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.

19325 lines
514KB

  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. Dynamic_range
  1251. and for Overall:
  1252. DC_offset
  1253. Min_level
  1254. Max_level
  1255. Min_difference
  1256. Max_difference
  1257. Mean_difference
  1258. RMS_difference
  1259. Peak_level
  1260. RMS_level
  1261. RMS_peak
  1262. RMS_trough
  1263. Flat_factor
  1264. Peak_count
  1265. Bit_depth
  1266. Number_of_samples
  1267. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1268. this @code{lavfi.astats.Overall.Peak_count}.
  1269. For description what each key means read below.
  1270. @item reset
  1271. Set number of frame after which stats are going to be recalculated.
  1272. Default is disabled.
  1273. @end table
  1274. A description of each shown parameter follows:
  1275. @table @option
  1276. @item DC offset
  1277. Mean amplitude displacement from zero.
  1278. @item Min level
  1279. Minimal sample level.
  1280. @item Max level
  1281. Maximal sample level.
  1282. @item Min difference
  1283. Minimal difference between two consecutive samples.
  1284. @item Max difference
  1285. Maximal difference between two consecutive samples.
  1286. @item Mean difference
  1287. Mean difference between two consecutive samples.
  1288. The average of each difference between two consecutive samples.
  1289. @item RMS difference
  1290. Root Mean Square difference between two consecutive samples.
  1291. @item Peak level dB
  1292. @item RMS level dB
  1293. Standard peak and RMS level measured in dBFS.
  1294. @item RMS peak dB
  1295. @item RMS trough dB
  1296. Peak and trough values for RMS level measured over a short window.
  1297. @item Crest factor
  1298. Standard ratio of peak to RMS level (note: not in dB).
  1299. @item Flat factor
  1300. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1301. (i.e. either @var{Min level} or @var{Max level}).
  1302. @item Peak count
  1303. Number of occasions (not the number of samples) that the signal attained either
  1304. @var{Min level} or @var{Max level}.
  1305. @item Bit depth
  1306. Overall bit depth of audio. Number of bits used for each sample.
  1307. @item Dynamic range
  1308. Measured dynamic range of audio in dB.
  1309. @end table
  1310. @section atempo
  1311. Adjust audio tempo.
  1312. The filter accepts exactly one parameter, the audio tempo. If not
  1313. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1314. be in the [0.5, 2.0] range.
  1315. @subsection Examples
  1316. @itemize
  1317. @item
  1318. Slow down audio to 80% tempo:
  1319. @example
  1320. atempo=0.8
  1321. @end example
  1322. @item
  1323. To speed up audio to 125% tempo:
  1324. @example
  1325. atempo=1.25
  1326. @end example
  1327. @end itemize
  1328. @section atrim
  1329. Trim the input so that the output contains one continuous subpart of the input.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item start
  1333. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1334. sample with the timestamp @var{start} will be the first sample in the output.
  1335. @item end
  1336. Specify time of the first audio sample that will be dropped, i.e. the
  1337. audio sample immediately preceding the one with the timestamp @var{end} will be
  1338. the last sample in the output.
  1339. @item start_pts
  1340. Same as @var{start}, except this option sets the start timestamp in samples
  1341. instead of seconds.
  1342. @item end_pts
  1343. Same as @var{end}, except this option sets the end timestamp in samples instead
  1344. of seconds.
  1345. @item duration
  1346. The maximum duration of the output in seconds.
  1347. @item start_sample
  1348. The number of the first sample that should be output.
  1349. @item end_sample
  1350. The number of the first sample that should be dropped.
  1351. @end table
  1352. @option{start}, @option{end}, and @option{duration} are expressed as time
  1353. duration specifications; see
  1354. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1355. Note that the first two sets of the start/end options and the @option{duration}
  1356. option look at the frame timestamp, while the _sample options simply count the
  1357. samples that pass through the filter. So start/end_pts and start/end_sample will
  1358. give different results when the timestamps are wrong, inexact or do not start at
  1359. zero. Also note that this filter does not modify the timestamps. If you wish
  1360. to have the output timestamps start at zero, insert the asetpts filter after the
  1361. atrim filter.
  1362. If multiple start or end options are set, this filter tries to be greedy and
  1363. keep all samples that match at least one of the specified constraints. To keep
  1364. only the part that matches all the constraints at once, chain multiple atrim
  1365. filters.
  1366. The defaults are such that all the input is kept. So it is possible to set e.g.
  1367. just the end values to keep everything before the specified time.
  1368. Examples:
  1369. @itemize
  1370. @item
  1371. Drop everything except the second minute of input:
  1372. @example
  1373. ffmpeg -i INPUT -af atrim=60:120
  1374. @end example
  1375. @item
  1376. Keep only the first 1000 samples:
  1377. @example
  1378. ffmpeg -i INPUT -af atrim=end_sample=1000
  1379. @end example
  1380. @end itemize
  1381. @section bandpass
  1382. Apply a two-pole Butterworth band-pass filter with central
  1383. frequency @var{frequency}, and (3dB-point) band-width width.
  1384. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1385. instead of the default: constant 0dB peak gain.
  1386. The filter roll off at 6dB per octave (20dB per decade).
  1387. The filter accepts the following options:
  1388. @table @option
  1389. @item frequency, f
  1390. Set the filter's central frequency. Default is @code{3000}.
  1391. @item csg
  1392. Constant skirt gain if set to 1. Defaults to 0.
  1393. @item width_type, t
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @item channels, c
  1408. Specify which channels to filter, by default all available are filtered.
  1409. @end table
  1410. @section bandreject
  1411. Apply a two-pole Butterworth band-reject filter with central
  1412. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1413. The filter roll off at 6dB per octave (20dB per decade).
  1414. The filter accepts the following options:
  1415. @table @option
  1416. @item frequency, f
  1417. Set the filter's central frequency. Default is @code{3000}.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bass
  1436. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1437. shelving filter with a response similar to that of a standard
  1438. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item gain, g
  1442. Give the gain at 0 Hz. Its useful range is about -20
  1443. (for a large cut) to +20 (for a large boost).
  1444. Beware of clipping when using a positive gain.
  1445. @item frequency, f
  1446. Set the filter's central frequency and so can be used
  1447. to extend or reduce the frequency range to be boosted or cut.
  1448. The default value is @code{100} Hz.
  1449. @item width_type, t
  1450. Set method to specify band-width of filter.
  1451. @table @option
  1452. @item h
  1453. Hz
  1454. @item q
  1455. Q-Factor
  1456. @item o
  1457. octave
  1458. @item s
  1459. slope
  1460. @end table
  1461. @item width, w
  1462. Determine how steep is the filter's shelf transition.
  1463. @item channels, c
  1464. Specify which channels to filter, by default all available are filtered.
  1465. @end table
  1466. @section biquad
  1467. Apply a biquad IIR filter with the given coefficients.
  1468. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1469. are the numerator and denominator coefficients respectively.
  1470. and @var{channels}, @var{c} specify which channels to filter, by default all
  1471. available are filtered.
  1472. @section bs2b
  1473. Bauer stereo to binaural transformation, which improves headphone listening of
  1474. stereo audio records.
  1475. To enable compilation of this filter you need to configure FFmpeg with
  1476. @code{--enable-libbs2b}.
  1477. It accepts the following parameters:
  1478. @table @option
  1479. @item profile
  1480. Pre-defined crossfeed level.
  1481. @table @option
  1482. @item default
  1483. Default level (fcut=700, feed=50).
  1484. @item cmoy
  1485. Chu Moy circuit (fcut=700, feed=60).
  1486. @item jmeier
  1487. Jan Meier circuit (fcut=650, feed=95).
  1488. @end table
  1489. @item fcut
  1490. Cut frequency (in Hz).
  1491. @item feed
  1492. Feed level (in Hz).
  1493. @end table
  1494. @section channelmap
  1495. Remap input channels to new locations.
  1496. It accepts the following parameters:
  1497. @table @option
  1498. @item map
  1499. Map channels from input to output. The argument is a '|'-separated list of
  1500. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1501. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1502. channel (e.g. FL for front left) or its index in the input channel layout.
  1503. @var{out_channel} is the name of the output channel or its index in the output
  1504. channel layout. If @var{out_channel} is not given then it is implicitly an
  1505. index, starting with zero and increasing by one for each mapping.
  1506. @item channel_layout
  1507. The channel layout of the output stream.
  1508. @end table
  1509. If no mapping is present, the filter will implicitly map input channels to
  1510. output channels, preserving indices.
  1511. For example, assuming a 5.1+downmix input MOV file,
  1512. @example
  1513. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1514. @end example
  1515. will create an output WAV file tagged as stereo from the downmix channels of
  1516. the input.
  1517. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1518. @example
  1519. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1520. @end example
  1521. @section channelsplit
  1522. Split each channel from an input audio stream into a separate output stream.
  1523. It accepts the following parameters:
  1524. @table @option
  1525. @item channel_layout
  1526. The channel layout of the input stream. The default is "stereo".
  1527. @end table
  1528. For example, assuming a stereo input MP3 file,
  1529. @example
  1530. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1531. @end example
  1532. will create an output Matroska file with two audio streams, one containing only
  1533. the left channel and the other the right channel.
  1534. Split a 5.1 WAV file into per-channel files:
  1535. @example
  1536. ffmpeg -i in.wav -filter_complex
  1537. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1538. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1539. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1540. side_right.wav
  1541. @end example
  1542. @section chorus
  1543. Add a chorus effect to the audio.
  1544. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1545. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1546. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1547. The modulation depth defines the range the modulated delay is played before or after
  1548. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1549. sound tuned around the original one, like in a chorus where some vocals are slightly
  1550. off key.
  1551. It accepts the following parameters:
  1552. @table @option
  1553. @item in_gain
  1554. Set input gain. Default is 0.4.
  1555. @item out_gain
  1556. Set output gain. Default is 0.4.
  1557. @item delays
  1558. Set delays. A typical delay is around 40ms to 60ms.
  1559. @item decays
  1560. Set decays.
  1561. @item speeds
  1562. Set speeds.
  1563. @item depths
  1564. Set depths.
  1565. @end table
  1566. @subsection Examples
  1567. @itemize
  1568. @item
  1569. A single delay:
  1570. @example
  1571. chorus=0.7:0.9:55:0.4:0.25:2
  1572. @end example
  1573. @item
  1574. Two delays:
  1575. @example
  1576. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1577. @end example
  1578. @item
  1579. Fuller sounding chorus with three delays:
  1580. @example
  1581. 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
  1582. @end example
  1583. @end itemize
  1584. @section compand
  1585. Compress or expand the audio's dynamic range.
  1586. It accepts the following parameters:
  1587. @table @option
  1588. @item attacks
  1589. @item decays
  1590. A list of times in seconds for each channel over which the instantaneous level
  1591. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1592. increase of volume and @var{decays} refers to decrease of volume. For most
  1593. situations, the attack time (response to the audio getting louder) should be
  1594. shorter than the decay time, because the human ear is more sensitive to sudden
  1595. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1596. a typical value for decay is 0.8 seconds.
  1597. If specified number of attacks & decays is lower than number of channels, the last
  1598. set attack/decay will be used for all remaining channels.
  1599. @item points
  1600. A list of points for the transfer function, specified in dB relative to the
  1601. maximum possible signal amplitude. Each key points list must be defined using
  1602. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1603. @code{x0/y0 x1/y1 x2/y2 ....}
  1604. The input values must be in strictly increasing order but the transfer function
  1605. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1606. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1607. function are @code{-70/-70|-60/-20|1/0}.
  1608. @item soft-knee
  1609. Set the curve radius in dB for all joints. It defaults to 0.01.
  1610. @item gain
  1611. Set the additional gain in dB to be applied at all points on the transfer
  1612. function. This allows for easy adjustment of the overall gain.
  1613. It defaults to 0.
  1614. @item volume
  1615. Set an initial volume, in dB, to be assumed for each channel when filtering
  1616. starts. This permits the user to supply a nominal level initially, so that, for
  1617. example, a very large gain is not applied to initial signal levels before the
  1618. companding has begun to operate. A typical value for audio which is initially
  1619. quiet is -90 dB. It defaults to 0.
  1620. @item delay
  1621. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1622. delayed before being fed to the volume adjuster. Specifying a delay
  1623. approximately equal to the attack/decay times allows the filter to effectively
  1624. operate in predictive rather than reactive mode. It defaults to 0.
  1625. @end table
  1626. @subsection Examples
  1627. @itemize
  1628. @item
  1629. Make music with both quiet and loud passages suitable for listening to in a
  1630. noisy environment:
  1631. @example
  1632. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1633. @end example
  1634. Another example for audio with whisper and explosion parts:
  1635. @example
  1636. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1637. @end example
  1638. @item
  1639. A noise gate for when the noise is at a lower level than the signal:
  1640. @example
  1641. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1642. @end example
  1643. @item
  1644. Here is another noise gate, this time for when the noise is at a higher level
  1645. than the signal (making it, in some ways, similar to squelch):
  1646. @example
  1647. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1648. @end example
  1649. @item
  1650. 2:1 compression starting at -6dB:
  1651. @example
  1652. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1653. @end example
  1654. @item
  1655. 2:1 compression starting at -9dB:
  1656. @example
  1657. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1658. @end example
  1659. @item
  1660. 2:1 compression starting at -12dB:
  1661. @example
  1662. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1663. @end example
  1664. @item
  1665. 2:1 compression starting at -18dB:
  1666. @example
  1667. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1668. @end example
  1669. @item
  1670. 3:1 compression starting at -15dB:
  1671. @example
  1672. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1673. @end example
  1674. @item
  1675. Compressor/Gate:
  1676. @example
  1677. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1678. @end example
  1679. @item
  1680. Expander:
  1681. @example
  1682. 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
  1683. @end example
  1684. @item
  1685. Hard limiter at -6dB:
  1686. @example
  1687. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1688. @end example
  1689. @item
  1690. Hard limiter at -12dB:
  1691. @example
  1692. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1693. @end example
  1694. @item
  1695. Hard noise gate at -35 dB:
  1696. @example
  1697. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1698. @end example
  1699. @item
  1700. Soft limiter:
  1701. @example
  1702. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1703. @end example
  1704. @end itemize
  1705. @section compensationdelay
  1706. Compensation Delay Line is a metric based delay to compensate differing
  1707. positions of microphones or speakers.
  1708. For example, you have recorded guitar with two microphones placed in
  1709. different location. Because the front of sound wave has fixed speed in
  1710. normal conditions, the phasing of microphones can vary and depends on
  1711. their location and interposition. The best sound mix can be achieved when
  1712. these microphones are in phase (synchronized). Note that distance of
  1713. ~30 cm between microphones makes one microphone to capture signal in
  1714. antiphase to another microphone. That makes the final mix sounding moody.
  1715. This filter helps to solve phasing problems by adding different delays
  1716. to each microphone track and make them synchronized.
  1717. The best result can be reached when you take one track as base and
  1718. synchronize other tracks one by one with it.
  1719. Remember that synchronization/delay tolerance depends on sample rate, too.
  1720. Higher sample rates will give more tolerance.
  1721. It accepts the following parameters:
  1722. @table @option
  1723. @item mm
  1724. Set millimeters distance. This is compensation distance for fine tuning.
  1725. Default is 0.
  1726. @item cm
  1727. Set cm distance. This is compensation distance for tightening distance setup.
  1728. Default is 0.
  1729. @item m
  1730. Set meters distance. This is compensation distance for hard distance setup.
  1731. Default is 0.
  1732. @item dry
  1733. Set dry amount. Amount of unprocessed (dry) signal.
  1734. Default is 0.
  1735. @item wet
  1736. Set wet amount. Amount of processed (wet) signal.
  1737. Default is 1.
  1738. @item temp
  1739. Set temperature degree in Celsius. This is the temperature of the environment.
  1740. Default is 20.
  1741. @end table
  1742. @section crossfeed
  1743. Apply headphone crossfeed filter.
  1744. Crossfeed is the process of blending the left and right channels of stereo
  1745. audio recording.
  1746. It is mainly used to reduce extreme stereo separation of low frequencies.
  1747. The intent is to produce more speaker like sound to the listener.
  1748. The filter accepts the following options:
  1749. @table @option
  1750. @item strength
  1751. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1752. This sets gain of low shelf filter for side part of stereo image.
  1753. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1754. @item range
  1755. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1756. This sets cut off frequency of low shelf filter. Default is cut off near
  1757. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1758. @item level_in
  1759. Set input gain. Default is 0.9.
  1760. @item level_out
  1761. Set output gain. Default is 1.
  1762. @end table
  1763. @section crystalizer
  1764. Simple algorithm to expand audio dynamic range.
  1765. The filter accepts the following options:
  1766. @table @option
  1767. @item i
  1768. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1769. (unchanged sound) to 10.0 (maximum effect).
  1770. @item c
  1771. Enable clipping. By default is enabled.
  1772. @end table
  1773. @section dcshift
  1774. Apply a DC shift to the audio.
  1775. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1776. in the recording chain) from the audio. The effect of a DC offset is reduced
  1777. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1778. a signal has a DC offset.
  1779. @table @option
  1780. @item shift
  1781. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1782. the audio.
  1783. @item limitergain
  1784. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1785. used to prevent clipping.
  1786. @end table
  1787. @section dynaudnorm
  1788. Dynamic Audio Normalizer.
  1789. This filter applies a certain amount of gain to the input audio in order
  1790. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1791. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1792. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1793. This allows for applying extra gain to the "quiet" sections of the audio
  1794. while avoiding distortions or clipping the "loud" sections. In other words:
  1795. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1796. sections, in the sense that the volume of each section is brought to the
  1797. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1798. this goal *without* applying "dynamic range compressing". It will retain 100%
  1799. of the dynamic range *within* each section of the audio file.
  1800. @table @option
  1801. @item f
  1802. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1803. Default is 500 milliseconds.
  1804. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1805. referred to as frames. This is required, because a peak magnitude has no
  1806. meaning for just a single sample value. Instead, we need to determine the
  1807. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1808. normalizer would simply use the peak magnitude of the complete file, the
  1809. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1810. frame. The length of a frame is specified in milliseconds. By default, the
  1811. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1812. been found to give good results with most files.
  1813. Note that the exact frame length, in number of samples, will be determined
  1814. automatically, based on the sampling rate of the individual input audio file.
  1815. @item g
  1816. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1817. number. Default is 31.
  1818. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1819. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1820. is specified in frames, centered around the current frame. For the sake of
  1821. simplicity, this must be an odd number. Consequently, the default value of 31
  1822. takes into account the current frame, as well as the 15 preceding frames and
  1823. the 15 subsequent frames. Using a larger window results in a stronger
  1824. smoothing effect and thus in less gain variation, i.e. slower gain
  1825. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1826. effect and thus in more gain variation, i.e. faster gain adaptation.
  1827. In other words, the more you increase this value, the more the Dynamic Audio
  1828. Normalizer will behave like a "traditional" normalization filter. On the
  1829. contrary, the more you decrease this value, the more the Dynamic Audio
  1830. Normalizer will behave like a dynamic range compressor.
  1831. @item p
  1832. Set the target peak value. This specifies the highest permissible magnitude
  1833. level for the normalized audio input. This filter will try to approach the
  1834. target peak magnitude as closely as possible, but at the same time it also
  1835. makes sure that the normalized signal will never exceed the peak magnitude.
  1836. A frame's maximum local gain factor is imposed directly by the target peak
  1837. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1838. It is not recommended to go above this value.
  1839. @item m
  1840. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1841. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1842. factor for each input frame, i.e. the maximum gain factor that does not
  1843. result in clipping or distortion. The maximum gain factor is determined by
  1844. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1845. additionally bounds the frame's maximum gain factor by a predetermined
  1846. (global) maximum gain factor. This is done in order to avoid excessive gain
  1847. factors in "silent" or almost silent frames. By default, the maximum gain
  1848. factor is 10.0, For most inputs the default value should be sufficient and
  1849. it usually is not recommended to increase this value. Though, for input
  1850. with an extremely low overall volume level, it may be necessary to allow even
  1851. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1852. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1853. Instead, a "sigmoid" threshold function will be applied. This way, the
  1854. gain factors will smoothly approach the threshold value, but never exceed that
  1855. value.
  1856. @item r
  1857. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1858. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1859. This means that the maximum local gain factor for each frame is defined
  1860. (only) by the frame's highest magnitude sample. This way, the samples can
  1861. be amplified as much as possible without exceeding the maximum signal
  1862. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1863. Normalizer can also take into account the frame's root mean square,
  1864. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1865. determine the power of a time-varying signal. It is therefore considered
  1866. that the RMS is a better approximation of the "perceived loudness" than
  1867. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1868. frames to a constant RMS value, a uniform "perceived loudness" can be
  1869. established. If a target RMS value has been specified, a frame's local gain
  1870. factor is defined as the factor that would result in exactly that RMS value.
  1871. Note, however, that the maximum local gain factor is still restricted by the
  1872. frame's highest magnitude sample, in order to prevent clipping.
  1873. @item n
  1874. Enable channels coupling. By default is enabled.
  1875. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1876. amount. This means the same gain factor will be applied to all channels, i.e.
  1877. the maximum possible gain factor is determined by the "loudest" channel.
  1878. However, in some recordings, it may happen that the volume of the different
  1879. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1880. In this case, this option can be used to disable the channel coupling. This way,
  1881. the gain factor will be determined independently for each channel, depending
  1882. only on the individual channel's highest magnitude sample. This allows for
  1883. harmonizing the volume of the different channels.
  1884. @item c
  1885. Enable DC bias correction. By default is disabled.
  1886. An audio signal (in the time domain) is a sequence of sample values.
  1887. In the Dynamic Audio Normalizer these sample values are represented in the
  1888. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1889. audio signal, or "waveform", should be centered around the zero point.
  1890. That means if we calculate the mean value of all samples in a file, or in a
  1891. single frame, then the result should be 0.0 or at least very close to that
  1892. value. If, however, there is a significant deviation of the mean value from
  1893. 0.0, in either positive or negative direction, this is referred to as a
  1894. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1895. Audio Normalizer provides optional DC bias correction.
  1896. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1897. the mean value, or "DC correction" offset, of each input frame and subtract
  1898. that value from all of the frame's sample values which ensures those samples
  1899. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1900. boundaries, the DC correction offset values will be interpolated smoothly
  1901. between neighbouring frames.
  1902. @item b
  1903. Enable alternative boundary mode. By default is disabled.
  1904. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1905. around each frame. This includes the preceding frames as well as the
  1906. subsequent frames. However, for the "boundary" frames, located at the very
  1907. beginning and at the very end of the audio file, not all neighbouring
  1908. frames are available. In particular, for the first few frames in the audio
  1909. file, the preceding frames are not known. And, similarly, for the last few
  1910. frames in the audio file, the subsequent frames are not known. Thus, the
  1911. question arises which gain factors should be assumed for the missing frames
  1912. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1913. to deal with this situation. The default boundary mode assumes a gain factor
  1914. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1915. "fade out" at the beginning and at the end of the input, respectively.
  1916. @item s
  1917. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1918. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1919. compression. This means that signal peaks will not be pruned and thus the
  1920. full dynamic range will be retained within each local neighbourhood. However,
  1921. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1922. normalization algorithm with a more "traditional" compression.
  1923. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1924. (thresholding) function. If (and only if) the compression feature is enabled,
  1925. all input frames will be processed by a soft knee thresholding function prior
  1926. to the actual normalization process. Put simply, the thresholding function is
  1927. going to prune all samples whose magnitude exceeds a certain threshold value.
  1928. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1929. value. Instead, the threshold value will be adjusted for each individual
  1930. frame.
  1931. In general, smaller parameters result in stronger compression, and vice versa.
  1932. Values below 3.0 are not recommended, because audible distortion may appear.
  1933. @end table
  1934. @section earwax
  1935. Make audio easier to listen to on headphones.
  1936. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1937. so that when listened to on headphones the stereo image is moved from
  1938. inside your head (standard for headphones) to outside and in front of
  1939. the listener (standard for speakers).
  1940. Ported from SoX.
  1941. @section equalizer
  1942. Apply a two-pole peaking equalisation (EQ) filter. With this
  1943. filter, the signal-level at and around a selected frequency can
  1944. be increased or decreased, whilst (unlike bandpass and bandreject
  1945. filters) that at all other frequencies is unchanged.
  1946. In order to produce complex equalisation curves, this filter can
  1947. be given several times, each with a different central frequency.
  1948. The filter accepts the following options:
  1949. @table @option
  1950. @item frequency, f
  1951. Set the filter's central frequency in Hz.
  1952. @item width_type, t
  1953. Set method to specify band-width of filter.
  1954. @table @option
  1955. @item h
  1956. Hz
  1957. @item q
  1958. Q-Factor
  1959. @item o
  1960. octave
  1961. @item s
  1962. slope
  1963. @end table
  1964. @item width, w
  1965. Specify the band-width of a filter in width_type units.
  1966. @item gain, g
  1967. Set the required gain or attenuation in dB.
  1968. Beware of clipping when using a positive gain.
  1969. @item channels, c
  1970. Specify which channels to filter, by default all available are filtered.
  1971. @end table
  1972. @subsection Examples
  1973. @itemize
  1974. @item
  1975. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1976. @example
  1977. equalizer=f=1000:t=h:width=200:g=-10
  1978. @end example
  1979. @item
  1980. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1981. @example
  1982. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  1983. @end example
  1984. @end itemize
  1985. @section extrastereo
  1986. Linearly increases the difference between left and right channels which
  1987. adds some sort of "live" effect to playback.
  1988. The filter accepts the following options:
  1989. @table @option
  1990. @item m
  1991. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1992. (average of both channels), with 1.0 sound will be unchanged, with
  1993. -1.0 left and right channels will be swapped.
  1994. @item c
  1995. Enable clipping. By default is enabled.
  1996. @end table
  1997. @section firequalizer
  1998. Apply FIR Equalization using arbitrary frequency response.
  1999. The filter accepts the following option:
  2000. @table @option
  2001. @item gain
  2002. Set gain curve equation (in dB). The expression can contain variables:
  2003. @table @option
  2004. @item f
  2005. the evaluated frequency
  2006. @item sr
  2007. sample rate
  2008. @item ch
  2009. channel number, set to 0 when multichannels evaluation is disabled
  2010. @item chid
  2011. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2012. multichannels evaluation is disabled
  2013. @item chs
  2014. number of channels
  2015. @item chlayout
  2016. channel_layout, see libavutil/channel_layout.h
  2017. @end table
  2018. and functions:
  2019. @table @option
  2020. @item gain_interpolate(f)
  2021. interpolate gain on frequency f based on gain_entry
  2022. @item cubic_interpolate(f)
  2023. same as gain_interpolate, but smoother
  2024. @end table
  2025. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2026. @item gain_entry
  2027. Set gain entry for gain_interpolate function. The expression can
  2028. contain functions:
  2029. @table @option
  2030. @item entry(f, g)
  2031. store gain entry at frequency f with value g
  2032. @end table
  2033. This option is also available as command.
  2034. @item delay
  2035. Set filter delay in seconds. Higher value means more accurate.
  2036. Default is @code{0.01}.
  2037. @item accuracy
  2038. Set filter accuracy in Hz. Lower value means more accurate.
  2039. Default is @code{5}.
  2040. @item wfunc
  2041. Set window function. Acceptable values are:
  2042. @table @option
  2043. @item rectangular
  2044. rectangular window, useful when gain curve is already smooth
  2045. @item hann
  2046. hann window (default)
  2047. @item hamming
  2048. hamming window
  2049. @item blackman
  2050. blackman window
  2051. @item nuttall3
  2052. 3-terms continuous 1st derivative nuttall window
  2053. @item mnuttall3
  2054. minimum 3-terms discontinuous nuttall window
  2055. @item nuttall
  2056. 4-terms continuous 1st derivative nuttall window
  2057. @item bnuttall
  2058. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2059. @item bharris
  2060. blackman-harris window
  2061. @item tukey
  2062. tukey window
  2063. @end table
  2064. @item fixed
  2065. If enabled, use fixed number of audio samples. This improves speed when
  2066. filtering with large delay. Default is disabled.
  2067. @item multi
  2068. Enable multichannels evaluation on gain. Default is disabled.
  2069. @item zero_phase
  2070. Enable zero phase mode by subtracting timestamp to compensate delay.
  2071. Default is disabled.
  2072. @item scale
  2073. Set scale used by gain. Acceptable values are:
  2074. @table @option
  2075. @item linlin
  2076. linear frequency, linear gain
  2077. @item linlog
  2078. linear frequency, logarithmic (in dB) gain (default)
  2079. @item loglin
  2080. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2081. @item loglog
  2082. logarithmic frequency, logarithmic gain
  2083. @end table
  2084. @item dumpfile
  2085. Set file for dumping, suitable for gnuplot.
  2086. @item dumpscale
  2087. Set scale for dumpfile. Acceptable values are same with scale option.
  2088. Default is linlog.
  2089. @item fft2
  2090. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2091. Default is disabled.
  2092. @item min_phase
  2093. Enable minimum phase impulse response. Default is disabled.
  2094. @end table
  2095. @subsection Examples
  2096. @itemize
  2097. @item
  2098. lowpass at 1000 Hz:
  2099. @example
  2100. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2101. @end example
  2102. @item
  2103. lowpass at 1000 Hz with gain_entry:
  2104. @example
  2105. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2106. @end example
  2107. @item
  2108. custom equalization:
  2109. @example
  2110. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2111. @end example
  2112. @item
  2113. higher delay with zero phase to compensate delay:
  2114. @example
  2115. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2116. @end example
  2117. @item
  2118. lowpass on left channel, highpass on right channel:
  2119. @example
  2120. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2121. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2122. @end example
  2123. @end itemize
  2124. @section flanger
  2125. Apply a flanging effect to the audio.
  2126. The filter accepts the following options:
  2127. @table @option
  2128. @item delay
  2129. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2130. @item depth
  2131. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2132. @item regen
  2133. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2134. Default value is 0.
  2135. @item width
  2136. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2137. Default value is 71.
  2138. @item speed
  2139. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2140. @item shape
  2141. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2142. Default value is @var{sinusoidal}.
  2143. @item phase
  2144. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2145. Default value is 25.
  2146. @item interp
  2147. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2148. Default is @var{linear}.
  2149. @end table
  2150. @section hdcd
  2151. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2152. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2153. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2154. of HDCD, and detects the Transient Filter flag.
  2155. @example
  2156. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2157. @end example
  2158. When using the filter with wav, note the default encoding for wav is 16-bit,
  2159. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2160. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2161. @example
  2162. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2163. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2164. @end example
  2165. The filter accepts the following options:
  2166. @table @option
  2167. @item disable_autoconvert
  2168. Disable any automatic format conversion or resampling in the filter graph.
  2169. @item process_stereo
  2170. Process the stereo channels together. If target_gain does not match between
  2171. channels, consider it invalid and use the last valid target_gain.
  2172. @item cdt_ms
  2173. Set the code detect timer period in ms.
  2174. @item force_pe
  2175. Always extend peaks above -3dBFS even if PE isn't signaled.
  2176. @item analyze_mode
  2177. Replace audio with a solid tone and adjust the amplitude to signal some
  2178. specific aspect of the decoding process. The output file can be loaded in
  2179. an audio editor alongside the original to aid analysis.
  2180. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2181. Modes are:
  2182. @table @samp
  2183. @item 0, off
  2184. Disabled
  2185. @item 1, lle
  2186. Gain adjustment level at each sample
  2187. @item 2, pe
  2188. Samples where peak extend occurs
  2189. @item 3, cdt
  2190. Samples where the code detect timer is active
  2191. @item 4, tgm
  2192. Samples where the target gain does not match between channels
  2193. @end table
  2194. @end table
  2195. @section headphone
  2196. Apply head-related transfer functions (HRTFs) to create virtual
  2197. loudspeakers around the user for binaural listening via headphones.
  2198. The HRIRs are provided via additional streams, for each channel
  2199. one stereo input stream is needed.
  2200. The filter accepts the following options:
  2201. @table @option
  2202. @item map
  2203. Set mapping of input streams for convolution.
  2204. The argument is a '|'-separated list of channel names in order as they
  2205. are given as additional stream inputs for filter.
  2206. This also specify number of input streams. Number of input streams
  2207. must be not less than number of channels in first stream plus one.
  2208. @item gain
  2209. Set gain applied to audio. Value is in dB. Default is 0.
  2210. @item type
  2211. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2212. processing audio in time domain which is slow.
  2213. @var{freq} is processing audio in frequency domain which is fast.
  2214. Default is @var{freq}.
  2215. @item lfe
  2216. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2217. @end table
  2218. @subsection Examples
  2219. @itemize
  2220. @item
  2221. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2222. each amovie filter use stereo file with IR coefficients as input.
  2223. The files give coefficients for each position of virtual loudspeaker:
  2224. @example
  2225. 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"
  2226. output.wav
  2227. @end example
  2228. @end itemize
  2229. @section highpass
  2230. Apply a high-pass filter with 3dB point frequency.
  2231. The filter can be either single-pole, or double-pole (the default).
  2232. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2233. The filter accepts the following options:
  2234. @table @option
  2235. @item frequency, f
  2236. Set frequency in Hz. Default is 3000.
  2237. @item poles, p
  2238. Set number of poles. Default is 2.
  2239. @item width_type, t
  2240. Set method to specify band-width of filter.
  2241. @table @option
  2242. @item h
  2243. Hz
  2244. @item q
  2245. Q-Factor
  2246. @item o
  2247. octave
  2248. @item s
  2249. slope
  2250. @end table
  2251. @item width, w
  2252. Specify the band-width of a filter in width_type units.
  2253. Applies only to double-pole filter.
  2254. The default is 0.707q and gives a Butterworth response.
  2255. @item channels, c
  2256. Specify which channels to filter, by default all available are filtered.
  2257. @end table
  2258. @section join
  2259. Join multiple input streams into one multi-channel stream.
  2260. It accepts the following parameters:
  2261. @table @option
  2262. @item inputs
  2263. The number of input streams. It defaults to 2.
  2264. @item channel_layout
  2265. The desired output channel layout. It defaults to stereo.
  2266. @item map
  2267. Map channels from inputs to output. The argument is a '|'-separated list of
  2268. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2269. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2270. can be either the name of the input channel (e.g. FL for front left) or its
  2271. index in the specified input stream. @var{out_channel} is the name of the output
  2272. channel.
  2273. @end table
  2274. The filter will attempt to guess the mappings when they are not specified
  2275. explicitly. It does so by first trying to find an unused matching input channel
  2276. and if that fails it picks the first unused input channel.
  2277. Join 3 inputs (with properly set channel layouts):
  2278. @example
  2279. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2280. @end example
  2281. Build a 5.1 output from 6 single-channel streams:
  2282. @example
  2283. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2284. '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'
  2285. out
  2286. @end example
  2287. @section ladspa
  2288. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2289. To enable compilation of this filter you need to configure FFmpeg with
  2290. @code{--enable-ladspa}.
  2291. @table @option
  2292. @item file, f
  2293. Specifies the name of LADSPA plugin library to load. If the environment
  2294. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2295. each one of the directories specified by the colon separated list in
  2296. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2297. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2298. @file{/usr/lib/ladspa/}.
  2299. @item plugin, p
  2300. Specifies the plugin within the library. Some libraries contain only
  2301. one plugin, but others contain many of them. If this is not set filter
  2302. will list all available plugins within the specified library.
  2303. @item controls, c
  2304. Set the '|' separated list of controls which are zero or more floating point
  2305. values that determine the behavior of the loaded plugin (for example delay,
  2306. threshold or gain).
  2307. Controls need to be defined using the following syntax:
  2308. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2309. @var{valuei} is the value set on the @var{i}-th control.
  2310. Alternatively they can be also defined using the following syntax:
  2311. @var{value0}|@var{value1}|@var{value2}|..., where
  2312. @var{valuei} is the value set on the @var{i}-th control.
  2313. If @option{controls} is set to @code{help}, all available controls and
  2314. their valid ranges are printed.
  2315. @item sample_rate, s
  2316. Specify the sample rate, default to 44100. Only used if plugin have
  2317. zero inputs.
  2318. @item nb_samples, n
  2319. Set the number of samples per channel per each output frame, default
  2320. is 1024. Only used if plugin have zero inputs.
  2321. @item duration, d
  2322. Set the minimum duration of the sourced audio. See
  2323. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2324. for the accepted syntax.
  2325. Note that the resulting duration may be greater than the specified duration,
  2326. as the generated audio is always cut at the end of a complete frame.
  2327. If not specified, or the expressed duration is negative, the audio is
  2328. supposed to be generated forever.
  2329. Only used if plugin have zero inputs.
  2330. @end table
  2331. @subsection Examples
  2332. @itemize
  2333. @item
  2334. List all available plugins within amp (LADSPA example plugin) library:
  2335. @example
  2336. ladspa=file=amp
  2337. @end example
  2338. @item
  2339. List all available controls and their valid ranges for @code{vcf_notch}
  2340. plugin from @code{VCF} library:
  2341. @example
  2342. ladspa=f=vcf:p=vcf_notch:c=help
  2343. @end example
  2344. @item
  2345. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2346. plugin library:
  2347. @example
  2348. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2349. @end example
  2350. @item
  2351. Add reverberation to the audio using TAP-plugins
  2352. (Tom's Audio Processing plugins):
  2353. @example
  2354. ladspa=file=tap_reverb:tap_reverb
  2355. @end example
  2356. @item
  2357. Generate white noise, with 0.2 amplitude:
  2358. @example
  2359. ladspa=file=cmt:noise_source_white:c=c0=.2
  2360. @end example
  2361. @item
  2362. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2363. @code{C* Audio Plugin Suite} (CAPS) library:
  2364. @example
  2365. ladspa=file=caps:Click:c=c1=20'
  2366. @end example
  2367. @item
  2368. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2369. @example
  2370. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2371. @end example
  2372. @item
  2373. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2374. @code{SWH Plugins} collection:
  2375. @example
  2376. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2377. @end example
  2378. @item
  2379. Attenuate low frequencies using Multiband EQ from Steve Harris
  2380. @code{SWH Plugins} collection:
  2381. @example
  2382. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2383. @end example
  2384. @item
  2385. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2386. (CAPS) library:
  2387. @example
  2388. ladspa=caps:Narrower
  2389. @end example
  2390. @item
  2391. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2392. @example
  2393. ladspa=caps:White:.2
  2394. @end example
  2395. @item
  2396. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2397. @example
  2398. ladspa=caps:Fractal:c=c1=1
  2399. @end example
  2400. @item
  2401. Dynamic volume normalization using @code{VLevel} plugin:
  2402. @example
  2403. ladspa=vlevel-ladspa:vlevel_mono
  2404. @end example
  2405. @end itemize
  2406. @subsection Commands
  2407. This filter supports the following commands:
  2408. @table @option
  2409. @item cN
  2410. Modify the @var{N}-th control value.
  2411. If the specified value is not valid, it is ignored and prior one is kept.
  2412. @end table
  2413. @section loudnorm
  2414. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2415. Support for both single pass (livestreams, files) and double pass (files) modes.
  2416. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2417. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2418. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2419. The filter accepts the following options:
  2420. @table @option
  2421. @item I, i
  2422. Set integrated loudness target.
  2423. Range is -70.0 - -5.0. Default value is -24.0.
  2424. @item LRA, lra
  2425. Set loudness range target.
  2426. Range is 1.0 - 20.0. Default value is 7.0.
  2427. @item TP, tp
  2428. Set maximum true peak.
  2429. Range is -9.0 - +0.0. Default value is -2.0.
  2430. @item measured_I, measured_i
  2431. Measured IL of input file.
  2432. Range is -99.0 - +0.0.
  2433. @item measured_LRA, measured_lra
  2434. Measured LRA of input file.
  2435. Range is 0.0 - 99.0.
  2436. @item measured_TP, measured_tp
  2437. Measured true peak of input file.
  2438. Range is -99.0 - +99.0.
  2439. @item measured_thresh
  2440. Measured threshold of input file.
  2441. Range is -99.0 - +0.0.
  2442. @item offset
  2443. Set offset gain. Gain is applied before the true-peak limiter.
  2444. Range is -99.0 - +99.0. Default is +0.0.
  2445. @item linear
  2446. Normalize linearly if possible.
  2447. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2448. to be specified in order to use this mode.
  2449. Options are true or false. Default is true.
  2450. @item dual_mono
  2451. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2452. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2453. If set to @code{true}, this option will compensate for this effect.
  2454. Multi-channel input files are not affected by this option.
  2455. Options are true or false. Default is false.
  2456. @item print_format
  2457. Set print format for stats. Options are summary, json, or none.
  2458. Default value is none.
  2459. @end table
  2460. @section lowpass
  2461. Apply a low-pass filter with 3dB point frequency.
  2462. The filter can be either single-pole or double-pole (the default).
  2463. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2464. The filter accepts the following options:
  2465. @table @option
  2466. @item frequency, f
  2467. Set frequency in Hz. Default is 500.
  2468. @item poles, p
  2469. Set number of poles. Default is 2.
  2470. @item width_type, t
  2471. Set method to specify band-width of filter.
  2472. @table @option
  2473. @item h
  2474. Hz
  2475. @item q
  2476. Q-Factor
  2477. @item o
  2478. octave
  2479. @item s
  2480. slope
  2481. @end table
  2482. @item width, w
  2483. Specify the band-width of a filter in width_type units.
  2484. Applies only to double-pole filter.
  2485. The default is 0.707q and gives a Butterworth response.
  2486. @item channels, c
  2487. Specify which channels to filter, by default all available are filtered.
  2488. @end table
  2489. @subsection Examples
  2490. @itemize
  2491. @item
  2492. Lowpass only LFE channel, it LFE is not present it does nothing:
  2493. @example
  2494. lowpass=c=LFE
  2495. @end example
  2496. @end itemize
  2497. @anchor{pan}
  2498. @section pan
  2499. Mix channels with specific gain levels. The filter accepts the output
  2500. channel layout followed by a set of channels definitions.
  2501. This filter is also designed to efficiently remap the channels of an audio
  2502. stream.
  2503. The filter accepts parameters of the form:
  2504. "@var{l}|@var{outdef}|@var{outdef}|..."
  2505. @table @option
  2506. @item l
  2507. output channel layout or number of channels
  2508. @item outdef
  2509. output channel specification, of the form:
  2510. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2511. @item out_name
  2512. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2513. number (c0, c1, etc.)
  2514. @item gain
  2515. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2516. @item in_name
  2517. input channel to use, see out_name for details; it is not possible to mix
  2518. named and numbered input channels
  2519. @end table
  2520. If the `=' in a channel specification is replaced by `<', then the gains for
  2521. that specification will be renormalized so that the total is 1, thus
  2522. avoiding clipping noise.
  2523. @subsection Mixing examples
  2524. For example, if you want to down-mix from stereo to mono, but with a bigger
  2525. factor for the left channel:
  2526. @example
  2527. pan=1c|c0=0.9*c0+0.1*c1
  2528. @end example
  2529. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2530. 7-channels surround:
  2531. @example
  2532. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2533. @end example
  2534. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2535. that should be preferred (see "-ac" option) unless you have very specific
  2536. needs.
  2537. @subsection Remapping examples
  2538. The channel remapping will be effective if, and only if:
  2539. @itemize
  2540. @item gain coefficients are zeroes or ones,
  2541. @item only one input per channel output,
  2542. @end itemize
  2543. If all these conditions are satisfied, the filter will notify the user ("Pure
  2544. channel mapping detected"), and use an optimized and lossless method to do the
  2545. remapping.
  2546. For example, if you have a 5.1 source and want a stereo audio stream by
  2547. dropping the extra channels:
  2548. @example
  2549. pan="stereo| c0=FL | c1=FR"
  2550. @end example
  2551. Given the same source, you can also switch front left and front right channels
  2552. and keep the input channel layout:
  2553. @example
  2554. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2555. @end example
  2556. If the input is a stereo audio stream, you can mute the front left channel (and
  2557. still keep the stereo channel layout) with:
  2558. @example
  2559. pan="stereo|c1=c1"
  2560. @end example
  2561. Still with a stereo audio stream input, you can copy the right channel in both
  2562. front left and right:
  2563. @example
  2564. pan="stereo| c0=FR | c1=FR"
  2565. @end example
  2566. @section replaygain
  2567. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2568. outputs it unchanged.
  2569. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2570. @section resample
  2571. Convert the audio sample format, sample rate and channel layout. It is
  2572. not meant to be used directly.
  2573. @section rubberband
  2574. Apply time-stretching and pitch-shifting with librubberband.
  2575. The filter accepts the following options:
  2576. @table @option
  2577. @item tempo
  2578. Set tempo scale factor.
  2579. @item pitch
  2580. Set pitch scale factor.
  2581. @item transients
  2582. Set transients detector.
  2583. Possible values are:
  2584. @table @var
  2585. @item crisp
  2586. @item mixed
  2587. @item smooth
  2588. @end table
  2589. @item detector
  2590. Set detector.
  2591. Possible values are:
  2592. @table @var
  2593. @item compound
  2594. @item percussive
  2595. @item soft
  2596. @end table
  2597. @item phase
  2598. Set phase.
  2599. Possible values are:
  2600. @table @var
  2601. @item laminar
  2602. @item independent
  2603. @end table
  2604. @item window
  2605. Set processing window size.
  2606. Possible values are:
  2607. @table @var
  2608. @item standard
  2609. @item short
  2610. @item long
  2611. @end table
  2612. @item smoothing
  2613. Set smoothing.
  2614. Possible values are:
  2615. @table @var
  2616. @item off
  2617. @item on
  2618. @end table
  2619. @item formant
  2620. Enable formant preservation when shift pitching.
  2621. Possible values are:
  2622. @table @var
  2623. @item shifted
  2624. @item preserved
  2625. @end table
  2626. @item pitchq
  2627. Set pitch quality.
  2628. Possible values are:
  2629. @table @var
  2630. @item quality
  2631. @item speed
  2632. @item consistency
  2633. @end table
  2634. @item channels
  2635. Set channels.
  2636. Possible values are:
  2637. @table @var
  2638. @item apart
  2639. @item together
  2640. @end table
  2641. @end table
  2642. @section sidechaincompress
  2643. This filter acts like normal compressor but has the ability to compress
  2644. detected signal using second input signal.
  2645. It needs two input streams and returns one output stream.
  2646. First input stream will be processed depending on second stream signal.
  2647. The filtered signal then can be filtered with other filters in later stages of
  2648. processing. See @ref{pan} and @ref{amerge} filter.
  2649. The filter accepts the following options:
  2650. @table @option
  2651. @item level_in
  2652. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2653. @item threshold
  2654. If a signal of second stream raises above this level it will affect the gain
  2655. reduction of first stream.
  2656. By default is 0.125. Range is between 0.00097563 and 1.
  2657. @item ratio
  2658. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2659. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2660. Default is 2. Range is between 1 and 20.
  2661. @item attack
  2662. Amount of milliseconds the signal has to rise above the threshold before gain
  2663. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2664. @item release
  2665. Amount of milliseconds the signal has to fall below the threshold before
  2666. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2667. @item makeup
  2668. Set the amount by how much signal will be amplified after processing.
  2669. Default is 1. Range is from 1 to 64.
  2670. @item knee
  2671. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2672. Default is 2.82843. Range is between 1 and 8.
  2673. @item link
  2674. Choose if the @code{average} level between all channels of side-chain stream
  2675. or the louder(@code{maximum}) channel of side-chain stream affects the
  2676. reduction. Default is @code{average}.
  2677. @item detection
  2678. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2679. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2680. @item level_sc
  2681. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2682. @item mix
  2683. How much to use compressed signal in output. Default is 1.
  2684. Range is between 0 and 1.
  2685. @end table
  2686. @subsection Examples
  2687. @itemize
  2688. @item
  2689. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2690. depending on the signal of 2nd input and later compressed signal to be
  2691. merged with 2nd input:
  2692. @example
  2693. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2694. @end example
  2695. @end itemize
  2696. @section sidechaingate
  2697. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2698. filter the detected signal before sending it to the gain reduction stage.
  2699. Normally a gate uses the full range signal to detect a level above the
  2700. threshold.
  2701. For example: If you cut all lower frequencies from your sidechain signal
  2702. the gate will decrease the volume of your track only if not enough highs
  2703. appear. With this technique you are able to reduce the resonation of a
  2704. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2705. guitar.
  2706. It needs two input streams and returns one output stream.
  2707. First input stream will be processed depending on second stream signal.
  2708. The filter accepts the following options:
  2709. @table @option
  2710. @item level_in
  2711. Set input level before filtering.
  2712. Default is 1. Allowed range is from 0.015625 to 64.
  2713. @item range
  2714. Set the level of gain reduction when the signal is below the threshold.
  2715. Default is 0.06125. Allowed range is from 0 to 1.
  2716. @item threshold
  2717. If a signal rises above this level the gain reduction is released.
  2718. Default is 0.125. Allowed range is from 0 to 1.
  2719. @item ratio
  2720. Set a ratio about which the signal is reduced.
  2721. Default is 2. Allowed range is from 1 to 9000.
  2722. @item attack
  2723. Amount of milliseconds the signal has to rise above the threshold before gain
  2724. reduction stops.
  2725. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2726. @item release
  2727. Amount of milliseconds the signal has to fall below the threshold before the
  2728. reduction is increased again. Default is 250 milliseconds.
  2729. Allowed range is from 0.01 to 9000.
  2730. @item makeup
  2731. Set amount of amplification of signal after processing.
  2732. Default is 1. Allowed range is from 1 to 64.
  2733. @item knee
  2734. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2735. Default is 2.828427125. Allowed range is from 1 to 8.
  2736. @item detection
  2737. Choose if exact signal should be taken for detection or an RMS like one.
  2738. Default is rms. Can be peak or rms.
  2739. @item link
  2740. Choose if the average level between all channels or the louder channel affects
  2741. the reduction.
  2742. Default is average. Can be average or maximum.
  2743. @item level_sc
  2744. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2745. @end table
  2746. @section silencedetect
  2747. Detect silence in an audio stream.
  2748. This filter logs a message when it detects that the input audio volume is less
  2749. or equal to a noise tolerance value for a duration greater or equal to the
  2750. minimum detected noise duration.
  2751. The printed times and duration are expressed in seconds.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item duration, d
  2755. Set silence duration until notification (default is 2 seconds).
  2756. @item noise, n
  2757. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2758. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2759. @end table
  2760. @subsection Examples
  2761. @itemize
  2762. @item
  2763. Detect 5 seconds of silence with -50dB noise tolerance:
  2764. @example
  2765. silencedetect=n=-50dB:d=5
  2766. @end example
  2767. @item
  2768. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2769. tolerance in @file{silence.mp3}:
  2770. @example
  2771. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2772. @end example
  2773. @end itemize
  2774. @section silenceremove
  2775. Remove silence from the beginning, middle or end of the audio.
  2776. The filter accepts the following options:
  2777. @table @option
  2778. @item start_periods
  2779. This value is used to indicate if audio should be trimmed at beginning of
  2780. the audio. A value of zero indicates no silence should be trimmed from the
  2781. beginning. When specifying a non-zero value, it trims audio up until it
  2782. finds non-silence. Normally, when trimming silence from beginning of audio
  2783. the @var{start_periods} will be @code{1} but it can be increased to higher
  2784. values to trim all audio up to specific count of non-silence periods.
  2785. Default value is @code{0}.
  2786. @item start_duration
  2787. Specify the amount of time that non-silence must be detected before it stops
  2788. trimming audio. By increasing the duration, bursts of noises can be treated
  2789. as silence and trimmed off. Default value is @code{0}.
  2790. @item start_threshold
  2791. This indicates what sample value should be treated as silence. For digital
  2792. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2793. you may wish to increase the value to account for background noise.
  2794. Can be specified in dB (in case "dB" is appended to the specified value)
  2795. or amplitude ratio. Default value is @code{0}.
  2796. @item stop_periods
  2797. Set the count for trimming silence from the end of audio.
  2798. To remove silence from the middle of a file, specify a @var{stop_periods}
  2799. that is negative. This value is then treated as a positive value and is
  2800. used to indicate the effect should restart processing as specified by
  2801. @var{start_periods}, making it suitable for removing periods of silence
  2802. in the middle of the audio.
  2803. Default value is @code{0}.
  2804. @item stop_duration
  2805. Specify a duration of silence that must exist before audio is not copied any
  2806. more. By specifying a higher duration, silence that is wanted can be left in
  2807. the audio.
  2808. Default value is @code{0}.
  2809. @item stop_threshold
  2810. This is the same as @option{start_threshold} but for trimming silence from
  2811. the end of audio.
  2812. Can be specified in dB (in case "dB" is appended to the specified value)
  2813. or amplitude ratio. Default value is @code{0}.
  2814. @item leave_silence
  2815. This indicates that @var{stop_duration} length of audio should be left intact
  2816. at the beginning of each period of silence.
  2817. For example, if you want to remove long pauses between words but do not want
  2818. to remove the pauses completely. Default value is @code{0}.
  2819. @item detection
  2820. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2821. and works better with digital silence which is exactly 0.
  2822. Default value is @code{rms}.
  2823. @item window
  2824. Set ratio used to calculate size of window for detecting silence.
  2825. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2826. @end table
  2827. @subsection Examples
  2828. @itemize
  2829. @item
  2830. The following example shows how this filter can be used to start a recording
  2831. that does not contain the delay at the start which usually occurs between
  2832. pressing the record button and the start of the performance:
  2833. @example
  2834. silenceremove=1:5:0.02
  2835. @end example
  2836. @item
  2837. Trim all silence encountered from beginning to end where there is more than 1
  2838. second of silence in audio:
  2839. @example
  2840. silenceremove=0:0:0:-1:1:-90dB
  2841. @end example
  2842. @end itemize
  2843. @section sofalizer
  2844. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2845. loudspeakers around the user for binaural listening via headphones (audio
  2846. formats up to 9 channels supported).
  2847. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2848. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2849. Austrian Academy of Sciences.
  2850. To enable compilation of this filter you need to configure FFmpeg with
  2851. @code{--enable-libmysofa}.
  2852. The filter accepts the following options:
  2853. @table @option
  2854. @item sofa
  2855. Set the SOFA file used for rendering.
  2856. @item gain
  2857. Set gain applied to audio. Value is in dB. Default is 0.
  2858. @item rotation
  2859. Set rotation of virtual loudspeakers in deg. Default is 0.
  2860. @item elevation
  2861. Set elevation of virtual speakers in deg. Default is 0.
  2862. @item radius
  2863. Set distance in meters between loudspeakers and the listener with near-field
  2864. HRTFs. Default is 1.
  2865. @item type
  2866. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2867. processing audio in time domain which is slow.
  2868. @var{freq} is processing audio in frequency domain which is fast.
  2869. Default is @var{freq}.
  2870. @item speakers
  2871. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2872. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2873. Each virtual loudspeaker is described with short channel name following with
  2874. azimuth and elevation in degreees.
  2875. Each virtual loudspeaker description is separated by '|'.
  2876. For example to override front left and front right channel positions use:
  2877. 'speakers=FL 45 15|FR 345 15'.
  2878. Descriptions with unrecognised channel names are ignored.
  2879. @item lfegain
  2880. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2881. @end table
  2882. @subsection Examples
  2883. @itemize
  2884. @item
  2885. Using ClubFritz6 sofa file:
  2886. @example
  2887. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2888. @end example
  2889. @item
  2890. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2891. @example
  2892. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2893. @end example
  2894. @item
  2895. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2896. and also with custom gain:
  2897. @example
  2898. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2899. @end example
  2900. @end itemize
  2901. @section stereotools
  2902. This filter has some handy utilities to manage stereo signals, for converting
  2903. M/S stereo recordings to L/R signal while having control over the parameters
  2904. or spreading the stereo image of master track.
  2905. The filter accepts the following options:
  2906. @table @option
  2907. @item level_in
  2908. Set input level before filtering for both channels. Defaults is 1.
  2909. Allowed range is from 0.015625 to 64.
  2910. @item level_out
  2911. Set output level after filtering for both channels. Defaults is 1.
  2912. Allowed range is from 0.015625 to 64.
  2913. @item balance_in
  2914. Set input balance between both channels. Default is 0.
  2915. Allowed range is from -1 to 1.
  2916. @item balance_out
  2917. Set output balance between both channels. Default is 0.
  2918. Allowed range is from -1 to 1.
  2919. @item softclip
  2920. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2921. clipping. Disabled by default.
  2922. @item mutel
  2923. Mute the left channel. Disabled by default.
  2924. @item muter
  2925. Mute the right channel. Disabled by default.
  2926. @item phasel
  2927. Change the phase of the left channel. Disabled by default.
  2928. @item phaser
  2929. Change the phase of the right channel. Disabled by default.
  2930. @item mode
  2931. Set stereo mode. Available values are:
  2932. @table @samp
  2933. @item lr>lr
  2934. Left/Right to Left/Right, this is default.
  2935. @item lr>ms
  2936. Left/Right to Mid/Side.
  2937. @item ms>lr
  2938. Mid/Side to Left/Right.
  2939. @item lr>ll
  2940. Left/Right to Left/Left.
  2941. @item lr>rr
  2942. Left/Right to Right/Right.
  2943. @item lr>l+r
  2944. Left/Right to Left + Right.
  2945. @item lr>rl
  2946. Left/Right to Right/Left.
  2947. @item ms>ll
  2948. Mid/Side to Left/Left.
  2949. @item ms>rr
  2950. Mid/Side to Right/Right.
  2951. @end table
  2952. @item slev
  2953. Set level of side signal. Default is 1.
  2954. Allowed range is from 0.015625 to 64.
  2955. @item sbal
  2956. Set balance of side signal. Default is 0.
  2957. Allowed range is from -1 to 1.
  2958. @item mlev
  2959. Set level of the middle signal. Default is 1.
  2960. Allowed range is from 0.015625 to 64.
  2961. @item mpan
  2962. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2963. @item base
  2964. Set stereo base between mono and inversed channels. Default is 0.
  2965. Allowed range is from -1 to 1.
  2966. @item delay
  2967. Set delay in milliseconds how much to delay left from right channel and
  2968. vice versa. Default is 0. Allowed range is from -20 to 20.
  2969. @item sclevel
  2970. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2971. @item phase
  2972. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2973. @item bmode_in, bmode_out
  2974. Set balance mode for balance_in/balance_out option.
  2975. Can be one of the following:
  2976. @table @samp
  2977. @item balance
  2978. Classic balance mode. Attenuate one channel at time.
  2979. Gain is raised up to 1.
  2980. @item amplitude
  2981. Similar as classic mode above but gain is raised up to 2.
  2982. @item power
  2983. Equal power distribution, from -6dB to +6dB range.
  2984. @end table
  2985. @end table
  2986. @subsection Examples
  2987. @itemize
  2988. @item
  2989. Apply karaoke like effect:
  2990. @example
  2991. stereotools=mlev=0.015625
  2992. @end example
  2993. @item
  2994. Convert M/S signal to L/R:
  2995. @example
  2996. "stereotools=mode=ms>lr"
  2997. @end example
  2998. @end itemize
  2999. @section stereowiden
  3000. This filter enhance the stereo effect by suppressing signal common to both
  3001. channels and by delaying the signal of left into right and vice versa,
  3002. thereby widening the stereo effect.
  3003. The filter accepts the following options:
  3004. @table @option
  3005. @item delay
  3006. Time in milliseconds of the delay of left signal into right and vice versa.
  3007. Default is 20 milliseconds.
  3008. @item feedback
  3009. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3010. effect of left signal in right output and vice versa which gives widening
  3011. effect. Default is 0.3.
  3012. @item crossfeed
  3013. Cross feed of left into right with inverted phase. This helps in suppressing
  3014. the mono. If the value is 1 it will cancel all the signal common to both
  3015. channels. Default is 0.3.
  3016. @item drymix
  3017. Set level of input signal of original channel. Default is 0.8.
  3018. @end table
  3019. @section superequalizer
  3020. Apply 18 band equalizer.
  3021. The filter accepts the following options:
  3022. @table @option
  3023. @item 1b
  3024. Set 65Hz band gain.
  3025. @item 2b
  3026. Set 92Hz band gain.
  3027. @item 3b
  3028. Set 131Hz band gain.
  3029. @item 4b
  3030. Set 185Hz band gain.
  3031. @item 5b
  3032. Set 262Hz band gain.
  3033. @item 6b
  3034. Set 370Hz band gain.
  3035. @item 7b
  3036. Set 523Hz band gain.
  3037. @item 8b
  3038. Set 740Hz band gain.
  3039. @item 9b
  3040. Set 1047Hz band gain.
  3041. @item 10b
  3042. Set 1480Hz band gain.
  3043. @item 11b
  3044. Set 2093Hz band gain.
  3045. @item 12b
  3046. Set 2960Hz band gain.
  3047. @item 13b
  3048. Set 4186Hz band gain.
  3049. @item 14b
  3050. Set 5920Hz band gain.
  3051. @item 15b
  3052. Set 8372Hz band gain.
  3053. @item 16b
  3054. Set 11840Hz band gain.
  3055. @item 17b
  3056. Set 16744Hz band gain.
  3057. @item 18b
  3058. Set 20000Hz band gain.
  3059. @end table
  3060. @section surround
  3061. Apply audio surround upmix filter.
  3062. This filter allows to produce multichannel output from audio stream.
  3063. The filter accepts the following options:
  3064. @table @option
  3065. @item chl_out
  3066. Set output channel layout. By default, this is @var{5.1}.
  3067. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3068. for the required syntax.
  3069. @item chl_in
  3070. Set input channel layout. By default, this is @var{stereo}.
  3071. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3072. for the required syntax.
  3073. @item level_in
  3074. Set input volume level. By default, this is @var{1}.
  3075. @item level_out
  3076. Set output volume level. By default, this is @var{1}.
  3077. @item lfe
  3078. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3079. @item lfe_low
  3080. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3081. @item lfe_high
  3082. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3083. @item fc_in
  3084. Set front center input volume. By default, this is @var{1}.
  3085. @item fc_out
  3086. Set front center output volume. By default, this is @var{1}.
  3087. @item lfe_in
  3088. Set LFE input volume. By default, this is @var{1}.
  3089. @item lfe_out
  3090. Set LFE output volume. By default, this is @var{1}.
  3091. @end table
  3092. @section treble
  3093. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3094. shelving filter with a response similar to that of a standard
  3095. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3096. The filter accepts the following options:
  3097. @table @option
  3098. @item gain, g
  3099. Give the gain at whichever is the lower of ~22 kHz and the
  3100. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3101. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3102. @item frequency, f
  3103. Set the filter's central frequency and so can be used
  3104. to extend or reduce the frequency range to be boosted or cut.
  3105. The default value is @code{3000} Hz.
  3106. @item width_type, t
  3107. Set method to specify band-width of filter.
  3108. @table @option
  3109. @item h
  3110. Hz
  3111. @item q
  3112. Q-Factor
  3113. @item o
  3114. octave
  3115. @item s
  3116. slope
  3117. @end table
  3118. @item width, w
  3119. Determine how steep is the filter's shelf transition.
  3120. @item channels, c
  3121. Specify which channels to filter, by default all available are filtered.
  3122. @end table
  3123. @section tremolo
  3124. Sinusoidal amplitude modulation.
  3125. The filter accepts the following options:
  3126. @table @option
  3127. @item f
  3128. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3129. (20 Hz or lower) will result in a tremolo effect.
  3130. This filter may also be used as a ring modulator by specifying
  3131. a modulation frequency higher than 20 Hz.
  3132. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3133. @item d
  3134. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3135. Default value is 0.5.
  3136. @end table
  3137. @section vibrato
  3138. Sinusoidal phase modulation.
  3139. The filter accepts the following options:
  3140. @table @option
  3141. @item f
  3142. Modulation frequency in Hertz.
  3143. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3144. @item d
  3145. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3146. Default value is 0.5.
  3147. @end table
  3148. @section volume
  3149. Adjust the input audio volume.
  3150. It accepts the following parameters:
  3151. @table @option
  3152. @item volume
  3153. Set audio volume expression.
  3154. Output values are clipped to the maximum value.
  3155. The output audio volume is given by the relation:
  3156. @example
  3157. @var{output_volume} = @var{volume} * @var{input_volume}
  3158. @end example
  3159. The default value for @var{volume} is "1.0".
  3160. @item precision
  3161. This parameter represents the mathematical precision.
  3162. It determines which input sample formats will be allowed, which affects the
  3163. precision of the volume scaling.
  3164. @table @option
  3165. @item fixed
  3166. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3167. @item float
  3168. 32-bit floating-point; this limits input sample format to FLT. (default)
  3169. @item double
  3170. 64-bit floating-point; this limits input sample format to DBL.
  3171. @end table
  3172. @item replaygain
  3173. Choose the behaviour on encountering ReplayGain side data in input frames.
  3174. @table @option
  3175. @item drop
  3176. Remove ReplayGain side data, ignoring its contents (the default).
  3177. @item ignore
  3178. Ignore ReplayGain side data, but leave it in the frame.
  3179. @item track
  3180. Prefer the track gain, if present.
  3181. @item album
  3182. Prefer the album gain, if present.
  3183. @end table
  3184. @item replaygain_preamp
  3185. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3186. Default value for @var{replaygain_preamp} is 0.0.
  3187. @item eval
  3188. Set when the volume expression is evaluated.
  3189. It accepts the following values:
  3190. @table @samp
  3191. @item once
  3192. only evaluate expression once during the filter initialization, or
  3193. when the @samp{volume} command is sent
  3194. @item frame
  3195. evaluate expression for each incoming frame
  3196. @end table
  3197. Default value is @samp{once}.
  3198. @end table
  3199. The volume expression can contain the following parameters.
  3200. @table @option
  3201. @item n
  3202. frame number (starting at zero)
  3203. @item nb_channels
  3204. number of channels
  3205. @item nb_consumed_samples
  3206. number of samples consumed by the filter
  3207. @item nb_samples
  3208. number of samples in the current frame
  3209. @item pos
  3210. original frame position in the file
  3211. @item pts
  3212. frame PTS
  3213. @item sample_rate
  3214. sample rate
  3215. @item startpts
  3216. PTS at start of stream
  3217. @item startt
  3218. time at start of stream
  3219. @item t
  3220. frame time
  3221. @item tb
  3222. timestamp timebase
  3223. @item volume
  3224. last set volume value
  3225. @end table
  3226. Note that when @option{eval} is set to @samp{once} only the
  3227. @var{sample_rate} and @var{tb} variables are available, all other
  3228. variables will evaluate to NAN.
  3229. @subsection Commands
  3230. This filter supports the following commands:
  3231. @table @option
  3232. @item volume
  3233. Modify the volume expression.
  3234. The command accepts the same syntax of the corresponding option.
  3235. If the specified expression is not valid, it is kept at its current
  3236. value.
  3237. @item replaygain_noclip
  3238. Prevent clipping by limiting the gain applied.
  3239. Default value for @var{replaygain_noclip} is 1.
  3240. @end table
  3241. @subsection Examples
  3242. @itemize
  3243. @item
  3244. Halve the input audio volume:
  3245. @example
  3246. volume=volume=0.5
  3247. volume=volume=1/2
  3248. volume=volume=-6.0206dB
  3249. @end example
  3250. In all the above example the named key for @option{volume} can be
  3251. omitted, for example like in:
  3252. @example
  3253. volume=0.5
  3254. @end example
  3255. @item
  3256. Increase input audio power by 6 decibels using fixed-point precision:
  3257. @example
  3258. volume=volume=6dB:precision=fixed
  3259. @end example
  3260. @item
  3261. Fade volume after time 10 with an annihilation period of 5 seconds:
  3262. @example
  3263. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3264. @end example
  3265. @end itemize
  3266. @section volumedetect
  3267. Detect the volume of the input video.
  3268. The filter has no parameters. The input is not modified. Statistics about
  3269. the volume will be printed in the log when the input stream end is reached.
  3270. In particular it will show the mean volume (root mean square), maximum
  3271. volume (on a per-sample basis), and the beginning of a histogram of the
  3272. registered volume values (from the maximum value to a cumulated 1/1000 of
  3273. the samples).
  3274. All volumes are in decibels relative to the maximum PCM value.
  3275. @subsection Examples
  3276. Here is an excerpt of the output:
  3277. @example
  3278. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3279. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3280. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3281. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3282. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3283. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3284. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3285. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3286. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3287. @end example
  3288. It means that:
  3289. @itemize
  3290. @item
  3291. The mean square energy is approximately -27 dB, or 10^-2.7.
  3292. @item
  3293. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3294. @item
  3295. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3296. @end itemize
  3297. In other words, raising the volume by +4 dB does not cause any clipping,
  3298. raising it by +5 dB causes clipping for 6 samples, etc.
  3299. @c man end AUDIO FILTERS
  3300. @chapter Audio Sources
  3301. @c man begin AUDIO SOURCES
  3302. Below is a description of the currently available audio sources.
  3303. @section abuffer
  3304. Buffer audio frames, and make them available to the filter chain.
  3305. This source is mainly intended for a programmatic use, in particular
  3306. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3307. It accepts the following parameters:
  3308. @table @option
  3309. @item time_base
  3310. The timebase which will be used for timestamps of submitted frames. It must be
  3311. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3312. @item sample_rate
  3313. The sample rate of the incoming audio buffers.
  3314. @item sample_fmt
  3315. The sample format of the incoming audio buffers.
  3316. Either a sample format name or its corresponding integer representation from
  3317. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3318. @item channel_layout
  3319. The channel layout of the incoming audio buffers.
  3320. Either a channel layout name from channel_layout_map in
  3321. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3322. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3323. @item channels
  3324. The number of channels of the incoming audio buffers.
  3325. If both @var{channels} and @var{channel_layout} are specified, then they
  3326. must be consistent.
  3327. @end table
  3328. @subsection Examples
  3329. @example
  3330. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3331. @end example
  3332. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3333. Since the sample format with name "s16p" corresponds to the number
  3334. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3335. equivalent to:
  3336. @example
  3337. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3338. @end example
  3339. @section aevalsrc
  3340. Generate an audio signal specified by an expression.
  3341. This source accepts in input one or more expressions (one for each
  3342. channel), which are evaluated and used to generate a corresponding
  3343. audio signal.
  3344. This source accepts the following options:
  3345. @table @option
  3346. @item exprs
  3347. Set the '|'-separated expressions list for each separate channel. In case the
  3348. @option{channel_layout} option is not specified, the selected channel layout
  3349. depends on the number of provided expressions. Otherwise the last
  3350. specified expression is applied to the remaining output channels.
  3351. @item channel_layout, c
  3352. Set the channel layout. The number of channels in the specified layout
  3353. must be equal to the number of specified expressions.
  3354. @item duration, d
  3355. Set the minimum duration of the sourced audio. See
  3356. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3357. for the accepted syntax.
  3358. Note that the resulting duration may be greater than the specified
  3359. duration, as the generated audio is always cut at the end of a
  3360. complete frame.
  3361. If not specified, or the expressed duration is negative, the audio is
  3362. supposed to be generated forever.
  3363. @item nb_samples, n
  3364. Set the number of samples per channel per each output frame,
  3365. default to 1024.
  3366. @item sample_rate, s
  3367. Specify the sample rate, default to 44100.
  3368. @end table
  3369. Each expression in @var{exprs} can contain the following constants:
  3370. @table @option
  3371. @item n
  3372. number of the evaluated sample, starting from 0
  3373. @item t
  3374. time of the evaluated sample expressed in seconds, starting from 0
  3375. @item s
  3376. sample rate
  3377. @end table
  3378. @subsection Examples
  3379. @itemize
  3380. @item
  3381. Generate silence:
  3382. @example
  3383. aevalsrc=0
  3384. @end example
  3385. @item
  3386. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3387. 8000 Hz:
  3388. @example
  3389. aevalsrc="sin(440*2*PI*t):s=8000"
  3390. @end example
  3391. @item
  3392. Generate a two channels signal, specify the channel layout (Front
  3393. Center + Back Center) explicitly:
  3394. @example
  3395. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3396. @end example
  3397. @item
  3398. Generate white noise:
  3399. @example
  3400. aevalsrc="-2+random(0)"
  3401. @end example
  3402. @item
  3403. Generate an amplitude modulated signal:
  3404. @example
  3405. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3406. @end example
  3407. @item
  3408. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3409. @example
  3410. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3411. @end example
  3412. @end itemize
  3413. @section anullsrc
  3414. The null audio source, return unprocessed audio frames. It is mainly useful
  3415. as a template and to be employed in analysis / debugging tools, or as
  3416. the source for filters which ignore the input data (for example the sox
  3417. synth filter).
  3418. This source accepts the following options:
  3419. @table @option
  3420. @item channel_layout, cl
  3421. Specifies the channel layout, and can be either an integer or a string
  3422. representing a channel layout. The default value of @var{channel_layout}
  3423. is "stereo".
  3424. Check the channel_layout_map definition in
  3425. @file{libavutil/channel_layout.c} for the mapping between strings and
  3426. channel layout values.
  3427. @item sample_rate, r
  3428. Specifies the sample rate, and defaults to 44100.
  3429. @item nb_samples, n
  3430. Set the number of samples per requested frames.
  3431. @end table
  3432. @subsection Examples
  3433. @itemize
  3434. @item
  3435. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3436. @example
  3437. anullsrc=r=48000:cl=4
  3438. @end example
  3439. @item
  3440. Do the same operation with a more obvious syntax:
  3441. @example
  3442. anullsrc=r=48000:cl=mono
  3443. @end example
  3444. @end itemize
  3445. All the parameters need to be explicitly defined.
  3446. @section flite
  3447. Synthesize a voice utterance using the libflite library.
  3448. To enable compilation of this filter you need to configure FFmpeg with
  3449. @code{--enable-libflite}.
  3450. Note that the flite library is not thread-safe.
  3451. The filter accepts the following options:
  3452. @table @option
  3453. @item list_voices
  3454. If set to 1, list the names of the available voices and exit
  3455. immediately. Default value is 0.
  3456. @item nb_samples, n
  3457. Set the maximum number of samples per frame. Default value is 512.
  3458. @item textfile
  3459. Set the filename containing the text to speak.
  3460. @item text
  3461. Set the text to speak.
  3462. @item voice, v
  3463. Set the voice to use for the speech synthesis. Default value is
  3464. @code{kal}. See also the @var{list_voices} option.
  3465. @end table
  3466. @subsection Examples
  3467. @itemize
  3468. @item
  3469. Read from file @file{speech.txt}, and synthesize the text using the
  3470. standard flite voice:
  3471. @example
  3472. flite=textfile=speech.txt
  3473. @end example
  3474. @item
  3475. Read the specified text selecting the @code{slt} voice:
  3476. @example
  3477. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3478. @end example
  3479. @item
  3480. Input text to ffmpeg:
  3481. @example
  3482. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3483. @end example
  3484. @item
  3485. Make @file{ffplay} speak the specified text, using @code{flite} and
  3486. the @code{lavfi} device:
  3487. @example
  3488. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3489. @end example
  3490. @end itemize
  3491. For more information about libflite, check:
  3492. @url{http://www.speech.cs.cmu.edu/flite/}
  3493. @section anoisesrc
  3494. Generate a noise audio signal.
  3495. The filter accepts the following options:
  3496. @table @option
  3497. @item sample_rate, r
  3498. Specify the sample rate. Default value is 48000 Hz.
  3499. @item amplitude, a
  3500. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3501. is 1.0.
  3502. @item duration, d
  3503. Specify the duration of the generated audio stream. Not specifying this option
  3504. results in noise with an infinite length.
  3505. @item color, colour, c
  3506. Specify the color of noise. Available noise colors are white, pink, brown,
  3507. blue and violet. Default color is white.
  3508. @item seed, s
  3509. Specify a value used to seed the PRNG.
  3510. @item nb_samples, n
  3511. Set the number of samples per each output frame, default is 1024.
  3512. @end table
  3513. @subsection Examples
  3514. @itemize
  3515. @item
  3516. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3517. @example
  3518. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3519. @end example
  3520. @end itemize
  3521. @section sine
  3522. Generate an audio signal made of a sine wave with amplitude 1/8.
  3523. The audio signal is bit-exact.
  3524. The filter accepts the following options:
  3525. @table @option
  3526. @item frequency, f
  3527. Set the carrier frequency. Default is 440 Hz.
  3528. @item beep_factor, b
  3529. Enable a periodic beep every second with frequency @var{beep_factor} times
  3530. the carrier frequency. Default is 0, meaning the beep is disabled.
  3531. @item sample_rate, r
  3532. Specify the sample rate, default is 44100.
  3533. @item duration, d
  3534. Specify the duration of the generated audio stream.
  3535. @item samples_per_frame
  3536. Set the number of samples per output frame.
  3537. The expression can contain the following constants:
  3538. @table @option
  3539. @item n
  3540. The (sequential) number of the output audio frame, starting from 0.
  3541. @item pts
  3542. The PTS (Presentation TimeStamp) of the output audio frame,
  3543. expressed in @var{TB} units.
  3544. @item t
  3545. The PTS of the output audio frame, expressed in seconds.
  3546. @item TB
  3547. The timebase of the output audio frames.
  3548. @end table
  3549. Default is @code{1024}.
  3550. @end table
  3551. @subsection Examples
  3552. @itemize
  3553. @item
  3554. Generate a simple 440 Hz sine wave:
  3555. @example
  3556. sine
  3557. @end example
  3558. @item
  3559. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3560. @example
  3561. sine=220:4:d=5
  3562. sine=f=220:b=4:d=5
  3563. sine=frequency=220:beep_factor=4:duration=5
  3564. @end example
  3565. @item
  3566. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3567. pattern:
  3568. @example
  3569. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3570. @end example
  3571. @end itemize
  3572. @c man end AUDIO SOURCES
  3573. @chapter Audio Sinks
  3574. @c man begin AUDIO SINKS
  3575. Below is a description of the currently available audio sinks.
  3576. @section abuffersink
  3577. Buffer audio frames, and make them available to the end of filter chain.
  3578. This sink is mainly intended for programmatic use, in particular
  3579. through the interface defined in @file{libavfilter/buffersink.h}
  3580. or the options system.
  3581. It accepts a pointer to an AVABufferSinkContext structure, which
  3582. defines the incoming buffers' formats, to be passed as the opaque
  3583. parameter to @code{avfilter_init_filter} for initialization.
  3584. @section anullsink
  3585. Null audio sink; do absolutely nothing with the input audio. It is
  3586. mainly useful as a template and for use in analysis / debugging
  3587. tools.
  3588. @c man end AUDIO SINKS
  3589. @chapter Video Filters
  3590. @c man begin VIDEO FILTERS
  3591. When you configure your FFmpeg build, you can disable any of the
  3592. existing filters using @code{--disable-filters}.
  3593. The configure output will show the video filters included in your
  3594. build.
  3595. Below is a description of the currently available video filters.
  3596. @section alphaextract
  3597. Extract the alpha component from the input as a grayscale video. This
  3598. is especially useful with the @var{alphamerge} filter.
  3599. @section alphamerge
  3600. Add or replace the alpha component of the primary input with the
  3601. grayscale value of a second input. This is intended for use with
  3602. @var{alphaextract} to allow the transmission or storage of frame
  3603. sequences that have alpha in a format that doesn't support an alpha
  3604. channel.
  3605. For example, to reconstruct full frames from a normal YUV-encoded video
  3606. and a separate video created with @var{alphaextract}, you might use:
  3607. @example
  3608. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3609. @end example
  3610. Since this filter is designed for reconstruction, it operates on frame
  3611. sequences without considering timestamps, and terminates when either
  3612. input reaches end of stream. This will cause problems if your encoding
  3613. pipeline drops frames. If you're trying to apply an image as an
  3614. overlay to a video stream, consider the @var{overlay} filter instead.
  3615. @section ass
  3616. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3617. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3618. Substation Alpha) subtitles files.
  3619. This filter accepts the following option in addition to the common options from
  3620. the @ref{subtitles} filter:
  3621. @table @option
  3622. @item shaping
  3623. Set the shaping engine
  3624. Available values are:
  3625. @table @samp
  3626. @item auto
  3627. The default libass shaping engine, which is the best available.
  3628. @item simple
  3629. Fast, font-agnostic shaper that can do only substitutions
  3630. @item complex
  3631. Slower shaper using OpenType for substitutions and positioning
  3632. @end table
  3633. The default is @code{auto}.
  3634. @end table
  3635. @section atadenoise
  3636. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3637. The filter accepts the following options:
  3638. @table @option
  3639. @item 0a
  3640. Set threshold A for 1st plane. Default is 0.02.
  3641. Valid range is 0 to 0.3.
  3642. @item 0b
  3643. Set threshold B for 1st plane. Default is 0.04.
  3644. Valid range is 0 to 5.
  3645. @item 1a
  3646. Set threshold A for 2nd plane. Default is 0.02.
  3647. Valid range is 0 to 0.3.
  3648. @item 1b
  3649. Set threshold B for 2nd plane. Default is 0.04.
  3650. Valid range is 0 to 5.
  3651. @item 2a
  3652. Set threshold A for 3rd plane. Default is 0.02.
  3653. Valid range is 0 to 0.3.
  3654. @item 2b
  3655. Set threshold B for 3rd plane. Default is 0.04.
  3656. Valid range is 0 to 5.
  3657. Threshold A is designed to react on abrupt changes in the input signal and
  3658. threshold B is designed to react on continuous changes in the input signal.
  3659. @item s
  3660. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3661. number in range [5, 129].
  3662. @item p
  3663. Set what planes of frame filter will use for averaging. Default is all.
  3664. @end table
  3665. @section avgblur
  3666. Apply average blur filter.
  3667. The filter accepts the following options:
  3668. @table @option
  3669. @item sizeX
  3670. Set horizontal kernel size.
  3671. @item planes
  3672. Set which planes to filter. By default all planes are filtered.
  3673. @item sizeY
  3674. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3675. Default is @code{0}.
  3676. @end table
  3677. @section bbox
  3678. Compute the bounding box for the non-black pixels in the input frame
  3679. luminance plane.
  3680. This filter computes the bounding box containing all the pixels with a
  3681. luminance value greater than the minimum allowed value.
  3682. The parameters describing the bounding box are printed on the filter
  3683. log.
  3684. The filter accepts the following option:
  3685. @table @option
  3686. @item min_val
  3687. Set the minimal luminance value. Default is @code{16}.
  3688. @end table
  3689. @section bitplanenoise
  3690. Show and measure bit plane noise.
  3691. The filter accepts the following options:
  3692. @table @option
  3693. @item bitplane
  3694. Set which plane to analyze. Default is @code{1}.
  3695. @item filter
  3696. Filter out noisy pixels from @code{bitplane} set above.
  3697. Default is disabled.
  3698. @end table
  3699. @section blackdetect
  3700. Detect video intervals that are (almost) completely black. Can be
  3701. useful to detect chapter transitions, commercials, or invalid
  3702. recordings. Output lines contains the time for the start, end and
  3703. duration of the detected black interval expressed in seconds.
  3704. In order to display the output lines, you need to set the loglevel at
  3705. least to the AV_LOG_INFO value.
  3706. The filter accepts the following options:
  3707. @table @option
  3708. @item black_min_duration, d
  3709. Set the minimum detected black duration expressed in seconds. It must
  3710. be a non-negative floating point number.
  3711. Default value is 2.0.
  3712. @item picture_black_ratio_th, pic_th
  3713. Set the threshold for considering a picture "black".
  3714. Express the minimum value for the ratio:
  3715. @example
  3716. @var{nb_black_pixels} / @var{nb_pixels}
  3717. @end example
  3718. for which a picture is considered black.
  3719. Default value is 0.98.
  3720. @item pixel_black_th, pix_th
  3721. Set the threshold for considering a pixel "black".
  3722. The threshold expresses the maximum pixel luminance value for which a
  3723. pixel is considered "black". The provided value is scaled according to
  3724. the following equation:
  3725. @example
  3726. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3727. @end example
  3728. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3729. the input video format, the range is [0-255] for YUV full-range
  3730. formats and [16-235] for YUV non full-range formats.
  3731. Default value is 0.10.
  3732. @end table
  3733. The following example sets the maximum pixel threshold to the minimum
  3734. value, and detects only black intervals of 2 or more seconds:
  3735. @example
  3736. blackdetect=d=2:pix_th=0.00
  3737. @end example
  3738. @section blackframe
  3739. Detect frames that are (almost) completely black. Can be useful to
  3740. detect chapter transitions or commercials. Output lines consist of
  3741. the frame number of the detected frame, the percentage of blackness,
  3742. the position in the file if known or -1 and the timestamp in seconds.
  3743. In order to display the output lines, you need to set the loglevel at
  3744. least to the AV_LOG_INFO value.
  3745. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3746. The value represents the percentage of pixels in the picture that
  3747. are below the threshold value.
  3748. It accepts the following parameters:
  3749. @table @option
  3750. @item amount
  3751. The percentage of the pixels that have to be below the threshold; it defaults to
  3752. @code{98}.
  3753. @item threshold, thresh
  3754. The threshold below which a pixel value is considered black; it defaults to
  3755. @code{32}.
  3756. @end table
  3757. @section blend, tblend
  3758. Blend two video frames into each other.
  3759. The @code{blend} filter takes two input streams and outputs one
  3760. stream, the first input is the "top" layer and second input is
  3761. "bottom" layer. By default, the output terminates when the longest input terminates.
  3762. The @code{tblend} (time blend) filter takes two consecutive frames
  3763. from one single stream, and outputs the result obtained by blending
  3764. the new frame on top of the old frame.
  3765. A description of the accepted options follows.
  3766. @table @option
  3767. @item c0_mode
  3768. @item c1_mode
  3769. @item c2_mode
  3770. @item c3_mode
  3771. @item all_mode
  3772. Set blend mode for specific pixel component or all pixel components in case
  3773. of @var{all_mode}. Default value is @code{normal}.
  3774. Available values for component modes are:
  3775. @table @samp
  3776. @item addition
  3777. @item grainmerge
  3778. @item and
  3779. @item average
  3780. @item burn
  3781. @item darken
  3782. @item difference
  3783. @item grainextract
  3784. @item divide
  3785. @item dodge
  3786. @item freeze
  3787. @item exclusion
  3788. @item extremity
  3789. @item glow
  3790. @item hardlight
  3791. @item hardmix
  3792. @item heat
  3793. @item lighten
  3794. @item linearlight
  3795. @item multiply
  3796. @item multiply128
  3797. @item negation
  3798. @item normal
  3799. @item or
  3800. @item overlay
  3801. @item phoenix
  3802. @item pinlight
  3803. @item reflect
  3804. @item screen
  3805. @item softlight
  3806. @item subtract
  3807. @item vividlight
  3808. @item xor
  3809. @end table
  3810. @item c0_opacity
  3811. @item c1_opacity
  3812. @item c2_opacity
  3813. @item c3_opacity
  3814. @item all_opacity
  3815. Set blend opacity for specific pixel component or all pixel components in case
  3816. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3817. @item c0_expr
  3818. @item c1_expr
  3819. @item c2_expr
  3820. @item c3_expr
  3821. @item all_expr
  3822. Set blend expression for specific pixel component or all pixel components in case
  3823. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3824. The expressions can use the following variables:
  3825. @table @option
  3826. @item N
  3827. The sequential number of the filtered frame, starting from @code{0}.
  3828. @item X
  3829. @item Y
  3830. the coordinates of the current sample
  3831. @item W
  3832. @item H
  3833. the width and height of currently filtered plane
  3834. @item SW
  3835. @item SH
  3836. Width and height scale depending on the currently filtered plane. It is the
  3837. ratio between the corresponding luma plane number of pixels and the current
  3838. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3839. @code{0.5,0.5} for chroma planes.
  3840. @item T
  3841. Time of the current frame, expressed in seconds.
  3842. @item TOP, A
  3843. Value of pixel component at current location for first video frame (top layer).
  3844. @item BOTTOM, B
  3845. Value of pixel component at current location for second video frame (bottom layer).
  3846. @end table
  3847. @item shortest
  3848. Force termination when the shortest input terminates. Default is
  3849. @code{0}. This option is only defined for the @code{blend} filter.
  3850. @item repeatlast
  3851. Continue applying the last bottom frame after the end of the stream. A value of
  3852. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3853. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3854. @end table
  3855. @subsection Examples
  3856. @itemize
  3857. @item
  3858. Apply transition from bottom layer to top layer in first 10 seconds:
  3859. @example
  3860. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3861. @end example
  3862. @item
  3863. Apply 1x1 checkerboard effect:
  3864. @example
  3865. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3866. @end example
  3867. @item
  3868. Apply uncover left effect:
  3869. @example
  3870. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3871. @end example
  3872. @item
  3873. Apply uncover down effect:
  3874. @example
  3875. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3876. @end example
  3877. @item
  3878. Apply uncover up-left effect:
  3879. @example
  3880. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3881. @end example
  3882. @item
  3883. Split diagonally video and shows top and bottom layer on each side:
  3884. @example
  3885. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3886. @end example
  3887. @item
  3888. Display differences between the current and the previous frame:
  3889. @example
  3890. tblend=all_mode=grainextract
  3891. @end example
  3892. @end itemize
  3893. @section boxblur
  3894. Apply a boxblur algorithm to the input video.
  3895. It accepts the following parameters:
  3896. @table @option
  3897. @item luma_radius, lr
  3898. @item luma_power, lp
  3899. @item chroma_radius, cr
  3900. @item chroma_power, cp
  3901. @item alpha_radius, ar
  3902. @item alpha_power, ap
  3903. @end table
  3904. A description of the accepted options follows.
  3905. @table @option
  3906. @item luma_radius, lr
  3907. @item chroma_radius, cr
  3908. @item alpha_radius, ar
  3909. Set an expression for the box radius in pixels used for blurring the
  3910. corresponding input plane.
  3911. The radius value must be a non-negative number, and must not be
  3912. greater than the value of the expression @code{min(w,h)/2} for the
  3913. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3914. planes.
  3915. Default value for @option{luma_radius} is "2". If not specified,
  3916. @option{chroma_radius} and @option{alpha_radius} default to the
  3917. corresponding value set for @option{luma_radius}.
  3918. The expressions can contain the following constants:
  3919. @table @option
  3920. @item w
  3921. @item h
  3922. The input width and height in pixels.
  3923. @item cw
  3924. @item ch
  3925. The input chroma image width and height in pixels.
  3926. @item hsub
  3927. @item vsub
  3928. The horizontal and vertical chroma subsample values. For example, for the
  3929. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3930. @end table
  3931. @item luma_power, lp
  3932. @item chroma_power, cp
  3933. @item alpha_power, ap
  3934. Specify how many times the boxblur filter is applied to the
  3935. corresponding plane.
  3936. Default value for @option{luma_power} is 2. If not specified,
  3937. @option{chroma_power} and @option{alpha_power} default to the
  3938. corresponding value set for @option{luma_power}.
  3939. A value of 0 will disable the effect.
  3940. @end table
  3941. @subsection Examples
  3942. @itemize
  3943. @item
  3944. Apply a boxblur filter with the luma, chroma, and alpha radii
  3945. set to 2:
  3946. @example
  3947. boxblur=luma_radius=2:luma_power=1
  3948. boxblur=2:1
  3949. @end example
  3950. @item
  3951. Set the luma radius to 2, and alpha and chroma radius to 0:
  3952. @example
  3953. boxblur=2:1:cr=0:ar=0
  3954. @end example
  3955. @item
  3956. Set the luma and chroma radii to a fraction of the video dimension:
  3957. @example
  3958. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3959. @end example
  3960. @end itemize
  3961. @section bwdif
  3962. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3963. Deinterlacing Filter").
  3964. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3965. interpolation algorithms.
  3966. It accepts the following parameters:
  3967. @table @option
  3968. @item mode
  3969. The interlacing mode to adopt. It accepts one of the following values:
  3970. @table @option
  3971. @item 0, send_frame
  3972. Output one frame for each frame.
  3973. @item 1, send_field
  3974. Output one frame for each field.
  3975. @end table
  3976. The default value is @code{send_field}.
  3977. @item parity
  3978. The picture field parity assumed for the input interlaced video. It accepts one
  3979. of the following values:
  3980. @table @option
  3981. @item 0, tff
  3982. Assume the top field is first.
  3983. @item 1, bff
  3984. Assume the bottom field is first.
  3985. @item -1, auto
  3986. Enable automatic detection of field parity.
  3987. @end table
  3988. The default value is @code{auto}.
  3989. If the interlacing is unknown or the decoder does not export this information,
  3990. top field first will be assumed.
  3991. @item deint
  3992. Specify which frames to deinterlace. Accept one of the following
  3993. values:
  3994. @table @option
  3995. @item 0, all
  3996. Deinterlace all frames.
  3997. @item 1, interlaced
  3998. Only deinterlace frames marked as interlaced.
  3999. @end table
  4000. The default value is @code{all}.
  4001. @end table
  4002. @section chromakey
  4003. YUV colorspace color/chroma keying.
  4004. The filter accepts the following options:
  4005. @table @option
  4006. @item color
  4007. The color which will be replaced with transparency.
  4008. @item similarity
  4009. Similarity percentage with the key color.
  4010. 0.01 matches only the exact key color, while 1.0 matches everything.
  4011. @item blend
  4012. Blend percentage.
  4013. 0.0 makes pixels either fully transparent, or not transparent at all.
  4014. Higher values result in semi-transparent pixels, with a higher transparency
  4015. the more similar the pixels color is to the key color.
  4016. @item yuv
  4017. Signals that the color passed is already in YUV instead of RGB.
  4018. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4019. This can be used to pass exact YUV values as hexadecimal numbers.
  4020. @end table
  4021. @subsection Examples
  4022. @itemize
  4023. @item
  4024. Make every green pixel in the input image transparent:
  4025. @example
  4026. ffmpeg -i input.png -vf chromakey=green out.png
  4027. @end example
  4028. @item
  4029. Overlay a greenscreen-video on top of a static black background.
  4030. @example
  4031. 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
  4032. @end example
  4033. @end itemize
  4034. @section ciescope
  4035. Display CIE color diagram with pixels overlaid onto it.
  4036. The filter accepts the following options:
  4037. @table @option
  4038. @item system
  4039. Set color system.
  4040. @table @samp
  4041. @item ntsc, 470m
  4042. @item ebu, 470bg
  4043. @item smpte
  4044. @item 240m
  4045. @item apple
  4046. @item widergb
  4047. @item cie1931
  4048. @item rec709, hdtv
  4049. @item uhdtv, rec2020
  4050. @end table
  4051. @item cie
  4052. Set CIE system.
  4053. @table @samp
  4054. @item xyy
  4055. @item ucs
  4056. @item luv
  4057. @end table
  4058. @item gamuts
  4059. Set what gamuts to draw.
  4060. See @code{system} option for available values.
  4061. @item size, s
  4062. Set ciescope size, by default set to 512.
  4063. @item intensity, i
  4064. Set intensity used to map input pixel values to CIE diagram.
  4065. @item contrast
  4066. Set contrast used to draw tongue colors that are out of active color system gamut.
  4067. @item corrgamma
  4068. Correct gamma displayed on scope, by default enabled.
  4069. @item showwhite
  4070. Show white point on CIE diagram, by default disabled.
  4071. @item gamma
  4072. Set input gamma. Used only with XYZ input color space.
  4073. @end table
  4074. @section codecview
  4075. Visualize information exported by some codecs.
  4076. Some codecs can export information through frames using side-data or other
  4077. means. For example, some MPEG based codecs export motion vectors through the
  4078. @var{export_mvs} flag in the codec @option{flags2} option.
  4079. The filter accepts the following option:
  4080. @table @option
  4081. @item mv
  4082. Set motion vectors to visualize.
  4083. Available flags for @var{mv} are:
  4084. @table @samp
  4085. @item pf
  4086. forward predicted MVs of P-frames
  4087. @item bf
  4088. forward predicted MVs of B-frames
  4089. @item bb
  4090. backward predicted MVs of B-frames
  4091. @end table
  4092. @item qp
  4093. Display quantization parameters using the chroma planes.
  4094. @item mv_type, mvt
  4095. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4096. Available flags for @var{mv_type} are:
  4097. @table @samp
  4098. @item fp
  4099. forward predicted MVs
  4100. @item bp
  4101. backward predicted MVs
  4102. @end table
  4103. @item frame_type, ft
  4104. Set frame type to visualize motion vectors of.
  4105. Available flags for @var{frame_type} are:
  4106. @table @samp
  4107. @item if
  4108. intra-coded frames (I-frames)
  4109. @item pf
  4110. predicted frames (P-frames)
  4111. @item bf
  4112. bi-directionally predicted frames (B-frames)
  4113. @end table
  4114. @end table
  4115. @subsection Examples
  4116. @itemize
  4117. @item
  4118. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4119. @example
  4120. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4121. @end example
  4122. @item
  4123. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4124. @example
  4125. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4126. @end example
  4127. @end itemize
  4128. @section colorbalance
  4129. Modify intensity of primary colors (red, green and blue) of input frames.
  4130. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4131. regions for the red-cyan, green-magenta or blue-yellow balance.
  4132. A positive adjustment value shifts the balance towards the primary color, a negative
  4133. value towards the complementary color.
  4134. The filter accepts the following options:
  4135. @table @option
  4136. @item rs
  4137. @item gs
  4138. @item bs
  4139. Adjust red, green and blue shadows (darkest pixels).
  4140. @item rm
  4141. @item gm
  4142. @item bm
  4143. Adjust red, green and blue midtones (medium pixels).
  4144. @item rh
  4145. @item gh
  4146. @item bh
  4147. Adjust red, green and blue highlights (brightest pixels).
  4148. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4149. @end table
  4150. @subsection Examples
  4151. @itemize
  4152. @item
  4153. Add red color cast to shadows:
  4154. @example
  4155. colorbalance=rs=.3
  4156. @end example
  4157. @end itemize
  4158. @section colorkey
  4159. RGB colorspace color keying.
  4160. The filter accepts the following options:
  4161. @table @option
  4162. @item color
  4163. The color which will be replaced with transparency.
  4164. @item similarity
  4165. Similarity percentage with the key color.
  4166. 0.01 matches only the exact key color, while 1.0 matches everything.
  4167. @item blend
  4168. Blend percentage.
  4169. 0.0 makes pixels either fully transparent, or not transparent at all.
  4170. Higher values result in semi-transparent pixels, with a higher transparency
  4171. the more similar the pixels color is to the key color.
  4172. @end table
  4173. @subsection Examples
  4174. @itemize
  4175. @item
  4176. Make every green pixel in the input image transparent:
  4177. @example
  4178. ffmpeg -i input.png -vf colorkey=green out.png
  4179. @end example
  4180. @item
  4181. Overlay a greenscreen-video on top of a static background image.
  4182. @example
  4183. 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
  4184. @end example
  4185. @end itemize
  4186. @section colorlevels
  4187. Adjust video input frames using levels.
  4188. The filter accepts the following options:
  4189. @table @option
  4190. @item rimin
  4191. @item gimin
  4192. @item bimin
  4193. @item aimin
  4194. Adjust red, green, blue and alpha input black point.
  4195. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4196. @item rimax
  4197. @item gimax
  4198. @item bimax
  4199. @item aimax
  4200. Adjust red, green, blue and alpha input white point.
  4201. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4202. Input levels are used to lighten highlights (bright tones), darken shadows
  4203. (dark tones), change the balance of bright and dark tones.
  4204. @item romin
  4205. @item gomin
  4206. @item bomin
  4207. @item aomin
  4208. Adjust red, green, blue and alpha output black point.
  4209. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4210. @item romax
  4211. @item gomax
  4212. @item bomax
  4213. @item aomax
  4214. Adjust red, green, blue and alpha output white point.
  4215. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4216. Output levels allows manual selection of a constrained output level range.
  4217. @end table
  4218. @subsection Examples
  4219. @itemize
  4220. @item
  4221. Make video output darker:
  4222. @example
  4223. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4224. @end example
  4225. @item
  4226. Increase contrast:
  4227. @example
  4228. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4229. @end example
  4230. @item
  4231. Make video output lighter:
  4232. @example
  4233. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4234. @end example
  4235. @item
  4236. Increase brightness:
  4237. @example
  4238. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4239. @end example
  4240. @end itemize
  4241. @section colorchannelmixer
  4242. Adjust video input frames by re-mixing color channels.
  4243. This filter modifies a color channel by adding the values associated to
  4244. the other channels of the same pixels. For example if the value to
  4245. modify is red, the output value will be:
  4246. @example
  4247. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4248. @end example
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item rr
  4252. @item rg
  4253. @item rb
  4254. @item ra
  4255. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4256. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4257. @item gr
  4258. @item gg
  4259. @item gb
  4260. @item ga
  4261. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4262. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4263. @item br
  4264. @item bg
  4265. @item bb
  4266. @item ba
  4267. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4268. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4269. @item ar
  4270. @item ag
  4271. @item ab
  4272. @item aa
  4273. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4274. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4275. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4276. @end table
  4277. @subsection Examples
  4278. @itemize
  4279. @item
  4280. Convert source to grayscale:
  4281. @example
  4282. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4283. @end example
  4284. @item
  4285. Simulate sepia tones:
  4286. @example
  4287. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4288. @end example
  4289. @end itemize
  4290. @section colormatrix
  4291. Convert color matrix.
  4292. The filter accepts the following options:
  4293. @table @option
  4294. @item src
  4295. @item dst
  4296. Specify the source and destination color matrix. Both values must be
  4297. specified.
  4298. The accepted values are:
  4299. @table @samp
  4300. @item bt709
  4301. BT.709
  4302. @item fcc
  4303. FCC
  4304. @item bt601
  4305. BT.601
  4306. @item bt470
  4307. BT.470
  4308. @item bt470bg
  4309. BT.470BG
  4310. @item smpte170m
  4311. SMPTE-170M
  4312. @item smpte240m
  4313. SMPTE-240M
  4314. @item bt2020
  4315. BT.2020
  4316. @end table
  4317. @end table
  4318. For example to convert from BT.601 to SMPTE-240M, use the command:
  4319. @example
  4320. colormatrix=bt601:smpte240m
  4321. @end example
  4322. @section colorspace
  4323. Convert colorspace, transfer characteristics or color primaries.
  4324. Input video needs to have an even size.
  4325. The filter accepts the following options:
  4326. @table @option
  4327. @anchor{all}
  4328. @item all
  4329. Specify all color properties at once.
  4330. The accepted values are:
  4331. @table @samp
  4332. @item bt470m
  4333. BT.470M
  4334. @item bt470bg
  4335. BT.470BG
  4336. @item bt601-6-525
  4337. BT.601-6 525
  4338. @item bt601-6-625
  4339. BT.601-6 625
  4340. @item bt709
  4341. BT.709
  4342. @item smpte170m
  4343. SMPTE-170M
  4344. @item smpte240m
  4345. SMPTE-240M
  4346. @item bt2020
  4347. BT.2020
  4348. @end table
  4349. @anchor{space}
  4350. @item space
  4351. Specify output colorspace.
  4352. The accepted values are:
  4353. @table @samp
  4354. @item bt709
  4355. BT.709
  4356. @item fcc
  4357. FCC
  4358. @item bt470bg
  4359. BT.470BG or BT.601-6 625
  4360. @item smpte170m
  4361. SMPTE-170M or BT.601-6 525
  4362. @item smpte240m
  4363. SMPTE-240M
  4364. @item ycgco
  4365. YCgCo
  4366. @item bt2020ncl
  4367. BT.2020 with non-constant luminance
  4368. @end table
  4369. @anchor{trc}
  4370. @item trc
  4371. Specify output transfer characteristics.
  4372. The accepted values are:
  4373. @table @samp
  4374. @item bt709
  4375. BT.709
  4376. @item bt470m
  4377. BT.470M
  4378. @item bt470bg
  4379. BT.470BG
  4380. @item gamma22
  4381. Constant gamma of 2.2
  4382. @item gamma28
  4383. Constant gamma of 2.8
  4384. @item smpte170m
  4385. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4386. @item smpte240m
  4387. SMPTE-240M
  4388. @item srgb
  4389. SRGB
  4390. @item iec61966-2-1
  4391. iec61966-2-1
  4392. @item iec61966-2-4
  4393. iec61966-2-4
  4394. @item xvycc
  4395. xvycc
  4396. @item bt2020-10
  4397. BT.2020 for 10-bits content
  4398. @item bt2020-12
  4399. BT.2020 for 12-bits content
  4400. @end table
  4401. @anchor{primaries}
  4402. @item primaries
  4403. Specify output color primaries.
  4404. The accepted values are:
  4405. @table @samp
  4406. @item bt709
  4407. BT.709
  4408. @item bt470m
  4409. BT.470M
  4410. @item bt470bg
  4411. BT.470BG or BT.601-6 625
  4412. @item smpte170m
  4413. SMPTE-170M or BT.601-6 525
  4414. @item smpte240m
  4415. SMPTE-240M
  4416. @item film
  4417. film
  4418. @item smpte431
  4419. SMPTE-431
  4420. @item smpte432
  4421. SMPTE-432
  4422. @item bt2020
  4423. BT.2020
  4424. @item jedec-p22
  4425. JEDEC P22 phosphors
  4426. @end table
  4427. @anchor{range}
  4428. @item range
  4429. Specify output color range.
  4430. The accepted values are:
  4431. @table @samp
  4432. @item tv
  4433. TV (restricted) range
  4434. @item mpeg
  4435. MPEG (restricted) range
  4436. @item pc
  4437. PC (full) range
  4438. @item jpeg
  4439. JPEG (full) range
  4440. @end table
  4441. @item format
  4442. Specify output color format.
  4443. The accepted values are:
  4444. @table @samp
  4445. @item yuv420p
  4446. YUV 4:2:0 planar 8-bits
  4447. @item yuv420p10
  4448. YUV 4:2:0 planar 10-bits
  4449. @item yuv420p12
  4450. YUV 4:2:0 planar 12-bits
  4451. @item yuv422p
  4452. YUV 4:2:2 planar 8-bits
  4453. @item yuv422p10
  4454. YUV 4:2:2 planar 10-bits
  4455. @item yuv422p12
  4456. YUV 4:2:2 planar 12-bits
  4457. @item yuv444p
  4458. YUV 4:4:4 planar 8-bits
  4459. @item yuv444p10
  4460. YUV 4:4:4 planar 10-bits
  4461. @item yuv444p12
  4462. YUV 4:4:4 planar 12-bits
  4463. @end table
  4464. @item fast
  4465. Do a fast conversion, which skips gamma/primary correction. This will take
  4466. significantly less CPU, but will be mathematically incorrect. To get output
  4467. compatible with that produced by the colormatrix filter, use fast=1.
  4468. @item dither
  4469. Specify dithering mode.
  4470. The accepted values are:
  4471. @table @samp
  4472. @item none
  4473. No dithering
  4474. @item fsb
  4475. Floyd-Steinberg dithering
  4476. @end table
  4477. @item wpadapt
  4478. Whitepoint adaptation mode.
  4479. The accepted values are:
  4480. @table @samp
  4481. @item bradford
  4482. Bradford whitepoint adaptation
  4483. @item vonkries
  4484. von Kries whitepoint adaptation
  4485. @item identity
  4486. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4487. @end table
  4488. @item iall
  4489. Override all input properties at once. Same accepted values as @ref{all}.
  4490. @item ispace
  4491. Override input colorspace. Same accepted values as @ref{space}.
  4492. @item iprimaries
  4493. Override input color primaries. Same accepted values as @ref{primaries}.
  4494. @item itrc
  4495. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4496. @item irange
  4497. Override input color range. Same accepted values as @ref{range}.
  4498. @end table
  4499. The filter converts the transfer characteristics, color space and color
  4500. primaries to the specified user values. The output value, if not specified,
  4501. is set to a default value based on the "all" property. If that property is
  4502. also not specified, the filter will log an error. The output color range and
  4503. format default to the same value as the input color range and format. The
  4504. input transfer characteristics, color space, color primaries and color range
  4505. should be set on the input data. If any of these are missing, the filter will
  4506. log an error and no conversion will take place.
  4507. For example to convert the input to SMPTE-240M, use the command:
  4508. @example
  4509. colorspace=smpte240m
  4510. @end example
  4511. @section convolution
  4512. Apply convolution 3x3 or 5x5 filter.
  4513. The filter accepts the following options:
  4514. @table @option
  4515. @item 0m
  4516. @item 1m
  4517. @item 2m
  4518. @item 3m
  4519. Set matrix for each plane.
  4520. Matrix is sequence of 9 or 25 signed integers.
  4521. @item 0rdiv
  4522. @item 1rdiv
  4523. @item 2rdiv
  4524. @item 3rdiv
  4525. Set multiplier for calculated value for each plane.
  4526. @item 0bias
  4527. @item 1bias
  4528. @item 2bias
  4529. @item 3bias
  4530. Set bias for each plane. This value is added to the result of the multiplication.
  4531. Useful for making the overall image brighter or darker. Default is 0.0.
  4532. @end table
  4533. @subsection Examples
  4534. @itemize
  4535. @item
  4536. Apply sharpen:
  4537. @example
  4538. 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"
  4539. @end example
  4540. @item
  4541. Apply blur:
  4542. @example
  4543. 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"
  4544. @end example
  4545. @item
  4546. Apply edge enhance:
  4547. @example
  4548. 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"
  4549. @end example
  4550. @item
  4551. Apply edge detect:
  4552. @example
  4553. 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"
  4554. @end example
  4555. @item
  4556. Apply laplacian edge detector which includes diagonals:
  4557. @example
  4558. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4559. @end example
  4560. @item
  4561. Apply emboss:
  4562. @example
  4563. 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"
  4564. @end example
  4565. @end itemize
  4566. @section copy
  4567. Copy the input video source unchanged to the output. This is mainly useful for
  4568. testing purposes.
  4569. @anchor{coreimage}
  4570. @section coreimage
  4571. Video filtering on GPU using Apple's CoreImage API on OSX.
  4572. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4573. processed by video hardware. However, software-based OpenGL implementations
  4574. exist which means there is no guarantee for hardware processing. It depends on
  4575. the respective OSX.
  4576. There are many filters and image generators provided by Apple that come with a
  4577. large variety of options. The filter has to be referenced by its name along
  4578. with its options.
  4579. The coreimage filter accepts the following options:
  4580. @table @option
  4581. @item list_filters
  4582. List all available filters and generators along with all their respective
  4583. options as well as possible minimum and maximum values along with the default
  4584. values.
  4585. @example
  4586. list_filters=true
  4587. @end example
  4588. @item filter
  4589. Specify all filters by their respective name and options.
  4590. Use @var{list_filters} to determine all valid filter names and options.
  4591. Numerical options are specified by a float value and are automatically clamped
  4592. to their respective value range. Vector and color options have to be specified
  4593. by a list of space separated float values. Character escaping has to be done.
  4594. A special option name @code{default} is available to use default options for a
  4595. filter.
  4596. It is required to specify either @code{default} or at least one of the filter options.
  4597. All omitted options are used with their default values.
  4598. The syntax of the filter string is as follows:
  4599. @example
  4600. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4601. @end example
  4602. @item output_rect
  4603. Specify a rectangle where the output of the filter chain is copied into the
  4604. input image. It is given by a list of space separated float values:
  4605. @example
  4606. output_rect=x\ y\ width\ height
  4607. @end example
  4608. If not given, the output rectangle equals the dimensions of the input image.
  4609. The output rectangle is automatically cropped at the borders of the input
  4610. image. Negative values are valid for each component.
  4611. @example
  4612. output_rect=25\ 25\ 100\ 100
  4613. @end example
  4614. @end table
  4615. Several filters can be chained for successive processing without GPU-HOST
  4616. transfers allowing for fast processing of complex filter chains.
  4617. Currently, only filters with zero (generators) or exactly one (filters) input
  4618. image and one output image are supported. Also, transition filters are not yet
  4619. usable as intended.
  4620. Some filters generate output images with additional padding depending on the
  4621. respective filter kernel. The padding is automatically removed to ensure the
  4622. filter output has the same size as the input image.
  4623. For image generators, the size of the output image is determined by the
  4624. previous output image of the filter chain or the input image of the whole
  4625. filterchain, respectively. The generators do not use the pixel information of
  4626. this image to generate their output. However, the generated output is
  4627. blended onto this image, resulting in partial or complete coverage of the
  4628. output image.
  4629. The @ref{coreimagesrc} video source can be used for generating input images
  4630. which are directly fed into the filter chain. By using it, providing input
  4631. images by another video source or an input video is not required.
  4632. @subsection Examples
  4633. @itemize
  4634. @item
  4635. List all filters available:
  4636. @example
  4637. coreimage=list_filters=true
  4638. @end example
  4639. @item
  4640. Use the CIBoxBlur filter with default options to blur an image:
  4641. @example
  4642. coreimage=filter=CIBoxBlur@@default
  4643. @end example
  4644. @item
  4645. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4646. its center at 100x100 and a radius of 50 pixels:
  4647. @example
  4648. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4649. @end example
  4650. @item
  4651. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4652. given as complete and escaped command-line for Apple's standard bash shell:
  4653. @example
  4654. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4655. @end example
  4656. @end itemize
  4657. @section crop
  4658. Crop the input video to given dimensions.
  4659. It accepts the following parameters:
  4660. @table @option
  4661. @item w, out_w
  4662. The width of the output video. It defaults to @code{iw}.
  4663. This expression is evaluated only once during the filter
  4664. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4665. @item h, out_h
  4666. The height of the output video. It defaults to @code{ih}.
  4667. This expression is evaluated only once during the filter
  4668. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4669. @item x
  4670. The horizontal position, in the input video, of the left edge of the output
  4671. video. It defaults to @code{(in_w-out_w)/2}.
  4672. This expression is evaluated per-frame.
  4673. @item y
  4674. The vertical position, in the input video, of the top edge of the output video.
  4675. It defaults to @code{(in_h-out_h)/2}.
  4676. This expression is evaluated per-frame.
  4677. @item keep_aspect
  4678. If set to 1 will force the output display aspect ratio
  4679. to be the same of the input, by changing the output sample aspect
  4680. ratio. It defaults to 0.
  4681. @item exact
  4682. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4683. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4684. It defaults to 0.
  4685. @end table
  4686. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4687. expressions containing the following constants:
  4688. @table @option
  4689. @item x
  4690. @item y
  4691. The computed values for @var{x} and @var{y}. They are evaluated for
  4692. each new frame.
  4693. @item in_w
  4694. @item in_h
  4695. The input width and height.
  4696. @item iw
  4697. @item ih
  4698. These are the same as @var{in_w} and @var{in_h}.
  4699. @item out_w
  4700. @item out_h
  4701. The output (cropped) width and height.
  4702. @item ow
  4703. @item oh
  4704. These are the same as @var{out_w} and @var{out_h}.
  4705. @item a
  4706. same as @var{iw} / @var{ih}
  4707. @item sar
  4708. input sample aspect ratio
  4709. @item dar
  4710. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4711. @item hsub
  4712. @item vsub
  4713. horizontal and vertical chroma subsample values. For example for the
  4714. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4715. @item n
  4716. The number of the input frame, starting from 0.
  4717. @item pos
  4718. the position in the file of the input frame, NAN if unknown
  4719. @item t
  4720. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4721. @end table
  4722. The expression for @var{out_w} may depend on the value of @var{out_h},
  4723. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4724. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4725. evaluated after @var{out_w} and @var{out_h}.
  4726. The @var{x} and @var{y} parameters specify the expressions for the
  4727. position of the top-left corner of the output (non-cropped) area. They
  4728. are evaluated for each frame. If the evaluated value is not valid, it
  4729. is approximated to the nearest valid value.
  4730. The expression for @var{x} may depend on @var{y}, and the expression
  4731. for @var{y} may depend on @var{x}.
  4732. @subsection Examples
  4733. @itemize
  4734. @item
  4735. Crop area with size 100x100 at position (12,34).
  4736. @example
  4737. crop=100:100:12:34
  4738. @end example
  4739. Using named options, the example above becomes:
  4740. @example
  4741. crop=w=100:h=100:x=12:y=34
  4742. @end example
  4743. @item
  4744. Crop the central input area with size 100x100:
  4745. @example
  4746. crop=100:100
  4747. @end example
  4748. @item
  4749. Crop the central input area with size 2/3 of the input video:
  4750. @example
  4751. crop=2/3*in_w:2/3*in_h
  4752. @end example
  4753. @item
  4754. Crop the input video central square:
  4755. @example
  4756. crop=out_w=in_h
  4757. crop=in_h
  4758. @end example
  4759. @item
  4760. Delimit the rectangle with the top-left corner placed at position
  4761. 100:100 and the right-bottom corner corresponding to the right-bottom
  4762. corner of the input image.
  4763. @example
  4764. crop=in_w-100:in_h-100:100:100
  4765. @end example
  4766. @item
  4767. Crop 10 pixels from the left and right borders, and 20 pixels from
  4768. the top and bottom borders
  4769. @example
  4770. crop=in_w-2*10:in_h-2*20
  4771. @end example
  4772. @item
  4773. Keep only the bottom right quarter of the input image:
  4774. @example
  4775. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4776. @end example
  4777. @item
  4778. Crop height for getting Greek harmony:
  4779. @example
  4780. crop=in_w:1/PHI*in_w
  4781. @end example
  4782. @item
  4783. Apply trembling effect:
  4784. @example
  4785. 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)
  4786. @end example
  4787. @item
  4788. Apply erratic camera effect depending on timestamp:
  4789. @example
  4790. 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)"
  4791. @end example
  4792. @item
  4793. Set x depending on the value of y:
  4794. @example
  4795. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4796. @end example
  4797. @end itemize
  4798. @subsection Commands
  4799. This filter supports the following commands:
  4800. @table @option
  4801. @item w, out_w
  4802. @item h, out_h
  4803. @item x
  4804. @item y
  4805. Set width/height of the output video and the horizontal/vertical position
  4806. in the input video.
  4807. The command accepts the same syntax of the corresponding option.
  4808. If the specified expression is not valid, it is kept at its current
  4809. value.
  4810. @end table
  4811. @section cropdetect
  4812. Auto-detect the crop size.
  4813. It calculates the necessary cropping parameters and prints the
  4814. recommended parameters via the logging system. The detected dimensions
  4815. correspond to the non-black area of the input video.
  4816. It accepts the following parameters:
  4817. @table @option
  4818. @item limit
  4819. Set higher black value threshold, which can be optionally specified
  4820. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4821. value greater to the set value is considered non-black. It defaults to 24.
  4822. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4823. on the bitdepth of the pixel format.
  4824. @item round
  4825. The value which the width/height should be divisible by. It defaults to
  4826. 16. The offset is automatically adjusted to center the video. Use 2 to
  4827. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4828. encoding to most video codecs.
  4829. @item reset_count, reset
  4830. Set the counter that determines after how many frames cropdetect will
  4831. reset the previously detected largest video area and start over to
  4832. detect the current optimal crop area. Default value is 0.
  4833. This can be useful when channel logos distort the video area. 0
  4834. indicates 'never reset', and returns the largest area encountered during
  4835. playback.
  4836. @end table
  4837. @anchor{curves}
  4838. @section curves
  4839. Apply color adjustments using curves.
  4840. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4841. component (red, green and blue) has its values defined by @var{N} key points
  4842. tied from each other using a smooth curve. The x-axis represents the pixel
  4843. values from the input frame, and the y-axis the new pixel values to be set for
  4844. the output frame.
  4845. By default, a component curve is defined by the two points @var{(0;0)} and
  4846. @var{(1;1)}. This creates a straight line where each original pixel value is
  4847. "adjusted" to its own value, which means no change to the image.
  4848. The filter allows you to redefine these two points and add some more. A new
  4849. curve (using a natural cubic spline interpolation) will be define to pass
  4850. smoothly through all these new coordinates. The new defined points needs to be
  4851. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4852. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4853. the vector spaces, the values will be clipped accordingly.
  4854. The filter accepts the following options:
  4855. @table @option
  4856. @item preset
  4857. Select one of the available color presets. This option can be used in addition
  4858. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4859. options takes priority on the preset values.
  4860. Available presets are:
  4861. @table @samp
  4862. @item none
  4863. @item color_negative
  4864. @item cross_process
  4865. @item darker
  4866. @item increase_contrast
  4867. @item lighter
  4868. @item linear_contrast
  4869. @item medium_contrast
  4870. @item negative
  4871. @item strong_contrast
  4872. @item vintage
  4873. @end table
  4874. Default is @code{none}.
  4875. @item master, m
  4876. Set the master key points. These points will define a second pass mapping. It
  4877. is sometimes called a "luminance" or "value" mapping. It can be used with
  4878. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4879. post-processing LUT.
  4880. @item red, r
  4881. Set the key points for the red component.
  4882. @item green, g
  4883. Set the key points for the green component.
  4884. @item blue, b
  4885. Set the key points for the blue component.
  4886. @item all
  4887. Set the key points for all components (not including master).
  4888. Can be used in addition to the other key points component
  4889. options. In this case, the unset component(s) will fallback on this
  4890. @option{all} setting.
  4891. @item psfile
  4892. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4893. @item plot
  4894. Save Gnuplot script of the curves in specified file.
  4895. @end table
  4896. To avoid some filtergraph syntax conflicts, each key points list need to be
  4897. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4898. @subsection Examples
  4899. @itemize
  4900. @item
  4901. Increase slightly the middle level of blue:
  4902. @example
  4903. curves=blue='0/0 0.5/0.58 1/1'
  4904. @end example
  4905. @item
  4906. Vintage effect:
  4907. @example
  4908. 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'
  4909. @end example
  4910. Here we obtain the following coordinates for each components:
  4911. @table @var
  4912. @item red
  4913. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4914. @item green
  4915. @code{(0;0) (0.50;0.48) (1;1)}
  4916. @item blue
  4917. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4918. @end table
  4919. @item
  4920. The previous example can also be achieved with the associated built-in preset:
  4921. @example
  4922. curves=preset=vintage
  4923. @end example
  4924. @item
  4925. Or simply:
  4926. @example
  4927. curves=vintage
  4928. @end example
  4929. @item
  4930. Use a Photoshop preset and redefine the points of the green component:
  4931. @example
  4932. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4933. @end example
  4934. @item
  4935. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4936. and @command{gnuplot}:
  4937. @example
  4938. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4939. gnuplot -p /tmp/curves.plt
  4940. @end example
  4941. @end itemize
  4942. @section datascope
  4943. Video data analysis filter.
  4944. This filter shows hexadecimal pixel values of part of video.
  4945. The filter accepts the following options:
  4946. @table @option
  4947. @item size, s
  4948. Set output video size.
  4949. @item x
  4950. Set x offset from where to pick pixels.
  4951. @item y
  4952. Set y offset from where to pick pixels.
  4953. @item mode
  4954. Set scope mode, can be one of the following:
  4955. @table @samp
  4956. @item mono
  4957. Draw hexadecimal pixel values with white color on black background.
  4958. @item color
  4959. Draw hexadecimal pixel values with input video pixel color on black
  4960. background.
  4961. @item color2
  4962. Draw hexadecimal pixel values on color background picked from input video,
  4963. the text color is picked in such way so its always visible.
  4964. @end table
  4965. @item axis
  4966. Draw rows and columns numbers on left and top of video.
  4967. @item opacity
  4968. Set background opacity.
  4969. @end table
  4970. @section dctdnoiz
  4971. Denoise frames using 2D DCT (frequency domain filtering).
  4972. This filter is not designed for real time.
  4973. The filter accepts the following options:
  4974. @table @option
  4975. @item sigma, s
  4976. Set the noise sigma constant.
  4977. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4978. coefficient (absolute value) below this threshold with be dropped.
  4979. If you need a more advanced filtering, see @option{expr}.
  4980. Default is @code{0}.
  4981. @item overlap
  4982. Set number overlapping pixels for each block. Since the filter can be slow, you
  4983. may want to reduce this value, at the cost of a less effective filter and the
  4984. risk of various artefacts.
  4985. If the overlapping value doesn't permit processing the whole input width or
  4986. height, a warning will be displayed and according borders won't be denoised.
  4987. Default value is @var{blocksize}-1, which is the best possible setting.
  4988. @item expr, e
  4989. Set the coefficient factor expression.
  4990. For each coefficient of a DCT block, this expression will be evaluated as a
  4991. multiplier value for the coefficient.
  4992. If this is option is set, the @option{sigma} option will be ignored.
  4993. The absolute value of the coefficient can be accessed through the @var{c}
  4994. variable.
  4995. @item n
  4996. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4997. @var{blocksize}, which is the width and height of the processed blocks.
  4998. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4999. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5000. on the speed processing. Also, a larger block size does not necessarily means a
  5001. better de-noising.
  5002. @end table
  5003. @subsection Examples
  5004. Apply a denoise with a @option{sigma} of @code{4.5}:
  5005. @example
  5006. dctdnoiz=4.5
  5007. @end example
  5008. The same operation can be achieved using the expression system:
  5009. @example
  5010. dctdnoiz=e='gte(c, 4.5*3)'
  5011. @end example
  5012. Violent denoise using a block size of @code{16x16}:
  5013. @example
  5014. dctdnoiz=15:n=4
  5015. @end example
  5016. @section deband
  5017. Remove banding artifacts from input video.
  5018. It works by replacing banded pixels with average value of referenced pixels.
  5019. The filter accepts the following options:
  5020. @table @option
  5021. @item 1thr
  5022. @item 2thr
  5023. @item 3thr
  5024. @item 4thr
  5025. Set banding detection threshold for each plane. Default is 0.02.
  5026. Valid range is 0.00003 to 0.5.
  5027. If difference between current pixel and reference pixel is less than threshold,
  5028. it will be considered as banded.
  5029. @item range, r
  5030. Banding detection range in pixels. Default is 16. If positive, random number
  5031. in range 0 to set value will be used. If negative, exact absolute value
  5032. will be used.
  5033. The range defines square of four pixels around current pixel.
  5034. @item direction, d
  5035. Set direction in radians from which four pixel will be compared. If positive,
  5036. random direction from 0 to set direction will be picked. If negative, exact of
  5037. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5038. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5039. column.
  5040. @item blur, b
  5041. If enabled, current pixel is compared with average value of all four
  5042. surrounding pixels. The default is enabled. If disabled current pixel is
  5043. compared with all four surrounding pixels. The pixel is considered banded
  5044. if only all four differences with surrounding pixels are less than threshold.
  5045. @item coupling, c
  5046. If enabled, current pixel is changed if and only if all pixel components are banded,
  5047. e.g. banding detection threshold is triggered for all color components.
  5048. The default is disabled.
  5049. @end table
  5050. @anchor{decimate}
  5051. @section decimate
  5052. Drop duplicated frames at regular intervals.
  5053. The filter accepts the following options:
  5054. @table @option
  5055. @item cycle
  5056. Set the number of frames from which one will be dropped. Setting this to
  5057. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5058. Default is @code{5}.
  5059. @item dupthresh
  5060. Set the threshold for duplicate detection. If the difference metric for a frame
  5061. is less than or equal to this value, then it is declared as duplicate. Default
  5062. is @code{1.1}
  5063. @item scthresh
  5064. Set scene change threshold. Default is @code{15}.
  5065. @item blockx
  5066. @item blocky
  5067. Set the size of the x and y-axis blocks used during metric calculations.
  5068. Larger blocks give better noise suppression, but also give worse detection of
  5069. small movements. Must be a power of two. Default is @code{32}.
  5070. @item ppsrc
  5071. Mark main input as a pre-processed input and activate clean source input
  5072. stream. This allows the input to be pre-processed with various filters to help
  5073. the metrics calculation while keeping the frame selection lossless. When set to
  5074. @code{1}, the first stream is for the pre-processed input, and the second
  5075. stream is the clean source from where the kept frames are chosen. Default is
  5076. @code{0}.
  5077. @item chroma
  5078. Set whether or not chroma is considered in the metric calculations. Default is
  5079. @code{1}.
  5080. @end table
  5081. @section deflate
  5082. Apply deflate effect to the video.
  5083. This filter replaces the pixel by the local(3x3) average by taking into account
  5084. only values lower than the pixel.
  5085. It accepts the following options:
  5086. @table @option
  5087. @item threshold0
  5088. @item threshold1
  5089. @item threshold2
  5090. @item threshold3
  5091. Limit the maximum change for each plane, default is 65535.
  5092. If 0, plane will remain unchanged.
  5093. @end table
  5094. @section deflicker
  5095. Remove temporal frame luminance variations.
  5096. It accepts the following options:
  5097. @table @option
  5098. @item size, s
  5099. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5100. @item mode, m
  5101. Set averaging mode to smooth temporal luminance variations.
  5102. Available values are:
  5103. @table @samp
  5104. @item am
  5105. Arithmetic mean
  5106. @item gm
  5107. Geometric mean
  5108. @item hm
  5109. Harmonic mean
  5110. @item qm
  5111. Quadratic mean
  5112. @item cm
  5113. Cubic mean
  5114. @item pm
  5115. Power mean
  5116. @item median
  5117. Median
  5118. @end table
  5119. @item bypass
  5120. Do not actually modify frame. Useful when one only wants metadata.
  5121. @end table
  5122. @section dejudder
  5123. Remove judder produced by partially interlaced telecined content.
  5124. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5125. source was partially telecined content then the output of @code{pullup,dejudder}
  5126. will have a variable frame rate. May change the recorded frame rate of the
  5127. container. Aside from that change, this filter will not affect constant frame
  5128. rate video.
  5129. The option available in this filter is:
  5130. @table @option
  5131. @item cycle
  5132. Specify the length of the window over which the judder repeats.
  5133. Accepts any integer greater than 1. Useful values are:
  5134. @table @samp
  5135. @item 4
  5136. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5137. @item 5
  5138. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5139. @item 20
  5140. If a mixture of the two.
  5141. @end table
  5142. The default is @samp{4}.
  5143. @end table
  5144. @section delogo
  5145. Suppress a TV station logo by a simple interpolation of the surrounding
  5146. pixels. Just set a rectangle covering the logo and watch it disappear
  5147. (and sometimes something even uglier appear - your mileage may vary).
  5148. It accepts the following parameters:
  5149. @table @option
  5150. @item x
  5151. @item y
  5152. Specify the top left corner coordinates of the logo. They must be
  5153. specified.
  5154. @item w
  5155. @item h
  5156. Specify the width and height of the logo to clear. They must be
  5157. specified.
  5158. @item band, t
  5159. Specify the thickness of the fuzzy edge of the rectangle (added to
  5160. @var{w} and @var{h}). The default value is 1. This option is
  5161. deprecated, setting higher values should no longer be necessary and
  5162. is not recommended.
  5163. @item show
  5164. When set to 1, a green rectangle is drawn on the screen to simplify
  5165. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5166. The default value is 0.
  5167. The rectangle is drawn on the outermost pixels which will be (partly)
  5168. replaced with interpolated values. The values of the next pixels
  5169. immediately outside this rectangle in each direction will be used to
  5170. compute the interpolated pixel values inside the rectangle.
  5171. @end table
  5172. @subsection Examples
  5173. @itemize
  5174. @item
  5175. Set a rectangle covering the area with top left corner coordinates 0,0
  5176. and size 100x77, and a band of size 10:
  5177. @example
  5178. delogo=x=0:y=0:w=100:h=77:band=10
  5179. @end example
  5180. @end itemize
  5181. @section deshake
  5182. Attempt to fix small changes in horizontal and/or vertical shift. This
  5183. filter helps remove camera shake from hand-holding a camera, bumping a
  5184. tripod, moving on a vehicle, etc.
  5185. The filter accepts the following options:
  5186. @table @option
  5187. @item x
  5188. @item y
  5189. @item w
  5190. @item h
  5191. Specify a rectangular area where to limit the search for motion
  5192. vectors.
  5193. If desired the search for motion vectors can be limited to a
  5194. rectangular area of the frame defined by its top left corner, width
  5195. and height. These parameters have the same meaning as the drawbox
  5196. filter which can be used to visualise the position of the bounding
  5197. box.
  5198. This is useful when simultaneous movement of subjects within the frame
  5199. might be confused for camera motion by the motion vector search.
  5200. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5201. then the full frame is used. This allows later options to be set
  5202. without specifying the bounding box for the motion vector search.
  5203. Default - search the whole frame.
  5204. @item rx
  5205. @item ry
  5206. Specify the maximum extent of movement in x and y directions in the
  5207. range 0-64 pixels. Default 16.
  5208. @item edge
  5209. Specify how to generate pixels to fill blanks at the edge of the
  5210. frame. Available values are:
  5211. @table @samp
  5212. @item blank, 0
  5213. Fill zeroes at blank locations
  5214. @item original, 1
  5215. Original image at blank locations
  5216. @item clamp, 2
  5217. Extruded edge value at blank locations
  5218. @item mirror, 3
  5219. Mirrored edge at blank locations
  5220. @end table
  5221. Default value is @samp{mirror}.
  5222. @item blocksize
  5223. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5224. default 8.
  5225. @item contrast
  5226. Specify the contrast threshold for blocks. Only blocks with more than
  5227. the specified contrast (difference between darkest and lightest
  5228. pixels) will be considered. Range 1-255, default 125.
  5229. @item search
  5230. Specify the search strategy. Available values are:
  5231. @table @samp
  5232. @item exhaustive, 0
  5233. Set exhaustive search
  5234. @item less, 1
  5235. Set less exhaustive search.
  5236. @end table
  5237. Default value is @samp{exhaustive}.
  5238. @item filename
  5239. If set then a detailed log of the motion search is written to the
  5240. specified file.
  5241. @item opencl
  5242. If set to 1, specify using OpenCL capabilities, only available if
  5243. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5244. @end table
  5245. @section detelecine
  5246. Apply an exact inverse of the telecine operation. It requires a predefined
  5247. pattern specified using the pattern option which must be the same as that passed
  5248. to the telecine filter.
  5249. This filter accepts the following options:
  5250. @table @option
  5251. @item first_field
  5252. @table @samp
  5253. @item top, t
  5254. top field first
  5255. @item bottom, b
  5256. bottom field first
  5257. The default value is @code{top}.
  5258. @end table
  5259. @item pattern
  5260. A string of numbers representing the pulldown pattern you wish to apply.
  5261. The default value is @code{23}.
  5262. @item start_frame
  5263. A number representing position of the first frame with respect to the telecine
  5264. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5265. @end table
  5266. @section dilation
  5267. Apply dilation effect to the video.
  5268. This filter replaces the pixel by the local(3x3) maximum.
  5269. It accepts the following options:
  5270. @table @option
  5271. @item threshold0
  5272. @item threshold1
  5273. @item threshold2
  5274. @item threshold3
  5275. Limit the maximum change for each plane, default is 65535.
  5276. If 0, plane will remain unchanged.
  5277. @item coordinates
  5278. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5279. pixels are used.
  5280. Flags to local 3x3 coordinates maps like this:
  5281. 1 2 3
  5282. 4 5
  5283. 6 7 8
  5284. @end table
  5285. @section displace
  5286. Displace pixels as indicated by second and third input stream.
  5287. It takes three input streams and outputs one stream, the first input is the
  5288. source, and second and third input are displacement maps.
  5289. The second input specifies how much to displace pixels along the
  5290. x-axis, while the third input specifies how much to displace pixels
  5291. along the y-axis.
  5292. If one of displacement map streams terminates, last frame from that
  5293. displacement map will be used.
  5294. Note that once generated, displacements maps can be reused over and over again.
  5295. A description of the accepted options follows.
  5296. @table @option
  5297. @item edge
  5298. Set displace behavior for pixels that are out of range.
  5299. Available values are:
  5300. @table @samp
  5301. @item blank
  5302. Missing pixels are replaced by black pixels.
  5303. @item smear
  5304. Adjacent pixels will spread out to replace missing pixels.
  5305. @item wrap
  5306. Out of range pixels are wrapped so they point to pixels of other side.
  5307. @end table
  5308. Default is @samp{smear}.
  5309. @end table
  5310. @subsection Examples
  5311. @itemize
  5312. @item
  5313. Add ripple effect to rgb input of video size hd720:
  5314. @example
  5315. 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
  5316. @end example
  5317. @item
  5318. Add wave effect to rgb input of video size hd720:
  5319. @example
  5320. 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
  5321. @end example
  5322. @end itemize
  5323. @section drawbox
  5324. Draw a colored box on the input image.
  5325. It accepts the following parameters:
  5326. @table @option
  5327. @item x
  5328. @item y
  5329. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5330. @item width, w
  5331. @item height, h
  5332. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5333. the input width and height. It defaults to 0.
  5334. @item color, c
  5335. Specify the color of the box to write. For the general syntax of this option,
  5336. check the "Color" section in the ffmpeg-utils manual. If the special
  5337. value @code{invert} is used, the box edge color is the same as the
  5338. video with inverted luma.
  5339. @item thickness, t
  5340. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5341. See below for the list of accepted constants.
  5342. @end table
  5343. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5344. following constants:
  5345. @table @option
  5346. @item dar
  5347. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5348. @item hsub
  5349. @item vsub
  5350. horizontal and vertical chroma subsample values. For example for the
  5351. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5352. @item in_h, ih
  5353. @item in_w, iw
  5354. The input width and height.
  5355. @item sar
  5356. The input sample aspect ratio.
  5357. @item x
  5358. @item y
  5359. The x and y offset coordinates where the box is drawn.
  5360. @item w
  5361. @item h
  5362. The width and height of the drawn box.
  5363. @item t
  5364. The thickness of the drawn box.
  5365. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5366. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5367. @end table
  5368. @subsection Examples
  5369. @itemize
  5370. @item
  5371. Draw a black box around the edge of the input image:
  5372. @example
  5373. drawbox
  5374. @end example
  5375. @item
  5376. Draw a box with color red and an opacity of 50%:
  5377. @example
  5378. drawbox=10:20:200:60:red@@0.5
  5379. @end example
  5380. The previous example can be specified as:
  5381. @example
  5382. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5383. @end example
  5384. @item
  5385. Fill the box with pink color:
  5386. @example
  5387. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5388. @end example
  5389. @item
  5390. Draw a 2-pixel red 2.40:1 mask:
  5391. @example
  5392. 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
  5393. @end example
  5394. @end itemize
  5395. @section drawgrid
  5396. Draw a grid on the input image.
  5397. It accepts the following parameters:
  5398. @table @option
  5399. @item x
  5400. @item y
  5401. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5402. @item width, w
  5403. @item height, h
  5404. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5405. input width and height, respectively, minus @code{thickness}, so image gets
  5406. framed. Default to 0.
  5407. @item color, c
  5408. Specify the color of the grid. For the general syntax of this option,
  5409. check the "Color" section in the ffmpeg-utils manual. If the special
  5410. value @code{invert} is used, the grid color is the same as the
  5411. video with inverted luma.
  5412. @item thickness, t
  5413. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5414. See below for the list of accepted constants.
  5415. @end table
  5416. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5417. following constants:
  5418. @table @option
  5419. @item dar
  5420. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5421. @item hsub
  5422. @item vsub
  5423. horizontal and vertical chroma subsample values. For example for the
  5424. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5425. @item in_h, ih
  5426. @item in_w, iw
  5427. The input grid cell width and height.
  5428. @item sar
  5429. The input sample aspect ratio.
  5430. @item x
  5431. @item y
  5432. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5433. @item w
  5434. @item h
  5435. The width and height of the drawn cell.
  5436. @item t
  5437. The thickness of the drawn cell.
  5438. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5439. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5440. @end table
  5441. @subsection Examples
  5442. @itemize
  5443. @item
  5444. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5445. @example
  5446. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5447. @end example
  5448. @item
  5449. Draw a white 3x3 grid with an opacity of 50%:
  5450. @example
  5451. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5452. @end example
  5453. @end itemize
  5454. @anchor{drawtext}
  5455. @section drawtext
  5456. Draw a text string or text from a specified file on top of a video, using the
  5457. libfreetype library.
  5458. To enable compilation of this filter, you need to configure FFmpeg with
  5459. @code{--enable-libfreetype}.
  5460. To enable default font fallback and the @var{font} option you need to
  5461. configure FFmpeg with @code{--enable-libfontconfig}.
  5462. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5463. @code{--enable-libfribidi}.
  5464. @subsection Syntax
  5465. It accepts the following parameters:
  5466. @table @option
  5467. @item box
  5468. Used to draw a box around text using the background color.
  5469. The value must be either 1 (enable) or 0 (disable).
  5470. The default value of @var{box} is 0.
  5471. @item boxborderw
  5472. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5473. The default value of @var{boxborderw} is 0.
  5474. @item boxcolor
  5475. The color to be used for drawing box around text. For the syntax of this
  5476. option, check the "Color" section in the ffmpeg-utils manual.
  5477. The default value of @var{boxcolor} is "white".
  5478. @item line_spacing
  5479. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5480. The default value of @var{line_spacing} is 0.
  5481. @item borderw
  5482. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5483. The default value of @var{borderw} is 0.
  5484. @item bordercolor
  5485. Set the color to be used for drawing border around text. For the syntax of this
  5486. option, check the "Color" section in the ffmpeg-utils manual.
  5487. The default value of @var{bordercolor} is "black".
  5488. @item expansion
  5489. Select how the @var{text} is expanded. Can be either @code{none},
  5490. @code{strftime} (deprecated) or
  5491. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5492. below for details.
  5493. @item basetime
  5494. Set a start time for the count. Value is in microseconds. Only applied
  5495. in the deprecated strftime expansion mode. To emulate in normal expansion
  5496. mode use the @code{pts} function, supplying the start time (in seconds)
  5497. as the second argument.
  5498. @item fix_bounds
  5499. If true, check and fix text coords to avoid clipping.
  5500. @item fontcolor
  5501. The color to be used for drawing fonts. For the syntax of this option, check
  5502. the "Color" section in the ffmpeg-utils manual.
  5503. The default value of @var{fontcolor} is "black".
  5504. @item fontcolor_expr
  5505. String which is expanded the same way as @var{text} to obtain dynamic
  5506. @var{fontcolor} value. By default this option has empty value and is not
  5507. processed. When this option is set, it overrides @var{fontcolor} option.
  5508. @item font
  5509. The font family to be used for drawing text. By default Sans.
  5510. @item fontfile
  5511. The font file to be used for drawing text. The path must be included.
  5512. This parameter is mandatory if the fontconfig support is disabled.
  5513. @item alpha
  5514. Draw the text applying alpha blending. The value can
  5515. be a number between 0.0 and 1.0.
  5516. The expression accepts the same variables @var{x, y} as well.
  5517. The default value is 1.
  5518. Please see @var{fontcolor_expr}.
  5519. @item fontsize
  5520. The font size to be used for drawing text.
  5521. The default value of @var{fontsize} is 16.
  5522. @item text_shaping
  5523. If set to 1, attempt to shape the text (for example, reverse the order of
  5524. right-to-left text and join Arabic characters) before drawing it.
  5525. Otherwise, just draw the text exactly as given.
  5526. By default 1 (if supported).
  5527. @item ft_load_flags
  5528. The flags to be used for loading the fonts.
  5529. The flags map the corresponding flags supported by libfreetype, and are
  5530. a combination of the following values:
  5531. @table @var
  5532. @item default
  5533. @item no_scale
  5534. @item no_hinting
  5535. @item render
  5536. @item no_bitmap
  5537. @item vertical_layout
  5538. @item force_autohint
  5539. @item crop_bitmap
  5540. @item pedantic
  5541. @item ignore_global_advance_width
  5542. @item no_recurse
  5543. @item ignore_transform
  5544. @item monochrome
  5545. @item linear_design
  5546. @item no_autohint
  5547. @end table
  5548. Default value is "default".
  5549. For more information consult the documentation for the FT_LOAD_*
  5550. libfreetype flags.
  5551. @item shadowcolor
  5552. The color to be used for drawing a shadow behind the drawn text. For the
  5553. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5554. The default value of @var{shadowcolor} is "black".
  5555. @item shadowx
  5556. @item shadowy
  5557. The x and y offsets for the text shadow position with respect to the
  5558. position of the text. They can be either positive or negative
  5559. values. The default value for both is "0".
  5560. @item start_number
  5561. The starting frame number for the n/frame_num variable. The default value
  5562. is "0".
  5563. @item tabsize
  5564. The size in number of spaces to use for rendering the tab.
  5565. Default value is 4.
  5566. @item timecode
  5567. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5568. format. It can be used with or without text parameter. @var{timecode_rate}
  5569. option must be specified.
  5570. @item timecode_rate, rate, r
  5571. Set the timecode frame rate (timecode only).
  5572. @item tc24hmax
  5573. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5574. Default is 0 (disabled).
  5575. @item text
  5576. The text string to be drawn. The text must be a sequence of UTF-8
  5577. encoded characters.
  5578. This parameter is mandatory if no file is specified with the parameter
  5579. @var{textfile}.
  5580. @item textfile
  5581. A text file containing text to be drawn. The text must be a sequence
  5582. of UTF-8 encoded characters.
  5583. This parameter is mandatory if no text string is specified with the
  5584. parameter @var{text}.
  5585. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5586. @item reload
  5587. If set to 1, the @var{textfile} will be reloaded before each frame.
  5588. Be sure to update it atomically, or it may be read partially, or even fail.
  5589. @item x
  5590. @item y
  5591. The expressions which specify the offsets where text will be drawn
  5592. within the video frame. They are relative to the top/left border of the
  5593. output image.
  5594. The default value of @var{x} and @var{y} is "0".
  5595. See below for the list of accepted constants and functions.
  5596. @end table
  5597. The parameters for @var{x} and @var{y} are expressions containing the
  5598. following constants and functions:
  5599. @table @option
  5600. @item dar
  5601. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5602. @item hsub
  5603. @item vsub
  5604. horizontal and vertical chroma subsample values. For example for the
  5605. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5606. @item line_h, lh
  5607. the height of each text line
  5608. @item main_h, h, H
  5609. the input height
  5610. @item main_w, w, W
  5611. the input width
  5612. @item max_glyph_a, ascent
  5613. the maximum distance from the baseline to the highest/upper grid
  5614. coordinate used to place a glyph outline point, for all the rendered
  5615. glyphs.
  5616. It is a positive value, due to the grid's orientation with the Y axis
  5617. upwards.
  5618. @item max_glyph_d, descent
  5619. the maximum distance from the baseline to the lowest grid coordinate
  5620. used to place a glyph outline point, for all the rendered glyphs.
  5621. This is a negative value, due to the grid's orientation, with the Y axis
  5622. upwards.
  5623. @item max_glyph_h
  5624. maximum glyph height, that is the maximum height for all the glyphs
  5625. contained in the rendered text, it is equivalent to @var{ascent} -
  5626. @var{descent}.
  5627. @item max_glyph_w
  5628. maximum glyph width, that is the maximum width for all the glyphs
  5629. contained in the rendered text
  5630. @item n
  5631. the number of input frame, starting from 0
  5632. @item rand(min, max)
  5633. return a random number included between @var{min} and @var{max}
  5634. @item sar
  5635. The input sample aspect ratio.
  5636. @item t
  5637. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5638. @item text_h, th
  5639. the height of the rendered text
  5640. @item text_w, tw
  5641. the width of the rendered text
  5642. @item x
  5643. @item y
  5644. the x and y offset coordinates where the text is drawn.
  5645. These parameters allow the @var{x} and @var{y} expressions to refer
  5646. each other, so you can for example specify @code{y=x/dar}.
  5647. @end table
  5648. @anchor{drawtext_expansion}
  5649. @subsection Text expansion
  5650. If @option{expansion} is set to @code{strftime},
  5651. the filter recognizes strftime() sequences in the provided text and
  5652. expands them accordingly. Check the documentation of strftime(). This
  5653. feature is deprecated.
  5654. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5655. If @option{expansion} is set to @code{normal} (which is the default),
  5656. the following expansion mechanism is used.
  5657. The backslash character @samp{\}, followed by any character, always expands to
  5658. the second character.
  5659. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5660. braces is a function name, possibly followed by arguments separated by ':'.
  5661. If the arguments contain special characters or delimiters (':' or '@}'),
  5662. they should be escaped.
  5663. Note that they probably must also be escaped as the value for the
  5664. @option{text} option in the filter argument string and as the filter
  5665. argument in the filtergraph description, and possibly also for the shell,
  5666. that makes up to four levels of escaping; using a text file avoids these
  5667. problems.
  5668. The following functions are available:
  5669. @table @command
  5670. @item expr, e
  5671. The expression evaluation result.
  5672. It must take one argument specifying the expression to be evaluated,
  5673. which accepts the same constants and functions as the @var{x} and
  5674. @var{y} values. Note that not all constants should be used, for
  5675. example the text size is not known when evaluating the expression, so
  5676. the constants @var{text_w} and @var{text_h} will have an undefined
  5677. value.
  5678. @item expr_int_format, eif
  5679. Evaluate the expression's value and output as formatted integer.
  5680. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5681. The second argument specifies the output format. Allowed values are @samp{x},
  5682. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5683. @code{printf} function.
  5684. The third parameter is optional and sets the number of positions taken by the output.
  5685. It can be used to add padding with zeros from the left.
  5686. @item gmtime
  5687. The time at which the filter is running, expressed in UTC.
  5688. It can accept an argument: a strftime() format string.
  5689. @item localtime
  5690. The time at which the filter is running, expressed in the local time zone.
  5691. It can accept an argument: a strftime() format string.
  5692. @item metadata
  5693. Frame metadata. Takes one or two arguments.
  5694. The first argument is mandatory and specifies the metadata key.
  5695. The second argument is optional and specifies a default value, used when the
  5696. metadata key is not found or empty.
  5697. @item n, frame_num
  5698. The frame number, starting from 0.
  5699. @item pict_type
  5700. A 1 character description of the current picture type.
  5701. @item pts
  5702. The timestamp of the current frame.
  5703. It can take up to three arguments.
  5704. The first argument is the format of the timestamp; it defaults to @code{flt}
  5705. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5706. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5707. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5708. @code{localtime} stands for the timestamp of the frame formatted as
  5709. local time zone time.
  5710. The second argument is an offset added to the timestamp.
  5711. If the format is set to @code{localtime} or @code{gmtime},
  5712. a third argument may be supplied: a strftime() format string.
  5713. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5714. @end table
  5715. @subsection Examples
  5716. @itemize
  5717. @item
  5718. Draw "Test Text" with font FreeSerif, using the default values for the
  5719. optional parameters.
  5720. @example
  5721. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5722. @end example
  5723. @item
  5724. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5725. and y=50 (counting from the top-left corner of the screen), text is
  5726. yellow with a red box around it. Both the text and the box have an
  5727. opacity of 20%.
  5728. @example
  5729. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5730. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5731. @end example
  5732. Note that the double quotes are not necessary if spaces are not used
  5733. within the parameter list.
  5734. @item
  5735. Show the text at the center of the video frame:
  5736. @example
  5737. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5738. @end example
  5739. @item
  5740. Show the text at a random position, switching to a new position every 30 seconds:
  5741. @example
  5742. 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)"
  5743. @end example
  5744. @item
  5745. Show a text line sliding from right to left in the last row of the video
  5746. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5747. with no newlines.
  5748. @example
  5749. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5750. @end example
  5751. @item
  5752. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5753. @example
  5754. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5755. @end example
  5756. @item
  5757. Draw a single green letter "g", at the center of the input video.
  5758. The glyph baseline is placed at half screen height.
  5759. @example
  5760. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5761. @end example
  5762. @item
  5763. Show text for 1 second every 3 seconds:
  5764. @example
  5765. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5766. @end example
  5767. @item
  5768. Use fontconfig to set the font. Note that the colons need to be escaped.
  5769. @example
  5770. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5771. @end example
  5772. @item
  5773. Print the date of a real-time encoding (see strftime(3)):
  5774. @example
  5775. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5776. @end example
  5777. @item
  5778. Show text fading in and out (appearing/disappearing):
  5779. @example
  5780. #!/bin/sh
  5781. DS=1.0 # display start
  5782. DE=10.0 # display end
  5783. FID=1.5 # fade in duration
  5784. FOD=5 # fade out duration
  5785. 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 @}"
  5786. @end example
  5787. @item
  5788. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5789. and the @option{fontsize} value are included in the @option{y} offset.
  5790. @example
  5791. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5792. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5793. @end example
  5794. @end itemize
  5795. For more information about libfreetype, check:
  5796. @url{http://www.freetype.org/}.
  5797. For more information about fontconfig, check:
  5798. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5799. For more information about libfribidi, check:
  5800. @url{http://fribidi.org/}.
  5801. @section edgedetect
  5802. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5803. The filter accepts the following options:
  5804. @table @option
  5805. @item low
  5806. @item high
  5807. Set low and high threshold values used by the Canny thresholding
  5808. algorithm.
  5809. The high threshold selects the "strong" edge pixels, which are then
  5810. connected through 8-connectivity with the "weak" edge pixels selected
  5811. by the low threshold.
  5812. @var{low} and @var{high} threshold values must be chosen in the range
  5813. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5814. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5815. is @code{50/255}.
  5816. @item mode
  5817. Define the drawing mode.
  5818. @table @samp
  5819. @item wires
  5820. Draw white/gray wires on black background.
  5821. @item colormix
  5822. Mix the colors to create a paint/cartoon effect.
  5823. @end table
  5824. Default value is @var{wires}.
  5825. @end table
  5826. @subsection Examples
  5827. @itemize
  5828. @item
  5829. Standard edge detection with custom values for the hysteresis thresholding:
  5830. @example
  5831. edgedetect=low=0.1:high=0.4
  5832. @end example
  5833. @item
  5834. Painting effect without thresholding:
  5835. @example
  5836. edgedetect=mode=colormix:high=0
  5837. @end example
  5838. @end itemize
  5839. @section eq
  5840. Set brightness, contrast, saturation and approximate gamma adjustment.
  5841. The filter accepts the following options:
  5842. @table @option
  5843. @item contrast
  5844. Set the contrast expression. The value must be a float value in range
  5845. @code{-2.0} to @code{2.0}. The default value is "1".
  5846. @item brightness
  5847. Set the brightness expression. The value must be a float value in
  5848. range @code{-1.0} to @code{1.0}. The default value is "0".
  5849. @item saturation
  5850. Set the saturation expression. The value must be a float in
  5851. range @code{0.0} to @code{3.0}. The default value is "1".
  5852. @item gamma
  5853. Set the gamma expression. The value must be a float in range
  5854. @code{0.1} to @code{10.0}. The default value is "1".
  5855. @item gamma_r
  5856. Set the gamma expression for red. The value must be a float in
  5857. range @code{0.1} to @code{10.0}. The default value is "1".
  5858. @item gamma_g
  5859. Set the gamma expression for green. The value must be a float in range
  5860. @code{0.1} to @code{10.0}. The default value is "1".
  5861. @item gamma_b
  5862. Set the gamma expression for blue. The value must be a float in range
  5863. @code{0.1} to @code{10.0}. The default value is "1".
  5864. @item gamma_weight
  5865. Set the gamma weight expression. It can be used to reduce the effect
  5866. of a high gamma value on bright image areas, e.g. keep them from
  5867. getting overamplified and just plain white. The value must be a float
  5868. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5869. gamma correction all the way down while @code{1.0} leaves it at its
  5870. full strength. Default is "1".
  5871. @item eval
  5872. Set when the expressions for brightness, contrast, saturation and
  5873. gamma expressions are evaluated.
  5874. It accepts the following values:
  5875. @table @samp
  5876. @item init
  5877. only evaluate expressions once during the filter initialization or
  5878. when a command is processed
  5879. @item frame
  5880. evaluate expressions for each incoming frame
  5881. @end table
  5882. Default value is @samp{init}.
  5883. @end table
  5884. The expressions accept the following parameters:
  5885. @table @option
  5886. @item n
  5887. frame count of the input frame starting from 0
  5888. @item pos
  5889. byte position of the corresponding packet in the input file, NAN if
  5890. unspecified
  5891. @item r
  5892. frame rate of the input video, NAN if the input frame rate is unknown
  5893. @item t
  5894. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5895. @end table
  5896. @subsection Commands
  5897. The filter supports the following commands:
  5898. @table @option
  5899. @item contrast
  5900. Set the contrast expression.
  5901. @item brightness
  5902. Set the brightness expression.
  5903. @item saturation
  5904. Set the saturation expression.
  5905. @item gamma
  5906. Set the gamma expression.
  5907. @item gamma_r
  5908. Set the gamma_r expression.
  5909. @item gamma_g
  5910. Set gamma_g expression.
  5911. @item gamma_b
  5912. Set gamma_b expression.
  5913. @item gamma_weight
  5914. Set gamma_weight expression.
  5915. The command accepts the same syntax of the corresponding option.
  5916. If the specified expression is not valid, it is kept at its current
  5917. value.
  5918. @end table
  5919. @section erosion
  5920. Apply erosion effect to the video.
  5921. This filter replaces the pixel by the local(3x3) minimum.
  5922. It accepts the following options:
  5923. @table @option
  5924. @item threshold0
  5925. @item threshold1
  5926. @item threshold2
  5927. @item threshold3
  5928. Limit the maximum change for each plane, default is 65535.
  5929. If 0, plane will remain unchanged.
  5930. @item coordinates
  5931. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5932. pixels are used.
  5933. Flags to local 3x3 coordinates maps like this:
  5934. 1 2 3
  5935. 4 5
  5936. 6 7 8
  5937. @end table
  5938. @section extractplanes
  5939. Extract color channel components from input video stream into
  5940. separate grayscale video streams.
  5941. The filter accepts the following option:
  5942. @table @option
  5943. @item planes
  5944. Set plane(s) to extract.
  5945. Available values for planes are:
  5946. @table @samp
  5947. @item y
  5948. @item u
  5949. @item v
  5950. @item a
  5951. @item r
  5952. @item g
  5953. @item b
  5954. @end table
  5955. Choosing planes not available in the input will result in an error.
  5956. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5957. with @code{y}, @code{u}, @code{v} planes at same time.
  5958. @end table
  5959. @subsection Examples
  5960. @itemize
  5961. @item
  5962. Extract luma, u and v color channel component from input video frame
  5963. into 3 grayscale outputs:
  5964. @example
  5965. 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
  5966. @end example
  5967. @end itemize
  5968. @section elbg
  5969. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5970. For each input image, the filter will compute the optimal mapping from
  5971. the input to the output given the codebook length, that is the number
  5972. of distinct output colors.
  5973. This filter accepts the following options.
  5974. @table @option
  5975. @item codebook_length, l
  5976. Set codebook length. The value must be a positive integer, and
  5977. represents the number of distinct output colors. Default value is 256.
  5978. @item nb_steps, n
  5979. Set the maximum number of iterations to apply for computing the optimal
  5980. mapping. The higher the value the better the result and the higher the
  5981. computation time. Default value is 1.
  5982. @item seed, s
  5983. Set a random seed, must be an integer included between 0 and
  5984. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5985. will try to use a good random seed on a best effort basis.
  5986. @item pal8
  5987. Set pal8 output pixel format. This option does not work with codebook
  5988. length greater than 256.
  5989. @end table
  5990. @section fade
  5991. Apply a fade-in/out effect to the input video.
  5992. It accepts the following parameters:
  5993. @table @option
  5994. @item type, t
  5995. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5996. effect.
  5997. Default is @code{in}.
  5998. @item start_frame, s
  5999. Specify the number of the frame to start applying the fade
  6000. effect at. Default is 0.
  6001. @item nb_frames, n
  6002. The number of frames that the fade effect lasts. At the end of the
  6003. fade-in effect, the output video will have the same intensity as the input video.
  6004. At the end of the fade-out transition, the output video will be filled with the
  6005. selected @option{color}.
  6006. Default is 25.
  6007. @item alpha
  6008. If set to 1, fade only alpha channel, if one exists on the input.
  6009. Default value is 0.
  6010. @item start_time, st
  6011. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6012. effect. If both start_frame and start_time are specified, the fade will start at
  6013. whichever comes last. Default is 0.
  6014. @item duration, d
  6015. The number of seconds for which the fade effect has to last. At the end of the
  6016. fade-in effect the output video will have the same intensity as the input video,
  6017. at the end of the fade-out transition the output video will be filled with the
  6018. selected @option{color}.
  6019. If both duration and nb_frames are specified, duration is used. Default is 0
  6020. (nb_frames is used by default).
  6021. @item color, c
  6022. Specify the color of the fade. Default is "black".
  6023. @end table
  6024. @subsection Examples
  6025. @itemize
  6026. @item
  6027. Fade in the first 30 frames of video:
  6028. @example
  6029. fade=in:0:30
  6030. @end example
  6031. The command above is equivalent to:
  6032. @example
  6033. fade=t=in:s=0:n=30
  6034. @end example
  6035. @item
  6036. Fade out the last 45 frames of a 200-frame video:
  6037. @example
  6038. fade=out:155:45
  6039. fade=type=out:start_frame=155:nb_frames=45
  6040. @end example
  6041. @item
  6042. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6043. @example
  6044. fade=in:0:25, fade=out:975:25
  6045. @end example
  6046. @item
  6047. Make the first 5 frames yellow, then fade in from frame 5-24:
  6048. @example
  6049. fade=in:5:20:color=yellow
  6050. @end example
  6051. @item
  6052. Fade in alpha over first 25 frames of video:
  6053. @example
  6054. fade=in:0:25:alpha=1
  6055. @end example
  6056. @item
  6057. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6058. @example
  6059. fade=t=in:st=5.5:d=0.5
  6060. @end example
  6061. @end itemize
  6062. @section fftfilt
  6063. Apply arbitrary expressions to samples in frequency domain
  6064. @table @option
  6065. @item dc_Y
  6066. Adjust the dc value (gain) of the luma plane of the image. The filter
  6067. accepts an integer value in range @code{0} to @code{1000}. The default
  6068. value is set to @code{0}.
  6069. @item dc_U
  6070. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6071. filter accepts an integer value in range @code{0} to @code{1000}. The
  6072. default value is set to @code{0}.
  6073. @item dc_V
  6074. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6075. filter accepts an integer value in range @code{0} to @code{1000}. The
  6076. default value is set to @code{0}.
  6077. @item weight_Y
  6078. Set the frequency domain weight expression for the luma plane.
  6079. @item weight_U
  6080. Set the frequency domain weight expression for the 1st chroma plane.
  6081. @item weight_V
  6082. Set the frequency domain weight expression for the 2nd chroma plane.
  6083. The filter accepts the following variables:
  6084. @item X
  6085. @item Y
  6086. The coordinates of the current sample.
  6087. @item W
  6088. @item H
  6089. The width and height of the image.
  6090. @end table
  6091. @subsection Examples
  6092. @itemize
  6093. @item
  6094. High-pass:
  6095. @example
  6096. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6097. @end example
  6098. @item
  6099. Low-pass:
  6100. @example
  6101. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6102. @end example
  6103. @item
  6104. Sharpen:
  6105. @example
  6106. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6107. @end example
  6108. @item
  6109. Blur:
  6110. @example
  6111. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6112. @end example
  6113. @end itemize
  6114. @section field
  6115. Extract a single field from an interlaced image using stride
  6116. arithmetic to avoid wasting CPU time. The output frames are marked as
  6117. non-interlaced.
  6118. The filter accepts the following options:
  6119. @table @option
  6120. @item type
  6121. Specify whether to extract the top (if the value is @code{0} or
  6122. @code{top}) or the bottom field (if the value is @code{1} or
  6123. @code{bottom}).
  6124. @end table
  6125. @section fieldhint
  6126. Create new frames by copying the top and bottom fields from surrounding frames
  6127. supplied as numbers by the hint file.
  6128. @table @option
  6129. @item hint
  6130. Set file containing hints: absolute/relative frame numbers.
  6131. There must be one line for each frame in a clip. Each line must contain two
  6132. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6133. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6134. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6135. for @code{relative} mode. First number tells from which frame to pick up top
  6136. field and second number tells from which frame to pick up bottom field.
  6137. If optionally followed by @code{+} output frame will be marked as interlaced,
  6138. else if followed by @code{-} output frame will be marked as progressive, else
  6139. it will be marked same as input frame.
  6140. If line starts with @code{#} or @code{;} that line is skipped.
  6141. @item mode
  6142. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6143. @end table
  6144. Example of first several lines of @code{hint} file for @code{relative} mode:
  6145. @example
  6146. 0,0 - # first frame
  6147. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6148. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6149. 1,0 -
  6150. 0,0 -
  6151. 0,0 -
  6152. 1,0 -
  6153. 1,0 -
  6154. 1,0 -
  6155. 0,0 -
  6156. 0,0 -
  6157. 1,0 -
  6158. 1,0 -
  6159. 1,0 -
  6160. 0,0 -
  6161. @end example
  6162. @section fieldmatch
  6163. Field matching filter for inverse telecine. It is meant to reconstruct the
  6164. progressive frames from a telecined stream. The filter does not drop duplicated
  6165. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6166. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6167. The separation of the field matching and the decimation is notably motivated by
  6168. the possibility of inserting a de-interlacing filter fallback between the two.
  6169. If the source has mixed telecined and real interlaced content,
  6170. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6171. But these remaining combed frames will be marked as interlaced, and thus can be
  6172. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6173. In addition to the various configuration options, @code{fieldmatch} can take an
  6174. optional second stream, activated through the @option{ppsrc} option. If
  6175. enabled, the frames reconstruction will be based on the fields and frames from
  6176. this second stream. This allows the first input to be pre-processed in order to
  6177. help the various algorithms of the filter, while keeping the output lossless
  6178. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6179. or brightness/contrast adjustments can help.
  6180. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6181. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6182. which @code{fieldmatch} is based on. While the semantic and usage are very
  6183. close, some behaviour and options names can differ.
  6184. The @ref{decimate} filter currently only works for constant frame rate input.
  6185. If your input has mixed telecined (30fps) and progressive content with a lower
  6186. framerate like 24fps use the following filterchain to produce the necessary cfr
  6187. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6188. The filter accepts the following options:
  6189. @table @option
  6190. @item order
  6191. Specify the assumed field order of the input stream. Available values are:
  6192. @table @samp
  6193. @item auto
  6194. Auto detect parity (use FFmpeg's internal parity value).
  6195. @item bff
  6196. Assume bottom field first.
  6197. @item tff
  6198. Assume top field first.
  6199. @end table
  6200. Note that it is sometimes recommended not to trust the parity announced by the
  6201. stream.
  6202. Default value is @var{auto}.
  6203. @item mode
  6204. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6205. sense that it won't risk creating jerkiness due to duplicate frames when
  6206. possible, but if there are bad edits or blended fields it will end up
  6207. outputting combed frames when a good match might actually exist. On the other
  6208. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6209. but will almost always find a good frame if there is one. The other values are
  6210. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6211. jerkiness and creating duplicate frames versus finding good matches in sections
  6212. with bad edits, orphaned fields, blended fields, etc.
  6213. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6214. Available values are:
  6215. @table @samp
  6216. @item pc
  6217. 2-way matching (p/c)
  6218. @item pc_n
  6219. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6220. @item pc_u
  6221. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6222. @item pc_n_ub
  6223. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6224. still combed (p/c + n + u/b)
  6225. @item pcn
  6226. 3-way matching (p/c/n)
  6227. @item pcn_ub
  6228. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6229. detected as combed (p/c/n + u/b)
  6230. @end table
  6231. The parenthesis at the end indicate the matches that would be used for that
  6232. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6233. @var{top}).
  6234. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6235. the slowest.
  6236. Default value is @var{pc_n}.
  6237. @item ppsrc
  6238. Mark the main input stream as a pre-processed input, and enable the secondary
  6239. input stream as the clean source to pick the fields from. See the filter
  6240. introduction for more details. It is similar to the @option{clip2} feature from
  6241. VFM/TFM.
  6242. Default value is @code{0} (disabled).
  6243. @item field
  6244. Set the field to match from. It is recommended to set this to the same value as
  6245. @option{order} unless you experience matching failures with that setting. In
  6246. certain circumstances changing the field that is used to match from can have a
  6247. large impact on matching performance. Available values are:
  6248. @table @samp
  6249. @item auto
  6250. Automatic (same value as @option{order}).
  6251. @item bottom
  6252. Match from the bottom field.
  6253. @item top
  6254. Match from the top field.
  6255. @end table
  6256. Default value is @var{auto}.
  6257. @item mchroma
  6258. Set whether or not chroma is included during the match comparisons. In most
  6259. cases it is recommended to leave this enabled. You should set this to @code{0}
  6260. only if your clip has bad chroma problems such as heavy rainbowing or other
  6261. artifacts. Setting this to @code{0} could also be used to speed things up at
  6262. the cost of some accuracy.
  6263. Default value is @code{1}.
  6264. @item y0
  6265. @item y1
  6266. These define an exclusion band which excludes the lines between @option{y0} and
  6267. @option{y1} from being included in the field matching decision. An exclusion
  6268. band can be used to ignore subtitles, a logo, or other things that may
  6269. interfere with the matching. @option{y0} sets the starting scan line and
  6270. @option{y1} sets the ending line; all lines in between @option{y0} and
  6271. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6272. @option{y0} and @option{y1} to the same value will disable the feature.
  6273. @option{y0} and @option{y1} defaults to @code{0}.
  6274. @item scthresh
  6275. Set the scene change detection threshold as a percentage of maximum change on
  6276. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6277. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6278. @option{scthresh} is @code{[0.0, 100.0]}.
  6279. Default value is @code{12.0}.
  6280. @item combmatch
  6281. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6282. account the combed scores of matches when deciding what match to use as the
  6283. final match. Available values are:
  6284. @table @samp
  6285. @item none
  6286. No final matching based on combed scores.
  6287. @item sc
  6288. Combed scores are only used when a scene change is detected.
  6289. @item full
  6290. Use combed scores all the time.
  6291. @end table
  6292. Default is @var{sc}.
  6293. @item combdbg
  6294. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6295. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6296. Available values are:
  6297. @table @samp
  6298. @item none
  6299. No forced calculation.
  6300. @item pcn
  6301. Force p/c/n calculations.
  6302. @item pcnub
  6303. Force p/c/n/u/b calculations.
  6304. @end table
  6305. Default value is @var{none}.
  6306. @item cthresh
  6307. This is the area combing threshold used for combed frame detection. This
  6308. essentially controls how "strong" or "visible" combing must be to be detected.
  6309. Larger values mean combing must be more visible and smaller values mean combing
  6310. can be less visible or strong and still be detected. Valid settings are from
  6311. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6312. be detected as combed). This is basically a pixel difference value. A good
  6313. range is @code{[8, 12]}.
  6314. Default value is @code{9}.
  6315. @item chroma
  6316. Sets whether or not chroma is considered in the combed frame decision. Only
  6317. disable this if your source has chroma problems (rainbowing, etc.) that are
  6318. causing problems for the combed frame detection with chroma enabled. Actually,
  6319. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6320. where there is chroma only combing in the source.
  6321. Default value is @code{0}.
  6322. @item blockx
  6323. @item blocky
  6324. Respectively set the x-axis and y-axis size of the window used during combed
  6325. frame detection. This has to do with the size of the area in which
  6326. @option{combpel} pixels are required to be detected as combed for a frame to be
  6327. declared combed. See the @option{combpel} parameter description for more info.
  6328. Possible values are any number that is a power of 2 starting at 4 and going up
  6329. to 512.
  6330. Default value is @code{16}.
  6331. @item combpel
  6332. The number of combed pixels inside any of the @option{blocky} by
  6333. @option{blockx} size blocks on the frame for the frame to be detected as
  6334. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6335. setting controls "how much" combing there must be in any localized area (a
  6336. window defined by the @option{blockx} and @option{blocky} settings) on the
  6337. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6338. which point no frames will ever be detected as combed). This setting is known
  6339. as @option{MI} in TFM/VFM vocabulary.
  6340. Default value is @code{80}.
  6341. @end table
  6342. @anchor{p/c/n/u/b meaning}
  6343. @subsection p/c/n/u/b meaning
  6344. @subsubsection p/c/n
  6345. We assume the following telecined stream:
  6346. @example
  6347. Top fields: 1 2 2 3 4
  6348. Bottom fields: 1 2 3 4 4
  6349. @end example
  6350. The numbers correspond to the progressive frame the fields relate to. Here, the
  6351. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6352. When @code{fieldmatch} is configured to run a matching from bottom
  6353. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6354. @example
  6355. Input stream:
  6356. T 1 2 2 3 4
  6357. B 1 2 3 4 4 <-- matching reference
  6358. Matches: c c n n c
  6359. Output stream:
  6360. T 1 2 3 4 4
  6361. B 1 2 3 4 4
  6362. @end example
  6363. As a result of the field matching, we can see that some frames get duplicated.
  6364. To perform a complete inverse telecine, you need to rely on a decimation filter
  6365. after this operation. See for instance the @ref{decimate} filter.
  6366. The same operation now matching from top fields (@option{field}=@var{top})
  6367. looks like this:
  6368. @example
  6369. Input stream:
  6370. T 1 2 2 3 4 <-- matching reference
  6371. B 1 2 3 4 4
  6372. Matches: c c p p c
  6373. Output stream:
  6374. T 1 2 2 3 4
  6375. B 1 2 2 3 4
  6376. @end example
  6377. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6378. basically, they refer to the frame and field of the opposite parity:
  6379. @itemize
  6380. @item @var{p} matches the field of the opposite parity in the previous frame
  6381. @item @var{c} matches the field of the opposite parity in the current frame
  6382. @item @var{n} matches the field of the opposite parity in the next frame
  6383. @end itemize
  6384. @subsubsection u/b
  6385. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6386. from the opposite parity flag. In the following examples, we assume that we are
  6387. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6388. 'x' is placed above and below each matched fields.
  6389. With bottom matching (@option{field}=@var{bottom}):
  6390. @example
  6391. Match: c p n b u
  6392. x x x x x
  6393. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6394. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6395. x x x x x
  6396. Output frames:
  6397. 2 1 2 2 2
  6398. 2 2 2 1 3
  6399. @end example
  6400. With top matching (@option{field}=@var{top}):
  6401. @example
  6402. Match: c p n b u
  6403. x x x x x
  6404. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6405. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6406. x x x x x
  6407. Output frames:
  6408. 2 2 2 1 2
  6409. 2 1 3 2 2
  6410. @end example
  6411. @subsection Examples
  6412. Simple IVTC of a top field first telecined stream:
  6413. @example
  6414. fieldmatch=order=tff:combmatch=none, decimate
  6415. @end example
  6416. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6417. @example
  6418. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6419. @end example
  6420. @section fieldorder
  6421. Transform the field order of the input video.
  6422. It accepts the following parameters:
  6423. @table @option
  6424. @item order
  6425. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6426. for bottom field first.
  6427. @end table
  6428. The default value is @samp{tff}.
  6429. The transformation is done by shifting the picture content up or down
  6430. by one line, and filling the remaining line with appropriate picture content.
  6431. This method is consistent with most broadcast field order converters.
  6432. If the input video is not flagged as being interlaced, or it is already
  6433. flagged as being of the required output field order, then this filter does
  6434. not alter the incoming video.
  6435. It is very useful when converting to or from PAL DV material,
  6436. which is bottom field first.
  6437. For example:
  6438. @example
  6439. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6440. @end example
  6441. @section fifo, afifo
  6442. Buffer input images and send them when they are requested.
  6443. It is mainly useful when auto-inserted by the libavfilter
  6444. framework.
  6445. It does not take parameters.
  6446. @section find_rect
  6447. Find a rectangular object
  6448. It accepts the following options:
  6449. @table @option
  6450. @item object
  6451. Filepath of the object image, needs to be in gray8.
  6452. @item threshold
  6453. Detection threshold, default is 0.5.
  6454. @item mipmaps
  6455. Number of mipmaps, default is 3.
  6456. @item xmin, ymin, xmax, ymax
  6457. Specifies the rectangle in which to search.
  6458. @end table
  6459. @subsection Examples
  6460. @itemize
  6461. @item
  6462. Generate a representative palette of a given video using @command{ffmpeg}:
  6463. @example
  6464. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6465. @end example
  6466. @end itemize
  6467. @section cover_rect
  6468. Cover a rectangular object
  6469. It accepts the following options:
  6470. @table @option
  6471. @item cover
  6472. Filepath of the optional cover image, needs to be in yuv420.
  6473. @item mode
  6474. Set covering mode.
  6475. It accepts the following values:
  6476. @table @samp
  6477. @item cover
  6478. cover it by the supplied image
  6479. @item blur
  6480. cover it by interpolating the surrounding pixels
  6481. @end table
  6482. Default value is @var{blur}.
  6483. @end table
  6484. @subsection Examples
  6485. @itemize
  6486. @item
  6487. Generate a representative palette of a given video using @command{ffmpeg}:
  6488. @example
  6489. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6490. @end example
  6491. @end itemize
  6492. @section floodfill
  6493. Flood area with values of same pixel components with another values.
  6494. It accepts the following options:
  6495. @table @option
  6496. @item x
  6497. Set pixel x coordinate.
  6498. @item y
  6499. Set pixel y coordinate.
  6500. @item s0
  6501. Set source #0 component value.
  6502. @item s1
  6503. Set source #1 component value.
  6504. @item s2
  6505. Set source #2 component value.
  6506. @item s3
  6507. Set source #3 component value.
  6508. @item d0
  6509. Set destination #0 component value.
  6510. @item d1
  6511. Set destination #1 component value.
  6512. @item d2
  6513. Set destination #2 component value.
  6514. @item d3
  6515. Set destination #3 component value.
  6516. @end table
  6517. @anchor{format}
  6518. @section format
  6519. Convert the input video to one of the specified pixel formats.
  6520. Libavfilter will try to pick one that is suitable as input to
  6521. the next filter.
  6522. It accepts the following parameters:
  6523. @table @option
  6524. @item pix_fmts
  6525. A '|'-separated list of pixel format names, such as
  6526. "pix_fmts=yuv420p|monow|rgb24".
  6527. @end table
  6528. @subsection Examples
  6529. @itemize
  6530. @item
  6531. Convert the input video to the @var{yuv420p} format
  6532. @example
  6533. format=pix_fmts=yuv420p
  6534. @end example
  6535. Convert the input video to any of the formats in the list
  6536. @example
  6537. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6538. @end example
  6539. @end itemize
  6540. @anchor{fps}
  6541. @section fps
  6542. Convert the video to specified constant frame rate by duplicating or dropping
  6543. frames as necessary.
  6544. It accepts the following parameters:
  6545. @table @option
  6546. @item fps
  6547. The desired output frame rate. The default is @code{25}.
  6548. @item round
  6549. Rounding method.
  6550. Possible values are:
  6551. @table @option
  6552. @item zero
  6553. zero round towards 0
  6554. @item inf
  6555. round away from 0
  6556. @item down
  6557. round towards -infinity
  6558. @item up
  6559. round towards +infinity
  6560. @item near
  6561. round to nearest
  6562. @end table
  6563. The default is @code{near}.
  6564. @item start_time
  6565. Assume the first PTS should be the given value, in seconds. This allows for
  6566. padding/trimming at the start of stream. By default, no assumption is made
  6567. about the first frame's expected PTS, so no padding or trimming is done.
  6568. For example, this could be set to 0 to pad the beginning with duplicates of
  6569. the first frame if a video stream starts after the audio stream or to trim any
  6570. frames with a negative PTS.
  6571. @end table
  6572. Alternatively, the options can be specified as a flat string:
  6573. @var{fps}[:@var{round}].
  6574. See also the @ref{setpts} filter.
  6575. @subsection Examples
  6576. @itemize
  6577. @item
  6578. A typical usage in order to set the fps to 25:
  6579. @example
  6580. fps=fps=25
  6581. @end example
  6582. @item
  6583. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6584. @example
  6585. fps=fps=film:round=near
  6586. @end example
  6587. @end itemize
  6588. @section framepack
  6589. Pack two different video streams into a stereoscopic video, setting proper
  6590. metadata on supported codecs. The two views should have the same size and
  6591. framerate and processing will stop when the shorter video ends. Please note
  6592. that you may conveniently adjust view properties with the @ref{scale} and
  6593. @ref{fps} filters.
  6594. It accepts the following parameters:
  6595. @table @option
  6596. @item format
  6597. The desired packing format. Supported values are:
  6598. @table @option
  6599. @item sbs
  6600. The views are next to each other (default).
  6601. @item tab
  6602. The views are on top of each other.
  6603. @item lines
  6604. The views are packed by line.
  6605. @item columns
  6606. The views are packed by column.
  6607. @item frameseq
  6608. The views are temporally interleaved.
  6609. @end table
  6610. @end table
  6611. Some examples:
  6612. @example
  6613. # Convert left and right views into a frame-sequential video
  6614. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6615. # Convert views into a side-by-side video with the same output resolution as the input
  6616. 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
  6617. @end example
  6618. @section framerate
  6619. Change the frame rate by interpolating new video output frames from the source
  6620. frames.
  6621. This filter is not designed to function correctly with interlaced media. If
  6622. you wish to change the frame rate of interlaced media then you are required
  6623. to deinterlace before this filter and re-interlace after this filter.
  6624. A description of the accepted options follows.
  6625. @table @option
  6626. @item fps
  6627. Specify the output frames per second. This option can also be specified
  6628. as a value alone. The default is @code{50}.
  6629. @item interp_start
  6630. Specify the start of a range where the output frame will be created as a
  6631. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6632. the default is @code{15}.
  6633. @item interp_end
  6634. Specify the end of a range where the output frame will be created as a
  6635. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6636. the default is @code{240}.
  6637. @item scene
  6638. Specify the level at which a scene change is detected as a value between
  6639. 0 and 100 to indicate a new scene; a low value reflects a low
  6640. probability for the current frame to introduce a new scene, while a higher
  6641. value means the current frame is more likely to be one.
  6642. The default is @code{7}.
  6643. @item flags
  6644. Specify flags influencing the filter process.
  6645. Available value for @var{flags} is:
  6646. @table @option
  6647. @item scene_change_detect, scd
  6648. Enable scene change detection using the value of the option @var{scene}.
  6649. This flag is enabled by default.
  6650. @end table
  6651. @end table
  6652. @section framestep
  6653. Select one frame every N-th frame.
  6654. This filter accepts the following option:
  6655. @table @option
  6656. @item step
  6657. Select frame after every @code{step} frames.
  6658. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6659. @end table
  6660. @anchor{frei0r}
  6661. @section frei0r
  6662. Apply a frei0r effect to the input video.
  6663. To enable the compilation of this filter, you need to install the frei0r
  6664. header and configure FFmpeg with @code{--enable-frei0r}.
  6665. It accepts the following parameters:
  6666. @table @option
  6667. @item filter_name
  6668. The name of the frei0r effect to load. If the environment variable
  6669. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6670. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6671. Otherwise, the standard frei0r paths are searched, in this order:
  6672. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6673. @file{/usr/lib/frei0r-1/}.
  6674. @item filter_params
  6675. A '|'-separated list of parameters to pass to the frei0r effect.
  6676. @end table
  6677. A frei0r effect parameter can be a boolean (its value is either
  6678. "y" or "n"), a double, a color (specified as
  6679. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6680. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6681. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6682. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6683. The number and types of parameters depend on the loaded effect. If an
  6684. effect parameter is not specified, the default value is set.
  6685. @subsection Examples
  6686. @itemize
  6687. @item
  6688. Apply the distort0r effect, setting the first two double parameters:
  6689. @example
  6690. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6691. @end example
  6692. @item
  6693. Apply the colordistance effect, taking a color as the first parameter:
  6694. @example
  6695. frei0r=colordistance:0.2/0.3/0.4
  6696. frei0r=colordistance:violet
  6697. frei0r=colordistance:0x112233
  6698. @end example
  6699. @item
  6700. Apply the perspective effect, specifying the top left and top right image
  6701. positions:
  6702. @example
  6703. frei0r=perspective:0.2/0.2|0.8/0.2
  6704. @end example
  6705. @end itemize
  6706. For more information, see
  6707. @url{http://frei0r.dyne.org}
  6708. @section fspp
  6709. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6710. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6711. processing filter, one of them is performed once per block, not per pixel.
  6712. This allows for much higher speed.
  6713. The filter accepts the following options:
  6714. @table @option
  6715. @item quality
  6716. Set quality. This option defines the number of levels for averaging. It accepts
  6717. an integer in the range 4-5. Default value is @code{4}.
  6718. @item qp
  6719. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6720. If not set, the filter will use the QP from the video stream (if available).
  6721. @item strength
  6722. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6723. more details but also more artifacts, while higher values make the image smoother
  6724. but also blurrier. Default value is @code{0} − PSNR optimal.
  6725. @item use_bframe_qp
  6726. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6727. option may cause flicker since the B-Frames have often larger QP. Default is
  6728. @code{0} (not enabled).
  6729. @end table
  6730. @section gblur
  6731. Apply Gaussian blur filter.
  6732. The filter accepts the following options:
  6733. @table @option
  6734. @item sigma
  6735. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6736. @item steps
  6737. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6738. @item planes
  6739. Set which planes to filter. By default all planes are filtered.
  6740. @item sigmaV
  6741. Set vertical sigma, if negative it will be same as @code{sigma}.
  6742. Default is @code{-1}.
  6743. @end table
  6744. @section geq
  6745. The filter accepts the following options:
  6746. @table @option
  6747. @item lum_expr, lum
  6748. Set the luminance expression.
  6749. @item cb_expr, cb
  6750. Set the chrominance blue expression.
  6751. @item cr_expr, cr
  6752. Set the chrominance red expression.
  6753. @item alpha_expr, a
  6754. Set the alpha expression.
  6755. @item red_expr, r
  6756. Set the red expression.
  6757. @item green_expr, g
  6758. Set the green expression.
  6759. @item blue_expr, b
  6760. Set the blue expression.
  6761. @end table
  6762. The colorspace is selected according to the specified options. If one
  6763. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6764. options is specified, the filter will automatically select a YCbCr
  6765. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6766. @option{blue_expr} options is specified, it will select an RGB
  6767. colorspace.
  6768. If one of the chrominance expression is not defined, it falls back on the other
  6769. one. If no alpha expression is specified it will evaluate to opaque value.
  6770. If none of chrominance expressions are specified, they will evaluate
  6771. to the luminance expression.
  6772. The expressions can use the following variables and functions:
  6773. @table @option
  6774. @item N
  6775. The sequential number of the filtered frame, starting from @code{0}.
  6776. @item X
  6777. @item Y
  6778. The coordinates of the current sample.
  6779. @item W
  6780. @item H
  6781. The width and height of the image.
  6782. @item SW
  6783. @item SH
  6784. Width and height scale depending on the currently filtered plane. It is the
  6785. ratio between the corresponding luma plane number of pixels and the current
  6786. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6787. @code{0.5,0.5} for chroma planes.
  6788. @item T
  6789. Time of the current frame, expressed in seconds.
  6790. @item p(x, y)
  6791. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6792. plane.
  6793. @item lum(x, y)
  6794. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6795. plane.
  6796. @item cb(x, y)
  6797. Return the value of the pixel at location (@var{x},@var{y}) of the
  6798. blue-difference chroma plane. Return 0 if there is no such plane.
  6799. @item cr(x, y)
  6800. Return the value of the pixel at location (@var{x},@var{y}) of the
  6801. red-difference chroma plane. Return 0 if there is no such plane.
  6802. @item r(x, y)
  6803. @item g(x, y)
  6804. @item b(x, y)
  6805. Return the value of the pixel at location (@var{x},@var{y}) of the
  6806. red/green/blue component. Return 0 if there is no such component.
  6807. @item alpha(x, y)
  6808. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6809. plane. Return 0 if there is no such plane.
  6810. @end table
  6811. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6812. automatically clipped to the closer edge.
  6813. @subsection Examples
  6814. @itemize
  6815. @item
  6816. Flip the image horizontally:
  6817. @example
  6818. geq=p(W-X\,Y)
  6819. @end example
  6820. @item
  6821. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6822. wavelength of 100 pixels:
  6823. @example
  6824. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6825. @end example
  6826. @item
  6827. Generate a fancy enigmatic moving light:
  6828. @example
  6829. 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
  6830. @end example
  6831. @item
  6832. Generate a quick emboss effect:
  6833. @example
  6834. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6835. @end example
  6836. @item
  6837. Modify RGB components depending on pixel position:
  6838. @example
  6839. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6840. @end example
  6841. @item
  6842. Create a radial gradient that is the same size as the input (also see
  6843. the @ref{vignette} filter):
  6844. @example
  6845. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6846. @end example
  6847. @end itemize
  6848. @section gradfun
  6849. Fix the banding artifacts that are sometimes introduced into nearly flat
  6850. regions by truncation to 8-bit color depth.
  6851. Interpolate the gradients that should go where the bands are, and
  6852. dither them.
  6853. It is designed for playback only. Do not use it prior to
  6854. lossy compression, because compression tends to lose the dither and
  6855. bring back the bands.
  6856. It accepts the following parameters:
  6857. @table @option
  6858. @item strength
  6859. The maximum amount by which the filter will change any one pixel. This is also
  6860. the threshold for detecting nearly flat regions. Acceptable values range from
  6861. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6862. valid range.
  6863. @item radius
  6864. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6865. gradients, but also prevents the filter from modifying the pixels near detailed
  6866. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6867. values will be clipped to the valid range.
  6868. @end table
  6869. Alternatively, the options can be specified as a flat string:
  6870. @var{strength}[:@var{radius}]
  6871. @subsection Examples
  6872. @itemize
  6873. @item
  6874. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6875. @example
  6876. gradfun=3.5:8
  6877. @end example
  6878. @item
  6879. Specify radius, omitting the strength (which will fall-back to the default
  6880. value):
  6881. @example
  6882. gradfun=radius=8
  6883. @end example
  6884. @end itemize
  6885. @anchor{haldclut}
  6886. @section haldclut
  6887. Apply a Hald CLUT to a video stream.
  6888. First input is the video stream to process, and second one is the Hald CLUT.
  6889. The Hald CLUT input can be a simple picture or a complete video stream.
  6890. The filter accepts the following options:
  6891. @table @option
  6892. @item shortest
  6893. Force termination when the shortest input terminates. Default is @code{0}.
  6894. @item repeatlast
  6895. Continue applying the last CLUT after the end of the stream. A value of
  6896. @code{0} disable the filter after the last frame of the CLUT is reached.
  6897. Default is @code{1}.
  6898. @end table
  6899. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6900. filters share the same internals).
  6901. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6902. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6903. @subsection Workflow examples
  6904. @subsubsection Hald CLUT video stream
  6905. Generate an identity Hald CLUT stream altered with various effects:
  6906. @example
  6907. 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
  6908. @end example
  6909. Note: make sure you use a lossless codec.
  6910. Then use it with @code{haldclut} to apply it on some random stream:
  6911. @example
  6912. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6913. @end example
  6914. The Hald CLUT will be applied to the 10 first seconds (duration of
  6915. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6916. to the remaining frames of the @code{mandelbrot} stream.
  6917. @subsubsection Hald CLUT with preview
  6918. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6919. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6920. biggest possible square starting at the top left of the picture. The remaining
  6921. padding pixels (bottom or right) will be ignored. This area can be used to add
  6922. a preview of the Hald CLUT.
  6923. Typically, the following generated Hald CLUT will be supported by the
  6924. @code{haldclut} filter:
  6925. @example
  6926. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6927. pad=iw+320 [padded_clut];
  6928. smptebars=s=320x256, split [a][b];
  6929. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6930. [main][b] overlay=W-320" -frames:v 1 clut.png
  6931. @end example
  6932. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6933. bars are displayed on the right-top, and below the same color bars processed by
  6934. the color changes.
  6935. Then, the effect of this Hald CLUT can be visualized with:
  6936. @example
  6937. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6938. @end example
  6939. @section hflip
  6940. Flip the input video horizontally.
  6941. For example, to horizontally flip the input video with @command{ffmpeg}:
  6942. @example
  6943. ffmpeg -i in.avi -vf "hflip" out.avi
  6944. @end example
  6945. @section histeq
  6946. This filter applies a global color histogram equalization on a
  6947. per-frame basis.
  6948. It can be used to correct video that has a compressed range of pixel
  6949. intensities. The filter redistributes the pixel intensities to
  6950. equalize their distribution across the intensity range. It may be
  6951. viewed as an "automatically adjusting contrast filter". This filter is
  6952. useful only for correcting degraded or poorly captured source
  6953. video.
  6954. The filter accepts the following options:
  6955. @table @option
  6956. @item strength
  6957. Determine the amount of equalization to be applied. As the strength
  6958. is reduced, the distribution of pixel intensities more-and-more
  6959. approaches that of the input frame. The value must be a float number
  6960. in the range [0,1] and defaults to 0.200.
  6961. @item intensity
  6962. Set the maximum intensity that can generated and scale the output
  6963. values appropriately. The strength should be set as desired and then
  6964. the intensity can be limited if needed to avoid washing-out. The value
  6965. must be a float number in the range [0,1] and defaults to 0.210.
  6966. @item antibanding
  6967. Set the antibanding level. If enabled the filter will randomly vary
  6968. the luminance of output pixels by a small amount to avoid banding of
  6969. the histogram. Possible values are @code{none}, @code{weak} or
  6970. @code{strong}. It defaults to @code{none}.
  6971. @end table
  6972. @section histogram
  6973. Compute and draw a color distribution histogram for the input video.
  6974. The computed histogram is a representation of the color component
  6975. distribution in an image.
  6976. Standard histogram displays the color components distribution in an image.
  6977. Displays color graph for each color component. Shows distribution of
  6978. the Y, U, V, A or R, G, B components, depending on input format, in the
  6979. current frame. Below each graph a color component scale meter is shown.
  6980. The filter accepts the following options:
  6981. @table @option
  6982. @item level_height
  6983. Set height of level. Default value is @code{200}.
  6984. Allowed range is [50, 2048].
  6985. @item scale_height
  6986. Set height of color scale. Default value is @code{12}.
  6987. Allowed range is [0, 40].
  6988. @item display_mode
  6989. Set display mode.
  6990. It accepts the following values:
  6991. @table @samp
  6992. @item stack
  6993. Per color component graphs are placed below each other.
  6994. @item parade
  6995. Per color component graphs are placed side by side.
  6996. @item overlay
  6997. Presents information identical to that in the @code{parade}, except
  6998. that the graphs representing color components are superimposed directly
  6999. over one another.
  7000. @end table
  7001. Default is @code{stack}.
  7002. @item levels_mode
  7003. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7004. Default is @code{linear}.
  7005. @item components
  7006. Set what color components to display.
  7007. Default is @code{7}.
  7008. @item fgopacity
  7009. Set foreground opacity. Default is @code{0.7}.
  7010. @item bgopacity
  7011. Set background opacity. Default is @code{0.5}.
  7012. @end table
  7013. @subsection Examples
  7014. @itemize
  7015. @item
  7016. Calculate and draw histogram:
  7017. @example
  7018. ffplay -i input -vf histogram
  7019. @end example
  7020. @end itemize
  7021. @anchor{hqdn3d}
  7022. @section hqdn3d
  7023. This is a high precision/quality 3d denoise filter. It aims to reduce
  7024. image noise, producing smooth images and making still images really
  7025. still. It should enhance compressibility.
  7026. It accepts the following optional parameters:
  7027. @table @option
  7028. @item luma_spatial
  7029. A non-negative floating point number which specifies spatial luma strength.
  7030. It defaults to 4.0.
  7031. @item chroma_spatial
  7032. A non-negative floating point number which specifies spatial chroma strength.
  7033. It defaults to 3.0*@var{luma_spatial}/4.0.
  7034. @item luma_tmp
  7035. A floating point number which specifies luma temporal strength. It defaults to
  7036. 6.0*@var{luma_spatial}/4.0.
  7037. @item chroma_tmp
  7038. A floating point number which specifies chroma temporal strength. It defaults to
  7039. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7040. @end table
  7041. @section hwdownload
  7042. Download hardware frames to system memory.
  7043. The input must be in hardware frames, and the output a non-hardware format.
  7044. Not all formats will be supported on the output - it may be necessary to insert
  7045. an additional @option{format} filter immediately following in the graph to get
  7046. the output in a supported format.
  7047. @section hwmap
  7048. Map hardware frames to system memory or to another device.
  7049. This filter has several different modes of operation; which one is used depends
  7050. on the input and output formats:
  7051. @itemize
  7052. @item
  7053. Hardware frame input, normal frame output
  7054. Map the input frames to system memory and pass them to the output. If the
  7055. original hardware frame is later required (for example, after overlaying
  7056. something else on part of it), the @option{hwmap} filter can be used again
  7057. in the next mode to retrieve it.
  7058. @item
  7059. Normal frame input, hardware frame output
  7060. If the input is actually a software-mapped hardware frame, then unmap it -
  7061. that is, return the original hardware frame.
  7062. Otherwise, a device must be provided. Create new hardware surfaces on that
  7063. device for the output, then map them back to the software format at the input
  7064. and give those frames to the preceding filter. This will then act like the
  7065. @option{hwupload} filter, but may be able to avoid an additional copy when
  7066. the input is already in a compatible format.
  7067. @item
  7068. Hardware frame input and output
  7069. A device must be supplied for the output, either directly or with the
  7070. @option{derive_device} option. The input and output devices must be of
  7071. different types and compatible - the exact meaning of this is
  7072. system-dependent, but typically it means that they must refer to the same
  7073. underlying hardware context (for example, refer to the same graphics card).
  7074. If the input frames were originally created on the output device, then unmap
  7075. to retrieve the original frames.
  7076. Otherwise, map the frames to the output device - create new hardware frames
  7077. on the output corresponding to the frames on the input.
  7078. @end itemize
  7079. The following additional parameters are accepted:
  7080. @table @option
  7081. @item mode
  7082. Set the frame mapping mode. Some combination of:
  7083. @table @var
  7084. @item read
  7085. The mapped frame should be readable.
  7086. @item write
  7087. The mapped frame should be writeable.
  7088. @item overwrite
  7089. The mapping will always overwrite the entire frame.
  7090. This may improve performance in some cases, as the original contents of the
  7091. frame need not be loaded.
  7092. @item direct
  7093. The mapping must not involve any copying.
  7094. Indirect mappings to copies of frames are created in some cases where either
  7095. direct mapping is not possible or it would have unexpected properties.
  7096. Setting this flag ensures that the mapping is direct and will fail if that is
  7097. not possible.
  7098. @end table
  7099. Defaults to @var{read+write} if not specified.
  7100. @item derive_device @var{type}
  7101. Rather than using the device supplied at initialisation, instead derive a new
  7102. device of type @var{type} from the device the input frames exist on.
  7103. @item reverse
  7104. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7105. and map them back to the source. This may be necessary in some cases where
  7106. a mapping in one direction is required but only the opposite direction is
  7107. supported by the devices being used.
  7108. This option is dangerous - it may break the preceding filter in undefined
  7109. ways if there are any additional constraints on that filter's output.
  7110. Do not use it without fully understanding the implications of its use.
  7111. @end table
  7112. @section hwupload
  7113. Upload system memory frames to hardware surfaces.
  7114. The device to upload to must be supplied when the filter is initialised. If
  7115. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7116. option.
  7117. @anchor{hwupload_cuda}
  7118. @section hwupload_cuda
  7119. Upload system memory frames to a CUDA device.
  7120. It accepts the following optional parameters:
  7121. @table @option
  7122. @item device
  7123. The number of the CUDA device to use
  7124. @end table
  7125. @section hqx
  7126. Apply a high-quality magnification filter designed for pixel art. This filter
  7127. was originally created by Maxim Stepin.
  7128. It accepts the following option:
  7129. @table @option
  7130. @item n
  7131. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7132. @code{hq3x} and @code{4} for @code{hq4x}.
  7133. Default is @code{3}.
  7134. @end table
  7135. @section hstack
  7136. Stack input videos horizontally.
  7137. All streams must be of same pixel format and of same height.
  7138. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7139. to create same output.
  7140. The filter accept the following option:
  7141. @table @option
  7142. @item inputs
  7143. Set number of input streams. Default is 2.
  7144. @item shortest
  7145. If set to 1, force the output to terminate when the shortest input
  7146. terminates. Default value is 0.
  7147. @end table
  7148. @section hue
  7149. Modify the hue and/or the saturation of the input.
  7150. It accepts the following parameters:
  7151. @table @option
  7152. @item h
  7153. Specify the hue angle as a number of degrees. It accepts an expression,
  7154. and defaults to "0".
  7155. @item s
  7156. Specify the saturation in the [-10,10] range. It accepts an expression and
  7157. defaults to "1".
  7158. @item H
  7159. Specify the hue angle as a number of radians. It accepts an
  7160. expression, and defaults to "0".
  7161. @item b
  7162. Specify the brightness in the [-10,10] range. It accepts an expression and
  7163. defaults to "0".
  7164. @end table
  7165. @option{h} and @option{H} are mutually exclusive, and can't be
  7166. specified at the same time.
  7167. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7168. expressions containing the following constants:
  7169. @table @option
  7170. @item n
  7171. frame count of the input frame starting from 0
  7172. @item pts
  7173. presentation timestamp of the input frame expressed in time base units
  7174. @item r
  7175. frame rate of the input video, NAN if the input frame rate is unknown
  7176. @item t
  7177. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7178. @item tb
  7179. time base of the input video
  7180. @end table
  7181. @subsection Examples
  7182. @itemize
  7183. @item
  7184. Set the hue to 90 degrees and the saturation to 1.0:
  7185. @example
  7186. hue=h=90:s=1
  7187. @end example
  7188. @item
  7189. Same command but expressing the hue in radians:
  7190. @example
  7191. hue=H=PI/2:s=1
  7192. @end example
  7193. @item
  7194. Rotate hue and make the saturation swing between 0
  7195. and 2 over a period of 1 second:
  7196. @example
  7197. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7198. @end example
  7199. @item
  7200. Apply a 3 seconds saturation fade-in effect starting at 0:
  7201. @example
  7202. hue="s=min(t/3\,1)"
  7203. @end example
  7204. The general fade-in expression can be written as:
  7205. @example
  7206. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7207. @end example
  7208. @item
  7209. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7210. @example
  7211. hue="s=max(0\, min(1\, (8-t)/3))"
  7212. @end example
  7213. The general fade-out expression can be written as:
  7214. @example
  7215. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7216. @end example
  7217. @end itemize
  7218. @subsection Commands
  7219. This filter supports the following commands:
  7220. @table @option
  7221. @item b
  7222. @item s
  7223. @item h
  7224. @item H
  7225. Modify the hue and/or the saturation and/or brightness of the input video.
  7226. The command accepts the same syntax of the corresponding option.
  7227. If the specified expression is not valid, it is kept at its current
  7228. value.
  7229. @end table
  7230. @section hysteresis
  7231. Grow first stream into second stream by connecting components.
  7232. This makes it possible to build more robust edge masks.
  7233. This filter accepts the following options:
  7234. @table @option
  7235. @item planes
  7236. Set which planes will be processed as bitmap, unprocessed planes will be
  7237. copied from first stream.
  7238. By default value 0xf, all planes will be processed.
  7239. @item threshold
  7240. Set threshold which is used in filtering. If pixel component value is higher than
  7241. this value filter algorithm for connecting components is activated.
  7242. By default value is 0.
  7243. @end table
  7244. @section idet
  7245. Detect video interlacing type.
  7246. This filter tries to detect if the input frames are interlaced, progressive,
  7247. top or bottom field first. It will also try to detect fields that are
  7248. repeated between adjacent frames (a sign of telecine).
  7249. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7250. Multiple frame detection incorporates the classification history of previous frames.
  7251. The filter will log these metadata values:
  7252. @table @option
  7253. @item single.current_frame
  7254. Detected type of current frame using single-frame detection. One of:
  7255. ``tff'' (top field first), ``bff'' (bottom field first),
  7256. ``progressive'', or ``undetermined''
  7257. @item single.tff
  7258. Cumulative number of frames detected as top field first using single-frame detection.
  7259. @item multiple.tff
  7260. Cumulative number of frames detected as top field first using multiple-frame detection.
  7261. @item single.bff
  7262. Cumulative number of frames detected as bottom field first using single-frame detection.
  7263. @item multiple.current_frame
  7264. Detected type of current frame using multiple-frame detection. One of:
  7265. ``tff'' (top field first), ``bff'' (bottom field first),
  7266. ``progressive'', or ``undetermined''
  7267. @item multiple.bff
  7268. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7269. @item single.progressive
  7270. Cumulative number of frames detected as progressive using single-frame detection.
  7271. @item multiple.progressive
  7272. Cumulative number of frames detected as progressive using multiple-frame detection.
  7273. @item single.undetermined
  7274. Cumulative number of frames that could not be classified using single-frame detection.
  7275. @item multiple.undetermined
  7276. Cumulative number of frames that could not be classified using multiple-frame detection.
  7277. @item repeated.current_frame
  7278. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7279. @item repeated.neither
  7280. Cumulative number of frames with no repeated field.
  7281. @item repeated.top
  7282. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7283. @item repeated.bottom
  7284. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7285. @end table
  7286. The filter accepts the following options:
  7287. @table @option
  7288. @item intl_thres
  7289. Set interlacing threshold.
  7290. @item prog_thres
  7291. Set progressive threshold.
  7292. @item rep_thres
  7293. Threshold for repeated field detection.
  7294. @item half_life
  7295. Number of frames after which a given frame's contribution to the
  7296. statistics is halved (i.e., it contributes only 0.5 to its
  7297. classification). The default of 0 means that all frames seen are given
  7298. full weight of 1.0 forever.
  7299. @item analyze_interlaced_flag
  7300. When this is not 0 then idet will use the specified number of frames to determine
  7301. if the interlaced flag is accurate, it will not count undetermined frames.
  7302. If the flag is found to be accurate it will be used without any further
  7303. computations, if it is found to be inaccurate it will be cleared without any
  7304. further computations. This allows inserting the idet filter as a low computational
  7305. method to clean up the interlaced flag
  7306. @end table
  7307. @section il
  7308. Deinterleave or interleave fields.
  7309. This filter allows one to process interlaced images fields without
  7310. deinterlacing them. Deinterleaving splits the input frame into 2
  7311. fields (so called half pictures). Odd lines are moved to the top
  7312. half of the output image, even lines to the bottom half.
  7313. You can process (filter) them independently and then re-interleave them.
  7314. The filter accepts the following options:
  7315. @table @option
  7316. @item luma_mode, l
  7317. @item chroma_mode, c
  7318. @item alpha_mode, a
  7319. Available values for @var{luma_mode}, @var{chroma_mode} and
  7320. @var{alpha_mode} are:
  7321. @table @samp
  7322. @item none
  7323. Do nothing.
  7324. @item deinterleave, d
  7325. Deinterleave fields, placing one above the other.
  7326. @item interleave, i
  7327. Interleave fields. Reverse the effect of deinterleaving.
  7328. @end table
  7329. Default value is @code{none}.
  7330. @item luma_swap, ls
  7331. @item chroma_swap, cs
  7332. @item alpha_swap, as
  7333. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7334. @end table
  7335. @section inflate
  7336. Apply inflate effect to the video.
  7337. This filter replaces the pixel by the local(3x3) average by taking into account
  7338. only values higher than the pixel.
  7339. It accepts the following options:
  7340. @table @option
  7341. @item threshold0
  7342. @item threshold1
  7343. @item threshold2
  7344. @item threshold3
  7345. Limit the maximum change for each plane, default is 65535.
  7346. If 0, plane will remain unchanged.
  7347. @end table
  7348. @section interlace
  7349. Simple interlacing filter from progressive contents. This interleaves upper (or
  7350. lower) lines from odd frames with lower (or upper) lines from even frames,
  7351. halving the frame rate and preserving image height.
  7352. @example
  7353. Original Original New Frame
  7354. Frame 'j' Frame 'j+1' (tff)
  7355. ========== =========== ==================
  7356. Line 0 --------------------> Frame 'j' Line 0
  7357. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7358. Line 2 ---------------------> Frame 'j' Line 2
  7359. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7360. ... ... ...
  7361. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7362. @end example
  7363. It accepts the following optional parameters:
  7364. @table @option
  7365. @item scan
  7366. This determines whether the interlaced frame is taken from the even
  7367. (tff - default) or odd (bff) lines of the progressive frame.
  7368. @item lowpass
  7369. Vertical lowpass filter to avoid twitter interlacing and
  7370. reduce moire patterns.
  7371. @table @samp
  7372. @item 0, off
  7373. Disable vertical lowpass filter
  7374. @item 1, linear
  7375. Enable linear filter (default)
  7376. @item 2, complex
  7377. Enable complex filter. This will slightly less reduce twitter and moire
  7378. but better retain detail and subjective sharpness impression.
  7379. @end table
  7380. @end table
  7381. @section kerndeint
  7382. Deinterlace input video by applying Donald Graft's adaptive kernel
  7383. deinterling. Work on interlaced parts of a video to produce
  7384. progressive frames.
  7385. The description of the accepted parameters follows.
  7386. @table @option
  7387. @item thresh
  7388. Set the threshold which affects the filter's tolerance when
  7389. determining if a pixel line must be processed. It must be an integer
  7390. in the range [0,255] and defaults to 10. A value of 0 will result in
  7391. applying the process on every pixels.
  7392. @item map
  7393. Paint pixels exceeding the threshold value to white if set to 1.
  7394. Default is 0.
  7395. @item order
  7396. Set the fields order. Swap fields if set to 1, leave fields alone if
  7397. 0. Default is 0.
  7398. @item sharp
  7399. Enable additional sharpening if set to 1. Default is 0.
  7400. @item twoway
  7401. Enable twoway sharpening if set to 1. Default is 0.
  7402. @end table
  7403. @subsection Examples
  7404. @itemize
  7405. @item
  7406. Apply default values:
  7407. @example
  7408. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7409. @end example
  7410. @item
  7411. Enable additional sharpening:
  7412. @example
  7413. kerndeint=sharp=1
  7414. @end example
  7415. @item
  7416. Paint processed pixels in white:
  7417. @example
  7418. kerndeint=map=1
  7419. @end example
  7420. @end itemize
  7421. @section lenscorrection
  7422. Correct radial lens distortion
  7423. This filter can be used to correct for radial distortion as can result from the use
  7424. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7425. one can use tools available for example as part of opencv or simply trial-and-error.
  7426. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7427. and extract the k1 and k2 coefficients from the resulting matrix.
  7428. Note that effectively the same filter is available in the open-source tools Krita and
  7429. Digikam from the KDE project.
  7430. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7431. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7432. brightness distribution, so you may want to use both filters together in certain
  7433. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7434. be applied before or after lens correction.
  7435. @subsection Options
  7436. The filter accepts the following options:
  7437. @table @option
  7438. @item cx
  7439. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7440. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7441. width.
  7442. @item cy
  7443. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7444. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7445. height.
  7446. @item k1
  7447. Coefficient of the quadratic correction term. 0.5 means no correction.
  7448. @item k2
  7449. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7450. @end table
  7451. The formula that generates the correction is:
  7452. @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)
  7453. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7454. distances from the focal point in the source and target images, respectively.
  7455. @section libvmaf
  7456. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7457. score between two input videos.
  7458. This filter takes two input videos.
  7459. Both video inputs must have the same resolution and pixel format for
  7460. this filter to work correctly. Also it assumes that both inputs
  7461. have the same number of frames, which are compared one by one.
  7462. The obtained average VMAF score is printed through the logging system.
  7463. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7464. After installing the library it can be enabled using:
  7465. @code{./configure --enable-libvmaf}.
  7466. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7467. On the below examples the input file @file{main.mpg} being processed is
  7468. compared with the reference file @file{ref.mpg}.
  7469. The filter has following options:
  7470. @table @option
  7471. @item model_path
  7472. Set the model path which is to be used for SVM.
  7473. Default value: @code{"vmaf_v0.6.1.pkl"}
  7474. @item log_path
  7475. Set the file path to be used to store logs.
  7476. @item log_fmt
  7477. Set the format of the log file (xml or json).
  7478. @item enable_transform
  7479. Enables transform for computing vmaf.
  7480. @item phone_model
  7481. Invokes the phone model which will generate VMAF scores higher than in the
  7482. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7483. @item psnr
  7484. Enables computing psnr along with vmaf.
  7485. @item ssim
  7486. Enables computing ssim along with vmaf.
  7487. @item ms_ssim
  7488. Enables computing ms_ssim along with vmaf.
  7489. @item pool
  7490. Set the pool method to be used for computing vmaf.
  7491. @end table
  7492. For example:
  7493. @example
  7494. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7495. @end example
  7496. Example with options:
  7497. @example
  7498. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7499. @end example
  7500. @section limiter
  7501. Limits the pixel components values to the specified range [min, max].
  7502. The filter accepts the following options:
  7503. @table @option
  7504. @item min
  7505. Lower bound. Defaults to the lowest allowed value for the input.
  7506. @item max
  7507. Upper bound. Defaults to the highest allowed value for the input.
  7508. @item planes
  7509. Specify which planes will be processed. Defaults to all available.
  7510. @end table
  7511. @section loop
  7512. Loop video frames.
  7513. The filter accepts the following options:
  7514. @table @option
  7515. @item loop
  7516. Set the number of loops.
  7517. @item size
  7518. Set maximal size in number of frames.
  7519. @item start
  7520. Set first frame of loop.
  7521. @end table
  7522. @anchor{lut3d}
  7523. @section lut3d
  7524. Apply a 3D LUT to an input video.
  7525. The filter accepts the following options:
  7526. @table @option
  7527. @item file
  7528. Set the 3D LUT file name.
  7529. Currently supported formats:
  7530. @table @samp
  7531. @item 3dl
  7532. AfterEffects
  7533. @item cube
  7534. Iridas
  7535. @item dat
  7536. DaVinci
  7537. @item m3d
  7538. Pandora
  7539. @end table
  7540. @item interp
  7541. Select interpolation mode.
  7542. Available values are:
  7543. @table @samp
  7544. @item nearest
  7545. Use values from the nearest defined point.
  7546. @item trilinear
  7547. Interpolate values using the 8 points defining a cube.
  7548. @item tetrahedral
  7549. Interpolate values using a tetrahedron.
  7550. @end table
  7551. @end table
  7552. @section lumakey
  7553. Turn certain luma values into transparency.
  7554. The filter accepts the following options:
  7555. @table @option
  7556. @item threshold
  7557. Set the luma which will be used as base for transparency.
  7558. Default value is @code{0}.
  7559. @item tolerance
  7560. Set the range of luma values to be keyed out.
  7561. Default value is @code{0}.
  7562. @item softness
  7563. Set the range of softness. Default value is @code{0}.
  7564. Use this to control gradual transition from zero to full transparency.
  7565. @end table
  7566. @section lut, lutrgb, lutyuv
  7567. Compute a look-up table for binding each pixel component input value
  7568. to an output value, and apply it to the input video.
  7569. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7570. to an RGB input video.
  7571. These filters accept the following parameters:
  7572. @table @option
  7573. @item c0
  7574. set first pixel component expression
  7575. @item c1
  7576. set second pixel component expression
  7577. @item c2
  7578. set third pixel component expression
  7579. @item c3
  7580. set fourth pixel component expression, corresponds to the alpha component
  7581. @item r
  7582. set red component expression
  7583. @item g
  7584. set green component expression
  7585. @item b
  7586. set blue component expression
  7587. @item a
  7588. alpha component expression
  7589. @item y
  7590. set Y/luminance component expression
  7591. @item u
  7592. set U/Cb component expression
  7593. @item v
  7594. set V/Cr component expression
  7595. @end table
  7596. Each of them specifies the expression to use for computing the lookup table for
  7597. the corresponding pixel component values.
  7598. The exact component associated to each of the @var{c*} options depends on the
  7599. format in input.
  7600. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7601. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7602. The expressions can contain the following constants and functions:
  7603. @table @option
  7604. @item w
  7605. @item h
  7606. The input width and height.
  7607. @item val
  7608. The input value for the pixel component.
  7609. @item clipval
  7610. The input value, clipped to the @var{minval}-@var{maxval} range.
  7611. @item maxval
  7612. The maximum value for the pixel component.
  7613. @item minval
  7614. The minimum value for the pixel component.
  7615. @item negval
  7616. The negated value for the pixel component value, clipped to the
  7617. @var{minval}-@var{maxval} range; it corresponds to the expression
  7618. "maxval-clipval+minval".
  7619. @item clip(val)
  7620. The computed value in @var{val}, clipped to the
  7621. @var{minval}-@var{maxval} range.
  7622. @item gammaval(gamma)
  7623. The computed gamma correction value of the pixel component value,
  7624. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7625. expression
  7626. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7627. @end table
  7628. All expressions default to "val".
  7629. @subsection Examples
  7630. @itemize
  7631. @item
  7632. Negate input video:
  7633. @example
  7634. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7635. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7636. @end example
  7637. The above is the same as:
  7638. @example
  7639. lutrgb="r=negval:g=negval:b=negval"
  7640. lutyuv="y=negval:u=negval:v=negval"
  7641. @end example
  7642. @item
  7643. Negate luminance:
  7644. @example
  7645. lutyuv=y=negval
  7646. @end example
  7647. @item
  7648. Remove chroma components, turning the video into a graytone image:
  7649. @example
  7650. lutyuv="u=128:v=128"
  7651. @end example
  7652. @item
  7653. Apply a luma burning effect:
  7654. @example
  7655. lutyuv="y=2*val"
  7656. @end example
  7657. @item
  7658. Remove green and blue components:
  7659. @example
  7660. lutrgb="g=0:b=0"
  7661. @end example
  7662. @item
  7663. Set a constant alpha channel value on input:
  7664. @example
  7665. format=rgba,lutrgb=a="maxval-minval/2"
  7666. @end example
  7667. @item
  7668. Correct luminance gamma by a factor of 0.5:
  7669. @example
  7670. lutyuv=y=gammaval(0.5)
  7671. @end example
  7672. @item
  7673. Discard least significant bits of luma:
  7674. @example
  7675. lutyuv=y='bitand(val, 128+64+32)'
  7676. @end example
  7677. @item
  7678. Technicolor like effect:
  7679. @example
  7680. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7681. @end example
  7682. @end itemize
  7683. @section lut2, tlut2
  7684. The @code{lut2} filter takes two input streams and outputs one
  7685. stream.
  7686. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7687. from one single stream.
  7688. This filter accepts the following parameters:
  7689. @table @option
  7690. @item c0
  7691. set first pixel component expression
  7692. @item c1
  7693. set second pixel component expression
  7694. @item c2
  7695. set third pixel component expression
  7696. @item c3
  7697. set fourth pixel component expression, corresponds to the alpha component
  7698. @end table
  7699. Each of them specifies the expression to use for computing the lookup table for
  7700. the corresponding pixel component values.
  7701. The exact component associated to each of the @var{c*} options depends on the
  7702. format in inputs.
  7703. The expressions can contain the following constants:
  7704. @table @option
  7705. @item w
  7706. @item h
  7707. The input width and height.
  7708. @item x
  7709. The first input value for the pixel component.
  7710. @item y
  7711. The second input value for the pixel component.
  7712. @item bdx
  7713. The first input video bit depth.
  7714. @item bdy
  7715. The second input video bit depth.
  7716. @end table
  7717. All expressions default to "x".
  7718. @subsection Examples
  7719. @itemize
  7720. @item
  7721. Highlight differences between two RGB video streams:
  7722. @example
  7723. 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)'
  7724. @end example
  7725. @item
  7726. Highlight differences between two YUV video streams:
  7727. @example
  7728. 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)'
  7729. @end example
  7730. @item
  7731. Show max difference between two video streams:
  7732. @example
  7733. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  7734. @end example
  7735. @end itemize
  7736. @section maskedclamp
  7737. Clamp the first input stream with the second input and third input stream.
  7738. Returns the value of first stream to be between second input
  7739. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7740. This filter accepts the following options:
  7741. @table @option
  7742. @item undershoot
  7743. Default value is @code{0}.
  7744. @item overshoot
  7745. Default value is @code{0}.
  7746. @item planes
  7747. Set which planes will be processed as bitmap, unprocessed planes will be
  7748. copied from first stream.
  7749. By default value 0xf, all planes will be processed.
  7750. @end table
  7751. @section maskedmerge
  7752. Merge the first input stream with the second input stream using per pixel
  7753. weights in the third input stream.
  7754. A value of 0 in the third stream pixel component means that pixel component
  7755. from first stream is returned unchanged, while maximum value (eg. 255 for
  7756. 8-bit videos) means that pixel component from second stream is returned
  7757. unchanged. Intermediate values define the amount of merging between both
  7758. input stream's pixel components.
  7759. This filter accepts the following options:
  7760. @table @option
  7761. @item planes
  7762. Set which planes will be processed as bitmap, unprocessed planes will be
  7763. copied from first stream.
  7764. By default value 0xf, all planes will be processed.
  7765. @end table
  7766. @section mcdeint
  7767. Apply motion-compensation deinterlacing.
  7768. It needs one field per frame as input and must thus be used together
  7769. with yadif=1/3 or equivalent.
  7770. This filter accepts the following options:
  7771. @table @option
  7772. @item mode
  7773. Set the deinterlacing mode.
  7774. It accepts one of the following values:
  7775. @table @samp
  7776. @item fast
  7777. @item medium
  7778. @item slow
  7779. use iterative motion estimation
  7780. @item extra_slow
  7781. like @samp{slow}, but use multiple reference frames.
  7782. @end table
  7783. Default value is @samp{fast}.
  7784. @item parity
  7785. Set the picture field parity assumed for the input video. It must be
  7786. one of the following values:
  7787. @table @samp
  7788. @item 0, tff
  7789. assume top field first
  7790. @item 1, bff
  7791. assume bottom field first
  7792. @end table
  7793. Default value is @samp{bff}.
  7794. @item qp
  7795. Set per-block quantization parameter (QP) used by the internal
  7796. encoder.
  7797. Higher values should result in a smoother motion vector field but less
  7798. optimal individual vectors. Default value is 1.
  7799. @end table
  7800. @section mergeplanes
  7801. Merge color channel components from several video streams.
  7802. The filter accepts up to 4 input streams, and merge selected input
  7803. planes to the output video.
  7804. This filter accepts the following options:
  7805. @table @option
  7806. @item mapping
  7807. Set input to output plane mapping. Default is @code{0}.
  7808. The mappings is specified as a bitmap. It should be specified as a
  7809. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7810. mapping for the first plane of the output stream. 'A' sets the number of
  7811. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7812. corresponding input to use (from 0 to 3). The rest of the mappings is
  7813. similar, 'Bb' describes the mapping for the output stream second
  7814. plane, 'Cc' describes the mapping for the output stream third plane and
  7815. 'Dd' describes the mapping for the output stream fourth plane.
  7816. @item format
  7817. Set output pixel format. Default is @code{yuva444p}.
  7818. @end table
  7819. @subsection Examples
  7820. @itemize
  7821. @item
  7822. Merge three gray video streams of same width and height into single video stream:
  7823. @example
  7824. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7825. @end example
  7826. @item
  7827. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7828. @example
  7829. [a0][a1]mergeplanes=0x00010210:yuva444p
  7830. @end example
  7831. @item
  7832. Swap Y and A plane in yuva444p stream:
  7833. @example
  7834. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7835. @end example
  7836. @item
  7837. Swap U and V plane in yuv420p stream:
  7838. @example
  7839. format=yuv420p,mergeplanes=0x000201:yuv420p
  7840. @end example
  7841. @item
  7842. Cast a rgb24 clip to yuv444p:
  7843. @example
  7844. format=rgb24,mergeplanes=0x000102:yuv444p
  7845. @end example
  7846. @end itemize
  7847. @section mestimate
  7848. Estimate and export motion vectors using block matching algorithms.
  7849. Motion vectors are stored in frame side data to be used by other filters.
  7850. This filter accepts the following options:
  7851. @table @option
  7852. @item method
  7853. Specify the motion estimation method. Accepts one of the following values:
  7854. @table @samp
  7855. @item esa
  7856. Exhaustive search algorithm.
  7857. @item tss
  7858. Three step search algorithm.
  7859. @item tdls
  7860. Two dimensional logarithmic search algorithm.
  7861. @item ntss
  7862. New three step search algorithm.
  7863. @item fss
  7864. Four step search algorithm.
  7865. @item ds
  7866. Diamond search algorithm.
  7867. @item hexbs
  7868. Hexagon-based search algorithm.
  7869. @item epzs
  7870. Enhanced predictive zonal search algorithm.
  7871. @item umh
  7872. Uneven multi-hexagon search algorithm.
  7873. @end table
  7874. Default value is @samp{esa}.
  7875. @item mb_size
  7876. Macroblock size. Default @code{16}.
  7877. @item search_param
  7878. Search parameter. Default @code{7}.
  7879. @end table
  7880. @section midequalizer
  7881. Apply Midway Image Equalization effect using two video streams.
  7882. Midway Image Equalization adjusts a pair of images to have the same
  7883. histogram, while maintaining their dynamics as much as possible. It's
  7884. useful for e.g. matching exposures from a pair of stereo cameras.
  7885. This filter has two inputs and one output, which must be of same pixel format, but
  7886. may be of different sizes. The output of filter is first input adjusted with
  7887. midway histogram of both inputs.
  7888. This filter accepts the following option:
  7889. @table @option
  7890. @item planes
  7891. Set which planes to process. Default is @code{15}, which is all available planes.
  7892. @end table
  7893. @section minterpolate
  7894. Convert the video to specified frame rate using motion interpolation.
  7895. This filter accepts the following options:
  7896. @table @option
  7897. @item fps
  7898. 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}.
  7899. @item mi_mode
  7900. Motion interpolation mode. Following values are accepted:
  7901. @table @samp
  7902. @item dup
  7903. Duplicate previous or next frame for interpolating new ones.
  7904. @item blend
  7905. Blend source frames. Interpolated frame is mean of previous and next frames.
  7906. @item mci
  7907. Motion compensated interpolation. Following options are effective when this mode is selected:
  7908. @table @samp
  7909. @item mc_mode
  7910. Motion compensation mode. Following values are accepted:
  7911. @table @samp
  7912. @item obmc
  7913. Overlapped block motion compensation.
  7914. @item aobmc
  7915. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7916. @end table
  7917. Default mode is @samp{obmc}.
  7918. @item me_mode
  7919. Motion estimation mode. Following values are accepted:
  7920. @table @samp
  7921. @item bidir
  7922. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7923. @item bilat
  7924. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7925. @end table
  7926. Default mode is @samp{bilat}.
  7927. @item me
  7928. The algorithm to be used for motion estimation. Following values are accepted:
  7929. @table @samp
  7930. @item esa
  7931. Exhaustive search algorithm.
  7932. @item tss
  7933. Three step search algorithm.
  7934. @item tdls
  7935. Two dimensional logarithmic search algorithm.
  7936. @item ntss
  7937. New three step search algorithm.
  7938. @item fss
  7939. Four step search algorithm.
  7940. @item ds
  7941. Diamond search algorithm.
  7942. @item hexbs
  7943. Hexagon-based search algorithm.
  7944. @item epzs
  7945. Enhanced predictive zonal search algorithm.
  7946. @item umh
  7947. Uneven multi-hexagon search algorithm.
  7948. @end table
  7949. Default algorithm is @samp{epzs}.
  7950. @item mb_size
  7951. Macroblock size. Default @code{16}.
  7952. @item search_param
  7953. Motion estimation search parameter. Default @code{32}.
  7954. @item vsbmc
  7955. 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).
  7956. @end table
  7957. @end table
  7958. @item scd
  7959. 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:
  7960. @table @samp
  7961. @item none
  7962. Disable scene change detection.
  7963. @item fdiff
  7964. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7965. @end table
  7966. Default method is @samp{fdiff}.
  7967. @item scd_threshold
  7968. Scene change detection threshold. Default is @code{5.0}.
  7969. @end table
  7970. @section mpdecimate
  7971. Drop frames that do not differ greatly from the previous frame in
  7972. order to reduce frame rate.
  7973. The main use of this filter is for very-low-bitrate encoding
  7974. (e.g. streaming over dialup modem), but it could in theory be used for
  7975. fixing movies that were inverse-telecined incorrectly.
  7976. A description of the accepted options follows.
  7977. @table @option
  7978. @item max
  7979. Set the maximum number of consecutive frames which can be dropped (if
  7980. positive), or the minimum interval between dropped frames (if
  7981. negative). If the value is 0, the frame is dropped unregarding the
  7982. number of previous sequentially dropped frames.
  7983. Default value is 0.
  7984. @item hi
  7985. @item lo
  7986. @item frac
  7987. Set the dropping threshold values.
  7988. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7989. represent actual pixel value differences, so a threshold of 64
  7990. corresponds to 1 unit of difference for each pixel, or the same spread
  7991. out differently over the block.
  7992. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7993. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7994. meaning the whole image) differ by more than a threshold of @option{lo}.
  7995. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7996. 64*5, and default value for @option{frac} is 0.33.
  7997. @end table
  7998. @section negate
  7999. Negate input video.
  8000. It accepts an integer in input; if non-zero it negates the
  8001. alpha component (if available). The default value in input is 0.
  8002. @section nlmeans
  8003. Denoise frames using Non-Local Means algorithm.
  8004. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8005. context similarity is defined by comparing their surrounding patches of size
  8006. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8007. around the pixel.
  8008. Note that the research area defines centers for patches, which means some
  8009. patches will be made of pixels outside that research area.
  8010. The filter accepts the following options.
  8011. @table @option
  8012. @item s
  8013. Set denoising strength.
  8014. @item p
  8015. Set patch size.
  8016. @item pc
  8017. Same as @option{p} but for chroma planes.
  8018. The default value is @var{0} and means automatic.
  8019. @item r
  8020. Set research size.
  8021. @item rc
  8022. Same as @option{r} but for chroma planes.
  8023. The default value is @var{0} and means automatic.
  8024. @end table
  8025. @section nnedi
  8026. Deinterlace video using neural network edge directed interpolation.
  8027. This filter accepts the following options:
  8028. @table @option
  8029. @item weights
  8030. Mandatory option, without binary file filter can not work.
  8031. Currently file can be found here:
  8032. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8033. @item deint
  8034. Set which frames to deinterlace, by default it is @code{all}.
  8035. Can be @code{all} or @code{interlaced}.
  8036. @item field
  8037. Set mode of operation.
  8038. Can be one of the following:
  8039. @table @samp
  8040. @item af
  8041. Use frame flags, both fields.
  8042. @item a
  8043. Use frame flags, single field.
  8044. @item t
  8045. Use top field only.
  8046. @item b
  8047. Use bottom field only.
  8048. @item tf
  8049. Use both fields, top first.
  8050. @item bf
  8051. Use both fields, bottom first.
  8052. @end table
  8053. @item planes
  8054. Set which planes to process, by default filter process all frames.
  8055. @item nsize
  8056. Set size of local neighborhood around each pixel, used by the predictor neural
  8057. network.
  8058. Can be one of the following:
  8059. @table @samp
  8060. @item s8x6
  8061. @item s16x6
  8062. @item s32x6
  8063. @item s48x6
  8064. @item s8x4
  8065. @item s16x4
  8066. @item s32x4
  8067. @end table
  8068. @item nns
  8069. Set the number of neurons in predicctor neural network.
  8070. Can be one of the following:
  8071. @table @samp
  8072. @item n16
  8073. @item n32
  8074. @item n64
  8075. @item n128
  8076. @item n256
  8077. @end table
  8078. @item qual
  8079. Controls the number of different neural network predictions that are blended
  8080. together to compute the final output value. Can be @code{fast}, default or
  8081. @code{slow}.
  8082. @item etype
  8083. Set which set of weights to use in the predictor.
  8084. Can be one of the following:
  8085. @table @samp
  8086. @item a
  8087. weights trained to minimize absolute error
  8088. @item s
  8089. weights trained to minimize squared error
  8090. @end table
  8091. @item pscrn
  8092. Controls whether or not the prescreener neural network is used to decide
  8093. which pixels should be processed by the predictor neural network and which
  8094. can be handled by simple cubic interpolation.
  8095. The prescreener is trained to know whether cubic interpolation will be
  8096. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8097. The computational complexity of the prescreener nn is much less than that of
  8098. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8099. using the prescreener generally results in much faster processing.
  8100. The prescreener is pretty accurate, so the difference between using it and not
  8101. using it is almost always unnoticeable.
  8102. Can be one of the following:
  8103. @table @samp
  8104. @item none
  8105. @item original
  8106. @item new
  8107. @end table
  8108. Default is @code{new}.
  8109. @item fapprox
  8110. Set various debugging flags.
  8111. @end table
  8112. @section noformat
  8113. Force libavfilter not to use any of the specified pixel formats for the
  8114. input to the next filter.
  8115. It accepts the following parameters:
  8116. @table @option
  8117. @item pix_fmts
  8118. A '|'-separated list of pixel format names, such as
  8119. apix_fmts=yuv420p|monow|rgb24".
  8120. @end table
  8121. @subsection Examples
  8122. @itemize
  8123. @item
  8124. Force libavfilter to use a format different from @var{yuv420p} for the
  8125. input to the vflip filter:
  8126. @example
  8127. noformat=pix_fmts=yuv420p,vflip
  8128. @end example
  8129. @item
  8130. Convert the input video to any of the formats not contained in the list:
  8131. @example
  8132. noformat=yuv420p|yuv444p|yuv410p
  8133. @end example
  8134. @end itemize
  8135. @section noise
  8136. Add noise on video input frame.
  8137. The filter accepts the following options:
  8138. @table @option
  8139. @item all_seed
  8140. @item c0_seed
  8141. @item c1_seed
  8142. @item c2_seed
  8143. @item c3_seed
  8144. Set noise seed for specific pixel component or all pixel components in case
  8145. of @var{all_seed}. Default value is @code{123457}.
  8146. @item all_strength, alls
  8147. @item c0_strength, c0s
  8148. @item c1_strength, c1s
  8149. @item c2_strength, c2s
  8150. @item c3_strength, c3s
  8151. Set noise strength for specific pixel component or all pixel components in case
  8152. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8153. @item all_flags, allf
  8154. @item c0_flags, c0f
  8155. @item c1_flags, c1f
  8156. @item c2_flags, c2f
  8157. @item c3_flags, c3f
  8158. Set pixel component flags or set flags for all components if @var{all_flags}.
  8159. Available values for component flags are:
  8160. @table @samp
  8161. @item a
  8162. averaged temporal noise (smoother)
  8163. @item p
  8164. mix random noise with a (semi)regular pattern
  8165. @item t
  8166. temporal noise (noise pattern changes between frames)
  8167. @item u
  8168. uniform noise (gaussian otherwise)
  8169. @end table
  8170. @end table
  8171. @subsection Examples
  8172. Add temporal and uniform noise to input video:
  8173. @example
  8174. noise=alls=20:allf=t+u
  8175. @end example
  8176. @section null
  8177. Pass the video source unchanged to the output.
  8178. @section ocr
  8179. Optical Character Recognition
  8180. This filter uses Tesseract for optical character recognition.
  8181. It accepts the following options:
  8182. @table @option
  8183. @item datapath
  8184. Set datapath to tesseract data. Default is to use whatever was
  8185. set at installation.
  8186. @item language
  8187. Set language, default is "eng".
  8188. @item whitelist
  8189. Set character whitelist.
  8190. @item blacklist
  8191. Set character blacklist.
  8192. @end table
  8193. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8194. @section ocv
  8195. Apply a video transform using libopencv.
  8196. To enable this filter, install the libopencv library and headers and
  8197. configure FFmpeg with @code{--enable-libopencv}.
  8198. It accepts the following parameters:
  8199. @table @option
  8200. @item filter_name
  8201. The name of the libopencv filter to apply.
  8202. @item filter_params
  8203. The parameters to pass to the libopencv filter. If not specified, the default
  8204. values are assumed.
  8205. @end table
  8206. Refer to the official libopencv documentation for more precise
  8207. information:
  8208. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8209. Several libopencv filters are supported; see the following subsections.
  8210. @anchor{dilate}
  8211. @subsection dilate
  8212. Dilate an image by using a specific structuring element.
  8213. It corresponds to the libopencv function @code{cvDilate}.
  8214. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8215. @var{struct_el} represents a structuring element, and has the syntax:
  8216. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8217. @var{cols} and @var{rows} represent the number of columns and rows of
  8218. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8219. point, and @var{shape} the shape for the structuring element. @var{shape}
  8220. must be "rect", "cross", "ellipse", or "custom".
  8221. If the value for @var{shape} is "custom", it must be followed by a
  8222. string of the form "=@var{filename}". The file with name
  8223. @var{filename} is assumed to represent a binary image, with each
  8224. printable character corresponding to a bright pixel. When a custom
  8225. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8226. or columns and rows of the read file are assumed instead.
  8227. The default value for @var{struct_el} is "3x3+0x0/rect".
  8228. @var{nb_iterations} specifies the number of times the transform is
  8229. applied to the image, and defaults to 1.
  8230. Some examples:
  8231. @example
  8232. # Use the default values
  8233. ocv=dilate
  8234. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8235. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8236. # Read the shape from the file diamond.shape, iterating two times.
  8237. # The file diamond.shape may contain a pattern of characters like this
  8238. # *
  8239. # ***
  8240. # *****
  8241. # ***
  8242. # *
  8243. # The specified columns and rows are ignored
  8244. # but the anchor point coordinates are not
  8245. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8246. @end example
  8247. @subsection erode
  8248. Erode an image by using a specific structuring element.
  8249. It corresponds to the libopencv function @code{cvErode}.
  8250. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8251. with the same syntax and semantics as the @ref{dilate} filter.
  8252. @subsection smooth
  8253. Smooth the input video.
  8254. The filter takes the following parameters:
  8255. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8256. @var{type} is the type of smooth filter to apply, and must be one of
  8257. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8258. or "bilateral". The default value is "gaussian".
  8259. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8260. depend on the smooth type. @var{param1} and
  8261. @var{param2} accept integer positive values or 0. @var{param3} and
  8262. @var{param4} accept floating point values.
  8263. The default value for @var{param1} is 3. The default value for the
  8264. other parameters is 0.
  8265. These parameters correspond to the parameters assigned to the
  8266. libopencv function @code{cvSmooth}.
  8267. @section oscilloscope
  8268. 2D Video Oscilloscope.
  8269. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8270. It accepts the following parameters:
  8271. @table @option
  8272. @item x
  8273. Set scope center x position.
  8274. @item y
  8275. Set scope center y position.
  8276. @item s
  8277. Set scope size, relative to frame diagonal.
  8278. @item t
  8279. Set scope tilt/rotation.
  8280. @item o
  8281. Set trace opacity.
  8282. @item tx
  8283. Set trace center x position.
  8284. @item ty
  8285. Set trace center y position.
  8286. @item tw
  8287. Set trace width, relative to width of frame.
  8288. @item th
  8289. Set trace height, relative to height of frame.
  8290. @item c
  8291. Set which components to trace. By default it traces first three components.
  8292. @item g
  8293. Draw trace grid. By default is enabled.
  8294. @item st
  8295. Draw some statistics. By default is enabled.
  8296. @item sc
  8297. Draw scope. By default is enabled.
  8298. @end table
  8299. @subsection Examples
  8300. @itemize
  8301. @item
  8302. Inspect full first row of video frame.
  8303. @example
  8304. oscilloscope=x=0.5:y=0:s=1
  8305. @end example
  8306. @item
  8307. Inspect full last row of video frame.
  8308. @example
  8309. oscilloscope=x=0.5:y=1:s=1
  8310. @end example
  8311. @item
  8312. Inspect full 5th line of video frame of height 1080.
  8313. @example
  8314. oscilloscope=x=0.5:y=5/1080:s=1
  8315. @end example
  8316. @item
  8317. Inspect full last column of video frame.
  8318. @example
  8319. oscilloscope=x=1:y=0.5:s=1:t=1
  8320. @end example
  8321. @end itemize
  8322. @anchor{overlay}
  8323. @section overlay
  8324. Overlay one video on top of another.
  8325. It takes two inputs and has one output. The first input is the "main"
  8326. video on which the second input is overlaid.
  8327. It accepts the following parameters:
  8328. A description of the accepted options follows.
  8329. @table @option
  8330. @item x
  8331. @item y
  8332. Set the expression for the x and y coordinates of the overlaid video
  8333. on the main video. Default value is "0" for both expressions. In case
  8334. the expression is invalid, it is set to a huge value (meaning that the
  8335. overlay will not be displayed within the output visible area).
  8336. @item eof_action
  8337. The action to take when EOF is encountered on the secondary input; it accepts
  8338. one of the following values:
  8339. @table @option
  8340. @item repeat
  8341. Repeat the last frame (the default).
  8342. @item endall
  8343. End both streams.
  8344. @item pass
  8345. Pass the main input through.
  8346. @end table
  8347. @item eval
  8348. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8349. It accepts the following values:
  8350. @table @samp
  8351. @item init
  8352. only evaluate expressions once during the filter initialization or
  8353. when a command is processed
  8354. @item frame
  8355. evaluate expressions for each incoming frame
  8356. @end table
  8357. Default value is @samp{frame}.
  8358. @item shortest
  8359. If set to 1, force the output to terminate when the shortest input
  8360. terminates. Default value is 0.
  8361. @item format
  8362. Set the format for the output video.
  8363. It accepts the following values:
  8364. @table @samp
  8365. @item yuv420
  8366. force YUV420 output
  8367. @item yuv422
  8368. force YUV422 output
  8369. @item yuv444
  8370. force YUV444 output
  8371. @item rgb
  8372. force packed RGB output
  8373. @item gbrp
  8374. force planar RGB output
  8375. @item auto
  8376. automatically pick format
  8377. @end table
  8378. Default value is @samp{yuv420}.
  8379. @item repeatlast
  8380. If set to 1, force the filter to draw the last overlay frame over the
  8381. main input until the end of the stream. A value of 0 disables this
  8382. behavior. Default value is 1.
  8383. @end table
  8384. The @option{x}, and @option{y} expressions can contain the following
  8385. parameters.
  8386. @table @option
  8387. @item main_w, W
  8388. @item main_h, H
  8389. The main input width and height.
  8390. @item overlay_w, w
  8391. @item overlay_h, h
  8392. The overlay input width and height.
  8393. @item x
  8394. @item y
  8395. The computed values for @var{x} and @var{y}. They are evaluated for
  8396. each new frame.
  8397. @item hsub
  8398. @item vsub
  8399. horizontal and vertical chroma subsample values of the output
  8400. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8401. @var{vsub} is 1.
  8402. @item n
  8403. the number of input frame, starting from 0
  8404. @item pos
  8405. the position in the file of the input frame, NAN if unknown
  8406. @item t
  8407. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8408. @end table
  8409. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8410. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8411. when @option{eval} is set to @samp{init}.
  8412. Be aware that frames are taken from each input video in timestamp
  8413. order, hence, if their initial timestamps differ, it is a good idea
  8414. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8415. have them begin in the same zero timestamp, as the example for
  8416. the @var{movie} filter does.
  8417. You can chain together more overlays but you should test the
  8418. efficiency of such approach.
  8419. @subsection Commands
  8420. This filter supports the following commands:
  8421. @table @option
  8422. @item x
  8423. @item y
  8424. Modify the x and y of the overlay input.
  8425. The command accepts the same syntax of the corresponding option.
  8426. If the specified expression is not valid, it is kept at its current
  8427. value.
  8428. @end table
  8429. @subsection Examples
  8430. @itemize
  8431. @item
  8432. Draw the overlay at 10 pixels from the bottom right corner of the main
  8433. video:
  8434. @example
  8435. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8436. @end example
  8437. Using named options the example above becomes:
  8438. @example
  8439. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8440. @end example
  8441. @item
  8442. Insert a transparent PNG logo in the bottom left corner of the input,
  8443. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8444. @example
  8445. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8446. @end example
  8447. @item
  8448. Insert 2 different transparent PNG logos (second logo on bottom
  8449. right corner) using the @command{ffmpeg} tool:
  8450. @example
  8451. 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
  8452. @end example
  8453. @item
  8454. Add a transparent color layer on top of the main video; @code{WxH}
  8455. must specify the size of the main input to the overlay filter:
  8456. @example
  8457. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8458. @end example
  8459. @item
  8460. Play an original video and a filtered version (here with the deshake
  8461. filter) side by side using the @command{ffplay} tool:
  8462. @example
  8463. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8464. @end example
  8465. The above command is the same as:
  8466. @example
  8467. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8468. @end example
  8469. @item
  8470. Make a sliding overlay appearing from the left to the right top part of the
  8471. screen starting since time 2:
  8472. @example
  8473. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8474. @end example
  8475. @item
  8476. Compose output by putting two input videos side to side:
  8477. @example
  8478. ffmpeg -i left.avi -i right.avi -filter_complex "
  8479. nullsrc=size=200x100 [background];
  8480. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8481. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8482. [background][left] overlay=shortest=1 [background+left];
  8483. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8484. "
  8485. @end example
  8486. @item
  8487. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8488. @example
  8489. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8490. -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]'
  8491. masked.avi
  8492. @end example
  8493. @item
  8494. Chain several overlays in cascade:
  8495. @example
  8496. nullsrc=s=200x200 [bg];
  8497. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8498. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8499. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8500. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8501. [in3] null, [mid2] overlay=100:100 [out0]
  8502. @end example
  8503. @end itemize
  8504. @section owdenoise
  8505. Apply Overcomplete Wavelet denoiser.
  8506. The filter accepts the following options:
  8507. @table @option
  8508. @item depth
  8509. Set depth.
  8510. Larger depth values will denoise lower frequency components more, but
  8511. slow down filtering.
  8512. Must be an int in the range 8-16, default is @code{8}.
  8513. @item luma_strength, ls
  8514. Set luma strength.
  8515. Must be a double value in the range 0-1000, default is @code{1.0}.
  8516. @item chroma_strength, cs
  8517. Set chroma strength.
  8518. Must be a double value in the range 0-1000, default is @code{1.0}.
  8519. @end table
  8520. @anchor{pad}
  8521. @section pad
  8522. Add paddings to the input image, and place the original input at the
  8523. provided @var{x}, @var{y} coordinates.
  8524. It accepts the following parameters:
  8525. @table @option
  8526. @item width, w
  8527. @item height, h
  8528. Specify an expression for the size of the output image with the
  8529. paddings added. If the value for @var{width} or @var{height} is 0, the
  8530. corresponding input size is used for the output.
  8531. The @var{width} expression can reference the value set by the
  8532. @var{height} expression, and vice versa.
  8533. The default value of @var{width} and @var{height} is 0.
  8534. @item x
  8535. @item y
  8536. Specify the offsets to place the input image at within the padded area,
  8537. with respect to the top/left border of the output image.
  8538. The @var{x} expression can reference the value set by the @var{y}
  8539. expression, and vice versa.
  8540. The default value of @var{x} and @var{y} is 0.
  8541. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8542. so the input image is centered on the padded area.
  8543. @item color
  8544. Specify the color of the padded area. For the syntax of this option,
  8545. check the "Color" section in the ffmpeg-utils manual.
  8546. The default value of @var{color} is "black".
  8547. @item eval
  8548. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8549. It accepts the following values:
  8550. @table @samp
  8551. @item init
  8552. Only evaluate expressions once during the filter initialization or when
  8553. a command is processed.
  8554. @item frame
  8555. Evaluate expressions for each incoming frame.
  8556. @end table
  8557. Default value is @samp{init}.
  8558. @item aspect
  8559. Pad to aspect instead to a resolution.
  8560. @end table
  8561. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8562. options are expressions containing the following constants:
  8563. @table @option
  8564. @item in_w
  8565. @item in_h
  8566. The input video width and height.
  8567. @item iw
  8568. @item ih
  8569. These are the same as @var{in_w} and @var{in_h}.
  8570. @item out_w
  8571. @item out_h
  8572. The output width and height (the size of the padded area), as
  8573. specified by the @var{width} and @var{height} expressions.
  8574. @item ow
  8575. @item oh
  8576. These are the same as @var{out_w} and @var{out_h}.
  8577. @item x
  8578. @item y
  8579. The x and y offsets as specified by the @var{x} and @var{y}
  8580. expressions, or NAN if not yet specified.
  8581. @item a
  8582. same as @var{iw} / @var{ih}
  8583. @item sar
  8584. input sample aspect ratio
  8585. @item dar
  8586. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8587. @item hsub
  8588. @item vsub
  8589. The horizontal and vertical chroma subsample values. For example for the
  8590. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8591. @end table
  8592. @subsection Examples
  8593. @itemize
  8594. @item
  8595. Add paddings with the color "violet" to the input video. The output video
  8596. size is 640x480, and the top-left corner of the input video is placed at
  8597. column 0, row 40
  8598. @example
  8599. pad=640:480:0:40:violet
  8600. @end example
  8601. The example above is equivalent to the following command:
  8602. @example
  8603. pad=width=640:height=480:x=0:y=40:color=violet
  8604. @end example
  8605. @item
  8606. Pad the input to get an output with dimensions increased by 3/2,
  8607. and put the input video at the center of the padded area:
  8608. @example
  8609. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8610. @end example
  8611. @item
  8612. Pad the input to get a squared output with size equal to the maximum
  8613. value between the input width and height, and put the input video at
  8614. the center of the padded area:
  8615. @example
  8616. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8617. @end example
  8618. @item
  8619. Pad the input to get a final w/h ratio of 16:9:
  8620. @example
  8621. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8622. @end example
  8623. @item
  8624. In case of anamorphic video, in order to set the output display aspect
  8625. correctly, it is necessary to use @var{sar} in the expression,
  8626. according to the relation:
  8627. @example
  8628. (ih * X / ih) * sar = output_dar
  8629. X = output_dar / sar
  8630. @end example
  8631. Thus the previous example needs to be modified to:
  8632. @example
  8633. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8634. @end example
  8635. @item
  8636. Double the output size and put the input video in the bottom-right
  8637. corner of the output padded area:
  8638. @example
  8639. pad="2*iw:2*ih:ow-iw:oh-ih"
  8640. @end example
  8641. @end itemize
  8642. @anchor{palettegen}
  8643. @section palettegen
  8644. Generate one palette for a whole video stream.
  8645. It accepts the following options:
  8646. @table @option
  8647. @item max_colors
  8648. Set the maximum number of colors to quantize in the palette.
  8649. Note: the palette will still contain 256 colors; the unused palette entries
  8650. will be black.
  8651. @item reserve_transparent
  8652. Create a palette of 255 colors maximum and reserve the last one for
  8653. transparency. Reserving the transparency color is useful for GIF optimization.
  8654. If not set, the maximum of colors in the palette will be 256. You probably want
  8655. to disable this option for a standalone image.
  8656. Set by default.
  8657. @item stats_mode
  8658. Set statistics mode.
  8659. It accepts the following values:
  8660. @table @samp
  8661. @item full
  8662. Compute full frame histograms.
  8663. @item diff
  8664. Compute histograms only for the part that differs from previous frame. This
  8665. might be relevant to give more importance to the moving part of your input if
  8666. the background is static.
  8667. @item single
  8668. Compute new histogram for each frame.
  8669. @end table
  8670. Default value is @var{full}.
  8671. @end table
  8672. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8673. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8674. color quantization of the palette. This information is also visible at
  8675. @var{info} logging level.
  8676. @subsection Examples
  8677. @itemize
  8678. @item
  8679. Generate a representative palette of a given video using @command{ffmpeg}:
  8680. @example
  8681. ffmpeg -i input.mkv -vf palettegen palette.png
  8682. @end example
  8683. @end itemize
  8684. @section paletteuse
  8685. Use a palette to downsample an input video stream.
  8686. The filter takes two inputs: one video stream and a palette. The palette must
  8687. be a 256 pixels image.
  8688. It accepts the following options:
  8689. @table @option
  8690. @item dither
  8691. Select dithering mode. Available algorithms are:
  8692. @table @samp
  8693. @item bayer
  8694. Ordered 8x8 bayer dithering (deterministic)
  8695. @item heckbert
  8696. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8697. Note: this dithering is sometimes considered "wrong" and is included as a
  8698. reference.
  8699. @item floyd_steinberg
  8700. Floyd and Steingberg dithering (error diffusion)
  8701. @item sierra2
  8702. Frankie Sierra dithering v2 (error diffusion)
  8703. @item sierra2_4a
  8704. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8705. @end table
  8706. Default is @var{sierra2_4a}.
  8707. @item bayer_scale
  8708. When @var{bayer} dithering is selected, this option defines the scale of the
  8709. pattern (how much the crosshatch pattern is visible). A low value means more
  8710. visible pattern for less banding, and higher value means less visible pattern
  8711. at the cost of more banding.
  8712. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8713. @item diff_mode
  8714. If set, define the zone to process
  8715. @table @samp
  8716. @item rectangle
  8717. Only the changing rectangle will be reprocessed. This is similar to GIF
  8718. cropping/offsetting compression mechanism. This option can be useful for speed
  8719. if only a part of the image is changing, and has use cases such as limiting the
  8720. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8721. moving scene (it leads to more deterministic output if the scene doesn't change
  8722. much, and as a result less moving noise and better GIF compression).
  8723. @end table
  8724. Default is @var{none}.
  8725. @item new
  8726. Take new palette for each output frame.
  8727. @end table
  8728. @subsection Examples
  8729. @itemize
  8730. @item
  8731. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8732. using @command{ffmpeg}:
  8733. @example
  8734. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8735. @end example
  8736. @end itemize
  8737. @section perspective
  8738. Correct perspective of video not recorded perpendicular to the screen.
  8739. A description of the accepted parameters follows.
  8740. @table @option
  8741. @item x0
  8742. @item y0
  8743. @item x1
  8744. @item y1
  8745. @item x2
  8746. @item y2
  8747. @item x3
  8748. @item y3
  8749. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8750. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8751. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8752. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8753. then the corners of the source will be sent to the specified coordinates.
  8754. The expressions can use the following variables:
  8755. @table @option
  8756. @item W
  8757. @item H
  8758. the width and height of video frame.
  8759. @item in
  8760. Input frame count.
  8761. @item on
  8762. Output frame count.
  8763. @end table
  8764. @item interpolation
  8765. Set interpolation for perspective correction.
  8766. It accepts the following values:
  8767. @table @samp
  8768. @item linear
  8769. @item cubic
  8770. @end table
  8771. Default value is @samp{linear}.
  8772. @item sense
  8773. Set interpretation of coordinate options.
  8774. It accepts the following values:
  8775. @table @samp
  8776. @item 0, source
  8777. Send point in the source specified by the given coordinates to
  8778. the corners of the destination.
  8779. @item 1, destination
  8780. Send the corners of the source to the point in the destination specified
  8781. by the given coordinates.
  8782. Default value is @samp{source}.
  8783. @end table
  8784. @item eval
  8785. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8786. It accepts the following values:
  8787. @table @samp
  8788. @item init
  8789. only evaluate expressions once during the filter initialization or
  8790. when a command is processed
  8791. @item frame
  8792. evaluate expressions for each incoming frame
  8793. @end table
  8794. Default value is @samp{init}.
  8795. @end table
  8796. @section phase
  8797. Delay interlaced video by one field time so that the field order changes.
  8798. The intended use is to fix PAL movies that have been captured with the
  8799. opposite field order to the film-to-video transfer.
  8800. A description of the accepted parameters follows.
  8801. @table @option
  8802. @item mode
  8803. Set phase mode.
  8804. It accepts the following values:
  8805. @table @samp
  8806. @item t
  8807. Capture field order top-first, transfer bottom-first.
  8808. Filter will delay the bottom field.
  8809. @item b
  8810. Capture field order bottom-first, transfer top-first.
  8811. Filter will delay the top field.
  8812. @item p
  8813. Capture and transfer with the same field order. This mode only exists
  8814. for the documentation of the other options to refer to, but if you
  8815. actually select it, the filter will faithfully do nothing.
  8816. @item a
  8817. Capture field order determined automatically by field flags, transfer
  8818. opposite.
  8819. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8820. basis using field flags. If no field information is available,
  8821. then this works just like @samp{u}.
  8822. @item u
  8823. Capture unknown or varying, transfer opposite.
  8824. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8825. analyzing the images and selecting the alternative that produces best
  8826. match between the fields.
  8827. @item T
  8828. Capture top-first, transfer unknown or varying.
  8829. Filter selects among @samp{t} and @samp{p} using image analysis.
  8830. @item B
  8831. Capture bottom-first, transfer unknown or varying.
  8832. Filter selects among @samp{b} and @samp{p} using image analysis.
  8833. @item A
  8834. Capture determined by field flags, transfer unknown or varying.
  8835. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8836. image analysis. If no field information is available, then this works just
  8837. like @samp{U}. This is the default mode.
  8838. @item U
  8839. Both capture and transfer unknown or varying.
  8840. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8841. @end table
  8842. @end table
  8843. @section pixdesctest
  8844. Pixel format descriptor test filter, mainly useful for internal
  8845. testing. The output video should be equal to the input video.
  8846. For example:
  8847. @example
  8848. format=monow, pixdesctest
  8849. @end example
  8850. can be used to test the monowhite pixel format descriptor definition.
  8851. @section pixscope
  8852. Display sample values of color channels. Mainly useful for checking color and levels.
  8853. The filters accept the following options:
  8854. @table @option
  8855. @item x
  8856. Set scope X position, relative offset on X axis.
  8857. @item y
  8858. Set scope Y position, relative offset on Y axis.
  8859. @item w
  8860. Set scope width.
  8861. @item h
  8862. Set scope height.
  8863. @item o
  8864. Set window opacity. This window also holds statistics about pixel area.
  8865. @item wx
  8866. Set window X position, relative offset on X axis.
  8867. @item wy
  8868. Set window Y position, relative offset on Y axis.
  8869. @end table
  8870. @section pp
  8871. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8872. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8873. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8874. Each subfilter and some options have a short and a long name that can be used
  8875. interchangeably, i.e. dr/dering are the same.
  8876. The filters accept the following options:
  8877. @table @option
  8878. @item subfilters
  8879. Set postprocessing subfilters string.
  8880. @end table
  8881. All subfilters share common options to determine their scope:
  8882. @table @option
  8883. @item a/autoq
  8884. Honor the quality commands for this subfilter.
  8885. @item c/chrom
  8886. Do chrominance filtering, too (default).
  8887. @item y/nochrom
  8888. Do luminance filtering only (no chrominance).
  8889. @item n/noluma
  8890. Do chrominance filtering only (no luminance).
  8891. @end table
  8892. These options can be appended after the subfilter name, separated by a '|'.
  8893. Available subfilters are:
  8894. @table @option
  8895. @item hb/hdeblock[|difference[|flatness]]
  8896. Horizontal deblocking filter
  8897. @table @option
  8898. @item difference
  8899. Difference factor where higher values mean more deblocking (default: @code{32}).
  8900. @item flatness
  8901. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8902. @end table
  8903. @item vb/vdeblock[|difference[|flatness]]
  8904. Vertical deblocking filter
  8905. @table @option
  8906. @item difference
  8907. Difference factor where higher values mean more deblocking (default: @code{32}).
  8908. @item flatness
  8909. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8910. @end table
  8911. @item ha/hadeblock[|difference[|flatness]]
  8912. Accurate horizontal deblocking filter
  8913. @table @option
  8914. @item difference
  8915. Difference factor where higher values mean more deblocking (default: @code{32}).
  8916. @item flatness
  8917. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8918. @end table
  8919. @item va/vadeblock[|difference[|flatness]]
  8920. Accurate vertical deblocking filter
  8921. @table @option
  8922. @item difference
  8923. Difference factor where higher values mean more deblocking (default: @code{32}).
  8924. @item flatness
  8925. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8926. @end table
  8927. @end table
  8928. The horizontal and vertical deblocking filters share the difference and
  8929. flatness values so you cannot set different horizontal and vertical
  8930. thresholds.
  8931. @table @option
  8932. @item h1/x1hdeblock
  8933. Experimental horizontal deblocking filter
  8934. @item v1/x1vdeblock
  8935. Experimental vertical deblocking filter
  8936. @item dr/dering
  8937. Deringing filter
  8938. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8939. @table @option
  8940. @item threshold1
  8941. larger -> stronger filtering
  8942. @item threshold2
  8943. larger -> stronger filtering
  8944. @item threshold3
  8945. larger -> stronger filtering
  8946. @end table
  8947. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8948. @table @option
  8949. @item f/fullyrange
  8950. Stretch luminance to @code{0-255}.
  8951. @end table
  8952. @item lb/linblenddeint
  8953. Linear blend deinterlacing filter that deinterlaces the given block by
  8954. filtering all lines with a @code{(1 2 1)} filter.
  8955. @item li/linipoldeint
  8956. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8957. linearly interpolating every second line.
  8958. @item ci/cubicipoldeint
  8959. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8960. cubically interpolating every second line.
  8961. @item md/mediandeint
  8962. Median deinterlacing filter that deinterlaces the given block by applying a
  8963. median filter to every second line.
  8964. @item fd/ffmpegdeint
  8965. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8966. second line with a @code{(-1 4 2 4 -1)} filter.
  8967. @item l5/lowpass5
  8968. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8969. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8970. @item fq/forceQuant[|quantizer]
  8971. Overrides the quantizer table from the input with the constant quantizer you
  8972. specify.
  8973. @table @option
  8974. @item quantizer
  8975. Quantizer to use
  8976. @end table
  8977. @item de/default
  8978. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8979. @item fa/fast
  8980. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8981. @item ac
  8982. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8983. @end table
  8984. @subsection Examples
  8985. @itemize
  8986. @item
  8987. Apply horizontal and vertical deblocking, deringing and automatic
  8988. brightness/contrast:
  8989. @example
  8990. pp=hb/vb/dr/al
  8991. @end example
  8992. @item
  8993. Apply default filters without brightness/contrast correction:
  8994. @example
  8995. pp=de/-al
  8996. @end example
  8997. @item
  8998. Apply default filters and temporal denoiser:
  8999. @example
  9000. pp=default/tmpnoise|1|2|3
  9001. @end example
  9002. @item
  9003. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9004. automatically depending on available CPU time:
  9005. @example
  9006. pp=hb|y/vb|a
  9007. @end example
  9008. @end itemize
  9009. @section pp7
  9010. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9011. similar to spp = 6 with 7 point DCT, where only the center sample is
  9012. used after IDCT.
  9013. The filter accepts the following options:
  9014. @table @option
  9015. @item qp
  9016. Force a constant quantization parameter. It accepts an integer in range
  9017. 0 to 63. If not set, the filter will use the QP from the video stream
  9018. (if available).
  9019. @item mode
  9020. Set thresholding mode. Available modes are:
  9021. @table @samp
  9022. @item hard
  9023. Set hard thresholding.
  9024. @item soft
  9025. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9026. @item medium
  9027. Set medium thresholding (good results, default).
  9028. @end table
  9029. @end table
  9030. @section premultiply
  9031. Apply alpha premultiply effect to input video stream using first plane
  9032. of second stream as alpha.
  9033. Both streams must have same dimensions and same pixel format.
  9034. The filter accepts the following option:
  9035. @table @option
  9036. @item planes
  9037. Set which planes will be processed, unprocessed planes will be copied.
  9038. By default value 0xf, all planes will be processed.
  9039. @item inplace
  9040. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9041. @end table
  9042. @section prewitt
  9043. Apply prewitt operator to input video stream.
  9044. The filter accepts the following option:
  9045. @table @option
  9046. @item planes
  9047. Set which planes will be processed, unprocessed planes will be copied.
  9048. By default value 0xf, all planes will be processed.
  9049. @item scale
  9050. Set value which will be multiplied with filtered result.
  9051. @item delta
  9052. Set value which will be added to filtered result.
  9053. @end table
  9054. @section pseudocolor
  9055. Alter frame colors in video with pseudocolors.
  9056. This filter accept the following options:
  9057. @table @option
  9058. @item c0
  9059. set pixel first component expression
  9060. @item c1
  9061. set pixel second component expression
  9062. @item c2
  9063. set pixel third component expression
  9064. @item c3
  9065. set pixel fourth component expression, corresponds to the alpha component
  9066. @item i
  9067. set component to use as base for altering colors
  9068. @end table
  9069. Each of them specifies the expression to use for computing the lookup table for
  9070. the corresponding pixel component values.
  9071. The expressions can contain the following constants and functions:
  9072. @table @option
  9073. @item w
  9074. @item h
  9075. The input width and height.
  9076. @item val
  9077. The input value for the pixel component.
  9078. @item ymin, umin, vmin, amin
  9079. The minimum allowed component value.
  9080. @item ymax, umax, vmax, amax
  9081. The maximum allowed component value.
  9082. @end table
  9083. All expressions default to "val".
  9084. @subsection Examples
  9085. @itemize
  9086. @item
  9087. Change too high luma values to gradient:
  9088. @example
  9089. pseudocolor='if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'
  9090. @end example
  9091. @end itemize
  9092. @section psnr
  9093. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9094. Ratio) between two input videos.
  9095. This filter takes in input two input videos, the first input is
  9096. considered the "main" source and is passed unchanged to the
  9097. output. The second input is used as a "reference" video for computing
  9098. the PSNR.
  9099. Both video inputs must have the same resolution and pixel format for
  9100. this filter to work correctly. Also it assumes that both inputs
  9101. have the same number of frames, which are compared one by one.
  9102. The obtained average PSNR is printed through the logging system.
  9103. The filter stores the accumulated MSE (mean squared error) of each
  9104. frame, and at the end of the processing it is averaged across all frames
  9105. equally, and the following formula is applied to obtain the PSNR:
  9106. @example
  9107. PSNR = 10*log10(MAX^2/MSE)
  9108. @end example
  9109. Where MAX is the average of the maximum values of each component of the
  9110. image.
  9111. The description of the accepted parameters follows.
  9112. @table @option
  9113. @item stats_file, f
  9114. If specified the filter will use the named file to save the PSNR of
  9115. each individual frame. When filename equals "-" the data is sent to
  9116. standard output.
  9117. @item stats_version
  9118. Specifies which version of the stats file format to use. Details of
  9119. each format are written below.
  9120. Default value is 1.
  9121. @item stats_add_max
  9122. Determines whether the max value is output to the stats log.
  9123. Default value is 0.
  9124. Requires stats_version >= 2. If this is set and stats_version < 2,
  9125. the filter will return an error.
  9126. @end table
  9127. The file printed if @var{stats_file} is selected, contains a sequence of
  9128. key/value pairs of the form @var{key}:@var{value} for each compared
  9129. couple of frames.
  9130. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9131. the list of per-frame-pair stats, with key value pairs following the frame
  9132. format with the following parameters:
  9133. @table @option
  9134. @item psnr_log_version
  9135. The version of the log file format. Will match @var{stats_version}.
  9136. @item fields
  9137. A comma separated list of the per-frame-pair parameters included in
  9138. the log.
  9139. @end table
  9140. A description of each shown per-frame-pair parameter follows:
  9141. @table @option
  9142. @item n
  9143. sequential number of the input frame, starting from 1
  9144. @item mse_avg
  9145. Mean Square Error pixel-by-pixel average difference of the compared
  9146. frames, averaged over all the image components.
  9147. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9148. Mean Square Error pixel-by-pixel average difference of the compared
  9149. frames for the component specified by the suffix.
  9150. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9151. Peak Signal to Noise ratio of the compared frames for the component
  9152. specified by the suffix.
  9153. @item max_avg, max_y, max_u, max_v
  9154. Maximum allowed value for each channel, and average over all
  9155. channels.
  9156. @end table
  9157. For example:
  9158. @example
  9159. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9160. [main][ref] psnr="stats_file=stats.log" [out]
  9161. @end example
  9162. On this example the input file being processed is compared with the
  9163. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9164. is stored in @file{stats.log}.
  9165. @anchor{pullup}
  9166. @section pullup
  9167. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9168. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9169. content.
  9170. The pullup filter is designed to take advantage of future context in making
  9171. its decisions. This filter is stateless in the sense that it does not lock
  9172. onto a pattern to follow, but it instead looks forward to the following
  9173. fields in order to identify matches and rebuild progressive frames.
  9174. To produce content with an even framerate, insert the fps filter after
  9175. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9176. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9177. The filter accepts the following options:
  9178. @table @option
  9179. @item jl
  9180. @item jr
  9181. @item jt
  9182. @item jb
  9183. These options set the amount of "junk" to ignore at the left, right, top, and
  9184. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9185. while top and bottom are in units of 2 lines.
  9186. The default is 8 pixels on each side.
  9187. @item sb
  9188. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9189. filter generating an occasional mismatched frame, but it may also cause an
  9190. excessive number of frames to be dropped during high motion sequences.
  9191. Conversely, setting it to -1 will make filter match fields more easily.
  9192. This may help processing of video where there is slight blurring between
  9193. the fields, but may also cause there to be interlaced frames in the output.
  9194. Default value is @code{0}.
  9195. @item mp
  9196. Set the metric plane to use. It accepts the following values:
  9197. @table @samp
  9198. @item l
  9199. Use luma plane.
  9200. @item u
  9201. Use chroma blue plane.
  9202. @item v
  9203. Use chroma red plane.
  9204. @end table
  9205. This option may be set to use chroma plane instead of the default luma plane
  9206. for doing filter's computations. This may improve accuracy on very clean
  9207. source material, but more likely will decrease accuracy, especially if there
  9208. is chroma noise (rainbow effect) or any grayscale video.
  9209. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9210. load and make pullup usable in realtime on slow machines.
  9211. @end table
  9212. For best results (without duplicated frames in the output file) it is
  9213. necessary to change the output frame rate. For example, to inverse
  9214. telecine NTSC input:
  9215. @example
  9216. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9217. @end example
  9218. @section qp
  9219. Change video quantization parameters (QP).
  9220. The filter accepts the following option:
  9221. @table @option
  9222. @item qp
  9223. Set expression for quantization parameter.
  9224. @end table
  9225. The expression is evaluated through the eval API and can contain, among others,
  9226. the following constants:
  9227. @table @var
  9228. @item known
  9229. 1 if index is not 129, 0 otherwise.
  9230. @item qp
  9231. Sequentional index starting from -129 to 128.
  9232. @end table
  9233. @subsection Examples
  9234. @itemize
  9235. @item
  9236. Some equation like:
  9237. @example
  9238. qp=2+2*sin(PI*qp)
  9239. @end example
  9240. @end itemize
  9241. @section random
  9242. Flush video frames from internal cache of frames into a random order.
  9243. No frame is discarded.
  9244. Inspired by @ref{frei0r} nervous filter.
  9245. @table @option
  9246. @item frames
  9247. Set size in number of frames of internal cache, in range from @code{2} to
  9248. @code{512}. Default is @code{30}.
  9249. @item seed
  9250. Set seed for random number generator, must be an integer included between
  9251. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9252. less than @code{0}, the filter will try to use a good random seed on a
  9253. best effort basis.
  9254. @end table
  9255. @section readeia608
  9256. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9257. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9258. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9259. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9260. @table @option
  9261. @item lavfi.readeia608.X.cc
  9262. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9263. @item lavfi.readeia608.X.line
  9264. The number of the line on which the EIA-608 data was identified and read.
  9265. @end table
  9266. This filter accepts the following options:
  9267. @table @option
  9268. @item scan_min
  9269. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9270. @item scan_max
  9271. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9272. @item mac
  9273. Set minimal acceptable amplitude change for sync codes detection.
  9274. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9275. @item spw
  9276. Set the ratio of width reserved for sync code detection.
  9277. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9278. @item mhd
  9279. Set the max peaks height difference for sync code detection.
  9280. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9281. @item mpd
  9282. Set max peaks period difference for sync code detection.
  9283. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9284. @item msd
  9285. Set the first two max start code bits differences.
  9286. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9287. @item bhd
  9288. Set the minimum ratio of bits height compared to 3rd start code bit.
  9289. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9290. @item th_w
  9291. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9292. @item th_b
  9293. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9294. @item chp
  9295. Enable checking the parity bit. In the event of a parity error, the filter will output
  9296. @code{0x00} for that character. Default is false.
  9297. @end table
  9298. @subsection Examples
  9299. @itemize
  9300. @item
  9301. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9302. @example
  9303. 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
  9304. @end example
  9305. @end itemize
  9306. @section readvitc
  9307. Read vertical interval timecode (VITC) information from the top lines of a
  9308. video frame.
  9309. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9310. timecode value, if a valid timecode has been detected. Further metadata key
  9311. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9312. timecode data has been found or not.
  9313. This filter accepts the following options:
  9314. @table @option
  9315. @item scan_max
  9316. Set the maximum number of lines to scan for VITC data. If the value is set to
  9317. @code{-1} the full video frame is scanned. Default is @code{45}.
  9318. @item thr_b
  9319. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9320. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9321. @item thr_w
  9322. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9323. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9324. @end table
  9325. @subsection Examples
  9326. @itemize
  9327. @item
  9328. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9329. draw @code{--:--:--:--} as a placeholder:
  9330. @example
  9331. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9332. @end example
  9333. @end itemize
  9334. @section remap
  9335. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9336. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9337. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9338. value for pixel will be used for destination pixel.
  9339. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9340. will have Xmap/Ymap video stream dimensions.
  9341. Xmap and Ymap input video streams are 16bit depth, single channel.
  9342. @section removegrain
  9343. The removegrain filter is a spatial denoiser for progressive video.
  9344. @table @option
  9345. @item m0
  9346. Set mode for the first plane.
  9347. @item m1
  9348. Set mode for the second plane.
  9349. @item m2
  9350. Set mode for the third plane.
  9351. @item m3
  9352. Set mode for the fourth plane.
  9353. @end table
  9354. Range of mode is from 0 to 24. Description of each mode follows:
  9355. @table @var
  9356. @item 0
  9357. Leave input plane unchanged. Default.
  9358. @item 1
  9359. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9360. @item 2
  9361. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9362. @item 3
  9363. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9364. @item 4
  9365. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9366. This is equivalent to a median filter.
  9367. @item 5
  9368. Line-sensitive clipping giving the minimal change.
  9369. @item 6
  9370. Line-sensitive clipping, intermediate.
  9371. @item 7
  9372. Line-sensitive clipping, intermediate.
  9373. @item 8
  9374. Line-sensitive clipping, intermediate.
  9375. @item 9
  9376. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9377. @item 10
  9378. Replaces the target pixel with the closest neighbour.
  9379. @item 11
  9380. [1 2 1] horizontal and vertical kernel blur.
  9381. @item 12
  9382. Same as mode 11.
  9383. @item 13
  9384. Bob mode, interpolates top field from the line where the neighbours
  9385. pixels are the closest.
  9386. @item 14
  9387. Bob mode, interpolates bottom field from the line where the neighbours
  9388. pixels are the closest.
  9389. @item 15
  9390. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9391. interpolation formula.
  9392. @item 16
  9393. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9394. interpolation formula.
  9395. @item 17
  9396. Clips the pixel with the minimum and maximum of respectively the maximum and
  9397. minimum of each pair of opposite neighbour pixels.
  9398. @item 18
  9399. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9400. the current pixel is minimal.
  9401. @item 19
  9402. Replaces the pixel with the average of its 8 neighbours.
  9403. @item 20
  9404. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9405. @item 21
  9406. Clips pixels using the averages of opposite neighbour.
  9407. @item 22
  9408. Same as mode 21 but simpler and faster.
  9409. @item 23
  9410. Small edge and halo removal, but reputed useless.
  9411. @item 24
  9412. Similar as 23.
  9413. @end table
  9414. @section removelogo
  9415. Suppress a TV station logo, using an image file to determine which
  9416. pixels comprise the logo. It works by filling in the pixels that
  9417. comprise the logo with neighboring pixels.
  9418. The filter accepts the following options:
  9419. @table @option
  9420. @item filename, f
  9421. Set the filter bitmap file, which can be any image format supported by
  9422. libavformat. The width and height of the image file must match those of the
  9423. video stream being processed.
  9424. @end table
  9425. Pixels in the provided bitmap image with a value of zero are not
  9426. considered part of the logo, non-zero pixels are considered part of
  9427. the logo. If you use white (255) for the logo and black (0) for the
  9428. rest, you will be safe. For making the filter bitmap, it is
  9429. recommended to take a screen capture of a black frame with the logo
  9430. visible, and then using a threshold filter followed by the erode
  9431. filter once or twice.
  9432. If needed, little splotches can be fixed manually. Remember that if
  9433. logo pixels are not covered, the filter quality will be much
  9434. reduced. Marking too many pixels as part of the logo does not hurt as
  9435. much, but it will increase the amount of blurring needed to cover over
  9436. the image and will destroy more information than necessary, and extra
  9437. pixels will slow things down on a large logo.
  9438. @section repeatfields
  9439. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9440. fields based on its value.
  9441. @section reverse
  9442. Reverse a video clip.
  9443. Warning: This filter requires memory to buffer the entire clip, so trimming
  9444. is suggested.
  9445. @subsection Examples
  9446. @itemize
  9447. @item
  9448. Take the first 5 seconds of a clip, and reverse it.
  9449. @example
  9450. trim=end=5,reverse
  9451. @end example
  9452. @end itemize
  9453. @section roberts
  9454. Apply roberts cross operator to input video stream.
  9455. The filter accepts the following option:
  9456. @table @option
  9457. @item planes
  9458. Set which planes will be processed, unprocessed planes will be copied.
  9459. By default value 0xf, all planes will be processed.
  9460. @item scale
  9461. Set value which will be multiplied with filtered result.
  9462. @item delta
  9463. Set value which will be added to filtered result.
  9464. @end table
  9465. @section rotate
  9466. Rotate video by an arbitrary angle expressed in radians.
  9467. The filter accepts the following options:
  9468. A description of the optional parameters follows.
  9469. @table @option
  9470. @item angle, a
  9471. Set an expression for the angle by which to rotate the input video
  9472. clockwise, expressed as a number of radians. A negative value will
  9473. result in a counter-clockwise rotation. By default it is set to "0".
  9474. This expression is evaluated for each frame.
  9475. @item out_w, ow
  9476. Set the output width expression, default value is "iw".
  9477. This expression is evaluated just once during configuration.
  9478. @item out_h, oh
  9479. Set the output height expression, default value is "ih".
  9480. This expression is evaluated just once during configuration.
  9481. @item bilinear
  9482. Enable bilinear interpolation if set to 1, a value of 0 disables
  9483. it. Default value is 1.
  9484. @item fillcolor, c
  9485. Set the color used to fill the output area not covered by the rotated
  9486. image. For the general syntax of this option, check the "Color" section in the
  9487. ffmpeg-utils manual. If the special value "none" is selected then no
  9488. background is printed (useful for example if the background is never shown).
  9489. Default value is "black".
  9490. @end table
  9491. The expressions for the angle and the output size can contain the
  9492. following constants and functions:
  9493. @table @option
  9494. @item n
  9495. sequential number of the input frame, starting from 0. It is always NAN
  9496. before the first frame is filtered.
  9497. @item t
  9498. time in seconds of the input frame, it is set to 0 when the filter is
  9499. configured. It is always NAN before the first frame is filtered.
  9500. @item hsub
  9501. @item vsub
  9502. horizontal and vertical chroma subsample values. For example for the
  9503. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9504. @item in_w, iw
  9505. @item in_h, ih
  9506. the input video width and height
  9507. @item out_w, ow
  9508. @item out_h, oh
  9509. the output width and height, that is the size of the padded area as
  9510. specified by the @var{width} and @var{height} expressions
  9511. @item rotw(a)
  9512. @item roth(a)
  9513. the minimal width/height required for completely containing the input
  9514. video rotated by @var{a} radians.
  9515. These are only available when computing the @option{out_w} and
  9516. @option{out_h} expressions.
  9517. @end table
  9518. @subsection Examples
  9519. @itemize
  9520. @item
  9521. Rotate the input by PI/6 radians clockwise:
  9522. @example
  9523. rotate=PI/6
  9524. @end example
  9525. @item
  9526. Rotate the input by PI/6 radians counter-clockwise:
  9527. @example
  9528. rotate=-PI/6
  9529. @end example
  9530. @item
  9531. Rotate the input by 45 degrees clockwise:
  9532. @example
  9533. rotate=45*PI/180
  9534. @end example
  9535. @item
  9536. Apply a constant rotation with period T, starting from an angle of PI/3:
  9537. @example
  9538. rotate=PI/3+2*PI*t/T
  9539. @end example
  9540. @item
  9541. Make the input video rotation oscillating with a period of T
  9542. seconds and an amplitude of A radians:
  9543. @example
  9544. rotate=A*sin(2*PI/T*t)
  9545. @end example
  9546. @item
  9547. Rotate the video, output size is chosen so that the whole rotating
  9548. input video is always completely contained in the output:
  9549. @example
  9550. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9551. @end example
  9552. @item
  9553. Rotate the video, reduce the output size so that no background is ever
  9554. shown:
  9555. @example
  9556. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9557. @end example
  9558. @end itemize
  9559. @subsection Commands
  9560. The filter supports the following commands:
  9561. @table @option
  9562. @item a, angle
  9563. Set the angle expression.
  9564. The command accepts the same syntax of the corresponding option.
  9565. If the specified expression is not valid, it is kept at its current
  9566. value.
  9567. @end table
  9568. @section sab
  9569. Apply Shape Adaptive Blur.
  9570. The filter accepts the following options:
  9571. @table @option
  9572. @item luma_radius, lr
  9573. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9574. value is 1.0. A greater value will result in a more blurred image, and
  9575. in slower processing.
  9576. @item luma_pre_filter_radius, lpfr
  9577. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9578. value is 1.0.
  9579. @item luma_strength, ls
  9580. Set luma maximum difference between pixels to still be considered, must
  9581. be a value in the 0.1-100.0 range, default value is 1.0.
  9582. @item chroma_radius, cr
  9583. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9584. greater value will result in a more blurred image, and in slower
  9585. processing.
  9586. @item chroma_pre_filter_radius, cpfr
  9587. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9588. @item chroma_strength, cs
  9589. Set chroma maximum difference between pixels to still be considered,
  9590. must be a value in the -0.9-100.0 range.
  9591. @end table
  9592. Each chroma option value, if not explicitly specified, is set to the
  9593. corresponding luma option value.
  9594. @anchor{scale}
  9595. @section scale
  9596. Scale (resize) the input video, using the libswscale library.
  9597. The scale filter forces the output display aspect ratio to be the same
  9598. of the input, by changing the output sample aspect ratio.
  9599. If the input image format is different from the format requested by
  9600. the next filter, the scale filter will convert the input to the
  9601. requested format.
  9602. @subsection Options
  9603. The filter accepts the following options, or any of the options
  9604. supported by the libswscale scaler.
  9605. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9606. the complete list of scaler options.
  9607. @table @option
  9608. @item width, w
  9609. @item height, h
  9610. Set the output video dimension expression. Default value is the input
  9611. dimension.
  9612. If the @var{width} or @var{w} value is 0, the input width is used for
  9613. the output. If the @var{height} or @var{h} value is 0, the input height
  9614. is used for the output.
  9615. If one and only one of the values is -n with n >= 1, the scale filter
  9616. will use a value that maintains the aspect ratio of the input image,
  9617. calculated from the other specified dimension. After that it will,
  9618. however, make sure that the calculated dimension is divisible by n and
  9619. adjust the value if necessary.
  9620. If both values are -n with n >= 1, the behavior will be identical to
  9621. both values being set to 0 as previously detailed.
  9622. See below for the list of accepted constants for use in the dimension
  9623. expression.
  9624. @item eval
  9625. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9626. @table @samp
  9627. @item init
  9628. Only evaluate expressions once during the filter initialization or when a command is processed.
  9629. @item frame
  9630. Evaluate expressions for each incoming frame.
  9631. @end table
  9632. Default value is @samp{init}.
  9633. @item interl
  9634. Set the interlacing mode. It accepts the following values:
  9635. @table @samp
  9636. @item 1
  9637. Force interlaced aware scaling.
  9638. @item 0
  9639. Do not apply interlaced scaling.
  9640. @item -1
  9641. Select interlaced aware scaling depending on whether the source frames
  9642. are flagged as interlaced or not.
  9643. @end table
  9644. Default value is @samp{0}.
  9645. @item flags
  9646. Set libswscale scaling flags. See
  9647. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9648. complete list of values. If not explicitly specified the filter applies
  9649. the default flags.
  9650. @item param0, param1
  9651. Set libswscale input parameters for scaling algorithms that need them. See
  9652. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9653. complete documentation. If not explicitly specified the filter applies
  9654. empty parameters.
  9655. @item size, s
  9656. Set the video size. For the syntax of this option, check the
  9657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9658. @item in_color_matrix
  9659. @item out_color_matrix
  9660. Set in/output YCbCr color space type.
  9661. This allows the autodetected value to be overridden as well as allows forcing
  9662. a specific value used for the output and encoder.
  9663. If not specified, the color space type depends on the pixel format.
  9664. Possible values:
  9665. @table @samp
  9666. @item auto
  9667. Choose automatically.
  9668. @item bt709
  9669. Format conforming to International Telecommunication Union (ITU)
  9670. Recommendation BT.709.
  9671. @item fcc
  9672. Set color space conforming to the United States Federal Communications
  9673. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9674. @item bt601
  9675. Set color space conforming to:
  9676. @itemize
  9677. @item
  9678. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9679. @item
  9680. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9681. @item
  9682. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9683. @end itemize
  9684. @item smpte240m
  9685. Set color space conforming to SMPTE ST 240:1999.
  9686. @end table
  9687. @item in_range
  9688. @item out_range
  9689. Set in/output YCbCr sample range.
  9690. This allows the autodetected value to be overridden as well as allows forcing
  9691. a specific value used for the output and encoder. If not specified, the
  9692. range depends on the pixel format. Possible values:
  9693. @table @samp
  9694. @item auto
  9695. Choose automatically.
  9696. @item jpeg/full/pc
  9697. Set full range (0-255 in case of 8-bit luma).
  9698. @item mpeg/tv
  9699. Set "MPEG" range (16-235 in case of 8-bit luma).
  9700. @end table
  9701. @item force_original_aspect_ratio
  9702. Enable decreasing or increasing output video width or height if necessary to
  9703. keep the original aspect ratio. Possible values:
  9704. @table @samp
  9705. @item disable
  9706. Scale the video as specified and disable this feature.
  9707. @item decrease
  9708. The output video dimensions will automatically be decreased if needed.
  9709. @item increase
  9710. The output video dimensions will automatically be increased if needed.
  9711. @end table
  9712. One useful instance of this option is that when you know a specific device's
  9713. maximum allowed resolution, you can use this to limit the output video to
  9714. that, while retaining the aspect ratio. For example, device A allows
  9715. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9716. decrease) and specifying 1280x720 to the command line makes the output
  9717. 1280x533.
  9718. Please note that this is a different thing than specifying -1 for @option{w}
  9719. or @option{h}, you still need to specify the output resolution for this option
  9720. to work.
  9721. @end table
  9722. The values of the @option{w} and @option{h} options are expressions
  9723. containing the following constants:
  9724. @table @var
  9725. @item in_w
  9726. @item in_h
  9727. The input width and height
  9728. @item iw
  9729. @item ih
  9730. These are the same as @var{in_w} and @var{in_h}.
  9731. @item out_w
  9732. @item out_h
  9733. The output (scaled) width and height
  9734. @item ow
  9735. @item oh
  9736. These are the same as @var{out_w} and @var{out_h}
  9737. @item a
  9738. The same as @var{iw} / @var{ih}
  9739. @item sar
  9740. input sample aspect ratio
  9741. @item dar
  9742. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9743. @item hsub
  9744. @item vsub
  9745. horizontal and vertical input chroma subsample values. For example for the
  9746. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9747. @item ohsub
  9748. @item ovsub
  9749. horizontal and vertical output chroma subsample values. For example for the
  9750. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9751. @end table
  9752. @subsection Examples
  9753. @itemize
  9754. @item
  9755. Scale the input video to a size of 200x100
  9756. @example
  9757. scale=w=200:h=100
  9758. @end example
  9759. This is equivalent to:
  9760. @example
  9761. scale=200:100
  9762. @end example
  9763. or:
  9764. @example
  9765. scale=200x100
  9766. @end example
  9767. @item
  9768. Specify a size abbreviation for the output size:
  9769. @example
  9770. scale=qcif
  9771. @end example
  9772. which can also be written as:
  9773. @example
  9774. scale=size=qcif
  9775. @end example
  9776. @item
  9777. Scale the input to 2x:
  9778. @example
  9779. scale=w=2*iw:h=2*ih
  9780. @end example
  9781. @item
  9782. The above is the same as:
  9783. @example
  9784. scale=2*in_w:2*in_h
  9785. @end example
  9786. @item
  9787. Scale the input to 2x with forced interlaced scaling:
  9788. @example
  9789. scale=2*iw:2*ih:interl=1
  9790. @end example
  9791. @item
  9792. Scale the input to half size:
  9793. @example
  9794. scale=w=iw/2:h=ih/2
  9795. @end example
  9796. @item
  9797. Increase the width, and set the height to the same size:
  9798. @example
  9799. scale=3/2*iw:ow
  9800. @end example
  9801. @item
  9802. Seek Greek harmony:
  9803. @example
  9804. scale=iw:1/PHI*iw
  9805. scale=ih*PHI:ih
  9806. @end example
  9807. @item
  9808. Increase the height, and set the width to 3/2 of the height:
  9809. @example
  9810. scale=w=3/2*oh:h=3/5*ih
  9811. @end example
  9812. @item
  9813. Increase the size, making the size a multiple of the chroma
  9814. subsample values:
  9815. @example
  9816. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9817. @end example
  9818. @item
  9819. Increase the width to a maximum of 500 pixels,
  9820. keeping the same aspect ratio as the input:
  9821. @example
  9822. scale=w='min(500\, iw*3/2):h=-1'
  9823. @end example
  9824. @end itemize
  9825. @subsection Commands
  9826. This filter supports the following commands:
  9827. @table @option
  9828. @item width, w
  9829. @item height, h
  9830. Set the output video dimension expression.
  9831. The command accepts the same syntax of the corresponding option.
  9832. If the specified expression is not valid, it is kept at its current
  9833. value.
  9834. @end table
  9835. @section scale_npp
  9836. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9837. format conversion on CUDA video frames. Setting the output width and height
  9838. works in the same way as for the @var{scale} filter.
  9839. The following additional options are accepted:
  9840. @table @option
  9841. @item format
  9842. The pixel format of the output CUDA frames. If set to the string "same" (the
  9843. default), the input format will be kept. Note that automatic format negotiation
  9844. and conversion is not yet supported for hardware frames
  9845. @item interp_algo
  9846. The interpolation algorithm used for resizing. One of the following:
  9847. @table @option
  9848. @item nn
  9849. Nearest neighbour.
  9850. @item linear
  9851. @item cubic
  9852. @item cubic2p_bspline
  9853. 2-parameter cubic (B=1, C=0)
  9854. @item cubic2p_catmullrom
  9855. 2-parameter cubic (B=0, C=1/2)
  9856. @item cubic2p_b05c03
  9857. 2-parameter cubic (B=1/2, C=3/10)
  9858. @item super
  9859. Supersampling
  9860. @item lanczos
  9861. @end table
  9862. @end table
  9863. @section scale2ref
  9864. Scale (resize) the input video, based on a reference video.
  9865. See the scale filter for available options, scale2ref supports the same but
  9866. uses the reference video instead of the main input as basis. scale2ref also
  9867. supports the following additional constants for the @option{w} and
  9868. @option{h} options:
  9869. @table @var
  9870. @item main_w
  9871. @item main_h
  9872. The main input video's width and height
  9873. @item main_a
  9874. The same as @var{main_w} / @var{main_h}
  9875. @item main_sar
  9876. The main input video's sample aspect ratio
  9877. @item main_dar, mdar
  9878. The main input video's display aspect ratio. Calculated from
  9879. @code{(main_w / main_h) * main_sar}.
  9880. @item main_hsub
  9881. @item main_vsub
  9882. The main input video's horizontal and vertical chroma subsample values.
  9883. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9884. is 1.
  9885. @end table
  9886. @subsection Examples
  9887. @itemize
  9888. @item
  9889. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9890. @example
  9891. 'scale2ref[b][a];[a][b]overlay'
  9892. @end example
  9893. @end itemize
  9894. @anchor{selectivecolor}
  9895. @section selectivecolor
  9896. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9897. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9898. by the "purity" of the color (that is, how saturated it already is).
  9899. This filter is similar to the Adobe Photoshop Selective Color tool.
  9900. The filter accepts the following options:
  9901. @table @option
  9902. @item correction_method
  9903. Select color correction method.
  9904. Available values are:
  9905. @table @samp
  9906. @item absolute
  9907. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9908. component value).
  9909. @item relative
  9910. Specified adjustments are relative to the original component value.
  9911. @end table
  9912. Default is @code{absolute}.
  9913. @item reds
  9914. Adjustments for red pixels (pixels where the red component is the maximum)
  9915. @item yellows
  9916. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9917. @item greens
  9918. Adjustments for green pixels (pixels where the green component is the maximum)
  9919. @item cyans
  9920. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9921. @item blues
  9922. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9923. @item magentas
  9924. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9925. @item whites
  9926. Adjustments for white pixels (pixels where all components are greater than 128)
  9927. @item neutrals
  9928. Adjustments for all pixels except pure black and pure white
  9929. @item blacks
  9930. Adjustments for black pixels (pixels where all components are lesser than 128)
  9931. @item psfile
  9932. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9933. @end table
  9934. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9935. 4 space separated floating point adjustment values in the [-1,1] range,
  9936. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9937. pixels of its range.
  9938. @subsection Examples
  9939. @itemize
  9940. @item
  9941. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9942. increase magenta by 27% in blue areas:
  9943. @example
  9944. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9945. @end example
  9946. @item
  9947. Use a Photoshop selective color preset:
  9948. @example
  9949. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9950. @end example
  9951. @end itemize
  9952. @anchor{separatefields}
  9953. @section separatefields
  9954. The @code{separatefields} takes a frame-based video input and splits
  9955. each frame into its components fields, producing a new half height clip
  9956. with twice the frame rate and twice the frame count.
  9957. This filter use field-dominance information in frame to decide which
  9958. of each pair of fields to place first in the output.
  9959. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9960. @section setdar, setsar
  9961. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9962. output video.
  9963. This is done by changing the specified Sample (aka Pixel) Aspect
  9964. Ratio, according to the following equation:
  9965. @example
  9966. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9967. @end example
  9968. Keep in mind that the @code{setdar} filter does not modify the pixel
  9969. dimensions of the video frame. Also, the display aspect ratio set by
  9970. this filter may be changed by later filters in the filterchain,
  9971. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9972. applied.
  9973. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9974. the filter output video.
  9975. Note that as a consequence of the application of this filter, the
  9976. output display aspect ratio will change according to the equation
  9977. above.
  9978. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9979. filter may be changed by later filters in the filterchain, e.g. if
  9980. another "setsar" or a "setdar" filter is applied.
  9981. It accepts the following parameters:
  9982. @table @option
  9983. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9984. Set the aspect ratio used by the filter.
  9985. The parameter can be a floating point number string, an expression, or
  9986. a string of the form @var{num}:@var{den}, where @var{num} and
  9987. @var{den} are the numerator and denominator of the aspect ratio. If
  9988. the parameter is not specified, it is assumed the value "0".
  9989. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9990. should be escaped.
  9991. @item max
  9992. Set the maximum integer value to use for expressing numerator and
  9993. denominator when reducing the expressed aspect ratio to a rational.
  9994. Default value is @code{100}.
  9995. @end table
  9996. The parameter @var{sar} is an expression containing
  9997. the following constants:
  9998. @table @option
  9999. @item E, PI, PHI
  10000. These are approximated values for the mathematical constants e
  10001. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10002. @item w, h
  10003. The input width and height.
  10004. @item a
  10005. These are the same as @var{w} / @var{h}.
  10006. @item sar
  10007. The input sample aspect ratio.
  10008. @item dar
  10009. The input display aspect ratio. It is the same as
  10010. (@var{w} / @var{h}) * @var{sar}.
  10011. @item hsub, vsub
  10012. Horizontal and vertical chroma subsample values. For example, for the
  10013. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10014. @end table
  10015. @subsection Examples
  10016. @itemize
  10017. @item
  10018. To change the display aspect ratio to 16:9, specify one of the following:
  10019. @example
  10020. setdar=dar=1.77777
  10021. setdar=dar=16/9
  10022. @end example
  10023. @item
  10024. To change the sample aspect ratio to 10:11, specify:
  10025. @example
  10026. setsar=sar=10/11
  10027. @end example
  10028. @item
  10029. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10030. 1000 in the aspect ratio reduction, use the command:
  10031. @example
  10032. setdar=ratio=16/9:max=1000
  10033. @end example
  10034. @end itemize
  10035. @anchor{setfield}
  10036. @section setfield
  10037. Force field for the output video frame.
  10038. The @code{setfield} filter marks the interlace type field for the
  10039. output frames. It does not change the input frame, but only sets the
  10040. corresponding property, which affects how the frame is treated by
  10041. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10042. The filter accepts the following options:
  10043. @table @option
  10044. @item mode
  10045. Available values are:
  10046. @table @samp
  10047. @item auto
  10048. Keep the same field property.
  10049. @item bff
  10050. Mark the frame as bottom-field-first.
  10051. @item tff
  10052. Mark the frame as top-field-first.
  10053. @item prog
  10054. Mark the frame as progressive.
  10055. @end table
  10056. @end table
  10057. @section showinfo
  10058. Show a line containing various information for each input video frame.
  10059. The input video is not modified.
  10060. The shown line contains a sequence of key/value pairs of the form
  10061. @var{key}:@var{value}.
  10062. The following values are shown in the output:
  10063. @table @option
  10064. @item n
  10065. The (sequential) number of the input frame, starting from 0.
  10066. @item pts
  10067. The Presentation TimeStamp of the input frame, expressed as a number of
  10068. time base units. The time base unit depends on the filter input pad.
  10069. @item pts_time
  10070. The Presentation TimeStamp of the input frame, expressed as a number of
  10071. seconds.
  10072. @item pos
  10073. The position of the frame in the input stream, or -1 if this information is
  10074. unavailable and/or meaningless (for example in case of synthetic video).
  10075. @item fmt
  10076. The pixel format name.
  10077. @item sar
  10078. The sample aspect ratio of the input frame, expressed in the form
  10079. @var{num}/@var{den}.
  10080. @item s
  10081. The size of the input frame. For the syntax of this option, check the
  10082. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10083. @item i
  10084. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10085. for bottom field first).
  10086. @item iskey
  10087. This is 1 if the frame is a key frame, 0 otherwise.
  10088. @item type
  10089. The picture type of the input frame ("I" for an I-frame, "P" for a
  10090. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10091. Also refer to the documentation of the @code{AVPictureType} enum and of
  10092. the @code{av_get_picture_type_char} function defined in
  10093. @file{libavutil/avutil.h}.
  10094. @item checksum
  10095. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10096. @item plane_checksum
  10097. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10098. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10099. @end table
  10100. @section showpalette
  10101. Displays the 256 colors palette of each frame. This filter is only relevant for
  10102. @var{pal8} pixel format frames.
  10103. It accepts the following option:
  10104. @table @option
  10105. @item s
  10106. Set the size of the box used to represent one palette color entry. Default is
  10107. @code{30} (for a @code{30x30} pixel box).
  10108. @end table
  10109. @section shuffleframes
  10110. Reorder and/or duplicate and/or drop video frames.
  10111. It accepts the following parameters:
  10112. @table @option
  10113. @item mapping
  10114. Set the destination indexes of input frames.
  10115. This is space or '|' separated list of indexes that maps input frames to output
  10116. frames. Number of indexes also sets maximal value that each index may have.
  10117. '-1' index have special meaning and that is to drop frame.
  10118. @end table
  10119. The first frame has the index 0. The default is to keep the input unchanged.
  10120. @subsection Examples
  10121. @itemize
  10122. @item
  10123. Swap second and third frame of every three frames of the input:
  10124. @example
  10125. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10126. @end example
  10127. @item
  10128. Swap 10th and 1st frame of every ten frames of the input:
  10129. @example
  10130. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10131. @end example
  10132. @end itemize
  10133. @section shuffleplanes
  10134. Reorder and/or duplicate video planes.
  10135. It accepts the following parameters:
  10136. @table @option
  10137. @item map0
  10138. The index of the input plane to be used as the first output plane.
  10139. @item map1
  10140. The index of the input plane to be used as the second output plane.
  10141. @item map2
  10142. The index of the input plane to be used as the third output plane.
  10143. @item map3
  10144. The index of the input plane to be used as the fourth output plane.
  10145. @end table
  10146. The first plane has the index 0. The default is to keep the input unchanged.
  10147. @subsection Examples
  10148. @itemize
  10149. @item
  10150. Swap the second and third planes of the input:
  10151. @example
  10152. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10153. @end example
  10154. @end itemize
  10155. @anchor{signalstats}
  10156. @section signalstats
  10157. Evaluate various visual metrics that assist in determining issues associated
  10158. with the digitization of analog video media.
  10159. By default the filter will log these metadata values:
  10160. @table @option
  10161. @item YMIN
  10162. Display the minimal Y value contained within the input frame. Expressed in
  10163. range of [0-255].
  10164. @item YLOW
  10165. Display the Y value at the 10% percentile within the input frame. Expressed in
  10166. range of [0-255].
  10167. @item YAVG
  10168. Display the average Y value within the input frame. Expressed in range of
  10169. [0-255].
  10170. @item YHIGH
  10171. Display the Y value at the 90% percentile within the input frame. Expressed in
  10172. range of [0-255].
  10173. @item YMAX
  10174. Display the maximum Y value contained within the input frame. Expressed in
  10175. range of [0-255].
  10176. @item UMIN
  10177. Display the minimal U value contained within the input frame. Expressed in
  10178. range of [0-255].
  10179. @item ULOW
  10180. Display the U value at the 10% percentile within the input frame. Expressed in
  10181. range of [0-255].
  10182. @item UAVG
  10183. Display the average U value within the input frame. Expressed in range of
  10184. [0-255].
  10185. @item UHIGH
  10186. Display the U value at the 90% percentile within the input frame. Expressed in
  10187. range of [0-255].
  10188. @item UMAX
  10189. Display the maximum U value contained within the input frame. Expressed in
  10190. range of [0-255].
  10191. @item VMIN
  10192. Display the minimal V value contained within the input frame. Expressed in
  10193. range of [0-255].
  10194. @item VLOW
  10195. Display the V value at the 10% percentile within the input frame. Expressed in
  10196. range of [0-255].
  10197. @item VAVG
  10198. Display the average V value within the input frame. Expressed in range of
  10199. [0-255].
  10200. @item VHIGH
  10201. Display the V value at the 90% percentile within the input frame. Expressed in
  10202. range of [0-255].
  10203. @item VMAX
  10204. Display the maximum V value contained within the input frame. Expressed in
  10205. range of [0-255].
  10206. @item SATMIN
  10207. Display the minimal saturation value contained within the input frame.
  10208. Expressed in range of [0-~181.02].
  10209. @item SATLOW
  10210. Display the saturation value at the 10% percentile within the input frame.
  10211. Expressed in range of [0-~181.02].
  10212. @item SATAVG
  10213. Display the average saturation value within the input frame. Expressed in range
  10214. of [0-~181.02].
  10215. @item SATHIGH
  10216. Display the saturation value at the 90% percentile within the input frame.
  10217. Expressed in range of [0-~181.02].
  10218. @item SATMAX
  10219. Display the maximum saturation value contained within the input frame.
  10220. Expressed in range of [0-~181.02].
  10221. @item HUEMED
  10222. Display the median value for hue within the input frame. Expressed in range of
  10223. [0-360].
  10224. @item HUEAVG
  10225. Display the average value for hue within the input frame. Expressed in range of
  10226. [0-360].
  10227. @item YDIF
  10228. Display the average of sample value difference between all values of the Y
  10229. plane in the current frame and corresponding values of the previous input frame.
  10230. Expressed in range of [0-255].
  10231. @item UDIF
  10232. Display the average of sample value difference between all values of the U
  10233. plane in the current frame and corresponding values of the previous input frame.
  10234. Expressed in range of [0-255].
  10235. @item VDIF
  10236. Display the average of sample value difference between all values of the V
  10237. plane in the current frame and corresponding values of the previous input frame.
  10238. Expressed in range of [0-255].
  10239. @item YBITDEPTH
  10240. Display bit depth of Y plane in current frame.
  10241. Expressed in range of [0-16].
  10242. @item UBITDEPTH
  10243. Display bit depth of U plane in current frame.
  10244. Expressed in range of [0-16].
  10245. @item VBITDEPTH
  10246. Display bit depth of V plane in current frame.
  10247. Expressed in range of [0-16].
  10248. @end table
  10249. The filter accepts the following options:
  10250. @table @option
  10251. @item stat
  10252. @item out
  10253. @option{stat} specify an additional form of image analysis.
  10254. @option{out} output video with the specified type of pixel highlighted.
  10255. Both options accept the following values:
  10256. @table @samp
  10257. @item tout
  10258. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10259. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10260. include the results of video dropouts, head clogs, or tape tracking issues.
  10261. @item vrep
  10262. Identify @var{vertical line repetition}. Vertical line repetition includes
  10263. similar rows of pixels within a frame. In born-digital video vertical line
  10264. repetition is common, but this pattern is uncommon in video digitized from an
  10265. analog source. When it occurs in video that results from the digitization of an
  10266. analog source it can indicate concealment from a dropout compensator.
  10267. @item brng
  10268. Identify pixels that fall outside of legal broadcast range.
  10269. @end table
  10270. @item color, c
  10271. Set the highlight color for the @option{out} option. The default color is
  10272. yellow.
  10273. @end table
  10274. @subsection Examples
  10275. @itemize
  10276. @item
  10277. Output data of various video metrics:
  10278. @example
  10279. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10280. @end example
  10281. @item
  10282. Output specific data about the minimum and maximum values of the Y plane per frame:
  10283. @example
  10284. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10285. @end example
  10286. @item
  10287. Playback video while highlighting pixels that are outside of broadcast range in red.
  10288. @example
  10289. ffplay example.mov -vf signalstats="out=brng:color=red"
  10290. @end example
  10291. @item
  10292. Playback video with signalstats metadata drawn over the frame.
  10293. @example
  10294. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10295. @end example
  10296. The contents of signalstat_drawtext.txt used in the command are:
  10297. @example
  10298. time %@{pts:hms@}
  10299. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10300. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10301. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10302. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10303. @end example
  10304. @end itemize
  10305. @anchor{signature}
  10306. @section signature
  10307. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10308. input. In this case the matching between the inputs can be calculated additionally.
  10309. The filter always passes through the first input. The signature of each stream can
  10310. be written into a file.
  10311. It accepts the following options:
  10312. @table @option
  10313. @item detectmode
  10314. Enable or disable the matching process.
  10315. Available values are:
  10316. @table @samp
  10317. @item off
  10318. Disable the calculation of a matching (default).
  10319. @item full
  10320. Calculate the matching for the whole video and output whether the whole video
  10321. matches or only parts.
  10322. @item fast
  10323. Calculate only until a matching is found or the video ends. Should be faster in
  10324. some cases.
  10325. @end table
  10326. @item nb_inputs
  10327. Set the number of inputs. The option value must be a non negative integer.
  10328. Default value is 1.
  10329. @item filename
  10330. Set the path to which the output is written. If there is more than one input,
  10331. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10332. integer), that will be replaced with the input number. If no filename is
  10333. specified, no output will be written. This is the default.
  10334. @item format
  10335. Choose the output format.
  10336. Available values are:
  10337. @table @samp
  10338. @item binary
  10339. Use the specified binary representation (default).
  10340. @item xml
  10341. Use the specified xml representation.
  10342. @end table
  10343. @item th_d
  10344. Set threshold to detect one word as similar. The option value must be an integer
  10345. greater than zero. The default value is 9000.
  10346. @item th_dc
  10347. Set threshold to detect all words as similar. The option value must be an integer
  10348. greater than zero. The default value is 60000.
  10349. @item th_xh
  10350. Set threshold to detect frames as similar. The option value must be an integer
  10351. greater than zero. The default value is 116.
  10352. @item th_di
  10353. Set the minimum length of a sequence in frames to recognize it as matching
  10354. sequence. The option value must be a non negative integer value.
  10355. The default value is 0.
  10356. @item th_it
  10357. Set the minimum relation, that matching frames to all frames must have.
  10358. The option value must be a double value between 0 and 1. The default value is 0.5.
  10359. @end table
  10360. @subsection Examples
  10361. @itemize
  10362. @item
  10363. To calculate the signature of an input video and store it in signature.bin:
  10364. @example
  10365. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10366. @end example
  10367. @item
  10368. To detect whether two videos match and store the signatures in XML format in
  10369. signature0.xml and signature1.xml:
  10370. @example
  10371. 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 -
  10372. @end example
  10373. @end itemize
  10374. @anchor{smartblur}
  10375. @section smartblur
  10376. Blur the input video without impacting the outlines.
  10377. It accepts the following options:
  10378. @table @option
  10379. @item luma_radius, lr
  10380. Set the luma radius. The option value must be a float number in
  10381. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10382. used to blur the image (slower if larger). Default value is 1.0.
  10383. @item luma_strength, ls
  10384. Set the luma strength. The option value must be a float number
  10385. in the range [-1.0,1.0] that configures the blurring. A value included
  10386. in [0.0,1.0] will blur the image whereas a value included in
  10387. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10388. @item luma_threshold, lt
  10389. Set the luma threshold used as a coefficient to determine
  10390. whether a pixel should be blurred or not. The option value must be an
  10391. integer in the range [-30,30]. A value of 0 will filter all the image,
  10392. a value included in [0,30] will filter flat areas and a value included
  10393. in [-30,0] will filter edges. Default value is 0.
  10394. @item chroma_radius, cr
  10395. Set the chroma radius. The option value must be a float number in
  10396. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10397. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10398. @item chroma_strength, cs
  10399. Set the chroma strength. The option value must be a float number
  10400. in the range [-1.0,1.0] that configures the blurring. A value included
  10401. in [0.0,1.0] will blur the image whereas a value included in
  10402. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10403. @item chroma_threshold, ct
  10404. Set the chroma threshold used as a coefficient to determine
  10405. whether a pixel should be blurred or not. The option value must be an
  10406. integer in the range [-30,30]. A value of 0 will filter all the image,
  10407. a value included in [0,30] will filter flat areas and a value included
  10408. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10409. @end table
  10410. If a chroma option is not explicitly set, the corresponding luma value
  10411. is set.
  10412. @section ssim
  10413. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10414. This filter takes in input two input videos, the first input is
  10415. considered the "main" source and is passed unchanged to the
  10416. output. The second input is used as a "reference" video for computing
  10417. the SSIM.
  10418. Both video inputs must have the same resolution and pixel format for
  10419. this filter to work correctly. Also it assumes that both inputs
  10420. have the same number of frames, which are compared one by one.
  10421. The filter stores the calculated SSIM of each frame.
  10422. The description of the accepted parameters follows.
  10423. @table @option
  10424. @item stats_file, f
  10425. If specified the filter will use the named file to save the SSIM of
  10426. each individual frame. When filename equals "-" the data is sent to
  10427. standard output.
  10428. @end table
  10429. The file printed if @var{stats_file} is selected, contains a sequence of
  10430. key/value pairs of the form @var{key}:@var{value} for each compared
  10431. couple of frames.
  10432. A description of each shown parameter follows:
  10433. @table @option
  10434. @item n
  10435. sequential number of the input frame, starting from 1
  10436. @item Y, U, V, R, G, B
  10437. SSIM of the compared frames for the component specified by the suffix.
  10438. @item All
  10439. SSIM of the compared frames for the whole frame.
  10440. @item dB
  10441. Same as above but in dB representation.
  10442. @end table
  10443. For example:
  10444. @example
  10445. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10446. [main][ref] ssim="stats_file=stats.log" [out]
  10447. @end example
  10448. On this example the input file being processed is compared with the
  10449. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10450. is stored in @file{stats.log}.
  10451. Another example with both psnr and ssim at same time:
  10452. @example
  10453. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10454. @end example
  10455. @section stereo3d
  10456. Convert between different stereoscopic image formats.
  10457. The filters accept the following options:
  10458. @table @option
  10459. @item in
  10460. Set stereoscopic image format of input.
  10461. Available values for input image formats are:
  10462. @table @samp
  10463. @item sbsl
  10464. side by side parallel (left eye left, right eye right)
  10465. @item sbsr
  10466. side by side crosseye (right eye left, left eye right)
  10467. @item sbs2l
  10468. side by side parallel with half width resolution
  10469. (left eye left, right eye right)
  10470. @item sbs2r
  10471. side by side crosseye with half width resolution
  10472. (right eye left, left eye right)
  10473. @item abl
  10474. above-below (left eye above, right eye below)
  10475. @item abr
  10476. above-below (right eye above, left eye below)
  10477. @item ab2l
  10478. above-below with half height resolution
  10479. (left eye above, right eye below)
  10480. @item ab2r
  10481. above-below with half height resolution
  10482. (right eye above, left eye below)
  10483. @item al
  10484. alternating frames (left eye first, right eye second)
  10485. @item ar
  10486. alternating frames (right eye first, left eye second)
  10487. @item irl
  10488. interleaved rows (left eye has top row, right eye starts on next row)
  10489. @item irr
  10490. interleaved rows (right eye has top row, left eye starts on next row)
  10491. @item icl
  10492. interleaved columns, left eye first
  10493. @item icr
  10494. interleaved columns, right eye first
  10495. Default value is @samp{sbsl}.
  10496. @end table
  10497. @item out
  10498. Set stereoscopic image format of output.
  10499. @table @samp
  10500. @item sbsl
  10501. side by side parallel (left eye left, right eye right)
  10502. @item sbsr
  10503. side by side crosseye (right eye left, left eye right)
  10504. @item sbs2l
  10505. side by side parallel with half width resolution
  10506. (left eye left, right eye right)
  10507. @item sbs2r
  10508. side by side crosseye with half width resolution
  10509. (right eye left, left eye right)
  10510. @item abl
  10511. above-below (left eye above, right eye below)
  10512. @item abr
  10513. above-below (right eye above, left eye below)
  10514. @item ab2l
  10515. above-below with half height resolution
  10516. (left eye above, right eye below)
  10517. @item ab2r
  10518. above-below with half height resolution
  10519. (right eye above, left eye below)
  10520. @item al
  10521. alternating frames (left eye first, right eye second)
  10522. @item ar
  10523. alternating frames (right eye first, left eye second)
  10524. @item irl
  10525. interleaved rows (left eye has top row, right eye starts on next row)
  10526. @item irr
  10527. interleaved rows (right eye has top row, left eye starts on next row)
  10528. @item arbg
  10529. anaglyph red/blue gray
  10530. (red filter on left eye, blue filter on right eye)
  10531. @item argg
  10532. anaglyph red/green gray
  10533. (red filter on left eye, green filter on right eye)
  10534. @item arcg
  10535. anaglyph red/cyan gray
  10536. (red filter on left eye, cyan filter on right eye)
  10537. @item arch
  10538. anaglyph red/cyan half colored
  10539. (red filter on left eye, cyan filter on right eye)
  10540. @item arcc
  10541. anaglyph red/cyan color
  10542. (red filter on left eye, cyan filter on right eye)
  10543. @item arcd
  10544. anaglyph red/cyan color optimized with the least squares projection of dubois
  10545. (red filter on left eye, cyan filter on right eye)
  10546. @item agmg
  10547. anaglyph green/magenta gray
  10548. (green filter on left eye, magenta filter on right eye)
  10549. @item agmh
  10550. anaglyph green/magenta half colored
  10551. (green filter on left eye, magenta filter on right eye)
  10552. @item agmc
  10553. anaglyph green/magenta colored
  10554. (green filter on left eye, magenta filter on right eye)
  10555. @item agmd
  10556. anaglyph green/magenta color optimized with the least squares projection of dubois
  10557. (green filter on left eye, magenta filter on right eye)
  10558. @item aybg
  10559. anaglyph yellow/blue gray
  10560. (yellow filter on left eye, blue filter on right eye)
  10561. @item aybh
  10562. anaglyph yellow/blue half colored
  10563. (yellow filter on left eye, blue filter on right eye)
  10564. @item aybc
  10565. anaglyph yellow/blue colored
  10566. (yellow filter on left eye, blue filter on right eye)
  10567. @item aybd
  10568. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10569. (yellow filter on left eye, blue filter on right eye)
  10570. @item ml
  10571. mono output (left eye only)
  10572. @item mr
  10573. mono output (right eye only)
  10574. @item chl
  10575. checkerboard, left eye first
  10576. @item chr
  10577. checkerboard, right eye first
  10578. @item icl
  10579. interleaved columns, left eye first
  10580. @item icr
  10581. interleaved columns, right eye first
  10582. @item hdmi
  10583. HDMI frame pack
  10584. @end table
  10585. Default value is @samp{arcd}.
  10586. @end table
  10587. @subsection Examples
  10588. @itemize
  10589. @item
  10590. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10591. @example
  10592. stereo3d=sbsl:aybd
  10593. @end example
  10594. @item
  10595. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10596. @example
  10597. stereo3d=abl:sbsr
  10598. @end example
  10599. @end itemize
  10600. @section streamselect, astreamselect
  10601. Select video or audio streams.
  10602. The filter accepts the following options:
  10603. @table @option
  10604. @item inputs
  10605. Set number of inputs. Default is 2.
  10606. @item map
  10607. Set input indexes to remap to outputs.
  10608. @end table
  10609. @subsection Commands
  10610. The @code{streamselect} and @code{astreamselect} filter supports the following
  10611. commands:
  10612. @table @option
  10613. @item map
  10614. Set input indexes to remap to outputs.
  10615. @end table
  10616. @subsection Examples
  10617. @itemize
  10618. @item
  10619. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10620. @example
  10621. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10622. @end example
  10623. @item
  10624. Same as above, but for audio:
  10625. @example
  10626. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10627. @end example
  10628. @end itemize
  10629. @section sobel
  10630. Apply sobel operator to input video stream.
  10631. The filter accepts the following option:
  10632. @table @option
  10633. @item planes
  10634. Set which planes will be processed, unprocessed planes will be copied.
  10635. By default value 0xf, all planes will be processed.
  10636. @item scale
  10637. Set value which will be multiplied with filtered result.
  10638. @item delta
  10639. Set value which will be added to filtered result.
  10640. @end table
  10641. @anchor{spp}
  10642. @section spp
  10643. Apply a simple postprocessing filter that compresses and decompresses the image
  10644. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10645. and average the results.
  10646. The filter accepts the following options:
  10647. @table @option
  10648. @item quality
  10649. Set quality. This option defines the number of levels for averaging. It accepts
  10650. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10651. effect. A value of @code{6} means the higher quality. For each increment of
  10652. that value the speed drops by a factor of approximately 2. Default value is
  10653. @code{3}.
  10654. @item qp
  10655. Force a constant quantization parameter. If not set, the filter will use the QP
  10656. from the video stream (if available).
  10657. @item mode
  10658. Set thresholding mode. Available modes are:
  10659. @table @samp
  10660. @item hard
  10661. Set hard thresholding (default).
  10662. @item soft
  10663. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10664. @end table
  10665. @item use_bframe_qp
  10666. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10667. option may cause flicker since the B-Frames have often larger QP. Default is
  10668. @code{0} (not enabled).
  10669. @end table
  10670. @anchor{subtitles}
  10671. @section subtitles
  10672. Draw subtitles on top of input video using the libass library.
  10673. To enable compilation of this filter you need to configure FFmpeg with
  10674. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10675. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10676. Alpha) subtitles format.
  10677. The filter accepts the following options:
  10678. @table @option
  10679. @item filename, f
  10680. Set the filename of the subtitle file to read. It must be specified.
  10681. @item original_size
  10682. Specify the size of the original video, the video for which the ASS file
  10683. was composed. For the syntax of this option, check the
  10684. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10685. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10686. correctly scale the fonts if the aspect ratio has been changed.
  10687. @item fontsdir
  10688. Set a directory path containing fonts that can be used by the filter.
  10689. These fonts will be used in addition to whatever the font provider uses.
  10690. @item charenc
  10691. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10692. useful if not UTF-8.
  10693. @item stream_index, si
  10694. Set subtitles stream index. @code{subtitles} filter only.
  10695. @item force_style
  10696. Override default style or script info parameters of the subtitles. It accepts a
  10697. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10698. @end table
  10699. If the first key is not specified, it is assumed that the first value
  10700. specifies the @option{filename}.
  10701. For example, to render the file @file{sub.srt} on top of the input
  10702. video, use the command:
  10703. @example
  10704. subtitles=sub.srt
  10705. @end example
  10706. which is equivalent to:
  10707. @example
  10708. subtitles=filename=sub.srt
  10709. @end example
  10710. To render the default subtitles stream from file @file{video.mkv}, use:
  10711. @example
  10712. subtitles=video.mkv
  10713. @end example
  10714. To render the second subtitles stream from that file, use:
  10715. @example
  10716. subtitles=video.mkv:si=1
  10717. @end example
  10718. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10719. @code{DejaVu Serif}, use:
  10720. @example
  10721. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10722. @end example
  10723. @section super2xsai
  10724. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10725. Interpolate) pixel art scaling algorithm.
  10726. Useful for enlarging pixel art images without reducing sharpness.
  10727. @section swaprect
  10728. Swap two rectangular objects in video.
  10729. This filter accepts the following options:
  10730. @table @option
  10731. @item w
  10732. Set object width.
  10733. @item h
  10734. Set object height.
  10735. @item x1
  10736. Set 1st rect x coordinate.
  10737. @item y1
  10738. Set 1st rect y coordinate.
  10739. @item x2
  10740. Set 2nd rect x coordinate.
  10741. @item y2
  10742. Set 2nd rect y coordinate.
  10743. All expressions are evaluated once for each frame.
  10744. @end table
  10745. The all options are expressions containing the following constants:
  10746. @table @option
  10747. @item w
  10748. @item h
  10749. The input width and height.
  10750. @item a
  10751. same as @var{w} / @var{h}
  10752. @item sar
  10753. input sample aspect ratio
  10754. @item dar
  10755. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10756. @item n
  10757. The number of the input frame, starting from 0.
  10758. @item t
  10759. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10760. @item pos
  10761. the position in the file of the input frame, NAN if unknown
  10762. @end table
  10763. @section swapuv
  10764. Swap U & V plane.
  10765. @section telecine
  10766. Apply telecine process to the video.
  10767. This filter accepts the following options:
  10768. @table @option
  10769. @item first_field
  10770. @table @samp
  10771. @item top, t
  10772. top field first
  10773. @item bottom, b
  10774. bottom field first
  10775. The default value is @code{top}.
  10776. @end table
  10777. @item pattern
  10778. A string of numbers representing the pulldown pattern you wish to apply.
  10779. The default value is @code{23}.
  10780. @end table
  10781. @example
  10782. Some typical patterns:
  10783. NTSC output (30i):
  10784. 27.5p: 32222
  10785. 24p: 23 (classic)
  10786. 24p: 2332 (preferred)
  10787. 20p: 33
  10788. 18p: 334
  10789. 16p: 3444
  10790. PAL output (25i):
  10791. 27.5p: 12222
  10792. 24p: 222222222223 ("Euro pulldown")
  10793. 16.67p: 33
  10794. 16p: 33333334
  10795. @end example
  10796. @section threshold
  10797. Apply threshold effect to video stream.
  10798. This filter needs four video streams to perform thresholding.
  10799. First stream is stream we are filtering.
  10800. Second stream is holding threshold values, third stream is holding min values,
  10801. and last, fourth stream is holding max values.
  10802. The filter accepts the following option:
  10803. @table @option
  10804. @item planes
  10805. Set which planes will be processed, unprocessed planes will be copied.
  10806. By default value 0xf, all planes will be processed.
  10807. @end table
  10808. For example if first stream pixel's component value is less then threshold value
  10809. of pixel component from 2nd threshold stream, third stream value will picked,
  10810. otherwise fourth stream pixel component value will be picked.
  10811. Using color source filter one can perform various types of thresholding:
  10812. @subsection Examples
  10813. @itemize
  10814. @item
  10815. Binary threshold, using gray color as threshold:
  10816. @example
  10817. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10818. @end example
  10819. @item
  10820. Inverted binary threshold, using gray color as threshold:
  10821. @example
  10822. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10823. @end example
  10824. @item
  10825. Truncate binary threshold, using gray color as threshold:
  10826. @example
  10827. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10828. @end example
  10829. @item
  10830. Threshold to zero, using gray color as threshold:
  10831. @example
  10832. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10833. @end example
  10834. @item
  10835. Inverted threshold to zero, using gray color as threshold:
  10836. @example
  10837. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10838. @end example
  10839. @end itemize
  10840. @section thumbnail
  10841. Select the most representative frame in a given sequence of consecutive frames.
  10842. The filter accepts the following options:
  10843. @table @option
  10844. @item n
  10845. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10846. will pick one of them, and then handle the next batch of @var{n} frames until
  10847. the end. Default is @code{100}.
  10848. @end table
  10849. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10850. value will result in a higher memory usage, so a high value is not recommended.
  10851. @subsection Examples
  10852. @itemize
  10853. @item
  10854. Extract one picture each 50 frames:
  10855. @example
  10856. thumbnail=50
  10857. @end example
  10858. @item
  10859. Complete example of a thumbnail creation with @command{ffmpeg}:
  10860. @example
  10861. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10862. @end example
  10863. @end itemize
  10864. @section tile
  10865. Tile several successive frames together.
  10866. The filter accepts the following options:
  10867. @table @option
  10868. @item layout
  10869. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10870. this option, check the
  10871. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10872. @item nb_frames
  10873. Set the maximum number of frames to render in the given area. It must be less
  10874. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10875. the area will be used.
  10876. @item margin
  10877. Set the outer border margin in pixels.
  10878. @item padding
  10879. Set the inner border thickness (i.e. the number of pixels between frames). For
  10880. more advanced padding options (such as having different values for the edges),
  10881. refer to the pad video filter.
  10882. @item color
  10883. Specify the color of the unused area. For the syntax of this option, check the
  10884. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10885. is "black".
  10886. @end table
  10887. @subsection Examples
  10888. @itemize
  10889. @item
  10890. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10891. @example
  10892. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10893. @end example
  10894. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10895. duplicating each output frame to accommodate the originally detected frame
  10896. rate.
  10897. @item
  10898. Display @code{5} pictures in an area of @code{3x2} frames,
  10899. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10900. mixed flat and named options:
  10901. @example
  10902. tile=3x2:nb_frames=5:padding=7:margin=2
  10903. @end example
  10904. @end itemize
  10905. @section tinterlace
  10906. Perform various types of temporal field interlacing.
  10907. Frames are counted starting from 1, so the first input frame is
  10908. considered odd.
  10909. The filter accepts the following options:
  10910. @table @option
  10911. @item mode
  10912. Specify the mode of the interlacing. This option can also be specified
  10913. as a value alone. See below for a list of values for this option.
  10914. Available values are:
  10915. @table @samp
  10916. @item merge, 0
  10917. Move odd frames into the upper field, even into the lower field,
  10918. generating a double height frame at half frame rate.
  10919. @example
  10920. ------> time
  10921. Input:
  10922. Frame 1 Frame 2 Frame 3 Frame 4
  10923. 11111 22222 33333 44444
  10924. 11111 22222 33333 44444
  10925. 11111 22222 33333 44444
  10926. 11111 22222 33333 44444
  10927. Output:
  10928. 11111 33333
  10929. 22222 44444
  10930. 11111 33333
  10931. 22222 44444
  10932. 11111 33333
  10933. 22222 44444
  10934. 11111 33333
  10935. 22222 44444
  10936. @end example
  10937. @item drop_even, 1
  10938. Only output odd frames, even frames are dropped, generating a frame with
  10939. unchanged height at half frame rate.
  10940. @example
  10941. ------> time
  10942. Input:
  10943. Frame 1 Frame 2 Frame 3 Frame 4
  10944. 11111 22222 33333 44444
  10945. 11111 22222 33333 44444
  10946. 11111 22222 33333 44444
  10947. 11111 22222 33333 44444
  10948. Output:
  10949. 11111 33333
  10950. 11111 33333
  10951. 11111 33333
  10952. 11111 33333
  10953. @end example
  10954. @item drop_odd, 2
  10955. Only output even frames, odd frames are dropped, generating a frame with
  10956. unchanged height at half frame rate.
  10957. @example
  10958. ------> time
  10959. Input:
  10960. Frame 1 Frame 2 Frame 3 Frame 4
  10961. 11111 22222 33333 44444
  10962. 11111 22222 33333 44444
  10963. 11111 22222 33333 44444
  10964. 11111 22222 33333 44444
  10965. Output:
  10966. 22222 44444
  10967. 22222 44444
  10968. 22222 44444
  10969. 22222 44444
  10970. @end example
  10971. @item pad, 3
  10972. Expand each frame to full height, but pad alternate lines with black,
  10973. generating a frame with double height at the same input frame rate.
  10974. @example
  10975. ------> time
  10976. Input:
  10977. Frame 1 Frame 2 Frame 3 Frame 4
  10978. 11111 22222 33333 44444
  10979. 11111 22222 33333 44444
  10980. 11111 22222 33333 44444
  10981. 11111 22222 33333 44444
  10982. Output:
  10983. 11111 ..... 33333 .....
  10984. ..... 22222 ..... 44444
  10985. 11111 ..... 33333 .....
  10986. ..... 22222 ..... 44444
  10987. 11111 ..... 33333 .....
  10988. ..... 22222 ..... 44444
  10989. 11111 ..... 33333 .....
  10990. ..... 22222 ..... 44444
  10991. @end example
  10992. @item interleave_top, 4
  10993. Interleave the upper field from odd frames with the lower field from
  10994. even frames, generating a frame with unchanged height at half frame rate.
  10995. @example
  10996. ------> time
  10997. Input:
  10998. Frame 1 Frame 2 Frame 3 Frame 4
  10999. 11111<- 22222 33333<- 44444
  11000. 11111 22222<- 33333 44444<-
  11001. 11111<- 22222 33333<- 44444
  11002. 11111 22222<- 33333 44444<-
  11003. Output:
  11004. 11111 33333
  11005. 22222 44444
  11006. 11111 33333
  11007. 22222 44444
  11008. @end example
  11009. @item interleave_bottom, 5
  11010. Interleave the lower field from odd frames with the upper field from
  11011. even frames, generating a frame with unchanged height at half frame rate.
  11012. @example
  11013. ------> time
  11014. Input:
  11015. Frame 1 Frame 2 Frame 3 Frame 4
  11016. 11111 22222<- 33333 44444<-
  11017. 11111<- 22222 33333<- 44444
  11018. 11111 22222<- 33333 44444<-
  11019. 11111<- 22222 33333<- 44444
  11020. Output:
  11021. 22222 44444
  11022. 11111 33333
  11023. 22222 44444
  11024. 11111 33333
  11025. @end example
  11026. @item interlacex2, 6
  11027. Double frame rate with unchanged height. Frames are inserted each
  11028. containing the second temporal field from the previous input frame and
  11029. the first temporal field from the next input frame. This mode relies on
  11030. the top_field_first flag. Useful for interlaced video displays with no
  11031. field synchronisation.
  11032. @example
  11033. ------> time
  11034. Input:
  11035. Frame 1 Frame 2 Frame 3 Frame 4
  11036. 11111 22222 33333 44444
  11037. 11111 22222 33333 44444
  11038. 11111 22222 33333 44444
  11039. 11111 22222 33333 44444
  11040. Output:
  11041. 11111 22222 22222 33333 33333 44444 44444
  11042. 11111 11111 22222 22222 33333 33333 44444
  11043. 11111 22222 22222 33333 33333 44444 44444
  11044. 11111 11111 22222 22222 33333 33333 44444
  11045. @end example
  11046. @item mergex2, 7
  11047. Move odd frames into the upper field, even into the lower field,
  11048. generating a double height frame at same frame rate.
  11049. @example
  11050. ------> time
  11051. Input:
  11052. Frame 1 Frame 2 Frame 3 Frame 4
  11053. 11111 22222 33333 44444
  11054. 11111 22222 33333 44444
  11055. 11111 22222 33333 44444
  11056. 11111 22222 33333 44444
  11057. Output:
  11058. 11111 33333 33333 55555
  11059. 22222 22222 44444 44444
  11060. 11111 33333 33333 55555
  11061. 22222 22222 44444 44444
  11062. 11111 33333 33333 55555
  11063. 22222 22222 44444 44444
  11064. 11111 33333 33333 55555
  11065. 22222 22222 44444 44444
  11066. @end example
  11067. @end table
  11068. Numeric values are deprecated but are accepted for backward
  11069. compatibility reasons.
  11070. Default mode is @code{merge}.
  11071. @item flags
  11072. Specify flags influencing the filter process.
  11073. Available value for @var{flags} is:
  11074. @table @option
  11075. @item low_pass_filter, vlfp
  11076. Enable linear vertical low-pass filtering in the filter.
  11077. Vertical low-pass filtering is required when creating an interlaced
  11078. destination from a progressive source which contains high-frequency
  11079. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11080. patterning.
  11081. @item complex_filter, cvlfp
  11082. Enable complex vertical low-pass filtering.
  11083. This will slightly less reduce interlace 'twitter' and Moire
  11084. patterning but better retain detail and subjective sharpness impression.
  11085. @end table
  11086. Vertical low-pass filtering can only be enabled for @option{mode}
  11087. @var{interleave_top} and @var{interleave_bottom}.
  11088. @end table
  11089. @section tonemap
  11090. Tone map colors from different dynamic ranges.
  11091. This filter expects data in single precision floating point, as it needs to
  11092. operate on (and can output) out-of-range values. Another filter, such as
  11093. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11094. The tonemapping algorithms implemented only work on linear light, so input
  11095. data should be linearized beforehand (and possibly correctly tagged).
  11096. @example
  11097. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11098. @end example
  11099. @subsection Options
  11100. The filter accepts the following options.
  11101. @table @option
  11102. @item tonemap
  11103. Set the tone map algorithm to use.
  11104. Possible values are:
  11105. @table @var
  11106. @item none
  11107. Do not apply any tone map, only desaturate overbright pixels.
  11108. @item clip
  11109. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11110. in-range values, while distorting out-of-range values.
  11111. @item linear
  11112. Stretch the entire reference gamut to a linear multiple of the display.
  11113. @item gamma
  11114. Fit a logarithmic transfer between the tone curves.
  11115. @item reinhard
  11116. Preserve overall image brightness with a simple curve, using nonlinear
  11117. contrast, which results in flattening details and degrading color accuracy.
  11118. @item hable
  11119. Peserve both dark and bright details better than @var{reinhard}, at the cost
  11120. of slightly darkening everything. Use it when detail preservation is more
  11121. important than color and brightness accuracy.
  11122. @item mobius
  11123. Smoothly map out-of-range values, while retaining contrast and colors for
  11124. in-range material as much as possible. Use it when color accuracy is more
  11125. important than detail preservation.
  11126. @end table
  11127. Default is none.
  11128. @item param
  11129. Tune the tone mapping algorithm.
  11130. This affects the following algorithms:
  11131. @table @var
  11132. @item none
  11133. Ignored.
  11134. @item linear
  11135. Specifies the scale factor to use while stretching.
  11136. Default to 1.0.
  11137. @item gamma
  11138. Specifies the exponent of the function.
  11139. Default to 1.8.
  11140. @item clip
  11141. Specify an extra linear coefficient to multiply into the signal before clipping.
  11142. Default to 1.0.
  11143. @item reinhard
  11144. Specify the local contrast coefficient at the display peak.
  11145. Default to 0.5, which means that in-gamut values will be about half as bright
  11146. as when clipping.
  11147. @item hable
  11148. Ignored.
  11149. @item mobius
  11150. Specify the transition point from linear to mobius transform. Every value
  11151. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11152. more accurate the result will be, at the cost of losing bright details.
  11153. Default to 0.3, which due to the steep initial slope still preserves in-range
  11154. colors fairly accurately.
  11155. @end table
  11156. @item desat
  11157. Apply desaturation for highlights that exceed this level of brightness. The
  11158. higher the parameter, the more color information will be preserved. This
  11159. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11160. (smoothly) turning into white instead. This makes images feel more natural,
  11161. at the cost of reducing information about out-of-range colors.
  11162. The default of 2.0 is somewhat conservative and will mostly just apply to
  11163. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11164. This option works only if the input frame has a supported color tag.
  11165. @item peak
  11166. Override signal/nominal/reference peak with this value. Useful when the
  11167. embedded peak information in display metadata is not reliable or when tone
  11168. mapping from a lower range to a higher range.
  11169. @end table
  11170. @section transpose
  11171. Transpose rows with columns in the input video and optionally flip it.
  11172. It accepts the following parameters:
  11173. @table @option
  11174. @item dir
  11175. Specify the transposition direction.
  11176. Can assume the following values:
  11177. @table @samp
  11178. @item 0, 4, cclock_flip
  11179. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11180. @example
  11181. L.R L.l
  11182. . . -> . .
  11183. l.r R.r
  11184. @end example
  11185. @item 1, 5, clock
  11186. Rotate by 90 degrees clockwise, that is:
  11187. @example
  11188. L.R l.L
  11189. . . -> . .
  11190. l.r r.R
  11191. @end example
  11192. @item 2, 6, cclock
  11193. Rotate by 90 degrees counterclockwise, that is:
  11194. @example
  11195. L.R R.r
  11196. . . -> . .
  11197. l.r L.l
  11198. @end example
  11199. @item 3, 7, clock_flip
  11200. Rotate by 90 degrees clockwise and vertically flip, that is:
  11201. @example
  11202. L.R r.R
  11203. . . -> . .
  11204. l.r l.L
  11205. @end example
  11206. @end table
  11207. For values between 4-7, the transposition is only done if the input
  11208. video geometry is portrait and not landscape. These values are
  11209. deprecated, the @code{passthrough} option should be used instead.
  11210. Numerical values are deprecated, and should be dropped in favor of
  11211. symbolic constants.
  11212. @item passthrough
  11213. Do not apply the transposition if the input geometry matches the one
  11214. specified by the specified value. It accepts the following values:
  11215. @table @samp
  11216. @item none
  11217. Always apply transposition.
  11218. @item portrait
  11219. Preserve portrait geometry (when @var{height} >= @var{width}).
  11220. @item landscape
  11221. Preserve landscape geometry (when @var{width} >= @var{height}).
  11222. @end table
  11223. Default value is @code{none}.
  11224. @end table
  11225. For example to rotate by 90 degrees clockwise and preserve portrait
  11226. layout:
  11227. @example
  11228. transpose=dir=1:passthrough=portrait
  11229. @end example
  11230. The command above can also be specified as:
  11231. @example
  11232. transpose=1:portrait
  11233. @end example
  11234. @section trim
  11235. Trim the input so that the output contains one continuous subpart of the input.
  11236. It accepts the following parameters:
  11237. @table @option
  11238. @item start
  11239. Specify the time of the start of the kept section, i.e. the frame with the
  11240. timestamp @var{start} will be the first frame in the output.
  11241. @item end
  11242. Specify the time of the first frame that will be dropped, i.e. the frame
  11243. immediately preceding the one with the timestamp @var{end} will be the last
  11244. frame in the output.
  11245. @item start_pts
  11246. This is the same as @var{start}, except this option sets the start timestamp
  11247. in timebase units instead of seconds.
  11248. @item end_pts
  11249. This is the same as @var{end}, except this option sets the end timestamp
  11250. in timebase units instead of seconds.
  11251. @item duration
  11252. The maximum duration of the output in seconds.
  11253. @item start_frame
  11254. The number of the first frame that should be passed to the output.
  11255. @item end_frame
  11256. The number of the first frame that should be dropped.
  11257. @end table
  11258. @option{start}, @option{end}, and @option{duration} are expressed as time
  11259. duration specifications; see
  11260. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11261. for the accepted syntax.
  11262. Note that the first two sets of the start/end options and the @option{duration}
  11263. option look at the frame timestamp, while the _frame variants simply count the
  11264. frames that pass through the filter. Also note that this filter does not modify
  11265. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11266. setpts filter after the trim filter.
  11267. If multiple start or end options are set, this filter tries to be greedy and
  11268. keep all the frames that match at least one of the specified constraints. To keep
  11269. only the part that matches all the constraints at once, chain multiple trim
  11270. filters.
  11271. The defaults are such that all the input is kept. So it is possible to set e.g.
  11272. just the end values to keep everything before the specified time.
  11273. Examples:
  11274. @itemize
  11275. @item
  11276. Drop everything except the second minute of input:
  11277. @example
  11278. ffmpeg -i INPUT -vf trim=60:120
  11279. @end example
  11280. @item
  11281. Keep only the first second:
  11282. @example
  11283. ffmpeg -i INPUT -vf trim=duration=1
  11284. @end example
  11285. @end itemize
  11286. @section unpremultiply
  11287. Apply alpha unpremultiply effect to input video stream using first plane
  11288. of second stream as alpha.
  11289. Both streams must have same dimensions and same pixel format.
  11290. The filter accepts the following option:
  11291. @table @option
  11292. @item planes
  11293. Set which planes will be processed, unprocessed planes will be copied.
  11294. By default value 0xf, all planes will be processed.
  11295. If the format has 1 or 2 components, then luma is bit 0.
  11296. If the format has 3 or 4 components:
  11297. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11298. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11299. If present, the alpha channel is always the last bit.
  11300. @item inplace
  11301. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11302. @end table
  11303. @anchor{unsharp}
  11304. @section unsharp
  11305. Sharpen or blur the input video.
  11306. It accepts the following parameters:
  11307. @table @option
  11308. @item luma_msize_x, lx
  11309. Set the luma matrix horizontal size. It must be an odd integer between
  11310. 3 and 23. The default value is 5.
  11311. @item luma_msize_y, ly
  11312. Set the luma matrix vertical size. It must be an odd integer between 3
  11313. and 23. The default value is 5.
  11314. @item luma_amount, la
  11315. Set the luma effect strength. It must be a floating point number, reasonable
  11316. values lay between -1.5 and 1.5.
  11317. Negative values will blur the input video, while positive values will
  11318. sharpen it, a value of zero will disable the effect.
  11319. Default value is 1.0.
  11320. @item chroma_msize_x, cx
  11321. Set the chroma matrix horizontal size. It must be an odd integer
  11322. between 3 and 23. The default value is 5.
  11323. @item chroma_msize_y, cy
  11324. Set the chroma matrix vertical size. It must be an odd integer
  11325. between 3 and 23. The default value is 5.
  11326. @item chroma_amount, ca
  11327. Set the chroma effect strength. It must be a floating point number, reasonable
  11328. values lay between -1.5 and 1.5.
  11329. Negative values will blur the input video, while positive values will
  11330. sharpen it, a value of zero will disable the effect.
  11331. Default value is 0.0.
  11332. @item opencl
  11333. If set to 1, specify using OpenCL capabilities, only available if
  11334. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11335. @end table
  11336. All parameters are optional and default to the equivalent of the
  11337. string '5:5:1.0:5:5:0.0'.
  11338. @subsection Examples
  11339. @itemize
  11340. @item
  11341. Apply strong luma sharpen effect:
  11342. @example
  11343. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11344. @end example
  11345. @item
  11346. Apply a strong blur of both luma and chroma parameters:
  11347. @example
  11348. unsharp=7:7:-2:7:7:-2
  11349. @end example
  11350. @end itemize
  11351. @section uspp
  11352. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11353. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11354. shifts and average the results.
  11355. The way this differs from the behavior of spp is that uspp actually encodes &
  11356. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11357. DCT similar to MJPEG.
  11358. The filter accepts the following options:
  11359. @table @option
  11360. @item quality
  11361. Set quality. This option defines the number of levels for averaging. It accepts
  11362. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11363. effect. A value of @code{8} means the higher quality. For each increment of
  11364. that value the speed drops by a factor of approximately 2. Default value is
  11365. @code{3}.
  11366. @item qp
  11367. Force a constant quantization parameter. If not set, the filter will use the QP
  11368. from the video stream (if available).
  11369. @end table
  11370. @section vaguedenoiser
  11371. Apply a wavelet based denoiser.
  11372. It transforms each frame from the video input into the wavelet domain,
  11373. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11374. the obtained coefficients. It does an inverse wavelet transform after.
  11375. Due to wavelet properties, it should give a nice smoothed result, and
  11376. reduced noise, without blurring picture features.
  11377. This filter accepts the following options:
  11378. @table @option
  11379. @item threshold
  11380. The filtering strength. The higher, the more filtered the video will be.
  11381. Hard thresholding can use a higher threshold than soft thresholding
  11382. before the video looks overfiltered.
  11383. @item method
  11384. The filtering method the filter will use.
  11385. It accepts the following values:
  11386. @table @samp
  11387. @item hard
  11388. All values under the threshold will be zeroed.
  11389. @item soft
  11390. All values under the threshold will be zeroed. All values above will be
  11391. reduced by the threshold.
  11392. @item garrote
  11393. Scales or nullifies coefficients - intermediary between (more) soft and
  11394. (less) hard thresholding.
  11395. @end table
  11396. @item nsteps
  11397. Number of times, the wavelet will decompose the picture. Picture can't
  11398. be decomposed beyond a particular point (typically, 8 for a 640x480
  11399. frame - as 2^9 = 512 > 480)
  11400. @item percent
  11401. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11402. @item planes
  11403. A list of the planes to process. By default all planes are processed.
  11404. @end table
  11405. @section vectorscope
  11406. Display 2 color component values in the two dimensional graph (which is called
  11407. a vectorscope).
  11408. This filter accepts the following options:
  11409. @table @option
  11410. @item mode, m
  11411. Set vectorscope mode.
  11412. It accepts the following values:
  11413. @table @samp
  11414. @item gray
  11415. Gray values are displayed on graph, higher brightness means more pixels have
  11416. same component color value on location in graph. This is the default mode.
  11417. @item color
  11418. Gray values are displayed on graph. Surrounding pixels values which are not
  11419. present in video frame are drawn in gradient of 2 color components which are
  11420. set by option @code{x} and @code{y}. The 3rd color component is static.
  11421. @item color2
  11422. Actual color components values present in video frame are displayed on graph.
  11423. @item color3
  11424. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11425. on graph increases value of another color component, which is luminance by
  11426. default values of @code{x} and @code{y}.
  11427. @item color4
  11428. Actual colors present in video frame are displayed on graph. If two different
  11429. colors map to same position on graph then color with higher value of component
  11430. not present in graph is picked.
  11431. @item color5
  11432. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11433. component picked from radial gradient.
  11434. @end table
  11435. @item x
  11436. Set which color component will be represented on X-axis. Default is @code{1}.
  11437. @item y
  11438. Set which color component will be represented on Y-axis. Default is @code{2}.
  11439. @item intensity, i
  11440. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11441. of color component which represents frequency of (X, Y) location in graph.
  11442. @item envelope, e
  11443. @table @samp
  11444. @item none
  11445. No envelope, this is default.
  11446. @item instant
  11447. Instant envelope, even darkest single pixel will be clearly highlighted.
  11448. @item peak
  11449. Hold maximum and minimum values presented in graph over time. This way you
  11450. can still spot out of range values without constantly looking at vectorscope.
  11451. @item peak+instant
  11452. Peak and instant envelope combined together.
  11453. @end table
  11454. @item graticule, g
  11455. Set what kind of graticule to draw.
  11456. @table @samp
  11457. @item none
  11458. @item green
  11459. @item color
  11460. @end table
  11461. @item opacity, o
  11462. Set graticule opacity.
  11463. @item flags, f
  11464. Set graticule flags.
  11465. @table @samp
  11466. @item white
  11467. Draw graticule for white point.
  11468. @item black
  11469. Draw graticule for black point.
  11470. @item name
  11471. Draw color points short names.
  11472. @end table
  11473. @item bgopacity, b
  11474. Set background opacity.
  11475. @item lthreshold, l
  11476. Set low threshold for color component not represented on X or Y axis.
  11477. Values lower than this value will be ignored. Default is 0.
  11478. Note this value is multiplied with actual max possible value one pixel component
  11479. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11480. is 0.1 * 255 = 25.
  11481. @item hthreshold, h
  11482. Set high threshold for color component not represented on X or Y axis.
  11483. Values higher than this value will be ignored. Default is 1.
  11484. Note this value is multiplied with actual max possible value one pixel component
  11485. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11486. is 0.9 * 255 = 230.
  11487. @item colorspace, c
  11488. Set what kind of colorspace to use when drawing graticule.
  11489. @table @samp
  11490. @item auto
  11491. @item 601
  11492. @item 709
  11493. @end table
  11494. Default is auto.
  11495. @end table
  11496. @anchor{vidstabdetect}
  11497. @section vidstabdetect
  11498. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11499. @ref{vidstabtransform} for pass 2.
  11500. This filter generates a file with relative translation and rotation
  11501. transform information about subsequent frames, which is then used by
  11502. the @ref{vidstabtransform} filter.
  11503. To enable compilation of this filter you need to configure FFmpeg with
  11504. @code{--enable-libvidstab}.
  11505. This filter accepts the following options:
  11506. @table @option
  11507. @item result
  11508. Set the path to the file used to write the transforms information.
  11509. Default value is @file{transforms.trf}.
  11510. @item shakiness
  11511. Set how shaky the video is and how quick the camera is. It accepts an
  11512. integer in the range 1-10, a value of 1 means little shakiness, a
  11513. value of 10 means strong shakiness. Default value is 5.
  11514. @item accuracy
  11515. Set the accuracy of the detection process. It must be a value in the
  11516. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11517. accuracy. Default value is 15.
  11518. @item stepsize
  11519. Set stepsize of the search process. The region around minimum is
  11520. scanned with 1 pixel resolution. Default value is 6.
  11521. @item mincontrast
  11522. Set minimum contrast. Below this value a local measurement field is
  11523. discarded. Must be a floating point value in the range 0-1. Default
  11524. value is 0.3.
  11525. @item tripod
  11526. Set reference frame number for tripod mode.
  11527. If enabled, the motion of the frames is compared to a reference frame
  11528. in the filtered stream, identified by the specified number. The idea
  11529. is to compensate all movements in a more-or-less static scene and keep
  11530. the camera view absolutely still.
  11531. If set to 0, it is disabled. The frames are counted starting from 1.
  11532. @item show
  11533. Show fields and transforms in the resulting frames. It accepts an
  11534. integer in the range 0-2. Default value is 0, which disables any
  11535. visualization.
  11536. @end table
  11537. @subsection Examples
  11538. @itemize
  11539. @item
  11540. Use default values:
  11541. @example
  11542. vidstabdetect
  11543. @end example
  11544. @item
  11545. Analyze strongly shaky movie and put the results in file
  11546. @file{mytransforms.trf}:
  11547. @example
  11548. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11549. @end example
  11550. @item
  11551. Visualize the result of internal transformations in the resulting
  11552. video:
  11553. @example
  11554. vidstabdetect=show=1
  11555. @end example
  11556. @item
  11557. Analyze a video with medium shakiness using @command{ffmpeg}:
  11558. @example
  11559. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11560. @end example
  11561. @end itemize
  11562. @anchor{vidstabtransform}
  11563. @section vidstabtransform
  11564. Video stabilization/deshaking: pass 2 of 2,
  11565. see @ref{vidstabdetect} for pass 1.
  11566. Read a file with transform information for each frame and
  11567. apply/compensate them. Together with the @ref{vidstabdetect}
  11568. filter this can be used to deshake videos. See also
  11569. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11570. the @ref{unsharp} filter, see below.
  11571. To enable compilation of this filter you need to configure FFmpeg with
  11572. @code{--enable-libvidstab}.
  11573. @subsection Options
  11574. @table @option
  11575. @item input
  11576. Set path to the file used to read the transforms. Default value is
  11577. @file{transforms.trf}.
  11578. @item smoothing
  11579. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11580. camera movements. Default value is 10.
  11581. For example a number of 10 means that 21 frames are used (10 in the
  11582. past and 10 in the future) to smoothen the motion in the video. A
  11583. larger value leads to a smoother video, but limits the acceleration of
  11584. the camera (pan/tilt movements). 0 is a special case where a static
  11585. camera is simulated.
  11586. @item optalgo
  11587. Set the camera path optimization algorithm.
  11588. Accepted values are:
  11589. @table @samp
  11590. @item gauss
  11591. gaussian kernel low-pass filter on camera motion (default)
  11592. @item avg
  11593. averaging on transformations
  11594. @end table
  11595. @item maxshift
  11596. Set maximal number of pixels to translate frames. Default value is -1,
  11597. meaning no limit.
  11598. @item maxangle
  11599. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11600. value is -1, meaning no limit.
  11601. @item crop
  11602. Specify how to deal with borders that may be visible due to movement
  11603. compensation.
  11604. Available values are:
  11605. @table @samp
  11606. @item keep
  11607. keep image information from previous frame (default)
  11608. @item black
  11609. fill the border black
  11610. @end table
  11611. @item invert
  11612. Invert transforms if set to 1. Default value is 0.
  11613. @item relative
  11614. Consider transforms as relative to previous frame if set to 1,
  11615. absolute if set to 0. Default value is 0.
  11616. @item zoom
  11617. Set percentage to zoom. A positive value will result in a zoom-in
  11618. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11619. zoom).
  11620. @item optzoom
  11621. Set optimal zooming to avoid borders.
  11622. Accepted values are:
  11623. @table @samp
  11624. @item 0
  11625. disabled
  11626. @item 1
  11627. optimal static zoom value is determined (only very strong movements
  11628. will lead to visible borders) (default)
  11629. @item 2
  11630. optimal adaptive zoom value is determined (no borders will be
  11631. visible), see @option{zoomspeed}
  11632. @end table
  11633. Note that the value given at zoom is added to the one calculated here.
  11634. @item zoomspeed
  11635. Set percent to zoom maximally each frame (enabled when
  11636. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11637. 0.25.
  11638. @item interpol
  11639. Specify type of interpolation.
  11640. Available values are:
  11641. @table @samp
  11642. @item no
  11643. no interpolation
  11644. @item linear
  11645. linear only horizontal
  11646. @item bilinear
  11647. linear in both directions (default)
  11648. @item bicubic
  11649. cubic in both directions (slow)
  11650. @end table
  11651. @item tripod
  11652. Enable virtual tripod mode if set to 1, which is equivalent to
  11653. @code{relative=0:smoothing=0}. Default value is 0.
  11654. Use also @code{tripod} option of @ref{vidstabdetect}.
  11655. @item debug
  11656. Increase log verbosity if set to 1. Also the detected global motions
  11657. are written to the temporary file @file{global_motions.trf}. Default
  11658. value is 0.
  11659. @end table
  11660. @subsection Examples
  11661. @itemize
  11662. @item
  11663. Use @command{ffmpeg} for a typical stabilization with default values:
  11664. @example
  11665. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11666. @end example
  11667. Note the use of the @ref{unsharp} filter which is always recommended.
  11668. @item
  11669. Zoom in a bit more and load transform data from a given file:
  11670. @example
  11671. vidstabtransform=zoom=5:input="mytransforms.trf"
  11672. @end example
  11673. @item
  11674. Smoothen the video even more:
  11675. @example
  11676. vidstabtransform=smoothing=30
  11677. @end example
  11678. @end itemize
  11679. @section vflip
  11680. Flip the input video vertically.
  11681. For example, to vertically flip a video with @command{ffmpeg}:
  11682. @example
  11683. ffmpeg -i in.avi -vf "vflip" out.avi
  11684. @end example
  11685. @anchor{vignette}
  11686. @section vignette
  11687. Make or reverse a natural vignetting effect.
  11688. The filter accepts the following options:
  11689. @table @option
  11690. @item angle, a
  11691. Set lens angle expression as a number of radians.
  11692. The value is clipped in the @code{[0,PI/2]} range.
  11693. Default value: @code{"PI/5"}
  11694. @item x0
  11695. @item y0
  11696. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11697. by default.
  11698. @item mode
  11699. Set forward/backward mode.
  11700. Available modes are:
  11701. @table @samp
  11702. @item forward
  11703. The larger the distance from the central point, the darker the image becomes.
  11704. @item backward
  11705. The larger the distance from the central point, the brighter the image becomes.
  11706. This can be used to reverse a vignette effect, though there is no automatic
  11707. detection to extract the lens @option{angle} and other settings (yet). It can
  11708. also be used to create a burning effect.
  11709. @end table
  11710. Default value is @samp{forward}.
  11711. @item eval
  11712. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11713. It accepts the following values:
  11714. @table @samp
  11715. @item init
  11716. Evaluate expressions only once during the filter initialization.
  11717. @item frame
  11718. Evaluate expressions for each incoming frame. This is way slower than the
  11719. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11720. allows advanced dynamic expressions.
  11721. @end table
  11722. Default value is @samp{init}.
  11723. @item dither
  11724. Set dithering to reduce the circular banding effects. Default is @code{1}
  11725. (enabled).
  11726. @item aspect
  11727. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11728. Setting this value to the SAR of the input will make a rectangular vignetting
  11729. following the dimensions of the video.
  11730. Default is @code{1/1}.
  11731. @end table
  11732. @subsection Expressions
  11733. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11734. following parameters.
  11735. @table @option
  11736. @item w
  11737. @item h
  11738. input width and height
  11739. @item n
  11740. the number of input frame, starting from 0
  11741. @item pts
  11742. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11743. @var{TB} units, NAN if undefined
  11744. @item r
  11745. frame rate of the input video, NAN if the input frame rate is unknown
  11746. @item t
  11747. the PTS (Presentation TimeStamp) of the filtered video frame,
  11748. expressed in seconds, NAN if undefined
  11749. @item tb
  11750. time base of the input video
  11751. @end table
  11752. @subsection Examples
  11753. @itemize
  11754. @item
  11755. Apply simple strong vignetting effect:
  11756. @example
  11757. vignette=PI/4
  11758. @end example
  11759. @item
  11760. Make a flickering vignetting:
  11761. @example
  11762. vignette='PI/4+random(1)*PI/50':eval=frame
  11763. @end example
  11764. @end itemize
  11765. @section vstack
  11766. Stack input videos vertically.
  11767. All streams must be of same pixel format and of same width.
  11768. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11769. to create same output.
  11770. The filter accept the following option:
  11771. @table @option
  11772. @item inputs
  11773. Set number of input streams. Default is 2.
  11774. @item shortest
  11775. If set to 1, force the output to terminate when the shortest input
  11776. terminates. Default value is 0.
  11777. @end table
  11778. @section w3fdif
  11779. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11780. Deinterlacing Filter").
  11781. Based on the process described by Martin Weston for BBC R&D, and
  11782. implemented based on the de-interlace algorithm written by Jim
  11783. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11784. uses filter coefficients calculated by BBC R&D.
  11785. There are two sets of filter coefficients, so called "simple":
  11786. and "complex". Which set of filter coefficients is used can
  11787. be set by passing an optional parameter:
  11788. @table @option
  11789. @item filter
  11790. Set the interlacing filter coefficients. Accepts one of the following values:
  11791. @table @samp
  11792. @item simple
  11793. Simple filter coefficient set.
  11794. @item complex
  11795. More-complex filter coefficient set.
  11796. @end table
  11797. Default value is @samp{complex}.
  11798. @item deint
  11799. Specify which frames to deinterlace. Accept one of the following values:
  11800. @table @samp
  11801. @item all
  11802. Deinterlace all frames,
  11803. @item interlaced
  11804. Only deinterlace frames marked as interlaced.
  11805. @end table
  11806. Default value is @samp{all}.
  11807. @end table
  11808. @section waveform
  11809. Video waveform monitor.
  11810. The waveform monitor plots color component intensity. By default luminance
  11811. only. Each column of the waveform corresponds to a column of pixels in the
  11812. source video.
  11813. It accepts the following options:
  11814. @table @option
  11815. @item mode, m
  11816. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11817. In row mode, the graph on the left side represents color component value 0 and
  11818. the right side represents value = 255. In column mode, the top side represents
  11819. color component value = 0 and bottom side represents value = 255.
  11820. @item intensity, i
  11821. Set intensity. Smaller values are useful to find out how many values of the same
  11822. luminance are distributed across input rows/columns.
  11823. Default value is @code{0.04}. Allowed range is [0, 1].
  11824. @item mirror, r
  11825. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11826. In mirrored mode, higher values will be represented on the left
  11827. side for @code{row} mode and at the top for @code{column} mode. Default is
  11828. @code{1} (mirrored).
  11829. @item display, d
  11830. Set display mode.
  11831. It accepts the following values:
  11832. @table @samp
  11833. @item overlay
  11834. Presents information identical to that in the @code{parade}, except
  11835. that the graphs representing color components are superimposed directly
  11836. over one another.
  11837. This display mode makes it easier to spot relative differences or similarities
  11838. in overlapping areas of the color components that are supposed to be identical,
  11839. such as neutral whites, grays, or blacks.
  11840. @item stack
  11841. Display separate graph for the color components side by side in
  11842. @code{row} mode or one below the other in @code{column} mode.
  11843. @item parade
  11844. Display separate graph for the color components side by side in
  11845. @code{column} mode or one below the other in @code{row} mode.
  11846. Using this display mode makes it easy to spot color casts in the highlights
  11847. and shadows of an image, by comparing the contours of the top and the bottom
  11848. graphs of each waveform. Since whites, grays, and blacks are characterized
  11849. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11850. should display three waveforms of roughly equal width/height. If not, the
  11851. correction is easy to perform by making level adjustments the three waveforms.
  11852. @end table
  11853. Default is @code{stack}.
  11854. @item components, c
  11855. Set which color components to display. Default is 1, which means only luminance
  11856. or red color component if input is in RGB colorspace. If is set for example to
  11857. 7 it will display all 3 (if) available color components.
  11858. @item envelope, e
  11859. @table @samp
  11860. @item none
  11861. No envelope, this is default.
  11862. @item instant
  11863. Instant envelope, minimum and maximum values presented in graph will be easily
  11864. visible even with small @code{step} value.
  11865. @item peak
  11866. Hold minimum and maximum values presented in graph across time. This way you
  11867. can still spot out of range values without constantly looking at waveforms.
  11868. @item peak+instant
  11869. Peak and instant envelope combined together.
  11870. @end table
  11871. @item filter, f
  11872. @table @samp
  11873. @item lowpass
  11874. No filtering, this is default.
  11875. @item flat
  11876. Luma and chroma combined together.
  11877. @item aflat
  11878. Similar as above, but shows difference between blue and red chroma.
  11879. @item chroma
  11880. Displays only chroma.
  11881. @item color
  11882. Displays actual color value on waveform.
  11883. @item acolor
  11884. Similar as above, but with luma showing frequency of chroma values.
  11885. @end table
  11886. @item graticule, g
  11887. Set which graticule to display.
  11888. @table @samp
  11889. @item none
  11890. Do not display graticule.
  11891. @item green
  11892. Display green graticule showing legal broadcast ranges.
  11893. @end table
  11894. @item opacity, o
  11895. Set graticule opacity.
  11896. @item flags, fl
  11897. Set graticule flags.
  11898. @table @samp
  11899. @item numbers
  11900. Draw numbers above lines. By default enabled.
  11901. @item dots
  11902. Draw dots instead of lines.
  11903. @end table
  11904. @item scale, s
  11905. Set scale used for displaying graticule.
  11906. @table @samp
  11907. @item digital
  11908. @item millivolts
  11909. @item ire
  11910. @end table
  11911. Default is digital.
  11912. @item bgopacity, b
  11913. Set background opacity.
  11914. @end table
  11915. @section weave, doubleweave
  11916. The @code{weave} takes a field-based video input and join
  11917. each two sequential fields into single frame, producing a new double
  11918. height clip with half the frame rate and half the frame count.
  11919. The @code{doubleweave} works same as @code{weave} but without
  11920. halving frame rate and frame count.
  11921. It accepts the following option:
  11922. @table @option
  11923. @item first_field
  11924. Set first field. Available values are:
  11925. @table @samp
  11926. @item top, t
  11927. Set the frame as top-field-first.
  11928. @item bottom, b
  11929. Set the frame as bottom-field-first.
  11930. @end table
  11931. @end table
  11932. @subsection Examples
  11933. @itemize
  11934. @item
  11935. Interlace video using @ref{select} and @ref{separatefields} filter:
  11936. @example
  11937. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11938. @end example
  11939. @end itemize
  11940. @section xbr
  11941. Apply the xBR high-quality magnification filter which is designed for pixel
  11942. art. It follows a set of edge-detection rules, see
  11943. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11944. It accepts the following option:
  11945. @table @option
  11946. @item n
  11947. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11948. @code{3xBR} and @code{4} for @code{4xBR}.
  11949. Default is @code{3}.
  11950. @end table
  11951. @anchor{yadif}
  11952. @section yadif
  11953. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11954. filter").
  11955. It accepts the following parameters:
  11956. @table @option
  11957. @item mode
  11958. The interlacing mode to adopt. It accepts one of the following values:
  11959. @table @option
  11960. @item 0, send_frame
  11961. Output one frame for each frame.
  11962. @item 1, send_field
  11963. Output one frame for each field.
  11964. @item 2, send_frame_nospatial
  11965. Like @code{send_frame}, but it skips the spatial interlacing check.
  11966. @item 3, send_field_nospatial
  11967. Like @code{send_field}, but it skips the spatial interlacing check.
  11968. @end table
  11969. The default value is @code{send_frame}.
  11970. @item parity
  11971. The picture field parity assumed for the input interlaced video. It accepts one
  11972. of the following values:
  11973. @table @option
  11974. @item 0, tff
  11975. Assume the top field is first.
  11976. @item 1, bff
  11977. Assume the bottom field is first.
  11978. @item -1, auto
  11979. Enable automatic detection of field parity.
  11980. @end table
  11981. The default value is @code{auto}.
  11982. If the interlacing is unknown or the decoder does not export this information,
  11983. top field first will be assumed.
  11984. @item deint
  11985. Specify which frames to deinterlace. Accept one of the following
  11986. values:
  11987. @table @option
  11988. @item 0, all
  11989. Deinterlace all frames.
  11990. @item 1, interlaced
  11991. Only deinterlace frames marked as interlaced.
  11992. @end table
  11993. The default value is @code{all}.
  11994. @end table
  11995. @section zoompan
  11996. Apply Zoom & Pan effect.
  11997. This filter accepts the following options:
  11998. @table @option
  11999. @item zoom, z
  12000. Set the zoom expression. Default is 1.
  12001. @item x
  12002. @item y
  12003. Set the x and y expression. Default is 0.
  12004. @item d
  12005. Set the duration expression in number of frames.
  12006. This sets for how many number of frames effect will last for
  12007. single input image.
  12008. @item s
  12009. Set the output image size, default is 'hd720'.
  12010. @item fps
  12011. Set the output frame rate, default is '25'.
  12012. @end table
  12013. Each expression can contain the following constants:
  12014. @table @option
  12015. @item in_w, iw
  12016. Input width.
  12017. @item in_h, ih
  12018. Input height.
  12019. @item out_w, ow
  12020. Output width.
  12021. @item out_h, oh
  12022. Output height.
  12023. @item in
  12024. Input frame count.
  12025. @item on
  12026. Output frame count.
  12027. @item x
  12028. @item y
  12029. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12030. for current input frame.
  12031. @item px
  12032. @item py
  12033. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12034. not yet such frame (first input frame).
  12035. @item zoom
  12036. Last calculated zoom from 'z' expression for current input frame.
  12037. @item pzoom
  12038. Last calculated zoom of last output frame of previous input frame.
  12039. @item duration
  12040. Number of output frames for current input frame. Calculated from 'd' expression
  12041. for each input frame.
  12042. @item pduration
  12043. number of output frames created for previous input frame
  12044. @item a
  12045. Rational number: input width / input height
  12046. @item sar
  12047. sample aspect ratio
  12048. @item dar
  12049. display aspect ratio
  12050. @end table
  12051. @subsection Examples
  12052. @itemize
  12053. @item
  12054. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12055. @example
  12056. 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
  12057. @end example
  12058. @item
  12059. Zoom-in up to 1.5 and pan always at center of picture:
  12060. @example
  12061. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12062. @end example
  12063. @item
  12064. Same as above but without pausing:
  12065. @example
  12066. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12067. @end example
  12068. @end itemize
  12069. @anchor{zscale}
  12070. @section zscale
  12071. Scale (resize) the input video, using the z.lib library:
  12072. https://github.com/sekrit-twc/zimg.
  12073. The zscale filter forces the output display aspect ratio to be the same
  12074. as the input, by changing the output sample aspect ratio.
  12075. If the input image format is different from the format requested by
  12076. the next filter, the zscale filter will convert the input to the
  12077. requested format.
  12078. @subsection Options
  12079. The filter accepts the following options.
  12080. @table @option
  12081. @item width, w
  12082. @item height, h
  12083. Set the output video dimension expression. Default value is the input
  12084. dimension.
  12085. If the @var{width} or @var{w} value is 0, the input width is used for
  12086. the output. If the @var{height} or @var{h} value is 0, the input height
  12087. is used for the output.
  12088. If one and only one of the values is -n with n >= 1, the zscale filter
  12089. will use a value that maintains the aspect ratio of the input image,
  12090. calculated from the other specified dimension. After that it will,
  12091. however, make sure that the calculated dimension is divisible by n and
  12092. adjust the value if necessary.
  12093. If both values are -n with n >= 1, the behavior will be identical to
  12094. both values being set to 0 as previously detailed.
  12095. See below for the list of accepted constants for use in the dimension
  12096. expression.
  12097. @item size, s
  12098. Set the video size. For the syntax of this option, check the
  12099. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12100. @item dither, d
  12101. Set the dither type.
  12102. Possible values are:
  12103. @table @var
  12104. @item none
  12105. @item ordered
  12106. @item random
  12107. @item error_diffusion
  12108. @end table
  12109. Default is none.
  12110. @item filter, f
  12111. Set the resize filter type.
  12112. Possible values are:
  12113. @table @var
  12114. @item point
  12115. @item bilinear
  12116. @item bicubic
  12117. @item spline16
  12118. @item spline36
  12119. @item lanczos
  12120. @end table
  12121. Default is bilinear.
  12122. @item range, r
  12123. Set the color range.
  12124. Possible values are:
  12125. @table @var
  12126. @item input
  12127. @item limited
  12128. @item full
  12129. @end table
  12130. Default is same as input.
  12131. @item primaries, p
  12132. Set the color primaries.
  12133. Possible values are:
  12134. @table @var
  12135. @item input
  12136. @item 709
  12137. @item unspecified
  12138. @item 170m
  12139. @item 240m
  12140. @item 2020
  12141. @end table
  12142. Default is same as input.
  12143. @item transfer, t
  12144. Set the transfer characteristics.
  12145. Possible values are:
  12146. @table @var
  12147. @item input
  12148. @item 709
  12149. @item unspecified
  12150. @item 601
  12151. @item linear
  12152. @item 2020_10
  12153. @item 2020_12
  12154. @item smpte2084
  12155. @item iec61966-2-1
  12156. @item arib-std-b67
  12157. @end table
  12158. Default is same as input.
  12159. @item matrix, m
  12160. Set the colorspace matrix.
  12161. Possible value are:
  12162. @table @var
  12163. @item input
  12164. @item 709
  12165. @item unspecified
  12166. @item 470bg
  12167. @item 170m
  12168. @item 2020_ncl
  12169. @item 2020_cl
  12170. @end table
  12171. Default is same as input.
  12172. @item rangein, rin
  12173. Set the input color range.
  12174. Possible values are:
  12175. @table @var
  12176. @item input
  12177. @item limited
  12178. @item full
  12179. @end table
  12180. Default is same as input.
  12181. @item primariesin, pin
  12182. Set the input color primaries.
  12183. Possible values are:
  12184. @table @var
  12185. @item input
  12186. @item 709
  12187. @item unspecified
  12188. @item 170m
  12189. @item 240m
  12190. @item 2020
  12191. @end table
  12192. Default is same as input.
  12193. @item transferin, tin
  12194. Set the input transfer characteristics.
  12195. Possible values are:
  12196. @table @var
  12197. @item input
  12198. @item 709
  12199. @item unspecified
  12200. @item 601
  12201. @item linear
  12202. @item 2020_10
  12203. @item 2020_12
  12204. @end table
  12205. Default is same as input.
  12206. @item matrixin, min
  12207. Set the input colorspace matrix.
  12208. Possible value are:
  12209. @table @var
  12210. @item input
  12211. @item 709
  12212. @item unspecified
  12213. @item 470bg
  12214. @item 170m
  12215. @item 2020_ncl
  12216. @item 2020_cl
  12217. @end table
  12218. @item chromal, c
  12219. Set the output chroma location.
  12220. Possible values are:
  12221. @table @var
  12222. @item input
  12223. @item left
  12224. @item center
  12225. @item topleft
  12226. @item top
  12227. @item bottomleft
  12228. @item bottom
  12229. @end table
  12230. @item chromalin, cin
  12231. Set the input chroma location.
  12232. Possible values are:
  12233. @table @var
  12234. @item input
  12235. @item left
  12236. @item center
  12237. @item topleft
  12238. @item top
  12239. @item bottomleft
  12240. @item bottom
  12241. @end table
  12242. @item npl
  12243. Set the nominal peak luminance.
  12244. @end table
  12245. The values of the @option{w} and @option{h} options are expressions
  12246. containing the following constants:
  12247. @table @var
  12248. @item in_w
  12249. @item in_h
  12250. The input width and height
  12251. @item iw
  12252. @item ih
  12253. These are the same as @var{in_w} and @var{in_h}.
  12254. @item out_w
  12255. @item out_h
  12256. The output (scaled) width and height
  12257. @item ow
  12258. @item oh
  12259. These are the same as @var{out_w} and @var{out_h}
  12260. @item a
  12261. The same as @var{iw} / @var{ih}
  12262. @item sar
  12263. input sample aspect ratio
  12264. @item dar
  12265. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12266. @item hsub
  12267. @item vsub
  12268. horizontal and vertical input chroma subsample values. For example for the
  12269. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12270. @item ohsub
  12271. @item ovsub
  12272. horizontal and vertical output chroma subsample values. For example for the
  12273. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12274. @end table
  12275. @table @option
  12276. @end table
  12277. @c man end VIDEO FILTERS
  12278. @chapter Video Sources
  12279. @c man begin VIDEO SOURCES
  12280. Below is a description of the currently available video sources.
  12281. @section buffer
  12282. Buffer video frames, and make them available to the filter chain.
  12283. This source is mainly intended for a programmatic use, in particular
  12284. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12285. It accepts the following parameters:
  12286. @table @option
  12287. @item video_size
  12288. Specify the size (width and height) of the buffered video frames. For the
  12289. syntax of this option, check the
  12290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12291. @item width
  12292. The input video width.
  12293. @item height
  12294. The input video height.
  12295. @item pix_fmt
  12296. A string representing the pixel format of the buffered video frames.
  12297. It may be a number corresponding to a pixel format, or a pixel format
  12298. name.
  12299. @item time_base
  12300. Specify the timebase assumed by the timestamps of the buffered frames.
  12301. @item frame_rate
  12302. Specify the frame rate expected for the video stream.
  12303. @item pixel_aspect, sar
  12304. The sample (pixel) aspect ratio of the input video.
  12305. @item sws_param
  12306. Specify the optional parameters to be used for the scale filter which
  12307. is automatically inserted when an input change is detected in the
  12308. input size or format.
  12309. @item hw_frames_ctx
  12310. When using a hardware pixel format, this should be a reference to an
  12311. AVHWFramesContext describing input frames.
  12312. @end table
  12313. For example:
  12314. @example
  12315. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12316. @end example
  12317. will instruct the source to accept video frames with size 320x240 and
  12318. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12319. square pixels (1:1 sample aspect ratio).
  12320. Since the pixel format with name "yuv410p" corresponds to the number 6
  12321. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12322. this example corresponds to:
  12323. @example
  12324. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12325. @end example
  12326. Alternatively, the options can be specified as a flat string, but this
  12327. syntax is deprecated:
  12328. @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}]
  12329. @section cellauto
  12330. Create a pattern generated by an elementary cellular automaton.
  12331. The initial state of the cellular automaton can be defined through the
  12332. @option{filename} and @option{pattern} options. If such options are
  12333. not specified an initial state is created randomly.
  12334. At each new frame a new row in the video is filled with the result of
  12335. the cellular automaton next generation. The behavior when the whole
  12336. frame is filled is defined by the @option{scroll} option.
  12337. This source accepts the following options:
  12338. @table @option
  12339. @item filename, f
  12340. Read the initial cellular automaton state, i.e. the starting row, from
  12341. the specified file.
  12342. In the file, each non-whitespace character is considered an alive
  12343. cell, a newline will terminate the row, and further characters in the
  12344. file will be ignored.
  12345. @item pattern, p
  12346. Read the initial cellular automaton state, i.e. the starting row, from
  12347. the specified string.
  12348. Each non-whitespace character in the string is considered an alive
  12349. cell, a newline will terminate the row, and further characters in the
  12350. string will be ignored.
  12351. @item rate, r
  12352. Set the video rate, that is the number of frames generated per second.
  12353. Default is 25.
  12354. @item random_fill_ratio, ratio
  12355. Set the random fill ratio for the initial cellular automaton row. It
  12356. is a floating point number value ranging from 0 to 1, defaults to
  12357. 1/PHI.
  12358. This option is ignored when a file or a pattern is specified.
  12359. @item random_seed, seed
  12360. Set the seed for filling randomly the initial row, must be an integer
  12361. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12362. set to -1, the filter will try to use a good random seed on a best
  12363. effort basis.
  12364. @item rule
  12365. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12366. Default value is 110.
  12367. @item size, s
  12368. Set the size of the output video. For the syntax of this option, check the
  12369. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12370. If @option{filename} or @option{pattern} is specified, the size is set
  12371. by default to the width of the specified initial state row, and the
  12372. height is set to @var{width} * PHI.
  12373. If @option{size} is set, it must contain the width of the specified
  12374. pattern string, and the specified pattern will be centered in the
  12375. larger row.
  12376. If a filename or a pattern string is not specified, the size value
  12377. defaults to "320x518" (used for a randomly generated initial state).
  12378. @item scroll
  12379. If set to 1, scroll the output upward when all the rows in the output
  12380. have been already filled. If set to 0, the new generated row will be
  12381. written over the top row just after the bottom row is filled.
  12382. Defaults to 1.
  12383. @item start_full, full
  12384. If set to 1, completely fill the output with generated rows before
  12385. outputting the first frame.
  12386. This is the default behavior, for disabling set the value to 0.
  12387. @item stitch
  12388. If set to 1, stitch the left and right row edges together.
  12389. This is the default behavior, for disabling set the value to 0.
  12390. @end table
  12391. @subsection Examples
  12392. @itemize
  12393. @item
  12394. Read the initial state from @file{pattern}, and specify an output of
  12395. size 200x400.
  12396. @example
  12397. cellauto=f=pattern:s=200x400
  12398. @end example
  12399. @item
  12400. Generate a random initial row with a width of 200 cells, with a fill
  12401. ratio of 2/3:
  12402. @example
  12403. cellauto=ratio=2/3:s=200x200
  12404. @end example
  12405. @item
  12406. Create a pattern generated by rule 18 starting by a single alive cell
  12407. centered on an initial row with width 100:
  12408. @example
  12409. cellauto=p=@@:s=100x400:full=0:rule=18
  12410. @end example
  12411. @item
  12412. Specify a more elaborated initial pattern:
  12413. @example
  12414. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12415. @end example
  12416. @end itemize
  12417. @anchor{coreimagesrc}
  12418. @section coreimagesrc
  12419. Video source generated on GPU using Apple's CoreImage API on OSX.
  12420. This video source is a specialized version of the @ref{coreimage} video filter.
  12421. Use a core image generator at the beginning of the applied filterchain to
  12422. generate the content.
  12423. The coreimagesrc video source accepts the following options:
  12424. @table @option
  12425. @item list_generators
  12426. List all available generators along with all their respective options as well as
  12427. possible minimum and maximum values along with the default values.
  12428. @example
  12429. list_generators=true
  12430. @end example
  12431. @item size, s
  12432. Specify the size of the sourced video. For the syntax of this option, check the
  12433. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12434. The default value is @code{320x240}.
  12435. @item rate, r
  12436. Specify the frame rate of the sourced video, as the number of frames
  12437. generated per second. It has to be a string in the format
  12438. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12439. number or a valid video frame rate abbreviation. The default value is
  12440. "25".
  12441. @item sar
  12442. Set the sample aspect ratio of the sourced video.
  12443. @item duration, d
  12444. Set the duration of the sourced video. See
  12445. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12446. for the accepted syntax.
  12447. If not specified, or the expressed duration is negative, the video is
  12448. supposed to be generated forever.
  12449. @end table
  12450. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12451. A complete filterchain can be used for further processing of the
  12452. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12453. and examples for details.
  12454. @subsection Examples
  12455. @itemize
  12456. @item
  12457. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12458. given as complete and escaped command-line for Apple's standard bash shell:
  12459. @example
  12460. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12461. @end example
  12462. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12463. need for a nullsrc video source.
  12464. @end itemize
  12465. @section mandelbrot
  12466. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12467. point specified with @var{start_x} and @var{start_y}.
  12468. This source accepts the following options:
  12469. @table @option
  12470. @item end_pts
  12471. Set the terminal pts value. Default value is 400.
  12472. @item end_scale
  12473. Set the terminal scale value.
  12474. Must be a floating point value. Default value is 0.3.
  12475. @item inner
  12476. Set the inner coloring mode, that is the algorithm used to draw the
  12477. Mandelbrot fractal internal region.
  12478. It shall assume one of the following values:
  12479. @table @option
  12480. @item black
  12481. Set black mode.
  12482. @item convergence
  12483. Show time until convergence.
  12484. @item mincol
  12485. Set color based on point closest to the origin of the iterations.
  12486. @item period
  12487. Set period mode.
  12488. @end table
  12489. Default value is @var{mincol}.
  12490. @item bailout
  12491. Set the bailout value. Default value is 10.0.
  12492. @item maxiter
  12493. Set the maximum of iterations performed by the rendering
  12494. algorithm. Default value is 7189.
  12495. @item outer
  12496. Set outer coloring mode.
  12497. It shall assume one of following values:
  12498. @table @option
  12499. @item iteration_count
  12500. Set iteration cound mode.
  12501. @item normalized_iteration_count
  12502. set normalized iteration count mode.
  12503. @end table
  12504. Default value is @var{normalized_iteration_count}.
  12505. @item rate, r
  12506. Set frame rate, expressed as number of frames per second. Default
  12507. value is "25".
  12508. @item size, s
  12509. Set frame size. For the syntax of this option, check the "Video
  12510. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12511. @item start_scale
  12512. Set the initial scale value. Default value is 3.0.
  12513. @item start_x
  12514. Set the initial x position. Must be a floating point value between
  12515. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12516. @item start_y
  12517. Set the initial y position. Must be a floating point value between
  12518. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12519. @end table
  12520. @section mptestsrc
  12521. Generate various test patterns, as generated by the MPlayer test filter.
  12522. The size of the generated video is fixed, and is 256x256.
  12523. This source is useful in particular for testing encoding features.
  12524. This source accepts the following options:
  12525. @table @option
  12526. @item rate, r
  12527. Specify the frame rate of the sourced video, as the number of frames
  12528. generated per second. It has to be a string in the format
  12529. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12530. number or a valid video frame rate abbreviation. The default value is
  12531. "25".
  12532. @item duration, d
  12533. Set the duration of the sourced video. See
  12534. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12535. for the accepted syntax.
  12536. If not specified, or the expressed duration is negative, the video is
  12537. supposed to be generated forever.
  12538. @item test, t
  12539. Set the number or the name of the test to perform. Supported tests are:
  12540. @table @option
  12541. @item dc_luma
  12542. @item dc_chroma
  12543. @item freq_luma
  12544. @item freq_chroma
  12545. @item amp_luma
  12546. @item amp_chroma
  12547. @item cbp
  12548. @item mv
  12549. @item ring1
  12550. @item ring2
  12551. @item all
  12552. @end table
  12553. Default value is "all", which will cycle through the list of all tests.
  12554. @end table
  12555. Some examples:
  12556. @example
  12557. mptestsrc=t=dc_luma
  12558. @end example
  12559. will generate a "dc_luma" test pattern.
  12560. @section frei0r_src
  12561. Provide a frei0r source.
  12562. To enable compilation of this filter you need to install the frei0r
  12563. header and configure FFmpeg with @code{--enable-frei0r}.
  12564. This source accepts the following parameters:
  12565. @table @option
  12566. @item size
  12567. The size of the video to generate. For the syntax of this option, check the
  12568. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12569. @item framerate
  12570. The framerate of the generated video. It may be a string of the form
  12571. @var{num}/@var{den} or a frame rate abbreviation.
  12572. @item filter_name
  12573. The name to the frei0r source to load. For more information regarding frei0r and
  12574. how to set the parameters, read the @ref{frei0r} section in the video filters
  12575. documentation.
  12576. @item filter_params
  12577. A '|'-separated list of parameters to pass to the frei0r source.
  12578. @end table
  12579. For example, to generate a frei0r partik0l source with size 200x200
  12580. and frame rate 10 which is overlaid on the overlay filter main input:
  12581. @example
  12582. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12583. @end example
  12584. @section life
  12585. Generate a life pattern.
  12586. This source is based on a generalization of John Conway's life game.
  12587. The sourced input represents a life grid, each pixel represents a cell
  12588. which can be in one of two possible states, alive or dead. Every cell
  12589. interacts with its eight neighbours, which are the cells that are
  12590. horizontally, vertically, or diagonally adjacent.
  12591. At each interaction the grid evolves according to the adopted rule,
  12592. which specifies the number of neighbor alive cells which will make a
  12593. cell stay alive or born. The @option{rule} option allows one to specify
  12594. the rule to adopt.
  12595. This source accepts the following options:
  12596. @table @option
  12597. @item filename, f
  12598. Set the file from which to read the initial grid state. In the file,
  12599. each non-whitespace character is considered an alive cell, and newline
  12600. is used to delimit the end of each row.
  12601. If this option is not specified, the initial grid is generated
  12602. randomly.
  12603. @item rate, r
  12604. Set the video rate, that is the number of frames generated per second.
  12605. Default is 25.
  12606. @item random_fill_ratio, ratio
  12607. Set the random fill ratio for the initial random grid. It is a
  12608. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12609. It is ignored when a file is specified.
  12610. @item random_seed, seed
  12611. Set the seed for filling the initial random grid, must be an integer
  12612. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12613. set to -1, the filter will try to use a good random seed on a best
  12614. effort basis.
  12615. @item rule
  12616. Set the life rule.
  12617. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12618. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12619. @var{NS} specifies the number of alive neighbor cells which make a
  12620. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12621. which make a dead cell to become alive (i.e. to "born").
  12622. "s" and "b" can be used in place of "S" and "B", respectively.
  12623. Alternatively a rule can be specified by an 18-bits integer. The 9
  12624. high order bits are used to encode the next cell state if it is alive
  12625. for each number of neighbor alive cells, the low order bits specify
  12626. the rule for "borning" new cells. Higher order bits encode for an
  12627. higher number of neighbor cells.
  12628. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12629. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12630. Default value is "S23/B3", which is the original Conway's game of life
  12631. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12632. cells, and will born a new cell if there are three alive cells around
  12633. a dead cell.
  12634. @item size, s
  12635. Set the size of the output video. For the syntax of this option, check the
  12636. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12637. If @option{filename} is specified, the size is set by default to the
  12638. same size of the input file. If @option{size} is set, it must contain
  12639. the size specified in the input file, and the initial grid defined in
  12640. that file is centered in the larger resulting area.
  12641. If a filename is not specified, the size value defaults to "320x240"
  12642. (used for a randomly generated initial grid).
  12643. @item stitch
  12644. If set to 1, stitch the left and right grid edges together, and the
  12645. top and bottom edges also. Defaults to 1.
  12646. @item mold
  12647. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12648. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12649. value from 0 to 255.
  12650. @item life_color
  12651. Set the color of living (or new born) cells.
  12652. @item death_color
  12653. Set the color of dead cells. If @option{mold} is set, this is the first color
  12654. used to represent a dead cell.
  12655. @item mold_color
  12656. Set mold color, for definitely dead and moldy cells.
  12657. For the syntax of these 3 color options, check the "Color" section in the
  12658. ffmpeg-utils manual.
  12659. @end table
  12660. @subsection Examples
  12661. @itemize
  12662. @item
  12663. Read a grid from @file{pattern}, and center it on a grid of size
  12664. 300x300 pixels:
  12665. @example
  12666. life=f=pattern:s=300x300
  12667. @end example
  12668. @item
  12669. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12670. @example
  12671. life=ratio=2/3:s=200x200
  12672. @end example
  12673. @item
  12674. Specify a custom rule for evolving a randomly generated grid:
  12675. @example
  12676. life=rule=S14/B34
  12677. @end example
  12678. @item
  12679. Full example with slow death effect (mold) using @command{ffplay}:
  12680. @example
  12681. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12682. @end example
  12683. @end itemize
  12684. @anchor{allrgb}
  12685. @anchor{allyuv}
  12686. @anchor{color}
  12687. @anchor{haldclutsrc}
  12688. @anchor{nullsrc}
  12689. @anchor{rgbtestsrc}
  12690. @anchor{smptebars}
  12691. @anchor{smptehdbars}
  12692. @anchor{testsrc}
  12693. @anchor{testsrc2}
  12694. @anchor{yuvtestsrc}
  12695. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12696. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12697. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12698. The @code{color} source provides an uniformly colored input.
  12699. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12700. @ref{haldclut} filter.
  12701. The @code{nullsrc} source returns unprocessed video frames. It is
  12702. mainly useful to be employed in analysis / debugging tools, or as the
  12703. source for filters which ignore the input data.
  12704. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12705. detecting RGB vs BGR issues. You should see a red, green and blue
  12706. stripe from top to bottom.
  12707. The @code{smptebars} source generates a color bars pattern, based on
  12708. the SMPTE Engineering Guideline EG 1-1990.
  12709. The @code{smptehdbars} source generates a color bars pattern, based on
  12710. the SMPTE RP 219-2002.
  12711. The @code{testsrc} source generates a test video pattern, showing a
  12712. color pattern, a scrolling gradient and a timestamp. This is mainly
  12713. intended for testing purposes.
  12714. The @code{testsrc2} source is similar to testsrc, but supports more
  12715. pixel formats instead of just @code{rgb24}. This allows using it as an
  12716. input for other tests without requiring a format conversion.
  12717. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12718. see a y, cb and cr stripe from top to bottom.
  12719. The sources accept the following parameters:
  12720. @table @option
  12721. @item alpha
  12722. Specify the alpha (opacity) of the background, only available in the
  12723. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12724. 255 (fully opaque, the default).
  12725. @item color, c
  12726. Specify the color of the source, only available in the @code{color}
  12727. source. For the syntax of this option, check the "Color" section in the
  12728. ffmpeg-utils manual.
  12729. @item level
  12730. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12731. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12732. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12733. coded on a @code{1/(N*N)} scale.
  12734. @item size, s
  12735. Specify the size of the sourced video. For the syntax of this option, check the
  12736. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12737. The default value is @code{320x240}.
  12738. This option is not available with the @code{haldclutsrc} filter.
  12739. @item rate, r
  12740. Specify the frame rate of the sourced video, as the number of frames
  12741. generated per second. It has to be a string in the format
  12742. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12743. number or a valid video frame rate abbreviation. The default value is
  12744. "25".
  12745. @item sar
  12746. Set the sample aspect ratio of the sourced video.
  12747. @item duration, d
  12748. Set the duration of the sourced video. See
  12749. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12750. for the accepted syntax.
  12751. If not specified, or the expressed duration is negative, the video is
  12752. supposed to be generated forever.
  12753. @item decimals, n
  12754. Set the number of decimals to show in the timestamp, only available in the
  12755. @code{testsrc} source.
  12756. The displayed timestamp value will correspond to the original
  12757. timestamp value multiplied by the power of 10 of the specified
  12758. value. Default value is 0.
  12759. @end table
  12760. For example the following:
  12761. @example
  12762. testsrc=duration=5.3:size=qcif:rate=10
  12763. @end example
  12764. will generate a video with a duration of 5.3 seconds, with size
  12765. 176x144 and a frame rate of 10 frames per second.
  12766. The following graph description will generate a red source
  12767. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12768. frames per second.
  12769. @example
  12770. color=c=red@@0.2:s=qcif:r=10
  12771. @end example
  12772. If the input content is to be ignored, @code{nullsrc} can be used. The
  12773. following command generates noise in the luminance plane by employing
  12774. the @code{geq} filter:
  12775. @example
  12776. nullsrc=s=256x256, geq=random(1)*255:128:128
  12777. @end example
  12778. @subsection Commands
  12779. The @code{color} source supports the following commands:
  12780. @table @option
  12781. @item c, color
  12782. Set the color of the created image. Accepts the same syntax of the
  12783. corresponding @option{color} option.
  12784. @end table
  12785. @c man end VIDEO SOURCES
  12786. @chapter Video Sinks
  12787. @c man begin VIDEO SINKS
  12788. Below is a description of the currently available video sinks.
  12789. @section buffersink
  12790. Buffer video frames, and make them available to the end of the filter
  12791. graph.
  12792. This sink is mainly intended for programmatic use, in particular
  12793. through the interface defined in @file{libavfilter/buffersink.h}
  12794. or the options system.
  12795. It accepts a pointer to an AVBufferSinkContext structure, which
  12796. defines the incoming buffers' formats, to be passed as the opaque
  12797. parameter to @code{avfilter_init_filter} for initialization.
  12798. @section nullsink
  12799. Null video sink: do absolutely nothing with the input video. It is
  12800. mainly useful as a template and for use in analysis / debugging
  12801. tools.
  12802. @c man end VIDEO SINKS
  12803. @chapter Multimedia Filters
  12804. @c man begin MULTIMEDIA FILTERS
  12805. Below is a description of the currently available multimedia filters.
  12806. @section abitscope
  12807. Convert input audio to a video output, displaying the audio bit scope.
  12808. The filter accepts the following options:
  12809. @table @option
  12810. @item rate, r
  12811. Set frame rate, expressed as number of frames per second. Default
  12812. value is "25".
  12813. @item size, s
  12814. Specify the video size for the output. For the syntax of this option, check the
  12815. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12816. Default value is @code{1024x256}.
  12817. @item colors
  12818. Specify list of colors separated by space or by '|' which will be used to
  12819. draw channels. Unrecognized or missing colors will be replaced
  12820. by white color.
  12821. @end table
  12822. @section ahistogram
  12823. Convert input audio to a video output, displaying the volume histogram.
  12824. The filter accepts the following options:
  12825. @table @option
  12826. @item dmode
  12827. Specify how histogram is calculated.
  12828. It accepts the following values:
  12829. @table @samp
  12830. @item single
  12831. Use single histogram for all channels.
  12832. @item separate
  12833. Use separate histogram for each channel.
  12834. @end table
  12835. Default is @code{single}.
  12836. @item rate, r
  12837. Set frame rate, expressed as number of frames per second. Default
  12838. value is "25".
  12839. @item size, s
  12840. Specify the video size for the output. For the syntax of this option, check the
  12841. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12842. Default value is @code{hd720}.
  12843. @item scale
  12844. Set display scale.
  12845. It accepts the following values:
  12846. @table @samp
  12847. @item log
  12848. logarithmic
  12849. @item sqrt
  12850. square root
  12851. @item cbrt
  12852. cubic root
  12853. @item lin
  12854. linear
  12855. @item rlog
  12856. reverse logarithmic
  12857. @end table
  12858. Default is @code{log}.
  12859. @item ascale
  12860. Set amplitude scale.
  12861. It accepts the following values:
  12862. @table @samp
  12863. @item log
  12864. logarithmic
  12865. @item lin
  12866. linear
  12867. @end table
  12868. Default is @code{log}.
  12869. @item acount
  12870. Set how much frames to accumulate in histogram.
  12871. Defauls is 1. Setting this to -1 accumulates all frames.
  12872. @item rheight
  12873. Set histogram ratio of window height.
  12874. @item slide
  12875. Set sonogram sliding.
  12876. It accepts the following values:
  12877. @table @samp
  12878. @item replace
  12879. replace old rows with new ones.
  12880. @item scroll
  12881. scroll from top to bottom.
  12882. @end table
  12883. Default is @code{replace}.
  12884. @end table
  12885. @section aphasemeter
  12886. Convert input audio to a video output, displaying the audio phase.
  12887. The filter accepts the following options:
  12888. @table @option
  12889. @item rate, r
  12890. Set the output frame rate. Default value is @code{25}.
  12891. @item size, s
  12892. Set the video size for the output. For the syntax of this option, check the
  12893. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12894. Default value is @code{800x400}.
  12895. @item rc
  12896. @item gc
  12897. @item bc
  12898. Specify the red, green, blue contrast. Default values are @code{2},
  12899. @code{7} and @code{1}.
  12900. Allowed range is @code{[0, 255]}.
  12901. @item mpc
  12902. Set color which will be used for drawing median phase. If color is
  12903. @code{none} which is default, no median phase value will be drawn.
  12904. @item video
  12905. Enable video output. Default is enabled.
  12906. @end table
  12907. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12908. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12909. The @code{-1} means left and right channels are completely out of phase and
  12910. @code{1} means channels are in phase.
  12911. @section avectorscope
  12912. Convert input audio to a video output, representing the audio vector
  12913. scope.
  12914. The filter is used to measure the difference between channels of stereo
  12915. audio stream. A monoaural signal, consisting of identical left and right
  12916. signal, results in straight vertical line. Any stereo separation is visible
  12917. as a deviation from this line, creating a Lissajous figure.
  12918. If the straight (or deviation from it) but horizontal line appears this
  12919. indicates that the left and right channels are out of phase.
  12920. The filter accepts the following options:
  12921. @table @option
  12922. @item mode, m
  12923. Set the vectorscope mode.
  12924. Available values are:
  12925. @table @samp
  12926. @item lissajous
  12927. Lissajous rotated by 45 degrees.
  12928. @item lissajous_xy
  12929. Same as above but not rotated.
  12930. @item polar
  12931. Shape resembling half of circle.
  12932. @end table
  12933. Default value is @samp{lissajous}.
  12934. @item size, s
  12935. Set the video size for the output. For the syntax of this option, check the
  12936. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12937. Default value is @code{400x400}.
  12938. @item rate, r
  12939. Set the output frame rate. Default value is @code{25}.
  12940. @item rc
  12941. @item gc
  12942. @item bc
  12943. @item ac
  12944. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12945. @code{160}, @code{80} and @code{255}.
  12946. Allowed range is @code{[0, 255]}.
  12947. @item rf
  12948. @item gf
  12949. @item bf
  12950. @item af
  12951. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12952. @code{10}, @code{5} and @code{5}.
  12953. Allowed range is @code{[0, 255]}.
  12954. @item zoom
  12955. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12956. @item draw
  12957. Set the vectorscope drawing mode.
  12958. Available values are:
  12959. @table @samp
  12960. @item dot
  12961. Draw dot for each sample.
  12962. @item line
  12963. Draw line between previous and current sample.
  12964. @end table
  12965. Default value is @samp{dot}.
  12966. @item scale
  12967. Specify amplitude scale of audio samples.
  12968. Available values are:
  12969. @table @samp
  12970. @item lin
  12971. Linear.
  12972. @item sqrt
  12973. Square root.
  12974. @item cbrt
  12975. Cubic root.
  12976. @item log
  12977. Logarithmic.
  12978. @end table
  12979. @end table
  12980. @subsection Examples
  12981. @itemize
  12982. @item
  12983. Complete example using @command{ffplay}:
  12984. @example
  12985. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12986. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12987. @end example
  12988. @end itemize
  12989. @section bench, abench
  12990. Benchmark part of a filtergraph.
  12991. The filter accepts the following options:
  12992. @table @option
  12993. @item action
  12994. Start or stop a timer.
  12995. Available values are:
  12996. @table @samp
  12997. @item start
  12998. Get the current time, set it as frame metadata (using the key
  12999. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13000. @item stop
  13001. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13002. the input frame metadata to get the time difference. Time difference, average,
  13003. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13004. @code{min}) are then printed. The timestamps are expressed in seconds.
  13005. @end table
  13006. @end table
  13007. @subsection Examples
  13008. @itemize
  13009. @item
  13010. Benchmark @ref{selectivecolor} filter:
  13011. @example
  13012. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13013. @end example
  13014. @end itemize
  13015. @section concat
  13016. Concatenate audio and video streams, joining them together one after the
  13017. other.
  13018. The filter works on segments of synchronized video and audio streams. All
  13019. segments must have the same number of streams of each type, and that will
  13020. also be the number of streams at output.
  13021. The filter accepts the following options:
  13022. @table @option
  13023. @item n
  13024. Set the number of segments. Default is 2.
  13025. @item v
  13026. Set the number of output video streams, that is also the number of video
  13027. streams in each segment. Default is 1.
  13028. @item a
  13029. Set the number of output audio streams, that is also the number of audio
  13030. streams in each segment. Default is 0.
  13031. @item unsafe
  13032. Activate unsafe mode: do not fail if segments have a different format.
  13033. @end table
  13034. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13035. @var{a} audio outputs.
  13036. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13037. segment, in the same order as the outputs, then the inputs for the second
  13038. segment, etc.
  13039. Related streams do not always have exactly the same duration, for various
  13040. reasons including codec frame size or sloppy authoring. For that reason,
  13041. related synchronized streams (e.g. a video and its audio track) should be
  13042. concatenated at once. The concat filter will use the duration of the longest
  13043. stream in each segment (except the last one), and if necessary pad shorter
  13044. audio streams with silence.
  13045. For this filter to work correctly, all segments must start at timestamp 0.
  13046. All corresponding streams must have the same parameters in all segments; the
  13047. filtering system will automatically select a common pixel format for video
  13048. streams, and a common sample format, sample rate and channel layout for
  13049. audio streams, but other settings, such as resolution, must be converted
  13050. explicitly by the user.
  13051. Different frame rates are acceptable but will result in variable frame rate
  13052. at output; be sure to configure the output file to handle it.
  13053. @subsection Examples
  13054. @itemize
  13055. @item
  13056. Concatenate an opening, an episode and an ending, all in bilingual version
  13057. (video in stream 0, audio in streams 1 and 2):
  13058. @example
  13059. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13060. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13061. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13062. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13063. @end example
  13064. @item
  13065. Concatenate two parts, handling audio and video separately, using the
  13066. (a)movie sources, and adjusting the resolution:
  13067. @example
  13068. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13069. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13070. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13071. @end example
  13072. Note that a desync will happen at the stitch if the audio and video streams
  13073. do not have exactly the same duration in the first file.
  13074. @end itemize
  13075. @section drawgraph, adrawgraph
  13076. Draw a graph using input video or audio metadata.
  13077. It accepts the following parameters:
  13078. @table @option
  13079. @item m1
  13080. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13081. @item fg1
  13082. Set 1st foreground color expression.
  13083. @item m2
  13084. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13085. @item fg2
  13086. Set 2nd foreground color expression.
  13087. @item m3
  13088. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13089. @item fg3
  13090. Set 3rd foreground color expression.
  13091. @item m4
  13092. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13093. @item fg4
  13094. Set 4th foreground color expression.
  13095. @item min
  13096. Set minimal value of metadata value.
  13097. @item max
  13098. Set maximal value of metadata value.
  13099. @item bg
  13100. Set graph background color. Default is white.
  13101. @item mode
  13102. Set graph mode.
  13103. Available values for mode is:
  13104. @table @samp
  13105. @item bar
  13106. @item dot
  13107. @item line
  13108. @end table
  13109. Default is @code{line}.
  13110. @item slide
  13111. Set slide mode.
  13112. Available values for slide is:
  13113. @table @samp
  13114. @item frame
  13115. Draw new frame when right border is reached.
  13116. @item replace
  13117. Replace old columns with new ones.
  13118. @item scroll
  13119. Scroll from right to left.
  13120. @item rscroll
  13121. Scroll from left to right.
  13122. @item picture
  13123. Draw single picture.
  13124. @end table
  13125. Default is @code{frame}.
  13126. @item size
  13127. Set size of graph video. For the syntax of this option, check the
  13128. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13129. The default value is @code{900x256}.
  13130. The foreground color expressions can use the following variables:
  13131. @table @option
  13132. @item MIN
  13133. Minimal value of metadata value.
  13134. @item MAX
  13135. Maximal value of metadata value.
  13136. @item VAL
  13137. Current metadata key value.
  13138. @end table
  13139. The color is defined as 0xAABBGGRR.
  13140. @end table
  13141. Example using metadata from @ref{signalstats} filter:
  13142. @example
  13143. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13144. @end example
  13145. Example using metadata from @ref{ebur128} filter:
  13146. @example
  13147. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13148. @end example
  13149. @anchor{ebur128}
  13150. @section ebur128
  13151. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13152. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13153. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13154. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13155. The filter also has a video output (see the @var{video} option) with a real
  13156. time graph to observe the loudness evolution. The graphic contains the logged
  13157. message mentioned above, so it is not printed anymore when this option is set,
  13158. unless the verbose logging is set. The main graphing area contains the
  13159. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13160. the momentary loudness (400 milliseconds).
  13161. More information about the Loudness Recommendation EBU R128 on
  13162. @url{http://tech.ebu.ch/loudness}.
  13163. The filter accepts the following options:
  13164. @table @option
  13165. @item video
  13166. Activate the video output. The audio stream is passed unchanged whether this
  13167. option is set or no. The video stream will be the first output stream if
  13168. activated. Default is @code{0}.
  13169. @item size
  13170. Set the video size. This option is for video only. For the syntax of this
  13171. option, check the
  13172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13173. Default and minimum resolution is @code{640x480}.
  13174. @item meter
  13175. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13176. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13177. other integer value between this range is allowed.
  13178. @item metadata
  13179. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13180. into 100ms output frames, each of them containing various loudness information
  13181. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13182. Default is @code{0}.
  13183. @item framelog
  13184. Force the frame logging level.
  13185. Available values are:
  13186. @table @samp
  13187. @item info
  13188. information logging level
  13189. @item verbose
  13190. verbose logging level
  13191. @end table
  13192. By default, the logging level is set to @var{info}. If the @option{video} or
  13193. the @option{metadata} options are set, it switches to @var{verbose}.
  13194. @item peak
  13195. Set peak mode(s).
  13196. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13197. values are:
  13198. @table @samp
  13199. @item none
  13200. Disable any peak mode (default).
  13201. @item sample
  13202. Enable sample-peak mode.
  13203. Simple peak mode looking for the higher sample value. It logs a message
  13204. for sample-peak (identified by @code{SPK}).
  13205. @item true
  13206. Enable true-peak mode.
  13207. If enabled, the peak lookup is done on an over-sampled version of the input
  13208. stream for better peak accuracy. It logs a message for true-peak.
  13209. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13210. This mode requires a build with @code{libswresample}.
  13211. @end table
  13212. @item dualmono
  13213. Treat mono input files as "dual mono". If a mono file is intended for playback
  13214. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13215. If set to @code{true}, this option will compensate for this effect.
  13216. Multi-channel input files are not affected by this option.
  13217. @item panlaw
  13218. Set a specific pan law to be used for the measurement of dual mono files.
  13219. This parameter is optional, and has a default value of -3.01dB.
  13220. @end table
  13221. @subsection Examples
  13222. @itemize
  13223. @item
  13224. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13225. @example
  13226. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13227. @end example
  13228. @item
  13229. Run an analysis with @command{ffmpeg}:
  13230. @example
  13231. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13232. @end example
  13233. @end itemize
  13234. @section interleave, ainterleave
  13235. Temporally interleave frames from several inputs.
  13236. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13237. These filters read frames from several inputs and send the oldest
  13238. queued frame to the output.
  13239. Input streams must have well defined, monotonically increasing frame
  13240. timestamp values.
  13241. In order to submit one frame to output, these filters need to enqueue
  13242. at least one frame for each input, so they cannot work in case one
  13243. input is not yet terminated and will not receive incoming frames.
  13244. For example consider the case when one input is a @code{select} filter
  13245. which always drops input frames. The @code{interleave} filter will keep
  13246. reading from that input, but it will never be able to send new frames
  13247. to output until the input sends an end-of-stream signal.
  13248. Also, depending on inputs synchronization, the filters will drop
  13249. frames in case one input receives more frames than the other ones, and
  13250. the queue is already filled.
  13251. These filters accept the following options:
  13252. @table @option
  13253. @item nb_inputs, n
  13254. Set the number of different inputs, it is 2 by default.
  13255. @end table
  13256. @subsection Examples
  13257. @itemize
  13258. @item
  13259. Interleave frames belonging to different streams using @command{ffmpeg}:
  13260. @example
  13261. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13262. @end example
  13263. @item
  13264. Add flickering blur effect:
  13265. @example
  13266. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13267. @end example
  13268. @end itemize
  13269. @section metadata, ametadata
  13270. Manipulate frame metadata.
  13271. This filter accepts the following options:
  13272. @table @option
  13273. @item mode
  13274. Set mode of operation of the filter.
  13275. Can be one of the following:
  13276. @table @samp
  13277. @item select
  13278. If both @code{value} and @code{key} is set, select frames
  13279. which have such metadata. If only @code{key} is set, select
  13280. every frame that has such key in metadata.
  13281. @item add
  13282. Add new metadata @code{key} and @code{value}. If key is already available
  13283. do nothing.
  13284. @item modify
  13285. Modify value of already present key.
  13286. @item delete
  13287. If @code{value} is set, delete only keys that have such value.
  13288. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13289. the frame.
  13290. @item print
  13291. Print key and its value if metadata was found. If @code{key} is not set print all
  13292. metadata values available in frame.
  13293. @end table
  13294. @item key
  13295. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13296. @item value
  13297. Set metadata value which will be used. This option is mandatory for
  13298. @code{modify} and @code{add} mode.
  13299. @item function
  13300. Which function to use when comparing metadata value and @code{value}.
  13301. Can be one of following:
  13302. @table @samp
  13303. @item same_str
  13304. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13305. @item starts_with
  13306. Values are interpreted as strings, returns true if metadata value starts with
  13307. the @code{value} option string.
  13308. @item less
  13309. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13310. @item equal
  13311. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13312. @item greater
  13313. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13314. @item expr
  13315. Values are interpreted as floats, returns true if expression from option @code{expr}
  13316. evaluates to true.
  13317. @end table
  13318. @item expr
  13319. Set expression which is used when @code{function} is set to @code{expr}.
  13320. The expression is evaluated through the eval API and can contain the following
  13321. constants:
  13322. @table @option
  13323. @item VALUE1
  13324. Float representation of @code{value} from metadata key.
  13325. @item VALUE2
  13326. Float representation of @code{value} as supplied by user in @code{value} option.
  13327. @end table
  13328. @item file
  13329. If specified in @code{print} mode, output is written to the named file. Instead of
  13330. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13331. for standard output. If @code{file} option is not set, output is written to the log
  13332. with AV_LOG_INFO loglevel.
  13333. @end table
  13334. @subsection Examples
  13335. @itemize
  13336. @item
  13337. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13338. between 0 and 1.
  13339. @example
  13340. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13341. @end example
  13342. @item
  13343. Print silencedetect output to file @file{metadata.txt}.
  13344. @example
  13345. silencedetect,ametadata=mode=print:file=metadata.txt
  13346. @end example
  13347. @item
  13348. Direct all metadata to a pipe with file descriptor 4.
  13349. @example
  13350. metadata=mode=print:file='pipe\:4'
  13351. @end example
  13352. @end itemize
  13353. @section perms, aperms
  13354. Set read/write permissions for the output frames.
  13355. These filters are mainly aimed at developers to test direct path in the
  13356. following filter in the filtergraph.
  13357. The filters accept the following options:
  13358. @table @option
  13359. @item mode
  13360. Select the permissions mode.
  13361. It accepts the following values:
  13362. @table @samp
  13363. @item none
  13364. Do nothing. This is the default.
  13365. @item ro
  13366. Set all the output frames read-only.
  13367. @item rw
  13368. Set all the output frames directly writable.
  13369. @item toggle
  13370. Make the frame read-only if writable, and writable if read-only.
  13371. @item random
  13372. Set each output frame read-only or writable randomly.
  13373. @end table
  13374. @item seed
  13375. Set the seed for the @var{random} mode, must be an integer included between
  13376. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13377. @code{-1}, the filter will try to use a good random seed on a best effort
  13378. basis.
  13379. @end table
  13380. Note: in case of auto-inserted filter between the permission filter and the
  13381. following one, the permission might not be received as expected in that
  13382. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13383. perms/aperms filter can avoid this problem.
  13384. @section realtime, arealtime
  13385. Slow down filtering to match real time approximatively.
  13386. These filters will pause the filtering for a variable amount of time to
  13387. match the output rate with the input timestamps.
  13388. They are similar to the @option{re} option to @code{ffmpeg}.
  13389. They accept the following options:
  13390. @table @option
  13391. @item limit
  13392. Time limit for the pauses. Any pause longer than that will be considered
  13393. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13394. @end table
  13395. @anchor{select}
  13396. @section select, aselect
  13397. Select frames to pass in output.
  13398. This filter accepts the following options:
  13399. @table @option
  13400. @item expr, e
  13401. Set expression, which is evaluated for each input frame.
  13402. If the expression is evaluated to zero, the frame is discarded.
  13403. If the evaluation result is negative or NaN, the frame is sent to the
  13404. first output; otherwise it is sent to the output with index
  13405. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13406. For example a value of @code{1.2} corresponds to the output with index
  13407. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13408. @item outputs, n
  13409. Set the number of outputs. The output to which to send the selected
  13410. frame is based on the result of the evaluation. Default value is 1.
  13411. @end table
  13412. The expression can contain the following constants:
  13413. @table @option
  13414. @item n
  13415. The (sequential) number of the filtered frame, starting from 0.
  13416. @item selected_n
  13417. The (sequential) number of the selected frame, starting from 0.
  13418. @item prev_selected_n
  13419. The sequential number of the last selected frame. It's NAN if undefined.
  13420. @item TB
  13421. The timebase of the input timestamps.
  13422. @item pts
  13423. The PTS (Presentation TimeStamp) of the filtered video frame,
  13424. expressed in @var{TB} units. It's NAN if undefined.
  13425. @item t
  13426. The PTS of the filtered video frame,
  13427. expressed in seconds. It's NAN if undefined.
  13428. @item prev_pts
  13429. The PTS of the previously filtered video frame. It's NAN if undefined.
  13430. @item prev_selected_pts
  13431. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13432. @item prev_selected_t
  13433. The PTS of the last previously selected video frame. It's NAN if undefined.
  13434. @item start_pts
  13435. The PTS of the first video frame in the video. It's NAN if undefined.
  13436. @item start_t
  13437. The time of the first video frame in the video. It's NAN if undefined.
  13438. @item pict_type @emph{(video only)}
  13439. The type of the filtered frame. It can assume one of the following
  13440. values:
  13441. @table @option
  13442. @item I
  13443. @item P
  13444. @item B
  13445. @item S
  13446. @item SI
  13447. @item SP
  13448. @item BI
  13449. @end table
  13450. @item interlace_type @emph{(video only)}
  13451. The frame interlace type. It can assume one of the following values:
  13452. @table @option
  13453. @item PROGRESSIVE
  13454. The frame is progressive (not interlaced).
  13455. @item TOPFIRST
  13456. The frame is top-field-first.
  13457. @item BOTTOMFIRST
  13458. The frame is bottom-field-first.
  13459. @end table
  13460. @item consumed_sample_n @emph{(audio only)}
  13461. the number of selected samples before the current frame
  13462. @item samples_n @emph{(audio only)}
  13463. the number of samples in the current frame
  13464. @item sample_rate @emph{(audio only)}
  13465. the input sample rate
  13466. @item key
  13467. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13468. @item pos
  13469. the position in the file of the filtered frame, -1 if the information
  13470. is not available (e.g. for synthetic video)
  13471. @item scene @emph{(video only)}
  13472. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13473. probability for the current frame to introduce a new scene, while a higher
  13474. value means the current frame is more likely to be one (see the example below)
  13475. @item concatdec_select
  13476. The concat demuxer can select only part of a concat input file by setting an
  13477. inpoint and an outpoint, but the output packets may not be entirely contained
  13478. in the selected interval. By using this variable, it is possible to skip frames
  13479. generated by the concat demuxer which are not exactly contained in the selected
  13480. interval.
  13481. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13482. and the @var{lavf.concat.duration} packet metadata values which are also
  13483. present in the decoded frames.
  13484. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13485. start_time and either the duration metadata is missing or the frame pts is less
  13486. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13487. missing.
  13488. That basically means that an input frame is selected if its pts is within the
  13489. interval set by the concat demuxer.
  13490. @end table
  13491. The default value of the select expression is "1".
  13492. @subsection Examples
  13493. @itemize
  13494. @item
  13495. Select all frames in input:
  13496. @example
  13497. select
  13498. @end example
  13499. The example above is the same as:
  13500. @example
  13501. select=1
  13502. @end example
  13503. @item
  13504. Skip all frames:
  13505. @example
  13506. select=0
  13507. @end example
  13508. @item
  13509. Select only I-frames:
  13510. @example
  13511. select='eq(pict_type\,I)'
  13512. @end example
  13513. @item
  13514. Select one frame every 100:
  13515. @example
  13516. select='not(mod(n\,100))'
  13517. @end example
  13518. @item
  13519. Select only frames contained in the 10-20 time interval:
  13520. @example
  13521. select=between(t\,10\,20)
  13522. @end example
  13523. @item
  13524. Select only I-frames contained in the 10-20 time interval:
  13525. @example
  13526. select=between(t\,10\,20)*eq(pict_type\,I)
  13527. @end example
  13528. @item
  13529. Select frames with a minimum distance of 10 seconds:
  13530. @example
  13531. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13532. @end example
  13533. @item
  13534. Use aselect to select only audio frames with samples number > 100:
  13535. @example
  13536. aselect='gt(samples_n\,100)'
  13537. @end example
  13538. @item
  13539. Create a mosaic of the first scenes:
  13540. @example
  13541. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13542. @end example
  13543. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13544. choice.
  13545. @item
  13546. Send even and odd frames to separate outputs, and compose them:
  13547. @example
  13548. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13549. @end example
  13550. @item
  13551. Select useful frames from an ffconcat file which is using inpoints and
  13552. outpoints but where the source files are not intra frame only.
  13553. @example
  13554. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13555. @end example
  13556. @end itemize
  13557. @section sendcmd, asendcmd
  13558. Send commands to filters in the filtergraph.
  13559. These filters read commands to be sent to other filters in the
  13560. filtergraph.
  13561. @code{sendcmd} must be inserted between two video filters,
  13562. @code{asendcmd} must be inserted between two audio filters, but apart
  13563. from that they act the same way.
  13564. The specification of commands can be provided in the filter arguments
  13565. with the @var{commands} option, or in a file specified by the
  13566. @var{filename} option.
  13567. These filters accept the following options:
  13568. @table @option
  13569. @item commands, c
  13570. Set the commands to be read and sent to the other filters.
  13571. @item filename, f
  13572. Set the filename of the commands to be read and sent to the other
  13573. filters.
  13574. @end table
  13575. @subsection Commands syntax
  13576. A commands description consists of a sequence of interval
  13577. specifications, comprising a list of commands to be executed when a
  13578. particular event related to that interval occurs. The occurring event
  13579. is typically the current frame time entering or leaving a given time
  13580. interval.
  13581. An interval is specified by the following syntax:
  13582. @example
  13583. @var{START}[-@var{END}] @var{COMMANDS};
  13584. @end example
  13585. The time interval is specified by the @var{START} and @var{END} times.
  13586. @var{END} is optional and defaults to the maximum time.
  13587. The current frame time is considered within the specified interval if
  13588. it is included in the interval [@var{START}, @var{END}), that is when
  13589. the time is greater or equal to @var{START} and is lesser than
  13590. @var{END}.
  13591. @var{COMMANDS} consists of a sequence of one or more command
  13592. specifications, separated by ",", relating to that interval. The
  13593. syntax of a command specification is given by:
  13594. @example
  13595. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13596. @end example
  13597. @var{FLAGS} is optional and specifies the type of events relating to
  13598. the time interval which enable sending the specified command, and must
  13599. be a non-null sequence of identifier flags separated by "+" or "|" and
  13600. enclosed between "[" and "]".
  13601. The following flags are recognized:
  13602. @table @option
  13603. @item enter
  13604. The command is sent when the current frame timestamp enters the
  13605. specified interval. In other words, the command is sent when the
  13606. previous frame timestamp was not in the given interval, and the
  13607. current is.
  13608. @item leave
  13609. The command is sent when the current frame timestamp leaves the
  13610. specified interval. In other words, the command is sent when the
  13611. previous frame timestamp was in the given interval, and the
  13612. current is not.
  13613. @end table
  13614. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13615. assumed.
  13616. @var{TARGET} specifies the target of the command, usually the name of
  13617. the filter class or a specific filter instance name.
  13618. @var{COMMAND} specifies the name of the command for the target filter.
  13619. @var{ARG} is optional and specifies the optional list of argument for
  13620. the given @var{COMMAND}.
  13621. Between one interval specification and another, whitespaces, or
  13622. sequences of characters starting with @code{#} until the end of line,
  13623. are ignored and can be used to annotate comments.
  13624. A simplified BNF description of the commands specification syntax
  13625. follows:
  13626. @example
  13627. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13628. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13629. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13630. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13631. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13632. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13633. @end example
  13634. @subsection Examples
  13635. @itemize
  13636. @item
  13637. Specify audio tempo change at second 4:
  13638. @example
  13639. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13640. @end example
  13641. @item
  13642. Target a specific filter instance:
  13643. @example
  13644. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13645. @end example
  13646. @item
  13647. Specify a list of drawtext and hue commands in a file.
  13648. @example
  13649. # show text in the interval 5-10
  13650. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13651. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13652. # desaturate the image in the interval 15-20
  13653. 15.0-20.0 [enter] hue s 0,
  13654. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13655. [leave] hue s 1,
  13656. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13657. # apply an exponential saturation fade-out effect, starting from time 25
  13658. 25 [enter] hue s exp(25-t)
  13659. @end example
  13660. A filtergraph allowing to read and process the above command list
  13661. stored in a file @file{test.cmd}, can be specified with:
  13662. @example
  13663. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13664. @end example
  13665. @end itemize
  13666. @anchor{setpts}
  13667. @section setpts, asetpts
  13668. Change the PTS (presentation timestamp) of the input frames.
  13669. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13670. This filter accepts the following options:
  13671. @table @option
  13672. @item expr
  13673. The expression which is evaluated for each frame to construct its timestamp.
  13674. @end table
  13675. The expression is evaluated through the eval API and can contain the following
  13676. constants:
  13677. @table @option
  13678. @item FRAME_RATE
  13679. frame rate, only defined for constant frame-rate video
  13680. @item PTS
  13681. The presentation timestamp in input
  13682. @item N
  13683. The count of the input frame for video or the number of consumed samples,
  13684. not including the current frame for audio, starting from 0.
  13685. @item NB_CONSUMED_SAMPLES
  13686. The number of consumed samples, not including the current frame (only
  13687. audio)
  13688. @item NB_SAMPLES, S
  13689. The number of samples in the current frame (only audio)
  13690. @item SAMPLE_RATE, SR
  13691. The audio sample rate.
  13692. @item STARTPTS
  13693. The PTS of the first frame.
  13694. @item STARTT
  13695. the time in seconds of the first frame
  13696. @item INTERLACED
  13697. State whether the current frame is interlaced.
  13698. @item T
  13699. the time in seconds of the current frame
  13700. @item POS
  13701. original position in the file of the frame, or undefined if undefined
  13702. for the current frame
  13703. @item PREV_INPTS
  13704. The previous input PTS.
  13705. @item PREV_INT
  13706. previous input time in seconds
  13707. @item PREV_OUTPTS
  13708. The previous output PTS.
  13709. @item PREV_OUTT
  13710. previous output time in seconds
  13711. @item RTCTIME
  13712. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13713. instead.
  13714. @item RTCSTART
  13715. The wallclock (RTC) time at the start of the movie in microseconds.
  13716. @item TB
  13717. The timebase of the input timestamps.
  13718. @end table
  13719. @subsection Examples
  13720. @itemize
  13721. @item
  13722. Start counting PTS from zero
  13723. @example
  13724. setpts=PTS-STARTPTS
  13725. @end example
  13726. @item
  13727. Apply fast motion effect:
  13728. @example
  13729. setpts=0.5*PTS
  13730. @end example
  13731. @item
  13732. Apply slow motion effect:
  13733. @example
  13734. setpts=2.0*PTS
  13735. @end example
  13736. @item
  13737. Set fixed rate of 25 frames per second:
  13738. @example
  13739. setpts=N/(25*TB)
  13740. @end example
  13741. @item
  13742. Set fixed rate 25 fps with some jitter:
  13743. @example
  13744. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13745. @end example
  13746. @item
  13747. Apply an offset of 10 seconds to the input PTS:
  13748. @example
  13749. setpts=PTS+10/TB
  13750. @end example
  13751. @item
  13752. Generate timestamps from a "live source" and rebase onto the current timebase:
  13753. @example
  13754. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13755. @end example
  13756. @item
  13757. Generate timestamps by counting samples:
  13758. @example
  13759. asetpts=N/SR/TB
  13760. @end example
  13761. @end itemize
  13762. @section settb, asettb
  13763. Set the timebase to use for the output frames timestamps.
  13764. It is mainly useful for testing timebase configuration.
  13765. It accepts the following parameters:
  13766. @table @option
  13767. @item expr, tb
  13768. The expression which is evaluated into the output timebase.
  13769. @end table
  13770. The value for @option{tb} is an arithmetic expression representing a
  13771. rational. The expression can contain the constants "AVTB" (the default
  13772. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13773. audio only). Default value is "intb".
  13774. @subsection Examples
  13775. @itemize
  13776. @item
  13777. Set the timebase to 1/25:
  13778. @example
  13779. settb=expr=1/25
  13780. @end example
  13781. @item
  13782. Set the timebase to 1/10:
  13783. @example
  13784. settb=expr=0.1
  13785. @end example
  13786. @item
  13787. Set the timebase to 1001/1000:
  13788. @example
  13789. settb=1+0.001
  13790. @end example
  13791. @item
  13792. Set the timebase to 2*intb:
  13793. @example
  13794. settb=2*intb
  13795. @end example
  13796. @item
  13797. Set the default timebase value:
  13798. @example
  13799. settb=AVTB
  13800. @end example
  13801. @end itemize
  13802. @section showcqt
  13803. Convert input audio to a video output representing frequency spectrum
  13804. logarithmically using Brown-Puckette constant Q transform algorithm with
  13805. direct frequency domain coefficient calculation (but the transform itself
  13806. is not really constant Q, instead the Q factor is actually variable/clamped),
  13807. with musical tone scale, from E0 to D#10.
  13808. The filter accepts the following options:
  13809. @table @option
  13810. @item size, s
  13811. Specify the video size for the output. It must be even. For the syntax of this option,
  13812. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13813. Default value is @code{1920x1080}.
  13814. @item fps, rate, r
  13815. Set the output frame rate. Default value is @code{25}.
  13816. @item bar_h
  13817. Set the bargraph height. It must be even. Default value is @code{-1} which
  13818. computes the bargraph height automatically.
  13819. @item axis_h
  13820. Set the axis height. It must be even. Default value is @code{-1} which computes
  13821. the axis height automatically.
  13822. @item sono_h
  13823. Set the sonogram height. It must be even. Default value is @code{-1} which
  13824. computes the sonogram height automatically.
  13825. @item fullhd
  13826. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13827. instead. Default value is @code{1}.
  13828. @item sono_v, volume
  13829. Specify the sonogram volume expression. It can contain variables:
  13830. @table @option
  13831. @item bar_v
  13832. the @var{bar_v} evaluated expression
  13833. @item frequency, freq, f
  13834. the frequency where it is evaluated
  13835. @item timeclamp, tc
  13836. the value of @var{timeclamp} option
  13837. @end table
  13838. and functions:
  13839. @table @option
  13840. @item a_weighting(f)
  13841. A-weighting of equal loudness
  13842. @item b_weighting(f)
  13843. B-weighting of equal loudness
  13844. @item c_weighting(f)
  13845. C-weighting of equal loudness.
  13846. @end table
  13847. Default value is @code{16}.
  13848. @item bar_v, volume2
  13849. Specify the bargraph volume expression. It can contain variables:
  13850. @table @option
  13851. @item sono_v
  13852. the @var{sono_v} evaluated expression
  13853. @item frequency, freq, f
  13854. the frequency where it is evaluated
  13855. @item timeclamp, tc
  13856. the value of @var{timeclamp} option
  13857. @end table
  13858. and functions:
  13859. @table @option
  13860. @item a_weighting(f)
  13861. A-weighting of equal loudness
  13862. @item b_weighting(f)
  13863. B-weighting of equal loudness
  13864. @item c_weighting(f)
  13865. C-weighting of equal loudness.
  13866. @end table
  13867. Default value is @code{sono_v}.
  13868. @item sono_g, gamma
  13869. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13870. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13871. Acceptable range is @code{[1, 7]}.
  13872. @item bar_g, gamma2
  13873. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13874. @code{[1, 7]}.
  13875. @item bar_t
  13876. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13877. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13878. @item timeclamp, tc
  13879. Specify the transform timeclamp. At low frequency, there is trade-off between
  13880. accuracy in time domain and frequency domain. If timeclamp is lower,
  13881. event in time domain is represented more accurately (such as fast bass drum),
  13882. otherwise event in frequency domain is represented more accurately
  13883. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13884. @item attack
  13885. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13886. limits future samples by applying asymmetric windowing in time domain, useful
  13887. when low latency is required. Accepted range is @code{[0, 1]}.
  13888. @item basefreq
  13889. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13890. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13891. @item endfreq
  13892. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13893. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13894. @item coeffclamp
  13895. This option is deprecated and ignored.
  13896. @item tlength
  13897. Specify the transform length in time domain. Use this option to control accuracy
  13898. trade-off between time domain and frequency domain at every frequency sample.
  13899. It can contain variables:
  13900. @table @option
  13901. @item frequency, freq, f
  13902. the frequency where it is evaluated
  13903. @item timeclamp, tc
  13904. the value of @var{timeclamp} option.
  13905. @end table
  13906. Default value is @code{384*tc/(384+tc*f)}.
  13907. @item count
  13908. Specify the transform count for every video frame. Default value is @code{6}.
  13909. Acceptable range is @code{[1, 30]}.
  13910. @item fcount
  13911. Specify the transform count for every single pixel. Default value is @code{0},
  13912. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13913. @item fontfile
  13914. Specify font file for use with freetype to draw the axis. If not specified,
  13915. use embedded font. Note that drawing with font file or embedded font is not
  13916. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13917. option instead.
  13918. @item font
  13919. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13920. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13921. @item fontcolor
  13922. Specify font color expression. This is arithmetic expression that should return
  13923. integer value 0xRRGGBB. It can contain variables:
  13924. @table @option
  13925. @item frequency, freq, f
  13926. the frequency where it is evaluated
  13927. @item timeclamp, tc
  13928. the value of @var{timeclamp} option
  13929. @end table
  13930. and functions:
  13931. @table @option
  13932. @item midi(f)
  13933. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13934. @item r(x), g(x), b(x)
  13935. red, green, and blue value of intensity x.
  13936. @end table
  13937. Default value is @code{st(0, (midi(f)-59.5)/12);
  13938. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13939. r(1-ld(1)) + b(ld(1))}.
  13940. @item axisfile
  13941. Specify image file to draw the axis. This option override @var{fontfile} and
  13942. @var{fontcolor} option.
  13943. @item axis, text
  13944. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13945. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13946. Default value is @code{1}.
  13947. @item csp
  13948. Set colorspace. The accepted values are:
  13949. @table @samp
  13950. @item unspecified
  13951. Unspecified (default)
  13952. @item bt709
  13953. BT.709
  13954. @item fcc
  13955. FCC
  13956. @item bt470bg
  13957. BT.470BG or BT.601-6 625
  13958. @item smpte170m
  13959. SMPTE-170M or BT.601-6 525
  13960. @item smpte240m
  13961. SMPTE-240M
  13962. @item bt2020ncl
  13963. BT.2020 with non-constant luminance
  13964. @end table
  13965. @item cscheme
  13966. Set spectrogram color scheme. This is list of floating point values with format
  13967. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13968. The default is @code{1|0.5|0|0|0.5|1}.
  13969. @end table
  13970. @subsection Examples
  13971. @itemize
  13972. @item
  13973. Playing audio while showing the spectrum:
  13974. @example
  13975. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13976. @end example
  13977. @item
  13978. Same as above, but with frame rate 30 fps:
  13979. @example
  13980. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13981. @end example
  13982. @item
  13983. Playing at 1280x720:
  13984. @example
  13985. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13986. @end example
  13987. @item
  13988. Disable sonogram display:
  13989. @example
  13990. sono_h=0
  13991. @end example
  13992. @item
  13993. A1 and its harmonics: A1, A2, (near)E3, A3:
  13994. @example
  13995. 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),
  13996. asplit[a][out1]; [a] showcqt [out0]'
  13997. @end example
  13998. @item
  13999. Same as above, but with more accuracy in frequency domain:
  14000. @example
  14001. 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),
  14002. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14003. @end example
  14004. @item
  14005. Custom volume:
  14006. @example
  14007. bar_v=10:sono_v=bar_v*a_weighting(f)
  14008. @end example
  14009. @item
  14010. Custom gamma, now spectrum is linear to the amplitude.
  14011. @example
  14012. bar_g=2:sono_g=2
  14013. @end example
  14014. @item
  14015. Custom tlength equation:
  14016. @example
  14017. 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)))'
  14018. @end example
  14019. @item
  14020. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14021. @example
  14022. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14023. @end example
  14024. @item
  14025. Custom font using fontconfig:
  14026. @example
  14027. font='Courier New,Monospace,mono|bold'
  14028. @end example
  14029. @item
  14030. Custom frequency range with custom axis using image file:
  14031. @example
  14032. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14033. @end example
  14034. @end itemize
  14035. @section showfreqs
  14036. Convert input audio to video output representing the audio power spectrum.
  14037. Audio amplitude is on Y-axis while frequency is on X-axis.
  14038. The filter accepts the following options:
  14039. @table @option
  14040. @item size, s
  14041. Specify size of video. For the syntax of this option, check the
  14042. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14043. Default is @code{1024x512}.
  14044. @item mode
  14045. Set display mode.
  14046. This set how each frequency bin will be represented.
  14047. It accepts the following values:
  14048. @table @samp
  14049. @item line
  14050. @item bar
  14051. @item dot
  14052. @end table
  14053. Default is @code{bar}.
  14054. @item ascale
  14055. Set amplitude scale.
  14056. It accepts the following values:
  14057. @table @samp
  14058. @item lin
  14059. Linear scale.
  14060. @item sqrt
  14061. Square root scale.
  14062. @item cbrt
  14063. Cubic root scale.
  14064. @item log
  14065. Logarithmic scale.
  14066. @end table
  14067. Default is @code{log}.
  14068. @item fscale
  14069. Set frequency scale.
  14070. It accepts the following values:
  14071. @table @samp
  14072. @item lin
  14073. Linear scale.
  14074. @item log
  14075. Logarithmic scale.
  14076. @item rlog
  14077. Reverse logarithmic scale.
  14078. @end table
  14079. Default is @code{lin}.
  14080. @item win_size
  14081. Set window size.
  14082. It accepts the following values:
  14083. @table @samp
  14084. @item w16
  14085. @item w32
  14086. @item w64
  14087. @item w128
  14088. @item w256
  14089. @item w512
  14090. @item w1024
  14091. @item w2048
  14092. @item w4096
  14093. @item w8192
  14094. @item w16384
  14095. @item w32768
  14096. @item w65536
  14097. @end table
  14098. Default is @code{w2048}
  14099. @item win_func
  14100. Set windowing function.
  14101. It accepts the following values:
  14102. @table @samp
  14103. @item rect
  14104. @item bartlett
  14105. @item hanning
  14106. @item hamming
  14107. @item blackman
  14108. @item welch
  14109. @item flattop
  14110. @item bharris
  14111. @item bnuttall
  14112. @item bhann
  14113. @item sine
  14114. @item nuttall
  14115. @item lanczos
  14116. @item gauss
  14117. @item tukey
  14118. @item dolph
  14119. @item cauchy
  14120. @item parzen
  14121. @item poisson
  14122. @end table
  14123. Default is @code{hanning}.
  14124. @item overlap
  14125. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14126. which means optimal overlap for selected window function will be picked.
  14127. @item averaging
  14128. Set time averaging. Setting this to 0 will display current maximal peaks.
  14129. Default is @code{1}, which means time averaging is disabled.
  14130. @item colors
  14131. Specify list of colors separated by space or by '|' which will be used to
  14132. draw channel frequencies. Unrecognized or missing colors will be replaced
  14133. by white color.
  14134. @item cmode
  14135. Set channel display mode.
  14136. It accepts the following values:
  14137. @table @samp
  14138. @item combined
  14139. @item separate
  14140. @end table
  14141. Default is @code{combined}.
  14142. @item minamp
  14143. Set minimum amplitude used in @code{log} amplitude scaler.
  14144. @end table
  14145. @anchor{showspectrum}
  14146. @section showspectrum
  14147. Convert input audio to a video output, representing the audio frequency
  14148. spectrum.
  14149. The filter accepts the following options:
  14150. @table @option
  14151. @item size, s
  14152. Specify the video size for the output. For the syntax of this option, check the
  14153. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14154. Default value is @code{640x512}.
  14155. @item slide
  14156. Specify how the spectrum should slide along the window.
  14157. It accepts the following values:
  14158. @table @samp
  14159. @item replace
  14160. the samples start again on the left when they reach the right
  14161. @item scroll
  14162. the samples scroll from right to left
  14163. @item fullframe
  14164. frames are only produced when the samples reach the right
  14165. @item rscroll
  14166. the samples scroll from left to right
  14167. @end table
  14168. Default value is @code{replace}.
  14169. @item mode
  14170. Specify display mode.
  14171. It accepts the following values:
  14172. @table @samp
  14173. @item combined
  14174. all channels are displayed in the same row
  14175. @item separate
  14176. all channels are displayed in separate rows
  14177. @end table
  14178. Default value is @samp{combined}.
  14179. @item color
  14180. Specify display color mode.
  14181. It accepts the following values:
  14182. @table @samp
  14183. @item channel
  14184. each channel is displayed in a separate color
  14185. @item intensity
  14186. each channel is displayed using the same color scheme
  14187. @item rainbow
  14188. each channel is displayed using the rainbow color scheme
  14189. @item moreland
  14190. each channel is displayed using the moreland color scheme
  14191. @item nebulae
  14192. each channel is displayed using the nebulae color scheme
  14193. @item fire
  14194. each channel is displayed using the fire color scheme
  14195. @item fiery
  14196. each channel is displayed using the fiery color scheme
  14197. @item fruit
  14198. each channel is displayed using the fruit color scheme
  14199. @item cool
  14200. each channel is displayed using the cool color scheme
  14201. @end table
  14202. Default value is @samp{channel}.
  14203. @item scale
  14204. Specify scale used for calculating intensity color values.
  14205. It accepts the following values:
  14206. @table @samp
  14207. @item lin
  14208. linear
  14209. @item sqrt
  14210. square root, default
  14211. @item cbrt
  14212. cubic root
  14213. @item log
  14214. logarithmic
  14215. @item 4thrt
  14216. 4th root
  14217. @item 5thrt
  14218. 5th root
  14219. @end table
  14220. Default value is @samp{sqrt}.
  14221. @item saturation
  14222. Set saturation modifier for displayed colors. Negative values provide
  14223. alternative color scheme. @code{0} is no saturation at all.
  14224. Saturation must be in [-10.0, 10.0] range.
  14225. Default value is @code{1}.
  14226. @item win_func
  14227. Set window function.
  14228. It accepts the following values:
  14229. @table @samp
  14230. @item rect
  14231. @item bartlett
  14232. @item hann
  14233. @item hanning
  14234. @item hamming
  14235. @item blackman
  14236. @item welch
  14237. @item flattop
  14238. @item bharris
  14239. @item bnuttall
  14240. @item bhann
  14241. @item sine
  14242. @item nuttall
  14243. @item lanczos
  14244. @item gauss
  14245. @item tukey
  14246. @item dolph
  14247. @item cauchy
  14248. @item parzen
  14249. @item poisson
  14250. @end table
  14251. Default value is @code{hann}.
  14252. @item orientation
  14253. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14254. @code{horizontal}. Default is @code{vertical}.
  14255. @item overlap
  14256. Set ratio of overlap window. Default value is @code{0}.
  14257. When value is @code{1} overlap is set to recommended size for specific
  14258. window function currently used.
  14259. @item gain
  14260. Set scale gain for calculating intensity color values.
  14261. Default value is @code{1}.
  14262. @item data
  14263. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14264. @item rotation
  14265. Set color rotation, must be in [-1.0, 1.0] range.
  14266. Default value is @code{0}.
  14267. @end table
  14268. The usage is very similar to the showwaves filter; see the examples in that
  14269. section.
  14270. @subsection Examples
  14271. @itemize
  14272. @item
  14273. Large window with logarithmic color scaling:
  14274. @example
  14275. showspectrum=s=1280x480:scale=log
  14276. @end example
  14277. @item
  14278. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14279. @example
  14280. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14281. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14282. @end example
  14283. @end itemize
  14284. @section showspectrumpic
  14285. Convert input audio to a single video frame, representing the audio frequency
  14286. spectrum.
  14287. The filter accepts the following options:
  14288. @table @option
  14289. @item size, s
  14290. Specify the video size for the output. For the syntax of this option, check the
  14291. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14292. Default value is @code{4096x2048}.
  14293. @item mode
  14294. Specify display mode.
  14295. It accepts the following values:
  14296. @table @samp
  14297. @item combined
  14298. all channels are displayed in the same row
  14299. @item separate
  14300. all channels are displayed in separate rows
  14301. @end table
  14302. Default value is @samp{combined}.
  14303. @item color
  14304. Specify display color mode.
  14305. It accepts the following values:
  14306. @table @samp
  14307. @item channel
  14308. each channel is displayed in a separate color
  14309. @item intensity
  14310. each channel is displayed using the same color scheme
  14311. @item rainbow
  14312. each channel is displayed using the rainbow color scheme
  14313. @item moreland
  14314. each channel is displayed using the moreland color scheme
  14315. @item nebulae
  14316. each channel is displayed using the nebulae color scheme
  14317. @item fire
  14318. each channel is displayed using the fire color scheme
  14319. @item fiery
  14320. each channel is displayed using the fiery color scheme
  14321. @item fruit
  14322. each channel is displayed using the fruit color scheme
  14323. @item cool
  14324. each channel is displayed using the cool color scheme
  14325. @end table
  14326. Default value is @samp{intensity}.
  14327. @item scale
  14328. Specify scale used for calculating intensity color values.
  14329. It accepts the following values:
  14330. @table @samp
  14331. @item lin
  14332. linear
  14333. @item sqrt
  14334. square root, default
  14335. @item cbrt
  14336. cubic root
  14337. @item log
  14338. logarithmic
  14339. @item 4thrt
  14340. 4th root
  14341. @item 5thrt
  14342. 5th root
  14343. @end table
  14344. Default value is @samp{log}.
  14345. @item saturation
  14346. Set saturation modifier for displayed colors. Negative values provide
  14347. alternative color scheme. @code{0} is no saturation at all.
  14348. Saturation must be in [-10.0, 10.0] range.
  14349. Default value is @code{1}.
  14350. @item win_func
  14351. Set window function.
  14352. It accepts the following values:
  14353. @table @samp
  14354. @item rect
  14355. @item bartlett
  14356. @item hann
  14357. @item hanning
  14358. @item hamming
  14359. @item blackman
  14360. @item welch
  14361. @item flattop
  14362. @item bharris
  14363. @item bnuttall
  14364. @item bhann
  14365. @item sine
  14366. @item nuttall
  14367. @item lanczos
  14368. @item gauss
  14369. @item tukey
  14370. @item dolph
  14371. @item cauchy
  14372. @item parzen
  14373. @item poisson
  14374. @end table
  14375. Default value is @code{hann}.
  14376. @item orientation
  14377. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14378. @code{horizontal}. Default is @code{vertical}.
  14379. @item gain
  14380. Set scale gain for calculating intensity color values.
  14381. Default value is @code{1}.
  14382. @item legend
  14383. Draw time and frequency axes and legends. Default is enabled.
  14384. @item rotation
  14385. Set color rotation, must be in [-1.0, 1.0] range.
  14386. Default value is @code{0}.
  14387. @end table
  14388. @subsection Examples
  14389. @itemize
  14390. @item
  14391. Extract an audio spectrogram of a whole audio track
  14392. in a 1024x1024 picture using @command{ffmpeg}:
  14393. @example
  14394. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14395. @end example
  14396. @end itemize
  14397. @section showvolume
  14398. Convert input audio volume to a video output.
  14399. The filter accepts the following options:
  14400. @table @option
  14401. @item rate, r
  14402. Set video rate.
  14403. @item b
  14404. Set border width, allowed range is [0, 5]. Default is 1.
  14405. @item w
  14406. Set channel width, allowed range is [80, 8192]. Default is 400.
  14407. @item h
  14408. Set channel height, allowed range is [1, 900]. Default is 20.
  14409. @item f
  14410. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14411. @item c
  14412. Set volume color expression.
  14413. The expression can use the following variables:
  14414. @table @option
  14415. @item VOLUME
  14416. Current max volume of channel in dB.
  14417. @item PEAK
  14418. Current peak.
  14419. @item CHANNEL
  14420. Current channel number, starting from 0.
  14421. @end table
  14422. @item t
  14423. If set, displays channel names. Default is enabled.
  14424. @item v
  14425. If set, displays volume values. Default is enabled.
  14426. @item o
  14427. Set orientation, can be @code{horizontal} or @code{vertical},
  14428. default is @code{horizontal}.
  14429. @item s
  14430. Set step size, allowed range s [0, 5]. Default is 0, which means
  14431. step is disabled.
  14432. @end table
  14433. @section showwaves
  14434. Convert input audio to a video output, representing the samples waves.
  14435. The filter accepts the following options:
  14436. @table @option
  14437. @item size, s
  14438. Specify the video size for the output. For the syntax of this option, check the
  14439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14440. Default value is @code{600x240}.
  14441. @item mode
  14442. Set display mode.
  14443. Available values are:
  14444. @table @samp
  14445. @item point
  14446. Draw a point for each sample.
  14447. @item line
  14448. Draw a vertical line for each sample.
  14449. @item p2p
  14450. Draw a point for each sample and a line between them.
  14451. @item cline
  14452. Draw a centered vertical line for each sample.
  14453. @end table
  14454. Default value is @code{point}.
  14455. @item n
  14456. Set the number of samples which are printed on the same column. A
  14457. larger value will decrease the frame rate. Must be a positive
  14458. integer. This option can be set only if the value for @var{rate}
  14459. is not explicitly specified.
  14460. @item rate, r
  14461. Set the (approximate) output frame rate. This is done by setting the
  14462. option @var{n}. Default value is "25".
  14463. @item split_channels
  14464. Set if channels should be drawn separately or overlap. Default value is 0.
  14465. @item colors
  14466. Set colors separated by '|' which are going to be used for drawing of each channel.
  14467. @item scale
  14468. Set amplitude scale.
  14469. Available values are:
  14470. @table @samp
  14471. @item lin
  14472. Linear.
  14473. @item log
  14474. Logarithmic.
  14475. @item sqrt
  14476. Square root.
  14477. @item cbrt
  14478. Cubic root.
  14479. @end table
  14480. Default is linear.
  14481. @end table
  14482. @subsection Examples
  14483. @itemize
  14484. @item
  14485. Output the input file audio and the corresponding video representation
  14486. at the same time:
  14487. @example
  14488. amovie=a.mp3,asplit[out0],showwaves[out1]
  14489. @end example
  14490. @item
  14491. Create a synthetic signal and show it with showwaves, forcing a
  14492. frame rate of 30 frames per second:
  14493. @example
  14494. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14495. @end example
  14496. @end itemize
  14497. @section showwavespic
  14498. Convert input audio to a single video frame, representing the samples waves.
  14499. The filter accepts the following options:
  14500. @table @option
  14501. @item size, s
  14502. Specify the video size for the output. For the syntax of this option, check the
  14503. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14504. Default value is @code{600x240}.
  14505. @item split_channels
  14506. Set if channels should be drawn separately or overlap. Default value is 0.
  14507. @item colors
  14508. Set colors separated by '|' which are going to be used for drawing of each channel.
  14509. @item scale
  14510. Set amplitude scale.
  14511. Available values are:
  14512. @table @samp
  14513. @item lin
  14514. Linear.
  14515. @item log
  14516. Logarithmic.
  14517. @item sqrt
  14518. Square root.
  14519. @item cbrt
  14520. Cubic root.
  14521. @end table
  14522. Default is linear.
  14523. @end table
  14524. @subsection Examples
  14525. @itemize
  14526. @item
  14527. Extract a channel split representation of the wave form of a whole audio track
  14528. in a 1024x800 picture using @command{ffmpeg}:
  14529. @example
  14530. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14531. @end example
  14532. @end itemize
  14533. @section sidedata, asidedata
  14534. Delete frame side data, or select frames based on it.
  14535. This filter accepts the following options:
  14536. @table @option
  14537. @item mode
  14538. Set mode of operation of the filter.
  14539. Can be one of the following:
  14540. @table @samp
  14541. @item select
  14542. Select every frame with side data of @code{type}.
  14543. @item delete
  14544. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14545. data in the frame.
  14546. @end table
  14547. @item type
  14548. Set side data type used with all modes. Must be set for @code{select} mode. For
  14549. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14550. in @file{libavutil/frame.h}. For example, to choose
  14551. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14552. @end table
  14553. @section spectrumsynth
  14554. Sythesize audio from 2 input video spectrums, first input stream represents
  14555. magnitude across time and second represents phase across time.
  14556. The filter will transform from frequency domain as displayed in videos back
  14557. to time domain as presented in audio output.
  14558. This filter is primarily created for reversing processed @ref{showspectrum}
  14559. filter outputs, but can synthesize sound from other spectrograms too.
  14560. But in such case results are going to be poor if the phase data is not
  14561. available, because in such cases phase data need to be recreated, usually
  14562. its just recreated from random noise.
  14563. For best results use gray only output (@code{channel} color mode in
  14564. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14565. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14566. @code{data} option. Inputs videos should generally use @code{fullframe}
  14567. slide mode as that saves resources needed for decoding video.
  14568. The filter accepts the following options:
  14569. @table @option
  14570. @item sample_rate
  14571. Specify sample rate of output audio, the sample rate of audio from which
  14572. spectrum was generated may differ.
  14573. @item channels
  14574. Set number of channels represented in input video spectrums.
  14575. @item scale
  14576. Set scale which was used when generating magnitude input spectrum.
  14577. Can be @code{lin} or @code{log}. Default is @code{log}.
  14578. @item slide
  14579. Set slide which was used when generating inputs spectrums.
  14580. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14581. Default is @code{fullframe}.
  14582. @item win_func
  14583. Set window function used for resynthesis.
  14584. @item overlap
  14585. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14586. which means optimal overlap for selected window function will be picked.
  14587. @item orientation
  14588. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14589. Default is @code{vertical}.
  14590. @end table
  14591. @subsection Examples
  14592. @itemize
  14593. @item
  14594. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14595. then resynthesize videos back to audio with spectrumsynth:
  14596. @example
  14597. 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
  14598. 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
  14599. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14600. @end example
  14601. @end itemize
  14602. @section split, asplit
  14603. Split input into several identical outputs.
  14604. @code{asplit} works with audio input, @code{split} with video.
  14605. The filter accepts a single parameter which specifies the number of outputs. If
  14606. unspecified, it defaults to 2.
  14607. @subsection Examples
  14608. @itemize
  14609. @item
  14610. Create two separate outputs from the same input:
  14611. @example
  14612. [in] split [out0][out1]
  14613. @end example
  14614. @item
  14615. To create 3 or more outputs, you need to specify the number of
  14616. outputs, like in:
  14617. @example
  14618. [in] asplit=3 [out0][out1][out2]
  14619. @end example
  14620. @item
  14621. Create two separate outputs from the same input, one cropped and
  14622. one padded:
  14623. @example
  14624. [in] split [splitout1][splitout2];
  14625. [splitout1] crop=100:100:0:0 [cropout];
  14626. [splitout2] pad=200:200:100:100 [padout];
  14627. @end example
  14628. @item
  14629. Create 5 copies of the input audio with @command{ffmpeg}:
  14630. @example
  14631. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14632. @end example
  14633. @end itemize
  14634. @section zmq, azmq
  14635. Receive commands sent through a libzmq client, and forward them to
  14636. filters in the filtergraph.
  14637. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14638. must be inserted between two video filters, @code{azmq} between two
  14639. audio filters.
  14640. To enable these filters you need to install the libzmq library and
  14641. headers and configure FFmpeg with @code{--enable-libzmq}.
  14642. For more information about libzmq see:
  14643. @url{http://www.zeromq.org/}
  14644. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14645. receives messages sent through a network interface defined by the
  14646. @option{bind_address} option.
  14647. The received message must be in the form:
  14648. @example
  14649. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14650. @end example
  14651. @var{TARGET} specifies the target of the command, usually the name of
  14652. the filter class or a specific filter instance name.
  14653. @var{COMMAND} specifies the name of the command for the target filter.
  14654. @var{ARG} is optional and specifies the optional argument list for the
  14655. given @var{COMMAND}.
  14656. Upon reception, the message is processed and the corresponding command
  14657. is injected into the filtergraph. Depending on the result, the filter
  14658. will send a reply to the client, adopting the format:
  14659. @example
  14660. @var{ERROR_CODE} @var{ERROR_REASON}
  14661. @var{MESSAGE}
  14662. @end example
  14663. @var{MESSAGE} is optional.
  14664. @subsection Examples
  14665. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14666. be used to send commands processed by these filters.
  14667. Consider the following filtergraph generated by @command{ffplay}
  14668. @example
  14669. ffplay -dumpgraph 1 -f lavfi "
  14670. color=s=100x100:c=red [l];
  14671. color=s=100x100:c=blue [r];
  14672. nullsrc=s=200x100, zmq [bg];
  14673. [bg][l] overlay [bg+l];
  14674. [bg+l][r] overlay=x=100 "
  14675. @end example
  14676. To change the color of the left side of the video, the following
  14677. command can be used:
  14678. @example
  14679. echo Parsed_color_0 c yellow | tools/zmqsend
  14680. @end example
  14681. To change the right side:
  14682. @example
  14683. echo Parsed_color_1 c pink | tools/zmqsend
  14684. @end example
  14685. @c man end MULTIMEDIA FILTERS
  14686. @chapter Multimedia Sources
  14687. @c man begin MULTIMEDIA SOURCES
  14688. Below is a description of the currently available multimedia sources.
  14689. @section amovie
  14690. This is the same as @ref{movie} source, except it selects an audio
  14691. stream by default.
  14692. @anchor{movie}
  14693. @section movie
  14694. Read audio and/or video stream(s) from a movie container.
  14695. It accepts the following parameters:
  14696. @table @option
  14697. @item filename
  14698. The name of the resource to read (not necessarily a file; it can also be a
  14699. device or a stream accessed through some protocol).
  14700. @item format_name, f
  14701. Specifies the format assumed for the movie to read, and can be either
  14702. the name of a container or an input device. If not specified, the
  14703. format is guessed from @var{movie_name} or by probing.
  14704. @item seek_point, sp
  14705. Specifies the seek point in seconds. The frames will be output
  14706. starting from this seek point. The parameter is evaluated with
  14707. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14708. postfix. The default value is "0".
  14709. @item streams, s
  14710. Specifies the streams to read. Several streams can be specified,
  14711. separated by "+". The source will then have as many outputs, in the
  14712. same order. The syntax is explained in the ``Stream specifiers''
  14713. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14714. respectively the default (best suited) video and audio stream. Default
  14715. is "dv", or "da" if the filter is called as "amovie".
  14716. @item stream_index, si
  14717. Specifies the index of the video stream to read. If the value is -1,
  14718. the most suitable video stream will be automatically selected. The default
  14719. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14720. audio instead of video.
  14721. @item loop
  14722. Specifies how many times to read the stream in sequence.
  14723. If the value is 0, the stream will be looped infinitely.
  14724. Default value is "1".
  14725. Note that when the movie is looped the source timestamps are not
  14726. changed, so it will generate non monotonically increasing timestamps.
  14727. @item discontinuity
  14728. Specifies the time difference between frames above which the point is
  14729. considered a timestamp discontinuity which is removed by adjusting the later
  14730. timestamps.
  14731. @end table
  14732. It allows overlaying a second video on top of the main input of
  14733. a filtergraph, as shown in this graph:
  14734. @example
  14735. input -----------> deltapts0 --> overlay --> output
  14736. ^
  14737. |
  14738. movie --> scale--> deltapts1 -------+
  14739. @end example
  14740. @subsection Examples
  14741. @itemize
  14742. @item
  14743. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14744. on top of the input labelled "in":
  14745. @example
  14746. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14747. [in] setpts=PTS-STARTPTS [main];
  14748. [main][over] overlay=16:16 [out]
  14749. @end example
  14750. @item
  14751. Read from a video4linux2 device, and overlay it on top of the input
  14752. labelled "in":
  14753. @example
  14754. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14755. [in] setpts=PTS-STARTPTS [main];
  14756. [main][over] overlay=16:16 [out]
  14757. @end example
  14758. @item
  14759. Read the first video stream and the audio stream with id 0x81 from
  14760. dvd.vob; the video is connected to the pad named "video" and the audio is
  14761. connected to the pad named "audio":
  14762. @example
  14763. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14764. @end example
  14765. @end itemize
  14766. @subsection Commands
  14767. Both movie and amovie support the following commands:
  14768. @table @option
  14769. @item seek
  14770. Perform seek using "av_seek_frame".
  14771. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14772. @itemize
  14773. @item
  14774. @var{stream_index}: If stream_index is -1, a default
  14775. stream is selected, and @var{timestamp} is automatically converted
  14776. from AV_TIME_BASE units to the stream specific time_base.
  14777. @item
  14778. @var{timestamp}: Timestamp in AVStream.time_base units
  14779. or, if no stream is specified, in AV_TIME_BASE units.
  14780. @item
  14781. @var{flags}: Flags which select direction and seeking mode.
  14782. @end itemize
  14783. @item get_duration
  14784. Get movie duration in AV_TIME_BASE units.
  14785. @end table
  14786. @c man end MULTIMEDIA SOURCES