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.

18905 lines
503KB

  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. @end table
  2941. @item slev
  2942. Set level of side signal. Default is 1.
  2943. Allowed range is from 0.015625 to 64.
  2944. @item sbal
  2945. Set balance of side signal. Default is 0.
  2946. Allowed range is from -1 to 1.
  2947. @item mlev
  2948. Set level of the middle signal. Default is 1.
  2949. Allowed range is from 0.015625 to 64.
  2950. @item mpan
  2951. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2952. @item base
  2953. Set stereo base between mono and inversed channels. Default is 0.
  2954. Allowed range is from -1 to 1.
  2955. @item delay
  2956. Set delay in milliseconds how much to delay left from right channel and
  2957. vice versa. Default is 0. Allowed range is from -20 to 20.
  2958. @item sclevel
  2959. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2960. @item phase
  2961. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2962. @item bmode_in, bmode_out
  2963. Set balance mode for balance_in/balance_out option.
  2964. Can be one of the following:
  2965. @table @samp
  2966. @item balance
  2967. Classic balance mode. Attenuate one channel at time.
  2968. Gain is raised up to 1.
  2969. @item amplitude
  2970. Similar as classic mode above but gain is raised up to 2.
  2971. @item power
  2972. Equal power distribution, from -6dB to +6dB range.
  2973. @end table
  2974. @end table
  2975. @subsection Examples
  2976. @itemize
  2977. @item
  2978. Apply karaoke like effect:
  2979. @example
  2980. stereotools=mlev=0.015625
  2981. @end example
  2982. @item
  2983. Convert M/S signal to L/R:
  2984. @example
  2985. "stereotools=mode=ms>lr"
  2986. @end example
  2987. @end itemize
  2988. @section stereowiden
  2989. This filter enhance the stereo effect by suppressing signal common to both
  2990. channels and by delaying the signal of left into right and vice versa,
  2991. thereby widening the stereo effect.
  2992. The filter accepts the following options:
  2993. @table @option
  2994. @item delay
  2995. Time in milliseconds of the delay of left signal into right and vice versa.
  2996. Default is 20 milliseconds.
  2997. @item feedback
  2998. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2999. effect of left signal in right output and vice versa which gives widening
  3000. effect. Default is 0.3.
  3001. @item crossfeed
  3002. Cross feed of left into right with inverted phase. This helps in suppressing
  3003. the mono. If the value is 1 it will cancel all the signal common to both
  3004. channels. Default is 0.3.
  3005. @item drymix
  3006. Set level of input signal of original channel. Default is 0.8.
  3007. @end table
  3008. @section surround
  3009. Apply audio surround upmix filter.
  3010. This filter allows to produce multichannel output from audio stream.
  3011. The filter accepts the following options:
  3012. @table @option
  3013. @item chl_out
  3014. Set output channel layout. By default, this is @var{5.1}.
  3015. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3016. for the required syntax.
  3017. @item chl_in
  3018. Set input channel layout. By default, this is @var{stereo}.
  3019. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3020. for the required syntax.
  3021. @item level_in
  3022. Set input volume level. By default, this is @var{1}.
  3023. @item level_out
  3024. Set output volume level. By default, this is @var{1}.
  3025. @item lfe
  3026. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3027. @item lfe_low
  3028. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3029. @item lfe_high
  3030. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3031. @end table
  3032. @section treble
  3033. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3034. shelving filter with a response similar to that of a standard
  3035. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3036. The filter accepts the following options:
  3037. @table @option
  3038. @item gain, g
  3039. Give the gain at whichever is the lower of ~22 kHz and the
  3040. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3041. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3042. @item frequency, f
  3043. Set the filter's central frequency and so can be used
  3044. to extend or reduce the frequency range to be boosted or cut.
  3045. The default value is @code{3000} Hz.
  3046. @item width_type, t
  3047. Set method to specify band-width of filter.
  3048. @table @option
  3049. @item h
  3050. Hz
  3051. @item q
  3052. Q-Factor
  3053. @item o
  3054. octave
  3055. @item s
  3056. slope
  3057. @end table
  3058. @item width, w
  3059. Determine how steep is the filter's shelf transition.
  3060. @item channels, c
  3061. Specify which channels to filter, by default all available are filtered.
  3062. @end table
  3063. @section tremolo
  3064. Sinusoidal amplitude modulation.
  3065. The filter accepts the following options:
  3066. @table @option
  3067. @item f
  3068. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3069. (20 Hz or lower) will result in a tremolo effect.
  3070. This filter may also be used as a ring modulator by specifying
  3071. a modulation frequency higher than 20 Hz.
  3072. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3073. @item d
  3074. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3075. Default value is 0.5.
  3076. @end table
  3077. @section vibrato
  3078. Sinusoidal phase modulation.
  3079. The filter accepts the following options:
  3080. @table @option
  3081. @item f
  3082. Modulation frequency in Hertz.
  3083. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3084. @item d
  3085. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3086. Default value is 0.5.
  3087. @end table
  3088. @section volume
  3089. Adjust the input audio volume.
  3090. It accepts the following parameters:
  3091. @table @option
  3092. @item volume
  3093. Set audio volume expression.
  3094. Output values are clipped to the maximum value.
  3095. The output audio volume is given by the relation:
  3096. @example
  3097. @var{output_volume} = @var{volume} * @var{input_volume}
  3098. @end example
  3099. The default value for @var{volume} is "1.0".
  3100. @item precision
  3101. This parameter represents the mathematical precision.
  3102. It determines which input sample formats will be allowed, which affects the
  3103. precision of the volume scaling.
  3104. @table @option
  3105. @item fixed
  3106. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3107. @item float
  3108. 32-bit floating-point; this limits input sample format to FLT. (default)
  3109. @item double
  3110. 64-bit floating-point; this limits input sample format to DBL.
  3111. @end table
  3112. @item replaygain
  3113. Choose the behaviour on encountering ReplayGain side data in input frames.
  3114. @table @option
  3115. @item drop
  3116. Remove ReplayGain side data, ignoring its contents (the default).
  3117. @item ignore
  3118. Ignore ReplayGain side data, but leave it in the frame.
  3119. @item track
  3120. Prefer the track gain, if present.
  3121. @item album
  3122. Prefer the album gain, if present.
  3123. @end table
  3124. @item replaygain_preamp
  3125. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3126. Default value for @var{replaygain_preamp} is 0.0.
  3127. @item eval
  3128. Set when the volume expression is evaluated.
  3129. It accepts the following values:
  3130. @table @samp
  3131. @item once
  3132. only evaluate expression once during the filter initialization, or
  3133. when the @samp{volume} command is sent
  3134. @item frame
  3135. evaluate expression for each incoming frame
  3136. @end table
  3137. Default value is @samp{once}.
  3138. @end table
  3139. The volume expression can contain the following parameters.
  3140. @table @option
  3141. @item n
  3142. frame number (starting at zero)
  3143. @item nb_channels
  3144. number of channels
  3145. @item nb_consumed_samples
  3146. number of samples consumed by the filter
  3147. @item nb_samples
  3148. number of samples in the current frame
  3149. @item pos
  3150. original frame position in the file
  3151. @item pts
  3152. frame PTS
  3153. @item sample_rate
  3154. sample rate
  3155. @item startpts
  3156. PTS at start of stream
  3157. @item startt
  3158. time at start of stream
  3159. @item t
  3160. frame time
  3161. @item tb
  3162. timestamp timebase
  3163. @item volume
  3164. last set volume value
  3165. @end table
  3166. Note that when @option{eval} is set to @samp{once} only the
  3167. @var{sample_rate} and @var{tb} variables are available, all other
  3168. variables will evaluate to NAN.
  3169. @subsection Commands
  3170. This filter supports the following commands:
  3171. @table @option
  3172. @item volume
  3173. Modify the volume expression.
  3174. The command accepts the same syntax of the corresponding option.
  3175. If the specified expression is not valid, it is kept at its current
  3176. value.
  3177. @item replaygain_noclip
  3178. Prevent clipping by limiting the gain applied.
  3179. Default value for @var{replaygain_noclip} is 1.
  3180. @end table
  3181. @subsection Examples
  3182. @itemize
  3183. @item
  3184. Halve the input audio volume:
  3185. @example
  3186. volume=volume=0.5
  3187. volume=volume=1/2
  3188. volume=volume=-6.0206dB
  3189. @end example
  3190. In all the above example the named key for @option{volume} can be
  3191. omitted, for example like in:
  3192. @example
  3193. volume=0.5
  3194. @end example
  3195. @item
  3196. Increase input audio power by 6 decibels using fixed-point precision:
  3197. @example
  3198. volume=volume=6dB:precision=fixed
  3199. @end example
  3200. @item
  3201. Fade volume after time 10 with an annihilation period of 5 seconds:
  3202. @example
  3203. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3204. @end example
  3205. @end itemize
  3206. @section volumedetect
  3207. Detect the volume of the input video.
  3208. The filter has no parameters. The input is not modified. Statistics about
  3209. the volume will be printed in the log when the input stream end is reached.
  3210. In particular it will show the mean volume (root mean square), maximum
  3211. volume (on a per-sample basis), and the beginning of a histogram of the
  3212. registered volume values (from the maximum value to a cumulated 1/1000 of
  3213. the samples).
  3214. All volumes are in decibels relative to the maximum PCM value.
  3215. @subsection Examples
  3216. Here is an excerpt of the output:
  3217. @example
  3218. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3219. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3220. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3221. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3222. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3223. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3224. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3225. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3226. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3227. @end example
  3228. It means that:
  3229. @itemize
  3230. @item
  3231. The mean square energy is approximately -27 dB, or 10^-2.7.
  3232. @item
  3233. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3234. @item
  3235. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3236. @end itemize
  3237. In other words, raising the volume by +4 dB does not cause any clipping,
  3238. raising it by +5 dB causes clipping for 6 samples, etc.
  3239. @c man end AUDIO FILTERS
  3240. @chapter Audio Sources
  3241. @c man begin AUDIO SOURCES
  3242. Below is a description of the currently available audio sources.
  3243. @section abuffer
  3244. Buffer audio frames, and make them available to the filter chain.
  3245. This source is mainly intended for a programmatic use, in particular
  3246. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3247. It accepts the following parameters:
  3248. @table @option
  3249. @item time_base
  3250. The timebase which will be used for timestamps of submitted frames. It must be
  3251. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3252. @item sample_rate
  3253. The sample rate of the incoming audio buffers.
  3254. @item sample_fmt
  3255. The sample format of the incoming audio buffers.
  3256. Either a sample format name or its corresponding integer representation from
  3257. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3258. @item channel_layout
  3259. The channel layout of the incoming audio buffers.
  3260. Either a channel layout name from channel_layout_map in
  3261. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3262. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3263. @item channels
  3264. The number of channels of the incoming audio buffers.
  3265. If both @var{channels} and @var{channel_layout} are specified, then they
  3266. must be consistent.
  3267. @end table
  3268. @subsection Examples
  3269. @example
  3270. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3271. @end example
  3272. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3273. Since the sample format with name "s16p" corresponds to the number
  3274. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3275. equivalent to:
  3276. @example
  3277. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3278. @end example
  3279. @section aevalsrc
  3280. Generate an audio signal specified by an expression.
  3281. This source accepts in input one or more expressions (one for each
  3282. channel), which are evaluated and used to generate a corresponding
  3283. audio signal.
  3284. This source accepts the following options:
  3285. @table @option
  3286. @item exprs
  3287. Set the '|'-separated expressions list for each separate channel. In case the
  3288. @option{channel_layout} option is not specified, the selected channel layout
  3289. depends on the number of provided expressions. Otherwise the last
  3290. specified expression is applied to the remaining output channels.
  3291. @item channel_layout, c
  3292. Set the channel layout. The number of channels in the specified layout
  3293. must be equal to the number of specified expressions.
  3294. @item duration, d
  3295. Set the minimum duration of the sourced audio. See
  3296. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3297. for the accepted syntax.
  3298. Note that the resulting duration may be greater than the specified
  3299. duration, as the generated audio is always cut at the end of a
  3300. complete frame.
  3301. If not specified, or the expressed duration is negative, the audio is
  3302. supposed to be generated forever.
  3303. @item nb_samples, n
  3304. Set the number of samples per channel per each output frame,
  3305. default to 1024.
  3306. @item sample_rate, s
  3307. Specify the sample rate, default to 44100.
  3308. @end table
  3309. Each expression in @var{exprs} can contain the following constants:
  3310. @table @option
  3311. @item n
  3312. number of the evaluated sample, starting from 0
  3313. @item t
  3314. time of the evaluated sample expressed in seconds, starting from 0
  3315. @item s
  3316. sample rate
  3317. @end table
  3318. @subsection Examples
  3319. @itemize
  3320. @item
  3321. Generate silence:
  3322. @example
  3323. aevalsrc=0
  3324. @end example
  3325. @item
  3326. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3327. 8000 Hz:
  3328. @example
  3329. aevalsrc="sin(440*2*PI*t):s=8000"
  3330. @end example
  3331. @item
  3332. Generate a two channels signal, specify the channel layout (Front
  3333. Center + Back Center) explicitly:
  3334. @example
  3335. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3336. @end example
  3337. @item
  3338. Generate white noise:
  3339. @example
  3340. aevalsrc="-2+random(0)"
  3341. @end example
  3342. @item
  3343. Generate an amplitude modulated signal:
  3344. @example
  3345. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3346. @end example
  3347. @item
  3348. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3349. @example
  3350. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3351. @end example
  3352. @end itemize
  3353. @section anullsrc
  3354. The null audio source, return unprocessed audio frames. It is mainly useful
  3355. as a template and to be employed in analysis / debugging tools, or as
  3356. the source for filters which ignore the input data (for example the sox
  3357. synth filter).
  3358. This source accepts the following options:
  3359. @table @option
  3360. @item channel_layout, cl
  3361. Specifies the channel layout, and can be either an integer or a string
  3362. representing a channel layout. The default value of @var{channel_layout}
  3363. is "stereo".
  3364. Check the channel_layout_map definition in
  3365. @file{libavutil/channel_layout.c} for the mapping between strings and
  3366. channel layout values.
  3367. @item sample_rate, r
  3368. Specifies the sample rate, and defaults to 44100.
  3369. @item nb_samples, n
  3370. Set the number of samples per requested frames.
  3371. @end table
  3372. @subsection Examples
  3373. @itemize
  3374. @item
  3375. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3376. @example
  3377. anullsrc=r=48000:cl=4
  3378. @end example
  3379. @item
  3380. Do the same operation with a more obvious syntax:
  3381. @example
  3382. anullsrc=r=48000:cl=mono
  3383. @end example
  3384. @end itemize
  3385. All the parameters need to be explicitly defined.
  3386. @section flite
  3387. Synthesize a voice utterance using the libflite library.
  3388. To enable compilation of this filter you need to configure FFmpeg with
  3389. @code{--enable-libflite}.
  3390. Note that the flite library is not thread-safe.
  3391. The filter accepts the following options:
  3392. @table @option
  3393. @item list_voices
  3394. If set to 1, list the names of the available voices and exit
  3395. immediately. Default value is 0.
  3396. @item nb_samples, n
  3397. Set the maximum number of samples per frame. Default value is 512.
  3398. @item textfile
  3399. Set the filename containing the text to speak.
  3400. @item text
  3401. Set the text to speak.
  3402. @item voice, v
  3403. Set the voice to use for the speech synthesis. Default value is
  3404. @code{kal}. See also the @var{list_voices} option.
  3405. @end table
  3406. @subsection Examples
  3407. @itemize
  3408. @item
  3409. Read from file @file{speech.txt}, and synthesize the text using the
  3410. standard flite voice:
  3411. @example
  3412. flite=textfile=speech.txt
  3413. @end example
  3414. @item
  3415. Read the specified text selecting the @code{slt} voice:
  3416. @example
  3417. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3418. @end example
  3419. @item
  3420. Input text to ffmpeg:
  3421. @example
  3422. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3423. @end example
  3424. @item
  3425. Make @file{ffplay} speak the specified text, using @code{flite} and
  3426. the @code{lavfi} device:
  3427. @example
  3428. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3429. @end example
  3430. @end itemize
  3431. For more information about libflite, check:
  3432. @url{http://www.speech.cs.cmu.edu/flite/}
  3433. @section anoisesrc
  3434. Generate a noise audio signal.
  3435. The filter accepts the following options:
  3436. @table @option
  3437. @item sample_rate, r
  3438. Specify the sample rate. Default value is 48000 Hz.
  3439. @item amplitude, a
  3440. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3441. is 1.0.
  3442. @item duration, d
  3443. Specify the duration of the generated audio stream. Not specifying this option
  3444. results in noise with an infinite length.
  3445. @item color, colour, c
  3446. Specify the color of noise. Available noise colors are white, pink, and brown.
  3447. Default color is white.
  3448. @item seed, s
  3449. Specify a value used to seed the PRNG.
  3450. @item nb_samples, n
  3451. Set the number of samples per each output frame, default is 1024.
  3452. @end table
  3453. @subsection Examples
  3454. @itemize
  3455. @item
  3456. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3457. @example
  3458. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3459. @end example
  3460. @end itemize
  3461. @section sine
  3462. Generate an audio signal made of a sine wave with amplitude 1/8.
  3463. The audio signal is bit-exact.
  3464. The filter accepts the following options:
  3465. @table @option
  3466. @item frequency, f
  3467. Set the carrier frequency. Default is 440 Hz.
  3468. @item beep_factor, b
  3469. Enable a periodic beep every second with frequency @var{beep_factor} times
  3470. the carrier frequency. Default is 0, meaning the beep is disabled.
  3471. @item sample_rate, r
  3472. Specify the sample rate, default is 44100.
  3473. @item duration, d
  3474. Specify the duration of the generated audio stream.
  3475. @item samples_per_frame
  3476. Set the number of samples per output frame.
  3477. The expression can contain the following constants:
  3478. @table @option
  3479. @item n
  3480. The (sequential) number of the output audio frame, starting from 0.
  3481. @item pts
  3482. The PTS (Presentation TimeStamp) of the output audio frame,
  3483. expressed in @var{TB} units.
  3484. @item t
  3485. The PTS of the output audio frame, expressed in seconds.
  3486. @item TB
  3487. The timebase of the output audio frames.
  3488. @end table
  3489. Default is @code{1024}.
  3490. @end table
  3491. @subsection Examples
  3492. @itemize
  3493. @item
  3494. Generate a simple 440 Hz sine wave:
  3495. @example
  3496. sine
  3497. @end example
  3498. @item
  3499. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3500. @example
  3501. sine=220:4:d=5
  3502. sine=f=220:b=4:d=5
  3503. sine=frequency=220:beep_factor=4:duration=5
  3504. @end example
  3505. @item
  3506. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3507. pattern:
  3508. @example
  3509. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3510. @end example
  3511. @end itemize
  3512. @c man end AUDIO SOURCES
  3513. @chapter Audio Sinks
  3514. @c man begin AUDIO SINKS
  3515. Below is a description of the currently available audio sinks.
  3516. @section abuffersink
  3517. Buffer audio frames, and make them available to the end of filter chain.
  3518. This sink is mainly intended for programmatic use, in particular
  3519. through the interface defined in @file{libavfilter/buffersink.h}
  3520. or the options system.
  3521. It accepts a pointer to an AVABufferSinkContext structure, which
  3522. defines the incoming buffers' formats, to be passed as the opaque
  3523. parameter to @code{avfilter_init_filter} for initialization.
  3524. @section anullsink
  3525. Null audio sink; do absolutely nothing with the input audio. It is
  3526. mainly useful as a template and for use in analysis / debugging
  3527. tools.
  3528. @c man end AUDIO SINKS
  3529. @chapter Video Filters
  3530. @c man begin VIDEO FILTERS
  3531. When you configure your FFmpeg build, you can disable any of the
  3532. existing filters using @code{--disable-filters}.
  3533. The configure output will show the video filters included in your
  3534. build.
  3535. Below is a description of the currently available video filters.
  3536. @section alphaextract
  3537. Extract the alpha component from the input as a grayscale video. This
  3538. is especially useful with the @var{alphamerge} filter.
  3539. @section alphamerge
  3540. Add or replace the alpha component of the primary input with the
  3541. grayscale value of a second input. This is intended for use with
  3542. @var{alphaextract} to allow the transmission or storage of frame
  3543. sequences that have alpha in a format that doesn't support an alpha
  3544. channel.
  3545. For example, to reconstruct full frames from a normal YUV-encoded video
  3546. and a separate video created with @var{alphaextract}, you might use:
  3547. @example
  3548. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3549. @end example
  3550. Since this filter is designed for reconstruction, it operates on frame
  3551. sequences without considering timestamps, and terminates when either
  3552. input reaches end of stream. This will cause problems if your encoding
  3553. pipeline drops frames. If you're trying to apply an image as an
  3554. overlay to a video stream, consider the @var{overlay} filter instead.
  3555. @section ass
  3556. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3557. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3558. Substation Alpha) subtitles files.
  3559. This filter accepts the following option in addition to the common options from
  3560. the @ref{subtitles} filter:
  3561. @table @option
  3562. @item shaping
  3563. Set the shaping engine
  3564. Available values are:
  3565. @table @samp
  3566. @item auto
  3567. The default libass shaping engine, which is the best available.
  3568. @item simple
  3569. Fast, font-agnostic shaper that can do only substitutions
  3570. @item complex
  3571. Slower shaper using OpenType for substitutions and positioning
  3572. @end table
  3573. The default is @code{auto}.
  3574. @end table
  3575. @section atadenoise
  3576. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3577. The filter accepts the following options:
  3578. @table @option
  3579. @item 0a
  3580. Set threshold A for 1st plane. Default is 0.02.
  3581. Valid range is 0 to 0.3.
  3582. @item 0b
  3583. Set threshold B for 1st plane. Default is 0.04.
  3584. Valid range is 0 to 5.
  3585. @item 1a
  3586. Set threshold A for 2nd plane. Default is 0.02.
  3587. Valid range is 0 to 0.3.
  3588. @item 1b
  3589. Set threshold B for 2nd plane. Default is 0.04.
  3590. Valid range is 0 to 5.
  3591. @item 2a
  3592. Set threshold A for 3rd plane. Default is 0.02.
  3593. Valid range is 0 to 0.3.
  3594. @item 2b
  3595. Set threshold B for 3rd plane. Default is 0.04.
  3596. Valid range is 0 to 5.
  3597. Threshold A is designed to react on abrupt changes in the input signal and
  3598. threshold B is designed to react on continuous changes in the input signal.
  3599. @item s
  3600. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3601. number in range [5, 129].
  3602. @item p
  3603. Set what planes of frame filter will use for averaging. Default is all.
  3604. @end table
  3605. @section avgblur
  3606. Apply average blur filter.
  3607. The filter accepts the following options:
  3608. @table @option
  3609. @item sizeX
  3610. Set horizontal kernel size.
  3611. @item planes
  3612. Set which planes to filter. By default all planes are filtered.
  3613. @item sizeY
  3614. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3615. Default is @code{0}.
  3616. @end table
  3617. @section bbox
  3618. Compute the bounding box for the non-black pixels in the input frame
  3619. luminance plane.
  3620. This filter computes the bounding box containing all the pixels with a
  3621. luminance value greater than the minimum allowed value.
  3622. The parameters describing the bounding box are printed on the filter
  3623. log.
  3624. The filter accepts the following option:
  3625. @table @option
  3626. @item min_val
  3627. Set the minimal luminance value. Default is @code{16}.
  3628. @end table
  3629. @section bitplanenoise
  3630. Show and measure bit plane noise.
  3631. The filter accepts the following options:
  3632. @table @option
  3633. @item bitplane
  3634. Set which plane to analyze. Default is @code{1}.
  3635. @item filter
  3636. Filter out noisy pixels from @code{bitplane} set above.
  3637. Default is disabled.
  3638. @end table
  3639. @section blackdetect
  3640. Detect video intervals that are (almost) completely black. Can be
  3641. useful to detect chapter transitions, commercials, or invalid
  3642. recordings. Output lines contains the time for the start, end and
  3643. duration of the detected black interval expressed in seconds.
  3644. In order to display the output lines, you need to set the loglevel at
  3645. least to the AV_LOG_INFO value.
  3646. The filter accepts the following options:
  3647. @table @option
  3648. @item black_min_duration, d
  3649. Set the minimum detected black duration expressed in seconds. It must
  3650. be a non-negative floating point number.
  3651. Default value is 2.0.
  3652. @item picture_black_ratio_th, pic_th
  3653. Set the threshold for considering a picture "black".
  3654. Express the minimum value for the ratio:
  3655. @example
  3656. @var{nb_black_pixels} / @var{nb_pixels}
  3657. @end example
  3658. for which a picture is considered black.
  3659. Default value is 0.98.
  3660. @item pixel_black_th, pix_th
  3661. Set the threshold for considering a pixel "black".
  3662. The threshold expresses the maximum pixel luminance value for which a
  3663. pixel is considered "black". The provided value is scaled according to
  3664. the following equation:
  3665. @example
  3666. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3667. @end example
  3668. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3669. the input video format, the range is [0-255] for YUV full-range
  3670. formats and [16-235] for YUV non full-range formats.
  3671. Default value is 0.10.
  3672. @end table
  3673. The following example sets the maximum pixel threshold to the minimum
  3674. value, and detects only black intervals of 2 or more seconds:
  3675. @example
  3676. blackdetect=d=2:pix_th=0.00
  3677. @end example
  3678. @section blackframe
  3679. Detect frames that are (almost) completely black. Can be useful to
  3680. detect chapter transitions or commercials. Output lines consist of
  3681. the frame number of the detected frame, the percentage of blackness,
  3682. the position in the file if known or -1 and the timestamp in seconds.
  3683. In order to display the output lines, you need to set the loglevel at
  3684. least to the AV_LOG_INFO value.
  3685. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3686. The value represents the percentage of pixels in the picture that
  3687. are below the threshold value.
  3688. It accepts the following parameters:
  3689. @table @option
  3690. @item amount
  3691. The percentage of the pixels that have to be below the threshold; it defaults to
  3692. @code{98}.
  3693. @item threshold, thresh
  3694. The threshold below which a pixel value is considered black; it defaults to
  3695. @code{32}.
  3696. @end table
  3697. @section blend, tblend
  3698. Blend two video frames into each other.
  3699. The @code{blend} filter takes two input streams and outputs one
  3700. stream, the first input is the "top" layer and second input is
  3701. "bottom" layer. By default, the output terminates when the longest input terminates.
  3702. The @code{tblend} (time blend) filter takes two consecutive frames
  3703. from one single stream, and outputs the result obtained by blending
  3704. the new frame on top of the old frame.
  3705. A description of the accepted options follows.
  3706. @table @option
  3707. @item c0_mode
  3708. @item c1_mode
  3709. @item c2_mode
  3710. @item c3_mode
  3711. @item all_mode
  3712. Set blend mode for specific pixel component or all pixel components in case
  3713. of @var{all_mode}. Default value is @code{normal}.
  3714. Available values for component modes are:
  3715. @table @samp
  3716. @item addition
  3717. @item addition128
  3718. @item and
  3719. @item average
  3720. @item burn
  3721. @item darken
  3722. @item difference
  3723. @item difference128
  3724. @item divide
  3725. @item dodge
  3726. @item freeze
  3727. @item exclusion
  3728. @item glow
  3729. @item hardlight
  3730. @item hardmix
  3731. @item heat
  3732. @item lighten
  3733. @item linearlight
  3734. @item multiply
  3735. @item multiply128
  3736. @item negation
  3737. @item normal
  3738. @item or
  3739. @item overlay
  3740. @item phoenix
  3741. @item pinlight
  3742. @item reflect
  3743. @item screen
  3744. @item softlight
  3745. @item subtract
  3746. @item vividlight
  3747. @item xor
  3748. @end table
  3749. @item c0_opacity
  3750. @item c1_opacity
  3751. @item c2_opacity
  3752. @item c3_opacity
  3753. @item all_opacity
  3754. Set blend opacity for specific pixel component or all pixel components in case
  3755. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3756. @item c0_expr
  3757. @item c1_expr
  3758. @item c2_expr
  3759. @item c3_expr
  3760. @item all_expr
  3761. Set blend expression for specific pixel component or all pixel components in case
  3762. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3763. The expressions can use the following variables:
  3764. @table @option
  3765. @item N
  3766. The sequential number of the filtered frame, starting from @code{0}.
  3767. @item X
  3768. @item Y
  3769. the coordinates of the current sample
  3770. @item W
  3771. @item H
  3772. the width and height of currently filtered plane
  3773. @item SW
  3774. @item SH
  3775. Width and height scale depending on the currently filtered plane. It is the
  3776. ratio between the corresponding luma plane number of pixels and the current
  3777. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3778. @code{0.5,0.5} for chroma planes.
  3779. @item T
  3780. Time of the current frame, expressed in seconds.
  3781. @item TOP, A
  3782. Value of pixel component at current location for first video frame (top layer).
  3783. @item BOTTOM, B
  3784. Value of pixel component at current location for second video frame (bottom layer).
  3785. @end table
  3786. @item shortest
  3787. Force termination when the shortest input terminates. Default is
  3788. @code{0}. This option is only defined for the @code{blend} filter.
  3789. @item repeatlast
  3790. Continue applying the last bottom frame after the end of the stream. A value of
  3791. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3792. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3793. @end table
  3794. @subsection Examples
  3795. @itemize
  3796. @item
  3797. Apply transition from bottom layer to top layer in first 10 seconds:
  3798. @example
  3799. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3800. @end example
  3801. @item
  3802. Apply 1x1 checkerboard effect:
  3803. @example
  3804. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3805. @end example
  3806. @item
  3807. Apply uncover left effect:
  3808. @example
  3809. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3810. @end example
  3811. @item
  3812. Apply uncover down effect:
  3813. @example
  3814. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3815. @end example
  3816. @item
  3817. Apply uncover up-left effect:
  3818. @example
  3819. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3820. @end example
  3821. @item
  3822. Split diagonally video and shows top and bottom layer on each side:
  3823. @example
  3824. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3825. @end example
  3826. @item
  3827. Display differences between the current and the previous frame:
  3828. @example
  3829. tblend=all_mode=difference128
  3830. @end example
  3831. @end itemize
  3832. @section boxblur
  3833. Apply a boxblur algorithm to the input video.
  3834. It accepts the following parameters:
  3835. @table @option
  3836. @item luma_radius, lr
  3837. @item luma_power, lp
  3838. @item chroma_radius, cr
  3839. @item chroma_power, cp
  3840. @item alpha_radius, ar
  3841. @item alpha_power, ap
  3842. @end table
  3843. A description of the accepted options follows.
  3844. @table @option
  3845. @item luma_radius, lr
  3846. @item chroma_radius, cr
  3847. @item alpha_radius, ar
  3848. Set an expression for the box radius in pixels used for blurring the
  3849. corresponding input plane.
  3850. The radius value must be a non-negative number, and must not be
  3851. greater than the value of the expression @code{min(w,h)/2} for the
  3852. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3853. planes.
  3854. Default value for @option{luma_radius} is "2". If not specified,
  3855. @option{chroma_radius} and @option{alpha_radius} default to the
  3856. corresponding value set for @option{luma_radius}.
  3857. The expressions can contain the following constants:
  3858. @table @option
  3859. @item w
  3860. @item h
  3861. The input width and height in pixels.
  3862. @item cw
  3863. @item ch
  3864. The input chroma image width and height in pixels.
  3865. @item hsub
  3866. @item vsub
  3867. The horizontal and vertical chroma subsample values. For example, for the
  3868. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3869. @end table
  3870. @item luma_power, lp
  3871. @item chroma_power, cp
  3872. @item alpha_power, ap
  3873. Specify how many times the boxblur filter is applied to the
  3874. corresponding plane.
  3875. Default value for @option{luma_power} is 2. If not specified,
  3876. @option{chroma_power} and @option{alpha_power} default to the
  3877. corresponding value set for @option{luma_power}.
  3878. A value of 0 will disable the effect.
  3879. @end table
  3880. @subsection Examples
  3881. @itemize
  3882. @item
  3883. Apply a boxblur filter with the luma, chroma, and alpha radii
  3884. set to 2:
  3885. @example
  3886. boxblur=luma_radius=2:luma_power=1
  3887. boxblur=2:1
  3888. @end example
  3889. @item
  3890. Set the luma radius to 2, and alpha and chroma radius to 0:
  3891. @example
  3892. boxblur=2:1:cr=0:ar=0
  3893. @end example
  3894. @item
  3895. Set the luma and chroma radii to a fraction of the video dimension:
  3896. @example
  3897. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3898. @end example
  3899. @end itemize
  3900. @section bwdif
  3901. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3902. Deinterlacing Filter").
  3903. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3904. interpolation algorithms.
  3905. It accepts the following parameters:
  3906. @table @option
  3907. @item mode
  3908. The interlacing mode to adopt. It accepts one of the following values:
  3909. @table @option
  3910. @item 0, send_frame
  3911. Output one frame for each frame.
  3912. @item 1, send_field
  3913. Output one frame for each field.
  3914. @end table
  3915. The default value is @code{send_field}.
  3916. @item parity
  3917. The picture field parity assumed for the input interlaced video. It accepts one
  3918. of the following values:
  3919. @table @option
  3920. @item 0, tff
  3921. Assume the top field is first.
  3922. @item 1, bff
  3923. Assume the bottom field is first.
  3924. @item -1, auto
  3925. Enable automatic detection of field parity.
  3926. @end table
  3927. The default value is @code{auto}.
  3928. If the interlacing is unknown or the decoder does not export this information,
  3929. top field first will be assumed.
  3930. @item deint
  3931. Specify which frames to deinterlace. Accept one of the following
  3932. values:
  3933. @table @option
  3934. @item 0, all
  3935. Deinterlace all frames.
  3936. @item 1, interlaced
  3937. Only deinterlace frames marked as interlaced.
  3938. @end table
  3939. The default value is @code{all}.
  3940. @end table
  3941. @section chromakey
  3942. YUV colorspace color/chroma keying.
  3943. The filter accepts the following options:
  3944. @table @option
  3945. @item color
  3946. The color which will be replaced with transparency.
  3947. @item similarity
  3948. Similarity percentage with the key color.
  3949. 0.01 matches only the exact key color, while 1.0 matches everything.
  3950. @item blend
  3951. Blend percentage.
  3952. 0.0 makes pixels either fully transparent, or not transparent at all.
  3953. Higher values result in semi-transparent pixels, with a higher transparency
  3954. the more similar the pixels color is to the key color.
  3955. @item yuv
  3956. Signals that the color passed is already in YUV instead of RGB.
  3957. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3958. This can be used to pass exact YUV values as hexadecimal numbers.
  3959. @end table
  3960. @subsection Examples
  3961. @itemize
  3962. @item
  3963. Make every green pixel in the input image transparent:
  3964. @example
  3965. ffmpeg -i input.png -vf chromakey=green out.png
  3966. @end example
  3967. @item
  3968. Overlay a greenscreen-video on top of a static black background.
  3969. @example
  3970. 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
  3971. @end example
  3972. @end itemize
  3973. @section ciescope
  3974. Display CIE color diagram with pixels overlaid onto it.
  3975. The filter accepts the following options:
  3976. @table @option
  3977. @item system
  3978. Set color system.
  3979. @table @samp
  3980. @item ntsc, 470m
  3981. @item ebu, 470bg
  3982. @item smpte
  3983. @item 240m
  3984. @item apple
  3985. @item widergb
  3986. @item cie1931
  3987. @item rec709, hdtv
  3988. @item uhdtv, rec2020
  3989. @end table
  3990. @item cie
  3991. Set CIE system.
  3992. @table @samp
  3993. @item xyy
  3994. @item ucs
  3995. @item luv
  3996. @end table
  3997. @item gamuts
  3998. Set what gamuts to draw.
  3999. See @code{system} option for available values.
  4000. @item size, s
  4001. Set ciescope size, by default set to 512.
  4002. @item intensity, i
  4003. Set intensity used to map input pixel values to CIE diagram.
  4004. @item contrast
  4005. Set contrast used to draw tongue colors that are out of active color system gamut.
  4006. @item corrgamma
  4007. Correct gamma displayed on scope, by default enabled.
  4008. @item showwhite
  4009. Show white point on CIE diagram, by default disabled.
  4010. @item gamma
  4011. Set input gamma. Used only with XYZ input color space.
  4012. @end table
  4013. @section codecview
  4014. Visualize information exported by some codecs.
  4015. Some codecs can export information through frames using side-data or other
  4016. means. For example, some MPEG based codecs export motion vectors through the
  4017. @var{export_mvs} flag in the codec @option{flags2} option.
  4018. The filter accepts the following option:
  4019. @table @option
  4020. @item mv
  4021. Set motion vectors to visualize.
  4022. Available flags for @var{mv} are:
  4023. @table @samp
  4024. @item pf
  4025. forward predicted MVs of P-frames
  4026. @item bf
  4027. forward predicted MVs of B-frames
  4028. @item bb
  4029. backward predicted MVs of B-frames
  4030. @end table
  4031. @item qp
  4032. Display quantization parameters using the chroma planes.
  4033. @item mv_type, mvt
  4034. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4035. Available flags for @var{mv_type} are:
  4036. @table @samp
  4037. @item fp
  4038. forward predicted MVs
  4039. @item bp
  4040. backward predicted MVs
  4041. @end table
  4042. @item frame_type, ft
  4043. Set frame type to visualize motion vectors of.
  4044. Available flags for @var{frame_type} are:
  4045. @table @samp
  4046. @item if
  4047. intra-coded frames (I-frames)
  4048. @item pf
  4049. predicted frames (P-frames)
  4050. @item bf
  4051. bi-directionally predicted frames (B-frames)
  4052. @end table
  4053. @end table
  4054. @subsection Examples
  4055. @itemize
  4056. @item
  4057. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4058. @example
  4059. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4060. @end example
  4061. @item
  4062. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4063. @example
  4064. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4065. @end example
  4066. @end itemize
  4067. @section colorbalance
  4068. Modify intensity of primary colors (red, green and blue) of input frames.
  4069. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4070. regions for the red-cyan, green-magenta or blue-yellow balance.
  4071. A positive adjustment value shifts the balance towards the primary color, a negative
  4072. value towards the complementary color.
  4073. The filter accepts the following options:
  4074. @table @option
  4075. @item rs
  4076. @item gs
  4077. @item bs
  4078. Adjust red, green and blue shadows (darkest pixels).
  4079. @item rm
  4080. @item gm
  4081. @item bm
  4082. Adjust red, green and blue midtones (medium pixels).
  4083. @item rh
  4084. @item gh
  4085. @item bh
  4086. Adjust red, green and blue highlights (brightest pixels).
  4087. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4088. @end table
  4089. @subsection Examples
  4090. @itemize
  4091. @item
  4092. Add red color cast to shadows:
  4093. @example
  4094. colorbalance=rs=.3
  4095. @end example
  4096. @end itemize
  4097. @section colorkey
  4098. RGB colorspace color keying.
  4099. The filter accepts the following options:
  4100. @table @option
  4101. @item color
  4102. The color which will be replaced with transparency.
  4103. @item similarity
  4104. Similarity percentage with the key color.
  4105. 0.01 matches only the exact key color, while 1.0 matches everything.
  4106. @item blend
  4107. Blend percentage.
  4108. 0.0 makes pixels either fully transparent, or not transparent at all.
  4109. Higher values result in semi-transparent pixels, with a higher transparency
  4110. the more similar the pixels color is to the key color.
  4111. @end table
  4112. @subsection Examples
  4113. @itemize
  4114. @item
  4115. Make every green pixel in the input image transparent:
  4116. @example
  4117. ffmpeg -i input.png -vf colorkey=green out.png
  4118. @end example
  4119. @item
  4120. Overlay a greenscreen-video on top of a static background image.
  4121. @example
  4122. 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
  4123. @end example
  4124. @end itemize
  4125. @section colorlevels
  4126. Adjust video input frames using levels.
  4127. The filter accepts the following options:
  4128. @table @option
  4129. @item rimin
  4130. @item gimin
  4131. @item bimin
  4132. @item aimin
  4133. Adjust red, green, blue and alpha input black point.
  4134. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4135. @item rimax
  4136. @item gimax
  4137. @item bimax
  4138. @item aimax
  4139. Adjust red, green, blue and alpha input white point.
  4140. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4141. Input levels are used to lighten highlights (bright tones), darken shadows
  4142. (dark tones), change the balance of bright and dark tones.
  4143. @item romin
  4144. @item gomin
  4145. @item bomin
  4146. @item aomin
  4147. Adjust red, green, blue and alpha output black point.
  4148. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4149. @item romax
  4150. @item gomax
  4151. @item bomax
  4152. @item aomax
  4153. Adjust red, green, blue and alpha output white point.
  4154. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4155. Output levels allows manual selection of a constrained output level range.
  4156. @end table
  4157. @subsection Examples
  4158. @itemize
  4159. @item
  4160. Make video output darker:
  4161. @example
  4162. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4163. @end example
  4164. @item
  4165. Increase contrast:
  4166. @example
  4167. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4168. @end example
  4169. @item
  4170. Make video output lighter:
  4171. @example
  4172. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4173. @end example
  4174. @item
  4175. Increase brightness:
  4176. @example
  4177. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4178. @end example
  4179. @end itemize
  4180. @section colorchannelmixer
  4181. Adjust video input frames by re-mixing color channels.
  4182. This filter modifies a color channel by adding the values associated to
  4183. the other channels of the same pixels. For example if the value to
  4184. modify is red, the output value will be:
  4185. @example
  4186. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4187. @end example
  4188. The filter accepts the following options:
  4189. @table @option
  4190. @item rr
  4191. @item rg
  4192. @item rb
  4193. @item ra
  4194. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4195. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4196. @item gr
  4197. @item gg
  4198. @item gb
  4199. @item ga
  4200. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4201. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4202. @item br
  4203. @item bg
  4204. @item bb
  4205. @item ba
  4206. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4207. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4208. @item ar
  4209. @item ag
  4210. @item ab
  4211. @item aa
  4212. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4213. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4214. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4215. @end table
  4216. @subsection Examples
  4217. @itemize
  4218. @item
  4219. Convert source to grayscale:
  4220. @example
  4221. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4222. @end example
  4223. @item
  4224. Simulate sepia tones:
  4225. @example
  4226. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4227. @end example
  4228. @end itemize
  4229. @section colormatrix
  4230. Convert color matrix.
  4231. The filter accepts the following options:
  4232. @table @option
  4233. @item src
  4234. @item dst
  4235. Specify the source and destination color matrix. Both values must be
  4236. specified.
  4237. The accepted values are:
  4238. @table @samp
  4239. @item bt709
  4240. BT.709
  4241. @item fcc
  4242. FCC
  4243. @item bt601
  4244. BT.601
  4245. @item bt470
  4246. BT.470
  4247. @item bt470bg
  4248. BT.470BG
  4249. @item smpte170m
  4250. SMPTE-170M
  4251. @item smpte240m
  4252. SMPTE-240M
  4253. @item bt2020
  4254. BT.2020
  4255. @end table
  4256. @end table
  4257. For example to convert from BT.601 to SMPTE-240M, use the command:
  4258. @example
  4259. colormatrix=bt601:smpte240m
  4260. @end example
  4261. @section colorspace
  4262. Convert colorspace, transfer characteristics or color primaries.
  4263. Input video needs to have an even size.
  4264. The filter accepts the following options:
  4265. @table @option
  4266. @anchor{all}
  4267. @item all
  4268. Specify all color properties at once.
  4269. The accepted values are:
  4270. @table @samp
  4271. @item bt470m
  4272. BT.470M
  4273. @item bt470bg
  4274. BT.470BG
  4275. @item bt601-6-525
  4276. BT.601-6 525
  4277. @item bt601-6-625
  4278. BT.601-6 625
  4279. @item bt709
  4280. BT.709
  4281. @item smpte170m
  4282. SMPTE-170M
  4283. @item smpte240m
  4284. SMPTE-240M
  4285. @item bt2020
  4286. BT.2020
  4287. @end table
  4288. @anchor{space}
  4289. @item space
  4290. Specify output colorspace.
  4291. The accepted values are:
  4292. @table @samp
  4293. @item bt709
  4294. BT.709
  4295. @item fcc
  4296. FCC
  4297. @item bt470bg
  4298. BT.470BG or BT.601-6 625
  4299. @item smpte170m
  4300. SMPTE-170M or BT.601-6 525
  4301. @item smpte240m
  4302. SMPTE-240M
  4303. @item ycgco
  4304. YCgCo
  4305. @item bt2020ncl
  4306. BT.2020 with non-constant luminance
  4307. @end table
  4308. @anchor{trc}
  4309. @item trc
  4310. Specify output transfer characteristics.
  4311. The accepted values are:
  4312. @table @samp
  4313. @item bt709
  4314. BT.709
  4315. @item bt470m
  4316. BT.470M
  4317. @item bt470bg
  4318. BT.470BG
  4319. @item gamma22
  4320. Constant gamma of 2.2
  4321. @item gamma28
  4322. Constant gamma of 2.8
  4323. @item smpte170m
  4324. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4325. @item smpte240m
  4326. SMPTE-240M
  4327. @item srgb
  4328. SRGB
  4329. @item iec61966-2-1
  4330. iec61966-2-1
  4331. @item iec61966-2-4
  4332. iec61966-2-4
  4333. @item xvycc
  4334. xvycc
  4335. @item bt2020-10
  4336. BT.2020 for 10-bits content
  4337. @item bt2020-12
  4338. BT.2020 for 12-bits content
  4339. @end table
  4340. @anchor{primaries}
  4341. @item primaries
  4342. Specify output color primaries.
  4343. The accepted values are:
  4344. @table @samp
  4345. @item bt709
  4346. BT.709
  4347. @item bt470m
  4348. BT.470M
  4349. @item bt470bg
  4350. BT.470BG or BT.601-6 625
  4351. @item smpte170m
  4352. SMPTE-170M or BT.601-6 525
  4353. @item smpte240m
  4354. SMPTE-240M
  4355. @item film
  4356. film
  4357. @item smpte431
  4358. SMPTE-431
  4359. @item smpte432
  4360. SMPTE-432
  4361. @item bt2020
  4362. BT.2020
  4363. @item jedec-p22
  4364. JEDEC P22 phosphors
  4365. @end table
  4366. @anchor{range}
  4367. @item range
  4368. Specify output color range.
  4369. The accepted values are:
  4370. @table @samp
  4371. @item tv
  4372. TV (restricted) range
  4373. @item mpeg
  4374. MPEG (restricted) range
  4375. @item pc
  4376. PC (full) range
  4377. @item jpeg
  4378. JPEG (full) range
  4379. @end table
  4380. @item format
  4381. Specify output color format.
  4382. The accepted values are:
  4383. @table @samp
  4384. @item yuv420p
  4385. YUV 4:2:0 planar 8-bits
  4386. @item yuv420p10
  4387. YUV 4:2:0 planar 10-bits
  4388. @item yuv420p12
  4389. YUV 4:2:0 planar 12-bits
  4390. @item yuv422p
  4391. YUV 4:2:2 planar 8-bits
  4392. @item yuv422p10
  4393. YUV 4:2:2 planar 10-bits
  4394. @item yuv422p12
  4395. YUV 4:2:2 planar 12-bits
  4396. @item yuv444p
  4397. YUV 4:4:4 planar 8-bits
  4398. @item yuv444p10
  4399. YUV 4:4:4 planar 10-bits
  4400. @item yuv444p12
  4401. YUV 4:4:4 planar 12-bits
  4402. @end table
  4403. @item fast
  4404. Do a fast conversion, which skips gamma/primary correction. This will take
  4405. significantly less CPU, but will be mathematically incorrect. To get output
  4406. compatible with that produced by the colormatrix filter, use fast=1.
  4407. @item dither
  4408. Specify dithering mode.
  4409. The accepted values are:
  4410. @table @samp
  4411. @item none
  4412. No dithering
  4413. @item fsb
  4414. Floyd-Steinberg dithering
  4415. @end table
  4416. @item wpadapt
  4417. Whitepoint adaptation mode.
  4418. The accepted values are:
  4419. @table @samp
  4420. @item bradford
  4421. Bradford whitepoint adaptation
  4422. @item vonkries
  4423. von Kries whitepoint adaptation
  4424. @item identity
  4425. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4426. @end table
  4427. @item iall
  4428. Override all input properties at once. Same accepted values as @ref{all}.
  4429. @item ispace
  4430. Override input colorspace. Same accepted values as @ref{space}.
  4431. @item iprimaries
  4432. Override input color primaries. Same accepted values as @ref{primaries}.
  4433. @item itrc
  4434. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4435. @item irange
  4436. Override input color range. Same accepted values as @ref{range}.
  4437. @end table
  4438. The filter converts the transfer characteristics, color space and color
  4439. primaries to the specified user values. The output value, if not specified,
  4440. is set to a default value based on the "all" property. If that property is
  4441. also not specified, the filter will log an error. The output color range and
  4442. format default to the same value as the input color range and format. The
  4443. input transfer characteristics, color space, color primaries and color range
  4444. should be set on the input data. If any of these are missing, the filter will
  4445. log an error and no conversion will take place.
  4446. For example to convert the input to SMPTE-240M, use the command:
  4447. @example
  4448. colorspace=smpte240m
  4449. @end example
  4450. @section convolution
  4451. Apply convolution 3x3 or 5x5 filter.
  4452. The filter accepts the following options:
  4453. @table @option
  4454. @item 0m
  4455. @item 1m
  4456. @item 2m
  4457. @item 3m
  4458. Set matrix for each plane.
  4459. Matrix is sequence of 9 or 25 signed integers.
  4460. @item 0rdiv
  4461. @item 1rdiv
  4462. @item 2rdiv
  4463. @item 3rdiv
  4464. Set multiplier for calculated value for each plane.
  4465. @item 0bias
  4466. @item 1bias
  4467. @item 2bias
  4468. @item 3bias
  4469. Set bias for each plane. This value is added to the result of the multiplication.
  4470. Useful for making the overall image brighter or darker. Default is 0.0.
  4471. @end table
  4472. @subsection Examples
  4473. @itemize
  4474. @item
  4475. Apply sharpen:
  4476. @example
  4477. 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"
  4478. @end example
  4479. @item
  4480. Apply blur:
  4481. @example
  4482. 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"
  4483. @end example
  4484. @item
  4485. Apply edge enhance:
  4486. @example
  4487. 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"
  4488. @end example
  4489. @item
  4490. Apply edge detect:
  4491. @example
  4492. 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"
  4493. @end example
  4494. @item
  4495. Apply emboss:
  4496. @example
  4497. 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"
  4498. @end example
  4499. @end itemize
  4500. @section copy
  4501. Copy the input video source unchanged to the output. This is mainly useful for
  4502. testing purposes.
  4503. @anchor{coreimage}
  4504. @section coreimage
  4505. Video filtering on GPU using Apple's CoreImage API on OSX.
  4506. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4507. processed by video hardware. However, software-based OpenGL implementations
  4508. exist which means there is no guarantee for hardware processing. It depends on
  4509. the respective OSX.
  4510. There are many filters and image generators provided by Apple that come with a
  4511. large variety of options. The filter has to be referenced by its name along
  4512. with its options.
  4513. The coreimage filter accepts the following options:
  4514. @table @option
  4515. @item list_filters
  4516. List all available filters and generators along with all their respective
  4517. options as well as possible minimum and maximum values along with the default
  4518. values.
  4519. @example
  4520. list_filters=true
  4521. @end example
  4522. @item filter
  4523. Specify all filters by their respective name and options.
  4524. Use @var{list_filters} to determine all valid filter names and options.
  4525. Numerical options are specified by a float value and are automatically clamped
  4526. to their respective value range. Vector and color options have to be specified
  4527. by a list of space separated float values. Character escaping has to be done.
  4528. A special option name @code{default} is available to use default options for a
  4529. filter.
  4530. It is required to specify either @code{default} or at least one of the filter options.
  4531. All omitted options are used with their default values.
  4532. The syntax of the filter string is as follows:
  4533. @example
  4534. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4535. @end example
  4536. @item output_rect
  4537. Specify a rectangle where the output of the filter chain is copied into the
  4538. input image. It is given by a list of space separated float values:
  4539. @example
  4540. output_rect=x\ y\ width\ height
  4541. @end example
  4542. If not given, the output rectangle equals the dimensions of the input image.
  4543. The output rectangle is automatically cropped at the borders of the input
  4544. image. Negative values are valid for each component.
  4545. @example
  4546. output_rect=25\ 25\ 100\ 100
  4547. @end example
  4548. @end table
  4549. Several filters can be chained for successive processing without GPU-HOST
  4550. transfers allowing for fast processing of complex filter chains.
  4551. Currently, only filters with zero (generators) or exactly one (filters) input
  4552. image and one output image are supported. Also, transition filters are not yet
  4553. usable as intended.
  4554. Some filters generate output images with additional padding depending on the
  4555. respective filter kernel. The padding is automatically removed to ensure the
  4556. filter output has the same size as the input image.
  4557. For image generators, the size of the output image is determined by the
  4558. previous output image of the filter chain or the input image of the whole
  4559. filterchain, respectively. The generators do not use the pixel information of
  4560. this image to generate their output. However, the generated output is
  4561. blended onto this image, resulting in partial or complete coverage of the
  4562. output image.
  4563. The @ref{coreimagesrc} video source can be used for generating input images
  4564. which are directly fed into the filter chain. By using it, providing input
  4565. images by another video source or an input video is not required.
  4566. @subsection Examples
  4567. @itemize
  4568. @item
  4569. List all filters available:
  4570. @example
  4571. coreimage=list_filters=true
  4572. @end example
  4573. @item
  4574. Use the CIBoxBlur filter with default options to blur an image:
  4575. @example
  4576. coreimage=filter=CIBoxBlur@@default
  4577. @end example
  4578. @item
  4579. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4580. its center at 100x100 and a radius of 50 pixels:
  4581. @example
  4582. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4583. @end example
  4584. @item
  4585. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4586. given as complete and escaped command-line for Apple's standard bash shell:
  4587. @example
  4588. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4589. @end example
  4590. @end itemize
  4591. @section crop
  4592. Crop the input video to given dimensions.
  4593. It accepts the following parameters:
  4594. @table @option
  4595. @item w, out_w
  4596. The width of the output video. It defaults to @code{iw}.
  4597. This expression is evaluated only once during the filter
  4598. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4599. @item h, out_h
  4600. The height of the output video. It defaults to @code{ih}.
  4601. This expression is evaluated only once during the filter
  4602. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4603. @item x
  4604. The horizontal position, in the input video, of the left edge of the output
  4605. video. It defaults to @code{(in_w-out_w)/2}.
  4606. This expression is evaluated per-frame.
  4607. @item y
  4608. The vertical position, in the input video, of the top edge of the output video.
  4609. It defaults to @code{(in_h-out_h)/2}.
  4610. This expression is evaluated per-frame.
  4611. @item keep_aspect
  4612. If set to 1 will force the output display aspect ratio
  4613. to be the same of the input, by changing the output sample aspect
  4614. ratio. It defaults to 0.
  4615. @item exact
  4616. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4617. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4618. It defaults to 0.
  4619. @end table
  4620. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4621. expressions containing the following constants:
  4622. @table @option
  4623. @item x
  4624. @item y
  4625. The computed values for @var{x} and @var{y}. They are evaluated for
  4626. each new frame.
  4627. @item in_w
  4628. @item in_h
  4629. The input width and height.
  4630. @item iw
  4631. @item ih
  4632. These are the same as @var{in_w} and @var{in_h}.
  4633. @item out_w
  4634. @item out_h
  4635. The output (cropped) width and height.
  4636. @item ow
  4637. @item oh
  4638. These are the same as @var{out_w} and @var{out_h}.
  4639. @item a
  4640. same as @var{iw} / @var{ih}
  4641. @item sar
  4642. input sample aspect ratio
  4643. @item dar
  4644. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4645. @item hsub
  4646. @item vsub
  4647. horizontal and vertical chroma subsample values. For example for the
  4648. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4649. @item n
  4650. The number of the input frame, starting from 0.
  4651. @item pos
  4652. the position in the file of the input frame, NAN if unknown
  4653. @item t
  4654. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4655. @end table
  4656. The expression for @var{out_w} may depend on the value of @var{out_h},
  4657. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4658. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4659. evaluated after @var{out_w} and @var{out_h}.
  4660. The @var{x} and @var{y} parameters specify the expressions for the
  4661. position of the top-left corner of the output (non-cropped) area. They
  4662. are evaluated for each frame. If the evaluated value is not valid, it
  4663. is approximated to the nearest valid value.
  4664. The expression for @var{x} may depend on @var{y}, and the expression
  4665. for @var{y} may depend on @var{x}.
  4666. @subsection Examples
  4667. @itemize
  4668. @item
  4669. Crop area with size 100x100 at position (12,34).
  4670. @example
  4671. crop=100:100:12:34
  4672. @end example
  4673. Using named options, the example above becomes:
  4674. @example
  4675. crop=w=100:h=100:x=12:y=34
  4676. @end example
  4677. @item
  4678. Crop the central input area with size 100x100:
  4679. @example
  4680. crop=100:100
  4681. @end example
  4682. @item
  4683. Crop the central input area with size 2/3 of the input video:
  4684. @example
  4685. crop=2/3*in_w:2/3*in_h
  4686. @end example
  4687. @item
  4688. Crop the input video central square:
  4689. @example
  4690. crop=out_w=in_h
  4691. crop=in_h
  4692. @end example
  4693. @item
  4694. Delimit the rectangle with the top-left corner placed at position
  4695. 100:100 and the right-bottom corner corresponding to the right-bottom
  4696. corner of the input image.
  4697. @example
  4698. crop=in_w-100:in_h-100:100:100
  4699. @end example
  4700. @item
  4701. Crop 10 pixels from the left and right borders, and 20 pixels from
  4702. the top and bottom borders
  4703. @example
  4704. crop=in_w-2*10:in_h-2*20
  4705. @end example
  4706. @item
  4707. Keep only the bottom right quarter of the input image:
  4708. @example
  4709. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4710. @end example
  4711. @item
  4712. Crop height for getting Greek harmony:
  4713. @example
  4714. crop=in_w:1/PHI*in_w
  4715. @end example
  4716. @item
  4717. Apply trembling effect:
  4718. @example
  4719. 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)
  4720. @end example
  4721. @item
  4722. Apply erratic camera effect depending on timestamp:
  4723. @example
  4724. 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)"
  4725. @end example
  4726. @item
  4727. Set x depending on the value of y:
  4728. @example
  4729. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4730. @end example
  4731. @end itemize
  4732. @subsection Commands
  4733. This filter supports the following commands:
  4734. @table @option
  4735. @item w, out_w
  4736. @item h, out_h
  4737. @item x
  4738. @item y
  4739. Set width/height of the output video and the horizontal/vertical position
  4740. in the input video.
  4741. The command accepts the same syntax of the corresponding option.
  4742. If the specified expression is not valid, it is kept at its current
  4743. value.
  4744. @end table
  4745. @section cropdetect
  4746. Auto-detect the crop size.
  4747. It calculates the necessary cropping parameters and prints the
  4748. recommended parameters via the logging system. The detected dimensions
  4749. correspond to the non-black area of the input video.
  4750. It accepts the following parameters:
  4751. @table @option
  4752. @item limit
  4753. Set higher black value threshold, which can be optionally specified
  4754. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4755. value greater to the set value is considered non-black. It defaults to 24.
  4756. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4757. on the bitdepth of the pixel format.
  4758. @item round
  4759. The value which the width/height should be divisible by. It defaults to
  4760. 16. The offset is automatically adjusted to center the video. Use 2 to
  4761. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4762. encoding to most video codecs.
  4763. @item reset_count, reset
  4764. Set the counter that determines after how many frames cropdetect will
  4765. reset the previously detected largest video area and start over to
  4766. detect the current optimal crop area. Default value is 0.
  4767. This can be useful when channel logos distort the video area. 0
  4768. indicates 'never reset', and returns the largest area encountered during
  4769. playback.
  4770. @end table
  4771. @anchor{curves}
  4772. @section curves
  4773. Apply color adjustments using curves.
  4774. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4775. component (red, green and blue) has its values defined by @var{N} key points
  4776. tied from each other using a smooth curve. The x-axis represents the pixel
  4777. values from the input frame, and the y-axis the new pixel values to be set for
  4778. the output frame.
  4779. By default, a component curve is defined by the two points @var{(0;0)} and
  4780. @var{(1;1)}. This creates a straight line where each original pixel value is
  4781. "adjusted" to its own value, which means no change to the image.
  4782. The filter allows you to redefine these two points and add some more. A new
  4783. curve (using a natural cubic spline interpolation) will be define to pass
  4784. smoothly through all these new coordinates. The new defined points needs to be
  4785. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4786. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4787. the vector spaces, the values will be clipped accordingly.
  4788. The filter accepts the following options:
  4789. @table @option
  4790. @item preset
  4791. Select one of the available color presets. This option can be used in addition
  4792. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4793. options takes priority on the preset values.
  4794. Available presets are:
  4795. @table @samp
  4796. @item none
  4797. @item color_negative
  4798. @item cross_process
  4799. @item darker
  4800. @item increase_contrast
  4801. @item lighter
  4802. @item linear_contrast
  4803. @item medium_contrast
  4804. @item negative
  4805. @item strong_contrast
  4806. @item vintage
  4807. @end table
  4808. Default is @code{none}.
  4809. @item master, m
  4810. Set the master key points. These points will define a second pass mapping. It
  4811. is sometimes called a "luminance" or "value" mapping. It can be used with
  4812. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4813. post-processing LUT.
  4814. @item red, r
  4815. Set the key points for the red component.
  4816. @item green, g
  4817. Set the key points for the green component.
  4818. @item blue, b
  4819. Set the key points for the blue component.
  4820. @item all
  4821. Set the key points for all components (not including master).
  4822. Can be used in addition to the other key points component
  4823. options. In this case, the unset component(s) will fallback on this
  4824. @option{all} setting.
  4825. @item psfile
  4826. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4827. @item plot
  4828. Save Gnuplot script of the curves in specified file.
  4829. @end table
  4830. To avoid some filtergraph syntax conflicts, each key points list need to be
  4831. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4832. @subsection Examples
  4833. @itemize
  4834. @item
  4835. Increase slightly the middle level of blue:
  4836. @example
  4837. curves=blue='0/0 0.5/0.58 1/1'
  4838. @end example
  4839. @item
  4840. Vintage effect:
  4841. @example
  4842. 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'
  4843. @end example
  4844. Here we obtain the following coordinates for each components:
  4845. @table @var
  4846. @item red
  4847. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4848. @item green
  4849. @code{(0;0) (0.50;0.48) (1;1)}
  4850. @item blue
  4851. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4852. @end table
  4853. @item
  4854. The previous example can also be achieved with the associated built-in preset:
  4855. @example
  4856. curves=preset=vintage
  4857. @end example
  4858. @item
  4859. Or simply:
  4860. @example
  4861. curves=vintage
  4862. @end example
  4863. @item
  4864. Use a Photoshop preset and redefine the points of the green component:
  4865. @example
  4866. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4867. @end example
  4868. @item
  4869. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4870. and @command{gnuplot}:
  4871. @example
  4872. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4873. gnuplot -p /tmp/curves.plt
  4874. @end example
  4875. @end itemize
  4876. @section datascope
  4877. Video data analysis filter.
  4878. This filter shows hexadecimal pixel values of part of video.
  4879. The filter accepts the following options:
  4880. @table @option
  4881. @item size, s
  4882. Set output video size.
  4883. @item x
  4884. Set x offset from where to pick pixels.
  4885. @item y
  4886. Set y offset from where to pick pixels.
  4887. @item mode
  4888. Set scope mode, can be one of the following:
  4889. @table @samp
  4890. @item mono
  4891. Draw hexadecimal pixel values with white color on black background.
  4892. @item color
  4893. Draw hexadecimal pixel values with input video pixel color on black
  4894. background.
  4895. @item color2
  4896. Draw hexadecimal pixel values on color background picked from input video,
  4897. the text color is picked in such way so its always visible.
  4898. @end table
  4899. @item axis
  4900. Draw rows and columns numbers on left and top of video.
  4901. @item opacity
  4902. Set background opacity.
  4903. @end table
  4904. @section dctdnoiz
  4905. Denoise frames using 2D DCT (frequency domain filtering).
  4906. This filter is not designed for real time.
  4907. The filter accepts the following options:
  4908. @table @option
  4909. @item sigma, s
  4910. Set the noise sigma constant.
  4911. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4912. coefficient (absolute value) below this threshold with be dropped.
  4913. If you need a more advanced filtering, see @option{expr}.
  4914. Default is @code{0}.
  4915. @item overlap
  4916. Set number overlapping pixels for each block. Since the filter can be slow, you
  4917. may want to reduce this value, at the cost of a less effective filter and the
  4918. risk of various artefacts.
  4919. If the overlapping value doesn't permit processing the whole input width or
  4920. height, a warning will be displayed and according borders won't be denoised.
  4921. Default value is @var{blocksize}-1, which is the best possible setting.
  4922. @item expr, e
  4923. Set the coefficient factor expression.
  4924. For each coefficient of a DCT block, this expression will be evaluated as a
  4925. multiplier value for the coefficient.
  4926. If this is option is set, the @option{sigma} option will be ignored.
  4927. The absolute value of the coefficient can be accessed through the @var{c}
  4928. variable.
  4929. @item n
  4930. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4931. @var{blocksize}, which is the width and height of the processed blocks.
  4932. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4933. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4934. on the speed processing. Also, a larger block size does not necessarily means a
  4935. better de-noising.
  4936. @end table
  4937. @subsection Examples
  4938. Apply a denoise with a @option{sigma} of @code{4.5}:
  4939. @example
  4940. dctdnoiz=4.5
  4941. @end example
  4942. The same operation can be achieved using the expression system:
  4943. @example
  4944. dctdnoiz=e='gte(c, 4.5*3)'
  4945. @end example
  4946. Violent denoise using a block size of @code{16x16}:
  4947. @example
  4948. dctdnoiz=15:n=4
  4949. @end example
  4950. @section deband
  4951. Remove banding artifacts from input video.
  4952. It works by replacing banded pixels with average value of referenced pixels.
  4953. The filter accepts the following options:
  4954. @table @option
  4955. @item 1thr
  4956. @item 2thr
  4957. @item 3thr
  4958. @item 4thr
  4959. Set banding detection threshold for each plane. Default is 0.02.
  4960. Valid range is 0.00003 to 0.5.
  4961. If difference between current pixel and reference pixel is less than threshold,
  4962. it will be considered as banded.
  4963. @item range, r
  4964. Banding detection range in pixels. Default is 16. If positive, random number
  4965. in range 0 to set value will be used. If negative, exact absolute value
  4966. will be used.
  4967. The range defines square of four pixels around current pixel.
  4968. @item direction, d
  4969. Set direction in radians from which four pixel will be compared. If positive,
  4970. random direction from 0 to set direction will be picked. If negative, exact of
  4971. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4972. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4973. column.
  4974. @item blur, b
  4975. If enabled, current pixel is compared with average value of all four
  4976. surrounding pixels. The default is enabled. If disabled current pixel is
  4977. compared with all four surrounding pixels. The pixel is considered banded
  4978. if only all four differences with surrounding pixels are less than threshold.
  4979. @item coupling, c
  4980. If enabled, current pixel is changed if and only if all pixel components are banded,
  4981. e.g. banding detection threshold is triggered for all color components.
  4982. The default is disabled.
  4983. @end table
  4984. @anchor{decimate}
  4985. @section decimate
  4986. Drop duplicated frames at regular intervals.
  4987. The filter accepts the following options:
  4988. @table @option
  4989. @item cycle
  4990. Set the number of frames from which one will be dropped. Setting this to
  4991. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4992. Default is @code{5}.
  4993. @item dupthresh
  4994. Set the threshold for duplicate detection. If the difference metric for a frame
  4995. is less than or equal to this value, then it is declared as duplicate. Default
  4996. is @code{1.1}
  4997. @item scthresh
  4998. Set scene change threshold. Default is @code{15}.
  4999. @item blockx
  5000. @item blocky
  5001. Set the size of the x and y-axis blocks used during metric calculations.
  5002. Larger blocks give better noise suppression, but also give worse detection of
  5003. small movements. Must be a power of two. Default is @code{32}.
  5004. @item ppsrc
  5005. Mark main input as a pre-processed input and activate clean source input
  5006. stream. This allows the input to be pre-processed with various filters to help
  5007. the metrics calculation while keeping the frame selection lossless. When set to
  5008. @code{1}, the first stream is for the pre-processed input, and the second
  5009. stream is the clean source from where the kept frames are chosen. Default is
  5010. @code{0}.
  5011. @item chroma
  5012. Set whether or not chroma is considered in the metric calculations. Default is
  5013. @code{1}.
  5014. @end table
  5015. @section deflate
  5016. Apply deflate effect to the video.
  5017. This filter replaces the pixel by the local(3x3) average by taking into account
  5018. only values lower than the pixel.
  5019. It accepts the following options:
  5020. @table @option
  5021. @item threshold0
  5022. @item threshold1
  5023. @item threshold2
  5024. @item threshold3
  5025. Limit the maximum change for each plane, default is 65535.
  5026. If 0, plane will remain unchanged.
  5027. @end table
  5028. @section deflicker
  5029. Remove temporal frame luminance variations.
  5030. It accepts the following options:
  5031. @table @option
  5032. @item size, s
  5033. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5034. @item mode, m
  5035. Set averaging mode to smooth temporal luminance variations.
  5036. Available values are:
  5037. @table @samp
  5038. @item am
  5039. Arithmetic mean
  5040. @item gm
  5041. Geometric mean
  5042. @item hm
  5043. Harmonic mean
  5044. @item qm
  5045. Quadratic mean
  5046. @item cm
  5047. Cubic mean
  5048. @item pm
  5049. Power mean
  5050. @item median
  5051. Median
  5052. @end table
  5053. @item bypass
  5054. Do not actually modify frame. Useful when one only wants metadata.
  5055. @end table
  5056. @section dejudder
  5057. Remove judder produced by partially interlaced telecined content.
  5058. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5059. source was partially telecined content then the output of @code{pullup,dejudder}
  5060. will have a variable frame rate. May change the recorded frame rate of the
  5061. container. Aside from that change, this filter will not affect constant frame
  5062. rate video.
  5063. The option available in this filter is:
  5064. @table @option
  5065. @item cycle
  5066. Specify the length of the window over which the judder repeats.
  5067. Accepts any integer greater than 1. Useful values are:
  5068. @table @samp
  5069. @item 4
  5070. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5071. @item 5
  5072. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5073. @item 20
  5074. If a mixture of the two.
  5075. @end table
  5076. The default is @samp{4}.
  5077. @end table
  5078. @section delogo
  5079. Suppress a TV station logo by a simple interpolation of the surrounding
  5080. pixels. Just set a rectangle covering the logo and watch it disappear
  5081. (and sometimes something even uglier appear - your mileage may vary).
  5082. It accepts the following parameters:
  5083. @table @option
  5084. @item x
  5085. @item y
  5086. Specify the top left corner coordinates of the logo. They must be
  5087. specified.
  5088. @item w
  5089. @item h
  5090. Specify the width and height of the logo to clear. They must be
  5091. specified.
  5092. @item band, t
  5093. Specify the thickness of the fuzzy edge of the rectangle (added to
  5094. @var{w} and @var{h}). The default value is 1. This option is
  5095. deprecated, setting higher values should no longer be necessary and
  5096. is not recommended.
  5097. @item show
  5098. When set to 1, a green rectangle is drawn on the screen to simplify
  5099. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5100. The default value is 0.
  5101. The rectangle is drawn on the outermost pixels which will be (partly)
  5102. replaced with interpolated values. The values of the next pixels
  5103. immediately outside this rectangle in each direction will be used to
  5104. compute the interpolated pixel values inside the rectangle.
  5105. @end table
  5106. @subsection Examples
  5107. @itemize
  5108. @item
  5109. Set a rectangle covering the area with top left corner coordinates 0,0
  5110. and size 100x77, and a band of size 10:
  5111. @example
  5112. delogo=x=0:y=0:w=100:h=77:band=10
  5113. @end example
  5114. @end itemize
  5115. @section deshake
  5116. Attempt to fix small changes in horizontal and/or vertical shift. This
  5117. filter helps remove camera shake from hand-holding a camera, bumping a
  5118. tripod, moving on a vehicle, etc.
  5119. The filter accepts the following options:
  5120. @table @option
  5121. @item x
  5122. @item y
  5123. @item w
  5124. @item h
  5125. Specify a rectangular area where to limit the search for motion
  5126. vectors.
  5127. If desired the search for motion vectors can be limited to a
  5128. rectangular area of the frame defined by its top left corner, width
  5129. and height. These parameters have the same meaning as the drawbox
  5130. filter which can be used to visualise the position of the bounding
  5131. box.
  5132. This is useful when simultaneous movement of subjects within the frame
  5133. might be confused for camera motion by the motion vector search.
  5134. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5135. then the full frame is used. This allows later options to be set
  5136. without specifying the bounding box for the motion vector search.
  5137. Default - search the whole frame.
  5138. @item rx
  5139. @item ry
  5140. Specify the maximum extent of movement in x and y directions in the
  5141. range 0-64 pixels. Default 16.
  5142. @item edge
  5143. Specify how to generate pixels to fill blanks at the edge of the
  5144. frame. Available values are:
  5145. @table @samp
  5146. @item blank, 0
  5147. Fill zeroes at blank locations
  5148. @item original, 1
  5149. Original image at blank locations
  5150. @item clamp, 2
  5151. Extruded edge value at blank locations
  5152. @item mirror, 3
  5153. Mirrored edge at blank locations
  5154. @end table
  5155. Default value is @samp{mirror}.
  5156. @item blocksize
  5157. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5158. default 8.
  5159. @item contrast
  5160. Specify the contrast threshold for blocks. Only blocks with more than
  5161. the specified contrast (difference between darkest and lightest
  5162. pixels) will be considered. Range 1-255, default 125.
  5163. @item search
  5164. Specify the search strategy. Available values are:
  5165. @table @samp
  5166. @item exhaustive, 0
  5167. Set exhaustive search
  5168. @item less, 1
  5169. Set less exhaustive search.
  5170. @end table
  5171. Default value is @samp{exhaustive}.
  5172. @item filename
  5173. If set then a detailed log of the motion search is written to the
  5174. specified file.
  5175. @item opencl
  5176. If set to 1, specify using OpenCL capabilities, only available if
  5177. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5178. @end table
  5179. @section detelecine
  5180. Apply an exact inverse of the telecine operation. It requires a predefined
  5181. pattern specified using the pattern option which must be the same as that passed
  5182. to the telecine filter.
  5183. This filter accepts the following options:
  5184. @table @option
  5185. @item first_field
  5186. @table @samp
  5187. @item top, t
  5188. top field first
  5189. @item bottom, b
  5190. bottom field first
  5191. The default value is @code{top}.
  5192. @end table
  5193. @item pattern
  5194. A string of numbers representing the pulldown pattern you wish to apply.
  5195. The default value is @code{23}.
  5196. @item start_frame
  5197. A number representing position of the first frame with respect to the telecine
  5198. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5199. @end table
  5200. @section dilation
  5201. Apply dilation effect to the video.
  5202. This filter replaces the pixel by the local(3x3) maximum.
  5203. It accepts the following options:
  5204. @table @option
  5205. @item threshold0
  5206. @item threshold1
  5207. @item threshold2
  5208. @item threshold3
  5209. Limit the maximum change for each plane, default is 65535.
  5210. If 0, plane will remain unchanged.
  5211. @item coordinates
  5212. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5213. pixels are used.
  5214. Flags to local 3x3 coordinates maps like this:
  5215. 1 2 3
  5216. 4 5
  5217. 6 7 8
  5218. @end table
  5219. @section displace
  5220. Displace pixels as indicated by second and third input stream.
  5221. It takes three input streams and outputs one stream, the first input is the
  5222. source, and second and third input are displacement maps.
  5223. The second input specifies how much to displace pixels along the
  5224. x-axis, while the third input specifies how much to displace pixels
  5225. along the y-axis.
  5226. If one of displacement map streams terminates, last frame from that
  5227. displacement map will be used.
  5228. Note that once generated, displacements maps can be reused over and over again.
  5229. A description of the accepted options follows.
  5230. @table @option
  5231. @item edge
  5232. Set displace behavior for pixels that are out of range.
  5233. Available values are:
  5234. @table @samp
  5235. @item blank
  5236. Missing pixels are replaced by black pixels.
  5237. @item smear
  5238. Adjacent pixels will spread out to replace missing pixels.
  5239. @item wrap
  5240. Out of range pixels are wrapped so they point to pixels of other side.
  5241. @end table
  5242. Default is @samp{smear}.
  5243. @end table
  5244. @subsection Examples
  5245. @itemize
  5246. @item
  5247. Add ripple effect to rgb input of video size hd720:
  5248. @example
  5249. 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
  5250. @end example
  5251. @item
  5252. Add wave effect to rgb input of video size hd720:
  5253. @example
  5254. 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
  5255. @end example
  5256. @end itemize
  5257. @section drawbox
  5258. Draw a colored box on the input image.
  5259. It accepts the following parameters:
  5260. @table @option
  5261. @item x
  5262. @item y
  5263. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5264. @item width, w
  5265. @item height, h
  5266. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5267. the input width and height. It defaults to 0.
  5268. @item color, c
  5269. Specify the color of the box to write. For the general syntax of this option,
  5270. check the "Color" section in the ffmpeg-utils manual. If the special
  5271. value @code{invert} is used, the box edge color is the same as the
  5272. video with inverted luma.
  5273. @item thickness, t
  5274. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5275. See below for the list of accepted constants.
  5276. @end table
  5277. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5278. following constants:
  5279. @table @option
  5280. @item dar
  5281. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5282. @item hsub
  5283. @item vsub
  5284. horizontal and vertical chroma subsample values. For example for the
  5285. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5286. @item in_h, ih
  5287. @item in_w, iw
  5288. The input width and height.
  5289. @item sar
  5290. The input sample aspect ratio.
  5291. @item x
  5292. @item y
  5293. The x and y offset coordinates where the box is drawn.
  5294. @item w
  5295. @item h
  5296. The width and height of the drawn box.
  5297. @item t
  5298. The thickness of the drawn box.
  5299. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5300. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5301. @end table
  5302. @subsection Examples
  5303. @itemize
  5304. @item
  5305. Draw a black box around the edge of the input image:
  5306. @example
  5307. drawbox
  5308. @end example
  5309. @item
  5310. Draw a box with color red and an opacity of 50%:
  5311. @example
  5312. drawbox=10:20:200:60:red@@0.5
  5313. @end example
  5314. The previous example can be specified as:
  5315. @example
  5316. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5317. @end example
  5318. @item
  5319. Fill the box with pink color:
  5320. @example
  5321. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5322. @end example
  5323. @item
  5324. Draw a 2-pixel red 2.40:1 mask:
  5325. @example
  5326. 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
  5327. @end example
  5328. @end itemize
  5329. @section drawgrid
  5330. Draw a grid on the input image.
  5331. It accepts the following parameters:
  5332. @table @option
  5333. @item x
  5334. @item y
  5335. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5336. @item width, w
  5337. @item height, h
  5338. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5339. input width and height, respectively, minus @code{thickness}, so image gets
  5340. framed. Default to 0.
  5341. @item color, c
  5342. Specify the color of the grid. For the general syntax of this option,
  5343. check the "Color" section in the ffmpeg-utils manual. If the special
  5344. value @code{invert} is used, the grid color is the same as the
  5345. video with inverted luma.
  5346. @item thickness, t
  5347. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5348. See below for the list of accepted constants.
  5349. @end table
  5350. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5351. following constants:
  5352. @table @option
  5353. @item dar
  5354. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5355. @item hsub
  5356. @item vsub
  5357. horizontal and vertical chroma subsample values. For example for the
  5358. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5359. @item in_h, ih
  5360. @item in_w, iw
  5361. The input grid cell width and height.
  5362. @item sar
  5363. The input sample aspect ratio.
  5364. @item x
  5365. @item y
  5366. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5367. @item w
  5368. @item h
  5369. The width and height of the drawn cell.
  5370. @item t
  5371. The thickness of the drawn cell.
  5372. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5373. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5374. @end table
  5375. @subsection Examples
  5376. @itemize
  5377. @item
  5378. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5379. @example
  5380. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5381. @end example
  5382. @item
  5383. Draw a white 3x3 grid with an opacity of 50%:
  5384. @example
  5385. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5386. @end example
  5387. @end itemize
  5388. @anchor{drawtext}
  5389. @section drawtext
  5390. Draw a text string or text from a specified file on top of a video, using the
  5391. libfreetype library.
  5392. To enable compilation of this filter, you need to configure FFmpeg with
  5393. @code{--enable-libfreetype}.
  5394. To enable default font fallback and the @var{font} option you need to
  5395. configure FFmpeg with @code{--enable-libfontconfig}.
  5396. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5397. @code{--enable-libfribidi}.
  5398. @subsection Syntax
  5399. It accepts the following parameters:
  5400. @table @option
  5401. @item box
  5402. Used to draw a box around text using the background color.
  5403. The value must be either 1 (enable) or 0 (disable).
  5404. The default value of @var{box} is 0.
  5405. @item boxborderw
  5406. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5407. The default value of @var{boxborderw} is 0.
  5408. @item boxcolor
  5409. The color to be used for drawing box around text. For the syntax of this
  5410. option, check the "Color" section in the ffmpeg-utils manual.
  5411. The default value of @var{boxcolor} is "white".
  5412. @item line_spacing
  5413. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5414. The default value of @var{line_spacing} is 0.
  5415. @item borderw
  5416. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5417. The default value of @var{borderw} is 0.
  5418. @item bordercolor
  5419. Set the color to be used for drawing border around text. For the syntax of this
  5420. option, check the "Color" section in the ffmpeg-utils manual.
  5421. The default value of @var{bordercolor} is "black".
  5422. @item expansion
  5423. Select how the @var{text} is expanded. Can be either @code{none},
  5424. @code{strftime} (deprecated) or
  5425. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5426. below for details.
  5427. @item basetime
  5428. Set a start time for the count. Value is in microseconds. Only applied
  5429. in the deprecated strftime expansion mode. To emulate in normal expansion
  5430. mode use the @code{pts} function, supplying the start time (in seconds)
  5431. as the second argument.
  5432. @item fix_bounds
  5433. If true, check and fix text coords to avoid clipping.
  5434. @item fontcolor
  5435. The color to be used for drawing fonts. For the syntax of this option, check
  5436. the "Color" section in the ffmpeg-utils manual.
  5437. The default value of @var{fontcolor} is "black".
  5438. @item fontcolor_expr
  5439. String which is expanded the same way as @var{text} to obtain dynamic
  5440. @var{fontcolor} value. By default this option has empty value and is not
  5441. processed. When this option is set, it overrides @var{fontcolor} option.
  5442. @item font
  5443. The font family to be used for drawing text. By default Sans.
  5444. @item fontfile
  5445. The font file to be used for drawing text. The path must be included.
  5446. This parameter is mandatory if the fontconfig support is disabled.
  5447. @item alpha
  5448. Draw the text applying alpha blending. The value can
  5449. be a number between 0.0 and 1.0.
  5450. The expression accepts the same variables @var{x, y} as well.
  5451. The default value is 1.
  5452. Please see @var{fontcolor_expr}.
  5453. @item fontsize
  5454. The font size to be used for drawing text.
  5455. The default value of @var{fontsize} is 16.
  5456. @item text_shaping
  5457. If set to 1, attempt to shape the text (for example, reverse the order of
  5458. right-to-left text and join Arabic characters) before drawing it.
  5459. Otherwise, just draw the text exactly as given.
  5460. By default 1 (if supported).
  5461. @item ft_load_flags
  5462. The flags to be used for loading the fonts.
  5463. The flags map the corresponding flags supported by libfreetype, and are
  5464. a combination of the following values:
  5465. @table @var
  5466. @item default
  5467. @item no_scale
  5468. @item no_hinting
  5469. @item render
  5470. @item no_bitmap
  5471. @item vertical_layout
  5472. @item force_autohint
  5473. @item crop_bitmap
  5474. @item pedantic
  5475. @item ignore_global_advance_width
  5476. @item no_recurse
  5477. @item ignore_transform
  5478. @item monochrome
  5479. @item linear_design
  5480. @item no_autohint
  5481. @end table
  5482. Default value is "default".
  5483. For more information consult the documentation for the FT_LOAD_*
  5484. libfreetype flags.
  5485. @item shadowcolor
  5486. The color to be used for drawing a shadow behind the drawn text. For the
  5487. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5488. The default value of @var{shadowcolor} is "black".
  5489. @item shadowx
  5490. @item shadowy
  5491. The x and y offsets for the text shadow position with respect to the
  5492. position of the text. They can be either positive or negative
  5493. values. The default value for both is "0".
  5494. @item start_number
  5495. The starting frame number for the n/frame_num variable. The default value
  5496. is "0".
  5497. @item tabsize
  5498. The size in number of spaces to use for rendering the tab.
  5499. Default value is 4.
  5500. @item timecode
  5501. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5502. format. It can be used with or without text parameter. @var{timecode_rate}
  5503. option must be specified.
  5504. @item timecode_rate, rate, r
  5505. Set the timecode frame rate (timecode only).
  5506. @item tc24hmax
  5507. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5508. Default is 0 (disabled).
  5509. @item text
  5510. The text string to be drawn. The text must be a sequence of UTF-8
  5511. encoded characters.
  5512. This parameter is mandatory if no file is specified with the parameter
  5513. @var{textfile}.
  5514. @item textfile
  5515. A text file containing text to be drawn. The text must be a sequence
  5516. of UTF-8 encoded characters.
  5517. This parameter is mandatory if no text string is specified with the
  5518. parameter @var{text}.
  5519. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5520. @item reload
  5521. If set to 1, the @var{textfile} will be reloaded before each frame.
  5522. Be sure to update it atomically, or it may be read partially, or even fail.
  5523. @item x
  5524. @item y
  5525. The expressions which specify the offsets where text will be drawn
  5526. within the video frame. They are relative to the top/left border of the
  5527. output image.
  5528. The default value of @var{x} and @var{y} is "0".
  5529. See below for the list of accepted constants and functions.
  5530. @end table
  5531. The parameters for @var{x} and @var{y} are expressions containing the
  5532. following constants and functions:
  5533. @table @option
  5534. @item dar
  5535. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5536. @item hsub
  5537. @item vsub
  5538. horizontal and vertical chroma subsample values. For example for the
  5539. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5540. @item line_h, lh
  5541. the height of each text line
  5542. @item main_h, h, H
  5543. the input height
  5544. @item main_w, w, W
  5545. the input width
  5546. @item max_glyph_a, ascent
  5547. the maximum distance from the baseline to the highest/upper grid
  5548. coordinate used to place a glyph outline point, for all the rendered
  5549. glyphs.
  5550. It is a positive value, due to the grid's orientation with the Y axis
  5551. upwards.
  5552. @item max_glyph_d, descent
  5553. the maximum distance from the baseline to the lowest grid coordinate
  5554. used to place a glyph outline point, for all the rendered glyphs.
  5555. This is a negative value, due to the grid's orientation, with the Y axis
  5556. upwards.
  5557. @item max_glyph_h
  5558. maximum glyph height, that is the maximum height for all the glyphs
  5559. contained in the rendered text, it is equivalent to @var{ascent} -
  5560. @var{descent}.
  5561. @item max_glyph_w
  5562. maximum glyph width, that is the maximum width for all the glyphs
  5563. contained in the rendered text
  5564. @item n
  5565. the number of input frame, starting from 0
  5566. @item rand(min, max)
  5567. return a random number included between @var{min} and @var{max}
  5568. @item sar
  5569. The input sample aspect ratio.
  5570. @item t
  5571. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5572. @item text_h, th
  5573. the height of the rendered text
  5574. @item text_w, tw
  5575. the width of the rendered text
  5576. @item x
  5577. @item y
  5578. the x and y offset coordinates where the text is drawn.
  5579. These parameters allow the @var{x} and @var{y} expressions to refer
  5580. each other, so you can for example specify @code{y=x/dar}.
  5581. @end table
  5582. @anchor{drawtext_expansion}
  5583. @subsection Text expansion
  5584. If @option{expansion} is set to @code{strftime},
  5585. the filter recognizes strftime() sequences in the provided text and
  5586. expands them accordingly. Check the documentation of strftime(). This
  5587. feature is deprecated.
  5588. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5589. If @option{expansion} is set to @code{normal} (which is the default),
  5590. the following expansion mechanism is used.
  5591. The backslash character @samp{\}, followed by any character, always expands to
  5592. the second character.
  5593. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5594. braces is a function name, possibly followed by arguments separated by ':'.
  5595. If the arguments contain special characters or delimiters (':' or '@}'),
  5596. they should be escaped.
  5597. Note that they probably must also be escaped as the value for the
  5598. @option{text} option in the filter argument string and as the filter
  5599. argument in the filtergraph description, and possibly also for the shell,
  5600. that makes up to four levels of escaping; using a text file avoids these
  5601. problems.
  5602. The following functions are available:
  5603. @table @command
  5604. @item expr, e
  5605. The expression evaluation result.
  5606. It must take one argument specifying the expression to be evaluated,
  5607. which accepts the same constants and functions as the @var{x} and
  5608. @var{y} values. Note that not all constants should be used, for
  5609. example the text size is not known when evaluating the expression, so
  5610. the constants @var{text_w} and @var{text_h} will have an undefined
  5611. value.
  5612. @item expr_int_format, eif
  5613. Evaluate the expression's value and output as formatted integer.
  5614. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5615. The second argument specifies the output format. Allowed values are @samp{x},
  5616. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5617. @code{printf} function.
  5618. The third parameter is optional and sets the number of positions taken by the output.
  5619. It can be used to add padding with zeros from the left.
  5620. @item gmtime
  5621. The time at which the filter is running, expressed in UTC.
  5622. It can accept an argument: a strftime() format string.
  5623. @item localtime
  5624. The time at which the filter is running, expressed in the local time zone.
  5625. It can accept an argument: a strftime() format string.
  5626. @item metadata
  5627. Frame metadata. Takes one or two arguments.
  5628. The first argument is mandatory and specifies the metadata key.
  5629. The second argument is optional and specifies a default value, used when the
  5630. metadata key is not found or empty.
  5631. @item n, frame_num
  5632. The frame number, starting from 0.
  5633. @item pict_type
  5634. A 1 character description of the current picture type.
  5635. @item pts
  5636. The timestamp of the current frame.
  5637. It can take up to three arguments.
  5638. The first argument is the format of the timestamp; it defaults to @code{flt}
  5639. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5640. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5641. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5642. @code{localtime} stands for the timestamp of the frame formatted as
  5643. local time zone time.
  5644. The second argument is an offset added to the timestamp.
  5645. If the format is set to @code{localtime} or @code{gmtime},
  5646. a third argument may be supplied: a strftime() format string.
  5647. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5648. @end table
  5649. @subsection Examples
  5650. @itemize
  5651. @item
  5652. Draw "Test Text" with font FreeSerif, using the default values for the
  5653. optional parameters.
  5654. @example
  5655. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5656. @end example
  5657. @item
  5658. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5659. and y=50 (counting from the top-left corner of the screen), text is
  5660. yellow with a red box around it. Both the text and the box have an
  5661. opacity of 20%.
  5662. @example
  5663. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5664. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5665. @end example
  5666. Note that the double quotes are not necessary if spaces are not used
  5667. within the parameter list.
  5668. @item
  5669. Show the text at the center of the video frame:
  5670. @example
  5671. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5672. @end example
  5673. @item
  5674. Show the text at a random position, switching to a new position every 30 seconds:
  5675. @example
  5676. 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)"
  5677. @end example
  5678. @item
  5679. Show a text line sliding from right to left in the last row of the video
  5680. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5681. with no newlines.
  5682. @example
  5683. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5684. @end example
  5685. @item
  5686. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5687. @example
  5688. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5689. @end example
  5690. @item
  5691. Draw a single green letter "g", at the center of the input video.
  5692. The glyph baseline is placed at half screen height.
  5693. @example
  5694. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5695. @end example
  5696. @item
  5697. Show text for 1 second every 3 seconds:
  5698. @example
  5699. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5700. @end example
  5701. @item
  5702. Use fontconfig to set the font. Note that the colons need to be escaped.
  5703. @example
  5704. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5705. @end example
  5706. @item
  5707. Print the date of a real-time encoding (see strftime(3)):
  5708. @example
  5709. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5710. @end example
  5711. @item
  5712. Show text fading in and out (appearing/disappearing):
  5713. @example
  5714. #!/bin/sh
  5715. DS=1.0 # display start
  5716. DE=10.0 # display end
  5717. FID=1.5 # fade in duration
  5718. FOD=5 # fade out duration
  5719. 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 @}"
  5720. @end example
  5721. @item
  5722. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5723. and the @option{fontsize} value are included in the @option{y} offset.
  5724. @example
  5725. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5726. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5727. @end example
  5728. @end itemize
  5729. For more information about libfreetype, check:
  5730. @url{http://www.freetype.org/}.
  5731. For more information about fontconfig, check:
  5732. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5733. For more information about libfribidi, check:
  5734. @url{http://fribidi.org/}.
  5735. @section edgedetect
  5736. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5737. The filter accepts the following options:
  5738. @table @option
  5739. @item low
  5740. @item high
  5741. Set low and high threshold values used by the Canny thresholding
  5742. algorithm.
  5743. The high threshold selects the "strong" edge pixels, which are then
  5744. connected through 8-connectivity with the "weak" edge pixels selected
  5745. by the low threshold.
  5746. @var{low} and @var{high} threshold values must be chosen in the range
  5747. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5748. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5749. is @code{50/255}.
  5750. @item mode
  5751. Define the drawing mode.
  5752. @table @samp
  5753. @item wires
  5754. Draw white/gray wires on black background.
  5755. @item colormix
  5756. Mix the colors to create a paint/cartoon effect.
  5757. @end table
  5758. Default value is @var{wires}.
  5759. @end table
  5760. @subsection Examples
  5761. @itemize
  5762. @item
  5763. Standard edge detection with custom values for the hysteresis thresholding:
  5764. @example
  5765. edgedetect=low=0.1:high=0.4
  5766. @end example
  5767. @item
  5768. Painting effect without thresholding:
  5769. @example
  5770. edgedetect=mode=colormix:high=0
  5771. @end example
  5772. @end itemize
  5773. @section eq
  5774. Set brightness, contrast, saturation and approximate gamma adjustment.
  5775. The filter accepts the following options:
  5776. @table @option
  5777. @item contrast
  5778. Set the contrast expression. The value must be a float value in range
  5779. @code{-2.0} to @code{2.0}. The default value is "1".
  5780. @item brightness
  5781. Set the brightness expression. The value must be a float value in
  5782. range @code{-1.0} to @code{1.0}. The default value is "0".
  5783. @item saturation
  5784. Set the saturation expression. The value must be a float in
  5785. range @code{0.0} to @code{3.0}. The default value is "1".
  5786. @item gamma
  5787. Set the gamma expression. The value must be a float in range
  5788. @code{0.1} to @code{10.0}. The default value is "1".
  5789. @item gamma_r
  5790. Set the gamma expression for red. The value must be a float in
  5791. range @code{0.1} to @code{10.0}. The default value is "1".
  5792. @item gamma_g
  5793. Set the gamma expression for green. The value must be a float in range
  5794. @code{0.1} to @code{10.0}. The default value is "1".
  5795. @item gamma_b
  5796. Set the gamma expression for blue. The value must be a float in range
  5797. @code{0.1} to @code{10.0}. The default value is "1".
  5798. @item gamma_weight
  5799. Set the gamma weight expression. It can be used to reduce the effect
  5800. of a high gamma value on bright image areas, e.g. keep them from
  5801. getting overamplified and just plain white. The value must be a float
  5802. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5803. gamma correction all the way down while @code{1.0} leaves it at its
  5804. full strength. Default is "1".
  5805. @item eval
  5806. Set when the expressions for brightness, contrast, saturation and
  5807. gamma expressions are evaluated.
  5808. It accepts the following values:
  5809. @table @samp
  5810. @item init
  5811. only evaluate expressions once during the filter initialization or
  5812. when a command is processed
  5813. @item frame
  5814. evaluate expressions for each incoming frame
  5815. @end table
  5816. Default value is @samp{init}.
  5817. @end table
  5818. The expressions accept the following parameters:
  5819. @table @option
  5820. @item n
  5821. frame count of the input frame starting from 0
  5822. @item pos
  5823. byte position of the corresponding packet in the input file, NAN if
  5824. unspecified
  5825. @item r
  5826. frame rate of the input video, NAN if the input frame rate is unknown
  5827. @item t
  5828. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5829. @end table
  5830. @subsection Commands
  5831. The filter supports the following commands:
  5832. @table @option
  5833. @item contrast
  5834. Set the contrast expression.
  5835. @item brightness
  5836. Set the brightness expression.
  5837. @item saturation
  5838. Set the saturation expression.
  5839. @item gamma
  5840. Set the gamma expression.
  5841. @item gamma_r
  5842. Set the gamma_r expression.
  5843. @item gamma_g
  5844. Set gamma_g expression.
  5845. @item gamma_b
  5846. Set gamma_b expression.
  5847. @item gamma_weight
  5848. Set gamma_weight expression.
  5849. The command accepts the same syntax of the corresponding option.
  5850. If the specified expression is not valid, it is kept at its current
  5851. value.
  5852. @end table
  5853. @section erosion
  5854. Apply erosion effect to the video.
  5855. This filter replaces the pixel by the local(3x3) minimum.
  5856. It accepts the following options:
  5857. @table @option
  5858. @item threshold0
  5859. @item threshold1
  5860. @item threshold2
  5861. @item threshold3
  5862. Limit the maximum change for each plane, default is 65535.
  5863. If 0, plane will remain unchanged.
  5864. @item coordinates
  5865. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5866. pixels are used.
  5867. Flags to local 3x3 coordinates maps like this:
  5868. 1 2 3
  5869. 4 5
  5870. 6 7 8
  5871. @end table
  5872. @section extractplanes
  5873. Extract color channel components from input video stream into
  5874. separate grayscale video streams.
  5875. The filter accepts the following option:
  5876. @table @option
  5877. @item planes
  5878. Set plane(s) to extract.
  5879. Available values for planes are:
  5880. @table @samp
  5881. @item y
  5882. @item u
  5883. @item v
  5884. @item a
  5885. @item r
  5886. @item g
  5887. @item b
  5888. @end table
  5889. Choosing planes not available in the input will result in an error.
  5890. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5891. with @code{y}, @code{u}, @code{v} planes at same time.
  5892. @end table
  5893. @subsection Examples
  5894. @itemize
  5895. @item
  5896. Extract luma, u and v color channel component from input video frame
  5897. into 3 grayscale outputs:
  5898. @example
  5899. 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
  5900. @end example
  5901. @end itemize
  5902. @section elbg
  5903. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5904. For each input image, the filter will compute the optimal mapping from
  5905. the input to the output given the codebook length, that is the number
  5906. of distinct output colors.
  5907. This filter accepts the following options.
  5908. @table @option
  5909. @item codebook_length, l
  5910. Set codebook length. The value must be a positive integer, and
  5911. represents the number of distinct output colors. Default value is 256.
  5912. @item nb_steps, n
  5913. Set the maximum number of iterations to apply for computing the optimal
  5914. mapping. The higher the value the better the result and the higher the
  5915. computation time. Default value is 1.
  5916. @item seed, s
  5917. Set a random seed, must be an integer included between 0 and
  5918. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5919. will try to use a good random seed on a best effort basis.
  5920. @item pal8
  5921. Set pal8 output pixel format. This option does not work with codebook
  5922. length greater than 256.
  5923. @end table
  5924. @section fade
  5925. Apply a fade-in/out effect to the input video.
  5926. It accepts the following parameters:
  5927. @table @option
  5928. @item type, t
  5929. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5930. effect.
  5931. Default is @code{in}.
  5932. @item start_frame, s
  5933. Specify the number of the frame to start applying the fade
  5934. effect at. Default is 0.
  5935. @item nb_frames, n
  5936. The number of frames that the fade effect lasts. At the end of the
  5937. fade-in effect, the output video will have the same intensity as the input video.
  5938. At the end of the fade-out transition, the output video will be filled with the
  5939. selected @option{color}.
  5940. Default is 25.
  5941. @item alpha
  5942. If set to 1, fade only alpha channel, if one exists on the input.
  5943. Default value is 0.
  5944. @item start_time, st
  5945. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5946. effect. If both start_frame and start_time are specified, the fade will start at
  5947. whichever comes last. Default is 0.
  5948. @item duration, d
  5949. The number of seconds for which the fade effect has to last. At the end of the
  5950. fade-in effect the output video will have the same intensity as the input video,
  5951. at the end of the fade-out transition the output video will be filled with the
  5952. selected @option{color}.
  5953. If both duration and nb_frames are specified, duration is used. Default is 0
  5954. (nb_frames is used by default).
  5955. @item color, c
  5956. Specify the color of the fade. Default is "black".
  5957. @end table
  5958. @subsection Examples
  5959. @itemize
  5960. @item
  5961. Fade in the first 30 frames of video:
  5962. @example
  5963. fade=in:0:30
  5964. @end example
  5965. The command above is equivalent to:
  5966. @example
  5967. fade=t=in:s=0:n=30
  5968. @end example
  5969. @item
  5970. Fade out the last 45 frames of a 200-frame video:
  5971. @example
  5972. fade=out:155:45
  5973. fade=type=out:start_frame=155:nb_frames=45
  5974. @end example
  5975. @item
  5976. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5977. @example
  5978. fade=in:0:25, fade=out:975:25
  5979. @end example
  5980. @item
  5981. Make the first 5 frames yellow, then fade in from frame 5-24:
  5982. @example
  5983. fade=in:5:20:color=yellow
  5984. @end example
  5985. @item
  5986. Fade in alpha over first 25 frames of video:
  5987. @example
  5988. fade=in:0:25:alpha=1
  5989. @end example
  5990. @item
  5991. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5992. @example
  5993. fade=t=in:st=5.5:d=0.5
  5994. @end example
  5995. @end itemize
  5996. @section fftfilt
  5997. Apply arbitrary expressions to samples in frequency domain
  5998. @table @option
  5999. @item dc_Y
  6000. Adjust the dc value (gain) of the luma plane of the image. The filter
  6001. accepts an integer value in range @code{0} to @code{1000}. The default
  6002. value is set to @code{0}.
  6003. @item dc_U
  6004. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6005. filter accepts an integer value in range @code{0} to @code{1000}. The
  6006. default value is set to @code{0}.
  6007. @item dc_V
  6008. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6009. filter accepts an integer value in range @code{0} to @code{1000}. The
  6010. default value is set to @code{0}.
  6011. @item weight_Y
  6012. Set the frequency domain weight expression for the luma plane.
  6013. @item weight_U
  6014. Set the frequency domain weight expression for the 1st chroma plane.
  6015. @item weight_V
  6016. Set the frequency domain weight expression for the 2nd chroma plane.
  6017. The filter accepts the following variables:
  6018. @item X
  6019. @item Y
  6020. The coordinates of the current sample.
  6021. @item W
  6022. @item H
  6023. The width and height of the image.
  6024. @end table
  6025. @subsection Examples
  6026. @itemize
  6027. @item
  6028. High-pass:
  6029. @example
  6030. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6031. @end example
  6032. @item
  6033. Low-pass:
  6034. @example
  6035. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6036. @end example
  6037. @item
  6038. Sharpen:
  6039. @example
  6040. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6041. @end example
  6042. @item
  6043. Blur:
  6044. @example
  6045. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6046. @end example
  6047. @end itemize
  6048. @section field
  6049. Extract a single field from an interlaced image using stride
  6050. arithmetic to avoid wasting CPU time. The output frames are marked as
  6051. non-interlaced.
  6052. The filter accepts the following options:
  6053. @table @option
  6054. @item type
  6055. Specify whether to extract the top (if the value is @code{0} or
  6056. @code{top}) or the bottom field (if the value is @code{1} or
  6057. @code{bottom}).
  6058. @end table
  6059. @section fieldhint
  6060. Create new frames by copying the top and bottom fields from surrounding frames
  6061. supplied as numbers by the hint file.
  6062. @table @option
  6063. @item hint
  6064. Set file containing hints: absolute/relative frame numbers.
  6065. There must be one line for each frame in a clip. Each line must contain two
  6066. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6067. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6068. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6069. for @code{relative} mode. First number tells from which frame to pick up top
  6070. field and second number tells from which frame to pick up bottom field.
  6071. If optionally followed by @code{+} output frame will be marked as interlaced,
  6072. else if followed by @code{-} output frame will be marked as progressive, else
  6073. it will be marked same as input frame.
  6074. If line starts with @code{#} or @code{;} that line is skipped.
  6075. @item mode
  6076. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6077. @end table
  6078. Example of first several lines of @code{hint} file for @code{relative} mode:
  6079. @example
  6080. 0,0 - # first frame
  6081. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6082. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6083. 1,0 -
  6084. 0,0 -
  6085. 0,0 -
  6086. 1,0 -
  6087. 1,0 -
  6088. 1,0 -
  6089. 0,0 -
  6090. 0,0 -
  6091. 1,0 -
  6092. 1,0 -
  6093. 1,0 -
  6094. 0,0 -
  6095. @end example
  6096. @section fieldmatch
  6097. Field matching filter for inverse telecine. It is meant to reconstruct the
  6098. progressive frames from a telecined stream. The filter does not drop duplicated
  6099. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6100. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6101. The separation of the field matching and the decimation is notably motivated by
  6102. the possibility of inserting a de-interlacing filter fallback between the two.
  6103. If the source has mixed telecined and real interlaced content,
  6104. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6105. But these remaining combed frames will be marked as interlaced, and thus can be
  6106. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6107. In addition to the various configuration options, @code{fieldmatch} can take an
  6108. optional second stream, activated through the @option{ppsrc} option. If
  6109. enabled, the frames reconstruction will be based on the fields and frames from
  6110. this second stream. This allows the first input to be pre-processed in order to
  6111. help the various algorithms of the filter, while keeping the output lossless
  6112. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6113. or brightness/contrast adjustments can help.
  6114. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6115. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6116. which @code{fieldmatch} is based on. While the semantic and usage are very
  6117. close, some behaviour and options names can differ.
  6118. The @ref{decimate} filter currently only works for constant frame rate input.
  6119. If your input has mixed telecined (30fps) and progressive content with a lower
  6120. framerate like 24fps use the following filterchain to produce the necessary cfr
  6121. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6122. The filter accepts the following options:
  6123. @table @option
  6124. @item order
  6125. Specify the assumed field order of the input stream. Available values are:
  6126. @table @samp
  6127. @item auto
  6128. Auto detect parity (use FFmpeg's internal parity value).
  6129. @item bff
  6130. Assume bottom field first.
  6131. @item tff
  6132. Assume top field first.
  6133. @end table
  6134. Note that it is sometimes recommended not to trust the parity announced by the
  6135. stream.
  6136. Default value is @var{auto}.
  6137. @item mode
  6138. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6139. sense that it won't risk creating jerkiness due to duplicate frames when
  6140. possible, but if there are bad edits or blended fields it will end up
  6141. outputting combed frames when a good match might actually exist. On the other
  6142. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6143. but will almost always find a good frame if there is one. The other values are
  6144. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6145. jerkiness and creating duplicate frames versus finding good matches in sections
  6146. with bad edits, orphaned fields, blended fields, etc.
  6147. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6148. Available values are:
  6149. @table @samp
  6150. @item pc
  6151. 2-way matching (p/c)
  6152. @item pc_n
  6153. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6154. @item pc_u
  6155. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6156. @item pc_n_ub
  6157. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6158. still combed (p/c + n + u/b)
  6159. @item pcn
  6160. 3-way matching (p/c/n)
  6161. @item pcn_ub
  6162. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6163. detected as combed (p/c/n + u/b)
  6164. @end table
  6165. The parenthesis at the end indicate the matches that would be used for that
  6166. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6167. @var{top}).
  6168. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6169. the slowest.
  6170. Default value is @var{pc_n}.
  6171. @item ppsrc
  6172. Mark the main input stream as a pre-processed input, and enable the secondary
  6173. input stream as the clean source to pick the fields from. See the filter
  6174. introduction for more details. It is similar to the @option{clip2} feature from
  6175. VFM/TFM.
  6176. Default value is @code{0} (disabled).
  6177. @item field
  6178. Set the field to match from. It is recommended to set this to the same value as
  6179. @option{order} unless you experience matching failures with that setting. In
  6180. certain circumstances changing the field that is used to match from can have a
  6181. large impact on matching performance. Available values are:
  6182. @table @samp
  6183. @item auto
  6184. Automatic (same value as @option{order}).
  6185. @item bottom
  6186. Match from the bottom field.
  6187. @item top
  6188. Match from the top field.
  6189. @end table
  6190. Default value is @var{auto}.
  6191. @item mchroma
  6192. Set whether or not chroma is included during the match comparisons. In most
  6193. cases it is recommended to leave this enabled. You should set this to @code{0}
  6194. only if your clip has bad chroma problems such as heavy rainbowing or other
  6195. artifacts. Setting this to @code{0} could also be used to speed things up at
  6196. the cost of some accuracy.
  6197. Default value is @code{1}.
  6198. @item y0
  6199. @item y1
  6200. These define an exclusion band which excludes the lines between @option{y0} and
  6201. @option{y1} from being included in the field matching decision. An exclusion
  6202. band can be used to ignore subtitles, a logo, or other things that may
  6203. interfere with the matching. @option{y0} sets the starting scan line and
  6204. @option{y1} sets the ending line; all lines in between @option{y0} and
  6205. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6206. @option{y0} and @option{y1} to the same value will disable the feature.
  6207. @option{y0} and @option{y1} defaults to @code{0}.
  6208. @item scthresh
  6209. Set the scene change detection threshold as a percentage of maximum change on
  6210. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6211. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6212. @option{scthresh} is @code{[0.0, 100.0]}.
  6213. Default value is @code{12.0}.
  6214. @item combmatch
  6215. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6216. account the combed scores of matches when deciding what match to use as the
  6217. final match. Available values are:
  6218. @table @samp
  6219. @item none
  6220. No final matching based on combed scores.
  6221. @item sc
  6222. Combed scores are only used when a scene change is detected.
  6223. @item full
  6224. Use combed scores all the time.
  6225. @end table
  6226. Default is @var{sc}.
  6227. @item combdbg
  6228. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6229. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6230. Available values are:
  6231. @table @samp
  6232. @item none
  6233. No forced calculation.
  6234. @item pcn
  6235. Force p/c/n calculations.
  6236. @item pcnub
  6237. Force p/c/n/u/b calculations.
  6238. @end table
  6239. Default value is @var{none}.
  6240. @item cthresh
  6241. This is the area combing threshold used for combed frame detection. This
  6242. essentially controls how "strong" or "visible" combing must be to be detected.
  6243. Larger values mean combing must be more visible and smaller values mean combing
  6244. can be less visible or strong and still be detected. Valid settings are from
  6245. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6246. be detected as combed). This is basically a pixel difference value. A good
  6247. range is @code{[8, 12]}.
  6248. Default value is @code{9}.
  6249. @item chroma
  6250. Sets whether or not chroma is considered in the combed frame decision. Only
  6251. disable this if your source has chroma problems (rainbowing, etc.) that are
  6252. causing problems for the combed frame detection with chroma enabled. Actually,
  6253. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6254. where there is chroma only combing in the source.
  6255. Default value is @code{0}.
  6256. @item blockx
  6257. @item blocky
  6258. Respectively set the x-axis and y-axis size of the window used during combed
  6259. frame detection. This has to do with the size of the area in which
  6260. @option{combpel} pixels are required to be detected as combed for a frame to be
  6261. declared combed. See the @option{combpel} parameter description for more info.
  6262. Possible values are any number that is a power of 2 starting at 4 and going up
  6263. to 512.
  6264. Default value is @code{16}.
  6265. @item combpel
  6266. The number of combed pixels inside any of the @option{blocky} by
  6267. @option{blockx} size blocks on the frame for the frame to be detected as
  6268. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6269. setting controls "how much" combing there must be in any localized area (a
  6270. window defined by the @option{blockx} and @option{blocky} settings) on the
  6271. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6272. which point no frames will ever be detected as combed). This setting is known
  6273. as @option{MI} in TFM/VFM vocabulary.
  6274. Default value is @code{80}.
  6275. @end table
  6276. @anchor{p/c/n/u/b meaning}
  6277. @subsection p/c/n/u/b meaning
  6278. @subsubsection p/c/n
  6279. We assume the following telecined stream:
  6280. @example
  6281. Top fields: 1 2 2 3 4
  6282. Bottom fields: 1 2 3 4 4
  6283. @end example
  6284. The numbers correspond to the progressive frame the fields relate to. Here, the
  6285. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6286. When @code{fieldmatch} is configured to run a matching from bottom
  6287. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6288. @example
  6289. Input stream:
  6290. T 1 2 2 3 4
  6291. B 1 2 3 4 4 <-- matching reference
  6292. Matches: c c n n c
  6293. Output stream:
  6294. T 1 2 3 4 4
  6295. B 1 2 3 4 4
  6296. @end example
  6297. As a result of the field matching, we can see that some frames get duplicated.
  6298. To perform a complete inverse telecine, you need to rely on a decimation filter
  6299. after this operation. See for instance the @ref{decimate} filter.
  6300. The same operation now matching from top fields (@option{field}=@var{top})
  6301. looks like this:
  6302. @example
  6303. Input stream:
  6304. T 1 2 2 3 4 <-- matching reference
  6305. B 1 2 3 4 4
  6306. Matches: c c p p c
  6307. Output stream:
  6308. T 1 2 2 3 4
  6309. B 1 2 2 3 4
  6310. @end example
  6311. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6312. basically, they refer to the frame and field of the opposite parity:
  6313. @itemize
  6314. @item @var{p} matches the field of the opposite parity in the previous frame
  6315. @item @var{c} matches the field of the opposite parity in the current frame
  6316. @item @var{n} matches the field of the opposite parity in the next frame
  6317. @end itemize
  6318. @subsubsection u/b
  6319. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6320. from the opposite parity flag. In the following examples, we assume that we are
  6321. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6322. 'x' is placed above and below each matched fields.
  6323. With bottom matching (@option{field}=@var{bottom}):
  6324. @example
  6325. Match: c p n b u
  6326. x x x x x
  6327. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6328. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6329. x x x x x
  6330. Output frames:
  6331. 2 1 2 2 2
  6332. 2 2 2 1 3
  6333. @end example
  6334. With top matching (@option{field}=@var{top}):
  6335. @example
  6336. Match: c p n b u
  6337. x x x x x
  6338. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6339. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6340. x x x x x
  6341. Output frames:
  6342. 2 2 2 1 2
  6343. 2 1 3 2 2
  6344. @end example
  6345. @subsection Examples
  6346. Simple IVTC of a top field first telecined stream:
  6347. @example
  6348. fieldmatch=order=tff:combmatch=none, decimate
  6349. @end example
  6350. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6351. @example
  6352. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6353. @end example
  6354. @section fieldorder
  6355. Transform the field order of the input video.
  6356. It accepts the following parameters:
  6357. @table @option
  6358. @item order
  6359. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6360. for bottom field first.
  6361. @end table
  6362. The default value is @samp{tff}.
  6363. The transformation is done by shifting the picture content up or down
  6364. by one line, and filling the remaining line with appropriate picture content.
  6365. This method is consistent with most broadcast field order converters.
  6366. If the input video is not flagged as being interlaced, or it is already
  6367. flagged as being of the required output field order, then this filter does
  6368. not alter the incoming video.
  6369. It is very useful when converting to or from PAL DV material,
  6370. which is bottom field first.
  6371. For example:
  6372. @example
  6373. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6374. @end example
  6375. @section fifo, afifo
  6376. Buffer input images and send them when they are requested.
  6377. It is mainly useful when auto-inserted by the libavfilter
  6378. framework.
  6379. It does not take parameters.
  6380. @section find_rect
  6381. Find a rectangular object
  6382. It accepts the following options:
  6383. @table @option
  6384. @item object
  6385. Filepath of the object image, needs to be in gray8.
  6386. @item threshold
  6387. Detection threshold, default is 0.5.
  6388. @item mipmaps
  6389. Number of mipmaps, default is 3.
  6390. @item xmin, ymin, xmax, ymax
  6391. Specifies the rectangle in which to search.
  6392. @end table
  6393. @subsection Examples
  6394. @itemize
  6395. @item
  6396. Generate a representative palette of a given video using @command{ffmpeg}:
  6397. @example
  6398. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6399. @end example
  6400. @end itemize
  6401. @section cover_rect
  6402. Cover a rectangular object
  6403. It accepts the following options:
  6404. @table @option
  6405. @item cover
  6406. Filepath of the optional cover image, needs to be in yuv420.
  6407. @item mode
  6408. Set covering mode.
  6409. It accepts the following values:
  6410. @table @samp
  6411. @item cover
  6412. cover it by the supplied image
  6413. @item blur
  6414. cover it by interpolating the surrounding pixels
  6415. @end table
  6416. Default value is @var{blur}.
  6417. @end table
  6418. @subsection Examples
  6419. @itemize
  6420. @item
  6421. Generate a representative palette of a given video using @command{ffmpeg}:
  6422. @example
  6423. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6424. @end example
  6425. @end itemize
  6426. @anchor{format}
  6427. @section format
  6428. Convert the input video to one of the specified pixel formats.
  6429. Libavfilter will try to pick one that is suitable as input to
  6430. the next filter.
  6431. It accepts the following parameters:
  6432. @table @option
  6433. @item pix_fmts
  6434. A '|'-separated list of pixel format names, such as
  6435. "pix_fmts=yuv420p|monow|rgb24".
  6436. @end table
  6437. @subsection Examples
  6438. @itemize
  6439. @item
  6440. Convert the input video to the @var{yuv420p} format
  6441. @example
  6442. format=pix_fmts=yuv420p
  6443. @end example
  6444. Convert the input video to any of the formats in the list
  6445. @example
  6446. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6447. @end example
  6448. @end itemize
  6449. @anchor{fps}
  6450. @section fps
  6451. Convert the video to specified constant frame rate by duplicating or dropping
  6452. frames as necessary.
  6453. It accepts the following parameters:
  6454. @table @option
  6455. @item fps
  6456. The desired output frame rate. The default is @code{25}.
  6457. @item round
  6458. Rounding method.
  6459. Possible values are:
  6460. @table @option
  6461. @item zero
  6462. zero round towards 0
  6463. @item inf
  6464. round away from 0
  6465. @item down
  6466. round towards -infinity
  6467. @item up
  6468. round towards +infinity
  6469. @item near
  6470. round to nearest
  6471. @end table
  6472. The default is @code{near}.
  6473. @item start_time
  6474. Assume the first PTS should be the given value, in seconds. This allows for
  6475. padding/trimming at the start of stream. By default, no assumption is made
  6476. about the first frame's expected PTS, so no padding or trimming is done.
  6477. For example, this could be set to 0 to pad the beginning with duplicates of
  6478. the first frame if a video stream starts after the audio stream or to trim any
  6479. frames with a negative PTS.
  6480. @end table
  6481. Alternatively, the options can be specified as a flat string:
  6482. @var{fps}[:@var{round}].
  6483. See also the @ref{setpts} filter.
  6484. @subsection Examples
  6485. @itemize
  6486. @item
  6487. A typical usage in order to set the fps to 25:
  6488. @example
  6489. fps=fps=25
  6490. @end example
  6491. @item
  6492. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6493. @example
  6494. fps=fps=film:round=near
  6495. @end example
  6496. @end itemize
  6497. @section framepack
  6498. Pack two different video streams into a stereoscopic video, setting proper
  6499. metadata on supported codecs. The two views should have the same size and
  6500. framerate and processing will stop when the shorter video ends. Please note
  6501. that you may conveniently adjust view properties with the @ref{scale} and
  6502. @ref{fps} filters.
  6503. It accepts the following parameters:
  6504. @table @option
  6505. @item format
  6506. The desired packing format. Supported values are:
  6507. @table @option
  6508. @item sbs
  6509. The views are next to each other (default).
  6510. @item tab
  6511. The views are on top of each other.
  6512. @item lines
  6513. The views are packed by line.
  6514. @item columns
  6515. The views are packed by column.
  6516. @item frameseq
  6517. The views are temporally interleaved.
  6518. @end table
  6519. @end table
  6520. Some examples:
  6521. @example
  6522. # Convert left and right views into a frame-sequential video
  6523. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6524. # Convert views into a side-by-side video with the same output resolution as the input
  6525. 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
  6526. @end example
  6527. @section framerate
  6528. Change the frame rate by interpolating new video output frames from the source
  6529. frames.
  6530. This filter is not designed to function correctly with interlaced media. If
  6531. you wish to change the frame rate of interlaced media then you are required
  6532. to deinterlace before this filter and re-interlace after this filter.
  6533. A description of the accepted options follows.
  6534. @table @option
  6535. @item fps
  6536. Specify the output frames per second. This option can also be specified
  6537. as a value alone. The default is @code{50}.
  6538. @item interp_start
  6539. Specify the start of a range where the output frame will be created as a
  6540. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6541. the default is @code{15}.
  6542. @item interp_end
  6543. Specify the end of a range where the output frame will be created as a
  6544. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6545. the default is @code{240}.
  6546. @item scene
  6547. Specify the level at which a scene change is detected as a value between
  6548. 0 and 100 to indicate a new scene; a low value reflects a low
  6549. probability for the current frame to introduce a new scene, while a higher
  6550. value means the current frame is more likely to be one.
  6551. The default is @code{7}.
  6552. @item flags
  6553. Specify flags influencing the filter process.
  6554. Available value for @var{flags} is:
  6555. @table @option
  6556. @item scene_change_detect, scd
  6557. Enable scene change detection using the value of the option @var{scene}.
  6558. This flag is enabled by default.
  6559. @end table
  6560. @end table
  6561. @section framestep
  6562. Select one frame every N-th frame.
  6563. This filter accepts the following option:
  6564. @table @option
  6565. @item step
  6566. Select frame after every @code{step} frames.
  6567. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6568. @end table
  6569. @anchor{frei0r}
  6570. @section frei0r
  6571. Apply a frei0r effect to the input video.
  6572. To enable the compilation of this filter, you need to install the frei0r
  6573. header and configure FFmpeg with @code{--enable-frei0r}.
  6574. It accepts the following parameters:
  6575. @table @option
  6576. @item filter_name
  6577. The name of the frei0r effect to load. If the environment variable
  6578. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6579. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6580. Otherwise, the standard frei0r paths are searched, in this order:
  6581. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6582. @file{/usr/lib/frei0r-1/}.
  6583. @item filter_params
  6584. A '|'-separated list of parameters to pass to the frei0r effect.
  6585. @end table
  6586. A frei0r effect parameter can be a boolean (its value is either
  6587. "y" or "n"), a double, a color (specified as
  6588. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6589. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6590. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6591. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6592. The number and types of parameters depend on the loaded effect. If an
  6593. effect parameter is not specified, the default value is set.
  6594. @subsection Examples
  6595. @itemize
  6596. @item
  6597. Apply the distort0r effect, setting the first two double parameters:
  6598. @example
  6599. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6600. @end example
  6601. @item
  6602. Apply the colordistance effect, taking a color as the first parameter:
  6603. @example
  6604. frei0r=colordistance:0.2/0.3/0.4
  6605. frei0r=colordistance:violet
  6606. frei0r=colordistance:0x112233
  6607. @end example
  6608. @item
  6609. Apply the perspective effect, specifying the top left and top right image
  6610. positions:
  6611. @example
  6612. frei0r=perspective:0.2/0.2|0.8/0.2
  6613. @end example
  6614. @end itemize
  6615. For more information, see
  6616. @url{http://frei0r.dyne.org}
  6617. @section fspp
  6618. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6619. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6620. processing filter, one of them is performed once per block, not per pixel.
  6621. This allows for much higher speed.
  6622. The filter accepts the following options:
  6623. @table @option
  6624. @item quality
  6625. Set quality. This option defines the number of levels for averaging. It accepts
  6626. an integer in the range 4-5. Default value is @code{4}.
  6627. @item qp
  6628. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6629. If not set, the filter will use the QP from the video stream (if available).
  6630. @item strength
  6631. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6632. more details but also more artifacts, while higher values make the image smoother
  6633. but also blurrier. Default value is @code{0} − PSNR optimal.
  6634. @item use_bframe_qp
  6635. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6636. option may cause flicker since the B-Frames have often larger QP. Default is
  6637. @code{0} (not enabled).
  6638. @end table
  6639. @section gblur
  6640. Apply Gaussian blur filter.
  6641. The filter accepts the following options:
  6642. @table @option
  6643. @item sigma
  6644. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6645. @item steps
  6646. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6647. @item planes
  6648. Set which planes to filter. By default all planes are filtered.
  6649. @item sigmaV
  6650. Set vertical sigma, if negative it will be same as @code{sigma}.
  6651. Default is @code{-1}.
  6652. @end table
  6653. @section geq
  6654. The filter accepts the following options:
  6655. @table @option
  6656. @item lum_expr, lum
  6657. Set the luminance expression.
  6658. @item cb_expr, cb
  6659. Set the chrominance blue expression.
  6660. @item cr_expr, cr
  6661. Set the chrominance red expression.
  6662. @item alpha_expr, a
  6663. Set the alpha expression.
  6664. @item red_expr, r
  6665. Set the red expression.
  6666. @item green_expr, g
  6667. Set the green expression.
  6668. @item blue_expr, b
  6669. Set the blue expression.
  6670. @end table
  6671. The colorspace is selected according to the specified options. If one
  6672. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6673. options is specified, the filter will automatically select a YCbCr
  6674. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6675. @option{blue_expr} options is specified, it will select an RGB
  6676. colorspace.
  6677. If one of the chrominance expression is not defined, it falls back on the other
  6678. one. If no alpha expression is specified it will evaluate to opaque value.
  6679. If none of chrominance expressions are specified, they will evaluate
  6680. to the luminance expression.
  6681. The expressions can use the following variables and functions:
  6682. @table @option
  6683. @item N
  6684. The sequential number of the filtered frame, starting from @code{0}.
  6685. @item X
  6686. @item Y
  6687. The coordinates of the current sample.
  6688. @item W
  6689. @item H
  6690. The width and height of the image.
  6691. @item SW
  6692. @item SH
  6693. Width and height scale depending on the currently filtered plane. It is the
  6694. ratio between the corresponding luma plane number of pixels and the current
  6695. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6696. @code{0.5,0.5} for chroma planes.
  6697. @item T
  6698. Time of the current frame, expressed in seconds.
  6699. @item p(x, y)
  6700. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6701. plane.
  6702. @item lum(x, y)
  6703. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6704. plane.
  6705. @item cb(x, y)
  6706. Return the value of the pixel at location (@var{x},@var{y}) of the
  6707. blue-difference chroma plane. Return 0 if there is no such plane.
  6708. @item cr(x, y)
  6709. Return the value of the pixel at location (@var{x},@var{y}) of the
  6710. red-difference chroma plane. Return 0 if there is no such plane.
  6711. @item r(x, y)
  6712. @item g(x, y)
  6713. @item b(x, y)
  6714. Return the value of the pixel at location (@var{x},@var{y}) of the
  6715. red/green/blue component. Return 0 if there is no such component.
  6716. @item alpha(x, y)
  6717. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6718. plane. Return 0 if there is no such plane.
  6719. @end table
  6720. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6721. automatically clipped to the closer edge.
  6722. @subsection Examples
  6723. @itemize
  6724. @item
  6725. Flip the image horizontally:
  6726. @example
  6727. geq=p(W-X\,Y)
  6728. @end example
  6729. @item
  6730. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6731. wavelength of 100 pixels:
  6732. @example
  6733. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6734. @end example
  6735. @item
  6736. Generate a fancy enigmatic moving light:
  6737. @example
  6738. 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
  6739. @end example
  6740. @item
  6741. Generate a quick emboss effect:
  6742. @example
  6743. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6744. @end example
  6745. @item
  6746. Modify RGB components depending on pixel position:
  6747. @example
  6748. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6749. @end example
  6750. @item
  6751. Create a radial gradient that is the same size as the input (also see
  6752. the @ref{vignette} filter):
  6753. @example
  6754. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6755. @end example
  6756. @end itemize
  6757. @section gradfun
  6758. Fix the banding artifacts that are sometimes introduced into nearly flat
  6759. regions by truncation to 8-bit color depth.
  6760. Interpolate the gradients that should go where the bands are, and
  6761. dither them.
  6762. It is designed for playback only. Do not use it prior to
  6763. lossy compression, because compression tends to lose the dither and
  6764. bring back the bands.
  6765. It accepts the following parameters:
  6766. @table @option
  6767. @item strength
  6768. The maximum amount by which the filter will change any one pixel. This is also
  6769. the threshold for detecting nearly flat regions. Acceptable values range from
  6770. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6771. valid range.
  6772. @item radius
  6773. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6774. gradients, but also prevents the filter from modifying the pixels near detailed
  6775. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6776. values will be clipped to the valid range.
  6777. @end table
  6778. Alternatively, the options can be specified as a flat string:
  6779. @var{strength}[:@var{radius}]
  6780. @subsection Examples
  6781. @itemize
  6782. @item
  6783. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6784. @example
  6785. gradfun=3.5:8
  6786. @end example
  6787. @item
  6788. Specify radius, omitting the strength (which will fall-back to the default
  6789. value):
  6790. @example
  6791. gradfun=radius=8
  6792. @end example
  6793. @end itemize
  6794. @anchor{haldclut}
  6795. @section haldclut
  6796. Apply a Hald CLUT to a video stream.
  6797. First input is the video stream to process, and second one is the Hald CLUT.
  6798. The Hald CLUT input can be a simple picture or a complete video stream.
  6799. The filter accepts the following options:
  6800. @table @option
  6801. @item shortest
  6802. Force termination when the shortest input terminates. Default is @code{0}.
  6803. @item repeatlast
  6804. Continue applying the last CLUT after the end of the stream. A value of
  6805. @code{0} disable the filter after the last frame of the CLUT is reached.
  6806. Default is @code{1}.
  6807. @end table
  6808. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6809. filters share the same internals).
  6810. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6811. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6812. @subsection Workflow examples
  6813. @subsubsection Hald CLUT video stream
  6814. Generate an identity Hald CLUT stream altered with various effects:
  6815. @example
  6816. 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
  6817. @end example
  6818. Note: make sure you use a lossless codec.
  6819. Then use it with @code{haldclut} to apply it on some random stream:
  6820. @example
  6821. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6822. @end example
  6823. The Hald CLUT will be applied to the 10 first seconds (duration of
  6824. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6825. to the remaining frames of the @code{mandelbrot} stream.
  6826. @subsubsection Hald CLUT with preview
  6827. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6828. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6829. biggest possible square starting at the top left of the picture. The remaining
  6830. padding pixels (bottom or right) will be ignored. This area can be used to add
  6831. a preview of the Hald CLUT.
  6832. Typically, the following generated Hald CLUT will be supported by the
  6833. @code{haldclut} filter:
  6834. @example
  6835. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6836. pad=iw+320 [padded_clut];
  6837. smptebars=s=320x256, split [a][b];
  6838. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6839. [main][b] overlay=W-320" -frames:v 1 clut.png
  6840. @end example
  6841. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6842. bars are displayed on the right-top, and below the same color bars processed by
  6843. the color changes.
  6844. Then, the effect of this Hald CLUT can be visualized with:
  6845. @example
  6846. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6847. @end example
  6848. @section hflip
  6849. Flip the input video horizontally.
  6850. For example, to horizontally flip the input video with @command{ffmpeg}:
  6851. @example
  6852. ffmpeg -i in.avi -vf "hflip" out.avi
  6853. @end example
  6854. @section histeq
  6855. This filter applies a global color histogram equalization on a
  6856. per-frame basis.
  6857. It can be used to correct video that has a compressed range of pixel
  6858. intensities. The filter redistributes the pixel intensities to
  6859. equalize their distribution across the intensity range. It may be
  6860. viewed as an "automatically adjusting contrast filter". This filter is
  6861. useful only for correcting degraded or poorly captured source
  6862. video.
  6863. The filter accepts the following options:
  6864. @table @option
  6865. @item strength
  6866. Determine the amount of equalization to be applied. As the strength
  6867. is reduced, the distribution of pixel intensities more-and-more
  6868. approaches that of the input frame. The value must be a float number
  6869. in the range [0,1] and defaults to 0.200.
  6870. @item intensity
  6871. Set the maximum intensity that can generated and scale the output
  6872. values appropriately. The strength should be set as desired and then
  6873. the intensity can be limited if needed to avoid washing-out. The value
  6874. must be a float number in the range [0,1] and defaults to 0.210.
  6875. @item antibanding
  6876. Set the antibanding level. If enabled the filter will randomly vary
  6877. the luminance of output pixels by a small amount to avoid banding of
  6878. the histogram. Possible values are @code{none}, @code{weak} or
  6879. @code{strong}. It defaults to @code{none}.
  6880. @end table
  6881. @section histogram
  6882. Compute and draw a color distribution histogram for the input video.
  6883. The computed histogram is a representation of the color component
  6884. distribution in an image.
  6885. Standard histogram displays the color components distribution in an image.
  6886. Displays color graph for each color component. Shows distribution of
  6887. the Y, U, V, A or R, G, B components, depending on input format, in the
  6888. current frame. Below each graph a color component scale meter is shown.
  6889. The filter accepts the following options:
  6890. @table @option
  6891. @item level_height
  6892. Set height of level. Default value is @code{200}.
  6893. Allowed range is [50, 2048].
  6894. @item scale_height
  6895. Set height of color scale. Default value is @code{12}.
  6896. Allowed range is [0, 40].
  6897. @item display_mode
  6898. Set display mode.
  6899. It accepts the following values:
  6900. @table @samp
  6901. @item stack
  6902. Per color component graphs are placed below each other.
  6903. @item parade
  6904. Per color component graphs are placed side by side.
  6905. @item overlay
  6906. Presents information identical to that in the @code{parade}, except
  6907. that the graphs representing color components are superimposed directly
  6908. over one another.
  6909. @end table
  6910. Default is @code{stack}.
  6911. @item levels_mode
  6912. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6913. Default is @code{linear}.
  6914. @item components
  6915. Set what color components to display.
  6916. Default is @code{7}.
  6917. @item fgopacity
  6918. Set foreground opacity. Default is @code{0.7}.
  6919. @item bgopacity
  6920. Set background opacity. Default is @code{0.5}.
  6921. @end table
  6922. @subsection Examples
  6923. @itemize
  6924. @item
  6925. Calculate and draw histogram:
  6926. @example
  6927. ffplay -i input -vf histogram
  6928. @end example
  6929. @end itemize
  6930. @anchor{hqdn3d}
  6931. @section hqdn3d
  6932. This is a high precision/quality 3d denoise filter. It aims to reduce
  6933. image noise, producing smooth images and making still images really
  6934. still. It should enhance compressibility.
  6935. It accepts the following optional parameters:
  6936. @table @option
  6937. @item luma_spatial
  6938. A non-negative floating point number which specifies spatial luma strength.
  6939. It defaults to 4.0.
  6940. @item chroma_spatial
  6941. A non-negative floating point number which specifies spatial chroma strength.
  6942. It defaults to 3.0*@var{luma_spatial}/4.0.
  6943. @item luma_tmp
  6944. A floating point number which specifies luma temporal strength. It defaults to
  6945. 6.0*@var{luma_spatial}/4.0.
  6946. @item chroma_tmp
  6947. A floating point number which specifies chroma temporal strength. It defaults to
  6948. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6949. @end table
  6950. @section hwdownload
  6951. Download hardware frames to system memory.
  6952. The input must be in hardware frames, and the output a non-hardware format.
  6953. Not all formats will be supported on the output - it may be necessary to insert
  6954. an additional @option{format} filter immediately following in the graph to get
  6955. the output in a supported format.
  6956. @section hwmap
  6957. Map hardware frames to system memory or to another device.
  6958. This filter has several different modes of operation; which one is used depends
  6959. on the input and output formats:
  6960. @itemize
  6961. @item
  6962. Hardware frame input, normal frame output
  6963. Map the input frames to system memory and pass them to the output. If the
  6964. original hardware frame is later required (for example, after overlaying
  6965. something else on part of it), the @option{hwmap} filter can be used again
  6966. in the next mode to retrieve it.
  6967. @item
  6968. Normal frame input, hardware frame output
  6969. If the input is actually a software-mapped hardware frame, then unmap it -
  6970. that is, return the original hardware frame.
  6971. Otherwise, a device must be provided. Create new hardware surfaces on that
  6972. device for the output, then map them back to the software format at the input
  6973. and give those frames to the preceding filter. This will then act like the
  6974. @option{hwupload} filter, but may be able to avoid an additional copy when
  6975. the input is already in a compatible format.
  6976. @item
  6977. Hardware frame input and output
  6978. A device must be supplied for the output, either directly or with the
  6979. @option{derive_device} option. The input and output devices must be of
  6980. different types and compatible - the exact meaning of this is
  6981. system-dependent, but typically it means that they must refer to the same
  6982. underlying hardware context (for example, refer to the same graphics card).
  6983. If the input frames were originally created on the output device, then unmap
  6984. to retrieve the original frames.
  6985. Otherwise, map the frames to the output device - create new hardware frames
  6986. on the output corresponding to the frames on the input.
  6987. @end itemize
  6988. The following additional parameters are accepted:
  6989. @table @option
  6990. @item mode
  6991. Set the frame mapping mode. Some combination of:
  6992. @table @var
  6993. @item read
  6994. The mapped frame should be readable.
  6995. @item write
  6996. The mapped frame should be writeable.
  6997. @item overwrite
  6998. The mapping will always overwrite the entire frame.
  6999. This may improve performance in some cases, as the original contents of the
  7000. frame need not be loaded.
  7001. @item direct
  7002. The mapping must not involve any copying.
  7003. Indirect mappings to copies of frames are created in some cases where either
  7004. direct mapping is not possible or it would have unexpected properties.
  7005. Setting this flag ensures that the mapping is direct and will fail if that is
  7006. not possible.
  7007. @end table
  7008. Defaults to @var{read+write} if not specified.
  7009. @item derive_device @var{type}
  7010. Rather than using the device supplied at initialisation, instead derive a new
  7011. device of type @var{type} from the device the input frames exist on.
  7012. @item reverse
  7013. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7014. and map them back to the source. This may be necessary in some cases where
  7015. a mapping in one direction is required but only the opposite direction is
  7016. supported by the devices being used.
  7017. This option is dangerous - it may break the preceding filter in undefined
  7018. ways if there are any additional constraints on that filter's output.
  7019. Do not use it without fully understanding the implications of its use.
  7020. @end table
  7021. @section hwupload
  7022. Upload system memory frames to hardware surfaces.
  7023. The device to upload to must be supplied when the filter is initialised. If
  7024. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7025. option.
  7026. @anchor{hwupload_cuda}
  7027. @section hwupload_cuda
  7028. Upload system memory frames to a CUDA device.
  7029. It accepts the following optional parameters:
  7030. @table @option
  7031. @item device
  7032. The number of the CUDA device to use
  7033. @end table
  7034. @section hqx
  7035. Apply a high-quality magnification filter designed for pixel art. This filter
  7036. was originally created by Maxim Stepin.
  7037. It accepts the following option:
  7038. @table @option
  7039. @item n
  7040. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7041. @code{hq3x} and @code{4} for @code{hq4x}.
  7042. Default is @code{3}.
  7043. @end table
  7044. @section hstack
  7045. Stack input videos horizontally.
  7046. All streams must be of same pixel format and of same height.
  7047. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7048. to create same output.
  7049. The filter accept the following option:
  7050. @table @option
  7051. @item inputs
  7052. Set number of input streams. Default is 2.
  7053. @item shortest
  7054. If set to 1, force the output to terminate when the shortest input
  7055. terminates. Default value is 0.
  7056. @end table
  7057. @section hue
  7058. Modify the hue and/or the saturation of the input.
  7059. It accepts the following parameters:
  7060. @table @option
  7061. @item h
  7062. Specify the hue angle as a number of degrees. It accepts an expression,
  7063. and defaults to "0".
  7064. @item s
  7065. Specify the saturation in the [-10,10] range. It accepts an expression and
  7066. defaults to "1".
  7067. @item H
  7068. Specify the hue angle as a number of radians. It accepts an
  7069. expression, and defaults to "0".
  7070. @item b
  7071. Specify the brightness in the [-10,10] range. It accepts an expression and
  7072. defaults to "0".
  7073. @end table
  7074. @option{h} and @option{H} are mutually exclusive, and can't be
  7075. specified at the same time.
  7076. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7077. expressions containing the following constants:
  7078. @table @option
  7079. @item n
  7080. frame count of the input frame starting from 0
  7081. @item pts
  7082. presentation timestamp of the input frame expressed in time base units
  7083. @item r
  7084. frame rate of the input video, NAN if the input frame rate is unknown
  7085. @item t
  7086. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7087. @item tb
  7088. time base of the input video
  7089. @end table
  7090. @subsection Examples
  7091. @itemize
  7092. @item
  7093. Set the hue to 90 degrees and the saturation to 1.0:
  7094. @example
  7095. hue=h=90:s=1
  7096. @end example
  7097. @item
  7098. Same command but expressing the hue in radians:
  7099. @example
  7100. hue=H=PI/2:s=1
  7101. @end example
  7102. @item
  7103. Rotate hue and make the saturation swing between 0
  7104. and 2 over a period of 1 second:
  7105. @example
  7106. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7107. @end example
  7108. @item
  7109. Apply a 3 seconds saturation fade-in effect starting at 0:
  7110. @example
  7111. hue="s=min(t/3\,1)"
  7112. @end example
  7113. The general fade-in expression can be written as:
  7114. @example
  7115. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7116. @end example
  7117. @item
  7118. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7119. @example
  7120. hue="s=max(0\, min(1\, (8-t)/3))"
  7121. @end example
  7122. The general fade-out expression can be written as:
  7123. @example
  7124. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7125. @end example
  7126. @end itemize
  7127. @subsection Commands
  7128. This filter supports the following commands:
  7129. @table @option
  7130. @item b
  7131. @item s
  7132. @item h
  7133. @item H
  7134. Modify the hue and/or the saturation and/or brightness of the input video.
  7135. The command accepts the same syntax of the corresponding option.
  7136. If the specified expression is not valid, it is kept at its current
  7137. value.
  7138. @end table
  7139. @section hysteresis
  7140. Grow first stream into second stream by connecting components.
  7141. This makes it possible to build more robust edge masks.
  7142. This filter accepts the following options:
  7143. @table @option
  7144. @item planes
  7145. Set which planes will be processed as bitmap, unprocessed planes will be
  7146. copied from first stream.
  7147. By default value 0xf, all planes will be processed.
  7148. @item threshold
  7149. Set threshold which is used in filtering. If pixel component value is higher than
  7150. this value filter algorithm for connecting components is activated.
  7151. By default value is 0.
  7152. @end table
  7153. @section idet
  7154. Detect video interlacing type.
  7155. This filter tries to detect if the input frames are interlaced, progressive,
  7156. top or bottom field first. It will also try to detect fields that are
  7157. repeated between adjacent frames (a sign of telecine).
  7158. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7159. Multiple frame detection incorporates the classification history of previous frames.
  7160. The filter will log these metadata values:
  7161. @table @option
  7162. @item single.current_frame
  7163. Detected type of current frame using single-frame detection. One of:
  7164. ``tff'' (top field first), ``bff'' (bottom field first),
  7165. ``progressive'', or ``undetermined''
  7166. @item single.tff
  7167. Cumulative number of frames detected as top field first using single-frame detection.
  7168. @item multiple.tff
  7169. Cumulative number of frames detected as top field first using multiple-frame detection.
  7170. @item single.bff
  7171. Cumulative number of frames detected as bottom field first using single-frame detection.
  7172. @item multiple.current_frame
  7173. Detected type of current frame using multiple-frame detection. One of:
  7174. ``tff'' (top field first), ``bff'' (bottom field first),
  7175. ``progressive'', or ``undetermined''
  7176. @item multiple.bff
  7177. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7178. @item single.progressive
  7179. Cumulative number of frames detected as progressive using single-frame detection.
  7180. @item multiple.progressive
  7181. Cumulative number of frames detected as progressive using multiple-frame detection.
  7182. @item single.undetermined
  7183. Cumulative number of frames that could not be classified using single-frame detection.
  7184. @item multiple.undetermined
  7185. Cumulative number of frames that could not be classified using multiple-frame detection.
  7186. @item repeated.current_frame
  7187. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7188. @item repeated.neither
  7189. Cumulative number of frames with no repeated field.
  7190. @item repeated.top
  7191. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7192. @item repeated.bottom
  7193. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7194. @end table
  7195. The filter accepts the following options:
  7196. @table @option
  7197. @item intl_thres
  7198. Set interlacing threshold.
  7199. @item prog_thres
  7200. Set progressive threshold.
  7201. @item rep_thres
  7202. Threshold for repeated field detection.
  7203. @item half_life
  7204. Number of frames after which a given frame's contribution to the
  7205. statistics is halved (i.e., it contributes only 0.5 to its
  7206. classification). The default of 0 means that all frames seen are given
  7207. full weight of 1.0 forever.
  7208. @item analyze_interlaced_flag
  7209. When this is not 0 then idet will use the specified number of frames to determine
  7210. if the interlaced flag is accurate, it will not count undetermined frames.
  7211. If the flag is found to be accurate it will be used without any further
  7212. computations, if it is found to be inaccurate it will be cleared without any
  7213. further computations. This allows inserting the idet filter as a low computational
  7214. method to clean up the interlaced flag
  7215. @end table
  7216. @section il
  7217. Deinterleave or interleave fields.
  7218. This filter allows one to process interlaced images fields without
  7219. deinterlacing them. Deinterleaving splits the input frame into 2
  7220. fields (so called half pictures). Odd lines are moved to the top
  7221. half of the output image, even lines to the bottom half.
  7222. You can process (filter) them independently and then re-interleave them.
  7223. The filter accepts the following options:
  7224. @table @option
  7225. @item luma_mode, l
  7226. @item chroma_mode, c
  7227. @item alpha_mode, a
  7228. Available values for @var{luma_mode}, @var{chroma_mode} and
  7229. @var{alpha_mode} are:
  7230. @table @samp
  7231. @item none
  7232. Do nothing.
  7233. @item deinterleave, d
  7234. Deinterleave fields, placing one above the other.
  7235. @item interleave, i
  7236. Interleave fields. Reverse the effect of deinterleaving.
  7237. @end table
  7238. Default value is @code{none}.
  7239. @item luma_swap, ls
  7240. @item chroma_swap, cs
  7241. @item alpha_swap, as
  7242. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7243. @end table
  7244. @section inflate
  7245. Apply inflate effect to the video.
  7246. This filter replaces the pixel by the local(3x3) average by taking into account
  7247. only values higher than the pixel.
  7248. It accepts the following options:
  7249. @table @option
  7250. @item threshold0
  7251. @item threshold1
  7252. @item threshold2
  7253. @item threshold3
  7254. Limit the maximum change for each plane, default is 65535.
  7255. If 0, plane will remain unchanged.
  7256. @end table
  7257. @section interlace
  7258. Simple interlacing filter from progressive contents. This interleaves upper (or
  7259. lower) lines from odd frames with lower (or upper) lines from even frames,
  7260. halving the frame rate and preserving image height.
  7261. @example
  7262. Original Original New Frame
  7263. Frame 'j' Frame 'j+1' (tff)
  7264. ========== =========== ==================
  7265. Line 0 --------------------> Frame 'j' Line 0
  7266. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7267. Line 2 ---------------------> Frame 'j' Line 2
  7268. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7269. ... ... ...
  7270. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7271. @end example
  7272. It accepts the following optional parameters:
  7273. @table @option
  7274. @item scan
  7275. This determines whether the interlaced frame is taken from the even
  7276. (tff - default) or odd (bff) lines of the progressive frame.
  7277. @item lowpass
  7278. Vertical lowpass filter to avoid twitter interlacing and
  7279. reduce moire patterns.
  7280. @table @samp
  7281. @item 0, off
  7282. Disable vertical lowpass filter
  7283. @item 1, linear
  7284. Enable linear filter (default)
  7285. @item 2, complex
  7286. Enable complex filter. This will slightly less reduce twitter and moire
  7287. but better retain detail and subjective sharpness impression.
  7288. @end table
  7289. @end table
  7290. @section kerndeint
  7291. Deinterlace input video by applying Donald Graft's adaptive kernel
  7292. deinterling. Work on interlaced parts of a video to produce
  7293. progressive frames.
  7294. The description of the accepted parameters follows.
  7295. @table @option
  7296. @item thresh
  7297. Set the threshold which affects the filter's tolerance when
  7298. determining if a pixel line must be processed. It must be an integer
  7299. in the range [0,255] and defaults to 10. A value of 0 will result in
  7300. applying the process on every pixels.
  7301. @item map
  7302. Paint pixels exceeding the threshold value to white if set to 1.
  7303. Default is 0.
  7304. @item order
  7305. Set the fields order. Swap fields if set to 1, leave fields alone if
  7306. 0. Default is 0.
  7307. @item sharp
  7308. Enable additional sharpening if set to 1. Default is 0.
  7309. @item twoway
  7310. Enable twoway sharpening if set to 1. Default is 0.
  7311. @end table
  7312. @subsection Examples
  7313. @itemize
  7314. @item
  7315. Apply default values:
  7316. @example
  7317. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7318. @end example
  7319. @item
  7320. Enable additional sharpening:
  7321. @example
  7322. kerndeint=sharp=1
  7323. @end example
  7324. @item
  7325. Paint processed pixels in white:
  7326. @example
  7327. kerndeint=map=1
  7328. @end example
  7329. @end itemize
  7330. @section lenscorrection
  7331. Correct radial lens distortion
  7332. This filter can be used to correct for radial distortion as can result from the use
  7333. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7334. one can use tools available for example as part of opencv or simply trial-and-error.
  7335. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7336. and extract the k1 and k2 coefficients from the resulting matrix.
  7337. Note that effectively the same filter is available in the open-source tools Krita and
  7338. Digikam from the KDE project.
  7339. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7340. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7341. brightness distribution, so you may want to use both filters together in certain
  7342. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7343. be applied before or after lens correction.
  7344. @subsection Options
  7345. The filter accepts the following options:
  7346. @table @option
  7347. @item cx
  7348. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7349. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7350. width.
  7351. @item cy
  7352. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7353. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7354. height.
  7355. @item k1
  7356. Coefficient of the quadratic correction term. 0.5 means no correction.
  7357. @item k2
  7358. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7359. @end table
  7360. The formula that generates the correction is:
  7361. @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)
  7362. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7363. distances from the focal point in the source and target images, respectively.
  7364. @section loop
  7365. Loop video frames.
  7366. The filter accepts the following options:
  7367. @table @option
  7368. @item loop
  7369. Set the number of loops.
  7370. @item size
  7371. Set maximal size in number of frames.
  7372. @item start
  7373. Set first frame of loop.
  7374. @end table
  7375. @anchor{lut3d}
  7376. @section lut3d
  7377. Apply a 3D LUT to an input video.
  7378. The filter accepts the following options:
  7379. @table @option
  7380. @item file
  7381. Set the 3D LUT file name.
  7382. Currently supported formats:
  7383. @table @samp
  7384. @item 3dl
  7385. AfterEffects
  7386. @item cube
  7387. Iridas
  7388. @item dat
  7389. DaVinci
  7390. @item m3d
  7391. Pandora
  7392. @end table
  7393. @item interp
  7394. Select interpolation mode.
  7395. Available values are:
  7396. @table @samp
  7397. @item nearest
  7398. Use values from the nearest defined point.
  7399. @item trilinear
  7400. Interpolate values using the 8 points defining a cube.
  7401. @item tetrahedral
  7402. Interpolate values using a tetrahedron.
  7403. @end table
  7404. @end table
  7405. @section lumakey
  7406. Turn certain luma values into transparency.
  7407. The filter accepts the following options:
  7408. @table @option
  7409. @item threshold
  7410. Set the luma which will be used as base for transparency.
  7411. Default value is @code{0}.
  7412. @item tolerance
  7413. Set the range of luma values to be keyed out.
  7414. Default value is @code{0}.
  7415. @item softness
  7416. Set the range of softness. Default value is @code{0}.
  7417. Use this to control gradual transition from zero to full transparency.
  7418. @end table
  7419. @section lut, lutrgb, lutyuv
  7420. Compute a look-up table for binding each pixel component input value
  7421. to an output value, and apply it to the input video.
  7422. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7423. to an RGB input video.
  7424. These filters accept the following parameters:
  7425. @table @option
  7426. @item c0
  7427. set first pixel component expression
  7428. @item c1
  7429. set second pixel component expression
  7430. @item c2
  7431. set third pixel component expression
  7432. @item c3
  7433. set fourth pixel component expression, corresponds to the alpha component
  7434. @item r
  7435. set red component expression
  7436. @item g
  7437. set green component expression
  7438. @item b
  7439. set blue component expression
  7440. @item a
  7441. alpha component expression
  7442. @item y
  7443. set Y/luminance component expression
  7444. @item u
  7445. set U/Cb component expression
  7446. @item v
  7447. set V/Cr component expression
  7448. @end table
  7449. Each of them specifies the expression to use for computing the lookup table for
  7450. the corresponding pixel component values.
  7451. The exact component associated to each of the @var{c*} options depends on the
  7452. format in input.
  7453. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7454. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7455. The expressions can contain the following constants and functions:
  7456. @table @option
  7457. @item w
  7458. @item h
  7459. The input width and height.
  7460. @item val
  7461. The input value for the pixel component.
  7462. @item clipval
  7463. The input value, clipped to the @var{minval}-@var{maxval} range.
  7464. @item maxval
  7465. The maximum value for the pixel component.
  7466. @item minval
  7467. The minimum value for the pixel component.
  7468. @item negval
  7469. The negated value for the pixel component value, clipped to the
  7470. @var{minval}-@var{maxval} range; it corresponds to the expression
  7471. "maxval-clipval+minval".
  7472. @item clip(val)
  7473. The computed value in @var{val}, clipped to the
  7474. @var{minval}-@var{maxval} range.
  7475. @item gammaval(gamma)
  7476. The computed gamma correction value of the pixel component value,
  7477. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7478. expression
  7479. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7480. @end table
  7481. All expressions default to "val".
  7482. @subsection Examples
  7483. @itemize
  7484. @item
  7485. Negate input video:
  7486. @example
  7487. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7488. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7489. @end example
  7490. The above is the same as:
  7491. @example
  7492. lutrgb="r=negval:g=negval:b=negval"
  7493. lutyuv="y=negval:u=negval:v=negval"
  7494. @end example
  7495. @item
  7496. Negate luminance:
  7497. @example
  7498. lutyuv=y=negval
  7499. @end example
  7500. @item
  7501. Remove chroma components, turning the video into a graytone image:
  7502. @example
  7503. lutyuv="u=128:v=128"
  7504. @end example
  7505. @item
  7506. Apply a luma burning effect:
  7507. @example
  7508. lutyuv="y=2*val"
  7509. @end example
  7510. @item
  7511. Remove green and blue components:
  7512. @example
  7513. lutrgb="g=0:b=0"
  7514. @end example
  7515. @item
  7516. Set a constant alpha channel value on input:
  7517. @example
  7518. format=rgba,lutrgb=a="maxval-minval/2"
  7519. @end example
  7520. @item
  7521. Correct luminance gamma by a factor of 0.5:
  7522. @example
  7523. lutyuv=y=gammaval(0.5)
  7524. @end example
  7525. @item
  7526. Discard least significant bits of luma:
  7527. @example
  7528. lutyuv=y='bitand(val, 128+64+32)'
  7529. @end example
  7530. @item
  7531. Technicolor like effect:
  7532. @example
  7533. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7534. @end example
  7535. @end itemize
  7536. @section lut2
  7537. Compute and apply a lookup table from two video inputs.
  7538. This filter accepts the following parameters:
  7539. @table @option
  7540. @item c0
  7541. set first pixel component expression
  7542. @item c1
  7543. set second pixel component expression
  7544. @item c2
  7545. set third pixel component expression
  7546. @item c3
  7547. set fourth pixel component expression, corresponds to the alpha component
  7548. @end table
  7549. Each of them specifies the expression to use for computing the lookup table for
  7550. the corresponding pixel component values.
  7551. The exact component associated to each of the @var{c*} options depends on the
  7552. format in inputs.
  7553. The expressions can contain the following constants:
  7554. @table @option
  7555. @item w
  7556. @item h
  7557. The input width and height.
  7558. @item x
  7559. The first input value for the pixel component.
  7560. @item y
  7561. The second input value for the pixel component.
  7562. @item bdx
  7563. The first input video bit depth.
  7564. @item bdy
  7565. The second input video bit depth.
  7566. @end table
  7567. All expressions default to "x".
  7568. @subsection Examples
  7569. @itemize
  7570. @item
  7571. Highlight differences between two RGB video streams:
  7572. @example
  7573. 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)'
  7574. @end example
  7575. @item
  7576. Highlight differences between two YUV video streams:
  7577. @example
  7578. 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)'
  7579. @end example
  7580. @end itemize
  7581. @section maskedclamp
  7582. Clamp the first input stream with the second input and third input stream.
  7583. Returns the value of first stream to be between second input
  7584. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7585. This filter accepts the following options:
  7586. @table @option
  7587. @item undershoot
  7588. Default value is @code{0}.
  7589. @item overshoot
  7590. Default value is @code{0}.
  7591. @item planes
  7592. Set which planes will be processed as bitmap, unprocessed planes will be
  7593. copied from first stream.
  7594. By default value 0xf, all planes will be processed.
  7595. @end table
  7596. @section maskedmerge
  7597. Merge the first input stream with the second input stream using per pixel
  7598. weights in the third input stream.
  7599. A value of 0 in the third stream pixel component means that pixel component
  7600. from first stream is returned unchanged, while maximum value (eg. 255 for
  7601. 8-bit videos) means that pixel component from second stream is returned
  7602. unchanged. Intermediate values define the amount of merging between both
  7603. input stream's pixel components.
  7604. This filter accepts the following options:
  7605. @table @option
  7606. @item planes
  7607. Set which planes will be processed as bitmap, unprocessed planes will be
  7608. copied from first stream.
  7609. By default value 0xf, all planes will be processed.
  7610. @end table
  7611. @section mcdeint
  7612. Apply motion-compensation deinterlacing.
  7613. It needs one field per frame as input and must thus be used together
  7614. with yadif=1/3 or equivalent.
  7615. This filter accepts the following options:
  7616. @table @option
  7617. @item mode
  7618. Set the deinterlacing mode.
  7619. It accepts one of the following values:
  7620. @table @samp
  7621. @item fast
  7622. @item medium
  7623. @item slow
  7624. use iterative motion estimation
  7625. @item extra_slow
  7626. like @samp{slow}, but use multiple reference frames.
  7627. @end table
  7628. Default value is @samp{fast}.
  7629. @item parity
  7630. Set the picture field parity assumed for the input video. It must be
  7631. one of the following values:
  7632. @table @samp
  7633. @item 0, tff
  7634. assume top field first
  7635. @item 1, bff
  7636. assume bottom field first
  7637. @end table
  7638. Default value is @samp{bff}.
  7639. @item qp
  7640. Set per-block quantization parameter (QP) used by the internal
  7641. encoder.
  7642. Higher values should result in a smoother motion vector field but less
  7643. optimal individual vectors. Default value is 1.
  7644. @end table
  7645. @section mergeplanes
  7646. Merge color channel components from several video streams.
  7647. The filter accepts up to 4 input streams, and merge selected input
  7648. planes to the output video.
  7649. This filter accepts the following options:
  7650. @table @option
  7651. @item mapping
  7652. Set input to output plane mapping. Default is @code{0}.
  7653. The mappings is specified as a bitmap. It should be specified as a
  7654. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7655. mapping for the first plane of the output stream. 'A' sets the number of
  7656. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7657. corresponding input to use (from 0 to 3). The rest of the mappings is
  7658. similar, 'Bb' describes the mapping for the output stream second
  7659. plane, 'Cc' describes the mapping for the output stream third plane and
  7660. 'Dd' describes the mapping for the output stream fourth plane.
  7661. @item format
  7662. Set output pixel format. Default is @code{yuva444p}.
  7663. @end table
  7664. @subsection Examples
  7665. @itemize
  7666. @item
  7667. Merge three gray video streams of same width and height into single video stream:
  7668. @example
  7669. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7670. @end example
  7671. @item
  7672. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7673. @example
  7674. [a0][a1]mergeplanes=0x00010210:yuva444p
  7675. @end example
  7676. @item
  7677. Swap Y and A plane in yuva444p stream:
  7678. @example
  7679. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7680. @end example
  7681. @item
  7682. Swap U and V plane in yuv420p stream:
  7683. @example
  7684. format=yuv420p,mergeplanes=0x000201:yuv420p
  7685. @end example
  7686. @item
  7687. Cast a rgb24 clip to yuv444p:
  7688. @example
  7689. format=rgb24,mergeplanes=0x000102:yuv444p
  7690. @end example
  7691. @end itemize
  7692. @section mestimate
  7693. Estimate and export motion vectors using block matching algorithms.
  7694. Motion vectors are stored in frame side data to be used by other filters.
  7695. This filter accepts the following options:
  7696. @table @option
  7697. @item method
  7698. Specify the motion estimation method. Accepts one of the following values:
  7699. @table @samp
  7700. @item esa
  7701. Exhaustive search algorithm.
  7702. @item tss
  7703. Three step search algorithm.
  7704. @item tdls
  7705. Two dimensional logarithmic search algorithm.
  7706. @item ntss
  7707. New three step search algorithm.
  7708. @item fss
  7709. Four step search algorithm.
  7710. @item ds
  7711. Diamond search algorithm.
  7712. @item hexbs
  7713. Hexagon-based search algorithm.
  7714. @item epzs
  7715. Enhanced predictive zonal search algorithm.
  7716. @item umh
  7717. Uneven multi-hexagon search algorithm.
  7718. @end table
  7719. Default value is @samp{esa}.
  7720. @item mb_size
  7721. Macroblock size. Default @code{16}.
  7722. @item search_param
  7723. Search parameter. Default @code{7}.
  7724. @end table
  7725. @section midequalizer
  7726. Apply Midway Image Equalization effect using two video streams.
  7727. Midway Image Equalization adjusts a pair of images to have the same
  7728. histogram, while maintaining their dynamics as much as possible. It's
  7729. useful for e.g. matching exposures from a pair of stereo cameras.
  7730. This filter has two inputs and one output, which must be of same pixel format, but
  7731. may be of different sizes. The output of filter is first input adjusted with
  7732. midway histogram of both inputs.
  7733. This filter accepts the following option:
  7734. @table @option
  7735. @item planes
  7736. Set which planes to process. Default is @code{15}, which is all available planes.
  7737. @end table
  7738. @section minterpolate
  7739. Convert the video to specified frame rate using motion interpolation.
  7740. This filter accepts the following options:
  7741. @table @option
  7742. @item fps
  7743. 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}.
  7744. @item mi_mode
  7745. Motion interpolation mode. Following values are accepted:
  7746. @table @samp
  7747. @item dup
  7748. Duplicate previous or next frame for interpolating new ones.
  7749. @item blend
  7750. Blend source frames. Interpolated frame is mean of previous and next frames.
  7751. @item mci
  7752. Motion compensated interpolation. Following options are effective when this mode is selected:
  7753. @table @samp
  7754. @item mc_mode
  7755. Motion compensation mode. Following values are accepted:
  7756. @table @samp
  7757. @item obmc
  7758. Overlapped block motion compensation.
  7759. @item aobmc
  7760. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7761. @end table
  7762. Default mode is @samp{obmc}.
  7763. @item me_mode
  7764. Motion estimation mode. Following values are accepted:
  7765. @table @samp
  7766. @item bidir
  7767. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7768. @item bilat
  7769. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7770. @end table
  7771. Default mode is @samp{bilat}.
  7772. @item me
  7773. The algorithm to be used for motion estimation. Following values are accepted:
  7774. @table @samp
  7775. @item esa
  7776. Exhaustive search algorithm.
  7777. @item tss
  7778. Three step search algorithm.
  7779. @item tdls
  7780. Two dimensional logarithmic search algorithm.
  7781. @item ntss
  7782. New three step search algorithm.
  7783. @item fss
  7784. Four step search algorithm.
  7785. @item ds
  7786. Diamond search algorithm.
  7787. @item hexbs
  7788. Hexagon-based search algorithm.
  7789. @item epzs
  7790. Enhanced predictive zonal search algorithm.
  7791. @item umh
  7792. Uneven multi-hexagon search algorithm.
  7793. @end table
  7794. Default algorithm is @samp{epzs}.
  7795. @item mb_size
  7796. Macroblock size. Default @code{16}.
  7797. @item search_param
  7798. Motion estimation search parameter. Default @code{32}.
  7799. @item vsbmc
  7800. 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).
  7801. @end table
  7802. @end table
  7803. @item scd
  7804. 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:
  7805. @table @samp
  7806. @item none
  7807. Disable scene change detection.
  7808. @item fdiff
  7809. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7810. @end table
  7811. Default method is @samp{fdiff}.
  7812. @item scd_threshold
  7813. Scene change detection threshold. Default is @code{5.0}.
  7814. @end table
  7815. @section mpdecimate
  7816. Drop frames that do not differ greatly from the previous frame in
  7817. order to reduce frame rate.
  7818. The main use of this filter is for very-low-bitrate encoding
  7819. (e.g. streaming over dialup modem), but it could in theory be used for
  7820. fixing movies that were inverse-telecined incorrectly.
  7821. A description of the accepted options follows.
  7822. @table @option
  7823. @item max
  7824. Set the maximum number of consecutive frames which can be dropped (if
  7825. positive), or the minimum interval between dropped frames (if
  7826. negative). If the value is 0, the frame is dropped unregarding the
  7827. number of previous sequentially dropped frames.
  7828. Default value is 0.
  7829. @item hi
  7830. @item lo
  7831. @item frac
  7832. Set the dropping threshold values.
  7833. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7834. represent actual pixel value differences, so a threshold of 64
  7835. corresponds to 1 unit of difference for each pixel, or the same spread
  7836. out differently over the block.
  7837. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7838. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7839. meaning the whole image) differ by more than a threshold of @option{lo}.
  7840. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7841. 64*5, and default value for @option{frac} is 0.33.
  7842. @end table
  7843. @section negate
  7844. Negate input video.
  7845. It accepts an integer in input; if non-zero it negates the
  7846. alpha component (if available). The default value in input is 0.
  7847. @section nlmeans
  7848. Denoise frames using Non-Local Means algorithm.
  7849. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7850. context similarity is defined by comparing their surrounding patches of size
  7851. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7852. around the pixel.
  7853. Note that the research area defines centers for patches, which means some
  7854. patches will be made of pixels outside that research area.
  7855. The filter accepts the following options.
  7856. @table @option
  7857. @item s
  7858. Set denoising strength.
  7859. @item p
  7860. Set patch size.
  7861. @item pc
  7862. Same as @option{p} but for chroma planes.
  7863. The default value is @var{0} and means automatic.
  7864. @item r
  7865. Set research size.
  7866. @item rc
  7867. Same as @option{r} but for chroma planes.
  7868. The default value is @var{0} and means automatic.
  7869. @end table
  7870. @section nnedi
  7871. Deinterlace video using neural network edge directed interpolation.
  7872. This filter accepts the following options:
  7873. @table @option
  7874. @item weights
  7875. Mandatory option, without binary file filter can not work.
  7876. Currently file can be found here:
  7877. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7878. @item deint
  7879. Set which frames to deinterlace, by default it is @code{all}.
  7880. Can be @code{all} or @code{interlaced}.
  7881. @item field
  7882. Set mode of operation.
  7883. Can be one of the following:
  7884. @table @samp
  7885. @item af
  7886. Use frame flags, both fields.
  7887. @item a
  7888. Use frame flags, single field.
  7889. @item t
  7890. Use top field only.
  7891. @item b
  7892. Use bottom field only.
  7893. @item tf
  7894. Use both fields, top first.
  7895. @item bf
  7896. Use both fields, bottom first.
  7897. @end table
  7898. @item planes
  7899. Set which planes to process, by default filter process all frames.
  7900. @item nsize
  7901. Set size of local neighborhood around each pixel, used by the predictor neural
  7902. network.
  7903. Can be one of the following:
  7904. @table @samp
  7905. @item s8x6
  7906. @item s16x6
  7907. @item s32x6
  7908. @item s48x6
  7909. @item s8x4
  7910. @item s16x4
  7911. @item s32x4
  7912. @end table
  7913. @item nns
  7914. Set the number of neurons in predicctor neural network.
  7915. Can be one of the following:
  7916. @table @samp
  7917. @item n16
  7918. @item n32
  7919. @item n64
  7920. @item n128
  7921. @item n256
  7922. @end table
  7923. @item qual
  7924. Controls the number of different neural network predictions that are blended
  7925. together to compute the final output value. Can be @code{fast}, default or
  7926. @code{slow}.
  7927. @item etype
  7928. Set which set of weights to use in the predictor.
  7929. Can be one of the following:
  7930. @table @samp
  7931. @item a
  7932. weights trained to minimize absolute error
  7933. @item s
  7934. weights trained to minimize squared error
  7935. @end table
  7936. @item pscrn
  7937. Controls whether or not the prescreener neural network is used to decide
  7938. which pixels should be processed by the predictor neural network and which
  7939. can be handled by simple cubic interpolation.
  7940. The prescreener is trained to know whether cubic interpolation will be
  7941. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7942. The computational complexity of the prescreener nn is much less than that of
  7943. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7944. using the prescreener generally results in much faster processing.
  7945. The prescreener is pretty accurate, so the difference between using it and not
  7946. using it is almost always unnoticeable.
  7947. Can be one of the following:
  7948. @table @samp
  7949. @item none
  7950. @item original
  7951. @item new
  7952. @end table
  7953. Default is @code{new}.
  7954. @item fapprox
  7955. Set various debugging flags.
  7956. @end table
  7957. @section noformat
  7958. Force libavfilter not to use any of the specified pixel formats for the
  7959. input to the next filter.
  7960. It accepts the following parameters:
  7961. @table @option
  7962. @item pix_fmts
  7963. A '|'-separated list of pixel format names, such as
  7964. apix_fmts=yuv420p|monow|rgb24".
  7965. @end table
  7966. @subsection Examples
  7967. @itemize
  7968. @item
  7969. Force libavfilter to use a format different from @var{yuv420p} for the
  7970. input to the vflip filter:
  7971. @example
  7972. noformat=pix_fmts=yuv420p,vflip
  7973. @end example
  7974. @item
  7975. Convert the input video to any of the formats not contained in the list:
  7976. @example
  7977. noformat=yuv420p|yuv444p|yuv410p
  7978. @end example
  7979. @end itemize
  7980. @section noise
  7981. Add noise on video input frame.
  7982. The filter accepts the following options:
  7983. @table @option
  7984. @item all_seed
  7985. @item c0_seed
  7986. @item c1_seed
  7987. @item c2_seed
  7988. @item c3_seed
  7989. Set noise seed for specific pixel component or all pixel components in case
  7990. of @var{all_seed}. Default value is @code{123457}.
  7991. @item all_strength, alls
  7992. @item c0_strength, c0s
  7993. @item c1_strength, c1s
  7994. @item c2_strength, c2s
  7995. @item c3_strength, c3s
  7996. Set noise strength for specific pixel component or all pixel components in case
  7997. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7998. @item all_flags, allf
  7999. @item c0_flags, c0f
  8000. @item c1_flags, c1f
  8001. @item c2_flags, c2f
  8002. @item c3_flags, c3f
  8003. Set pixel component flags or set flags for all components if @var{all_flags}.
  8004. Available values for component flags are:
  8005. @table @samp
  8006. @item a
  8007. averaged temporal noise (smoother)
  8008. @item p
  8009. mix random noise with a (semi)regular pattern
  8010. @item t
  8011. temporal noise (noise pattern changes between frames)
  8012. @item u
  8013. uniform noise (gaussian otherwise)
  8014. @end table
  8015. @end table
  8016. @subsection Examples
  8017. Add temporal and uniform noise to input video:
  8018. @example
  8019. noise=alls=20:allf=t+u
  8020. @end example
  8021. @section null
  8022. Pass the video source unchanged to the output.
  8023. @section ocr
  8024. Optical Character Recognition
  8025. This filter uses Tesseract for optical character recognition.
  8026. It accepts the following options:
  8027. @table @option
  8028. @item datapath
  8029. Set datapath to tesseract data. Default is to use whatever was
  8030. set at installation.
  8031. @item language
  8032. Set language, default is "eng".
  8033. @item whitelist
  8034. Set character whitelist.
  8035. @item blacklist
  8036. Set character blacklist.
  8037. @end table
  8038. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8039. @section ocv
  8040. Apply a video transform using libopencv.
  8041. To enable this filter, install the libopencv library and headers and
  8042. configure FFmpeg with @code{--enable-libopencv}.
  8043. It accepts the following parameters:
  8044. @table @option
  8045. @item filter_name
  8046. The name of the libopencv filter to apply.
  8047. @item filter_params
  8048. The parameters to pass to the libopencv filter. If not specified, the default
  8049. values are assumed.
  8050. @end table
  8051. Refer to the official libopencv documentation for more precise
  8052. information:
  8053. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8054. Several libopencv filters are supported; see the following subsections.
  8055. @anchor{dilate}
  8056. @subsection dilate
  8057. Dilate an image by using a specific structuring element.
  8058. It corresponds to the libopencv function @code{cvDilate}.
  8059. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8060. @var{struct_el} represents a structuring element, and has the syntax:
  8061. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8062. @var{cols} and @var{rows} represent the number of columns and rows of
  8063. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8064. point, and @var{shape} the shape for the structuring element. @var{shape}
  8065. must be "rect", "cross", "ellipse", or "custom".
  8066. If the value for @var{shape} is "custom", it must be followed by a
  8067. string of the form "=@var{filename}". The file with name
  8068. @var{filename} is assumed to represent a binary image, with each
  8069. printable character corresponding to a bright pixel. When a custom
  8070. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8071. or columns and rows of the read file are assumed instead.
  8072. The default value for @var{struct_el} is "3x3+0x0/rect".
  8073. @var{nb_iterations} specifies the number of times the transform is
  8074. applied to the image, and defaults to 1.
  8075. Some examples:
  8076. @example
  8077. # Use the default values
  8078. ocv=dilate
  8079. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8080. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8081. # Read the shape from the file diamond.shape, iterating two times.
  8082. # The file diamond.shape may contain a pattern of characters like this
  8083. # *
  8084. # ***
  8085. # *****
  8086. # ***
  8087. # *
  8088. # The specified columns and rows are ignored
  8089. # but the anchor point coordinates are not
  8090. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8091. @end example
  8092. @subsection erode
  8093. Erode an image by using a specific structuring element.
  8094. It corresponds to the libopencv function @code{cvErode}.
  8095. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8096. with the same syntax and semantics as the @ref{dilate} filter.
  8097. @subsection smooth
  8098. Smooth the input video.
  8099. The filter takes the following parameters:
  8100. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8101. @var{type} is the type of smooth filter to apply, and must be one of
  8102. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8103. or "bilateral". The default value is "gaussian".
  8104. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8105. depend on the smooth type. @var{param1} and
  8106. @var{param2} accept integer positive values or 0. @var{param3} and
  8107. @var{param4} accept floating point values.
  8108. The default value for @var{param1} is 3. The default value for the
  8109. other parameters is 0.
  8110. These parameters correspond to the parameters assigned to the
  8111. libopencv function @code{cvSmooth}.
  8112. @section oscilloscope
  8113. 2D Video Oscilloscope.
  8114. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8115. It accepts the following parameters:
  8116. @table @option
  8117. @item x
  8118. Set scope center x position.
  8119. @item y
  8120. Set scope center y position.
  8121. @item s
  8122. Set scope size, relative to frame diagonal.
  8123. @item t
  8124. Set scope tilt/rotation.
  8125. @item o
  8126. Set trace opacity.
  8127. @item tx
  8128. Set trace center x position.
  8129. @item ty
  8130. Set trace center y position.
  8131. @item tw
  8132. Set trace width, relative to width of frame.
  8133. @item th
  8134. Set trace height, relative to height of frame.
  8135. @item c
  8136. Set which components to trace. By default it traces first three components.
  8137. @item g
  8138. Draw trace grid. By default is enabled.
  8139. @item st
  8140. Draw some statistics. By default is enabled.
  8141. @item sc
  8142. Draw scope. By default is enabled.
  8143. @end table
  8144. @subsection Examples
  8145. @itemize
  8146. @item
  8147. Inspect full first row of video frame.
  8148. @example
  8149. oscilloscope=x=0.5:y=0:s=1
  8150. @end example
  8151. @item
  8152. Inspect full last row of video frame.
  8153. @example
  8154. oscilloscope=x=0.5:y=1:s=1
  8155. @end example
  8156. @item
  8157. Inspect full 5th line of video frame of height 1080.
  8158. @example
  8159. oscilloscope=x=0.5:y=5/1080:s=1
  8160. @end example
  8161. @item
  8162. Inspect full last column of video frame.
  8163. @example
  8164. oscilloscope=x=1:y=0.5:s=1:t=1
  8165. @end example
  8166. @end itemize
  8167. @anchor{overlay}
  8168. @section overlay
  8169. Overlay one video on top of another.
  8170. It takes two inputs and has one output. The first input is the "main"
  8171. video on which the second input is overlaid.
  8172. It accepts the following parameters:
  8173. A description of the accepted options follows.
  8174. @table @option
  8175. @item x
  8176. @item y
  8177. Set the expression for the x and y coordinates of the overlaid video
  8178. on the main video. Default value is "0" for both expressions. In case
  8179. the expression is invalid, it is set to a huge value (meaning that the
  8180. overlay will not be displayed within the output visible area).
  8181. @item eof_action
  8182. The action to take when EOF is encountered on the secondary input; it accepts
  8183. one of the following values:
  8184. @table @option
  8185. @item repeat
  8186. Repeat the last frame (the default).
  8187. @item endall
  8188. End both streams.
  8189. @item pass
  8190. Pass the main input through.
  8191. @end table
  8192. @item eval
  8193. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8194. It accepts the following values:
  8195. @table @samp
  8196. @item init
  8197. only evaluate expressions once during the filter initialization or
  8198. when a command is processed
  8199. @item frame
  8200. evaluate expressions for each incoming frame
  8201. @end table
  8202. Default value is @samp{frame}.
  8203. @item shortest
  8204. If set to 1, force the output to terminate when the shortest input
  8205. terminates. Default value is 0.
  8206. @item format
  8207. Set the format for the output video.
  8208. It accepts the following values:
  8209. @table @samp
  8210. @item yuv420
  8211. force YUV420 output
  8212. @item yuv422
  8213. force YUV422 output
  8214. @item yuv444
  8215. force YUV444 output
  8216. @item rgb
  8217. force packed RGB output
  8218. @item gbrp
  8219. force planar RGB output
  8220. @end table
  8221. Default value is @samp{yuv420}.
  8222. @item rgb @emph{(deprecated)}
  8223. If set to 1, force the filter to accept inputs in the RGB
  8224. color space. Default value is 0. This option is deprecated, use
  8225. @option{format} instead.
  8226. @item repeatlast
  8227. If set to 1, force the filter to draw the last overlay frame over the
  8228. main input until the end of the stream. A value of 0 disables this
  8229. behavior. Default value is 1.
  8230. @end table
  8231. The @option{x}, and @option{y} expressions can contain the following
  8232. parameters.
  8233. @table @option
  8234. @item main_w, W
  8235. @item main_h, H
  8236. The main input width and height.
  8237. @item overlay_w, w
  8238. @item overlay_h, h
  8239. The overlay input width and height.
  8240. @item x
  8241. @item y
  8242. The computed values for @var{x} and @var{y}. They are evaluated for
  8243. each new frame.
  8244. @item hsub
  8245. @item vsub
  8246. horizontal and vertical chroma subsample values of the output
  8247. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8248. @var{vsub} is 1.
  8249. @item n
  8250. the number of input frame, starting from 0
  8251. @item pos
  8252. the position in the file of the input frame, NAN if unknown
  8253. @item t
  8254. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8255. @end table
  8256. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8257. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8258. when @option{eval} is set to @samp{init}.
  8259. Be aware that frames are taken from each input video in timestamp
  8260. order, hence, if their initial timestamps differ, it is a good idea
  8261. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8262. have them begin in the same zero timestamp, as the example for
  8263. the @var{movie} filter does.
  8264. You can chain together more overlays but you should test the
  8265. efficiency of such approach.
  8266. @subsection Commands
  8267. This filter supports the following commands:
  8268. @table @option
  8269. @item x
  8270. @item y
  8271. Modify the x and y of the overlay input.
  8272. The command accepts the same syntax of the corresponding option.
  8273. If the specified expression is not valid, it is kept at its current
  8274. value.
  8275. @end table
  8276. @subsection Examples
  8277. @itemize
  8278. @item
  8279. Draw the overlay at 10 pixels from the bottom right corner of the main
  8280. video:
  8281. @example
  8282. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8283. @end example
  8284. Using named options the example above becomes:
  8285. @example
  8286. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8287. @end example
  8288. @item
  8289. Insert a transparent PNG logo in the bottom left corner of the input,
  8290. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8291. @example
  8292. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8293. @end example
  8294. @item
  8295. Insert 2 different transparent PNG logos (second logo on bottom
  8296. right corner) using the @command{ffmpeg} tool:
  8297. @example
  8298. 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
  8299. @end example
  8300. @item
  8301. Add a transparent color layer on top of the main video; @code{WxH}
  8302. must specify the size of the main input to the overlay filter:
  8303. @example
  8304. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8305. @end example
  8306. @item
  8307. Play an original video and a filtered version (here with the deshake
  8308. filter) side by side using the @command{ffplay} tool:
  8309. @example
  8310. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8311. @end example
  8312. The above command is the same as:
  8313. @example
  8314. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8315. @end example
  8316. @item
  8317. Make a sliding overlay appearing from the left to the right top part of the
  8318. screen starting since time 2:
  8319. @example
  8320. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8321. @end example
  8322. @item
  8323. Compose output by putting two input videos side to side:
  8324. @example
  8325. ffmpeg -i left.avi -i right.avi -filter_complex "
  8326. nullsrc=size=200x100 [background];
  8327. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8328. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8329. [background][left] overlay=shortest=1 [background+left];
  8330. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8331. "
  8332. @end example
  8333. @item
  8334. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8335. @example
  8336. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8337. -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]'
  8338. masked.avi
  8339. @end example
  8340. @item
  8341. Chain several overlays in cascade:
  8342. @example
  8343. nullsrc=s=200x200 [bg];
  8344. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8345. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8346. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8347. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8348. [in3] null, [mid2] overlay=100:100 [out0]
  8349. @end example
  8350. @end itemize
  8351. @section owdenoise
  8352. Apply Overcomplete Wavelet denoiser.
  8353. The filter accepts the following options:
  8354. @table @option
  8355. @item depth
  8356. Set depth.
  8357. Larger depth values will denoise lower frequency components more, but
  8358. slow down filtering.
  8359. Must be an int in the range 8-16, default is @code{8}.
  8360. @item luma_strength, ls
  8361. Set luma strength.
  8362. Must be a double value in the range 0-1000, default is @code{1.0}.
  8363. @item chroma_strength, cs
  8364. Set chroma strength.
  8365. Must be a double value in the range 0-1000, default is @code{1.0}.
  8366. @end table
  8367. @anchor{pad}
  8368. @section pad
  8369. Add paddings to the input image, and place the original input at the
  8370. provided @var{x}, @var{y} coordinates.
  8371. It accepts the following parameters:
  8372. @table @option
  8373. @item width, w
  8374. @item height, h
  8375. Specify an expression for the size of the output image with the
  8376. paddings added. If the value for @var{width} or @var{height} is 0, the
  8377. corresponding input size is used for the output.
  8378. The @var{width} expression can reference the value set by the
  8379. @var{height} expression, and vice versa.
  8380. The default value of @var{width} and @var{height} is 0.
  8381. @item x
  8382. @item y
  8383. Specify the offsets to place the input image at within the padded area,
  8384. with respect to the top/left border of the output image.
  8385. The @var{x} expression can reference the value set by the @var{y}
  8386. expression, and vice versa.
  8387. The default value of @var{x} and @var{y} is 0.
  8388. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8389. so the input image is centered on the padded area.
  8390. @item color
  8391. Specify the color of the padded area. For the syntax of this option,
  8392. check the "Color" section in the ffmpeg-utils manual.
  8393. The default value of @var{color} is "black".
  8394. @item eval
  8395. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8396. It accepts the following values:
  8397. @table @samp
  8398. @item init
  8399. Only evaluate expressions once during the filter initialization or when
  8400. a command is processed.
  8401. @item frame
  8402. Evaluate expressions for each incoming frame.
  8403. @end table
  8404. Default value is @samp{init}.
  8405. @item aspect
  8406. Pad to aspect instead to a resolution.
  8407. @end table
  8408. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8409. options are expressions containing the following constants:
  8410. @table @option
  8411. @item in_w
  8412. @item in_h
  8413. The input video width and height.
  8414. @item iw
  8415. @item ih
  8416. These are the same as @var{in_w} and @var{in_h}.
  8417. @item out_w
  8418. @item out_h
  8419. The output width and height (the size of the padded area), as
  8420. specified by the @var{width} and @var{height} expressions.
  8421. @item ow
  8422. @item oh
  8423. These are the same as @var{out_w} and @var{out_h}.
  8424. @item x
  8425. @item y
  8426. The x and y offsets as specified by the @var{x} and @var{y}
  8427. expressions, or NAN if not yet specified.
  8428. @item a
  8429. same as @var{iw} / @var{ih}
  8430. @item sar
  8431. input sample aspect ratio
  8432. @item dar
  8433. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8434. @item hsub
  8435. @item vsub
  8436. The horizontal and vertical chroma subsample values. For example for the
  8437. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8438. @end table
  8439. @subsection Examples
  8440. @itemize
  8441. @item
  8442. Add paddings with the color "violet" to the input video. The output video
  8443. size is 640x480, and the top-left corner of the input video is placed at
  8444. column 0, row 40
  8445. @example
  8446. pad=640:480:0:40:violet
  8447. @end example
  8448. The example above is equivalent to the following command:
  8449. @example
  8450. pad=width=640:height=480:x=0:y=40:color=violet
  8451. @end example
  8452. @item
  8453. Pad the input to get an output with dimensions increased by 3/2,
  8454. and put the input video at the center of the padded area:
  8455. @example
  8456. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8457. @end example
  8458. @item
  8459. Pad the input to get a squared output with size equal to the maximum
  8460. value between the input width and height, and put the input video at
  8461. the center of the padded area:
  8462. @example
  8463. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8464. @end example
  8465. @item
  8466. Pad the input to get a final w/h ratio of 16:9:
  8467. @example
  8468. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8469. @end example
  8470. @item
  8471. In case of anamorphic video, in order to set the output display aspect
  8472. correctly, it is necessary to use @var{sar} in the expression,
  8473. according to the relation:
  8474. @example
  8475. (ih * X / ih) * sar = output_dar
  8476. X = output_dar / sar
  8477. @end example
  8478. Thus the previous example needs to be modified to:
  8479. @example
  8480. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8481. @end example
  8482. @item
  8483. Double the output size and put the input video in the bottom-right
  8484. corner of the output padded area:
  8485. @example
  8486. pad="2*iw:2*ih:ow-iw:oh-ih"
  8487. @end example
  8488. @end itemize
  8489. @anchor{palettegen}
  8490. @section palettegen
  8491. Generate one palette for a whole video stream.
  8492. It accepts the following options:
  8493. @table @option
  8494. @item max_colors
  8495. Set the maximum number of colors to quantize in the palette.
  8496. Note: the palette will still contain 256 colors; the unused palette entries
  8497. will be black.
  8498. @item reserve_transparent
  8499. Create a palette of 255 colors maximum and reserve the last one for
  8500. transparency. Reserving the transparency color is useful for GIF optimization.
  8501. If not set, the maximum of colors in the palette will be 256. You probably want
  8502. to disable this option for a standalone image.
  8503. Set by default.
  8504. @item stats_mode
  8505. Set statistics mode.
  8506. It accepts the following values:
  8507. @table @samp
  8508. @item full
  8509. Compute full frame histograms.
  8510. @item diff
  8511. Compute histograms only for the part that differs from previous frame. This
  8512. might be relevant to give more importance to the moving part of your input if
  8513. the background is static.
  8514. @item single
  8515. Compute new histogram for each frame.
  8516. @end table
  8517. Default value is @var{full}.
  8518. @end table
  8519. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8520. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8521. color quantization of the palette. This information is also visible at
  8522. @var{info} logging level.
  8523. @subsection Examples
  8524. @itemize
  8525. @item
  8526. Generate a representative palette of a given video using @command{ffmpeg}:
  8527. @example
  8528. ffmpeg -i input.mkv -vf palettegen palette.png
  8529. @end example
  8530. @end itemize
  8531. @section paletteuse
  8532. Use a palette to downsample an input video stream.
  8533. The filter takes two inputs: one video stream and a palette. The palette must
  8534. be a 256 pixels image.
  8535. It accepts the following options:
  8536. @table @option
  8537. @item dither
  8538. Select dithering mode. Available algorithms are:
  8539. @table @samp
  8540. @item bayer
  8541. Ordered 8x8 bayer dithering (deterministic)
  8542. @item heckbert
  8543. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8544. Note: this dithering is sometimes considered "wrong" and is included as a
  8545. reference.
  8546. @item floyd_steinberg
  8547. Floyd and Steingberg dithering (error diffusion)
  8548. @item sierra2
  8549. Frankie Sierra dithering v2 (error diffusion)
  8550. @item sierra2_4a
  8551. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8552. @end table
  8553. Default is @var{sierra2_4a}.
  8554. @item bayer_scale
  8555. When @var{bayer} dithering is selected, this option defines the scale of the
  8556. pattern (how much the crosshatch pattern is visible). A low value means more
  8557. visible pattern for less banding, and higher value means less visible pattern
  8558. at the cost of more banding.
  8559. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8560. @item diff_mode
  8561. If set, define the zone to process
  8562. @table @samp
  8563. @item rectangle
  8564. Only the changing rectangle will be reprocessed. This is similar to GIF
  8565. cropping/offsetting compression mechanism. This option can be useful for speed
  8566. if only a part of the image is changing, and has use cases such as limiting the
  8567. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8568. moving scene (it leads to more deterministic output if the scene doesn't change
  8569. much, and as a result less moving noise and better GIF compression).
  8570. @end table
  8571. Default is @var{none}.
  8572. @item new
  8573. Take new palette for each output frame.
  8574. @end table
  8575. @subsection Examples
  8576. @itemize
  8577. @item
  8578. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8579. using @command{ffmpeg}:
  8580. @example
  8581. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8582. @end example
  8583. @end itemize
  8584. @section perspective
  8585. Correct perspective of video not recorded perpendicular to the screen.
  8586. A description of the accepted parameters follows.
  8587. @table @option
  8588. @item x0
  8589. @item y0
  8590. @item x1
  8591. @item y1
  8592. @item x2
  8593. @item y2
  8594. @item x3
  8595. @item y3
  8596. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8597. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8598. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8599. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8600. then the corners of the source will be sent to the specified coordinates.
  8601. The expressions can use the following variables:
  8602. @table @option
  8603. @item W
  8604. @item H
  8605. the width and height of video frame.
  8606. @item in
  8607. Input frame count.
  8608. @item on
  8609. Output frame count.
  8610. @end table
  8611. @item interpolation
  8612. Set interpolation for perspective correction.
  8613. It accepts the following values:
  8614. @table @samp
  8615. @item linear
  8616. @item cubic
  8617. @end table
  8618. Default value is @samp{linear}.
  8619. @item sense
  8620. Set interpretation of coordinate options.
  8621. It accepts the following values:
  8622. @table @samp
  8623. @item 0, source
  8624. Send point in the source specified by the given coordinates to
  8625. the corners of the destination.
  8626. @item 1, destination
  8627. Send the corners of the source to the point in the destination specified
  8628. by the given coordinates.
  8629. Default value is @samp{source}.
  8630. @end table
  8631. @item eval
  8632. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8633. It accepts the following values:
  8634. @table @samp
  8635. @item init
  8636. only evaluate expressions once during the filter initialization or
  8637. when a command is processed
  8638. @item frame
  8639. evaluate expressions for each incoming frame
  8640. @end table
  8641. Default value is @samp{init}.
  8642. @end table
  8643. @section phase
  8644. Delay interlaced video by one field time so that the field order changes.
  8645. The intended use is to fix PAL movies that have been captured with the
  8646. opposite field order to the film-to-video transfer.
  8647. A description of the accepted parameters follows.
  8648. @table @option
  8649. @item mode
  8650. Set phase mode.
  8651. It accepts the following values:
  8652. @table @samp
  8653. @item t
  8654. Capture field order top-first, transfer bottom-first.
  8655. Filter will delay the bottom field.
  8656. @item b
  8657. Capture field order bottom-first, transfer top-first.
  8658. Filter will delay the top field.
  8659. @item p
  8660. Capture and transfer with the same field order. This mode only exists
  8661. for the documentation of the other options to refer to, but if you
  8662. actually select it, the filter will faithfully do nothing.
  8663. @item a
  8664. Capture field order determined automatically by field flags, transfer
  8665. opposite.
  8666. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8667. basis using field flags. If no field information is available,
  8668. then this works just like @samp{u}.
  8669. @item u
  8670. Capture unknown or varying, transfer opposite.
  8671. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8672. analyzing the images and selecting the alternative that produces best
  8673. match between the fields.
  8674. @item T
  8675. Capture top-first, transfer unknown or varying.
  8676. Filter selects among @samp{t} and @samp{p} using image analysis.
  8677. @item B
  8678. Capture bottom-first, transfer unknown or varying.
  8679. Filter selects among @samp{b} and @samp{p} using image analysis.
  8680. @item A
  8681. Capture determined by field flags, transfer unknown or varying.
  8682. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8683. image analysis. If no field information is available, then this works just
  8684. like @samp{U}. This is the default mode.
  8685. @item U
  8686. Both capture and transfer unknown or varying.
  8687. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8688. @end table
  8689. @end table
  8690. @section pixdesctest
  8691. Pixel format descriptor test filter, mainly useful for internal
  8692. testing. The output video should be equal to the input video.
  8693. For example:
  8694. @example
  8695. format=monow, pixdesctest
  8696. @end example
  8697. can be used to test the monowhite pixel format descriptor definition.
  8698. @section pixscope
  8699. Display sample values of color channels. Mainly useful for checking color and levels.
  8700. The filters accept the following options:
  8701. @table @option
  8702. @item x
  8703. Set scope X position, offset on X axis.
  8704. @item y
  8705. Set scope Y position, offset on Y axis.
  8706. @item w
  8707. Set scope width.
  8708. @item h
  8709. Set scope height.
  8710. @item o
  8711. Set window opacity. This window also holds statistics about pixel area.
  8712. @end table
  8713. @section pp
  8714. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8715. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8716. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8717. Each subfilter and some options have a short and a long name that can be used
  8718. interchangeably, i.e. dr/dering are the same.
  8719. The filters accept the following options:
  8720. @table @option
  8721. @item subfilters
  8722. Set postprocessing subfilters string.
  8723. @end table
  8724. All subfilters share common options to determine their scope:
  8725. @table @option
  8726. @item a/autoq
  8727. Honor the quality commands for this subfilter.
  8728. @item c/chrom
  8729. Do chrominance filtering, too (default).
  8730. @item y/nochrom
  8731. Do luminance filtering only (no chrominance).
  8732. @item n/noluma
  8733. Do chrominance filtering only (no luminance).
  8734. @end table
  8735. These options can be appended after the subfilter name, separated by a '|'.
  8736. Available subfilters are:
  8737. @table @option
  8738. @item hb/hdeblock[|difference[|flatness]]
  8739. Horizontal deblocking filter
  8740. @table @option
  8741. @item difference
  8742. Difference factor where higher values mean more deblocking (default: @code{32}).
  8743. @item flatness
  8744. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8745. @end table
  8746. @item vb/vdeblock[|difference[|flatness]]
  8747. Vertical deblocking filter
  8748. @table @option
  8749. @item difference
  8750. Difference factor where higher values mean more deblocking (default: @code{32}).
  8751. @item flatness
  8752. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8753. @end table
  8754. @item ha/hadeblock[|difference[|flatness]]
  8755. Accurate horizontal deblocking filter
  8756. @table @option
  8757. @item difference
  8758. Difference factor where higher values mean more deblocking (default: @code{32}).
  8759. @item flatness
  8760. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8761. @end table
  8762. @item va/vadeblock[|difference[|flatness]]
  8763. Accurate vertical deblocking filter
  8764. @table @option
  8765. @item difference
  8766. Difference factor where higher values mean more deblocking (default: @code{32}).
  8767. @item flatness
  8768. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8769. @end table
  8770. @end table
  8771. The horizontal and vertical deblocking filters share the difference and
  8772. flatness values so you cannot set different horizontal and vertical
  8773. thresholds.
  8774. @table @option
  8775. @item h1/x1hdeblock
  8776. Experimental horizontal deblocking filter
  8777. @item v1/x1vdeblock
  8778. Experimental vertical deblocking filter
  8779. @item dr/dering
  8780. Deringing filter
  8781. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8782. @table @option
  8783. @item threshold1
  8784. larger -> stronger filtering
  8785. @item threshold2
  8786. larger -> stronger filtering
  8787. @item threshold3
  8788. larger -> stronger filtering
  8789. @end table
  8790. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8791. @table @option
  8792. @item f/fullyrange
  8793. Stretch luminance to @code{0-255}.
  8794. @end table
  8795. @item lb/linblenddeint
  8796. Linear blend deinterlacing filter that deinterlaces the given block by
  8797. filtering all lines with a @code{(1 2 1)} filter.
  8798. @item li/linipoldeint
  8799. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8800. linearly interpolating every second line.
  8801. @item ci/cubicipoldeint
  8802. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8803. cubically interpolating every second line.
  8804. @item md/mediandeint
  8805. Median deinterlacing filter that deinterlaces the given block by applying a
  8806. median filter to every second line.
  8807. @item fd/ffmpegdeint
  8808. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8809. second line with a @code{(-1 4 2 4 -1)} filter.
  8810. @item l5/lowpass5
  8811. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8812. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8813. @item fq/forceQuant[|quantizer]
  8814. Overrides the quantizer table from the input with the constant quantizer you
  8815. specify.
  8816. @table @option
  8817. @item quantizer
  8818. Quantizer to use
  8819. @end table
  8820. @item de/default
  8821. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8822. @item fa/fast
  8823. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8824. @item ac
  8825. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8826. @end table
  8827. @subsection Examples
  8828. @itemize
  8829. @item
  8830. Apply horizontal and vertical deblocking, deringing and automatic
  8831. brightness/contrast:
  8832. @example
  8833. pp=hb/vb/dr/al
  8834. @end example
  8835. @item
  8836. Apply default filters without brightness/contrast correction:
  8837. @example
  8838. pp=de/-al
  8839. @end example
  8840. @item
  8841. Apply default filters and temporal denoiser:
  8842. @example
  8843. pp=default/tmpnoise|1|2|3
  8844. @end example
  8845. @item
  8846. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8847. automatically depending on available CPU time:
  8848. @example
  8849. pp=hb|y/vb|a
  8850. @end example
  8851. @end itemize
  8852. @section pp7
  8853. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8854. similar to spp = 6 with 7 point DCT, where only the center sample is
  8855. used after IDCT.
  8856. The filter accepts the following options:
  8857. @table @option
  8858. @item qp
  8859. Force a constant quantization parameter. It accepts an integer in range
  8860. 0 to 63. If not set, the filter will use the QP from the video stream
  8861. (if available).
  8862. @item mode
  8863. Set thresholding mode. Available modes are:
  8864. @table @samp
  8865. @item hard
  8866. Set hard thresholding.
  8867. @item soft
  8868. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8869. @item medium
  8870. Set medium thresholding (good results, default).
  8871. @end table
  8872. @end table
  8873. @section premultiply
  8874. Apply alpha premultiply effect to input video stream using first plane
  8875. of second stream as alpha.
  8876. Both streams must have same dimensions and same pixel format.
  8877. The filter accepts the following option:
  8878. @table @option
  8879. @item planes
  8880. Set which planes will be processed, unprocessed planes will be copied.
  8881. By default value 0xf, all planes will be processed.
  8882. @end table
  8883. @section prewitt
  8884. Apply prewitt operator to input video stream.
  8885. The filter accepts the following option:
  8886. @table @option
  8887. @item planes
  8888. Set which planes will be processed, unprocessed planes will be copied.
  8889. By default value 0xf, all planes will be processed.
  8890. @item scale
  8891. Set value which will be multiplied with filtered result.
  8892. @item delta
  8893. Set value which will be added to filtered result.
  8894. @end table
  8895. @section psnr
  8896. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8897. Ratio) between two input videos.
  8898. This filter takes in input two input videos, the first input is
  8899. considered the "main" source and is passed unchanged to the
  8900. output. The second input is used as a "reference" video for computing
  8901. the PSNR.
  8902. Both video inputs must have the same resolution and pixel format for
  8903. this filter to work correctly. Also it assumes that both inputs
  8904. have the same number of frames, which are compared one by one.
  8905. The obtained average PSNR is printed through the logging system.
  8906. The filter stores the accumulated MSE (mean squared error) of each
  8907. frame, and at the end of the processing it is averaged across all frames
  8908. equally, and the following formula is applied to obtain the PSNR:
  8909. @example
  8910. PSNR = 10*log10(MAX^2/MSE)
  8911. @end example
  8912. Where MAX is the average of the maximum values of each component of the
  8913. image.
  8914. The description of the accepted parameters follows.
  8915. @table @option
  8916. @item stats_file, f
  8917. If specified the filter will use the named file to save the PSNR of
  8918. each individual frame. When filename equals "-" the data is sent to
  8919. standard output.
  8920. @item stats_version
  8921. Specifies which version of the stats file format to use. Details of
  8922. each format are written below.
  8923. Default value is 1.
  8924. @item stats_add_max
  8925. Determines whether the max value is output to the stats log.
  8926. Default value is 0.
  8927. Requires stats_version >= 2. If this is set and stats_version < 2,
  8928. the filter will return an error.
  8929. @end table
  8930. The file printed if @var{stats_file} is selected, contains a sequence of
  8931. key/value pairs of the form @var{key}:@var{value} for each compared
  8932. couple of frames.
  8933. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8934. the list of per-frame-pair stats, with key value pairs following the frame
  8935. format with the following parameters:
  8936. @table @option
  8937. @item psnr_log_version
  8938. The version of the log file format. Will match @var{stats_version}.
  8939. @item fields
  8940. A comma separated list of the per-frame-pair parameters included in
  8941. the log.
  8942. @end table
  8943. A description of each shown per-frame-pair parameter follows:
  8944. @table @option
  8945. @item n
  8946. sequential number of the input frame, starting from 1
  8947. @item mse_avg
  8948. Mean Square Error pixel-by-pixel average difference of the compared
  8949. frames, averaged over all the image components.
  8950. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8951. Mean Square Error pixel-by-pixel average difference of the compared
  8952. frames for the component specified by the suffix.
  8953. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8954. Peak Signal to Noise ratio of the compared frames for the component
  8955. specified by the suffix.
  8956. @item max_avg, max_y, max_u, max_v
  8957. Maximum allowed value for each channel, and average over all
  8958. channels.
  8959. @end table
  8960. For example:
  8961. @example
  8962. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8963. [main][ref] psnr="stats_file=stats.log" [out]
  8964. @end example
  8965. On this example the input file being processed is compared with the
  8966. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8967. is stored in @file{stats.log}.
  8968. @anchor{pullup}
  8969. @section pullup
  8970. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8971. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8972. content.
  8973. The pullup filter is designed to take advantage of future context in making
  8974. its decisions. This filter is stateless in the sense that it does not lock
  8975. onto a pattern to follow, but it instead looks forward to the following
  8976. fields in order to identify matches and rebuild progressive frames.
  8977. To produce content with an even framerate, insert the fps filter after
  8978. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8979. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8980. The filter accepts the following options:
  8981. @table @option
  8982. @item jl
  8983. @item jr
  8984. @item jt
  8985. @item jb
  8986. These options set the amount of "junk" to ignore at the left, right, top, and
  8987. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8988. while top and bottom are in units of 2 lines.
  8989. The default is 8 pixels on each side.
  8990. @item sb
  8991. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8992. filter generating an occasional mismatched frame, but it may also cause an
  8993. excessive number of frames to be dropped during high motion sequences.
  8994. Conversely, setting it to -1 will make filter match fields more easily.
  8995. This may help processing of video where there is slight blurring between
  8996. the fields, but may also cause there to be interlaced frames in the output.
  8997. Default value is @code{0}.
  8998. @item mp
  8999. Set the metric plane to use. It accepts the following values:
  9000. @table @samp
  9001. @item l
  9002. Use luma plane.
  9003. @item u
  9004. Use chroma blue plane.
  9005. @item v
  9006. Use chroma red plane.
  9007. @end table
  9008. This option may be set to use chroma plane instead of the default luma plane
  9009. for doing filter's computations. This may improve accuracy on very clean
  9010. source material, but more likely will decrease accuracy, especially if there
  9011. is chroma noise (rainbow effect) or any grayscale video.
  9012. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9013. load and make pullup usable in realtime on slow machines.
  9014. @end table
  9015. For best results (without duplicated frames in the output file) it is
  9016. necessary to change the output frame rate. For example, to inverse
  9017. telecine NTSC input:
  9018. @example
  9019. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9020. @end example
  9021. @section qp
  9022. Change video quantization parameters (QP).
  9023. The filter accepts the following option:
  9024. @table @option
  9025. @item qp
  9026. Set expression for quantization parameter.
  9027. @end table
  9028. The expression is evaluated through the eval API and can contain, among others,
  9029. the following constants:
  9030. @table @var
  9031. @item known
  9032. 1 if index is not 129, 0 otherwise.
  9033. @item qp
  9034. Sequentional index starting from -129 to 128.
  9035. @end table
  9036. @subsection Examples
  9037. @itemize
  9038. @item
  9039. Some equation like:
  9040. @example
  9041. qp=2+2*sin(PI*qp)
  9042. @end example
  9043. @end itemize
  9044. @section random
  9045. Flush video frames from internal cache of frames into a random order.
  9046. No frame is discarded.
  9047. Inspired by @ref{frei0r} nervous filter.
  9048. @table @option
  9049. @item frames
  9050. Set size in number of frames of internal cache, in range from @code{2} to
  9051. @code{512}. Default is @code{30}.
  9052. @item seed
  9053. Set seed for random number generator, must be an integer included between
  9054. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9055. less than @code{0}, the filter will try to use a good random seed on a
  9056. best effort basis.
  9057. @end table
  9058. @section readeia608
  9059. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9060. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9061. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9062. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9063. @table @option
  9064. @item lavfi.readeia608.X.cc
  9065. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9066. @item lavfi.readeia608.X.line
  9067. The number of the line on which the EIA-608 data was identified and read.
  9068. @end table
  9069. This filter accepts the following options:
  9070. @table @option
  9071. @item scan_min
  9072. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9073. @item scan_max
  9074. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9075. @item mac
  9076. Set minimal acceptable amplitude change for sync codes detection.
  9077. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9078. @item spw
  9079. Set the ratio of width reserved for sync code detection.
  9080. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9081. @item mhd
  9082. Set the max peaks height difference for sync code detection.
  9083. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9084. @item mpd
  9085. Set max peaks period difference for sync code detection.
  9086. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9087. @item msd
  9088. Set the first two max start code bits differences.
  9089. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9090. @item bhd
  9091. Set the minimum ratio of bits height compared to 3rd start code bit.
  9092. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9093. @item th_w
  9094. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9095. @item th_b
  9096. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9097. @item chp
  9098. Enable checking the parity bit. In the event of a parity error, the filter will output
  9099. @code{0x00} for that character. Default is false.
  9100. @end table
  9101. @subsection Examples
  9102. @itemize
  9103. @item
  9104. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9105. @example
  9106. 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
  9107. @end example
  9108. @end itemize
  9109. @section readvitc
  9110. Read vertical interval timecode (VITC) information from the top lines of a
  9111. video frame.
  9112. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9113. timecode value, if a valid timecode has been detected. Further metadata key
  9114. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9115. timecode data has been found or not.
  9116. This filter accepts the following options:
  9117. @table @option
  9118. @item scan_max
  9119. Set the maximum number of lines to scan for VITC data. If the value is set to
  9120. @code{-1} the full video frame is scanned. Default is @code{45}.
  9121. @item thr_b
  9122. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9123. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9124. @item thr_w
  9125. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9126. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9127. @end table
  9128. @subsection Examples
  9129. @itemize
  9130. @item
  9131. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9132. draw @code{--:--:--:--} as a placeholder:
  9133. @example
  9134. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9135. @end example
  9136. @end itemize
  9137. @section remap
  9138. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9139. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9140. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9141. value for pixel will be used for destination pixel.
  9142. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9143. will have Xmap/Ymap video stream dimensions.
  9144. Xmap and Ymap input video streams are 16bit depth, single channel.
  9145. @section removegrain
  9146. The removegrain filter is a spatial denoiser for progressive video.
  9147. @table @option
  9148. @item m0
  9149. Set mode for the first plane.
  9150. @item m1
  9151. Set mode for the second plane.
  9152. @item m2
  9153. Set mode for the third plane.
  9154. @item m3
  9155. Set mode for the fourth plane.
  9156. @end table
  9157. Range of mode is from 0 to 24. Description of each mode follows:
  9158. @table @var
  9159. @item 0
  9160. Leave input plane unchanged. Default.
  9161. @item 1
  9162. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9163. @item 2
  9164. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9165. @item 3
  9166. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9167. @item 4
  9168. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9169. This is equivalent to a median filter.
  9170. @item 5
  9171. Line-sensitive clipping giving the minimal change.
  9172. @item 6
  9173. Line-sensitive clipping, intermediate.
  9174. @item 7
  9175. Line-sensitive clipping, intermediate.
  9176. @item 8
  9177. Line-sensitive clipping, intermediate.
  9178. @item 9
  9179. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9180. @item 10
  9181. Replaces the target pixel with the closest neighbour.
  9182. @item 11
  9183. [1 2 1] horizontal and vertical kernel blur.
  9184. @item 12
  9185. Same as mode 11.
  9186. @item 13
  9187. Bob mode, interpolates top field from the line where the neighbours
  9188. pixels are the closest.
  9189. @item 14
  9190. Bob mode, interpolates bottom field from the line where the neighbours
  9191. pixels are the closest.
  9192. @item 15
  9193. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9194. interpolation formula.
  9195. @item 16
  9196. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9197. interpolation formula.
  9198. @item 17
  9199. Clips the pixel with the minimum and maximum of respectively the maximum and
  9200. minimum of each pair of opposite neighbour pixels.
  9201. @item 18
  9202. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9203. the current pixel is minimal.
  9204. @item 19
  9205. Replaces the pixel with the average of its 8 neighbours.
  9206. @item 20
  9207. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9208. @item 21
  9209. Clips pixels using the averages of opposite neighbour.
  9210. @item 22
  9211. Same as mode 21 but simpler and faster.
  9212. @item 23
  9213. Small edge and halo removal, but reputed useless.
  9214. @item 24
  9215. Similar as 23.
  9216. @end table
  9217. @section removelogo
  9218. Suppress a TV station logo, using an image file to determine which
  9219. pixels comprise the logo. It works by filling in the pixels that
  9220. comprise the logo with neighboring pixels.
  9221. The filter accepts the following options:
  9222. @table @option
  9223. @item filename, f
  9224. Set the filter bitmap file, which can be any image format supported by
  9225. libavformat. The width and height of the image file must match those of the
  9226. video stream being processed.
  9227. @end table
  9228. Pixels in the provided bitmap image with a value of zero are not
  9229. considered part of the logo, non-zero pixels are considered part of
  9230. the logo. If you use white (255) for the logo and black (0) for the
  9231. rest, you will be safe. For making the filter bitmap, it is
  9232. recommended to take a screen capture of a black frame with the logo
  9233. visible, and then using a threshold filter followed by the erode
  9234. filter once or twice.
  9235. If needed, little splotches can be fixed manually. Remember that if
  9236. logo pixels are not covered, the filter quality will be much
  9237. reduced. Marking too many pixels as part of the logo does not hurt as
  9238. much, but it will increase the amount of blurring needed to cover over
  9239. the image and will destroy more information than necessary, and extra
  9240. pixels will slow things down on a large logo.
  9241. @section repeatfields
  9242. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9243. fields based on its value.
  9244. @section reverse
  9245. Reverse a video clip.
  9246. Warning: This filter requires memory to buffer the entire clip, so trimming
  9247. is suggested.
  9248. @subsection Examples
  9249. @itemize
  9250. @item
  9251. Take the first 5 seconds of a clip, and reverse it.
  9252. @example
  9253. trim=end=5,reverse
  9254. @end example
  9255. @end itemize
  9256. @section rotate
  9257. Rotate video by an arbitrary angle expressed in radians.
  9258. The filter accepts the following options:
  9259. A description of the optional parameters follows.
  9260. @table @option
  9261. @item angle, a
  9262. Set an expression for the angle by which to rotate the input video
  9263. clockwise, expressed as a number of radians. A negative value will
  9264. result in a counter-clockwise rotation. By default it is set to "0".
  9265. This expression is evaluated for each frame.
  9266. @item out_w, ow
  9267. Set the output width expression, default value is "iw".
  9268. This expression is evaluated just once during configuration.
  9269. @item out_h, oh
  9270. Set the output height expression, default value is "ih".
  9271. This expression is evaluated just once during configuration.
  9272. @item bilinear
  9273. Enable bilinear interpolation if set to 1, a value of 0 disables
  9274. it. Default value is 1.
  9275. @item fillcolor, c
  9276. Set the color used to fill the output area not covered by the rotated
  9277. image. For the general syntax of this option, check the "Color" section in the
  9278. ffmpeg-utils manual. If the special value "none" is selected then no
  9279. background is printed (useful for example if the background is never shown).
  9280. Default value is "black".
  9281. @end table
  9282. The expressions for the angle and the output size can contain the
  9283. following constants and functions:
  9284. @table @option
  9285. @item n
  9286. sequential number of the input frame, starting from 0. It is always NAN
  9287. before the first frame is filtered.
  9288. @item t
  9289. time in seconds of the input frame, it is set to 0 when the filter is
  9290. configured. It is always NAN before the first frame is filtered.
  9291. @item hsub
  9292. @item vsub
  9293. horizontal and vertical chroma subsample values. For example for the
  9294. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9295. @item in_w, iw
  9296. @item in_h, ih
  9297. the input video width and height
  9298. @item out_w, ow
  9299. @item out_h, oh
  9300. the output width and height, that is the size of the padded area as
  9301. specified by the @var{width} and @var{height} expressions
  9302. @item rotw(a)
  9303. @item roth(a)
  9304. the minimal width/height required for completely containing the input
  9305. video rotated by @var{a} radians.
  9306. These are only available when computing the @option{out_w} and
  9307. @option{out_h} expressions.
  9308. @end table
  9309. @subsection Examples
  9310. @itemize
  9311. @item
  9312. Rotate the input by PI/6 radians clockwise:
  9313. @example
  9314. rotate=PI/6
  9315. @end example
  9316. @item
  9317. Rotate the input by PI/6 radians counter-clockwise:
  9318. @example
  9319. rotate=-PI/6
  9320. @end example
  9321. @item
  9322. Rotate the input by 45 degrees clockwise:
  9323. @example
  9324. rotate=45*PI/180
  9325. @end example
  9326. @item
  9327. Apply a constant rotation with period T, starting from an angle of PI/3:
  9328. @example
  9329. rotate=PI/3+2*PI*t/T
  9330. @end example
  9331. @item
  9332. Make the input video rotation oscillating with a period of T
  9333. seconds and an amplitude of A radians:
  9334. @example
  9335. rotate=A*sin(2*PI/T*t)
  9336. @end example
  9337. @item
  9338. Rotate the video, output size is chosen so that the whole rotating
  9339. input video is always completely contained in the output:
  9340. @example
  9341. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9342. @end example
  9343. @item
  9344. Rotate the video, reduce the output size so that no background is ever
  9345. shown:
  9346. @example
  9347. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9348. @end example
  9349. @end itemize
  9350. @subsection Commands
  9351. The filter supports the following commands:
  9352. @table @option
  9353. @item a, angle
  9354. Set the angle expression.
  9355. The command accepts the same syntax of the corresponding option.
  9356. If the specified expression is not valid, it is kept at its current
  9357. value.
  9358. @end table
  9359. @section sab
  9360. Apply Shape Adaptive Blur.
  9361. The filter accepts the following options:
  9362. @table @option
  9363. @item luma_radius, lr
  9364. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9365. value is 1.0. A greater value will result in a more blurred image, and
  9366. in slower processing.
  9367. @item luma_pre_filter_radius, lpfr
  9368. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9369. value is 1.0.
  9370. @item luma_strength, ls
  9371. Set luma maximum difference between pixels to still be considered, must
  9372. be a value in the 0.1-100.0 range, default value is 1.0.
  9373. @item chroma_radius, cr
  9374. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9375. greater value will result in a more blurred image, and in slower
  9376. processing.
  9377. @item chroma_pre_filter_radius, cpfr
  9378. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9379. @item chroma_strength, cs
  9380. Set chroma maximum difference between pixels to still be considered,
  9381. must be a value in the -0.9-100.0 range.
  9382. @end table
  9383. Each chroma option value, if not explicitly specified, is set to the
  9384. corresponding luma option value.
  9385. @anchor{scale}
  9386. @section scale
  9387. Scale (resize) the input video, using the libswscale library.
  9388. The scale filter forces the output display aspect ratio to be the same
  9389. of the input, by changing the output sample aspect ratio.
  9390. If the input image format is different from the format requested by
  9391. the next filter, the scale filter will convert the input to the
  9392. requested format.
  9393. @subsection Options
  9394. The filter accepts the following options, or any of the options
  9395. supported by the libswscale scaler.
  9396. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9397. the complete list of scaler options.
  9398. @table @option
  9399. @item width, w
  9400. @item height, h
  9401. Set the output video dimension expression. Default value is the input
  9402. dimension.
  9403. If the value is 0, the input width is used for the output.
  9404. If one of the values is -1, the scale filter will use a value that
  9405. maintains the aspect ratio of the input image, calculated from the
  9406. other specified dimension. If both of them are -1, the input size is
  9407. used
  9408. If one of the values is -n with n > 1, the scale filter will also use a value
  9409. that maintains the aspect ratio of the input image, calculated from the other
  9410. specified dimension. After that it will, however, make sure that the calculated
  9411. dimension is divisible by n and adjust the value if necessary.
  9412. See below for the list of accepted constants for use in the dimension
  9413. expression.
  9414. @item eval
  9415. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9416. @table @samp
  9417. @item init
  9418. Only evaluate expressions once during the filter initialization or when a command is processed.
  9419. @item frame
  9420. Evaluate expressions for each incoming frame.
  9421. @end table
  9422. Default value is @samp{init}.
  9423. @item interl
  9424. Set the interlacing mode. It accepts the following values:
  9425. @table @samp
  9426. @item 1
  9427. Force interlaced aware scaling.
  9428. @item 0
  9429. Do not apply interlaced scaling.
  9430. @item -1
  9431. Select interlaced aware scaling depending on whether the source frames
  9432. are flagged as interlaced or not.
  9433. @end table
  9434. Default value is @samp{0}.
  9435. @item flags
  9436. Set libswscale scaling flags. See
  9437. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9438. complete list of values. If not explicitly specified the filter applies
  9439. the default flags.
  9440. @item param0, param1
  9441. Set libswscale input parameters for scaling algorithms that need them. See
  9442. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9443. complete documentation. If not explicitly specified the filter applies
  9444. empty parameters.
  9445. @item size, s
  9446. Set the video size. For the syntax of this option, check the
  9447. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9448. @item in_color_matrix
  9449. @item out_color_matrix
  9450. Set in/output YCbCr color space type.
  9451. This allows the autodetected value to be overridden as well as allows forcing
  9452. a specific value used for the output and encoder.
  9453. If not specified, the color space type depends on the pixel format.
  9454. Possible values:
  9455. @table @samp
  9456. @item auto
  9457. Choose automatically.
  9458. @item bt709
  9459. Format conforming to International Telecommunication Union (ITU)
  9460. Recommendation BT.709.
  9461. @item fcc
  9462. Set color space conforming to the United States Federal Communications
  9463. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9464. @item bt601
  9465. Set color space conforming to:
  9466. @itemize
  9467. @item
  9468. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9469. @item
  9470. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9471. @item
  9472. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9473. @end itemize
  9474. @item smpte240m
  9475. Set color space conforming to SMPTE ST 240:1999.
  9476. @end table
  9477. @item in_range
  9478. @item out_range
  9479. Set in/output YCbCr sample range.
  9480. This allows the autodetected value to be overridden as well as allows forcing
  9481. a specific value used for the output and encoder. If not specified, the
  9482. range depends on the pixel format. Possible values:
  9483. @table @samp
  9484. @item auto
  9485. Choose automatically.
  9486. @item jpeg/full/pc
  9487. Set full range (0-255 in case of 8-bit luma).
  9488. @item mpeg/tv
  9489. Set "MPEG" range (16-235 in case of 8-bit luma).
  9490. @end table
  9491. @item force_original_aspect_ratio
  9492. Enable decreasing or increasing output video width or height if necessary to
  9493. keep the original aspect ratio. Possible values:
  9494. @table @samp
  9495. @item disable
  9496. Scale the video as specified and disable this feature.
  9497. @item decrease
  9498. The output video dimensions will automatically be decreased if needed.
  9499. @item increase
  9500. The output video dimensions will automatically be increased if needed.
  9501. @end table
  9502. One useful instance of this option is that when you know a specific device's
  9503. maximum allowed resolution, you can use this to limit the output video to
  9504. that, while retaining the aspect ratio. For example, device A allows
  9505. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9506. decrease) and specifying 1280x720 to the command line makes the output
  9507. 1280x533.
  9508. Please note that this is a different thing than specifying -1 for @option{w}
  9509. or @option{h}, you still need to specify the output resolution for this option
  9510. to work.
  9511. @end table
  9512. The values of the @option{w} and @option{h} options are expressions
  9513. containing the following constants:
  9514. @table @var
  9515. @item in_w
  9516. @item in_h
  9517. The input width and height
  9518. @item iw
  9519. @item ih
  9520. These are the same as @var{in_w} and @var{in_h}.
  9521. @item out_w
  9522. @item out_h
  9523. The output (scaled) width and height
  9524. @item ow
  9525. @item oh
  9526. These are the same as @var{out_w} and @var{out_h}
  9527. @item a
  9528. The same as @var{iw} / @var{ih}
  9529. @item sar
  9530. input sample aspect ratio
  9531. @item dar
  9532. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9533. @item hsub
  9534. @item vsub
  9535. horizontal and vertical input chroma subsample values. For example for the
  9536. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9537. @item ohsub
  9538. @item ovsub
  9539. horizontal and vertical output chroma subsample values. For example for the
  9540. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9541. @end table
  9542. @subsection Examples
  9543. @itemize
  9544. @item
  9545. Scale the input video to a size of 200x100
  9546. @example
  9547. scale=w=200:h=100
  9548. @end example
  9549. This is equivalent to:
  9550. @example
  9551. scale=200:100
  9552. @end example
  9553. or:
  9554. @example
  9555. scale=200x100
  9556. @end example
  9557. @item
  9558. Specify a size abbreviation for the output size:
  9559. @example
  9560. scale=qcif
  9561. @end example
  9562. which can also be written as:
  9563. @example
  9564. scale=size=qcif
  9565. @end example
  9566. @item
  9567. Scale the input to 2x:
  9568. @example
  9569. scale=w=2*iw:h=2*ih
  9570. @end example
  9571. @item
  9572. The above is the same as:
  9573. @example
  9574. scale=2*in_w:2*in_h
  9575. @end example
  9576. @item
  9577. Scale the input to 2x with forced interlaced scaling:
  9578. @example
  9579. scale=2*iw:2*ih:interl=1
  9580. @end example
  9581. @item
  9582. Scale the input to half size:
  9583. @example
  9584. scale=w=iw/2:h=ih/2
  9585. @end example
  9586. @item
  9587. Increase the width, and set the height to the same size:
  9588. @example
  9589. scale=3/2*iw:ow
  9590. @end example
  9591. @item
  9592. Seek Greek harmony:
  9593. @example
  9594. scale=iw:1/PHI*iw
  9595. scale=ih*PHI:ih
  9596. @end example
  9597. @item
  9598. Increase the height, and set the width to 3/2 of the height:
  9599. @example
  9600. scale=w=3/2*oh:h=3/5*ih
  9601. @end example
  9602. @item
  9603. Increase the size, making the size a multiple of the chroma
  9604. subsample values:
  9605. @example
  9606. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9607. @end example
  9608. @item
  9609. Increase the width to a maximum of 500 pixels,
  9610. keeping the same aspect ratio as the input:
  9611. @example
  9612. scale=w='min(500\, iw*3/2):h=-1'
  9613. @end example
  9614. @end itemize
  9615. @subsection Commands
  9616. This filter supports the following commands:
  9617. @table @option
  9618. @item width, w
  9619. @item height, h
  9620. Set the output video dimension expression.
  9621. The command accepts the same syntax of the corresponding option.
  9622. If the specified expression is not valid, it is kept at its current
  9623. value.
  9624. @end table
  9625. @section scale_npp
  9626. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9627. format conversion on CUDA video frames. Setting the output width and height
  9628. works in the same way as for the @var{scale} filter.
  9629. The following additional options are accepted:
  9630. @table @option
  9631. @item format
  9632. The pixel format of the output CUDA frames. If set to the string "same" (the
  9633. default), the input format will be kept. Note that automatic format negotiation
  9634. and conversion is not yet supported for hardware frames
  9635. @item interp_algo
  9636. The interpolation algorithm used for resizing. One of the following:
  9637. @table @option
  9638. @item nn
  9639. Nearest neighbour.
  9640. @item linear
  9641. @item cubic
  9642. @item cubic2p_bspline
  9643. 2-parameter cubic (B=1, C=0)
  9644. @item cubic2p_catmullrom
  9645. 2-parameter cubic (B=0, C=1/2)
  9646. @item cubic2p_b05c03
  9647. 2-parameter cubic (B=1/2, C=3/10)
  9648. @item super
  9649. Supersampling
  9650. @item lanczos
  9651. @end table
  9652. @end table
  9653. @section scale2ref
  9654. Scale (resize) the input video, based on a reference video.
  9655. See the scale filter for available options, scale2ref supports the same but
  9656. uses the reference video instead of the main input as basis. scale2ref also
  9657. supports the following additional constants for the @option{w} and
  9658. @option{h} options:
  9659. @table @var
  9660. @item main_w
  9661. @item main_h
  9662. The main input video's width and height
  9663. @item main_a
  9664. The same as @var{main_w} / @var{main_h}
  9665. @item main_sar
  9666. The main input video's sample aspect ratio
  9667. @item main_dar, mdar
  9668. The main input video's display aspect ratio. Calculated from
  9669. @code{(main_w / main_h) * main_sar}.
  9670. @item main_hsub
  9671. @item main_vsub
  9672. The main input video's horizontal and vertical chroma subsample values.
  9673. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9674. is 1.
  9675. @end table
  9676. @subsection Examples
  9677. @itemize
  9678. @item
  9679. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9680. @example
  9681. 'scale2ref[b][a];[a][b]overlay'
  9682. @end example
  9683. @end itemize
  9684. @anchor{selectivecolor}
  9685. @section selectivecolor
  9686. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9687. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9688. by the "purity" of the color (that is, how saturated it already is).
  9689. This filter is similar to the Adobe Photoshop Selective Color tool.
  9690. The filter accepts the following options:
  9691. @table @option
  9692. @item correction_method
  9693. Select color correction method.
  9694. Available values are:
  9695. @table @samp
  9696. @item absolute
  9697. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9698. component value).
  9699. @item relative
  9700. Specified adjustments are relative to the original component value.
  9701. @end table
  9702. Default is @code{absolute}.
  9703. @item reds
  9704. Adjustments for red pixels (pixels where the red component is the maximum)
  9705. @item yellows
  9706. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9707. @item greens
  9708. Adjustments for green pixels (pixels where the green component is the maximum)
  9709. @item cyans
  9710. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9711. @item blues
  9712. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9713. @item magentas
  9714. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9715. @item whites
  9716. Adjustments for white pixels (pixels where all components are greater than 128)
  9717. @item neutrals
  9718. Adjustments for all pixels except pure black and pure white
  9719. @item blacks
  9720. Adjustments for black pixels (pixels where all components are lesser than 128)
  9721. @item psfile
  9722. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9723. @end table
  9724. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9725. 4 space separated floating point adjustment values in the [-1,1] range,
  9726. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9727. pixels of its range.
  9728. @subsection Examples
  9729. @itemize
  9730. @item
  9731. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9732. increase magenta by 27% in blue areas:
  9733. @example
  9734. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9735. @end example
  9736. @item
  9737. Use a Photoshop selective color preset:
  9738. @example
  9739. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9740. @end example
  9741. @end itemize
  9742. @anchor{separatefields}
  9743. @section separatefields
  9744. The @code{separatefields} takes a frame-based video input and splits
  9745. each frame into its components fields, producing a new half height clip
  9746. with twice the frame rate and twice the frame count.
  9747. This filter use field-dominance information in frame to decide which
  9748. of each pair of fields to place first in the output.
  9749. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9750. @section setdar, setsar
  9751. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9752. output video.
  9753. This is done by changing the specified Sample (aka Pixel) Aspect
  9754. Ratio, according to the following equation:
  9755. @example
  9756. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9757. @end example
  9758. Keep in mind that the @code{setdar} filter does not modify the pixel
  9759. dimensions of the video frame. Also, the display aspect ratio set by
  9760. this filter may be changed by later filters in the filterchain,
  9761. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9762. applied.
  9763. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9764. the filter output video.
  9765. Note that as a consequence of the application of this filter, the
  9766. output display aspect ratio will change according to the equation
  9767. above.
  9768. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9769. filter may be changed by later filters in the filterchain, e.g. if
  9770. another "setsar" or a "setdar" filter is applied.
  9771. It accepts the following parameters:
  9772. @table @option
  9773. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9774. Set the aspect ratio used by the filter.
  9775. The parameter can be a floating point number string, an expression, or
  9776. a string of the form @var{num}:@var{den}, where @var{num} and
  9777. @var{den} are the numerator and denominator of the aspect ratio. If
  9778. the parameter is not specified, it is assumed the value "0".
  9779. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9780. should be escaped.
  9781. @item max
  9782. Set the maximum integer value to use for expressing numerator and
  9783. denominator when reducing the expressed aspect ratio to a rational.
  9784. Default value is @code{100}.
  9785. @end table
  9786. The parameter @var{sar} is an expression containing
  9787. the following constants:
  9788. @table @option
  9789. @item E, PI, PHI
  9790. These are approximated values for the mathematical constants e
  9791. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9792. @item w, h
  9793. The input width and height.
  9794. @item a
  9795. These are the same as @var{w} / @var{h}.
  9796. @item sar
  9797. The input sample aspect ratio.
  9798. @item dar
  9799. The input display aspect ratio. It is the same as
  9800. (@var{w} / @var{h}) * @var{sar}.
  9801. @item hsub, vsub
  9802. Horizontal and vertical chroma subsample values. For example, for the
  9803. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9804. @end table
  9805. @subsection Examples
  9806. @itemize
  9807. @item
  9808. To change the display aspect ratio to 16:9, specify one of the following:
  9809. @example
  9810. setdar=dar=1.77777
  9811. setdar=dar=16/9
  9812. @end example
  9813. @item
  9814. To change the sample aspect ratio to 10:11, specify:
  9815. @example
  9816. setsar=sar=10/11
  9817. @end example
  9818. @item
  9819. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9820. 1000 in the aspect ratio reduction, use the command:
  9821. @example
  9822. setdar=ratio=16/9:max=1000
  9823. @end example
  9824. @end itemize
  9825. @anchor{setfield}
  9826. @section setfield
  9827. Force field for the output video frame.
  9828. The @code{setfield} filter marks the interlace type field for the
  9829. output frames. It does not change the input frame, but only sets the
  9830. corresponding property, which affects how the frame is treated by
  9831. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9832. The filter accepts the following options:
  9833. @table @option
  9834. @item mode
  9835. Available values are:
  9836. @table @samp
  9837. @item auto
  9838. Keep the same field property.
  9839. @item bff
  9840. Mark the frame as bottom-field-first.
  9841. @item tff
  9842. Mark the frame as top-field-first.
  9843. @item prog
  9844. Mark the frame as progressive.
  9845. @end table
  9846. @end table
  9847. @section showinfo
  9848. Show a line containing various information for each input video frame.
  9849. The input video is not modified.
  9850. The shown line contains a sequence of key/value pairs of the form
  9851. @var{key}:@var{value}.
  9852. The following values are shown in the output:
  9853. @table @option
  9854. @item n
  9855. The (sequential) number of the input frame, starting from 0.
  9856. @item pts
  9857. The Presentation TimeStamp of the input frame, expressed as a number of
  9858. time base units. The time base unit depends on the filter input pad.
  9859. @item pts_time
  9860. The Presentation TimeStamp of the input frame, expressed as a number of
  9861. seconds.
  9862. @item pos
  9863. The position of the frame in the input stream, or -1 if this information is
  9864. unavailable and/or meaningless (for example in case of synthetic video).
  9865. @item fmt
  9866. The pixel format name.
  9867. @item sar
  9868. The sample aspect ratio of the input frame, expressed in the form
  9869. @var{num}/@var{den}.
  9870. @item s
  9871. The size of the input frame. For the syntax of this option, check the
  9872. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9873. @item i
  9874. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9875. for bottom field first).
  9876. @item iskey
  9877. This is 1 if the frame is a key frame, 0 otherwise.
  9878. @item type
  9879. The picture type of the input frame ("I" for an I-frame, "P" for a
  9880. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9881. Also refer to the documentation of the @code{AVPictureType} enum and of
  9882. the @code{av_get_picture_type_char} function defined in
  9883. @file{libavutil/avutil.h}.
  9884. @item checksum
  9885. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9886. @item plane_checksum
  9887. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9888. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9889. @end table
  9890. @section showpalette
  9891. Displays the 256 colors palette of each frame. This filter is only relevant for
  9892. @var{pal8} pixel format frames.
  9893. It accepts the following option:
  9894. @table @option
  9895. @item s
  9896. Set the size of the box used to represent one palette color entry. Default is
  9897. @code{30} (for a @code{30x30} pixel box).
  9898. @end table
  9899. @section shuffleframes
  9900. Reorder and/or duplicate and/or drop video frames.
  9901. It accepts the following parameters:
  9902. @table @option
  9903. @item mapping
  9904. Set the destination indexes of input frames.
  9905. This is space or '|' separated list of indexes that maps input frames to output
  9906. frames. Number of indexes also sets maximal value that each index may have.
  9907. '-1' index have special meaning and that is to drop frame.
  9908. @end table
  9909. The first frame has the index 0. The default is to keep the input unchanged.
  9910. @subsection Examples
  9911. @itemize
  9912. @item
  9913. Swap second and third frame of every three frames of the input:
  9914. @example
  9915. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9916. @end example
  9917. @item
  9918. Swap 10th and 1st frame of every ten frames of the input:
  9919. @example
  9920. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9921. @end example
  9922. @end itemize
  9923. @section shuffleplanes
  9924. Reorder and/or duplicate video planes.
  9925. It accepts the following parameters:
  9926. @table @option
  9927. @item map0
  9928. The index of the input plane to be used as the first output plane.
  9929. @item map1
  9930. The index of the input plane to be used as the second output plane.
  9931. @item map2
  9932. The index of the input plane to be used as the third output plane.
  9933. @item map3
  9934. The index of the input plane to be used as the fourth output plane.
  9935. @end table
  9936. The first plane has the index 0. The default is to keep the input unchanged.
  9937. @subsection Examples
  9938. @itemize
  9939. @item
  9940. Swap the second and third planes of the input:
  9941. @example
  9942. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9943. @end example
  9944. @end itemize
  9945. @anchor{signalstats}
  9946. @section signalstats
  9947. Evaluate various visual metrics that assist in determining issues associated
  9948. with the digitization of analog video media.
  9949. By default the filter will log these metadata values:
  9950. @table @option
  9951. @item YMIN
  9952. Display the minimal Y value contained within the input frame. Expressed in
  9953. range of [0-255].
  9954. @item YLOW
  9955. Display the Y value at the 10% percentile within the input frame. Expressed in
  9956. range of [0-255].
  9957. @item YAVG
  9958. Display the average Y value within the input frame. Expressed in range of
  9959. [0-255].
  9960. @item YHIGH
  9961. Display the Y value at the 90% percentile within the input frame. Expressed in
  9962. range of [0-255].
  9963. @item YMAX
  9964. Display the maximum Y value contained within the input frame. Expressed in
  9965. range of [0-255].
  9966. @item UMIN
  9967. Display the minimal U value contained within the input frame. Expressed in
  9968. range of [0-255].
  9969. @item ULOW
  9970. Display the U value at the 10% percentile within the input frame. Expressed in
  9971. range of [0-255].
  9972. @item UAVG
  9973. Display the average U value within the input frame. Expressed in range of
  9974. [0-255].
  9975. @item UHIGH
  9976. Display the U value at the 90% percentile within the input frame. Expressed in
  9977. range of [0-255].
  9978. @item UMAX
  9979. Display the maximum U value contained within the input frame. Expressed in
  9980. range of [0-255].
  9981. @item VMIN
  9982. Display the minimal V value contained within the input frame. Expressed in
  9983. range of [0-255].
  9984. @item VLOW
  9985. Display the V value at the 10% percentile within the input frame. Expressed in
  9986. range of [0-255].
  9987. @item VAVG
  9988. Display the average V value within the input frame. Expressed in range of
  9989. [0-255].
  9990. @item VHIGH
  9991. Display the V value at the 90% percentile within the input frame. Expressed in
  9992. range of [0-255].
  9993. @item VMAX
  9994. Display the maximum V value contained within the input frame. Expressed in
  9995. range of [0-255].
  9996. @item SATMIN
  9997. Display the minimal saturation value contained within the input frame.
  9998. Expressed in range of [0-~181.02].
  9999. @item SATLOW
  10000. Display the saturation value at the 10% percentile within the input frame.
  10001. Expressed in range of [0-~181.02].
  10002. @item SATAVG
  10003. Display the average saturation value within the input frame. Expressed in range
  10004. of [0-~181.02].
  10005. @item SATHIGH
  10006. Display the saturation value at the 90% percentile within the input frame.
  10007. Expressed in range of [0-~181.02].
  10008. @item SATMAX
  10009. Display the maximum saturation value contained within the input frame.
  10010. Expressed in range of [0-~181.02].
  10011. @item HUEMED
  10012. Display the median value for hue within the input frame. Expressed in range of
  10013. [0-360].
  10014. @item HUEAVG
  10015. Display the average value for hue within the input frame. Expressed in range of
  10016. [0-360].
  10017. @item YDIF
  10018. Display the average of sample value difference between all values of the Y
  10019. plane in the current frame and corresponding values of the previous input frame.
  10020. Expressed in range of [0-255].
  10021. @item UDIF
  10022. Display the average of sample value difference between all values of the U
  10023. plane in the current frame and corresponding values of the previous input frame.
  10024. Expressed in range of [0-255].
  10025. @item VDIF
  10026. Display the average of sample value difference between all values of the V
  10027. plane in the current frame and corresponding values of the previous input frame.
  10028. Expressed in range of [0-255].
  10029. @item YBITDEPTH
  10030. Display bit depth of Y plane in current frame.
  10031. Expressed in range of [0-16].
  10032. @item UBITDEPTH
  10033. Display bit depth of U plane in current frame.
  10034. Expressed in range of [0-16].
  10035. @item VBITDEPTH
  10036. Display bit depth of V plane in current frame.
  10037. Expressed in range of [0-16].
  10038. @end table
  10039. The filter accepts the following options:
  10040. @table @option
  10041. @item stat
  10042. @item out
  10043. @option{stat} specify an additional form of image analysis.
  10044. @option{out} output video with the specified type of pixel highlighted.
  10045. Both options accept the following values:
  10046. @table @samp
  10047. @item tout
  10048. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10049. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10050. include the results of video dropouts, head clogs, or tape tracking issues.
  10051. @item vrep
  10052. Identify @var{vertical line repetition}. Vertical line repetition includes
  10053. similar rows of pixels within a frame. In born-digital video vertical line
  10054. repetition is common, but this pattern is uncommon in video digitized from an
  10055. analog source. When it occurs in video that results from the digitization of an
  10056. analog source it can indicate concealment from a dropout compensator.
  10057. @item brng
  10058. Identify pixels that fall outside of legal broadcast range.
  10059. @end table
  10060. @item color, c
  10061. Set the highlight color for the @option{out} option. The default color is
  10062. yellow.
  10063. @end table
  10064. @subsection Examples
  10065. @itemize
  10066. @item
  10067. Output data of various video metrics:
  10068. @example
  10069. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10070. @end example
  10071. @item
  10072. Output specific data about the minimum and maximum values of the Y plane per frame:
  10073. @example
  10074. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10075. @end example
  10076. @item
  10077. Playback video while highlighting pixels that are outside of broadcast range in red.
  10078. @example
  10079. ffplay example.mov -vf signalstats="out=brng:color=red"
  10080. @end example
  10081. @item
  10082. Playback video with signalstats metadata drawn over the frame.
  10083. @example
  10084. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10085. @end example
  10086. The contents of signalstat_drawtext.txt used in the command are:
  10087. @example
  10088. time %@{pts:hms@}
  10089. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10090. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10091. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10092. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10093. @end example
  10094. @end itemize
  10095. @anchor{signature}
  10096. @section signature
  10097. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10098. input. In this case the matching between the inputs can be calculated additionally.
  10099. The filter always passes through the first input. The signature of each stream can
  10100. be written into a file.
  10101. It accepts the following options:
  10102. @table @option
  10103. @item detectmode
  10104. Enable or disable the matching process.
  10105. Available values are:
  10106. @table @samp
  10107. @item off
  10108. Disable the calculation of a matching (default).
  10109. @item full
  10110. Calculate the matching for the whole video and output whether the whole video
  10111. matches or only parts.
  10112. @item fast
  10113. Calculate only until a matching is found or the video ends. Should be faster in
  10114. some cases.
  10115. @end table
  10116. @item nb_inputs
  10117. Set the number of inputs. The option value must be a non negative integer.
  10118. Default value is 1.
  10119. @item filename
  10120. Set the path to which the output is written. If there is more than one input,
  10121. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10122. integer), that will be replaced with the input number. If no filename is
  10123. specified, no output will be written. This is the default.
  10124. @item format
  10125. Choose the output format.
  10126. Available values are:
  10127. @table @samp
  10128. @item binary
  10129. Use the specified binary representation (default).
  10130. @item xml
  10131. Use the specified xml representation.
  10132. @end table
  10133. @item th_d
  10134. Set threshold to detect one word as similar. The option value must be an integer
  10135. greater than zero. The default value is 9000.
  10136. @item th_dc
  10137. Set threshold to detect all words as similar. The option value must be an integer
  10138. greater than zero. The default value is 60000.
  10139. @item th_xh
  10140. Set threshold to detect frames as similar. The option value must be an integer
  10141. greater than zero. The default value is 116.
  10142. @item th_di
  10143. Set the minimum length of a sequence in frames to recognize it as matching
  10144. sequence. The option value must be a non negative integer value.
  10145. The default value is 0.
  10146. @item th_it
  10147. Set the minimum relation, that matching frames to all frames must have.
  10148. The option value must be a double value between 0 and 1. The default value is 0.5.
  10149. @end table
  10150. @subsection Examples
  10151. @itemize
  10152. @item
  10153. To calculate the signature of an input video and store it in signature.bin:
  10154. @example
  10155. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10156. @end example
  10157. @item
  10158. To detect whether two videos match and store the signatures in XML format in
  10159. signature0.xml and signature1.xml:
  10160. @example
  10161. 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 -
  10162. @end example
  10163. @end itemize
  10164. @anchor{smartblur}
  10165. @section smartblur
  10166. Blur the input video without impacting the outlines.
  10167. It accepts the following options:
  10168. @table @option
  10169. @item luma_radius, lr
  10170. Set the luma radius. The option value must be a float number in
  10171. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10172. used to blur the image (slower if larger). Default value is 1.0.
  10173. @item luma_strength, ls
  10174. Set the luma strength. The option value must be a float number
  10175. in the range [-1.0,1.0] that configures the blurring. A value included
  10176. in [0.0,1.0] will blur the image whereas a value included in
  10177. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10178. @item luma_threshold, lt
  10179. Set the luma threshold used as a coefficient to determine
  10180. whether a pixel should be blurred or not. The option value must be an
  10181. integer in the range [-30,30]. A value of 0 will filter all the image,
  10182. a value included in [0,30] will filter flat areas and a value included
  10183. in [-30,0] will filter edges. Default value is 0.
  10184. @item chroma_radius, cr
  10185. Set the chroma radius. The option value must be a float number in
  10186. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10187. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10188. @item chroma_strength, cs
  10189. Set the chroma strength. The option value must be a float number
  10190. in the range [-1.0,1.0] that configures the blurring. A value included
  10191. in [0.0,1.0] will blur the image whereas a value included in
  10192. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10193. @item chroma_threshold, ct
  10194. Set the chroma threshold used as a coefficient to determine
  10195. whether a pixel should be blurred or not. The option value must be an
  10196. integer in the range [-30,30]. A value of 0 will filter all the image,
  10197. a value included in [0,30] will filter flat areas and a value included
  10198. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10199. @end table
  10200. If a chroma option is not explicitly set, the corresponding luma value
  10201. is set.
  10202. @section ssim
  10203. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10204. This filter takes in input two input videos, the first input is
  10205. considered the "main" source and is passed unchanged to the
  10206. output. The second input is used as a "reference" video for computing
  10207. the SSIM.
  10208. Both video inputs must have the same resolution and pixel format for
  10209. this filter to work correctly. Also it assumes that both inputs
  10210. have the same number of frames, which are compared one by one.
  10211. The filter stores the calculated SSIM of each frame.
  10212. The description of the accepted parameters follows.
  10213. @table @option
  10214. @item stats_file, f
  10215. If specified the filter will use the named file to save the SSIM of
  10216. each individual frame. When filename equals "-" the data is sent to
  10217. standard output.
  10218. @end table
  10219. The file printed if @var{stats_file} is selected, contains a sequence of
  10220. key/value pairs of the form @var{key}:@var{value} for each compared
  10221. couple of frames.
  10222. A description of each shown parameter follows:
  10223. @table @option
  10224. @item n
  10225. sequential number of the input frame, starting from 1
  10226. @item Y, U, V, R, G, B
  10227. SSIM of the compared frames for the component specified by the suffix.
  10228. @item All
  10229. SSIM of the compared frames for the whole frame.
  10230. @item dB
  10231. Same as above but in dB representation.
  10232. @end table
  10233. For example:
  10234. @example
  10235. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10236. [main][ref] ssim="stats_file=stats.log" [out]
  10237. @end example
  10238. On this example the input file being processed is compared with the
  10239. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10240. is stored in @file{stats.log}.
  10241. Another example with both psnr and ssim at same time:
  10242. @example
  10243. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10244. @end example
  10245. @section stereo3d
  10246. Convert between different stereoscopic image formats.
  10247. The filters accept the following options:
  10248. @table @option
  10249. @item in
  10250. Set stereoscopic image format of input.
  10251. Available values for input image formats are:
  10252. @table @samp
  10253. @item sbsl
  10254. side by side parallel (left eye left, right eye right)
  10255. @item sbsr
  10256. side by side crosseye (right eye left, left eye right)
  10257. @item sbs2l
  10258. side by side parallel with half width resolution
  10259. (left eye left, right eye right)
  10260. @item sbs2r
  10261. side by side crosseye with half width resolution
  10262. (right eye left, left eye right)
  10263. @item abl
  10264. above-below (left eye above, right eye below)
  10265. @item abr
  10266. above-below (right eye above, left eye below)
  10267. @item ab2l
  10268. above-below with half height resolution
  10269. (left eye above, right eye below)
  10270. @item ab2r
  10271. above-below with half height resolution
  10272. (right eye above, left eye below)
  10273. @item al
  10274. alternating frames (left eye first, right eye second)
  10275. @item ar
  10276. alternating frames (right eye first, left eye second)
  10277. @item irl
  10278. interleaved rows (left eye has top row, right eye starts on next row)
  10279. @item irr
  10280. interleaved rows (right eye has top row, left eye starts on next row)
  10281. @item icl
  10282. interleaved columns, left eye first
  10283. @item icr
  10284. interleaved columns, right eye first
  10285. Default value is @samp{sbsl}.
  10286. @end table
  10287. @item out
  10288. Set stereoscopic image format of output.
  10289. @table @samp
  10290. @item sbsl
  10291. side by side parallel (left eye left, right eye right)
  10292. @item sbsr
  10293. side by side crosseye (right eye left, left eye right)
  10294. @item sbs2l
  10295. side by side parallel with half width resolution
  10296. (left eye left, right eye right)
  10297. @item sbs2r
  10298. side by side crosseye with half width resolution
  10299. (right eye left, left eye right)
  10300. @item abl
  10301. above-below (left eye above, right eye below)
  10302. @item abr
  10303. above-below (right eye above, left eye below)
  10304. @item ab2l
  10305. above-below with half height resolution
  10306. (left eye above, right eye below)
  10307. @item ab2r
  10308. above-below with half height resolution
  10309. (right eye above, left eye below)
  10310. @item al
  10311. alternating frames (left eye first, right eye second)
  10312. @item ar
  10313. alternating frames (right eye first, left eye second)
  10314. @item irl
  10315. interleaved rows (left eye has top row, right eye starts on next row)
  10316. @item irr
  10317. interleaved rows (right eye has top row, left eye starts on next row)
  10318. @item arbg
  10319. anaglyph red/blue gray
  10320. (red filter on left eye, blue filter on right eye)
  10321. @item argg
  10322. anaglyph red/green gray
  10323. (red filter on left eye, green filter on right eye)
  10324. @item arcg
  10325. anaglyph red/cyan gray
  10326. (red filter on left eye, cyan filter on right eye)
  10327. @item arch
  10328. anaglyph red/cyan half colored
  10329. (red filter on left eye, cyan filter on right eye)
  10330. @item arcc
  10331. anaglyph red/cyan color
  10332. (red filter on left eye, cyan filter on right eye)
  10333. @item arcd
  10334. anaglyph red/cyan color optimized with the least squares projection of dubois
  10335. (red filter on left eye, cyan filter on right eye)
  10336. @item agmg
  10337. anaglyph green/magenta gray
  10338. (green filter on left eye, magenta filter on right eye)
  10339. @item agmh
  10340. anaglyph green/magenta half colored
  10341. (green filter on left eye, magenta filter on right eye)
  10342. @item agmc
  10343. anaglyph green/magenta colored
  10344. (green filter on left eye, magenta filter on right eye)
  10345. @item agmd
  10346. anaglyph green/magenta color optimized with the least squares projection of dubois
  10347. (green filter on left eye, magenta filter on right eye)
  10348. @item aybg
  10349. anaglyph yellow/blue gray
  10350. (yellow filter on left eye, blue filter on right eye)
  10351. @item aybh
  10352. anaglyph yellow/blue half colored
  10353. (yellow filter on left eye, blue filter on right eye)
  10354. @item aybc
  10355. anaglyph yellow/blue colored
  10356. (yellow filter on left eye, blue filter on right eye)
  10357. @item aybd
  10358. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10359. (yellow filter on left eye, blue filter on right eye)
  10360. @item ml
  10361. mono output (left eye only)
  10362. @item mr
  10363. mono output (right eye only)
  10364. @item chl
  10365. checkerboard, left eye first
  10366. @item chr
  10367. checkerboard, right eye first
  10368. @item icl
  10369. interleaved columns, left eye first
  10370. @item icr
  10371. interleaved columns, right eye first
  10372. @item hdmi
  10373. HDMI frame pack
  10374. @end table
  10375. Default value is @samp{arcd}.
  10376. @end table
  10377. @subsection Examples
  10378. @itemize
  10379. @item
  10380. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10381. @example
  10382. stereo3d=sbsl:aybd
  10383. @end example
  10384. @item
  10385. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10386. @example
  10387. stereo3d=abl:sbsr
  10388. @end example
  10389. @end itemize
  10390. @section streamselect, astreamselect
  10391. Select video or audio streams.
  10392. The filter accepts the following options:
  10393. @table @option
  10394. @item inputs
  10395. Set number of inputs. Default is 2.
  10396. @item map
  10397. Set input indexes to remap to outputs.
  10398. @end table
  10399. @subsection Commands
  10400. The @code{streamselect} and @code{astreamselect} filter supports the following
  10401. commands:
  10402. @table @option
  10403. @item map
  10404. Set input indexes to remap to outputs.
  10405. @end table
  10406. @subsection Examples
  10407. @itemize
  10408. @item
  10409. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10410. @example
  10411. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10412. @end example
  10413. @item
  10414. Same as above, but for audio:
  10415. @example
  10416. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10417. @end example
  10418. @end itemize
  10419. @section sobel
  10420. Apply sobel operator to input video stream.
  10421. The filter accepts the following option:
  10422. @table @option
  10423. @item planes
  10424. Set which planes will be processed, unprocessed planes will be copied.
  10425. By default value 0xf, all planes will be processed.
  10426. @item scale
  10427. Set value which will be multiplied with filtered result.
  10428. @item delta
  10429. Set value which will be added to filtered result.
  10430. @end table
  10431. @anchor{spp}
  10432. @section spp
  10433. Apply a simple postprocessing filter that compresses and decompresses the image
  10434. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10435. and average the results.
  10436. The filter accepts the following options:
  10437. @table @option
  10438. @item quality
  10439. Set quality. This option defines the number of levels for averaging. It accepts
  10440. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10441. effect. A value of @code{6} means the higher quality. For each increment of
  10442. that value the speed drops by a factor of approximately 2. Default value is
  10443. @code{3}.
  10444. @item qp
  10445. Force a constant quantization parameter. If not set, the filter will use the QP
  10446. from the video stream (if available).
  10447. @item mode
  10448. Set thresholding mode. Available modes are:
  10449. @table @samp
  10450. @item hard
  10451. Set hard thresholding (default).
  10452. @item soft
  10453. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10454. @end table
  10455. @item use_bframe_qp
  10456. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10457. option may cause flicker since the B-Frames have often larger QP. Default is
  10458. @code{0} (not enabled).
  10459. @end table
  10460. @anchor{subtitles}
  10461. @section subtitles
  10462. Draw subtitles on top of input video using the libass library.
  10463. To enable compilation of this filter you need to configure FFmpeg with
  10464. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10465. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10466. Alpha) subtitles format.
  10467. The filter accepts the following options:
  10468. @table @option
  10469. @item filename, f
  10470. Set the filename of the subtitle file to read. It must be specified.
  10471. @item original_size
  10472. Specify the size of the original video, the video for which the ASS file
  10473. was composed. For the syntax of this option, check the
  10474. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10475. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10476. correctly scale the fonts if the aspect ratio has been changed.
  10477. @item fontsdir
  10478. Set a directory path containing fonts that can be used by the filter.
  10479. These fonts will be used in addition to whatever the font provider uses.
  10480. @item charenc
  10481. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10482. useful if not UTF-8.
  10483. @item stream_index, si
  10484. Set subtitles stream index. @code{subtitles} filter only.
  10485. @item force_style
  10486. Override default style or script info parameters of the subtitles. It accepts a
  10487. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10488. @end table
  10489. If the first key is not specified, it is assumed that the first value
  10490. specifies the @option{filename}.
  10491. For example, to render the file @file{sub.srt} on top of the input
  10492. video, use the command:
  10493. @example
  10494. subtitles=sub.srt
  10495. @end example
  10496. which is equivalent to:
  10497. @example
  10498. subtitles=filename=sub.srt
  10499. @end example
  10500. To render the default subtitles stream from file @file{video.mkv}, use:
  10501. @example
  10502. subtitles=video.mkv
  10503. @end example
  10504. To render the second subtitles stream from that file, use:
  10505. @example
  10506. subtitles=video.mkv:si=1
  10507. @end example
  10508. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10509. @code{DejaVu Serif}, use:
  10510. @example
  10511. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10512. @end example
  10513. @section super2xsai
  10514. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10515. Interpolate) pixel art scaling algorithm.
  10516. Useful for enlarging pixel art images without reducing sharpness.
  10517. @section swaprect
  10518. Swap two rectangular objects in video.
  10519. This filter accepts the following options:
  10520. @table @option
  10521. @item w
  10522. Set object width.
  10523. @item h
  10524. Set object height.
  10525. @item x1
  10526. Set 1st rect x coordinate.
  10527. @item y1
  10528. Set 1st rect y coordinate.
  10529. @item x2
  10530. Set 2nd rect x coordinate.
  10531. @item y2
  10532. Set 2nd rect y coordinate.
  10533. All expressions are evaluated once for each frame.
  10534. @end table
  10535. The all options are expressions containing the following constants:
  10536. @table @option
  10537. @item w
  10538. @item h
  10539. The input width and height.
  10540. @item a
  10541. same as @var{w} / @var{h}
  10542. @item sar
  10543. input sample aspect ratio
  10544. @item dar
  10545. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10546. @item n
  10547. The number of the input frame, starting from 0.
  10548. @item t
  10549. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10550. @item pos
  10551. the position in the file of the input frame, NAN if unknown
  10552. @end table
  10553. @section swapuv
  10554. Swap U & V plane.
  10555. @section telecine
  10556. Apply telecine process to the video.
  10557. This filter accepts the following options:
  10558. @table @option
  10559. @item first_field
  10560. @table @samp
  10561. @item top, t
  10562. top field first
  10563. @item bottom, b
  10564. bottom field first
  10565. The default value is @code{top}.
  10566. @end table
  10567. @item pattern
  10568. A string of numbers representing the pulldown pattern you wish to apply.
  10569. The default value is @code{23}.
  10570. @end table
  10571. @example
  10572. Some typical patterns:
  10573. NTSC output (30i):
  10574. 27.5p: 32222
  10575. 24p: 23 (classic)
  10576. 24p: 2332 (preferred)
  10577. 20p: 33
  10578. 18p: 334
  10579. 16p: 3444
  10580. PAL output (25i):
  10581. 27.5p: 12222
  10582. 24p: 222222222223 ("Euro pulldown")
  10583. 16.67p: 33
  10584. 16p: 33333334
  10585. @end example
  10586. @section threshold
  10587. Apply threshold effect to video stream.
  10588. This filter needs four video streams to perform thresholding.
  10589. First stream is stream we are filtering.
  10590. Second stream is holding threshold values, third stream is holding min values,
  10591. and last, fourth stream is holding max values.
  10592. The filter accepts the following option:
  10593. @table @option
  10594. @item planes
  10595. Set which planes will be processed, unprocessed planes will be copied.
  10596. By default value 0xf, all planes will be processed.
  10597. @end table
  10598. For example if first stream pixel's component value is less then threshold value
  10599. of pixel component from 2nd threshold stream, third stream value will picked,
  10600. otherwise fourth stream pixel component value will be picked.
  10601. Using color source filter one can perform various types of thresholding:
  10602. @subsection Examples
  10603. @itemize
  10604. @item
  10605. Binary threshold, using gray color as threshold:
  10606. @example
  10607. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10608. @end example
  10609. @item
  10610. Inverted binary threshold, using gray color as threshold:
  10611. @example
  10612. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10613. @end example
  10614. @item
  10615. Truncate binary threshold, using gray color as threshold:
  10616. @example
  10617. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10618. @end example
  10619. @item
  10620. Threshold to zero, using gray color as threshold:
  10621. @example
  10622. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10623. @end example
  10624. @item
  10625. Inverted threshold to zero, using gray color as threshold:
  10626. @example
  10627. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10628. @end example
  10629. @end itemize
  10630. @section thumbnail
  10631. Select the most representative frame in a given sequence of consecutive frames.
  10632. The filter accepts the following options:
  10633. @table @option
  10634. @item n
  10635. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10636. will pick one of them, and then handle the next batch of @var{n} frames until
  10637. the end. Default is @code{100}.
  10638. @end table
  10639. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10640. value will result in a higher memory usage, so a high value is not recommended.
  10641. @subsection Examples
  10642. @itemize
  10643. @item
  10644. Extract one picture each 50 frames:
  10645. @example
  10646. thumbnail=50
  10647. @end example
  10648. @item
  10649. Complete example of a thumbnail creation with @command{ffmpeg}:
  10650. @example
  10651. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10652. @end example
  10653. @end itemize
  10654. @section tile
  10655. Tile several successive frames together.
  10656. The filter accepts the following options:
  10657. @table @option
  10658. @item layout
  10659. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10660. this option, check the
  10661. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10662. @item nb_frames
  10663. Set the maximum number of frames to render in the given area. It must be less
  10664. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10665. the area will be used.
  10666. @item margin
  10667. Set the outer border margin in pixels.
  10668. @item padding
  10669. Set the inner border thickness (i.e. the number of pixels between frames). For
  10670. more advanced padding options (such as having different values for the edges),
  10671. refer to the pad video filter.
  10672. @item color
  10673. Specify the color of the unused area. For the syntax of this option, check the
  10674. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10675. is "black".
  10676. @end table
  10677. @subsection Examples
  10678. @itemize
  10679. @item
  10680. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10681. @example
  10682. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10683. @end example
  10684. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10685. duplicating each output frame to accommodate the originally detected frame
  10686. rate.
  10687. @item
  10688. Display @code{5} pictures in an area of @code{3x2} frames,
  10689. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10690. mixed flat and named options:
  10691. @example
  10692. tile=3x2:nb_frames=5:padding=7:margin=2
  10693. @end example
  10694. @end itemize
  10695. @section tinterlace
  10696. Perform various types of temporal field interlacing.
  10697. Frames are counted starting from 1, so the first input frame is
  10698. considered odd.
  10699. The filter accepts the following options:
  10700. @table @option
  10701. @item mode
  10702. Specify the mode of the interlacing. This option can also be specified
  10703. as a value alone. See below for a list of values for this option.
  10704. Available values are:
  10705. @table @samp
  10706. @item merge, 0
  10707. Move odd frames into the upper field, even into the lower field,
  10708. generating a double height frame at half frame rate.
  10709. @example
  10710. ------> time
  10711. Input:
  10712. Frame 1 Frame 2 Frame 3 Frame 4
  10713. 11111 22222 33333 44444
  10714. 11111 22222 33333 44444
  10715. 11111 22222 33333 44444
  10716. 11111 22222 33333 44444
  10717. Output:
  10718. 11111 33333
  10719. 22222 44444
  10720. 11111 33333
  10721. 22222 44444
  10722. 11111 33333
  10723. 22222 44444
  10724. 11111 33333
  10725. 22222 44444
  10726. @end example
  10727. @item drop_even, 1
  10728. Only output odd frames, even frames are dropped, generating a frame with
  10729. unchanged height at half frame rate.
  10730. @example
  10731. ------> time
  10732. Input:
  10733. Frame 1 Frame 2 Frame 3 Frame 4
  10734. 11111 22222 33333 44444
  10735. 11111 22222 33333 44444
  10736. 11111 22222 33333 44444
  10737. 11111 22222 33333 44444
  10738. Output:
  10739. 11111 33333
  10740. 11111 33333
  10741. 11111 33333
  10742. 11111 33333
  10743. @end example
  10744. @item drop_odd, 2
  10745. Only output even frames, odd frames are dropped, generating a frame with
  10746. unchanged height at half frame rate.
  10747. @example
  10748. ------> time
  10749. Input:
  10750. Frame 1 Frame 2 Frame 3 Frame 4
  10751. 11111 22222 33333 44444
  10752. 11111 22222 33333 44444
  10753. 11111 22222 33333 44444
  10754. 11111 22222 33333 44444
  10755. Output:
  10756. 22222 44444
  10757. 22222 44444
  10758. 22222 44444
  10759. 22222 44444
  10760. @end example
  10761. @item pad, 3
  10762. Expand each frame to full height, but pad alternate lines with black,
  10763. generating a frame with double height at the same input frame rate.
  10764. @example
  10765. ------> time
  10766. Input:
  10767. Frame 1 Frame 2 Frame 3 Frame 4
  10768. 11111 22222 33333 44444
  10769. 11111 22222 33333 44444
  10770. 11111 22222 33333 44444
  10771. 11111 22222 33333 44444
  10772. Output:
  10773. 11111 ..... 33333 .....
  10774. ..... 22222 ..... 44444
  10775. 11111 ..... 33333 .....
  10776. ..... 22222 ..... 44444
  10777. 11111 ..... 33333 .....
  10778. ..... 22222 ..... 44444
  10779. 11111 ..... 33333 .....
  10780. ..... 22222 ..... 44444
  10781. @end example
  10782. @item interleave_top, 4
  10783. Interleave the upper field from odd frames with the lower field from
  10784. even frames, generating a frame with unchanged height at half frame rate.
  10785. @example
  10786. ------> time
  10787. Input:
  10788. Frame 1 Frame 2 Frame 3 Frame 4
  10789. 11111<- 22222 33333<- 44444
  10790. 11111 22222<- 33333 44444<-
  10791. 11111<- 22222 33333<- 44444
  10792. 11111 22222<- 33333 44444<-
  10793. Output:
  10794. 11111 33333
  10795. 22222 44444
  10796. 11111 33333
  10797. 22222 44444
  10798. @end example
  10799. @item interleave_bottom, 5
  10800. Interleave the lower field from odd frames with the upper field from
  10801. even frames, generating a frame with unchanged height at half frame rate.
  10802. @example
  10803. ------> time
  10804. Input:
  10805. Frame 1 Frame 2 Frame 3 Frame 4
  10806. 11111 22222<- 33333 44444<-
  10807. 11111<- 22222 33333<- 44444
  10808. 11111 22222<- 33333 44444<-
  10809. 11111<- 22222 33333<- 44444
  10810. Output:
  10811. 22222 44444
  10812. 11111 33333
  10813. 22222 44444
  10814. 11111 33333
  10815. @end example
  10816. @item interlacex2, 6
  10817. Double frame rate with unchanged height. Frames are inserted each
  10818. containing the second temporal field from the previous input frame and
  10819. the first temporal field from the next input frame. This mode relies on
  10820. the top_field_first flag. Useful for interlaced video displays with no
  10821. field synchronisation.
  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 22222 22222 33333 33333 44444 44444
  10832. 11111 11111 22222 22222 33333 33333 44444
  10833. 11111 22222 22222 33333 33333 44444 44444
  10834. 11111 11111 22222 22222 33333 33333 44444
  10835. @end example
  10836. @item mergex2, 7
  10837. Move odd frames into the upper field, even into the lower field,
  10838. generating a double height frame at same frame rate.
  10839. @example
  10840. ------> time
  10841. Input:
  10842. Frame 1 Frame 2 Frame 3 Frame 4
  10843. 11111 22222 33333 44444
  10844. 11111 22222 33333 44444
  10845. 11111 22222 33333 44444
  10846. 11111 22222 33333 44444
  10847. Output:
  10848. 11111 33333 33333 55555
  10849. 22222 22222 44444 44444
  10850. 11111 33333 33333 55555
  10851. 22222 22222 44444 44444
  10852. 11111 33333 33333 55555
  10853. 22222 22222 44444 44444
  10854. 11111 33333 33333 55555
  10855. 22222 22222 44444 44444
  10856. @end example
  10857. @end table
  10858. Numeric values are deprecated but are accepted for backward
  10859. compatibility reasons.
  10860. Default mode is @code{merge}.
  10861. @item flags
  10862. Specify flags influencing the filter process.
  10863. Available value for @var{flags} is:
  10864. @table @option
  10865. @item low_pass_filter, vlfp
  10866. Enable linear vertical low-pass filtering in the filter.
  10867. Vertical low-pass filtering is required when creating an interlaced
  10868. destination from a progressive source which contains high-frequency
  10869. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10870. patterning.
  10871. @item complex_filter, cvlfp
  10872. Enable complex vertical low-pass filtering.
  10873. This will slightly less reduce interlace 'twitter' and Moire
  10874. patterning but better retain detail and subjective sharpness impression.
  10875. @end table
  10876. Vertical low-pass filtering can only be enabled for @option{mode}
  10877. @var{interleave_top} and @var{interleave_bottom}.
  10878. @end table
  10879. @section transpose
  10880. Transpose rows with columns in the input video and optionally flip it.
  10881. It accepts the following parameters:
  10882. @table @option
  10883. @item dir
  10884. Specify the transposition direction.
  10885. Can assume the following values:
  10886. @table @samp
  10887. @item 0, 4, cclock_flip
  10888. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10889. @example
  10890. L.R L.l
  10891. . . -> . .
  10892. l.r R.r
  10893. @end example
  10894. @item 1, 5, clock
  10895. Rotate by 90 degrees clockwise, that is:
  10896. @example
  10897. L.R l.L
  10898. . . -> . .
  10899. l.r r.R
  10900. @end example
  10901. @item 2, 6, cclock
  10902. Rotate by 90 degrees counterclockwise, that is:
  10903. @example
  10904. L.R R.r
  10905. . . -> . .
  10906. l.r L.l
  10907. @end example
  10908. @item 3, 7, clock_flip
  10909. Rotate by 90 degrees clockwise and vertically flip, that is:
  10910. @example
  10911. L.R r.R
  10912. . . -> . .
  10913. l.r l.L
  10914. @end example
  10915. @end table
  10916. For values between 4-7, the transposition is only done if the input
  10917. video geometry is portrait and not landscape. These values are
  10918. deprecated, the @code{passthrough} option should be used instead.
  10919. Numerical values are deprecated, and should be dropped in favor of
  10920. symbolic constants.
  10921. @item passthrough
  10922. Do not apply the transposition if the input geometry matches the one
  10923. specified by the specified value. It accepts the following values:
  10924. @table @samp
  10925. @item none
  10926. Always apply transposition.
  10927. @item portrait
  10928. Preserve portrait geometry (when @var{height} >= @var{width}).
  10929. @item landscape
  10930. Preserve landscape geometry (when @var{width} >= @var{height}).
  10931. @end table
  10932. Default value is @code{none}.
  10933. @end table
  10934. For example to rotate by 90 degrees clockwise and preserve portrait
  10935. layout:
  10936. @example
  10937. transpose=dir=1:passthrough=portrait
  10938. @end example
  10939. The command above can also be specified as:
  10940. @example
  10941. transpose=1:portrait
  10942. @end example
  10943. @section trim
  10944. Trim the input so that the output contains one continuous subpart of the input.
  10945. It accepts the following parameters:
  10946. @table @option
  10947. @item start
  10948. Specify the time of the start of the kept section, i.e. the frame with the
  10949. timestamp @var{start} will be the first frame in the output.
  10950. @item end
  10951. Specify the time of the first frame that will be dropped, i.e. the frame
  10952. immediately preceding the one with the timestamp @var{end} will be the last
  10953. frame in the output.
  10954. @item start_pts
  10955. This is the same as @var{start}, except this option sets the start timestamp
  10956. in timebase units instead of seconds.
  10957. @item end_pts
  10958. This is the same as @var{end}, except this option sets the end timestamp
  10959. in timebase units instead of seconds.
  10960. @item duration
  10961. The maximum duration of the output in seconds.
  10962. @item start_frame
  10963. The number of the first frame that should be passed to the output.
  10964. @item end_frame
  10965. The number of the first frame that should be dropped.
  10966. @end table
  10967. @option{start}, @option{end}, and @option{duration} are expressed as time
  10968. duration specifications; see
  10969. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10970. for the accepted syntax.
  10971. Note that the first two sets of the start/end options and the @option{duration}
  10972. option look at the frame timestamp, while the _frame variants simply count the
  10973. frames that pass through the filter. Also note that this filter does not modify
  10974. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10975. setpts filter after the trim filter.
  10976. If multiple start or end options are set, this filter tries to be greedy and
  10977. keep all the frames that match at least one of the specified constraints. To keep
  10978. only the part that matches all the constraints at once, chain multiple trim
  10979. filters.
  10980. The defaults are such that all the input is kept. So it is possible to set e.g.
  10981. just the end values to keep everything before the specified time.
  10982. Examples:
  10983. @itemize
  10984. @item
  10985. Drop everything except the second minute of input:
  10986. @example
  10987. ffmpeg -i INPUT -vf trim=60:120
  10988. @end example
  10989. @item
  10990. Keep only the first second:
  10991. @example
  10992. ffmpeg -i INPUT -vf trim=duration=1
  10993. @end example
  10994. @end itemize
  10995. @anchor{unsharp}
  10996. @section unsharp
  10997. Sharpen or blur the input video.
  10998. It accepts the following parameters:
  10999. @table @option
  11000. @item luma_msize_x, lx
  11001. Set the luma matrix horizontal size. It must be an odd integer between
  11002. 3 and 23. The default value is 5.
  11003. @item luma_msize_y, ly
  11004. Set the luma matrix vertical size. It must be an odd integer between 3
  11005. and 23. The default value is 5.
  11006. @item luma_amount, la
  11007. Set the luma effect strength. It must be a floating point number, reasonable
  11008. values lay between -1.5 and 1.5.
  11009. Negative values will blur the input video, while positive values will
  11010. sharpen it, a value of zero will disable the effect.
  11011. Default value is 1.0.
  11012. @item chroma_msize_x, cx
  11013. Set the chroma matrix horizontal size. It must be an odd integer
  11014. between 3 and 23. The default value is 5.
  11015. @item chroma_msize_y, cy
  11016. Set the chroma matrix vertical size. It must be an odd integer
  11017. between 3 and 23. The default value is 5.
  11018. @item chroma_amount, ca
  11019. Set the chroma effect strength. It must be a floating point number, reasonable
  11020. values lay between -1.5 and 1.5.
  11021. Negative values will blur the input video, while positive values will
  11022. sharpen it, a value of zero will disable the effect.
  11023. Default value is 0.0.
  11024. @item opencl
  11025. If set to 1, specify using OpenCL capabilities, only available if
  11026. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11027. @end table
  11028. All parameters are optional and default to the equivalent of the
  11029. string '5:5:1.0:5:5:0.0'.
  11030. @subsection Examples
  11031. @itemize
  11032. @item
  11033. Apply strong luma sharpen effect:
  11034. @example
  11035. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11036. @end example
  11037. @item
  11038. Apply a strong blur of both luma and chroma parameters:
  11039. @example
  11040. unsharp=7:7:-2:7:7:-2
  11041. @end example
  11042. @end itemize
  11043. @section uspp
  11044. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11045. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11046. shifts and average the results.
  11047. The way this differs from the behavior of spp is that uspp actually encodes &
  11048. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11049. DCT similar to MJPEG.
  11050. The filter accepts the following options:
  11051. @table @option
  11052. @item quality
  11053. Set quality. This option defines the number of levels for averaging. It accepts
  11054. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11055. effect. A value of @code{8} means the higher quality. For each increment of
  11056. that value the speed drops by a factor of approximately 2. Default value is
  11057. @code{3}.
  11058. @item qp
  11059. Force a constant quantization parameter. If not set, the filter will use the QP
  11060. from the video stream (if available).
  11061. @end table
  11062. @section vaguedenoiser
  11063. Apply a wavelet based denoiser.
  11064. It transforms each frame from the video input into the wavelet domain,
  11065. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11066. the obtained coefficients. It does an inverse wavelet transform after.
  11067. Due to wavelet properties, it should give a nice smoothed result, and
  11068. reduced noise, without blurring picture features.
  11069. This filter accepts the following options:
  11070. @table @option
  11071. @item threshold
  11072. The filtering strength. The higher, the more filtered the video will be.
  11073. Hard thresholding can use a higher threshold than soft thresholding
  11074. before the video looks overfiltered.
  11075. @item method
  11076. The filtering method the filter will use.
  11077. It accepts the following values:
  11078. @table @samp
  11079. @item hard
  11080. All values under the threshold will be zeroed.
  11081. @item soft
  11082. All values under the threshold will be zeroed. All values above will be
  11083. reduced by the threshold.
  11084. @item garrote
  11085. Scales or nullifies coefficients - intermediary between (more) soft and
  11086. (less) hard thresholding.
  11087. @end table
  11088. @item nsteps
  11089. Number of times, the wavelet will decompose the picture. Picture can't
  11090. be decomposed beyond a particular point (typically, 8 for a 640x480
  11091. frame - as 2^9 = 512 > 480)
  11092. @item percent
  11093. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11094. @item planes
  11095. A list of the planes to process. By default all planes are processed.
  11096. @end table
  11097. @section vectorscope
  11098. Display 2 color component values in the two dimensional graph (which is called
  11099. a vectorscope).
  11100. This filter accepts the following options:
  11101. @table @option
  11102. @item mode, m
  11103. Set vectorscope mode.
  11104. It accepts the following values:
  11105. @table @samp
  11106. @item gray
  11107. Gray values are displayed on graph, higher brightness means more pixels have
  11108. same component color value on location in graph. This is the default mode.
  11109. @item color
  11110. Gray values are displayed on graph. Surrounding pixels values which are not
  11111. present in video frame are drawn in gradient of 2 color components which are
  11112. set by option @code{x} and @code{y}. The 3rd color component is static.
  11113. @item color2
  11114. Actual color components values present in video frame are displayed on graph.
  11115. @item color3
  11116. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11117. on graph increases value of another color component, which is luminance by
  11118. default values of @code{x} and @code{y}.
  11119. @item color4
  11120. Actual colors present in video frame are displayed on graph. If two different
  11121. colors map to same position on graph then color with higher value of component
  11122. not present in graph is picked.
  11123. @item color5
  11124. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11125. component picked from radial gradient.
  11126. @end table
  11127. @item x
  11128. Set which color component will be represented on X-axis. Default is @code{1}.
  11129. @item y
  11130. Set which color component will be represented on Y-axis. Default is @code{2}.
  11131. @item intensity, i
  11132. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11133. of color component which represents frequency of (X, Y) location in graph.
  11134. @item envelope, e
  11135. @table @samp
  11136. @item none
  11137. No envelope, this is default.
  11138. @item instant
  11139. Instant envelope, even darkest single pixel will be clearly highlighted.
  11140. @item peak
  11141. Hold maximum and minimum values presented in graph over time. This way you
  11142. can still spot out of range values without constantly looking at vectorscope.
  11143. @item peak+instant
  11144. Peak and instant envelope combined together.
  11145. @end table
  11146. @item graticule, g
  11147. Set what kind of graticule to draw.
  11148. @table @samp
  11149. @item none
  11150. @item green
  11151. @item color
  11152. @end table
  11153. @item opacity, o
  11154. Set graticule opacity.
  11155. @item flags, f
  11156. Set graticule flags.
  11157. @table @samp
  11158. @item white
  11159. Draw graticule for white point.
  11160. @item black
  11161. Draw graticule for black point.
  11162. @item name
  11163. Draw color points short names.
  11164. @end table
  11165. @item bgopacity, b
  11166. Set background opacity.
  11167. @item lthreshold, l
  11168. Set low threshold for color component not represented on X or Y axis.
  11169. Values lower than this value will be ignored. Default is 0.
  11170. Note this value is multiplied with actual max possible value one pixel component
  11171. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11172. is 0.1 * 255 = 25.
  11173. @item hthreshold, h
  11174. Set high threshold for color component not represented on X or Y axis.
  11175. Values higher than this value will be ignored. Default is 1.
  11176. Note this value is multiplied with actual max possible value one pixel component
  11177. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11178. is 0.9 * 255 = 230.
  11179. @item colorspace, c
  11180. Set what kind of colorspace to use when drawing graticule.
  11181. @table @samp
  11182. @item auto
  11183. @item 601
  11184. @item 709
  11185. @end table
  11186. Default is auto.
  11187. @end table
  11188. @anchor{vidstabdetect}
  11189. @section vidstabdetect
  11190. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11191. @ref{vidstabtransform} for pass 2.
  11192. This filter generates a file with relative translation and rotation
  11193. transform information about subsequent frames, which is then used by
  11194. the @ref{vidstabtransform} filter.
  11195. To enable compilation of this filter you need to configure FFmpeg with
  11196. @code{--enable-libvidstab}.
  11197. This filter accepts the following options:
  11198. @table @option
  11199. @item result
  11200. Set the path to the file used to write the transforms information.
  11201. Default value is @file{transforms.trf}.
  11202. @item shakiness
  11203. Set how shaky the video is and how quick the camera is. It accepts an
  11204. integer in the range 1-10, a value of 1 means little shakiness, a
  11205. value of 10 means strong shakiness. Default value is 5.
  11206. @item accuracy
  11207. Set the accuracy of the detection process. It must be a value in the
  11208. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11209. accuracy. Default value is 15.
  11210. @item stepsize
  11211. Set stepsize of the search process. The region around minimum is
  11212. scanned with 1 pixel resolution. Default value is 6.
  11213. @item mincontrast
  11214. Set minimum contrast. Below this value a local measurement field is
  11215. discarded. Must be a floating point value in the range 0-1. Default
  11216. value is 0.3.
  11217. @item tripod
  11218. Set reference frame number for tripod mode.
  11219. If enabled, the motion of the frames is compared to a reference frame
  11220. in the filtered stream, identified by the specified number. The idea
  11221. is to compensate all movements in a more-or-less static scene and keep
  11222. the camera view absolutely still.
  11223. If set to 0, it is disabled. The frames are counted starting from 1.
  11224. @item show
  11225. Show fields and transforms in the resulting frames. It accepts an
  11226. integer in the range 0-2. Default value is 0, which disables any
  11227. visualization.
  11228. @end table
  11229. @subsection Examples
  11230. @itemize
  11231. @item
  11232. Use default values:
  11233. @example
  11234. vidstabdetect
  11235. @end example
  11236. @item
  11237. Analyze strongly shaky movie and put the results in file
  11238. @file{mytransforms.trf}:
  11239. @example
  11240. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11241. @end example
  11242. @item
  11243. Visualize the result of internal transformations in the resulting
  11244. video:
  11245. @example
  11246. vidstabdetect=show=1
  11247. @end example
  11248. @item
  11249. Analyze a video with medium shakiness using @command{ffmpeg}:
  11250. @example
  11251. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11252. @end example
  11253. @end itemize
  11254. @anchor{vidstabtransform}
  11255. @section vidstabtransform
  11256. Video stabilization/deshaking: pass 2 of 2,
  11257. see @ref{vidstabdetect} for pass 1.
  11258. Read a file with transform information for each frame and
  11259. apply/compensate them. Together with the @ref{vidstabdetect}
  11260. filter this can be used to deshake videos. See also
  11261. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11262. the @ref{unsharp} filter, see below.
  11263. To enable compilation of this filter you need to configure FFmpeg with
  11264. @code{--enable-libvidstab}.
  11265. @subsection Options
  11266. @table @option
  11267. @item input
  11268. Set path to the file used to read the transforms. Default value is
  11269. @file{transforms.trf}.
  11270. @item smoothing
  11271. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11272. camera movements. Default value is 10.
  11273. For example a number of 10 means that 21 frames are used (10 in the
  11274. past and 10 in the future) to smoothen the motion in the video. A
  11275. larger value leads to a smoother video, but limits the acceleration of
  11276. the camera (pan/tilt movements). 0 is a special case where a static
  11277. camera is simulated.
  11278. @item optalgo
  11279. Set the camera path optimization algorithm.
  11280. Accepted values are:
  11281. @table @samp
  11282. @item gauss
  11283. gaussian kernel low-pass filter on camera motion (default)
  11284. @item avg
  11285. averaging on transformations
  11286. @end table
  11287. @item maxshift
  11288. Set maximal number of pixels to translate frames. Default value is -1,
  11289. meaning no limit.
  11290. @item maxangle
  11291. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11292. value is -1, meaning no limit.
  11293. @item crop
  11294. Specify how to deal with borders that may be visible due to movement
  11295. compensation.
  11296. Available values are:
  11297. @table @samp
  11298. @item keep
  11299. keep image information from previous frame (default)
  11300. @item black
  11301. fill the border black
  11302. @end table
  11303. @item invert
  11304. Invert transforms if set to 1. Default value is 0.
  11305. @item relative
  11306. Consider transforms as relative to previous frame if set to 1,
  11307. absolute if set to 0. Default value is 0.
  11308. @item zoom
  11309. Set percentage to zoom. A positive value will result in a zoom-in
  11310. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11311. zoom).
  11312. @item optzoom
  11313. Set optimal zooming to avoid borders.
  11314. Accepted values are:
  11315. @table @samp
  11316. @item 0
  11317. disabled
  11318. @item 1
  11319. optimal static zoom value is determined (only very strong movements
  11320. will lead to visible borders) (default)
  11321. @item 2
  11322. optimal adaptive zoom value is determined (no borders will be
  11323. visible), see @option{zoomspeed}
  11324. @end table
  11325. Note that the value given at zoom is added to the one calculated here.
  11326. @item zoomspeed
  11327. Set percent to zoom maximally each frame (enabled when
  11328. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11329. 0.25.
  11330. @item interpol
  11331. Specify type of interpolation.
  11332. Available values are:
  11333. @table @samp
  11334. @item no
  11335. no interpolation
  11336. @item linear
  11337. linear only horizontal
  11338. @item bilinear
  11339. linear in both directions (default)
  11340. @item bicubic
  11341. cubic in both directions (slow)
  11342. @end table
  11343. @item tripod
  11344. Enable virtual tripod mode if set to 1, which is equivalent to
  11345. @code{relative=0:smoothing=0}. Default value is 0.
  11346. Use also @code{tripod} option of @ref{vidstabdetect}.
  11347. @item debug
  11348. Increase log verbosity if set to 1. Also the detected global motions
  11349. are written to the temporary file @file{global_motions.trf}. Default
  11350. value is 0.
  11351. @end table
  11352. @subsection Examples
  11353. @itemize
  11354. @item
  11355. Use @command{ffmpeg} for a typical stabilization with default values:
  11356. @example
  11357. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11358. @end example
  11359. Note the use of the @ref{unsharp} filter which is always recommended.
  11360. @item
  11361. Zoom in a bit more and load transform data from a given file:
  11362. @example
  11363. vidstabtransform=zoom=5:input="mytransforms.trf"
  11364. @end example
  11365. @item
  11366. Smoothen the video even more:
  11367. @example
  11368. vidstabtransform=smoothing=30
  11369. @end example
  11370. @end itemize
  11371. @section vflip
  11372. Flip the input video vertically.
  11373. For example, to vertically flip a video with @command{ffmpeg}:
  11374. @example
  11375. ffmpeg -i in.avi -vf "vflip" out.avi
  11376. @end example
  11377. @anchor{vignette}
  11378. @section vignette
  11379. Make or reverse a natural vignetting effect.
  11380. The filter accepts the following options:
  11381. @table @option
  11382. @item angle, a
  11383. Set lens angle expression as a number of radians.
  11384. The value is clipped in the @code{[0,PI/2]} range.
  11385. Default value: @code{"PI/5"}
  11386. @item x0
  11387. @item y0
  11388. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11389. by default.
  11390. @item mode
  11391. Set forward/backward mode.
  11392. Available modes are:
  11393. @table @samp
  11394. @item forward
  11395. The larger the distance from the central point, the darker the image becomes.
  11396. @item backward
  11397. The larger the distance from the central point, the brighter the image becomes.
  11398. This can be used to reverse a vignette effect, though there is no automatic
  11399. detection to extract the lens @option{angle} and other settings (yet). It can
  11400. also be used to create a burning effect.
  11401. @end table
  11402. Default value is @samp{forward}.
  11403. @item eval
  11404. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11405. It accepts the following values:
  11406. @table @samp
  11407. @item init
  11408. Evaluate expressions only once during the filter initialization.
  11409. @item frame
  11410. Evaluate expressions for each incoming frame. This is way slower than the
  11411. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11412. allows advanced dynamic expressions.
  11413. @end table
  11414. Default value is @samp{init}.
  11415. @item dither
  11416. Set dithering to reduce the circular banding effects. Default is @code{1}
  11417. (enabled).
  11418. @item aspect
  11419. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11420. Setting this value to the SAR of the input will make a rectangular vignetting
  11421. following the dimensions of the video.
  11422. Default is @code{1/1}.
  11423. @end table
  11424. @subsection Expressions
  11425. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11426. following parameters.
  11427. @table @option
  11428. @item w
  11429. @item h
  11430. input width and height
  11431. @item n
  11432. the number of input frame, starting from 0
  11433. @item pts
  11434. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11435. @var{TB} units, NAN if undefined
  11436. @item r
  11437. frame rate of the input video, NAN if the input frame rate is unknown
  11438. @item t
  11439. the PTS (Presentation TimeStamp) of the filtered video frame,
  11440. expressed in seconds, NAN if undefined
  11441. @item tb
  11442. time base of the input video
  11443. @end table
  11444. @subsection Examples
  11445. @itemize
  11446. @item
  11447. Apply simple strong vignetting effect:
  11448. @example
  11449. vignette=PI/4
  11450. @end example
  11451. @item
  11452. Make a flickering vignetting:
  11453. @example
  11454. vignette='PI/4+random(1)*PI/50':eval=frame
  11455. @end example
  11456. @end itemize
  11457. @section vstack
  11458. Stack input videos vertically.
  11459. All streams must be of same pixel format and of same width.
  11460. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11461. to create same output.
  11462. The filter accept the following option:
  11463. @table @option
  11464. @item inputs
  11465. Set number of input streams. Default is 2.
  11466. @item shortest
  11467. If set to 1, force the output to terminate when the shortest input
  11468. terminates. Default value is 0.
  11469. @end table
  11470. @section w3fdif
  11471. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11472. Deinterlacing Filter").
  11473. Based on the process described by Martin Weston for BBC R&D, and
  11474. implemented based on the de-interlace algorithm written by Jim
  11475. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11476. uses filter coefficients calculated by BBC R&D.
  11477. There are two sets of filter coefficients, so called "simple":
  11478. and "complex". Which set of filter coefficients is used can
  11479. be set by passing an optional parameter:
  11480. @table @option
  11481. @item filter
  11482. Set the interlacing filter coefficients. Accepts one of the following values:
  11483. @table @samp
  11484. @item simple
  11485. Simple filter coefficient set.
  11486. @item complex
  11487. More-complex filter coefficient set.
  11488. @end table
  11489. Default value is @samp{complex}.
  11490. @item deint
  11491. Specify which frames to deinterlace. Accept one of the following values:
  11492. @table @samp
  11493. @item all
  11494. Deinterlace all frames,
  11495. @item interlaced
  11496. Only deinterlace frames marked as interlaced.
  11497. @end table
  11498. Default value is @samp{all}.
  11499. @end table
  11500. @section waveform
  11501. Video waveform monitor.
  11502. The waveform monitor plots color component intensity. By default luminance
  11503. only. Each column of the waveform corresponds to a column of pixels in the
  11504. source video.
  11505. It accepts the following options:
  11506. @table @option
  11507. @item mode, m
  11508. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11509. In row mode, the graph on the left side represents color component value 0 and
  11510. the right side represents value = 255. In column mode, the top side represents
  11511. color component value = 0 and bottom side represents value = 255.
  11512. @item intensity, i
  11513. Set intensity. Smaller values are useful to find out how many values of the same
  11514. luminance are distributed across input rows/columns.
  11515. Default value is @code{0.04}. Allowed range is [0, 1].
  11516. @item mirror, r
  11517. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11518. In mirrored mode, higher values will be represented on the left
  11519. side for @code{row} mode and at the top for @code{column} mode. Default is
  11520. @code{1} (mirrored).
  11521. @item display, d
  11522. Set display mode.
  11523. It accepts the following values:
  11524. @table @samp
  11525. @item overlay
  11526. Presents information identical to that in the @code{parade}, except
  11527. that the graphs representing color components are superimposed directly
  11528. over one another.
  11529. This display mode makes it easier to spot relative differences or similarities
  11530. in overlapping areas of the color components that are supposed to be identical,
  11531. such as neutral whites, grays, or blacks.
  11532. @item stack
  11533. Display separate graph for the color components side by side in
  11534. @code{row} mode or one below the other in @code{column} mode.
  11535. @item parade
  11536. Display separate graph for the color components side by side in
  11537. @code{column} mode or one below the other in @code{row} mode.
  11538. Using this display mode makes it easy to spot color casts in the highlights
  11539. and shadows of an image, by comparing the contours of the top and the bottom
  11540. graphs of each waveform. Since whites, grays, and blacks are characterized
  11541. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11542. should display three waveforms of roughly equal width/height. If not, the
  11543. correction is easy to perform by making level adjustments the three waveforms.
  11544. @end table
  11545. Default is @code{stack}.
  11546. @item components, c
  11547. Set which color components to display. Default is 1, which means only luminance
  11548. or red color component if input is in RGB colorspace. If is set for example to
  11549. 7 it will display all 3 (if) available color components.
  11550. @item envelope, e
  11551. @table @samp
  11552. @item none
  11553. No envelope, this is default.
  11554. @item instant
  11555. Instant envelope, minimum and maximum values presented in graph will be easily
  11556. visible even with small @code{step} value.
  11557. @item peak
  11558. Hold minimum and maximum values presented in graph across time. This way you
  11559. can still spot out of range values without constantly looking at waveforms.
  11560. @item peak+instant
  11561. Peak and instant envelope combined together.
  11562. @end table
  11563. @item filter, f
  11564. @table @samp
  11565. @item lowpass
  11566. No filtering, this is default.
  11567. @item flat
  11568. Luma and chroma combined together.
  11569. @item aflat
  11570. Similar as above, but shows difference between blue and red chroma.
  11571. @item chroma
  11572. Displays only chroma.
  11573. @item color
  11574. Displays actual color value on waveform.
  11575. @item acolor
  11576. Similar as above, but with luma showing frequency of chroma values.
  11577. @end table
  11578. @item graticule, g
  11579. Set which graticule to display.
  11580. @table @samp
  11581. @item none
  11582. Do not display graticule.
  11583. @item green
  11584. Display green graticule showing legal broadcast ranges.
  11585. @end table
  11586. @item opacity, o
  11587. Set graticule opacity.
  11588. @item flags, fl
  11589. Set graticule flags.
  11590. @table @samp
  11591. @item numbers
  11592. Draw numbers above lines. By default enabled.
  11593. @item dots
  11594. Draw dots instead of lines.
  11595. @end table
  11596. @item scale, s
  11597. Set scale used for displaying graticule.
  11598. @table @samp
  11599. @item digital
  11600. @item millivolts
  11601. @item ire
  11602. @end table
  11603. Default is digital.
  11604. @item bgopacity, b
  11605. Set background opacity.
  11606. @end table
  11607. @section weave, doubleweave
  11608. The @code{weave} takes a field-based video input and join
  11609. each two sequential fields into single frame, producing a new double
  11610. height clip with half the frame rate and half the frame count.
  11611. The @code{doubleweave} works same as @code{weave} but without
  11612. halving frame rate and frame count.
  11613. It accepts the following option:
  11614. @table @option
  11615. @item first_field
  11616. Set first field. Available values are:
  11617. @table @samp
  11618. @item top, t
  11619. Set the frame as top-field-first.
  11620. @item bottom, b
  11621. Set the frame as bottom-field-first.
  11622. @end table
  11623. @end table
  11624. @subsection Examples
  11625. @itemize
  11626. @item
  11627. Interlace video using @ref{select} and @ref{separatefields} filter:
  11628. @example
  11629. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11630. @end example
  11631. @end itemize
  11632. @section xbr
  11633. Apply the xBR high-quality magnification filter which is designed for pixel
  11634. art. It follows a set of edge-detection rules, see
  11635. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11636. It accepts the following option:
  11637. @table @option
  11638. @item n
  11639. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11640. @code{3xBR} and @code{4} for @code{4xBR}.
  11641. Default is @code{3}.
  11642. @end table
  11643. @anchor{yadif}
  11644. @section yadif
  11645. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11646. filter").
  11647. It accepts the following parameters:
  11648. @table @option
  11649. @item mode
  11650. The interlacing mode to adopt. It accepts one of the following values:
  11651. @table @option
  11652. @item 0, send_frame
  11653. Output one frame for each frame.
  11654. @item 1, send_field
  11655. Output one frame for each field.
  11656. @item 2, send_frame_nospatial
  11657. Like @code{send_frame}, but it skips the spatial interlacing check.
  11658. @item 3, send_field_nospatial
  11659. Like @code{send_field}, but it skips the spatial interlacing check.
  11660. @end table
  11661. The default value is @code{send_frame}.
  11662. @item parity
  11663. The picture field parity assumed for the input interlaced video. It accepts one
  11664. of the following values:
  11665. @table @option
  11666. @item 0, tff
  11667. Assume the top field is first.
  11668. @item 1, bff
  11669. Assume the bottom field is first.
  11670. @item -1, auto
  11671. Enable automatic detection of field parity.
  11672. @end table
  11673. The default value is @code{auto}.
  11674. If the interlacing is unknown or the decoder does not export this information,
  11675. top field first will be assumed.
  11676. @item deint
  11677. Specify which frames to deinterlace. Accept one of the following
  11678. values:
  11679. @table @option
  11680. @item 0, all
  11681. Deinterlace all frames.
  11682. @item 1, interlaced
  11683. Only deinterlace frames marked as interlaced.
  11684. @end table
  11685. The default value is @code{all}.
  11686. @end table
  11687. @section zoompan
  11688. Apply Zoom & Pan effect.
  11689. This filter accepts the following options:
  11690. @table @option
  11691. @item zoom, z
  11692. Set the zoom expression. Default is 1.
  11693. @item x
  11694. @item y
  11695. Set the x and y expression. Default is 0.
  11696. @item d
  11697. Set the duration expression in number of frames.
  11698. This sets for how many number of frames effect will last for
  11699. single input image.
  11700. @item s
  11701. Set the output image size, default is 'hd720'.
  11702. @item fps
  11703. Set the output frame rate, default is '25'.
  11704. @end table
  11705. Each expression can contain the following constants:
  11706. @table @option
  11707. @item in_w, iw
  11708. Input width.
  11709. @item in_h, ih
  11710. Input height.
  11711. @item out_w, ow
  11712. Output width.
  11713. @item out_h, oh
  11714. Output height.
  11715. @item in
  11716. Input frame count.
  11717. @item on
  11718. Output frame count.
  11719. @item x
  11720. @item y
  11721. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11722. for current input frame.
  11723. @item px
  11724. @item py
  11725. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11726. not yet such frame (first input frame).
  11727. @item zoom
  11728. Last calculated zoom from 'z' expression for current input frame.
  11729. @item pzoom
  11730. Last calculated zoom of last output frame of previous input frame.
  11731. @item duration
  11732. Number of output frames for current input frame. Calculated from 'd' expression
  11733. for each input frame.
  11734. @item pduration
  11735. number of output frames created for previous input frame
  11736. @item a
  11737. Rational number: input width / input height
  11738. @item sar
  11739. sample aspect ratio
  11740. @item dar
  11741. display aspect ratio
  11742. @end table
  11743. @subsection Examples
  11744. @itemize
  11745. @item
  11746. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11747. @example
  11748. 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
  11749. @end example
  11750. @item
  11751. Zoom-in up to 1.5 and pan always at center of picture:
  11752. @example
  11753. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11754. @end example
  11755. @item
  11756. Same as above but without pausing:
  11757. @example
  11758. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11759. @end example
  11760. @end itemize
  11761. @section zscale
  11762. Scale (resize) the input video, using the z.lib library:
  11763. https://github.com/sekrit-twc/zimg.
  11764. The zscale filter forces the output display aspect ratio to be the same
  11765. as the input, by changing the output sample aspect ratio.
  11766. If the input image format is different from the format requested by
  11767. the next filter, the zscale filter will convert the input to the
  11768. requested format.
  11769. @subsection Options
  11770. The filter accepts the following options.
  11771. @table @option
  11772. @item width, w
  11773. @item height, h
  11774. Set the output video dimension expression. Default value is the input
  11775. dimension.
  11776. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11777. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11778. If one of the values is -1, the zscale filter will use a value that
  11779. maintains the aspect ratio of the input image, calculated from the
  11780. other specified dimension. If both of them are -1, the input size is
  11781. used
  11782. If one of the values is -n with n > 1, the zscale filter will also use a value
  11783. that maintains the aspect ratio of the input image, calculated from the other
  11784. specified dimension. After that it will, however, make sure that the calculated
  11785. dimension is divisible by n and adjust the value if necessary.
  11786. See below for the list of accepted constants for use in the dimension
  11787. expression.
  11788. @item size, s
  11789. Set the video size. For the syntax of this option, check the
  11790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11791. @item dither, d
  11792. Set the dither type.
  11793. Possible values are:
  11794. @table @var
  11795. @item none
  11796. @item ordered
  11797. @item random
  11798. @item error_diffusion
  11799. @end table
  11800. Default is none.
  11801. @item filter, f
  11802. Set the resize filter type.
  11803. Possible values are:
  11804. @table @var
  11805. @item point
  11806. @item bilinear
  11807. @item bicubic
  11808. @item spline16
  11809. @item spline36
  11810. @item lanczos
  11811. @end table
  11812. Default is bilinear.
  11813. @item range, r
  11814. Set the color range.
  11815. Possible values are:
  11816. @table @var
  11817. @item input
  11818. @item limited
  11819. @item full
  11820. @end table
  11821. Default is same as input.
  11822. @item primaries, p
  11823. Set the color primaries.
  11824. Possible values are:
  11825. @table @var
  11826. @item input
  11827. @item 709
  11828. @item unspecified
  11829. @item 170m
  11830. @item 240m
  11831. @item 2020
  11832. @end table
  11833. Default is same as input.
  11834. @item transfer, t
  11835. Set the transfer characteristics.
  11836. Possible values are:
  11837. @table @var
  11838. @item input
  11839. @item 709
  11840. @item unspecified
  11841. @item 601
  11842. @item linear
  11843. @item 2020_10
  11844. @item 2020_12
  11845. @item smpte2084
  11846. @item iec61966-2-1
  11847. @item arib-std-b67
  11848. @end table
  11849. Default is same as input.
  11850. @item matrix, m
  11851. Set the colorspace matrix.
  11852. Possible value are:
  11853. @table @var
  11854. @item input
  11855. @item 709
  11856. @item unspecified
  11857. @item 470bg
  11858. @item 170m
  11859. @item 2020_ncl
  11860. @item 2020_cl
  11861. @end table
  11862. Default is same as input.
  11863. @item rangein, rin
  11864. Set the input color range.
  11865. Possible values are:
  11866. @table @var
  11867. @item input
  11868. @item limited
  11869. @item full
  11870. @end table
  11871. Default is same as input.
  11872. @item primariesin, pin
  11873. Set the input color primaries.
  11874. Possible values are:
  11875. @table @var
  11876. @item input
  11877. @item 709
  11878. @item unspecified
  11879. @item 170m
  11880. @item 240m
  11881. @item 2020
  11882. @end table
  11883. Default is same as input.
  11884. @item transferin, tin
  11885. Set the input transfer characteristics.
  11886. Possible values are:
  11887. @table @var
  11888. @item input
  11889. @item 709
  11890. @item unspecified
  11891. @item 601
  11892. @item linear
  11893. @item 2020_10
  11894. @item 2020_12
  11895. @end table
  11896. Default is same as input.
  11897. @item matrixin, min
  11898. Set the input colorspace matrix.
  11899. Possible value are:
  11900. @table @var
  11901. @item input
  11902. @item 709
  11903. @item unspecified
  11904. @item 470bg
  11905. @item 170m
  11906. @item 2020_ncl
  11907. @item 2020_cl
  11908. @end table
  11909. @item chromal, c
  11910. Set the output chroma location.
  11911. Possible values are:
  11912. @table @var
  11913. @item input
  11914. @item left
  11915. @item center
  11916. @item topleft
  11917. @item top
  11918. @item bottomleft
  11919. @item bottom
  11920. @end table
  11921. @item chromalin, cin
  11922. Set the input chroma location.
  11923. Possible values are:
  11924. @table @var
  11925. @item input
  11926. @item left
  11927. @item center
  11928. @item topleft
  11929. @item top
  11930. @item bottomleft
  11931. @item bottom
  11932. @end table
  11933. @item npl
  11934. Set the nominal peak luminance.
  11935. @end table
  11936. The values of the @option{w} and @option{h} options are expressions
  11937. containing the following constants:
  11938. @table @var
  11939. @item in_w
  11940. @item in_h
  11941. The input width and height
  11942. @item iw
  11943. @item ih
  11944. These are the same as @var{in_w} and @var{in_h}.
  11945. @item out_w
  11946. @item out_h
  11947. The output (scaled) width and height
  11948. @item ow
  11949. @item oh
  11950. These are the same as @var{out_w} and @var{out_h}
  11951. @item a
  11952. The same as @var{iw} / @var{ih}
  11953. @item sar
  11954. input sample aspect ratio
  11955. @item dar
  11956. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11957. @item hsub
  11958. @item vsub
  11959. horizontal and vertical input chroma subsample values. For example for the
  11960. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11961. @item ohsub
  11962. @item ovsub
  11963. horizontal and vertical output chroma subsample values. For example for the
  11964. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11965. @end table
  11966. @table @option
  11967. @end table
  11968. @c man end VIDEO FILTERS
  11969. @chapter Video Sources
  11970. @c man begin VIDEO SOURCES
  11971. Below is a description of the currently available video sources.
  11972. @section buffer
  11973. Buffer video frames, and make them available to the filter chain.
  11974. This source is mainly intended for a programmatic use, in particular
  11975. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11976. It accepts the following parameters:
  11977. @table @option
  11978. @item video_size
  11979. Specify the size (width and height) of the buffered video frames. For the
  11980. syntax of this option, check the
  11981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11982. @item width
  11983. The input video width.
  11984. @item height
  11985. The input video height.
  11986. @item pix_fmt
  11987. A string representing the pixel format of the buffered video frames.
  11988. It may be a number corresponding to a pixel format, or a pixel format
  11989. name.
  11990. @item time_base
  11991. Specify the timebase assumed by the timestamps of the buffered frames.
  11992. @item frame_rate
  11993. Specify the frame rate expected for the video stream.
  11994. @item pixel_aspect, sar
  11995. The sample (pixel) aspect ratio of the input video.
  11996. @item sws_param
  11997. Specify the optional parameters to be used for the scale filter which
  11998. is automatically inserted when an input change is detected in the
  11999. input size or format.
  12000. @item hw_frames_ctx
  12001. When using a hardware pixel format, this should be a reference to an
  12002. AVHWFramesContext describing input frames.
  12003. @end table
  12004. For example:
  12005. @example
  12006. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12007. @end example
  12008. will instruct the source to accept video frames with size 320x240 and
  12009. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12010. square pixels (1:1 sample aspect ratio).
  12011. Since the pixel format with name "yuv410p" corresponds to the number 6
  12012. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12013. this example corresponds to:
  12014. @example
  12015. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12016. @end example
  12017. Alternatively, the options can be specified as a flat string, but this
  12018. syntax is deprecated:
  12019. @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}]
  12020. @section cellauto
  12021. Create a pattern generated by an elementary cellular automaton.
  12022. The initial state of the cellular automaton can be defined through the
  12023. @option{filename} and @option{pattern} options. If such options are
  12024. not specified an initial state is created randomly.
  12025. At each new frame a new row in the video is filled with the result of
  12026. the cellular automaton next generation. The behavior when the whole
  12027. frame is filled is defined by the @option{scroll} option.
  12028. This source accepts the following options:
  12029. @table @option
  12030. @item filename, f
  12031. Read the initial cellular automaton state, i.e. the starting row, from
  12032. the specified file.
  12033. In the file, each non-whitespace character is considered an alive
  12034. cell, a newline will terminate the row, and further characters in the
  12035. file will be ignored.
  12036. @item pattern, p
  12037. Read the initial cellular automaton state, i.e. the starting row, from
  12038. the specified string.
  12039. Each non-whitespace character in the string is considered an alive
  12040. cell, a newline will terminate the row, and further characters in the
  12041. string will be ignored.
  12042. @item rate, r
  12043. Set the video rate, that is the number of frames generated per second.
  12044. Default is 25.
  12045. @item random_fill_ratio, ratio
  12046. Set the random fill ratio for the initial cellular automaton row. It
  12047. is a floating point number value ranging from 0 to 1, defaults to
  12048. 1/PHI.
  12049. This option is ignored when a file or a pattern is specified.
  12050. @item random_seed, seed
  12051. Set the seed for filling randomly the initial row, must be an integer
  12052. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12053. set to -1, the filter will try to use a good random seed on a best
  12054. effort basis.
  12055. @item rule
  12056. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12057. Default value is 110.
  12058. @item size, s
  12059. Set the size of the output video. For the syntax of this option, check the
  12060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12061. If @option{filename} or @option{pattern} is specified, the size is set
  12062. by default to the width of the specified initial state row, and the
  12063. height is set to @var{width} * PHI.
  12064. If @option{size} is set, it must contain the width of the specified
  12065. pattern string, and the specified pattern will be centered in the
  12066. larger row.
  12067. If a filename or a pattern string is not specified, the size value
  12068. defaults to "320x518" (used for a randomly generated initial state).
  12069. @item scroll
  12070. If set to 1, scroll the output upward when all the rows in the output
  12071. have been already filled. If set to 0, the new generated row will be
  12072. written over the top row just after the bottom row is filled.
  12073. Defaults to 1.
  12074. @item start_full, full
  12075. If set to 1, completely fill the output with generated rows before
  12076. outputting the first frame.
  12077. This is the default behavior, for disabling set the value to 0.
  12078. @item stitch
  12079. If set to 1, stitch the left and right row edges together.
  12080. This is the default behavior, for disabling set the value to 0.
  12081. @end table
  12082. @subsection Examples
  12083. @itemize
  12084. @item
  12085. Read the initial state from @file{pattern}, and specify an output of
  12086. size 200x400.
  12087. @example
  12088. cellauto=f=pattern:s=200x400
  12089. @end example
  12090. @item
  12091. Generate a random initial row with a width of 200 cells, with a fill
  12092. ratio of 2/3:
  12093. @example
  12094. cellauto=ratio=2/3:s=200x200
  12095. @end example
  12096. @item
  12097. Create a pattern generated by rule 18 starting by a single alive cell
  12098. centered on an initial row with width 100:
  12099. @example
  12100. cellauto=p=@@:s=100x400:full=0:rule=18
  12101. @end example
  12102. @item
  12103. Specify a more elaborated initial pattern:
  12104. @example
  12105. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12106. @end example
  12107. @end itemize
  12108. @anchor{coreimagesrc}
  12109. @section coreimagesrc
  12110. Video source generated on GPU using Apple's CoreImage API on OSX.
  12111. This video source is a specialized version of the @ref{coreimage} video filter.
  12112. Use a core image generator at the beginning of the applied filterchain to
  12113. generate the content.
  12114. The coreimagesrc video source accepts the following options:
  12115. @table @option
  12116. @item list_generators
  12117. List all available generators along with all their respective options as well as
  12118. possible minimum and maximum values along with the default values.
  12119. @example
  12120. list_generators=true
  12121. @end example
  12122. @item size, s
  12123. Specify the size of the sourced video. For the syntax of this option, check the
  12124. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12125. The default value is @code{320x240}.
  12126. @item rate, r
  12127. Specify the frame rate of the sourced video, as the number of frames
  12128. generated per second. It has to be a string in the format
  12129. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12130. number or a valid video frame rate abbreviation. The default value is
  12131. "25".
  12132. @item sar
  12133. Set the sample aspect ratio of the sourced video.
  12134. @item duration, d
  12135. Set the duration of the sourced video. See
  12136. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12137. for the accepted syntax.
  12138. If not specified, or the expressed duration is negative, the video is
  12139. supposed to be generated forever.
  12140. @end table
  12141. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12142. A complete filterchain can be used for further processing of the
  12143. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12144. and examples for details.
  12145. @subsection Examples
  12146. @itemize
  12147. @item
  12148. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12149. given as complete and escaped command-line for Apple's standard bash shell:
  12150. @example
  12151. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12152. @end example
  12153. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12154. need for a nullsrc video source.
  12155. @end itemize
  12156. @section mandelbrot
  12157. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12158. point specified with @var{start_x} and @var{start_y}.
  12159. This source accepts the following options:
  12160. @table @option
  12161. @item end_pts
  12162. Set the terminal pts value. Default value is 400.
  12163. @item end_scale
  12164. Set the terminal scale value.
  12165. Must be a floating point value. Default value is 0.3.
  12166. @item inner
  12167. Set the inner coloring mode, that is the algorithm used to draw the
  12168. Mandelbrot fractal internal region.
  12169. It shall assume one of the following values:
  12170. @table @option
  12171. @item black
  12172. Set black mode.
  12173. @item convergence
  12174. Show time until convergence.
  12175. @item mincol
  12176. Set color based on point closest to the origin of the iterations.
  12177. @item period
  12178. Set period mode.
  12179. @end table
  12180. Default value is @var{mincol}.
  12181. @item bailout
  12182. Set the bailout value. Default value is 10.0.
  12183. @item maxiter
  12184. Set the maximum of iterations performed by the rendering
  12185. algorithm. Default value is 7189.
  12186. @item outer
  12187. Set outer coloring mode.
  12188. It shall assume one of following values:
  12189. @table @option
  12190. @item iteration_count
  12191. Set iteration cound mode.
  12192. @item normalized_iteration_count
  12193. set normalized iteration count mode.
  12194. @end table
  12195. Default value is @var{normalized_iteration_count}.
  12196. @item rate, r
  12197. Set frame rate, expressed as number of frames per second. Default
  12198. value is "25".
  12199. @item size, s
  12200. Set frame size. For the syntax of this option, check the "Video
  12201. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12202. @item start_scale
  12203. Set the initial scale value. Default value is 3.0.
  12204. @item start_x
  12205. Set the initial x position. Must be a floating point value between
  12206. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12207. @item start_y
  12208. Set the initial y position. Must be a floating point value between
  12209. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12210. @end table
  12211. @section mptestsrc
  12212. Generate various test patterns, as generated by the MPlayer test filter.
  12213. The size of the generated video is fixed, and is 256x256.
  12214. This source is useful in particular for testing encoding features.
  12215. This source accepts the following options:
  12216. @table @option
  12217. @item rate, r
  12218. Specify the frame rate of the sourced video, as the number of frames
  12219. generated per second. It has to be a string in the format
  12220. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12221. number or a valid video frame rate abbreviation. The default value is
  12222. "25".
  12223. @item duration, d
  12224. Set the duration of the sourced video. See
  12225. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12226. for the accepted syntax.
  12227. If not specified, or the expressed duration is negative, the video is
  12228. supposed to be generated forever.
  12229. @item test, t
  12230. Set the number or the name of the test to perform. Supported tests are:
  12231. @table @option
  12232. @item dc_luma
  12233. @item dc_chroma
  12234. @item freq_luma
  12235. @item freq_chroma
  12236. @item amp_luma
  12237. @item amp_chroma
  12238. @item cbp
  12239. @item mv
  12240. @item ring1
  12241. @item ring2
  12242. @item all
  12243. @end table
  12244. Default value is "all", which will cycle through the list of all tests.
  12245. @end table
  12246. Some examples:
  12247. @example
  12248. mptestsrc=t=dc_luma
  12249. @end example
  12250. will generate a "dc_luma" test pattern.
  12251. @section frei0r_src
  12252. Provide a frei0r source.
  12253. To enable compilation of this filter you need to install the frei0r
  12254. header and configure FFmpeg with @code{--enable-frei0r}.
  12255. This source accepts the following parameters:
  12256. @table @option
  12257. @item size
  12258. The size of the video to generate. For the syntax of this option, check the
  12259. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12260. @item framerate
  12261. The framerate of the generated video. It may be a string of the form
  12262. @var{num}/@var{den} or a frame rate abbreviation.
  12263. @item filter_name
  12264. The name to the frei0r source to load. For more information regarding frei0r and
  12265. how to set the parameters, read the @ref{frei0r} section in the video filters
  12266. documentation.
  12267. @item filter_params
  12268. A '|'-separated list of parameters to pass to the frei0r source.
  12269. @end table
  12270. For example, to generate a frei0r partik0l source with size 200x200
  12271. and frame rate 10 which is overlaid on the overlay filter main input:
  12272. @example
  12273. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12274. @end example
  12275. @section life
  12276. Generate a life pattern.
  12277. This source is based on a generalization of John Conway's life game.
  12278. The sourced input represents a life grid, each pixel represents a cell
  12279. which can be in one of two possible states, alive or dead. Every cell
  12280. interacts with its eight neighbours, which are the cells that are
  12281. horizontally, vertically, or diagonally adjacent.
  12282. At each interaction the grid evolves according to the adopted rule,
  12283. which specifies the number of neighbor alive cells which will make a
  12284. cell stay alive or born. The @option{rule} option allows one to specify
  12285. the rule to adopt.
  12286. This source accepts the following options:
  12287. @table @option
  12288. @item filename, f
  12289. Set the file from which to read the initial grid state. In the file,
  12290. each non-whitespace character is considered an alive cell, and newline
  12291. is used to delimit the end of each row.
  12292. If this option is not specified, the initial grid is generated
  12293. randomly.
  12294. @item rate, r
  12295. Set the video rate, that is the number of frames generated per second.
  12296. Default is 25.
  12297. @item random_fill_ratio, ratio
  12298. Set the random fill ratio for the initial random grid. It is a
  12299. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12300. It is ignored when a file is specified.
  12301. @item random_seed, seed
  12302. Set the seed for filling the initial random grid, must be an integer
  12303. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12304. set to -1, the filter will try to use a good random seed on a best
  12305. effort basis.
  12306. @item rule
  12307. Set the life rule.
  12308. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12309. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12310. @var{NS} specifies the number of alive neighbor cells which make a
  12311. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12312. which make a dead cell to become alive (i.e. to "born").
  12313. "s" and "b" can be used in place of "S" and "B", respectively.
  12314. Alternatively a rule can be specified by an 18-bits integer. The 9
  12315. high order bits are used to encode the next cell state if it is alive
  12316. for each number of neighbor alive cells, the low order bits specify
  12317. the rule for "borning" new cells. Higher order bits encode for an
  12318. higher number of neighbor cells.
  12319. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12320. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12321. Default value is "S23/B3", which is the original Conway's game of life
  12322. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12323. cells, and will born a new cell if there are three alive cells around
  12324. a dead cell.
  12325. @item size, s
  12326. Set the size of the output video. For the syntax of this option, check the
  12327. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12328. If @option{filename} is specified, the size is set by default to the
  12329. same size of the input file. If @option{size} is set, it must contain
  12330. the size specified in the input file, and the initial grid defined in
  12331. that file is centered in the larger resulting area.
  12332. If a filename is not specified, the size value defaults to "320x240"
  12333. (used for a randomly generated initial grid).
  12334. @item stitch
  12335. If set to 1, stitch the left and right grid edges together, and the
  12336. top and bottom edges also. Defaults to 1.
  12337. @item mold
  12338. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12339. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12340. value from 0 to 255.
  12341. @item life_color
  12342. Set the color of living (or new born) cells.
  12343. @item death_color
  12344. Set the color of dead cells. If @option{mold} is set, this is the first color
  12345. used to represent a dead cell.
  12346. @item mold_color
  12347. Set mold color, for definitely dead and moldy cells.
  12348. For the syntax of these 3 color options, check the "Color" section in the
  12349. ffmpeg-utils manual.
  12350. @end table
  12351. @subsection Examples
  12352. @itemize
  12353. @item
  12354. Read a grid from @file{pattern}, and center it on a grid of size
  12355. 300x300 pixels:
  12356. @example
  12357. life=f=pattern:s=300x300
  12358. @end example
  12359. @item
  12360. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12361. @example
  12362. life=ratio=2/3:s=200x200
  12363. @end example
  12364. @item
  12365. Specify a custom rule for evolving a randomly generated grid:
  12366. @example
  12367. life=rule=S14/B34
  12368. @end example
  12369. @item
  12370. Full example with slow death effect (mold) using @command{ffplay}:
  12371. @example
  12372. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12373. @end example
  12374. @end itemize
  12375. @anchor{allrgb}
  12376. @anchor{allyuv}
  12377. @anchor{color}
  12378. @anchor{haldclutsrc}
  12379. @anchor{nullsrc}
  12380. @anchor{rgbtestsrc}
  12381. @anchor{smptebars}
  12382. @anchor{smptehdbars}
  12383. @anchor{testsrc}
  12384. @anchor{testsrc2}
  12385. @anchor{yuvtestsrc}
  12386. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12387. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12388. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12389. The @code{color} source provides an uniformly colored input.
  12390. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12391. @ref{haldclut} filter.
  12392. The @code{nullsrc} source returns unprocessed video frames. It is
  12393. mainly useful to be employed in analysis / debugging tools, or as the
  12394. source for filters which ignore the input data.
  12395. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12396. detecting RGB vs BGR issues. You should see a red, green and blue
  12397. stripe from top to bottom.
  12398. The @code{smptebars} source generates a color bars pattern, based on
  12399. the SMPTE Engineering Guideline EG 1-1990.
  12400. The @code{smptehdbars} source generates a color bars pattern, based on
  12401. the SMPTE RP 219-2002.
  12402. The @code{testsrc} source generates a test video pattern, showing a
  12403. color pattern, a scrolling gradient and a timestamp. This is mainly
  12404. intended for testing purposes.
  12405. The @code{testsrc2} source is similar to testsrc, but supports more
  12406. pixel formats instead of just @code{rgb24}. This allows using it as an
  12407. input for other tests without requiring a format conversion.
  12408. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12409. see a y, cb and cr stripe from top to bottom.
  12410. The sources accept the following parameters:
  12411. @table @option
  12412. @item color, c
  12413. Specify the color of the source, only available in the @code{color}
  12414. source. For the syntax of this option, check the "Color" section in the
  12415. ffmpeg-utils manual.
  12416. @item level
  12417. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12418. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12419. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12420. coded on a @code{1/(N*N)} scale.
  12421. @item size, s
  12422. Specify the size of the sourced video. For the syntax of this option, check the
  12423. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12424. The default value is @code{320x240}.
  12425. This option is not available with the @code{haldclutsrc} filter.
  12426. @item rate, r
  12427. Specify the frame rate of the sourced video, as the number of frames
  12428. generated per second. It has to be a string in the format
  12429. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12430. number or a valid video frame rate abbreviation. The default value is
  12431. "25".
  12432. @item sar
  12433. Set the sample aspect ratio of the sourced video.
  12434. @item duration, d
  12435. Set the duration of the sourced video. See
  12436. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12437. for the accepted syntax.
  12438. If not specified, or the expressed duration is negative, the video is
  12439. supposed to be generated forever.
  12440. @item decimals, n
  12441. Set the number of decimals to show in the timestamp, only available in the
  12442. @code{testsrc} source.
  12443. The displayed timestamp value will correspond to the original
  12444. timestamp value multiplied by the power of 10 of the specified
  12445. value. Default value is 0.
  12446. @end table
  12447. For example the following:
  12448. @example
  12449. testsrc=duration=5.3:size=qcif:rate=10
  12450. @end example
  12451. will generate a video with a duration of 5.3 seconds, with size
  12452. 176x144 and a frame rate of 10 frames per second.
  12453. The following graph description will generate a red source
  12454. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12455. frames per second.
  12456. @example
  12457. color=c=red@@0.2:s=qcif:r=10
  12458. @end example
  12459. If the input content is to be ignored, @code{nullsrc} can be used. The
  12460. following command generates noise in the luminance plane by employing
  12461. the @code{geq} filter:
  12462. @example
  12463. nullsrc=s=256x256, geq=random(1)*255:128:128
  12464. @end example
  12465. @subsection Commands
  12466. The @code{color} source supports the following commands:
  12467. @table @option
  12468. @item c, color
  12469. Set the color of the created image. Accepts the same syntax of the
  12470. corresponding @option{color} option.
  12471. @end table
  12472. @c man end VIDEO SOURCES
  12473. @chapter Video Sinks
  12474. @c man begin VIDEO SINKS
  12475. Below is a description of the currently available video sinks.
  12476. @section buffersink
  12477. Buffer video frames, and make them available to the end of the filter
  12478. graph.
  12479. This sink is mainly intended for programmatic use, in particular
  12480. through the interface defined in @file{libavfilter/buffersink.h}
  12481. or the options system.
  12482. It accepts a pointer to an AVBufferSinkContext structure, which
  12483. defines the incoming buffers' formats, to be passed as the opaque
  12484. parameter to @code{avfilter_init_filter} for initialization.
  12485. @section nullsink
  12486. Null video sink: do absolutely nothing with the input video. It is
  12487. mainly useful as a template and for use in analysis / debugging
  12488. tools.
  12489. @c man end VIDEO SINKS
  12490. @chapter Multimedia Filters
  12491. @c man begin MULTIMEDIA FILTERS
  12492. Below is a description of the currently available multimedia filters.
  12493. @section abitscope
  12494. Convert input audio to a video output, displaying the audio bit scope.
  12495. The filter accepts the following options:
  12496. @table @option
  12497. @item rate, r
  12498. Set frame rate, expressed as number of frames per second. Default
  12499. value is "25".
  12500. @item size, s
  12501. Specify the video size for the output. For the syntax of this option, check the
  12502. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12503. Default value is @code{1024x256}.
  12504. @item colors
  12505. Specify list of colors separated by space or by '|' which will be used to
  12506. draw channels. Unrecognized or missing colors will be replaced
  12507. by white color.
  12508. @end table
  12509. @section ahistogram
  12510. Convert input audio to a video output, displaying the volume histogram.
  12511. The filter accepts the following options:
  12512. @table @option
  12513. @item dmode
  12514. Specify how histogram is calculated.
  12515. It accepts the following values:
  12516. @table @samp
  12517. @item single
  12518. Use single histogram for all channels.
  12519. @item separate
  12520. Use separate histogram for each channel.
  12521. @end table
  12522. Default is @code{single}.
  12523. @item rate, r
  12524. Set frame rate, expressed as number of frames per second. Default
  12525. value is "25".
  12526. @item size, s
  12527. Specify the video size for the output. For the syntax of this option, check the
  12528. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12529. Default value is @code{hd720}.
  12530. @item scale
  12531. Set display scale.
  12532. It accepts the following values:
  12533. @table @samp
  12534. @item log
  12535. logarithmic
  12536. @item sqrt
  12537. square root
  12538. @item cbrt
  12539. cubic root
  12540. @item lin
  12541. linear
  12542. @item rlog
  12543. reverse logarithmic
  12544. @end table
  12545. Default is @code{log}.
  12546. @item ascale
  12547. Set amplitude scale.
  12548. It accepts the following values:
  12549. @table @samp
  12550. @item log
  12551. logarithmic
  12552. @item lin
  12553. linear
  12554. @end table
  12555. Default is @code{log}.
  12556. @item acount
  12557. Set how much frames to accumulate in histogram.
  12558. Defauls is 1. Setting this to -1 accumulates all frames.
  12559. @item rheight
  12560. Set histogram ratio of window height.
  12561. @item slide
  12562. Set sonogram sliding.
  12563. It accepts the following values:
  12564. @table @samp
  12565. @item replace
  12566. replace old rows with new ones.
  12567. @item scroll
  12568. scroll from top to bottom.
  12569. @end table
  12570. Default is @code{replace}.
  12571. @end table
  12572. @section aphasemeter
  12573. Convert input audio to a video output, displaying the audio phase.
  12574. The filter accepts the following options:
  12575. @table @option
  12576. @item rate, r
  12577. Set the output frame rate. Default value is @code{25}.
  12578. @item size, s
  12579. Set the video size for the output. For the syntax of this option, check the
  12580. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12581. Default value is @code{800x400}.
  12582. @item rc
  12583. @item gc
  12584. @item bc
  12585. Specify the red, green, blue contrast. Default values are @code{2},
  12586. @code{7} and @code{1}.
  12587. Allowed range is @code{[0, 255]}.
  12588. @item mpc
  12589. Set color which will be used for drawing median phase. If color is
  12590. @code{none} which is default, no median phase value will be drawn.
  12591. @item video
  12592. Enable video output. Default is enabled.
  12593. @end table
  12594. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12595. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12596. The @code{-1} means left and right channels are completely out of phase and
  12597. @code{1} means channels are in phase.
  12598. @section avectorscope
  12599. Convert input audio to a video output, representing the audio vector
  12600. scope.
  12601. The filter is used to measure the difference between channels of stereo
  12602. audio stream. A monoaural signal, consisting of identical left and right
  12603. signal, results in straight vertical line. Any stereo separation is visible
  12604. as a deviation from this line, creating a Lissajous figure.
  12605. If the straight (or deviation from it) but horizontal line appears this
  12606. indicates that the left and right channels are out of phase.
  12607. The filter accepts the following options:
  12608. @table @option
  12609. @item mode, m
  12610. Set the vectorscope mode.
  12611. Available values are:
  12612. @table @samp
  12613. @item lissajous
  12614. Lissajous rotated by 45 degrees.
  12615. @item lissajous_xy
  12616. Same as above but not rotated.
  12617. @item polar
  12618. Shape resembling half of circle.
  12619. @end table
  12620. Default value is @samp{lissajous}.
  12621. @item size, s
  12622. Set the video size for the output. For the syntax of this option, check the
  12623. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12624. Default value is @code{400x400}.
  12625. @item rate, r
  12626. Set the output frame rate. Default value is @code{25}.
  12627. @item rc
  12628. @item gc
  12629. @item bc
  12630. @item ac
  12631. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12632. @code{160}, @code{80} and @code{255}.
  12633. Allowed range is @code{[0, 255]}.
  12634. @item rf
  12635. @item gf
  12636. @item bf
  12637. @item af
  12638. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12639. @code{10}, @code{5} and @code{5}.
  12640. Allowed range is @code{[0, 255]}.
  12641. @item zoom
  12642. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12643. @item draw
  12644. Set the vectorscope drawing mode.
  12645. Available values are:
  12646. @table @samp
  12647. @item dot
  12648. Draw dot for each sample.
  12649. @item line
  12650. Draw line between previous and current sample.
  12651. @end table
  12652. Default value is @samp{dot}.
  12653. @item scale
  12654. Specify amplitude scale of audio samples.
  12655. Available values are:
  12656. @table @samp
  12657. @item lin
  12658. Linear.
  12659. @item sqrt
  12660. Square root.
  12661. @item cbrt
  12662. Cubic root.
  12663. @item log
  12664. Logarithmic.
  12665. @end table
  12666. @end table
  12667. @subsection Examples
  12668. @itemize
  12669. @item
  12670. Complete example using @command{ffplay}:
  12671. @example
  12672. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12673. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12674. @end example
  12675. @end itemize
  12676. @section bench, abench
  12677. Benchmark part of a filtergraph.
  12678. The filter accepts the following options:
  12679. @table @option
  12680. @item action
  12681. Start or stop a timer.
  12682. Available values are:
  12683. @table @samp
  12684. @item start
  12685. Get the current time, set it as frame metadata (using the key
  12686. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12687. @item stop
  12688. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12689. the input frame metadata to get the time difference. Time difference, average,
  12690. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12691. @code{min}) are then printed. The timestamps are expressed in seconds.
  12692. @end table
  12693. @end table
  12694. @subsection Examples
  12695. @itemize
  12696. @item
  12697. Benchmark @ref{selectivecolor} filter:
  12698. @example
  12699. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12700. @end example
  12701. @end itemize
  12702. @section concat
  12703. Concatenate audio and video streams, joining them together one after the
  12704. other.
  12705. The filter works on segments of synchronized video and audio streams. All
  12706. segments must have the same number of streams of each type, and that will
  12707. also be the number of streams at output.
  12708. The filter accepts the following options:
  12709. @table @option
  12710. @item n
  12711. Set the number of segments. Default is 2.
  12712. @item v
  12713. Set the number of output video streams, that is also the number of video
  12714. streams in each segment. Default is 1.
  12715. @item a
  12716. Set the number of output audio streams, that is also the number of audio
  12717. streams in each segment. Default is 0.
  12718. @item unsafe
  12719. Activate unsafe mode: do not fail if segments have a different format.
  12720. @end table
  12721. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12722. @var{a} audio outputs.
  12723. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12724. segment, in the same order as the outputs, then the inputs for the second
  12725. segment, etc.
  12726. Related streams do not always have exactly the same duration, for various
  12727. reasons including codec frame size or sloppy authoring. For that reason,
  12728. related synchronized streams (e.g. a video and its audio track) should be
  12729. concatenated at once. The concat filter will use the duration of the longest
  12730. stream in each segment (except the last one), and if necessary pad shorter
  12731. audio streams with silence.
  12732. For this filter to work correctly, all segments must start at timestamp 0.
  12733. All corresponding streams must have the same parameters in all segments; the
  12734. filtering system will automatically select a common pixel format for video
  12735. streams, and a common sample format, sample rate and channel layout for
  12736. audio streams, but other settings, such as resolution, must be converted
  12737. explicitly by the user.
  12738. Different frame rates are acceptable but will result in variable frame rate
  12739. at output; be sure to configure the output file to handle it.
  12740. @subsection Examples
  12741. @itemize
  12742. @item
  12743. Concatenate an opening, an episode and an ending, all in bilingual version
  12744. (video in stream 0, audio in streams 1 and 2):
  12745. @example
  12746. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12747. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12748. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12749. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12750. @end example
  12751. @item
  12752. Concatenate two parts, handling audio and video separately, using the
  12753. (a)movie sources, and adjusting the resolution:
  12754. @example
  12755. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12756. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12757. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12758. @end example
  12759. Note that a desync will happen at the stitch if the audio and video streams
  12760. do not have exactly the same duration in the first file.
  12761. @end itemize
  12762. @section drawgraph, adrawgraph
  12763. Draw a graph using input video or audio metadata.
  12764. It accepts the following parameters:
  12765. @table @option
  12766. @item m1
  12767. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12768. @item fg1
  12769. Set 1st foreground color expression.
  12770. @item m2
  12771. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12772. @item fg2
  12773. Set 2nd foreground color expression.
  12774. @item m3
  12775. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12776. @item fg3
  12777. Set 3rd foreground color expression.
  12778. @item m4
  12779. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12780. @item fg4
  12781. Set 4th foreground color expression.
  12782. @item min
  12783. Set minimal value of metadata value.
  12784. @item max
  12785. Set maximal value of metadata value.
  12786. @item bg
  12787. Set graph background color. Default is white.
  12788. @item mode
  12789. Set graph mode.
  12790. Available values for mode is:
  12791. @table @samp
  12792. @item bar
  12793. @item dot
  12794. @item line
  12795. @end table
  12796. Default is @code{line}.
  12797. @item slide
  12798. Set slide mode.
  12799. Available values for slide is:
  12800. @table @samp
  12801. @item frame
  12802. Draw new frame when right border is reached.
  12803. @item replace
  12804. Replace old columns with new ones.
  12805. @item scroll
  12806. Scroll from right to left.
  12807. @item rscroll
  12808. Scroll from left to right.
  12809. @item picture
  12810. Draw single picture.
  12811. @end table
  12812. Default is @code{frame}.
  12813. @item size
  12814. Set size of graph video. For the syntax of this option, check the
  12815. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12816. The default value is @code{900x256}.
  12817. The foreground color expressions can use the following variables:
  12818. @table @option
  12819. @item MIN
  12820. Minimal value of metadata value.
  12821. @item MAX
  12822. Maximal value of metadata value.
  12823. @item VAL
  12824. Current metadata key value.
  12825. @end table
  12826. The color is defined as 0xAABBGGRR.
  12827. @end table
  12828. Example using metadata from @ref{signalstats} filter:
  12829. @example
  12830. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12831. @end example
  12832. Example using metadata from @ref{ebur128} filter:
  12833. @example
  12834. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12835. @end example
  12836. @anchor{ebur128}
  12837. @section ebur128
  12838. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12839. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12840. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12841. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12842. The filter also has a video output (see the @var{video} option) with a real
  12843. time graph to observe the loudness evolution. The graphic contains the logged
  12844. message mentioned above, so it is not printed anymore when this option is set,
  12845. unless the verbose logging is set. The main graphing area contains the
  12846. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12847. the momentary loudness (400 milliseconds).
  12848. More information about the Loudness Recommendation EBU R128 on
  12849. @url{http://tech.ebu.ch/loudness}.
  12850. The filter accepts the following options:
  12851. @table @option
  12852. @item video
  12853. Activate the video output. The audio stream is passed unchanged whether this
  12854. option is set or no. The video stream will be the first output stream if
  12855. activated. Default is @code{0}.
  12856. @item size
  12857. Set the video size. This option is for video only. For the syntax of this
  12858. option, check the
  12859. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12860. Default and minimum resolution is @code{640x480}.
  12861. @item meter
  12862. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12863. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12864. other integer value between this range is allowed.
  12865. @item metadata
  12866. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12867. into 100ms output frames, each of them containing various loudness information
  12868. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12869. Default is @code{0}.
  12870. @item framelog
  12871. Force the frame logging level.
  12872. Available values are:
  12873. @table @samp
  12874. @item info
  12875. information logging level
  12876. @item verbose
  12877. verbose logging level
  12878. @end table
  12879. By default, the logging level is set to @var{info}. If the @option{video} or
  12880. the @option{metadata} options are set, it switches to @var{verbose}.
  12881. @item peak
  12882. Set peak mode(s).
  12883. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12884. values are:
  12885. @table @samp
  12886. @item none
  12887. Disable any peak mode (default).
  12888. @item sample
  12889. Enable sample-peak mode.
  12890. Simple peak mode looking for the higher sample value. It logs a message
  12891. for sample-peak (identified by @code{SPK}).
  12892. @item true
  12893. Enable true-peak mode.
  12894. If enabled, the peak lookup is done on an over-sampled version of the input
  12895. stream for better peak accuracy. It logs a message for true-peak.
  12896. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12897. This mode requires a build with @code{libswresample}.
  12898. @end table
  12899. @item dualmono
  12900. Treat mono input files as "dual mono". If a mono file is intended for playback
  12901. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12902. If set to @code{true}, this option will compensate for this effect.
  12903. Multi-channel input files are not affected by this option.
  12904. @item panlaw
  12905. Set a specific pan law to be used for the measurement of dual mono files.
  12906. This parameter is optional, and has a default value of -3.01dB.
  12907. @end table
  12908. @subsection Examples
  12909. @itemize
  12910. @item
  12911. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12912. @example
  12913. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12914. @end example
  12915. @item
  12916. Run an analysis with @command{ffmpeg}:
  12917. @example
  12918. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12919. @end example
  12920. @end itemize
  12921. @section interleave, ainterleave
  12922. Temporally interleave frames from several inputs.
  12923. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12924. These filters read frames from several inputs and send the oldest
  12925. queued frame to the output.
  12926. Input streams must have well defined, monotonically increasing frame
  12927. timestamp values.
  12928. In order to submit one frame to output, these filters need to enqueue
  12929. at least one frame for each input, so they cannot work in case one
  12930. input is not yet terminated and will not receive incoming frames.
  12931. For example consider the case when one input is a @code{select} filter
  12932. which always drops input frames. The @code{interleave} filter will keep
  12933. reading from that input, but it will never be able to send new frames
  12934. to output until the input sends an end-of-stream signal.
  12935. Also, depending on inputs synchronization, the filters will drop
  12936. frames in case one input receives more frames than the other ones, and
  12937. the queue is already filled.
  12938. These filters accept the following options:
  12939. @table @option
  12940. @item nb_inputs, n
  12941. Set the number of different inputs, it is 2 by default.
  12942. @end table
  12943. @subsection Examples
  12944. @itemize
  12945. @item
  12946. Interleave frames belonging to different streams using @command{ffmpeg}:
  12947. @example
  12948. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12949. @end example
  12950. @item
  12951. Add flickering blur effect:
  12952. @example
  12953. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12954. @end example
  12955. @end itemize
  12956. @section metadata, ametadata
  12957. Manipulate frame metadata.
  12958. This filter accepts the following options:
  12959. @table @option
  12960. @item mode
  12961. Set mode of operation of the filter.
  12962. Can be one of the following:
  12963. @table @samp
  12964. @item select
  12965. If both @code{value} and @code{key} is set, select frames
  12966. which have such metadata. If only @code{key} is set, select
  12967. every frame that has such key in metadata.
  12968. @item add
  12969. Add new metadata @code{key} and @code{value}. If key is already available
  12970. do nothing.
  12971. @item modify
  12972. Modify value of already present key.
  12973. @item delete
  12974. If @code{value} is set, delete only keys that have such value.
  12975. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12976. the frame.
  12977. @item print
  12978. Print key and its value if metadata was found. If @code{key} is not set print all
  12979. metadata values available in frame.
  12980. @end table
  12981. @item key
  12982. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12983. @item value
  12984. Set metadata value which will be used. This option is mandatory for
  12985. @code{modify} and @code{add} mode.
  12986. @item function
  12987. Which function to use when comparing metadata value and @code{value}.
  12988. Can be one of following:
  12989. @table @samp
  12990. @item same_str
  12991. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12992. @item starts_with
  12993. Values are interpreted as strings, returns true if metadata value starts with
  12994. the @code{value} option string.
  12995. @item less
  12996. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12997. @item equal
  12998. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12999. @item greater
  13000. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13001. @item expr
  13002. Values are interpreted as floats, returns true if expression from option @code{expr}
  13003. evaluates to true.
  13004. @end table
  13005. @item expr
  13006. Set expression which is used when @code{function} is set to @code{expr}.
  13007. The expression is evaluated through the eval API and can contain the following
  13008. constants:
  13009. @table @option
  13010. @item VALUE1
  13011. Float representation of @code{value} from metadata key.
  13012. @item VALUE2
  13013. Float representation of @code{value} as supplied by user in @code{value} option.
  13014. @end table
  13015. @item file
  13016. If specified in @code{print} mode, output is written to the named file. Instead of
  13017. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13018. for standard output. If @code{file} option is not set, output is written to the log
  13019. with AV_LOG_INFO loglevel.
  13020. @end table
  13021. @subsection Examples
  13022. @itemize
  13023. @item
  13024. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13025. between 0 and 1.
  13026. @example
  13027. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13028. @end example
  13029. @item
  13030. Print silencedetect output to file @file{metadata.txt}.
  13031. @example
  13032. silencedetect,ametadata=mode=print:file=metadata.txt
  13033. @end example
  13034. @item
  13035. Direct all metadata to a pipe with file descriptor 4.
  13036. @example
  13037. metadata=mode=print:file='pipe\:4'
  13038. @end example
  13039. @end itemize
  13040. @section perms, aperms
  13041. Set read/write permissions for the output frames.
  13042. These filters are mainly aimed at developers to test direct path in the
  13043. following filter in the filtergraph.
  13044. The filters accept the following options:
  13045. @table @option
  13046. @item mode
  13047. Select the permissions mode.
  13048. It accepts the following values:
  13049. @table @samp
  13050. @item none
  13051. Do nothing. This is the default.
  13052. @item ro
  13053. Set all the output frames read-only.
  13054. @item rw
  13055. Set all the output frames directly writable.
  13056. @item toggle
  13057. Make the frame read-only if writable, and writable if read-only.
  13058. @item random
  13059. Set each output frame read-only or writable randomly.
  13060. @end table
  13061. @item seed
  13062. Set the seed for the @var{random} mode, must be an integer included between
  13063. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13064. @code{-1}, the filter will try to use a good random seed on a best effort
  13065. basis.
  13066. @end table
  13067. Note: in case of auto-inserted filter between the permission filter and the
  13068. following one, the permission might not be received as expected in that
  13069. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13070. perms/aperms filter can avoid this problem.
  13071. @section realtime, arealtime
  13072. Slow down filtering to match real time approximatively.
  13073. These filters will pause the filtering for a variable amount of time to
  13074. match the output rate with the input timestamps.
  13075. They are similar to the @option{re} option to @code{ffmpeg}.
  13076. They accept the following options:
  13077. @table @option
  13078. @item limit
  13079. Time limit for the pauses. Any pause longer than that will be considered
  13080. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13081. @end table
  13082. @anchor{select}
  13083. @section select, aselect
  13084. Select frames to pass in output.
  13085. This filter accepts the following options:
  13086. @table @option
  13087. @item expr, e
  13088. Set expression, which is evaluated for each input frame.
  13089. If the expression is evaluated to zero, the frame is discarded.
  13090. If the evaluation result is negative or NaN, the frame is sent to the
  13091. first output; otherwise it is sent to the output with index
  13092. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13093. For example a value of @code{1.2} corresponds to the output with index
  13094. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13095. @item outputs, n
  13096. Set the number of outputs. The output to which to send the selected
  13097. frame is based on the result of the evaluation. Default value is 1.
  13098. @end table
  13099. The expression can contain the following constants:
  13100. @table @option
  13101. @item n
  13102. The (sequential) number of the filtered frame, starting from 0.
  13103. @item selected_n
  13104. The (sequential) number of the selected frame, starting from 0.
  13105. @item prev_selected_n
  13106. The sequential number of the last selected frame. It's NAN if undefined.
  13107. @item TB
  13108. The timebase of the input timestamps.
  13109. @item pts
  13110. The PTS (Presentation TimeStamp) of the filtered video frame,
  13111. expressed in @var{TB} units. It's NAN if undefined.
  13112. @item t
  13113. The PTS of the filtered video frame,
  13114. expressed in seconds. It's NAN if undefined.
  13115. @item prev_pts
  13116. The PTS of the previously filtered video frame. It's NAN if undefined.
  13117. @item prev_selected_pts
  13118. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13119. @item prev_selected_t
  13120. The PTS of the last previously selected video frame. It's NAN if undefined.
  13121. @item start_pts
  13122. The PTS of the first video frame in the video. It's NAN if undefined.
  13123. @item start_t
  13124. The time of the first video frame in the video. It's NAN if undefined.
  13125. @item pict_type @emph{(video only)}
  13126. The type of the filtered frame. It can assume one of the following
  13127. values:
  13128. @table @option
  13129. @item I
  13130. @item P
  13131. @item B
  13132. @item S
  13133. @item SI
  13134. @item SP
  13135. @item BI
  13136. @end table
  13137. @item interlace_type @emph{(video only)}
  13138. The frame interlace type. It can assume one of the following values:
  13139. @table @option
  13140. @item PROGRESSIVE
  13141. The frame is progressive (not interlaced).
  13142. @item TOPFIRST
  13143. The frame is top-field-first.
  13144. @item BOTTOMFIRST
  13145. The frame is bottom-field-first.
  13146. @end table
  13147. @item consumed_sample_n @emph{(audio only)}
  13148. the number of selected samples before the current frame
  13149. @item samples_n @emph{(audio only)}
  13150. the number of samples in the current frame
  13151. @item sample_rate @emph{(audio only)}
  13152. the input sample rate
  13153. @item key
  13154. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13155. @item pos
  13156. the position in the file of the filtered frame, -1 if the information
  13157. is not available (e.g. for synthetic video)
  13158. @item scene @emph{(video only)}
  13159. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13160. probability for the current frame to introduce a new scene, while a higher
  13161. value means the current frame is more likely to be one (see the example below)
  13162. @item concatdec_select
  13163. The concat demuxer can select only part of a concat input file by setting an
  13164. inpoint and an outpoint, but the output packets may not be entirely contained
  13165. in the selected interval. By using this variable, it is possible to skip frames
  13166. generated by the concat demuxer which are not exactly contained in the selected
  13167. interval.
  13168. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13169. and the @var{lavf.concat.duration} packet metadata values which are also
  13170. present in the decoded frames.
  13171. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13172. start_time and either the duration metadata is missing or the frame pts is less
  13173. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13174. missing.
  13175. That basically means that an input frame is selected if its pts is within the
  13176. interval set by the concat demuxer.
  13177. @end table
  13178. The default value of the select expression is "1".
  13179. @subsection Examples
  13180. @itemize
  13181. @item
  13182. Select all frames in input:
  13183. @example
  13184. select
  13185. @end example
  13186. The example above is the same as:
  13187. @example
  13188. select=1
  13189. @end example
  13190. @item
  13191. Skip all frames:
  13192. @example
  13193. select=0
  13194. @end example
  13195. @item
  13196. Select only I-frames:
  13197. @example
  13198. select='eq(pict_type\,I)'
  13199. @end example
  13200. @item
  13201. Select one frame every 100:
  13202. @example
  13203. select='not(mod(n\,100))'
  13204. @end example
  13205. @item
  13206. Select only frames contained in the 10-20 time interval:
  13207. @example
  13208. select=between(t\,10\,20)
  13209. @end example
  13210. @item
  13211. Select only I-frames contained in the 10-20 time interval:
  13212. @example
  13213. select=between(t\,10\,20)*eq(pict_type\,I)
  13214. @end example
  13215. @item
  13216. Select frames with a minimum distance of 10 seconds:
  13217. @example
  13218. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13219. @end example
  13220. @item
  13221. Use aselect to select only audio frames with samples number > 100:
  13222. @example
  13223. aselect='gt(samples_n\,100)'
  13224. @end example
  13225. @item
  13226. Create a mosaic of the first scenes:
  13227. @example
  13228. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13229. @end example
  13230. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13231. choice.
  13232. @item
  13233. Send even and odd frames to separate outputs, and compose them:
  13234. @example
  13235. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13236. @end example
  13237. @item
  13238. Select useful frames from an ffconcat file which is using inpoints and
  13239. outpoints but where the source files are not intra frame only.
  13240. @example
  13241. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13242. @end example
  13243. @end itemize
  13244. @section sendcmd, asendcmd
  13245. Send commands to filters in the filtergraph.
  13246. These filters read commands to be sent to other filters in the
  13247. filtergraph.
  13248. @code{sendcmd} must be inserted between two video filters,
  13249. @code{asendcmd} must be inserted between two audio filters, but apart
  13250. from that they act the same way.
  13251. The specification of commands can be provided in the filter arguments
  13252. with the @var{commands} option, or in a file specified by the
  13253. @var{filename} option.
  13254. These filters accept the following options:
  13255. @table @option
  13256. @item commands, c
  13257. Set the commands to be read and sent to the other filters.
  13258. @item filename, f
  13259. Set the filename of the commands to be read and sent to the other
  13260. filters.
  13261. @end table
  13262. @subsection Commands syntax
  13263. A commands description consists of a sequence of interval
  13264. specifications, comprising a list of commands to be executed when a
  13265. particular event related to that interval occurs. The occurring event
  13266. is typically the current frame time entering or leaving a given time
  13267. interval.
  13268. An interval is specified by the following syntax:
  13269. @example
  13270. @var{START}[-@var{END}] @var{COMMANDS};
  13271. @end example
  13272. The time interval is specified by the @var{START} and @var{END} times.
  13273. @var{END} is optional and defaults to the maximum time.
  13274. The current frame time is considered within the specified interval if
  13275. it is included in the interval [@var{START}, @var{END}), that is when
  13276. the time is greater or equal to @var{START} and is lesser than
  13277. @var{END}.
  13278. @var{COMMANDS} consists of a sequence of one or more command
  13279. specifications, separated by ",", relating to that interval. The
  13280. syntax of a command specification is given by:
  13281. @example
  13282. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13283. @end example
  13284. @var{FLAGS} is optional and specifies the type of events relating to
  13285. the time interval which enable sending the specified command, and must
  13286. be a non-null sequence of identifier flags separated by "+" or "|" and
  13287. enclosed between "[" and "]".
  13288. The following flags are recognized:
  13289. @table @option
  13290. @item enter
  13291. The command is sent when the current frame timestamp enters the
  13292. specified interval. In other words, the command is sent when the
  13293. previous frame timestamp was not in the given interval, and the
  13294. current is.
  13295. @item leave
  13296. The command is sent when the current frame timestamp leaves the
  13297. specified interval. In other words, the command is sent when the
  13298. previous frame timestamp was in the given interval, and the
  13299. current is not.
  13300. @end table
  13301. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13302. assumed.
  13303. @var{TARGET} specifies the target of the command, usually the name of
  13304. the filter class or a specific filter instance name.
  13305. @var{COMMAND} specifies the name of the command for the target filter.
  13306. @var{ARG} is optional and specifies the optional list of argument for
  13307. the given @var{COMMAND}.
  13308. Between one interval specification and another, whitespaces, or
  13309. sequences of characters starting with @code{#} until the end of line,
  13310. are ignored and can be used to annotate comments.
  13311. A simplified BNF description of the commands specification syntax
  13312. follows:
  13313. @example
  13314. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13315. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13316. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13317. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13318. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13319. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13320. @end example
  13321. @subsection Examples
  13322. @itemize
  13323. @item
  13324. Specify audio tempo change at second 4:
  13325. @example
  13326. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13327. @end example
  13328. @item
  13329. Target a specific filter instance:
  13330. @example
  13331. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13332. @end example
  13333. @item
  13334. Specify a list of drawtext and hue commands in a file.
  13335. @example
  13336. # show text in the interval 5-10
  13337. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13338. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13339. # desaturate the image in the interval 15-20
  13340. 15.0-20.0 [enter] hue s 0,
  13341. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13342. [leave] hue s 1,
  13343. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13344. # apply an exponential saturation fade-out effect, starting from time 25
  13345. 25 [enter] hue s exp(25-t)
  13346. @end example
  13347. A filtergraph allowing to read and process the above command list
  13348. stored in a file @file{test.cmd}, can be specified with:
  13349. @example
  13350. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13351. @end example
  13352. @end itemize
  13353. @anchor{setpts}
  13354. @section setpts, asetpts
  13355. Change the PTS (presentation timestamp) of the input frames.
  13356. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13357. This filter accepts the following options:
  13358. @table @option
  13359. @item expr
  13360. The expression which is evaluated for each frame to construct its timestamp.
  13361. @end table
  13362. The expression is evaluated through the eval API and can contain the following
  13363. constants:
  13364. @table @option
  13365. @item FRAME_RATE
  13366. frame rate, only defined for constant frame-rate video
  13367. @item PTS
  13368. The presentation timestamp in input
  13369. @item N
  13370. The count of the input frame for video or the number of consumed samples,
  13371. not including the current frame for audio, starting from 0.
  13372. @item NB_CONSUMED_SAMPLES
  13373. The number of consumed samples, not including the current frame (only
  13374. audio)
  13375. @item NB_SAMPLES, S
  13376. The number of samples in the current frame (only audio)
  13377. @item SAMPLE_RATE, SR
  13378. The audio sample rate.
  13379. @item STARTPTS
  13380. The PTS of the first frame.
  13381. @item STARTT
  13382. the time in seconds of the first frame
  13383. @item INTERLACED
  13384. State whether the current frame is interlaced.
  13385. @item T
  13386. the time in seconds of the current frame
  13387. @item POS
  13388. original position in the file of the frame, or undefined if undefined
  13389. for the current frame
  13390. @item PREV_INPTS
  13391. The previous input PTS.
  13392. @item PREV_INT
  13393. previous input time in seconds
  13394. @item PREV_OUTPTS
  13395. The previous output PTS.
  13396. @item PREV_OUTT
  13397. previous output time in seconds
  13398. @item RTCTIME
  13399. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13400. instead.
  13401. @item RTCSTART
  13402. The wallclock (RTC) time at the start of the movie in microseconds.
  13403. @item TB
  13404. The timebase of the input timestamps.
  13405. @end table
  13406. @subsection Examples
  13407. @itemize
  13408. @item
  13409. Start counting PTS from zero
  13410. @example
  13411. setpts=PTS-STARTPTS
  13412. @end example
  13413. @item
  13414. Apply fast motion effect:
  13415. @example
  13416. setpts=0.5*PTS
  13417. @end example
  13418. @item
  13419. Apply slow motion effect:
  13420. @example
  13421. setpts=2.0*PTS
  13422. @end example
  13423. @item
  13424. Set fixed rate of 25 frames per second:
  13425. @example
  13426. setpts=N/(25*TB)
  13427. @end example
  13428. @item
  13429. Set fixed rate 25 fps with some jitter:
  13430. @example
  13431. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13432. @end example
  13433. @item
  13434. Apply an offset of 10 seconds to the input PTS:
  13435. @example
  13436. setpts=PTS+10/TB
  13437. @end example
  13438. @item
  13439. Generate timestamps from a "live source" and rebase onto the current timebase:
  13440. @example
  13441. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13442. @end example
  13443. @item
  13444. Generate timestamps by counting samples:
  13445. @example
  13446. asetpts=N/SR/TB
  13447. @end example
  13448. @end itemize
  13449. @section settb, asettb
  13450. Set the timebase to use for the output frames timestamps.
  13451. It is mainly useful for testing timebase configuration.
  13452. It accepts the following parameters:
  13453. @table @option
  13454. @item expr, tb
  13455. The expression which is evaluated into the output timebase.
  13456. @end table
  13457. The value for @option{tb} is an arithmetic expression representing a
  13458. rational. The expression can contain the constants "AVTB" (the default
  13459. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13460. audio only). Default value is "intb".
  13461. @subsection Examples
  13462. @itemize
  13463. @item
  13464. Set the timebase to 1/25:
  13465. @example
  13466. settb=expr=1/25
  13467. @end example
  13468. @item
  13469. Set the timebase to 1/10:
  13470. @example
  13471. settb=expr=0.1
  13472. @end example
  13473. @item
  13474. Set the timebase to 1001/1000:
  13475. @example
  13476. settb=1+0.001
  13477. @end example
  13478. @item
  13479. Set the timebase to 2*intb:
  13480. @example
  13481. settb=2*intb
  13482. @end example
  13483. @item
  13484. Set the default timebase value:
  13485. @example
  13486. settb=AVTB
  13487. @end example
  13488. @end itemize
  13489. @section showcqt
  13490. Convert input audio to a video output representing frequency spectrum
  13491. logarithmically using Brown-Puckette constant Q transform algorithm with
  13492. direct frequency domain coefficient calculation (but the transform itself
  13493. is not really constant Q, instead the Q factor is actually variable/clamped),
  13494. with musical tone scale, from E0 to D#10.
  13495. The filter accepts the following options:
  13496. @table @option
  13497. @item size, s
  13498. Specify the video size for the output. It must be even. For the syntax of this option,
  13499. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13500. Default value is @code{1920x1080}.
  13501. @item fps, rate, r
  13502. Set the output frame rate. Default value is @code{25}.
  13503. @item bar_h
  13504. Set the bargraph height. It must be even. Default value is @code{-1} which
  13505. computes the bargraph height automatically.
  13506. @item axis_h
  13507. Set the axis height. It must be even. Default value is @code{-1} which computes
  13508. the axis height automatically.
  13509. @item sono_h
  13510. Set the sonogram height. It must be even. Default value is @code{-1} which
  13511. computes the sonogram height automatically.
  13512. @item fullhd
  13513. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13514. instead. Default value is @code{1}.
  13515. @item sono_v, volume
  13516. Specify the sonogram volume expression. It can contain variables:
  13517. @table @option
  13518. @item bar_v
  13519. the @var{bar_v} evaluated expression
  13520. @item frequency, freq, f
  13521. the frequency where it is evaluated
  13522. @item timeclamp, tc
  13523. the value of @var{timeclamp} option
  13524. @end table
  13525. and functions:
  13526. @table @option
  13527. @item a_weighting(f)
  13528. A-weighting of equal loudness
  13529. @item b_weighting(f)
  13530. B-weighting of equal loudness
  13531. @item c_weighting(f)
  13532. C-weighting of equal loudness.
  13533. @end table
  13534. Default value is @code{16}.
  13535. @item bar_v, volume2
  13536. Specify the bargraph volume expression. It can contain variables:
  13537. @table @option
  13538. @item sono_v
  13539. the @var{sono_v} evaluated expression
  13540. @item frequency, freq, f
  13541. the frequency where it is evaluated
  13542. @item timeclamp, tc
  13543. the value of @var{timeclamp} option
  13544. @end table
  13545. and functions:
  13546. @table @option
  13547. @item a_weighting(f)
  13548. A-weighting of equal loudness
  13549. @item b_weighting(f)
  13550. B-weighting of equal loudness
  13551. @item c_weighting(f)
  13552. C-weighting of equal loudness.
  13553. @end table
  13554. Default value is @code{sono_v}.
  13555. @item sono_g, gamma
  13556. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13557. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13558. Acceptable range is @code{[1, 7]}.
  13559. @item bar_g, gamma2
  13560. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13561. @code{[1, 7]}.
  13562. @item bar_t
  13563. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13564. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13565. @item timeclamp, tc
  13566. Specify the transform timeclamp. At low frequency, there is trade-off between
  13567. accuracy in time domain and frequency domain. If timeclamp is lower,
  13568. event in time domain is represented more accurately (such as fast bass drum),
  13569. otherwise event in frequency domain is represented more accurately
  13570. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13571. @item attack
  13572. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13573. limits future samples by applying asymmetric windowing in time domain, useful
  13574. when low latency is required. Accepted range is @code{[0, 1]}.
  13575. @item basefreq
  13576. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13577. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13578. @item endfreq
  13579. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13580. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13581. @item coeffclamp
  13582. This option is deprecated and ignored.
  13583. @item tlength
  13584. Specify the transform length in time domain. Use this option to control accuracy
  13585. trade-off between time domain and frequency domain at every frequency sample.
  13586. It can contain variables:
  13587. @table @option
  13588. @item frequency, freq, f
  13589. the frequency where it is evaluated
  13590. @item timeclamp, tc
  13591. the value of @var{timeclamp} option.
  13592. @end table
  13593. Default value is @code{384*tc/(384+tc*f)}.
  13594. @item count
  13595. Specify the transform count for every video frame. Default value is @code{6}.
  13596. Acceptable range is @code{[1, 30]}.
  13597. @item fcount
  13598. Specify the transform count for every single pixel. Default value is @code{0},
  13599. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13600. @item fontfile
  13601. Specify font file for use with freetype to draw the axis. If not specified,
  13602. use embedded font. Note that drawing with font file or embedded font is not
  13603. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13604. option instead.
  13605. @item font
  13606. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13607. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13608. @item fontcolor
  13609. Specify font color expression. This is arithmetic expression that should return
  13610. integer value 0xRRGGBB. It can contain variables:
  13611. @table @option
  13612. @item frequency, freq, f
  13613. the frequency where it is evaluated
  13614. @item timeclamp, tc
  13615. the value of @var{timeclamp} option
  13616. @end table
  13617. and functions:
  13618. @table @option
  13619. @item midi(f)
  13620. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13621. @item r(x), g(x), b(x)
  13622. red, green, and blue value of intensity x.
  13623. @end table
  13624. Default value is @code{st(0, (midi(f)-59.5)/12);
  13625. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13626. r(1-ld(1)) + b(ld(1))}.
  13627. @item axisfile
  13628. Specify image file to draw the axis. This option override @var{fontfile} and
  13629. @var{fontcolor} option.
  13630. @item axis, text
  13631. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13632. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13633. Default value is @code{1}.
  13634. @item csp
  13635. Set colorspace. The accepted values are:
  13636. @table @samp
  13637. @item unspecified
  13638. Unspecified (default)
  13639. @item bt709
  13640. BT.709
  13641. @item fcc
  13642. FCC
  13643. @item bt470bg
  13644. BT.470BG or BT.601-6 625
  13645. @item smpte170m
  13646. SMPTE-170M or BT.601-6 525
  13647. @item smpte240m
  13648. SMPTE-240M
  13649. @item bt2020ncl
  13650. BT.2020 with non-constant luminance
  13651. @end table
  13652. @item cscheme
  13653. Set spectrogram color scheme. This is list of floating point values with format
  13654. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13655. The default is @code{1|0.5|0|0|0.5|1}.
  13656. @end table
  13657. @subsection Examples
  13658. @itemize
  13659. @item
  13660. Playing audio while showing the spectrum:
  13661. @example
  13662. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13663. @end example
  13664. @item
  13665. Same as above, but with frame rate 30 fps:
  13666. @example
  13667. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13668. @end example
  13669. @item
  13670. Playing at 1280x720:
  13671. @example
  13672. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13673. @end example
  13674. @item
  13675. Disable sonogram display:
  13676. @example
  13677. sono_h=0
  13678. @end example
  13679. @item
  13680. A1 and its harmonics: A1, A2, (near)E3, A3:
  13681. @example
  13682. 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),
  13683. asplit[a][out1]; [a] showcqt [out0]'
  13684. @end example
  13685. @item
  13686. Same as above, but with more accuracy in frequency domain:
  13687. @example
  13688. 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),
  13689. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13690. @end example
  13691. @item
  13692. Custom volume:
  13693. @example
  13694. bar_v=10:sono_v=bar_v*a_weighting(f)
  13695. @end example
  13696. @item
  13697. Custom gamma, now spectrum is linear to the amplitude.
  13698. @example
  13699. bar_g=2:sono_g=2
  13700. @end example
  13701. @item
  13702. Custom tlength equation:
  13703. @example
  13704. 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)))'
  13705. @end example
  13706. @item
  13707. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13708. @example
  13709. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13710. @end example
  13711. @item
  13712. Custom font using fontconfig:
  13713. @example
  13714. font='Courier New,Monospace,mono|bold'
  13715. @end example
  13716. @item
  13717. Custom frequency range with custom axis using image file:
  13718. @example
  13719. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13720. @end example
  13721. @end itemize
  13722. @section showfreqs
  13723. Convert input audio to video output representing the audio power spectrum.
  13724. Audio amplitude is on Y-axis while frequency is on X-axis.
  13725. The filter accepts the following options:
  13726. @table @option
  13727. @item size, s
  13728. Specify size of video. For the syntax of this option, check the
  13729. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13730. Default is @code{1024x512}.
  13731. @item mode
  13732. Set display mode.
  13733. This set how each frequency bin will be represented.
  13734. It accepts the following values:
  13735. @table @samp
  13736. @item line
  13737. @item bar
  13738. @item dot
  13739. @end table
  13740. Default is @code{bar}.
  13741. @item ascale
  13742. Set amplitude scale.
  13743. It accepts the following values:
  13744. @table @samp
  13745. @item lin
  13746. Linear scale.
  13747. @item sqrt
  13748. Square root scale.
  13749. @item cbrt
  13750. Cubic root scale.
  13751. @item log
  13752. Logarithmic scale.
  13753. @end table
  13754. Default is @code{log}.
  13755. @item fscale
  13756. Set frequency scale.
  13757. It accepts the following values:
  13758. @table @samp
  13759. @item lin
  13760. Linear scale.
  13761. @item log
  13762. Logarithmic scale.
  13763. @item rlog
  13764. Reverse logarithmic scale.
  13765. @end table
  13766. Default is @code{lin}.
  13767. @item win_size
  13768. Set window size.
  13769. It accepts the following values:
  13770. @table @samp
  13771. @item w16
  13772. @item w32
  13773. @item w64
  13774. @item w128
  13775. @item w256
  13776. @item w512
  13777. @item w1024
  13778. @item w2048
  13779. @item w4096
  13780. @item w8192
  13781. @item w16384
  13782. @item w32768
  13783. @item w65536
  13784. @end table
  13785. Default is @code{w2048}
  13786. @item win_func
  13787. Set windowing function.
  13788. It accepts the following values:
  13789. @table @samp
  13790. @item rect
  13791. @item bartlett
  13792. @item hanning
  13793. @item hamming
  13794. @item blackman
  13795. @item welch
  13796. @item flattop
  13797. @item bharris
  13798. @item bnuttall
  13799. @item bhann
  13800. @item sine
  13801. @item nuttall
  13802. @item lanczos
  13803. @item gauss
  13804. @item tukey
  13805. @item dolph
  13806. @item cauchy
  13807. @item parzen
  13808. @item poisson
  13809. @end table
  13810. Default is @code{hanning}.
  13811. @item overlap
  13812. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13813. which means optimal overlap for selected window function will be picked.
  13814. @item averaging
  13815. Set time averaging. Setting this to 0 will display current maximal peaks.
  13816. Default is @code{1}, which means time averaging is disabled.
  13817. @item colors
  13818. Specify list of colors separated by space or by '|' which will be used to
  13819. draw channel frequencies. Unrecognized or missing colors will be replaced
  13820. by white color.
  13821. @item cmode
  13822. Set channel display mode.
  13823. It accepts the following values:
  13824. @table @samp
  13825. @item combined
  13826. @item separate
  13827. @end table
  13828. Default is @code{combined}.
  13829. @item minamp
  13830. Set minimum amplitude used in @code{log} amplitude scaler.
  13831. @end table
  13832. @anchor{showspectrum}
  13833. @section showspectrum
  13834. Convert input audio to a video output, representing the audio frequency
  13835. spectrum.
  13836. The filter accepts the following options:
  13837. @table @option
  13838. @item size, s
  13839. Specify the video size for the output. For the syntax of this option, check the
  13840. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13841. Default value is @code{640x512}.
  13842. @item slide
  13843. Specify how the spectrum should slide along the window.
  13844. It accepts the following values:
  13845. @table @samp
  13846. @item replace
  13847. the samples start again on the left when they reach the right
  13848. @item scroll
  13849. the samples scroll from right to left
  13850. @item fullframe
  13851. frames are only produced when the samples reach the right
  13852. @item rscroll
  13853. the samples scroll from left to right
  13854. @end table
  13855. Default value is @code{replace}.
  13856. @item mode
  13857. Specify display mode.
  13858. It accepts the following values:
  13859. @table @samp
  13860. @item combined
  13861. all channels are displayed in the same row
  13862. @item separate
  13863. all channels are displayed in separate rows
  13864. @end table
  13865. Default value is @samp{combined}.
  13866. @item color
  13867. Specify display color mode.
  13868. It accepts the following values:
  13869. @table @samp
  13870. @item channel
  13871. each channel is displayed in a separate color
  13872. @item intensity
  13873. each channel is displayed using the same color scheme
  13874. @item rainbow
  13875. each channel is displayed using the rainbow color scheme
  13876. @item moreland
  13877. each channel is displayed using the moreland color scheme
  13878. @item nebulae
  13879. each channel is displayed using the nebulae color scheme
  13880. @item fire
  13881. each channel is displayed using the fire color scheme
  13882. @item fiery
  13883. each channel is displayed using the fiery color scheme
  13884. @item fruit
  13885. each channel is displayed using the fruit color scheme
  13886. @item cool
  13887. each channel is displayed using the cool color scheme
  13888. @end table
  13889. Default value is @samp{channel}.
  13890. @item scale
  13891. Specify scale used for calculating intensity color values.
  13892. It accepts the following values:
  13893. @table @samp
  13894. @item lin
  13895. linear
  13896. @item sqrt
  13897. square root, default
  13898. @item cbrt
  13899. cubic root
  13900. @item log
  13901. logarithmic
  13902. @item 4thrt
  13903. 4th root
  13904. @item 5thrt
  13905. 5th root
  13906. @end table
  13907. Default value is @samp{sqrt}.
  13908. @item saturation
  13909. Set saturation modifier for displayed colors. Negative values provide
  13910. alternative color scheme. @code{0} is no saturation at all.
  13911. Saturation must be in [-10.0, 10.0] range.
  13912. Default value is @code{1}.
  13913. @item win_func
  13914. Set window function.
  13915. It accepts the following values:
  13916. @table @samp
  13917. @item rect
  13918. @item bartlett
  13919. @item hann
  13920. @item hanning
  13921. @item hamming
  13922. @item blackman
  13923. @item welch
  13924. @item flattop
  13925. @item bharris
  13926. @item bnuttall
  13927. @item bhann
  13928. @item sine
  13929. @item nuttall
  13930. @item lanczos
  13931. @item gauss
  13932. @item tukey
  13933. @item dolph
  13934. @item cauchy
  13935. @item parzen
  13936. @item poisson
  13937. @end table
  13938. Default value is @code{hann}.
  13939. @item orientation
  13940. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13941. @code{horizontal}. Default is @code{vertical}.
  13942. @item overlap
  13943. Set ratio of overlap window. Default value is @code{0}.
  13944. When value is @code{1} overlap is set to recommended size for specific
  13945. window function currently used.
  13946. @item gain
  13947. Set scale gain for calculating intensity color values.
  13948. Default value is @code{1}.
  13949. @item data
  13950. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13951. @item rotation
  13952. Set color rotation, must be in [-1.0, 1.0] range.
  13953. Default value is @code{0}.
  13954. @end table
  13955. The usage is very similar to the showwaves filter; see the examples in that
  13956. section.
  13957. @subsection Examples
  13958. @itemize
  13959. @item
  13960. Large window with logarithmic color scaling:
  13961. @example
  13962. showspectrum=s=1280x480:scale=log
  13963. @end example
  13964. @item
  13965. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13966. @example
  13967. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13968. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13969. @end example
  13970. @end itemize
  13971. @section showspectrumpic
  13972. Convert input audio to a single video frame, representing the audio frequency
  13973. spectrum.
  13974. The filter accepts the following options:
  13975. @table @option
  13976. @item size, s
  13977. Specify the video size for the output. For the syntax of this option, check the
  13978. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13979. Default value is @code{4096x2048}.
  13980. @item mode
  13981. Specify display mode.
  13982. It accepts the following values:
  13983. @table @samp
  13984. @item combined
  13985. all channels are displayed in the same row
  13986. @item separate
  13987. all channels are displayed in separate rows
  13988. @end table
  13989. Default value is @samp{combined}.
  13990. @item color
  13991. Specify display color mode.
  13992. It accepts the following values:
  13993. @table @samp
  13994. @item channel
  13995. each channel is displayed in a separate color
  13996. @item intensity
  13997. each channel is displayed using the same color scheme
  13998. @item rainbow
  13999. each channel is displayed using the rainbow color scheme
  14000. @item moreland
  14001. each channel is displayed using the moreland color scheme
  14002. @item nebulae
  14003. each channel is displayed using the nebulae color scheme
  14004. @item fire
  14005. each channel is displayed using the fire color scheme
  14006. @item fiery
  14007. each channel is displayed using the fiery color scheme
  14008. @item fruit
  14009. each channel is displayed using the fruit color scheme
  14010. @item cool
  14011. each channel is displayed using the cool color scheme
  14012. @end table
  14013. Default value is @samp{intensity}.
  14014. @item scale
  14015. Specify scale used for calculating intensity color values.
  14016. It accepts the following values:
  14017. @table @samp
  14018. @item lin
  14019. linear
  14020. @item sqrt
  14021. square root, default
  14022. @item cbrt
  14023. cubic root
  14024. @item log
  14025. logarithmic
  14026. @item 4thrt
  14027. 4th root
  14028. @item 5thrt
  14029. 5th root
  14030. @end table
  14031. Default value is @samp{log}.
  14032. @item saturation
  14033. Set saturation modifier for displayed colors. Negative values provide
  14034. alternative color scheme. @code{0} is no saturation at all.
  14035. Saturation must be in [-10.0, 10.0] range.
  14036. Default value is @code{1}.
  14037. @item win_func
  14038. Set window function.
  14039. It accepts the following values:
  14040. @table @samp
  14041. @item rect
  14042. @item bartlett
  14043. @item hann
  14044. @item hanning
  14045. @item hamming
  14046. @item blackman
  14047. @item welch
  14048. @item flattop
  14049. @item bharris
  14050. @item bnuttall
  14051. @item bhann
  14052. @item sine
  14053. @item nuttall
  14054. @item lanczos
  14055. @item gauss
  14056. @item tukey
  14057. @item dolph
  14058. @item cauchy
  14059. @item parzen
  14060. @item poisson
  14061. @end table
  14062. Default value is @code{hann}.
  14063. @item orientation
  14064. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14065. @code{horizontal}. Default is @code{vertical}.
  14066. @item gain
  14067. Set scale gain for calculating intensity color values.
  14068. Default value is @code{1}.
  14069. @item legend
  14070. Draw time and frequency axes and legends. Default is enabled.
  14071. @item rotation
  14072. Set color rotation, must be in [-1.0, 1.0] range.
  14073. Default value is @code{0}.
  14074. @end table
  14075. @subsection Examples
  14076. @itemize
  14077. @item
  14078. Extract an audio spectrogram of a whole audio track
  14079. in a 1024x1024 picture using @command{ffmpeg}:
  14080. @example
  14081. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14082. @end example
  14083. @end itemize
  14084. @section showvolume
  14085. Convert input audio volume to a video output.
  14086. The filter accepts the following options:
  14087. @table @option
  14088. @item rate, r
  14089. Set video rate.
  14090. @item b
  14091. Set border width, allowed range is [0, 5]. Default is 1.
  14092. @item w
  14093. Set channel width, allowed range is [80, 8192]. Default is 400.
  14094. @item h
  14095. Set channel height, allowed range is [1, 900]. Default is 20.
  14096. @item f
  14097. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14098. @item c
  14099. Set volume color expression.
  14100. The expression can use the following variables:
  14101. @table @option
  14102. @item VOLUME
  14103. Current max volume of channel in dB.
  14104. @item PEAK
  14105. Current peak.
  14106. @item CHANNEL
  14107. Current channel number, starting from 0.
  14108. @end table
  14109. @item t
  14110. If set, displays channel names. Default is enabled.
  14111. @item v
  14112. If set, displays volume values. Default is enabled.
  14113. @item o
  14114. Set orientation, can be @code{horizontal} or @code{vertical},
  14115. default is @code{horizontal}.
  14116. @item s
  14117. Set step size, allowed range s [0, 5]. Default is 0, which means
  14118. step is disabled.
  14119. @end table
  14120. @section showwaves
  14121. Convert input audio to a video output, representing the samples waves.
  14122. The filter accepts the following options:
  14123. @table @option
  14124. @item size, s
  14125. Specify the video size for the output. For the syntax of this option, check the
  14126. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14127. Default value is @code{600x240}.
  14128. @item mode
  14129. Set display mode.
  14130. Available values are:
  14131. @table @samp
  14132. @item point
  14133. Draw a point for each sample.
  14134. @item line
  14135. Draw a vertical line for each sample.
  14136. @item p2p
  14137. Draw a point for each sample and a line between them.
  14138. @item cline
  14139. Draw a centered vertical line for each sample.
  14140. @end table
  14141. Default value is @code{point}.
  14142. @item n
  14143. Set the number of samples which are printed on the same column. A
  14144. larger value will decrease the frame rate. Must be a positive
  14145. integer. This option can be set only if the value for @var{rate}
  14146. is not explicitly specified.
  14147. @item rate, r
  14148. Set the (approximate) output frame rate. This is done by setting the
  14149. option @var{n}. Default value is "25".
  14150. @item split_channels
  14151. Set if channels should be drawn separately or overlap. Default value is 0.
  14152. @item colors
  14153. Set colors separated by '|' which are going to be used for drawing of each channel.
  14154. @item scale
  14155. Set amplitude scale.
  14156. Available values are:
  14157. @table @samp
  14158. @item lin
  14159. Linear.
  14160. @item log
  14161. Logarithmic.
  14162. @item sqrt
  14163. Square root.
  14164. @item cbrt
  14165. Cubic root.
  14166. @end table
  14167. Default is linear.
  14168. @end table
  14169. @subsection Examples
  14170. @itemize
  14171. @item
  14172. Output the input file audio and the corresponding video representation
  14173. at the same time:
  14174. @example
  14175. amovie=a.mp3,asplit[out0],showwaves[out1]
  14176. @end example
  14177. @item
  14178. Create a synthetic signal and show it with showwaves, forcing a
  14179. frame rate of 30 frames per second:
  14180. @example
  14181. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14182. @end example
  14183. @end itemize
  14184. @section showwavespic
  14185. Convert input audio to a single video frame, representing the samples waves.
  14186. The filter accepts the following options:
  14187. @table @option
  14188. @item size, s
  14189. Specify the video size for the output. For the syntax of this option, check the
  14190. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14191. Default value is @code{600x240}.
  14192. @item split_channels
  14193. Set if channels should be drawn separately or overlap. Default value is 0.
  14194. @item colors
  14195. Set colors separated by '|' which are going to be used for drawing of each channel.
  14196. @item scale
  14197. Set amplitude scale.
  14198. Available values are:
  14199. @table @samp
  14200. @item lin
  14201. Linear.
  14202. @item log
  14203. Logarithmic.
  14204. @item sqrt
  14205. Square root.
  14206. @item cbrt
  14207. Cubic root.
  14208. @end table
  14209. Default is linear.
  14210. @end table
  14211. @subsection Examples
  14212. @itemize
  14213. @item
  14214. Extract a channel split representation of the wave form of a whole audio track
  14215. in a 1024x800 picture using @command{ffmpeg}:
  14216. @example
  14217. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14218. @end example
  14219. @end itemize
  14220. @section sidedata, asidedata
  14221. Delete frame side data, or select frames based on it.
  14222. This filter accepts the following options:
  14223. @table @option
  14224. @item mode
  14225. Set mode of operation of the filter.
  14226. Can be one of the following:
  14227. @table @samp
  14228. @item select
  14229. Select every frame with side data of @code{type}.
  14230. @item delete
  14231. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14232. data in the frame.
  14233. @end table
  14234. @item type
  14235. Set side data type used with all modes. Must be set for @code{select} mode. For
  14236. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14237. in @file{libavutil/frame.h}. For example, to choose
  14238. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14239. @end table
  14240. @section spectrumsynth
  14241. Sythesize audio from 2 input video spectrums, first input stream represents
  14242. magnitude across time and second represents phase across time.
  14243. The filter will transform from frequency domain as displayed in videos back
  14244. to time domain as presented in audio output.
  14245. This filter is primarily created for reversing processed @ref{showspectrum}
  14246. filter outputs, but can synthesize sound from other spectrograms too.
  14247. But in such case results are going to be poor if the phase data is not
  14248. available, because in such cases phase data need to be recreated, usually
  14249. its just recreated from random noise.
  14250. For best results use gray only output (@code{channel} color mode in
  14251. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14252. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14253. @code{data} option. Inputs videos should generally use @code{fullframe}
  14254. slide mode as that saves resources needed for decoding video.
  14255. The filter accepts the following options:
  14256. @table @option
  14257. @item sample_rate
  14258. Specify sample rate of output audio, the sample rate of audio from which
  14259. spectrum was generated may differ.
  14260. @item channels
  14261. Set number of channels represented in input video spectrums.
  14262. @item scale
  14263. Set scale which was used when generating magnitude input spectrum.
  14264. Can be @code{lin} or @code{log}. Default is @code{log}.
  14265. @item slide
  14266. Set slide which was used when generating inputs spectrums.
  14267. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14268. Default is @code{fullframe}.
  14269. @item win_func
  14270. Set window function used for resynthesis.
  14271. @item overlap
  14272. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14273. which means optimal overlap for selected window function will be picked.
  14274. @item orientation
  14275. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14276. Default is @code{vertical}.
  14277. @end table
  14278. @subsection Examples
  14279. @itemize
  14280. @item
  14281. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14282. then resynthesize videos back to audio with spectrumsynth:
  14283. @example
  14284. 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
  14285. 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
  14286. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14287. @end example
  14288. @end itemize
  14289. @section split, asplit
  14290. Split input into several identical outputs.
  14291. @code{asplit} works with audio input, @code{split} with video.
  14292. The filter accepts a single parameter which specifies the number of outputs. If
  14293. unspecified, it defaults to 2.
  14294. @subsection Examples
  14295. @itemize
  14296. @item
  14297. Create two separate outputs from the same input:
  14298. @example
  14299. [in] split [out0][out1]
  14300. @end example
  14301. @item
  14302. To create 3 or more outputs, you need to specify the number of
  14303. outputs, like in:
  14304. @example
  14305. [in] asplit=3 [out0][out1][out2]
  14306. @end example
  14307. @item
  14308. Create two separate outputs from the same input, one cropped and
  14309. one padded:
  14310. @example
  14311. [in] split [splitout1][splitout2];
  14312. [splitout1] crop=100:100:0:0 [cropout];
  14313. [splitout2] pad=200:200:100:100 [padout];
  14314. @end example
  14315. @item
  14316. Create 5 copies of the input audio with @command{ffmpeg}:
  14317. @example
  14318. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14319. @end example
  14320. @end itemize
  14321. @section zmq, azmq
  14322. Receive commands sent through a libzmq client, and forward them to
  14323. filters in the filtergraph.
  14324. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14325. must be inserted between two video filters, @code{azmq} between two
  14326. audio filters.
  14327. To enable these filters you need to install the libzmq library and
  14328. headers and configure FFmpeg with @code{--enable-libzmq}.
  14329. For more information about libzmq see:
  14330. @url{http://www.zeromq.org/}
  14331. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14332. receives messages sent through a network interface defined by the
  14333. @option{bind_address} option.
  14334. The received message must be in the form:
  14335. @example
  14336. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14337. @end example
  14338. @var{TARGET} specifies the target of the command, usually the name of
  14339. the filter class or a specific filter instance name.
  14340. @var{COMMAND} specifies the name of the command for the target filter.
  14341. @var{ARG} is optional and specifies the optional argument list for the
  14342. given @var{COMMAND}.
  14343. Upon reception, the message is processed and the corresponding command
  14344. is injected into the filtergraph. Depending on the result, the filter
  14345. will send a reply to the client, adopting the format:
  14346. @example
  14347. @var{ERROR_CODE} @var{ERROR_REASON}
  14348. @var{MESSAGE}
  14349. @end example
  14350. @var{MESSAGE} is optional.
  14351. @subsection Examples
  14352. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14353. be used to send commands processed by these filters.
  14354. Consider the following filtergraph generated by @command{ffplay}
  14355. @example
  14356. ffplay -dumpgraph 1 -f lavfi "
  14357. color=s=100x100:c=red [l];
  14358. color=s=100x100:c=blue [r];
  14359. nullsrc=s=200x100, zmq [bg];
  14360. [bg][l] overlay [bg+l];
  14361. [bg+l][r] overlay=x=100 "
  14362. @end example
  14363. To change the color of the left side of the video, the following
  14364. command can be used:
  14365. @example
  14366. echo Parsed_color_0 c yellow | tools/zmqsend
  14367. @end example
  14368. To change the right side:
  14369. @example
  14370. echo Parsed_color_1 c pink | tools/zmqsend
  14371. @end example
  14372. @c man end MULTIMEDIA FILTERS
  14373. @chapter Multimedia Sources
  14374. @c man begin MULTIMEDIA SOURCES
  14375. Below is a description of the currently available multimedia sources.
  14376. @section amovie
  14377. This is the same as @ref{movie} source, except it selects an audio
  14378. stream by default.
  14379. @anchor{movie}
  14380. @section movie
  14381. Read audio and/or video stream(s) from a movie container.
  14382. It accepts the following parameters:
  14383. @table @option
  14384. @item filename
  14385. The name of the resource to read (not necessarily a file; it can also be a
  14386. device or a stream accessed through some protocol).
  14387. @item format_name, f
  14388. Specifies the format assumed for the movie to read, and can be either
  14389. the name of a container or an input device. If not specified, the
  14390. format is guessed from @var{movie_name} or by probing.
  14391. @item seek_point, sp
  14392. Specifies the seek point in seconds. The frames will be output
  14393. starting from this seek point. The parameter is evaluated with
  14394. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14395. postfix. The default value is "0".
  14396. @item streams, s
  14397. Specifies the streams to read. Several streams can be specified,
  14398. separated by "+". The source will then have as many outputs, in the
  14399. same order. The syntax is explained in the ``Stream specifiers''
  14400. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14401. respectively the default (best suited) video and audio stream. Default
  14402. is "dv", or "da" if the filter is called as "amovie".
  14403. @item stream_index, si
  14404. Specifies the index of the video stream to read. If the value is -1,
  14405. the most suitable video stream will be automatically selected. The default
  14406. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14407. audio instead of video.
  14408. @item loop
  14409. Specifies how many times to read the stream in sequence.
  14410. If the value is 0, the stream will be looped infinitely.
  14411. Default value is "1".
  14412. Note that when the movie is looped the source timestamps are not
  14413. changed, so it will generate non monotonically increasing timestamps.
  14414. @item discontinuity
  14415. Specifies the time difference between frames above which the point is
  14416. considered a timestamp discontinuity which is removed by adjusting the later
  14417. timestamps.
  14418. @end table
  14419. It allows overlaying a second video on top of the main input of
  14420. a filtergraph, as shown in this graph:
  14421. @example
  14422. input -----------> deltapts0 --> overlay --> output
  14423. ^
  14424. |
  14425. movie --> scale--> deltapts1 -------+
  14426. @end example
  14427. @subsection Examples
  14428. @itemize
  14429. @item
  14430. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14431. on top of the input labelled "in":
  14432. @example
  14433. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14434. [in] setpts=PTS-STARTPTS [main];
  14435. [main][over] overlay=16:16 [out]
  14436. @end example
  14437. @item
  14438. Read from a video4linux2 device, and overlay it on top of the input
  14439. labelled "in":
  14440. @example
  14441. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14442. [in] setpts=PTS-STARTPTS [main];
  14443. [main][over] overlay=16:16 [out]
  14444. @end example
  14445. @item
  14446. Read the first video stream and the audio stream with id 0x81 from
  14447. dvd.vob; the video is connected to the pad named "video" and the audio is
  14448. connected to the pad named "audio":
  14449. @example
  14450. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14451. @end example
  14452. @end itemize
  14453. @subsection Commands
  14454. Both movie and amovie support the following commands:
  14455. @table @option
  14456. @item seek
  14457. Perform seek using "av_seek_frame".
  14458. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14459. @itemize
  14460. @item
  14461. @var{stream_index}: If stream_index is -1, a default
  14462. stream is selected, and @var{timestamp} is automatically converted
  14463. from AV_TIME_BASE units to the stream specific time_base.
  14464. @item
  14465. @var{timestamp}: Timestamp in AVStream.time_base units
  14466. or, if no stream is specified, in AV_TIME_BASE units.
  14467. @item
  14468. @var{flags}: Flags which select direction and seeking mode.
  14469. @end itemize
  14470. @item get_duration
  14471. Get movie duration in AV_TIME_BASE units.
  14472. @end table
  14473. @c man end MULTIMEDIA SOURCES