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.

17339 lines
464KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing ammount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and divide it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to raise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio about which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is rms. Can be peak or rms.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is average. Can be average or maximum.
  763. @end table
  764. @section alimiter
  765. The limiter prevents input signal from raising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item cf
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item f
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to reasonable value allows to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signal its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @end table
  1967. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1968. @item gain_entry
  1969. Set gain entry for gain_interpolate function. The expression can
  1970. contain functions:
  1971. @table @option
  1972. @item entry(f, g)
  1973. store gain entry at frequency f with value g
  1974. @end table
  1975. This option is also available as command.
  1976. @item delay
  1977. Set filter delay in seconds. Higher value means more accurate.
  1978. Default is @code{0.01}.
  1979. @item accuracy
  1980. Set filter accuracy in Hz. Lower value means more accurate.
  1981. Default is @code{5}.
  1982. @item wfunc
  1983. Set window function. Acceptable values are:
  1984. @table @option
  1985. @item rectangular
  1986. rectangular window, useful when gain curve is already smooth
  1987. @item hann
  1988. hann window (default)
  1989. @item hamming
  1990. hamming window
  1991. @item blackman
  1992. blackman window
  1993. @item nuttall3
  1994. 3-terms continuous 1st derivative nuttall window
  1995. @item mnuttall3
  1996. minimum 3-terms discontinuous nuttall window
  1997. @item nuttall
  1998. 4-terms continuous 1st derivative nuttall window
  1999. @item bnuttall
  2000. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2001. @item bharris
  2002. blackman-harris window
  2003. @end table
  2004. @item fixed
  2005. If enabled, use fixed number of audio samples. This improves speed when
  2006. filtering with large delay. Default is disabled.
  2007. @item multi
  2008. Enable multichannels evaluation on gain. Default is disabled.
  2009. @item zero_phase
  2010. Enable zero phase mode by substracting timestamp to compensate delay.
  2011. Default is disabled.
  2012. @end table
  2013. @subsection Examples
  2014. @itemize
  2015. @item
  2016. lowpass at 1000 Hz:
  2017. @example
  2018. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2019. @end example
  2020. @item
  2021. lowpass at 1000 Hz with gain_entry:
  2022. @example
  2023. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2024. @end example
  2025. @item
  2026. custom equalization:
  2027. @example
  2028. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2029. @end example
  2030. @item
  2031. higher delay with zero phase to compensate delay:
  2032. @example
  2033. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2034. @end example
  2035. @item
  2036. lowpass on left channel, highpass on right channel:
  2037. @example
  2038. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2039. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2040. @end example
  2041. @end itemize
  2042. @section flanger
  2043. Apply a flanging effect to the audio.
  2044. The filter accepts the following options:
  2045. @table @option
  2046. @item delay
  2047. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2048. @item depth
  2049. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2050. @item regen
  2051. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2052. Default value is 0.
  2053. @item width
  2054. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2055. Default value is 71.
  2056. @item speed
  2057. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2058. @item shape
  2059. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2060. Default value is @var{sinusoidal}.
  2061. @item phase
  2062. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2063. Default value is 25.
  2064. @item interp
  2065. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2066. Default is @var{linear}.
  2067. @end table
  2068. @section hdcd
  2069. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2070. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2071. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2072. of HDCD, and detects the Transient Filter flag.
  2073. @example
  2074. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2075. @end example
  2076. When using the filter with wav, note the default encoding for wav is 16-bit,
  2077. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2078. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2079. @example
  2080. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2081. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2082. @end example
  2083. The filter accepts the following options:
  2084. @table @option
  2085. @item process_stereo
  2086. Process the stereo channels together. If target_gain does not match between
  2087. channels, consider it invalid and use the last valid target_gain.
  2088. @item force_pe
  2089. Always extend peaks above -3dBFS even if PE isn't signaled.
  2090. @item analyze_mode
  2091. Replace audio with a solid tone and adjust the amplitude to signal some
  2092. specific aspect of the decoding process. The output file can be loaded in
  2093. an audio editor alongside the original to aid analysis.
  2094. @code{analyze_mode=pe:force_pe=1} can be used to see all samples above the PE level.
  2095. Modes are:
  2096. @table @samp
  2097. @item 0, off
  2098. Disabled
  2099. @item 1, lle
  2100. Gain adjustment level at each sample
  2101. @item 2, pe
  2102. Samples where peak extend occurs
  2103. @item 3, cdt
  2104. Samples where the code detect timer is active
  2105. @item 4, tgm
  2106. Samples where the target gain does not match between channels
  2107. @end table
  2108. @end table
  2109. @section highpass
  2110. Apply a high-pass filter with 3dB point frequency.
  2111. The filter can be either single-pole, or double-pole (the default).
  2112. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2113. The filter accepts the following options:
  2114. @table @option
  2115. @item frequency, f
  2116. Set frequency in Hz. Default is 3000.
  2117. @item poles, p
  2118. Set number of poles. Default is 2.
  2119. @item width_type
  2120. Set method to specify band-width of filter.
  2121. @table @option
  2122. @item h
  2123. Hz
  2124. @item q
  2125. Q-Factor
  2126. @item o
  2127. octave
  2128. @item s
  2129. slope
  2130. @end table
  2131. @item width, w
  2132. Specify the band-width of a filter in width_type units.
  2133. Applies only to double-pole filter.
  2134. The default is 0.707q and gives a Butterworth response.
  2135. @end table
  2136. @section join
  2137. Join multiple input streams into one multi-channel stream.
  2138. It accepts the following parameters:
  2139. @table @option
  2140. @item inputs
  2141. The number of input streams. It defaults to 2.
  2142. @item channel_layout
  2143. The desired output channel layout. It defaults to stereo.
  2144. @item map
  2145. Map channels from inputs to output. The argument is a '|'-separated list of
  2146. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2147. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2148. can be either the name of the input channel (e.g. FL for front left) or its
  2149. index in the specified input stream. @var{out_channel} is the name of the output
  2150. channel.
  2151. @end table
  2152. The filter will attempt to guess the mappings when they are not specified
  2153. explicitly. It does so by first trying to find an unused matching input channel
  2154. and if that fails it picks the first unused input channel.
  2155. Join 3 inputs (with properly set channel layouts):
  2156. @example
  2157. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2158. @end example
  2159. Build a 5.1 output from 6 single-channel streams:
  2160. @example
  2161. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2162. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2163. out
  2164. @end example
  2165. @section ladspa
  2166. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2167. To enable compilation of this filter you need to configure FFmpeg with
  2168. @code{--enable-ladspa}.
  2169. @table @option
  2170. @item file, f
  2171. Specifies the name of LADSPA plugin library to load. If the environment
  2172. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2173. each one of the directories specified by the colon separated list in
  2174. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2175. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2176. @file{/usr/lib/ladspa/}.
  2177. @item plugin, p
  2178. Specifies the plugin within the library. Some libraries contain only
  2179. one plugin, but others contain many of them. If this is not set filter
  2180. will list all available plugins within the specified library.
  2181. @item controls, c
  2182. Set the '|' separated list of controls which are zero or more floating point
  2183. values that determine the behavior of the loaded plugin (for example delay,
  2184. threshold or gain).
  2185. Controls need to be defined using the following syntax:
  2186. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2187. @var{valuei} is the value set on the @var{i}-th control.
  2188. Alternatively they can be also defined using the following syntax:
  2189. @var{value0}|@var{value1}|@var{value2}|..., where
  2190. @var{valuei} is the value set on the @var{i}-th control.
  2191. If @option{controls} is set to @code{help}, all available controls and
  2192. their valid ranges are printed.
  2193. @item sample_rate, s
  2194. Specify the sample rate, default to 44100. Only used if plugin have
  2195. zero inputs.
  2196. @item nb_samples, n
  2197. Set the number of samples per channel per each output frame, default
  2198. is 1024. Only used if plugin have zero inputs.
  2199. @item duration, d
  2200. Set the minimum duration of the sourced audio. See
  2201. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2202. for the accepted syntax.
  2203. Note that the resulting duration may be greater than the specified duration,
  2204. as the generated audio is always cut at the end of a complete frame.
  2205. If not specified, or the expressed duration is negative, the audio is
  2206. supposed to be generated forever.
  2207. Only used if plugin have zero inputs.
  2208. @end table
  2209. @subsection Examples
  2210. @itemize
  2211. @item
  2212. List all available plugins within amp (LADSPA example plugin) library:
  2213. @example
  2214. ladspa=file=amp
  2215. @end example
  2216. @item
  2217. List all available controls and their valid ranges for @code{vcf_notch}
  2218. plugin from @code{VCF} library:
  2219. @example
  2220. ladspa=f=vcf:p=vcf_notch:c=help
  2221. @end example
  2222. @item
  2223. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2224. plugin library:
  2225. @example
  2226. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2227. @end example
  2228. @item
  2229. Add reverberation to the audio using TAP-plugins
  2230. (Tom's Audio Processing plugins):
  2231. @example
  2232. ladspa=file=tap_reverb:tap_reverb
  2233. @end example
  2234. @item
  2235. Generate white noise, with 0.2 amplitude:
  2236. @example
  2237. ladspa=file=cmt:noise_source_white:c=c0=.2
  2238. @end example
  2239. @item
  2240. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2241. @code{C* Audio Plugin Suite} (CAPS) library:
  2242. @example
  2243. ladspa=file=caps:Click:c=c1=20'
  2244. @end example
  2245. @item
  2246. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2247. @example
  2248. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2249. @end example
  2250. @item
  2251. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2252. @code{SWH Plugins} collection:
  2253. @example
  2254. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2255. @end example
  2256. @item
  2257. Attenuate low frequencies using Multiband EQ from Steve Harris
  2258. @code{SWH Plugins} collection:
  2259. @example
  2260. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2261. @end example
  2262. @end itemize
  2263. @subsection Commands
  2264. This filter supports the following commands:
  2265. @table @option
  2266. @item cN
  2267. Modify the @var{N}-th control value.
  2268. If the specified value is not valid, it is ignored and prior one is kept.
  2269. @end table
  2270. @section loudnorm
  2271. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2272. Support for both single pass (livestreams, files) and double pass (files) modes.
  2273. This algorithm can target IL, LRA, and maximum true peak.
  2274. To enable compilation of this filter you need to configure FFmpeg with
  2275. @code{--enable-libebur128}.
  2276. The filter accepts the following options:
  2277. @table @option
  2278. @item I, i
  2279. Set integrated loudness target.
  2280. Range is -70.0 - -5.0. Default value is -24.0.
  2281. @item LRA, lra
  2282. Set loudness range target.
  2283. Range is 1.0 - 20.0. Default value is 7.0.
  2284. @item TP, tp
  2285. Set maximum true peak.
  2286. Range is -9.0 - +0.0. Default value is -2.0.
  2287. @item measured_I, measured_i
  2288. Measured IL of input file.
  2289. Range is -99.0 - +0.0.
  2290. @item measured_LRA, measured_lra
  2291. Measured LRA of input file.
  2292. Range is 0.0 - 99.0.
  2293. @item measured_TP, measured_tp
  2294. Measured true peak of input file.
  2295. Range is -99.0 - +99.0.
  2296. @item measured_thresh
  2297. Measured threshold of input file.
  2298. Range is -99.0 - +0.0.
  2299. @item offset
  2300. Set offset gain. Gain is applied before the true-peak limiter.
  2301. Range is -99.0 - +99.0. Default is +0.0.
  2302. @item linear
  2303. Normalize linearly if possible.
  2304. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2305. to be specified in order to use this mode.
  2306. Options are true or false. Default is true.
  2307. @item dual_mono
  2308. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2309. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2310. If set to @code{true}, this option will compensate for this effect.
  2311. Multi-channel input files are not affected by this option.
  2312. Options are true or false. Default is false.
  2313. @item print_format
  2314. Set print format for stats. Options are summary, json, or none.
  2315. Default value is none.
  2316. @end table
  2317. @section lowpass
  2318. Apply a low-pass filter with 3dB point frequency.
  2319. The filter can be either single-pole or double-pole (the default).
  2320. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2321. The filter accepts the following options:
  2322. @table @option
  2323. @item frequency, f
  2324. Set frequency in Hz. Default is 500.
  2325. @item poles, p
  2326. Set number of poles. Default is 2.
  2327. @item width_type
  2328. Set method to specify band-width of filter.
  2329. @table @option
  2330. @item h
  2331. Hz
  2332. @item q
  2333. Q-Factor
  2334. @item o
  2335. octave
  2336. @item s
  2337. slope
  2338. @end table
  2339. @item width, w
  2340. Specify the band-width of a filter in width_type units.
  2341. Applies only to double-pole filter.
  2342. The default is 0.707q and gives a Butterworth response.
  2343. @end table
  2344. @anchor{pan}
  2345. @section pan
  2346. Mix channels with specific gain levels. The filter accepts the output
  2347. channel layout followed by a set of channels definitions.
  2348. This filter is also designed to efficiently remap the channels of an audio
  2349. stream.
  2350. The filter accepts parameters of the form:
  2351. "@var{l}|@var{outdef}|@var{outdef}|..."
  2352. @table @option
  2353. @item l
  2354. output channel layout or number of channels
  2355. @item outdef
  2356. output channel specification, of the form:
  2357. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2358. @item out_name
  2359. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2360. number (c0, c1, etc.)
  2361. @item gain
  2362. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2363. @item in_name
  2364. input channel to use, see out_name for details; it is not possible to mix
  2365. named and numbered input channels
  2366. @end table
  2367. If the `=' in a channel specification is replaced by `<', then the gains for
  2368. that specification will be renormalized so that the total is 1, thus
  2369. avoiding clipping noise.
  2370. @subsection Mixing examples
  2371. For example, if you want to down-mix from stereo to mono, but with a bigger
  2372. factor for the left channel:
  2373. @example
  2374. pan=1c|c0=0.9*c0+0.1*c1
  2375. @end example
  2376. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2377. 7-channels surround:
  2378. @example
  2379. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2380. @end example
  2381. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2382. that should be preferred (see "-ac" option) unless you have very specific
  2383. needs.
  2384. @subsection Remapping examples
  2385. The channel remapping will be effective if, and only if:
  2386. @itemize
  2387. @item gain coefficients are zeroes or ones,
  2388. @item only one input per channel output,
  2389. @end itemize
  2390. If all these conditions are satisfied, the filter will notify the user ("Pure
  2391. channel mapping detected"), and use an optimized and lossless method to do the
  2392. remapping.
  2393. For example, if you have a 5.1 source and want a stereo audio stream by
  2394. dropping the extra channels:
  2395. @example
  2396. pan="stereo| c0=FL | c1=FR"
  2397. @end example
  2398. Given the same source, you can also switch front left and front right channels
  2399. and keep the input channel layout:
  2400. @example
  2401. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2402. @end example
  2403. If the input is a stereo audio stream, you can mute the front left channel (and
  2404. still keep the stereo channel layout) with:
  2405. @example
  2406. pan="stereo|c1=c1"
  2407. @end example
  2408. Still with a stereo audio stream input, you can copy the right channel in both
  2409. front left and right:
  2410. @example
  2411. pan="stereo| c0=FR | c1=FR"
  2412. @end example
  2413. @section replaygain
  2414. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2415. outputs it unchanged.
  2416. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2417. @section resample
  2418. Convert the audio sample format, sample rate and channel layout. It is
  2419. not meant to be used directly.
  2420. @section rubberband
  2421. Apply time-stretching and pitch-shifting with librubberband.
  2422. The filter accepts the following options:
  2423. @table @option
  2424. @item tempo
  2425. Set tempo scale factor.
  2426. @item pitch
  2427. Set pitch scale factor.
  2428. @item transients
  2429. Set transients detector.
  2430. Possible values are:
  2431. @table @var
  2432. @item crisp
  2433. @item mixed
  2434. @item smooth
  2435. @end table
  2436. @item detector
  2437. Set detector.
  2438. Possible values are:
  2439. @table @var
  2440. @item compound
  2441. @item percussive
  2442. @item soft
  2443. @end table
  2444. @item phase
  2445. Set phase.
  2446. Possible values are:
  2447. @table @var
  2448. @item laminar
  2449. @item independent
  2450. @end table
  2451. @item window
  2452. Set processing window size.
  2453. Possible values are:
  2454. @table @var
  2455. @item standard
  2456. @item short
  2457. @item long
  2458. @end table
  2459. @item smoothing
  2460. Set smoothing.
  2461. Possible values are:
  2462. @table @var
  2463. @item off
  2464. @item on
  2465. @end table
  2466. @item formant
  2467. Enable formant preservation when shift pitching.
  2468. Possible values are:
  2469. @table @var
  2470. @item shifted
  2471. @item preserved
  2472. @end table
  2473. @item pitchq
  2474. Set pitch quality.
  2475. Possible values are:
  2476. @table @var
  2477. @item quality
  2478. @item speed
  2479. @item consistency
  2480. @end table
  2481. @item channels
  2482. Set channels.
  2483. Possible values are:
  2484. @table @var
  2485. @item apart
  2486. @item together
  2487. @end table
  2488. @end table
  2489. @section sidechaincompress
  2490. This filter acts like normal compressor but has the ability to compress
  2491. detected signal using second input signal.
  2492. It needs two input streams and returns one output stream.
  2493. First input stream will be processed depending on second stream signal.
  2494. The filtered signal then can be filtered with other filters in later stages of
  2495. processing. See @ref{pan} and @ref{amerge} filter.
  2496. The filter accepts the following options:
  2497. @table @option
  2498. @item level_in
  2499. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2500. @item threshold
  2501. If a signal of second stream raises above this level it will affect the gain
  2502. reduction of first stream.
  2503. By default is 0.125. Range is between 0.00097563 and 1.
  2504. @item ratio
  2505. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2506. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2507. Default is 2. Range is between 1 and 20.
  2508. @item attack
  2509. Amount of milliseconds the signal has to rise above the threshold before gain
  2510. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2511. @item release
  2512. Amount of milliseconds the signal has to fall below the threshold before
  2513. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2514. @item makeup
  2515. Set the amount by how much signal will be amplified after processing.
  2516. Default is 2. Range is from 1 and 64.
  2517. @item knee
  2518. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2519. Default is 2.82843. Range is between 1 and 8.
  2520. @item link
  2521. Choose if the @code{average} level between all channels of side-chain stream
  2522. or the louder(@code{maximum}) channel of side-chain stream affects the
  2523. reduction. Default is @code{average}.
  2524. @item detection
  2525. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2526. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2527. @item level_sc
  2528. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2529. @item mix
  2530. How much to use compressed signal in output. Default is 1.
  2531. Range is between 0 and 1.
  2532. @end table
  2533. @subsection Examples
  2534. @itemize
  2535. @item
  2536. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2537. depending on the signal of 2nd input and later compressed signal to be
  2538. merged with 2nd input:
  2539. @example
  2540. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2541. @end example
  2542. @end itemize
  2543. @section sidechaingate
  2544. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2545. filter the detected signal before sending it to the gain reduction stage.
  2546. Normally a gate uses the full range signal to detect a level above the
  2547. threshold.
  2548. For example: If you cut all lower frequencies from your sidechain signal
  2549. the gate will decrease the volume of your track only if not enough highs
  2550. appear. With this technique you are able to reduce the resonation of a
  2551. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2552. guitar.
  2553. It needs two input streams and returns one output stream.
  2554. First input stream will be processed depending on second stream signal.
  2555. The filter accepts the following options:
  2556. @table @option
  2557. @item level_in
  2558. Set input level before filtering.
  2559. Default is 1. Allowed range is from 0.015625 to 64.
  2560. @item range
  2561. Set the level of gain reduction when the signal is below the threshold.
  2562. Default is 0.06125. Allowed range is from 0 to 1.
  2563. @item threshold
  2564. If a signal rises above this level the gain reduction is released.
  2565. Default is 0.125. Allowed range is from 0 to 1.
  2566. @item ratio
  2567. Set a ratio about which the signal is reduced.
  2568. Default is 2. Allowed range is from 1 to 9000.
  2569. @item attack
  2570. Amount of milliseconds the signal has to rise above the threshold before gain
  2571. reduction stops.
  2572. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2573. @item release
  2574. Amount of milliseconds the signal has to fall below the threshold before the
  2575. reduction is increased again. Default is 250 milliseconds.
  2576. Allowed range is from 0.01 to 9000.
  2577. @item makeup
  2578. Set amount of amplification of signal after processing.
  2579. Default is 1. Allowed range is from 1 to 64.
  2580. @item knee
  2581. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2582. Default is 2.828427125. Allowed range is from 1 to 8.
  2583. @item detection
  2584. Choose if exact signal should be taken for detection or an RMS like one.
  2585. Default is rms. Can be peak or rms.
  2586. @item link
  2587. Choose if the average level between all channels or the louder channel affects
  2588. the reduction.
  2589. Default is average. Can be average or maximum.
  2590. @item level_sc
  2591. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2592. @end table
  2593. @section silencedetect
  2594. Detect silence in an audio stream.
  2595. This filter logs a message when it detects that the input audio volume is less
  2596. or equal to a noise tolerance value for a duration greater or equal to the
  2597. minimum detected noise duration.
  2598. The printed times and duration are expressed in seconds.
  2599. The filter accepts the following options:
  2600. @table @option
  2601. @item duration, d
  2602. Set silence duration until notification (default is 2 seconds).
  2603. @item noise, n
  2604. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2605. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2606. @end table
  2607. @subsection Examples
  2608. @itemize
  2609. @item
  2610. Detect 5 seconds of silence with -50dB noise tolerance:
  2611. @example
  2612. silencedetect=n=-50dB:d=5
  2613. @end example
  2614. @item
  2615. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2616. tolerance in @file{silence.mp3}:
  2617. @example
  2618. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2619. @end example
  2620. @end itemize
  2621. @section silenceremove
  2622. Remove silence from the beginning, middle or end of the audio.
  2623. The filter accepts the following options:
  2624. @table @option
  2625. @item start_periods
  2626. This value is used to indicate if audio should be trimmed at beginning of
  2627. the audio. A value of zero indicates no silence should be trimmed from the
  2628. beginning. When specifying a non-zero value, it trims audio up until it
  2629. finds non-silence. Normally, when trimming silence from beginning of audio
  2630. the @var{start_periods} will be @code{1} but it can be increased to higher
  2631. values to trim all audio up to specific count of non-silence periods.
  2632. Default value is @code{0}.
  2633. @item start_duration
  2634. Specify the amount of time that non-silence must be detected before it stops
  2635. trimming audio. By increasing the duration, bursts of noises can be treated
  2636. as silence and trimmed off. Default value is @code{0}.
  2637. @item start_threshold
  2638. This indicates what sample value should be treated as silence. For digital
  2639. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2640. you may wish to increase the value to account for background noise.
  2641. Can be specified in dB (in case "dB" is appended to the specified value)
  2642. or amplitude ratio. Default value is @code{0}.
  2643. @item stop_periods
  2644. Set the count for trimming silence from the end of audio.
  2645. To remove silence from the middle of a file, specify a @var{stop_periods}
  2646. that is negative. This value is then treated as a positive value and is
  2647. used to indicate the effect should restart processing as specified by
  2648. @var{start_periods}, making it suitable for removing periods of silence
  2649. in the middle of the audio.
  2650. Default value is @code{0}.
  2651. @item stop_duration
  2652. Specify a duration of silence that must exist before audio is not copied any
  2653. more. By specifying a higher duration, silence that is wanted can be left in
  2654. the audio.
  2655. Default value is @code{0}.
  2656. @item stop_threshold
  2657. This is the same as @option{start_threshold} but for trimming silence from
  2658. the end of audio.
  2659. Can be specified in dB (in case "dB" is appended to the specified value)
  2660. or amplitude ratio. Default value is @code{0}.
  2661. @item leave_silence
  2662. This indicate that @var{stop_duration} length of audio should be left intact
  2663. at the beginning of each period of silence.
  2664. For example, if you want to remove long pauses between words but do not want
  2665. to remove the pauses completely. Default value is @code{0}.
  2666. @item detection
  2667. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2668. and works better with digital silence which is exactly 0.
  2669. Default value is @code{rms}.
  2670. @item window
  2671. Set ratio used to calculate size of window for detecting silence.
  2672. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2673. @end table
  2674. @subsection Examples
  2675. @itemize
  2676. @item
  2677. The following example shows how this filter can be used to start a recording
  2678. that does not contain the delay at the start which usually occurs between
  2679. pressing the record button and the start of the performance:
  2680. @example
  2681. silenceremove=1:5:0.02
  2682. @end example
  2683. @item
  2684. Trim all silence encountered from beginning to end where there is more than 1
  2685. second of silence in audio:
  2686. @example
  2687. silenceremove=0:0:0:-1:1:-90dB
  2688. @end example
  2689. @end itemize
  2690. @section sofalizer
  2691. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2692. loudspeakers around the user for binaural listening via headphones (audio
  2693. formats up to 9 channels supported).
  2694. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2695. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2696. Austrian Academy of Sciences.
  2697. To enable compilation of this filter you need to configure FFmpeg with
  2698. @code{--enable-netcdf}.
  2699. The filter accepts the following options:
  2700. @table @option
  2701. @item sofa
  2702. Set the SOFA file used for rendering.
  2703. @item gain
  2704. Set gain applied to audio. Value is in dB. Default is 0.
  2705. @item rotation
  2706. Set rotation of virtual loudspeakers in deg. Default is 0.
  2707. @item elevation
  2708. Set elevation of virtual speakers in deg. Default is 0.
  2709. @item radius
  2710. Set distance in meters between loudspeakers and the listener with near-field
  2711. HRTFs. Default is 1.
  2712. @item type
  2713. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2714. processing audio in time domain which is slow.
  2715. @var{freq} is processing audio in frequency domain which is fast.
  2716. Default is @var{freq}.
  2717. @item speakers
  2718. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2719. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2720. Each virtual loudspeaker is described with short channel name following with
  2721. azimuth and elevation in degreees.
  2722. Each virtual loudspeaker description is separated by '|'.
  2723. For example to override front left and front right channel positions use:
  2724. 'speakers=FL 45 15|FR 345 15'.
  2725. Descriptions with unrecognised channel names are ignored.
  2726. @end table
  2727. @subsection Examples
  2728. @itemize
  2729. @item
  2730. Using ClubFritz6 sofa file:
  2731. @example
  2732. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2733. @end example
  2734. @item
  2735. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2736. @example
  2737. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2738. @end example
  2739. @item
  2740. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2741. and also with custom gain:
  2742. @example
  2743. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2744. @end example
  2745. @end itemize
  2746. @section stereotools
  2747. This filter has some handy utilities to manage stereo signals, for converting
  2748. M/S stereo recordings to L/R signal while having control over the parameters
  2749. or spreading the stereo image of master track.
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item level_in
  2753. Set input level before filtering for both channels. Defaults is 1.
  2754. Allowed range is from 0.015625 to 64.
  2755. @item level_out
  2756. Set output level after filtering for both channels. Defaults is 1.
  2757. Allowed range is from 0.015625 to 64.
  2758. @item balance_in
  2759. Set input balance between both channels. Default is 0.
  2760. Allowed range is from -1 to 1.
  2761. @item balance_out
  2762. Set output balance between both channels. Default is 0.
  2763. Allowed range is from -1 to 1.
  2764. @item softclip
  2765. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2766. clipping. Disabled by default.
  2767. @item mutel
  2768. Mute the left channel. Disabled by default.
  2769. @item muter
  2770. Mute the right channel. Disabled by default.
  2771. @item phasel
  2772. Change the phase of the left channel. Disabled by default.
  2773. @item phaser
  2774. Change the phase of the right channel. Disabled by default.
  2775. @item mode
  2776. Set stereo mode. Available values are:
  2777. @table @samp
  2778. @item lr>lr
  2779. Left/Right to Left/Right, this is default.
  2780. @item lr>ms
  2781. Left/Right to Mid/Side.
  2782. @item ms>lr
  2783. Mid/Side to Left/Right.
  2784. @item lr>ll
  2785. Left/Right to Left/Left.
  2786. @item lr>rr
  2787. Left/Right to Right/Right.
  2788. @item lr>l+r
  2789. Left/Right to Left + Right.
  2790. @item lr>rl
  2791. Left/Right to Right/Left.
  2792. @end table
  2793. @item slev
  2794. Set level of side signal. Default is 1.
  2795. Allowed range is from 0.015625 to 64.
  2796. @item sbal
  2797. Set balance of side signal. Default is 0.
  2798. Allowed range is from -1 to 1.
  2799. @item mlev
  2800. Set level of the middle signal. Default is 1.
  2801. Allowed range is from 0.015625 to 64.
  2802. @item mpan
  2803. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2804. @item base
  2805. Set stereo base between mono and inversed channels. Default is 0.
  2806. Allowed range is from -1 to 1.
  2807. @item delay
  2808. Set delay in milliseconds how much to delay left from right channel and
  2809. vice versa. Default is 0. Allowed range is from -20 to 20.
  2810. @item sclevel
  2811. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2812. @item phase
  2813. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2814. @end table
  2815. @subsection Examples
  2816. @itemize
  2817. @item
  2818. Apply karaoke like effect:
  2819. @example
  2820. stereotools=mlev=0.015625
  2821. @end example
  2822. @item
  2823. Convert M/S signal to L/R:
  2824. @example
  2825. "stereotools=mode=ms>lr"
  2826. @end example
  2827. @end itemize
  2828. @section stereowiden
  2829. This filter enhance the stereo effect by suppressing signal common to both
  2830. channels and by delaying the signal of left into right and vice versa,
  2831. thereby widening the stereo effect.
  2832. The filter accepts the following options:
  2833. @table @option
  2834. @item delay
  2835. Time in milliseconds of the delay of left signal into right and vice versa.
  2836. Default is 20 milliseconds.
  2837. @item feedback
  2838. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2839. effect of left signal in right output and vice versa which gives widening
  2840. effect. Default is 0.3.
  2841. @item crossfeed
  2842. Cross feed of left into right with inverted phase. This helps in suppressing
  2843. the mono. If the value is 1 it will cancel all the signal common to both
  2844. channels. Default is 0.3.
  2845. @item drymix
  2846. Set level of input signal of original channel. Default is 0.8.
  2847. @end table
  2848. @section treble
  2849. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2850. shelving filter with a response similar to that of a standard
  2851. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2852. The filter accepts the following options:
  2853. @table @option
  2854. @item gain, g
  2855. Give the gain at whichever is the lower of ~22 kHz and the
  2856. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2857. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2858. @item frequency, f
  2859. Set the filter's central frequency and so can be used
  2860. to extend or reduce the frequency range to be boosted or cut.
  2861. The default value is @code{3000} Hz.
  2862. @item width_type
  2863. Set method to specify band-width of filter.
  2864. @table @option
  2865. @item h
  2866. Hz
  2867. @item q
  2868. Q-Factor
  2869. @item o
  2870. octave
  2871. @item s
  2872. slope
  2873. @end table
  2874. @item width, w
  2875. Determine how steep is the filter's shelf transition.
  2876. @end table
  2877. @section tremolo
  2878. Sinusoidal amplitude modulation.
  2879. The filter accepts the following options:
  2880. @table @option
  2881. @item f
  2882. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2883. (20 Hz or lower) will result in a tremolo effect.
  2884. This filter may also be used as a ring modulator by specifying
  2885. a modulation frequency higher than 20 Hz.
  2886. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2887. @item d
  2888. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2889. Default value is 0.5.
  2890. @end table
  2891. @section vibrato
  2892. Sinusoidal phase modulation.
  2893. The filter accepts the following options:
  2894. @table @option
  2895. @item f
  2896. Modulation frequency in Hertz.
  2897. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2898. @item d
  2899. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2900. Default value is 0.5.
  2901. @end table
  2902. @section volume
  2903. Adjust the input audio volume.
  2904. It accepts the following parameters:
  2905. @table @option
  2906. @item volume
  2907. Set audio volume expression.
  2908. Output values are clipped to the maximum value.
  2909. The output audio volume is given by the relation:
  2910. @example
  2911. @var{output_volume} = @var{volume} * @var{input_volume}
  2912. @end example
  2913. The default value for @var{volume} is "1.0".
  2914. @item precision
  2915. This parameter represents the mathematical precision.
  2916. It determines which input sample formats will be allowed, which affects the
  2917. precision of the volume scaling.
  2918. @table @option
  2919. @item fixed
  2920. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2921. @item float
  2922. 32-bit floating-point; this limits input sample format to FLT. (default)
  2923. @item double
  2924. 64-bit floating-point; this limits input sample format to DBL.
  2925. @end table
  2926. @item replaygain
  2927. Choose the behaviour on encountering ReplayGain side data in input frames.
  2928. @table @option
  2929. @item drop
  2930. Remove ReplayGain side data, ignoring its contents (the default).
  2931. @item ignore
  2932. Ignore ReplayGain side data, but leave it in the frame.
  2933. @item track
  2934. Prefer the track gain, if present.
  2935. @item album
  2936. Prefer the album gain, if present.
  2937. @end table
  2938. @item replaygain_preamp
  2939. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2940. Default value for @var{replaygain_preamp} is 0.0.
  2941. @item eval
  2942. Set when the volume expression is evaluated.
  2943. It accepts the following values:
  2944. @table @samp
  2945. @item once
  2946. only evaluate expression once during the filter initialization, or
  2947. when the @samp{volume} command is sent
  2948. @item frame
  2949. evaluate expression for each incoming frame
  2950. @end table
  2951. Default value is @samp{once}.
  2952. @end table
  2953. The volume expression can contain the following parameters.
  2954. @table @option
  2955. @item n
  2956. frame number (starting at zero)
  2957. @item nb_channels
  2958. number of channels
  2959. @item nb_consumed_samples
  2960. number of samples consumed by the filter
  2961. @item nb_samples
  2962. number of samples in the current frame
  2963. @item pos
  2964. original frame position in the file
  2965. @item pts
  2966. frame PTS
  2967. @item sample_rate
  2968. sample rate
  2969. @item startpts
  2970. PTS at start of stream
  2971. @item startt
  2972. time at start of stream
  2973. @item t
  2974. frame time
  2975. @item tb
  2976. timestamp timebase
  2977. @item volume
  2978. last set volume value
  2979. @end table
  2980. Note that when @option{eval} is set to @samp{once} only the
  2981. @var{sample_rate} and @var{tb} variables are available, all other
  2982. variables will evaluate to NAN.
  2983. @subsection Commands
  2984. This filter supports the following commands:
  2985. @table @option
  2986. @item volume
  2987. Modify the volume expression.
  2988. The command accepts the same syntax of the corresponding option.
  2989. If the specified expression is not valid, it is kept at its current
  2990. value.
  2991. @item replaygain_noclip
  2992. Prevent clipping by limiting the gain applied.
  2993. Default value for @var{replaygain_noclip} is 1.
  2994. @end table
  2995. @subsection Examples
  2996. @itemize
  2997. @item
  2998. Halve the input audio volume:
  2999. @example
  3000. volume=volume=0.5
  3001. volume=volume=1/2
  3002. volume=volume=-6.0206dB
  3003. @end example
  3004. In all the above example the named key for @option{volume} can be
  3005. omitted, for example like in:
  3006. @example
  3007. volume=0.5
  3008. @end example
  3009. @item
  3010. Increase input audio power by 6 decibels using fixed-point precision:
  3011. @example
  3012. volume=volume=6dB:precision=fixed
  3013. @end example
  3014. @item
  3015. Fade volume after time 10 with an annihilation period of 5 seconds:
  3016. @example
  3017. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3018. @end example
  3019. @end itemize
  3020. @section volumedetect
  3021. Detect the volume of the input video.
  3022. The filter has no parameters. The input is not modified. Statistics about
  3023. the volume will be printed in the log when the input stream end is reached.
  3024. In particular it will show the mean volume (root mean square), maximum
  3025. volume (on a per-sample basis), and the beginning of a histogram of the
  3026. registered volume values (from the maximum value to a cumulated 1/1000 of
  3027. the samples).
  3028. All volumes are in decibels relative to the maximum PCM value.
  3029. @subsection Examples
  3030. Here is an excerpt of the output:
  3031. @example
  3032. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3033. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3034. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3035. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3036. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3037. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3038. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3039. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3040. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3041. @end example
  3042. It means that:
  3043. @itemize
  3044. @item
  3045. The mean square energy is approximately -27 dB, or 10^-2.7.
  3046. @item
  3047. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3048. @item
  3049. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3050. @end itemize
  3051. In other words, raising the volume by +4 dB does not cause any clipping,
  3052. raising it by +5 dB causes clipping for 6 samples, etc.
  3053. @c man end AUDIO FILTERS
  3054. @chapter Audio Sources
  3055. @c man begin AUDIO SOURCES
  3056. Below is a description of the currently available audio sources.
  3057. @section abuffer
  3058. Buffer audio frames, and make them available to the filter chain.
  3059. This source is mainly intended for a programmatic use, in particular
  3060. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3061. It accepts the following parameters:
  3062. @table @option
  3063. @item time_base
  3064. The timebase which will be used for timestamps of submitted frames. It must be
  3065. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3066. @item sample_rate
  3067. The sample rate of the incoming audio buffers.
  3068. @item sample_fmt
  3069. The sample format of the incoming audio buffers.
  3070. Either a sample format name or its corresponding integer representation from
  3071. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3072. @item channel_layout
  3073. The channel layout of the incoming audio buffers.
  3074. Either a channel layout name from channel_layout_map in
  3075. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3076. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3077. @item channels
  3078. The number of channels of the incoming audio buffers.
  3079. If both @var{channels} and @var{channel_layout} are specified, then they
  3080. must be consistent.
  3081. @end table
  3082. @subsection Examples
  3083. @example
  3084. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3085. @end example
  3086. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3087. Since the sample format with name "s16p" corresponds to the number
  3088. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3089. equivalent to:
  3090. @example
  3091. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3092. @end example
  3093. @section aevalsrc
  3094. Generate an audio signal specified by an expression.
  3095. This source accepts in input one or more expressions (one for each
  3096. channel), which are evaluated and used to generate a corresponding
  3097. audio signal.
  3098. This source accepts the following options:
  3099. @table @option
  3100. @item exprs
  3101. Set the '|'-separated expressions list for each separate channel. In case the
  3102. @option{channel_layout} option is not specified, the selected channel layout
  3103. depends on the number of provided expressions. Otherwise the last
  3104. specified expression is applied to the remaining output channels.
  3105. @item channel_layout, c
  3106. Set the channel layout. The number of channels in the specified layout
  3107. must be equal to the number of specified expressions.
  3108. @item duration, d
  3109. Set the minimum duration of the sourced audio. See
  3110. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3111. for the accepted syntax.
  3112. Note that the resulting duration may be greater than the specified
  3113. duration, as the generated audio is always cut at the end of a
  3114. complete frame.
  3115. If not specified, or the expressed duration is negative, the audio is
  3116. supposed to be generated forever.
  3117. @item nb_samples, n
  3118. Set the number of samples per channel per each output frame,
  3119. default to 1024.
  3120. @item sample_rate, s
  3121. Specify the sample rate, default to 44100.
  3122. @end table
  3123. Each expression in @var{exprs} can contain the following constants:
  3124. @table @option
  3125. @item n
  3126. number of the evaluated sample, starting from 0
  3127. @item t
  3128. time of the evaluated sample expressed in seconds, starting from 0
  3129. @item s
  3130. sample rate
  3131. @end table
  3132. @subsection Examples
  3133. @itemize
  3134. @item
  3135. Generate silence:
  3136. @example
  3137. aevalsrc=0
  3138. @end example
  3139. @item
  3140. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3141. 8000 Hz:
  3142. @example
  3143. aevalsrc="sin(440*2*PI*t):s=8000"
  3144. @end example
  3145. @item
  3146. Generate a two channels signal, specify the channel layout (Front
  3147. Center + Back Center) explicitly:
  3148. @example
  3149. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3150. @end example
  3151. @item
  3152. Generate white noise:
  3153. @example
  3154. aevalsrc="-2+random(0)"
  3155. @end example
  3156. @item
  3157. Generate an amplitude modulated signal:
  3158. @example
  3159. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3160. @end example
  3161. @item
  3162. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3163. @example
  3164. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3165. @end example
  3166. @end itemize
  3167. @section anullsrc
  3168. The null audio source, return unprocessed audio frames. It is mainly useful
  3169. as a template and to be employed in analysis / debugging tools, or as
  3170. the source for filters which ignore the input data (for example the sox
  3171. synth filter).
  3172. This source accepts the following options:
  3173. @table @option
  3174. @item channel_layout, cl
  3175. Specifies the channel layout, and can be either an integer or a string
  3176. representing a channel layout. The default value of @var{channel_layout}
  3177. is "stereo".
  3178. Check the channel_layout_map definition in
  3179. @file{libavutil/channel_layout.c} for the mapping between strings and
  3180. channel layout values.
  3181. @item sample_rate, r
  3182. Specifies the sample rate, and defaults to 44100.
  3183. @item nb_samples, n
  3184. Set the number of samples per requested frames.
  3185. @end table
  3186. @subsection Examples
  3187. @itemize
  3188. @item
  3189. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3190. @example
  3191. anullsrc=r=48000:cl=4
  3192. @end example
  3193. @item
  3194. Do the same operation with a more obvious syntax:
  3195. @example
  3196. anullsrc=r=48000:cl=mono
  3197. @end example
  3198. @end itemize
  3199. All the parameters need to be explicitly defined.
  3200. @section flite
  3201. Synthesize a voice utterance using the libflite library.
  3202. To enable compilation of this filter you need to configure FFmpeg with
  3203. @code{--enable-libflite}.
  3204. Note that the flite library is not thread-safe.
  3205. The filter accepts the following options:
  3206. @table @option
  3207. @item list_voices
  3208. If set to 1, list the names of the available voices and exit
  3209. immediately. Default value is 0.
  3210. @item nb_samples, n
  3211. Set the maximum number of samples per frame. Default value is 512.
  3212. @item textfile
  3213. Set the filename containing the text to speak.
  3214. @item text
  3215. Set the text to speak.
  3216. @item voice, v
  3217. Set the voice to use for the speech synthesis. Default value is
  3218. @code{kal}. See also the @var{list_voices} option.
  3219. @end table
  3220. @subsection Examples
  3221. @itemize
  3222. @item
  3223. Read from file @file{speech.txt}, and synthesize the text using the
  3224. standard flite voice:
  3225. @example
  3226. flite=textfile=speech.txt
  3227. @end example
  3228. @item
  3229. Read the specified text selecting the @code{slt} voice:
  3230. @example
  3231. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3232. @end example
  3233. @item
  3234. Input text to ffmpeg:
  3235. @example
  3236. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3237. @end example
  3238. @item
  3239. Make @file{ffplay} speak the specified text, using @code{flite} and
  3240. the @code{lavfi} device:
  3241. @example
  3242. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3243. @end example
  3244. @end itemize
  3245. For more information about libflite, check:
  3246. @url{http://www.speech.cs.cmu.edu/flite/}
  3247. @section anoisesrc
  3248. Generate a noise audio signal.
  3249. The filter accepts the following options:
  3250. @table @option
  3251. @item sample_rate, r
  3252. Specify the sample rate. Default value is 48000 Hz.
  3253. @item amplitude, a
  3254. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3255. is 1.0.
  3256. @item duration, d
  3257. Specify the duration of the generated audio stream. Not specifying this option
  3258. results in noise with an infinite length.
  3259. @item color, colour, c
  3260. Specify the color of noise. Available noise colors are white, pink, and brown.
  3261. Default color is white.
  3262. @item seed, s
  3263. Specify a value used to seed the PRNG.
  3264. @item nb_samples, n
  3265. Set the number of samples per each output frame, default is 1024.
  3266. @end table
  3267. @subsection Examples
  3268. @itemize
  3269. @item
  3270. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3271. @example
  3272. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3273. @end example
  3274. @end itemize
  3275. @section sine
  3276. Generate an audio signal made of a sine wave with amplitude 1/8.
  3277. The audio signal is bit-exact.
  3278. The filter accepts the following options:
  3279. @table @option
  3280. @item frequency, f
  3281. Set the carrier frequency. Default is 440 Hz.
  3282. @item beep_factor, b
  3283. Enable a periodic beep every second with frequency @var{beep_factor} times
  3284. the carrier frequency. Default is 0, meaning the beep is disabled.
  3285. @item sample_rate, r
  3286. Specify the sample rate, default is 44100.
  3287. @item duration, d
  3288. Specify the duration of the generated audio stream.
  3289. @item samples_per_frame
  3290. Set the number of samples per output frame.
  3291. The expression can contain the following constants:
  3292. @table @option
  3293. @item n
  3294. The (sequential) number of the output audio frame, starting from 0.
  3295. @item pts
  3296. The PTS (Presentation TimeStamp) of the output audio frame,
  3297. expressed in @var{TB} units.
  3298. @item t
  3299. The PTS of the output audio frame, expressed in seconds.
  3300. @item TB
  3301. The timebase of the output audio frames.
  3302. @end table
  3303. Default is @code{1024}.
  3304. @end table
  3305. @subsection Examples
  3306. @itemize
  3307. @item
  3308. Generate a simple 440 Hz sine wave:
  3309. @example
  3310. sine
  3311. @end example
  3312. @item
  3313. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3314. @example
  3315. sine=220:4:d=5
  3316. sine=f=220:b=4:d=5
  3317. sine=frequency=220:beep_factor=4:duration=5
  3318. @end example
  3319. @item
  3320. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3321. pattern:
  3322. @example
  3323. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3324. @end example
  3325. @end itemize
  3326. @c man end AUDIO SOURCES
  3327. @chapter Audio Sinks
  3328. @c man begin AUDIO SINKS
  3329. Below is a description of the currently available audio sinks.
  3330. @section abuffersink
  3331. Buffer audio frames, and make them available to the end of filter chain.
  3332. This sink is mainly intended for programmatic use, in particular
  3333. through the interface defined in @file{libavfilter/buffersink.h}
  3334. or the options system.
  3335. It accepts a pointer to an AVABufferSinkContext structure, which
  3336. defines the incoming buffers' formats, to be passed as the opaque
  3337. parameter to @code{avfilter_init_filter} for initialization.
  3338. @section anullsink
  3339. Null audio sink; do absolutely nothing with the input audio. It is
  3340. mainly useful as a template and for use in analysis / debugging
  3341. tools.
  3342. @c man end AUDIO SINKS
  3343. @chapter Video Filters
  3344. @c man begin VIDEO FILTERS
  3345. When you configure your FFmpeg build, you can disable any of the
  3346. existing filters using @code{--disable-filters}.
  3347. The configure output will show the video filters included in your
  3348. build.
  3349. Below is a description of the currently available video filters.
  3350. @section alphaextract
  3351. Extract the alpha component from the input as a grayscale video. This
  3352. is especially useful with the @var{alphamerge} filter.
  3353. @section alphamerge
  3354. Add or replace the alpha component of the primary input with the
  3355. grayscale value of a second input. This is intended for use with
  3356. @var{alphaextract} to allow the transmission or storage of frame
  3357. sequences that have alpha in a format that doesn't support an alpha
  3358. channel.
  3359. For example, to reconstruct full frames from a normal YUV-encoded video
  3360. and a separate video created with @var{alphaextract}, you might use:
  3361. @example
  3362. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3363. @end example
  3364. Since this filter is designed for reconstruction, it operates on frame
  3365. sequences without considering timestamps, and terminates when either
  3366. input reaches end of stream. This will cause problems if your encoding
  3367. pipeline drops frames. If you're trying to apply an image as an
  3368. overlay to a video stream, consider the @var{overlay} filter instead.
  3369. @section ass
  3370. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3371. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3372. Substation Alpha) subtitles files.
  3373. This filter accepts the following option in addition to the common options from
  3374. the @ref{subtitles} filter:
  3375. @table @option
  3376. @item shaping
  3377. Set the shaping engine
  3378. Available values are:
  3379. @table @samp
  3380. @item auto
  3381. The default libass shaping engine, which is the best available.
  3382. @item simple
  3383. Fast, font-agnostic shaper that can do only substitutions
  3384. @item complex
  3385. Slower shaper using OpenType for substitutions and positioning
  3386. @end table
  3387. The default is @code{auto}.
  3388. @end table
  3389. @section atadenoise
  3390. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3391. The filter accepts the following options:
  3392. @table @option
  3393. @item 0a
  3394. Set threshold A for 1st plane. Default is 0.02.
  3395. Valid range is 0 to 0.3.
  3396. @item 0b
  3397. Set threshold B for 1st plane. Default is 0.04.
  3398. Valid range is 0 to 5.
  3399. @item 1a
  3400. Set threshold A for 2nd plane. Default is 0.02.
  3401. Valid range is 0 to 0.3.
  3402. @item 1b
  3403. Set threshold B for 2nd plane. Default is 0.04.
  3404. Valid range is 0 to 5.
  3405. @item 2a
  3406. Set threshold A for 3rd plane. Default is 0.02.
  3407. Valid range is 0 to 0.3.
  3408. @item 2b
  3409. Set threshold B for 3rd plane. Default is 0.04.
  3410. Valid range is 0 to 5.
  3411. Threshold A is designed to react on abrupt changes in the input signal and
  3412. threshold B is designed to react on continuous changes in the input signal.
  3413. @item s
  3414. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3415. number in range [5, 129].
  3416. @end table
  3417. @section bbox
  3418. Compute the bounding box for the non-black pixels in the input frame
  3419. luminance plane.
  3420. This filter computes the bounding box containing all the pixels with a
  3421. luminance value greater than the minimum allowed value.
  3422. The parameters describing the bounding box are printed on the filter
  3423. log.
  3424. The filter accepts the following option:
  3425. @table @option
  3426. @item min_val
  3427. Set the minimal luminance value. Default is @code{16}.
  3428. @end table
  3429. @section bitplanenoise
  3430. Show and measure bit plane noise.
  3431. The filter accepts the following options:
  3432. @table @option
  3433. @item bitplane
  3434. Set which plane to analyze. Default is @code{1}.
  3435. @item filter
  3436. Filter out noisy pixels from @code{bitplane} set above.
  3437. Default is disabled.
  3438. @end table
  3439. @section blackdetect
  3440. Detect video intervals that are (almost) completely black. Can be
  3441. useful to detect chapter transitions, commercials, or invalid
  3442. recordings. Output lines contains the time for the start, end and
  3443. duration of the detected black interval expressed in seconds.
  3444. In order to display the output lines, you need to set the loglevel at
  3445. least to the AV_LOG_INFO value.
  3446. The filter accepts the following options:
  3447. @table @option
  3448. @item black_min_duration, d
  3449. Set the minimum detected black duration expressed in seconds. It must
  3450. be a non-negative floating point number.
  3451. Default value is 2.0.
  3452. @item picture_black_ratio_th, pic_th
  3453. Set the threshold for considering a picture "black".
  3454. Express the minimum value for the ratio:
  3455. @example
  3456. @var{nb_black_pixels} / @var{nb_pixels}
  3457. @end example
  3458. for which a picture is considered black.
  3459. Default value is 0.98.
  3460. @item pixel_black_th, pix_th
  3461. Set the threshold for considering a pixel "black".
  3462. The threshold expresses the maximum pixel luminance value for which a
  3463. pixel is considered "black". The provided value is scaled according to
  3464. the following equation:
  3465. @example
  3466. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3467. @end example
  3468. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3469. the input video format, the range is [0-255] for YUV full-range
  3470. formats and [16-235] for YUV non full-range formats.
  3471. Default value is 0.10.
  3472. @end table
  3473. The following example sets the maximum pixel threshold to the minimum
  3474. value, and detects only black intervals of 2 or more seconds:
  3475. @example
  3476. blackdetect=d=2:pix_th=0.00
  3477. @end example
  3478. @section blackframe
  3479. Detect frames that are (almost) completely black. Can be useful to
  3480. detect chapter transitions or commercials. Output lines consist of
  3481. the frame number of the detected frame, the percentage of blackness,
  3482. the position in the file if known or -1 and the timestamp in seconds.
  3483. In order to display the output lines, you need to set the loglevel at
  3484. least to the AV_LOG_INFO value.
  3485. It accepts the following parameters:
  3486. @table @option
  3487. @item amount
  3488. The percentage of the pixels that have to be below the threshold; it defaults to
  3489. @code{98}.
  3490. @item threshold, thresh
  3491. The threshold below which a pixel value is considered black; it defaults to
  3492. @code{32}.
  3493. @end table
  3494. @section blend, tblend
  3495. Blend two video frames into each other.
  3496. The @code{blend} filter takes two input streams and outputs one
  3497. stream, the first input is the "top" layer and second input is
  3498. "bottom" layer. Output terminates when shortest input terminates.
  3499. The @code{tblend} (time blend) filter takes two consecutive frames
  3500. from one single stream, and outputs the result obtained by blending
  3501. the new frame on top of the old frame.
  3502. A description of the accepted options follows.
  3503. @table @option
  3504. @item c0_mode
  3505. @item c1_mode
  3506. @item c2_mode
  3507. @item c3_mode
  3508. @item all_mode
  3509. Set blend mode for specific pixel component or all pixel components in case
  3510. of @var{all_mode}. Default value is @code{normal}.
  3511. Available values for component modes are:
  3512. @table @samp
  3513. @item addition
  3514. @item addition128
  3515. @item and
  3516. @item average
  3517. @item burn
  3518. @item darken
  3519. @item difference
  3520. @item difference128
  3521. @item divide
  3522. @item dodge
  3523. @item freeze
  3524. @item exclusion
  3525. @item glow
  3526. @item hardlight
  3527. @item hardmix
  3528. @item heat
  3529. @item lighten
  3530. @item linearlight
  3531. @item multiply
  3532. @item multiply128
  3533. @item negation
  3534. @item normal
  3535. @item or
  3536. @item overlay
  3537. @item phoenix
  3538. @item pinlight
  3539. @item reflect
  3540. @item screen
  3541. @item softlight
  3542. @item subtract
  3543. @item vividlight
  3544. @item xor
  3545. @end table
  3546. @item c0_opacity
  3547. @item c1_opacity
  3548. @item c2_opacity
  3549. @item c3_opacity
  3550. @item all_opacity
  3551. Set blend opacity for specific pixel component or all pixel components in case
  3552. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3553. @item c0_expr
  3554. @item c1_expr
  3555. @item c2_expr
  3556. @item c3_expr
  3557. @item all_expr
  3558. Set blend expression for specific pixel component or all pixel components in case
  3559. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3560. The expressions can use the following variables:
  3561. @table @option
  3562. @item N
  3563. The sequential number of the filtered frame, starting from @code{0}.
  3564. @item X
  3565. @item Y
  3566. the coordinates of the current sample
  3567. @item W
  3568. @item H
  3569. the width and height of currently filtered plane
  3570. @item SW
  3571. @item SH
  3572. Width and height scale depending on the currently filtered plane. It is the
  3573. ratio between the corresponding luma plane number of pixels and the current
  3574. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3575. @code{0.5,0.5} for chroma planes.
  3576. @item T
  3577. Time of the current frame, expressed in seconds.
  3578. @item TOP, A
  3579. Value of pixel component at current location for first video frame (top layer).
  3580. @item BOTTOM, B
  3581. Value of pixel component at current location for second video frame (bottom layer).
  3582. @end table
  3583. @item shortest
  3584. Force termination when the shortest input terminates. Default is
  3585. @code{0}. This option is only defined for the @code{blend} filter.
  3586. @item repeatlast
  3587. Continue applying the last bottom frame after the end of the stream. A value of
  3588. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3589. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3590. @end table
  3591. @subsection Examples
  3592. @itemize
  3593. @item
  3594. Apply transition from bottom layer to top layer in first 10 seconds:
  3595. @example
  3596. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3597. @end example
  3598. @item
  3599. Apply 1x1 checkerboard effect:
  3600. @example
  3601. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3602. @end example
  3603. @item
  3604. Apply uncover left effect:
  3605. @example
  3606. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3607. @end example
  3608. @item
  3609. Apply uncover down effect:
  3610. @example
  3611. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3612. @end example
  3613. @item
  3614. Apply uncover up-left effect:
  3615. @example
  3616. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3617. @end example
  3618. @item
  3619. Split diagonally video and shows top and bottom layer on each side:
  3620. @example
  3621. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3622. @end example
  3623. @item
  3624. Display differences between the current and the previous frame:
  3625. @example
  3626. tblend=all_mode=difference128
  3627. @end example
  3628. @end itemize
  3629. @section boxblur
  3630. Apply a boxblur algorithm to the input video.
  3631. It accepts the following parameters:
  3632. @table @option
  3633. @item luma_radius, lr
  3634. @item luma_power, lp
  3635. @item chroma_radius, cr
  3636. @item chroma_power, cp
  3637. @item alpha_radius, ar
  3638. @item alpha_power, ap
  3639. @end table
  3640. A description of the accepted options follows.
  3641. @table @option
  3642. @item luma_radius, lr
  3643. @item chroma_radius, cr
  3644. @item alpha_radius, ar
  3645. Set an expression for the box radius in pixels used for blurring the
  3646. corresponding input plane.
  3647. The radius value must be a non-negative number, and must not be
  3648. greater than the value of the expression @code{min(w,h)/2} for the
  3649. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3650. planes.
  3651. Default value for @option{luma_radius} is "2". If not specified,
  3652. @option{chroma_radius} and @option{alpha_radius} default to the
  3653. corresponding value set for @option{luma_radius}.
  3654. The expressions can contain the following constants:
  3655. @table @option
  3656. @item w
  3657. @item h
  3658. The input width and height in pixels.
  3659. @item cw
  3660. @item ch
  3661. The input chroma image width and height in pixels.
  3662. @item hsub
  3663. @item vsub
  3664. The horizontal and vertical chroma subsample values. For example, for the
  3665. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3666. @end table
  3667. @item luma_power, lp
  3668. @item chroma_power, cp
  3669. @item alpha_power, ap
  3670. Specify how many times the boxblur filter is applied to the
  3671. corresponding plane.
  3672. Default value for @option{luma_power} is 2. If not specified,
  3673. @option{chroma_power} and @option{alpha_power} default to the
  3674. corresponding value set for @option{luma_power}.
  3675. A value of 0 will disable the effect.
  3676. @end table
  3677. @subsection Examples
  3678. @itemize
  3679. @item
  3680. Apply a boxblur filter with the luma, chroma, and alpha radii
  3681. set to 2:
  3682. @example
  3683. boxblur=luma_radius=2:luma_power=1
  3684. boxblur=2:1
  3685. @end example
  3686. @item
  3687. Set the luma radius to 2, and alpha and chroma radius to 0:
  3688. @example
  3689. boxblur=2:1:cr=0:ar=0
  3690. @end example
  3691. @item
  3692. Set the luma and chroma radii to a fraction of the video dimension:
  3693. @example
  3694. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3695. @end example
  3696. @end itemize
  3697. @section bwdif
  3698. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3699. Deinterlacing Filter").
  3700. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3701. interpolation algorithms.
  3702. It accepts the following parameters:
  3703. @table @option
  3704. @item mode
  3705. The interlacing mode to adopt. It accepts one of the following values:
  3706. @table @option
  3707. @item 0, send_frame
  3708. Output one frame for each frame.
  3709. @item 1, send_field
  3710. Output one frame for each field.
  3711. @end table
  3712. The default value is @code{send_field}.
  3713. @item parity
  3714. The picture field parity assumed for the input interlaced video. It accepts one
  3715. of the following values:
  3716. @table @option
  3717. @item 0, tff
  3718. Assume the top field is first.
  3719. @item 1, bff
  3720. Assume the bottom field is first.
  3721. @item -1, auto
  3722. Enable automatic detection of field parity.
  3723. @end table
  3724. The default value is @code{auto}.
  3725. If the interlacing is unknown or the decoder does not export this information,
  3726. top field first will be assumed.
  3727. @item deint
  3728. Specify which frames to deinterlace. Accept one of the following
  3729. values:
  3730. @table @option
  3731. @item 0, all
  3732. Deinterlace all frames.
  3733. @item 1, interlaced
  3734. Only deinterlace frames marked as interlaced.
  3735. @end table
  3736. The default value is @code{all}.
  3737. @end table
  3738. @section chromakey
  3739. YUV colorspace color/chroma keying.
  3740. The filter accepts the following options:
  3741. @table @option
  3742. @item color
  3743. The color which will be replaced with transparency.
  3744. @item similarity
  3745. Similarity percentage with the key color.
  3746. 0.01 matches only the exact key color, while 1.0 matches everything.
  3747. @item blend
  3748. Blend percentage.
  3749. 0.0 makes pixels either fully transparent, or not transparent at all.
  3750. Higher values result in semi-transparent pixels, with a higher transparency
  3751. the more similar the pixels color is to the key color.
  3752. @item yuv
  3753. Signals that the color passed is already in YUV instead of RGB.
  3754. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3755. This can be used to pass exact YUV values as hexadecimal numbers.
  3756. @end table
  3757. @subsection Examples
  3758. @itemize
  3759. @item
  3760. Make every green pixel in the input image transparent:
  3761. @example
  3762. ffmpeg -i input.png -vf chromakey=green out.png
  3763. @end example
  3764. @item
  3765. Overlay a greenscreen-video on top of a static black background.
  3766. @example
  3767. 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
  3768. @end example
  3769. @end itemize
  3770. @section ciescope
  3771. Display CIE color diagram with pixels overlaid onto it.
  3772. The filter accepts the following options:
  3773. @table @option
  3774. @item system
  3775. Set color system.
  3776. @table @samp
  3777. @item ntsc, 470m
  3778. @item ebu, 470bg
  3779. @item smpte
  3780. @item 240m
  3781. @item apple
  3782. @item widergb
  3783. @item cie1931
  3784. @item rec709, hdtv
  3785. @item uhdtv, rec2020
  3786. @end table
  3787. @item cie
  3788. Set CIE system.
  3789. @table @samp
  3790. @item xyy
  3791. @item ucs
  3792. @item luv
  3793. @end table
  3794. @item gamuts
  3795. Set what gamuts to draw.
  3796. See @code{system} option for available values.
  3797. @item size, s
  3798. Set ciescope size, by default set to 512.
  3799. @item intensity, i
  3800. Set intensity used to map input pixel values to CIE diagram.
  3801. @item contrast
  3802. Set contrast used to draw tongue colors that are out of active color system gamut.
  3803. @item corrgamma
  3804. Correct gamma displayed on scope, by default enabled.
  3805. @item showwhite
  3806. Show white point on CIE diagram, by default disabled.
  3807. @item gamma
  3808. Set input gamma. Used only with XYZ input color space.
  3809. @end table
  3810. @section codecview
  3811. Visualize information exported by some codecs.
  3812. Some codecs can export information through frames using side-data or other
  3813. means. For example, some MPEG based codecs export motion vectors through the
  3814. @var{export_mvs} flag in the codec @option{flags2} option.
  3815. The filter accepts the following option:
  3816. @table @option
  3817. @item mv
  3818. Set motion vectors to visualize.
  3819. Available flags for @var{mv} are:
  3820. @table @samp
  3821. @item pf
  3822. forward predicted MVs of P-frames
  3823. @item bf
  3824. forward predicted MVs of B-frames
  3825. @item bb
  3826. backward predicted MVs of B-frames
  3827. @end table
  3828. @item qp
  3829. Display quantization parameters using the chroma planes.
  3830. @item mv_type, mvt
  3831. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3832. Available flags for @var{mv_type} are:
  3833. @table @samp
  3834. @item fp
  3835. forward predicted MVs
  3836. @item bp
  3837. backward predicted MVs
  3838. @end table
  3839. @item frame_type, ft
  3840. Set frame type to visualize motion vectors of.
  3841. Available flags for @var{frame_type} are:
  3842. @table @samp
  3843. @item if
  3844. intra-coded frames (I-frames)
  3845. @item pf
  3846. predicted frames (P-frames)
  3847. @item bf
  3848. bi-directionally predicted frames (B-frames)
  3849. @end table
  3850. @end table
  3851. @subsection Examples
  3852. @itemize
  3853. @item
  3854. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3855. @example
  3856. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3857. @end example
  3858. @item
  3859. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3860. @example
  3861. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3862. @end example
  3863. @end itemize
  3864. @section colorbalance
  3865. Modify intensity of primary colors (red, green and blue) of input frames.
  3866. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3867. regions for the red-cyan, green-magenta or blue-yellow balance.
  3868. A positive adjustment value shifts the balance towards the primary color, a negative
  3869. value towards the complementary color.
  3870. The filter accepts the following options:
  3871. @table @option
  3872. @item rs
  3873. @item gs
  3874. @item bs
  3875. Adjust red, green and blue shadows (darkest pixels).
  3876. @item rm
  3877. @item gm
  3878. @item bm
  3879. Adjust red, green and blue midtones (medium pixels).
  3880. @item rh
  3881. @item gh
  3882. @item bh
  3883. Adjust red, green and blue highlights (brightest pixels).
  3884. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3885. @end table
  3886. @subsection Examples
  3887. @itemize
  3888. @item
  3889. Add red color cast to shadows:
  3890. @example
  3891. colorbalance=rs=.3
  3892. @end example
  3893. @end itemize
  3894. @section colorkey
  3895. RGB colorspace color keying.
  3896. The filter accepts the following options:
  3897. @table @option
  3898. @item color
  3899. The color which will be replaced with transparency.
  3900. @item similarity
  3901. Similarity percentage with the key color.
  3902. 0.01 matches only the exact key color, while 1.0 matches everything.
  3903. @item blend
  3904. Blend percentage.
  3905. 0.0 makes pixels either fully transparent, or not transparent at all.
  3906. Higher values result in semi-transparent pixels, with a higher transparency
  3907. the more similar the pixels color is to the key color.
  3908. @end table
  3909. @subsection Examples
  3910. @itemize
  3911. @item
  3912. Make every green pixel in the input image transparent:
  3913. @example
  3914. ffmpeg -i input.png -vf colorkey=green out.png
  3915. @end example
  3916. @item
  3917. Overlay a greenscreen-video on top of a static background image.
  3918. @example
  3919. 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
  3920. @end example
  3921. @end itemize
  3922. @section colorlevels
  3923. Adjust video input frames using levels.
  3924. The filter accepts the following options:
  3925. @table @option
  3926. @item rimin
  3927. @item gimin
  3928. @item bimin
  3929. @item aimin
  3930. Adjust red, green, blue and alpha input black point.
  3931. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3932. @item rimax
  3933. @item gimax
  3934. @item bimax
  3935. @item aimax
  3936. Adjust red, green, blue and alpha input white point.
  3937. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3938. Input levels are used to lighten highlights (bright tones), darken shadows
  3939. (dark tones), change the balance of bright and dark tones.
  3940. @item romin
  3941. @item gomin
  3942. @item bomin
  3943. @item aomin
  3944. Adjust red, green, blue and alpha output black point.
  3945. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3946. @item romax
  3947. @item gomax
  3948. @item bomax
  3949. @item aomax
  3950. Adjust red, green, blue and alpha output white point.
  3951. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3952. Output levels allows manual selection of a constrained output level range.
  3953. @end table
  3954. @subsection Examples
  3955. @itemize
  3956. @item
  3957. Make video output darker:
  3958. @example
  3959. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3960. @end example
  3961. @item
  3962. Increase contrast:
  3963. @example
  3964. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3965. @end example
  3966. @item
  3967. Make video output lighter:
  3968. @example
  3969. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3970. @end example
  3971. @item
  3972. Increase brightness:
  3973. @example
  3974. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3975. @end example
  3976. @end itemize
  3977. @section colorchannelmixer
  3978. Adjust video input frames by re-mixing color channels.
  3979. This filter modifies a color channel by adding the values associated to
  3980. the other channels of the same pixels. For example if the value to
  3981. modify is red, the output value will be:
  3982. @example
  3983. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3984. @end example
  3985. The filter accepts the following options:
  3986. @table @option
  3987. @item rr
  3988. @item rg
  3989. @item rb
  3990. @item ra
  3991. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3992. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3993. @item gr
  3994. @item gg
  3995. @item gb
  3996. @item ga
  3997. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3998. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3999. @item br
  4000. @item bg
  4001. @item bb
  4002. @item ba
  4003. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4004. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4005. @item ar
  4006. @item ag
  4007. @item ab
  4008. @item aa
  4009. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4010. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4011. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4012. @end table
  4013. @subsection Examples
  4014. @itemize
  4015. @item
  4016. Convert source to grayscale:
  4017. @example
  4018. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4019. @end example
  4020. @item
  4021. Simulate sepia tones:
  4022. @example
  4023. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4024. @end example
  4025. @end itemize
  4026. @section colormatrix
  4027. Convert color matrix.
  4028. The filter accepts the following options:
  4029. @table @option
  4030. @item src
  4031. @item dst
  4032. Specify the source and destination color matrix. Both values must be
  4033. specified.
  4034. The accepted values are:
  4035. @table @samp
  4036. @item bt709
  4037. BT.709
  4038. @item bt601
  4039. BT.601
  4040. @item smpte240m
  4041. SMPTE-240M
  4042. @item fcc
  4043. FCC
  4044. @item bt2020
  4045. BT.2020
  4046. @end table
  4047. @end table
  4048. For example to convert from BT.601 to SMPTE-240M, use the command:
  4049. @example
  4050. colormatrix=bt601:smpte240m
  4051. @end example
  4052. @section colorspace
  4053. Convert colorspace, transfer characteristics or color primaries.
  4054. The filter accepts the following options:
  4055. @table @option
  4056. @item all
  4057. Specify all color properties at once.
  4058. The accepted values are:
  4059. @table @samp
  4060. @item bt470m
  4061. BT.470M
  4062. @item bt470bg
  4063. BT.470BG
  4064. @item bt601-6-525
  4065. BT.601-6 525
  4066. @item bt601-6-625
  4067. BT.601-6 625
  4068. @item bt709
  4069. BT.709
  4070. @item smpte170m
  4071. SMPTE-170M
  4072. @item smpte240m
  4073. SMPTE-240M
  4074. @item bt2020
  4075. BT.2020
  4076. @end table
  4077. @item space
  4078. Specify output colorspace.
  4079. The accepted values are:
  4080. @table @samp
  4081. @item bt709
  4082. BT.709
  4083. @item fcc
  4084. FCC
  4085. @item bt470bg
  4086. BT.470BG or BT.601-6 625
  4087. @item smpte170m
  4088. SMPTE-170M or BT.601-6 525
  4089. @item smpte240m
  4090. SMPTE-240M
  4091. @item bt2020ncl
  4092. BT.2020 with non-constant luminance
  4093. @end table
  4094. @item trc
  4095. Specify output transfer characteristics.
  4096. The accepted values are:
  4097. @table @samp
  4098. @item bt709
  4099. BT.709
  4100. @item gamma22
  4101. Constant gamma of 2.2
  4102. @item gamma28
  4103. Constant gamma of 2.8
  4104. @item smpte170m
  4105. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4106. @item smpte240m
  4107. SMPTE-240M
  4108. @item bt2020-10
  4109. BT.2020 for 10-bits content
  4110. @item bt2020-12
  4111. BT.2020 for 12-bits content
  4112. @end table
  4113. @item primaries
  4114. Specify output color primaries.
  4115. The accepted values are:
  4116. @table @samp
  4117. @item bt709
  4118. BT.709
  4119. @item bt470m
  4120. BT.470M
  4121. @item bt470bg
  4122. BT.470BG or BT.601-6 625
  4123. @item smpte170m
  4124. SMPTE-170M or BT.601-6 525
  4125. @item smpte240m
  4126. SMPTE-240M
  4127. @item bt2020
  4128. BT.2020
  4129. @end table
  4130. @item range
  4131. Specify output color range.
  4132. The accepted values are:
  4133. @table @samp
  4134. @item mpeg
  4135. MPEG (restricted) range
  4136. @item jpeg
  4137. JPEG (full) range
  4138. @end table
  4139. @item format
  4140. Specify output color format.
  4141. The accepted values are:
  4142. @table @samp
  4143. @item yuv420p
  4144. YUV 4:2:0 planar 8-bits
  4145. @item yuv420p10
  4146. YUV 4:2:0 planar 10-bits
  4147. @item yuv420p12
  4148. YUV 4:2:0 planar 12-bits
  4149. @item yuv422p
  4150. YUV 4:2:2 planar 8-bits
  4151. @item yuv422p10
  4152. YUV 4:2:2 planar 10-bits
  4153. @item yuv422p12
  4154. YUV 4:2:2 planar 12-bits
  4155. @item yuv444p
  4156. YUV 4:4:4 planar 8-bits
  4157. @item yuv444p10
  4158. YUV 4:4:4 planar 10-bits
  4159. @item yuv444p12
  4160. YUV 4:4:4 planar 12-bits
  4161. @end table
  4162. @item fast
  4163. Do a fast conversion, which skips gamma/primary correction. This will take
  4164. significantly less CPU, but will be mathematically incorrect. To get output
  4165. compatible with that produced by the colormatrix filter, use fast=1.
  4166. @item dither
  4167. Specify dithering mode.
  4168. The accepted values are:
  4169. @table @samp
  4170. @item none
  4171. No dithering
  4172. @item fsb
  4173. Floyd-Steinberg dithering
  4174. @end table
  4175. @item wpadapt
  4176. Whitepoint adaptation mode.
  4177. The accepted values are:
  4178. @table @samp
  4179. @item bradford
  4180. Bradford whitepoint adaptation
  4181. @item vonkries
  4182. von Kries whitepoint adaptation
  4183. @item identity
  4184. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4185. @end table
  4186. @end table
  4187. The filter converts the transfer characteristics, color space and color
  4188. primaries to the specified user values. The output value, if not specified,
  4189. is set to a default value based on the "all" property. If that property is
  4190. also not specified, the filter will log an error. The output color range and
  4191. format default to the same value as the input color range and format. The
  4192. input transfer characteristics, color space, color primaries and color range
  4193. should be set on the input data. If any of these are missing, the filter will
  4194. log an error and no conversion will take place.
  4195. For example to convert the input to SMPTE-240M, use the command:
  4196. @example
  4197. colorspace=smpte240m
  4198. @end example
  4199. @section convolution
  4200. Apply convolution 3x3 or 5x5 filter.
  4201. The filter accepts the following options:
  4202. @table @option
  4203. @item 0m
  4204. @item 1m
  4205. @item 2m
  4206. @item 3m
  4207. Set matrix for each plane.
  4208. Matrix is sequence of 9 or 25 signed integers.
  4209. @item 0rdiv
  4210. @item 1rdiv
  4211. @item 2rdiv
  4212. @item 3rdiv
  4213. Set multiplier for calculated value for each plane.
  4214. @item 0bias
  4215. @item 1bias
  4216. @item 2bias
  4217. @item 3bias
  4218. Set bias for each plane. This value is added to the result of the multiplication.
  4219. Useful for making the overall image brighter or darker. Default is 0.0.
  4220. @end table
  4221. @subsection Examples
  4222. @itemize
  4223. @item
  4224. Apply sharpen:
  4225. @example
  4226. 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"
  4227. @end example
  4228. @item
  4229. Apply blur:
  4230. @example
  4231. 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"
  4232. @end example
  4233. @item
  4234. Apply edge enhance:
  4235. @example
  4236. 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"
  4237. @end example
  4238. @item
  4239. Apply edge detect:
  4240. @example
  4241. 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"
  4242. @end example
  4243. @item
  4244. Apply emboss:
  4245. @example
  4246. 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"
  4247. @end example
  4248. @end itemize
  4249. @section copy
  4250. Copy the input source unchanged to the output. This is mainly useful for
  4251. testing purposes.
  4252. @anchor{coreimage}
  4253. @section coreimage
  4254. Video filtering on GPU using Apple's CoreImage API on OSX.
  4255. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4256. processed by video hardware. However, software-based OpenGL implementations
  4257. exist which means there is no guarantee for hardware processing. It depends on
  4258. the respective OSX.
  4259. There are many filters and image generators provided by Apple that come with a
  4260. large variety of options. The filter has to be referenced by its name along
  4261. with its options.
  4262. The coreimage filter accepts the following options:
  4263. @table @option
  4264. @item list_filters
  4265. List all available filters and generators along with all their respective
  4266. options as well as possible minimum and maximum values along with the default
  4267. values.
  4268. @example
  4269. list_filters=true
  4270. @end example
  4271. @item filter
  4272. Specify all filters by their respective name and options.
  4273. Use @var{list_filters} to determine all valid filter names and options.
  4274. Numerical options are specified by a float value and are automatically clamped
  4275. to their respective value range. Vector and color options have to be specified
  4276. by a list of space separated float values. Character escaping has to be done.
  4277. A special option name @code{default} is available to use default options for a
  4278. filter.
  4279. It is required to specify either @code{default} or at least one of the filter options.
  4280. All omitted options are used with their default values.
  4281. The syntax of the filter string is as follows:
  4282. @example
  4283. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4284. @end example
  4285. @item output_rect
  4286. Specify a rectangle where the output of the filter chain is copied into the
  4287. input image. It is given by a list of space separated float values:
  4288. @example
  4289. output_rect=x\ y\ width\ height
  4290. @end example
  4291. If not given, the output rectangle equals the dimensions of the input image.
  4292. The output rectangle is automatically cropped at the borders of the input
  4293. image. Negative values are valid for each component.
  4294. @example
  4295. output_rect=25\ 25\ 100\ 100
  4296. @end example
  4297. @end table
  4298. Several filters can be chained for successive processing without GPU-HOST
  4299. transfers allowing for fast processing of complex filter chains.
  4300. Currently, only filters with zero (generators) or exactly one (filters) input
  4301. image and one output image are supported. Also, transition filters are not yet
  4302. usable as intended.
  4303. Some filters generate output images with additional padding depending on the
  4304. respective filter kernel. The padding is automatically removed to ensure the
  4305. filter output has the same size as the input image.
  4306. For image generators, the size of the output image is determined by the
  4307. previous output image of the filter chain or the input image of the whole
  4308. filterchain, respectively. The generators do not use the pixel information of
  4309. this image to generate their output. However, the generated output is
  4310. blended onto this image, resulting in partial or complete coverage of the
  4311. output image.
  4312. The @ref{coreimagesrc} video source can be used for generating input images
  4313. which are directly fed into the filter chain. By using it, providing input
  4314. images by another video source or an input video is not required.
  4315. @subsection Examples
  4316. @itemize
  4317. @item
  4318. List all filters available:
  4319. @example
  4320. coreimage=list_filters=true
  4321. @end example
  4322. @item
  4323. Use the CIBoxBlur filter with default options to blur an image:
  4324. @example
  4325. coreimage=filter=CIBoxBlur@@default
  4326. @end example
  4327. @item
  4328. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4329. its center at 100x100 and a radius of 50 pixels:
  4330. @example
  4331. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4332. @end example
  4333. @item
  4334. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4335. given as complete and escaped command-line for Apple's standard bash shell:
  4336. @example
  4337. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4338. @end example
  4339. @end itemize
  4340. @section crop
  4341. Crop the input video to given dimensions.
  4342. It accepts the following parameters:
  4343. @table @option
  4344. @item w, out_w
  4345. The width of the output video. It defaults to @code{iw}.
  4346. This expression is evaluated only once during the filter
  4347. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4348. @item h, out_h
  4349. The height of the output video. It defaults to @code{ih}.
  4350. This expression is evaluated only once during the filter
  4351. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4352. @item x
  4353. The horizontal position, in the input video, of the left edge of the output
  4354. video. It defaults to @code{(in_w-out_w)/2}.
  4355. This expression is evaluated per-frame.
  4356. @item y
  4357. The vertical position, in the input video, of the top edge of the output video.
  4358. It defaults to @code{(in_h-out_h)/2}.
  4359. This expression is evaluated per-frame.
  4360. @item keep_aspect
  4361. If set to 1 will force the output display aspect ratio
  4362. to be the same of the input, by changing the output sample aspect
  4363. ratio. It defaults to 0.
  4364. @end table
  4365. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4366. expressions containing the following constants:
  4367. @table @option
  4368. @item x
  4369. @item y
  4370. The computed values for @var{x} and @var{y}. They are evaluated for
  4371. each new frame.
  4372. @item in_w
  4373. @item in_h
  4374. The input width and height.
  4375. @item iw
  4376. @item ih
  4377. These are the same as @var{in_w} and @var{in_h}.
  4378. @item out_w
  4379. @item out_h
  4380. The output (cropped) width and height.
  4381. @item ow
  4382. @item oh
  4383. These are the same as @var{out_w} and @var{out_h}.
  4384. @item a
  4385. same as @var{iw} / @var{ih}
  4386. @item sar
  4387. input sample aspect ratio
  4388. @item dar
  4389. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4390. @item hsub
  4391. @item vsub
  4392. horizontal and vertical chroma subsample values. For example for the
  4393. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4394. @item n
  4395. The number of the input frame, starting from 0.
  4396. @item pos
  4397. the position in the file of the input frame, NAN if unknown
  4398. @item t
  4399. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4400. @end table
  4401. The expression for @var{out_w} may depend on the value of @var{out_h},
  4402. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4403. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4404. evaluated after @var{out_w} and @var{out_h}.
  4405. The @var{x} and @var{y} parameters specify the expressions for the
  4406. position of the top-left corner of the output (non-cropped) area. They
  4407. are evaluated for each frame. If the evaluated value is not valid, it
  4408. is approximated to the nearest valid value.
  4409. The expression for @var{x} may depend on @var{y}, and the expression
  4410. for @var{y} may depend on @var{x}.
  4411. @subsection Examples
  4412. @itemize
  4413. @item
  4414. Crop area with size 100x100 at position (12,34).
  4415. @example
  4416. crop=100:100:12:34
  4417. @end example
  4418. Using named options, the example above becomes:
  4419. @example
  4420. crop=w=100:h=100:x=12:y=34
  4421. @end example
  4422. @item
  4423. Crop the central input area with size 100x100:
  4424. @example
  4425. crop=100:100
  4426. @end example
  4427. @item
  4428. Crop the central input area with size 2/3 of the input video:
  4429. @example
  4430. crop=2/3*in_w:2/3*in_h
  4431. @end example
  4432. @item
  4433. Crop the input video central square:
  4434. @example
  4435. crop=out_w=in_h
  4436. crop=in_h
  4437. @end example
  4438. @item
  4439. Delimit the rectangle with the top-left corner placed at position
  4440. 100:100 and the right-bottom corner corresponding to the right-bottom
  4441. corner of the input image.
  4442. @example
  4443. crop=in_w-100:in_h-100:100:100
  4444. @end example
  4445. @item
  4446. Crop 10 pixels from the left and right borders, and 20 pixels from
  4447. the top and bottom borders
  4448. @example
  4449. crop=in_w-2*10:in_h-2*20
  4450. @end example
  4451. @item
  4452. Keep only the bottom right quarter of the input image:
  4453. @example
  4454. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4455. @end example
  4456. @item
  4457. Crop height for getting Greek harmony:
  4458. @example
  4459. crop=in_w:1/PHI*in_w
  4460. @end example
  4461. @item
  4462. Apply trembling effect:
  4463. @example
  4464. 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)
  4465. @end example
  4466. @item
  4467. Apply erratic camera effect depending on timestamp:
  4468. @example
  4469. 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)"
  4470. @end example
  4471. @item
  4472. Set x depending on the value of y:
  4473. @example
  4474. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4475. @end example
  4476. @end itemize
  4477. @subsection Commands
  4478. This filter supports the following commands:
  4479. @table @option
  4480. @item w, out_w
  4481. @item h, out_h
  4482. @item x
  4483. @item y
  4484. Set width/height of the output video and the horizontal/vertical position
  4485. in the input video.
  4486. The command accepts the same syntax of the corresponding option.
  4487. If the specified expression is not valid, it is kept at its current
  4488. value.
  4489. @end table
  4490. @section cropdetect
  4491. Auto-detect the crop size.
  4492. It calculates the necessary cropping parameters and prints the
  4493. recommended parameters via the logging system. The detected dimensions
  4494. correspond to the non-black area of the input video.
  4495. It accepts the following parameters:
  4496. @table @option
  4497. @item limit
  4498. Set higher black value threshold, which can be optionally specified
  4499. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4500. value greater to the set value is considered non-black. It defaults to 24.
  4501. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4502. on the bitdepth of the pixel format.
  4503. @item round
  4504. The value which the width/height should be divisible by. It defaults to
  4505. 16. The offset is automatically adjusted to center the video. Use 2 to
  4506. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4507. encoding to most video codecs.
  4508. @item reset_count, reset
  4509. Set the counter that determines after how many frames cropdetect will
  4510. reset the previously detected largest video area and start over to
  4511. detect the current optimal crop area. Default value is 0.
  4512. This can be useful when channel logos distort the video area. 0
  4513. indicates 'never reset', and returns the largest area encountered during
  4514. playback.
  4515. @end table
  4516. @anchor{curves}
  4517. @section curves
  4518. Apply color adjustments using curves.
  4519. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4520. component (red, green and blue) has its values defined by @var{N} key points
  4521. tied from each other using a smooth curve. The x-axis represents the pixel
  4522. values from the input frame, and the y-axis the new pixel values to be set for
  4523. the output frame.
  4524. By default, a component curve is defined by the two points @var{(0;0)} and
  4525. @var{(1;1)}. This creates a straight line where each original pixel value is
  4526. "adjusted" to its own value, which means no change to the image.
  4527. The filter allows you to redefine these two points and add some more. A new
  4528. curve (using a natural cubic spline interpolation) will be define to pass
  4529. smoothly through all these new coordinates. The new defined points needs to be
  4530. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4531. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4532. the vector spaces, the values will be clipped accordingly.
  4533. The filter accepts the following options:
  4534. @table @option
  4535. @item preset
  4536. Select one of the available color presets. This option can be used in addition
  4537. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4538. options takes priority on the preset values.
  4539. Available presets are:
  4540. @table @samp
  4541. @item none
  4542. @item color_negative
  4543. @item cross_process
  4544. @item darker
  4545. @item increase_contrast
  4546. @item lighter
  4547. @item linear_contrast
  4548. @item medium_contrast
  4549. @item negative
  4550. @item strong_contrast
  4551. @item vintage
  4552. @end table
  4553. Default is @code{none}.
  4554. @item master, m
  4555. Set the master key points. These points will define a second pass mapping. It
  4556. is sometimes called a "luminance" or "value" mapping. It can be used with
  4557. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4558. post-processing LUT.
  4559. @item red, r
  4560. Set the key points for the red component.
  4561. @item green, g
  4562. Set the key points for the green component.
  4563. @item blue, b
  4564. Set the key points for the blue component.
  4565. @item all
  4566. Set the key points for all components (not including master).
  4567. Can be used in addition to the other key points component
  4568. options. In this case, the unset component(s) will fallback on this
  4569. @option{all} setting.
  4570. @item psfile
  4571. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4572. @item plot
  4573. Save Gnuplot script of the curves in specified file.
  4574. @end table
  4575. To avoid some filtergraph syntax conflicts, each key points list need to be
  4576. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4577. @subsection Examples
  4578. @itemize
  4579. @item
  4580. Increase slightly the middle level of blue:
  4581. @example
  4582. curves=blue='0/0 0.5/0.58 1/1'
  4583. @end example
  4584. @item
  4585. Vintage effect:
  4586. @example
  4587. 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'
  4588. @end example
  4589. Here we obtain the following coordinates for each components:
  4590. @table @var
  4591. @item red
  4592. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4593. @item green
  4594. @code{(0;0) (0.50;0.48) (1;1)}
  4595. @item blue
  4596. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4597. @end table
  4598. @item
  4599. The previous example can also be achieved with the associated built-in preset:
  4600. @example
  4601. curves=preset=vintage
  4602. @end example
  4603. @item
  4604. Or simply:
  4605. @example
  4606. curves=vintage
  4607. @end example
  4608. @item
  4609. Use a Photoshop preset and redefine the points of the green component:
  4610. @example
  4611. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4612. @end example
  4613. @item
  4614. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4615. and @command{gnuplot}:
  4616. @example
  4617. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4618. gnuplot -p /tmp/curves.plt
  4619. @end example
  4620. @end itemize
  4621. @section datascope
  4622. Video data analysis filter.
  4623. This filter shows hexadecimal pixel values of part of video.
  4624. The filter accepts the following options:
  4625. @table @option
  4626. @item size, s
  4627. Set output video size.
  4628. @item x
  4629. Set x offset from where to pick pixels.
  4630. @item y
  4631. Set y offset from where to pick pixels.
  4632. @item mode
  4633. Set scope mode, can be one of the following:
  4634. @table @samp
  4635. @item mono
  4636. Draw hexadecimal pixel values with white color on black background.
  4637. @item color
  4638. Draw hexadecimal pixel values with input video pixel color on black
  4639. background.
  4640. @item color2
  4641. Draw hexadecimal pixel values on color background picked from input video,
  4642. the text color is picked in such way so its always visible.
  4643. @end table
  4644. @item axis
  4645. Draw rows and columns numbers on left and top of video.
  4646. @end table
  4647. @section dctdnoiz
  4648. Denoise frames using 2D DCT (frequency domain filtering).
  4649. This filter is not designed for real time.
  4650. The filter accepts the following options:
  4651. @table @option
  4652. @item sigma, s
  4653. Set the noise sigma constant.
  4654. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4655. coefficient (absolute value) below this threshold with be dropped.
  4656. If you need a more advanced filtering, see @option{expr}.
  4657. Default is @code{0}.
  4658. @item overlap
  4659. Set number overlapping pixels for each block. Since the filter can be slow, you
  4660. may want to reduce this value, at the cost of a less effective filter and the
  4661. risk of various artefacts.
  4662. If the overlapping value doesn't permit processing the whole input width or
  4663. height, a warning will be displayed and according borders won't be denoised.
  4664. Default value is @var{blocksize}-1, which is the best possible setting.
  4665. @item expr, e
  4666. Set the coefficient factor expression.
  4667. For each coefficient of a DCT block, this expression will be evaluated as a
  4668. multiplier value for the coefficient.
  4669. If this is option is set, the @option{sigma} option will be ignored.
  4670. The absolute value of the coefficient can be accessed through the @var{c}
  4671. variable.
  4672. @item n
  4673. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4674. @var{blocksize}, which is the width and height of the processed blocks.
  4675. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4676. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4677. on the speed processing. Also, a larger block size does not necessarily means a
  4678. better de-noising.
  4679. @end table
  4680. @subsection Examples
  4681. Apply a denoise with a @option{sigma} of @code{4.5}:
  4682. @example
  4683. dctdnoiz=4.5
  4684. @end example
  4685. The same operation can be achieved using the expression system:
  4686. @example
  4687. dctdnoiz=e='gte(c, 4.5*3)'
  4688. @end example
  4689. Violent denoise using a block size of @code{16x16}:
  4690. @example
  4691. dctdnoiz=15:n=4
  4692. @end example
  4693. @section deband
  4694. Remove banding artifacts from input video.
  4695. It works by replacing banded pixels with average value of referenced pixels.
  4696. The filter accepts the following options:
  4697. @table @option
  4698. @item 1thr
  4699. @item 2thr
  4700. @item 3thr
  4701. @item 4thr
  4702. Set banding detection threshold for each plane. Default is 0.02.
  4703. Valid range is 0.00003 to 0.5.
  4704. If difference between current pixel and reference pixel is less than threshold,
  4705. it will be considered as banded.
  4706. @item range, r
  4707. Banding detection range in pixels. Default is 16. If positive, random number
  4708. in range 0 to set value will be used. If negative, exact absolute value
  4709. will be used.
  4710. The range defines square of four pixels around current pixel.
  4711. @item direction, d
  4712. Set direction in radians from which four pixel will be compared. If positive,
  4713. random direction from 0 to set direction will be picked. If negative, exact of
  4714. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4715. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4716. column.
  4717. @item blur
  4718. If enabled, current pixel is compared with average value of all four
  4719. surrounding pixels. The default is enabled. If disabled current pixel is
  4720. compared with all four surrounding pixels. The pixel is considered banded
  4721. if only all four differences with surrounding pixels are less than threshold.
  4722. @end table
  4723. @anchor{decimate}
  4724. @section decimate
  4725. Drop duplicated frames at regular intervals.
  4726. The filter accepts the following options:
  4727. @table @option
  4728. @item cycle
  4729. Set the number of frames from which one will be dropped. Setting this to
  4730. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4731. Default is @code{5}.
  4732. @item dupthresh
  4733. Set the threshold for duplicate detection. If the difference metric for a frame
  4734. is less than or equal to this value, then it is declared as duplicate. Default
  4735. is @code{1.1}
  4736. @item scthresh
  4737. Set scene change threshold. Default is @code{15}.
  4738. @item blockx
  4739. @item blocky
  4740. Set the size of the x and y-axis blocks used during metric calculations.
  4741. Larger blocks give better noise suppression, but also give worse detection of
  4742. small movements. Must be a power of two. Default is @code{32}.
  4743. @item ppsrc
  4744. Mark main input as a pre-processed input and activate clean source input
  4745. stream. This allows the input to be pre-processed with various filters to help
  4746. the metrics calculation while keeping the frame selection lossless. When set to
  4747. @code{1}, the first stream is for the pre-processed input, and the second
  4748. stream is the clean source from where the kept frames are chosen. Default is
  4749. @code{0}.
  4750. @item chroma
  4751. Set whether or not chroma is considered in the metric calculations. Default is
  4752. @code{1}.
  4753. @end table
  4754. @section deflate
  4755. Apply deflate effect to the video.
  4756. This filter replaces the pixel by the local(3x3) average by taking into account
  4757. only values lower than the pixel.
  4758. It accepts the following options:
  4759. @table @option
  4760. @item threshold0
  4761. @item threshold1
  4762. @item threshold2
  4763. @item threshold3
  4764. Limit the maximum change for each plane, default is 65535.
  4765. If 0, plane will remain unchanged.
  4766. @end table
  4767. @section dejudder
  4768. Remove judder produced by partially interlaced telecined content.
  4769. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4770. source was partially telecined content then the output of @code{pullup,dejudder}
  4771. will have a variable frame rate. May change the recorded frame rate of the
  4772. container. Aside from that change, this filter will not affect constant frame
  4773. rate video.
  4774. The option available in this filter is:
  4775. @table @option
  4776. @item cycle
  4777. Specify the length of the window over which the judder repeats.
  4778. Accepts any integer greater than 1. Useful values are:
  4779. @table @samp
  4780. @item 4
  4781. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4782. @item 5
  4783. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4784. @item 20
  4785. If a mixture of the two.
  4786. @end table
  4787. The default is @samp{4}.
  4788. @end table
  4789. @section delogo
  4790. Suppress a TV station logo by a simple interpolation of the surrounding
  4791. pixels. Just set a rectangle covering the logo and watch it disappear
  4792. (and sometimes something even uglier appear - your mileage may vary).
  4793. It accepts the following parameters:
  4794. @table @option
  4795. @item x
  4796. @item y
  4797. Specify the top left corner coordinates of the logo. They must be
  4798. specified.
  4799. @item w
  4800. @item h
  4801. Specify the width and height of the logo to clear. They must be
  4802. specified.
  4803. @item band, t
  4804. Specify the thickness of the fuzzy edge of the rectangle (added to
  4805. @var{w} and @var{h}). The default value is 1. This option is
  4806. deprecated, setting higher values should no longer be necessary and
  4807. is not recommended.
  4808. @item show
  4809. When set to 1, a green rectangle is drawn on the screen to simplify
  4810. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4811. The default value is 0.
  4812. The rectangle is drawn on the outermost pixels which will be (partly)
  4813. replaced with interpolated values. The values of the next pixels
  4814. immediately outside this rectangle in each direction will be used to
  4815. compute the interpolated pixel values inside the rectangle.
  4816. @end table
  4817. @subsection Examples
  4818. @itemize
  4819. @item
  4820. Set a rectangle covering the area with top left corner coordinates 0,0
  4821. and size 100x77, and a band of size 10:
  4822. @example
  4823. delogo=x=0:y=0:w=100:h=77:band=10
  4824. @end example
  4825. @end itemize
  4826. @section deshake
  4827. Attempt to fix small changes in horizontal and/or vertical shift. This
  4828. filter helps remove camera shake from hand-holding a camera, bumping a
  4829. tripod, moving on a vehicle, etc.
  4830. The filter accepts the following options:
  4831. @table @option
  4832. @item x
  4833. @item y
  4834. @item w
  4835. @item h
  4836. Specify a rectangular area where to limit the search for motion
  4837. vectors.
  4838. If desired the search for motion vectors can be limited to a
  4839. rectangular area of the frame defined by its top left corner, width
  4840. and height. These parameters have the same meaning as the drawbox
  4841. filter which can be used to visualise the position of the bounding
  4842. box.
  4843. This is useful when simultaneous movement of subjects within the frame
  4844. might be confused for camera motion by the motion vector search.
  4845. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4846. then the full frame is used. This allows later options to be set
  4847. without specifying the bounding box for the motion vector search.
  4848. Default - search the whole frame.
  4849. @item rx
  4850. @item ry
  4851. Specify the maximum extent of movement in x and y directions in the
  4852. range 0-64 pixels. Default 16.
  4853. @item edge
  4854. Specify how to generate pixels to fill blanks at the edge of the
  4855. frame. Available values are:
  4856. @table @samp
  4857. @item blank, 0
  4858. Fill zeroes at blank locations
  4859. @item original, 1
  4860. Original image at blank locations
  4861. @item clamp, 2
  4862. Extruded edge value at blank locations
  4863. @item mirror, 3
  4864. Mirrored edge at blank locations
  4865. @end table
  4866. Default value is @samp{mirror}.
  4867. @item blocksize
  4868. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4869. default 8.
  4870. @item contrast
  4871. Specify the contrast threshold for blocks. Only blocks with more than
  4872. the specified contrast (difference between darkest and lightest
  4873. pixels) will be considered. Range 1-255, default 125.
  4874. @item search
  4875. Specify the search strategy. Available values are:
  4876. @table @samp
  4877. @item exhaustive, 0
  4878. Set exhaustive search
  4879. @item less, 1
  4880. Set less exhaustive search.
  4881. @end table
  4882. Default value is @samp{exhaustive}.
  4883. @item filename
  4884. If set then a detailed log of the motion search is written to the
  4885. specified file.
  4886. @item opencl
  4887. If set to 1, specify using OpenCL capabilities, only available if
  4888. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4889. @end table
  4890. @section detelecine
  4891. Apply an exact inverse of the telecine operation. It requires a predefined
  4892. pattern specified using the pattern option which must be the same as that passed
  4893. to the telecine filter.
  4894. This filter accepts the following options:
  4895. @table @option
  4896. @item first_field
  4897. @table @samp
  4898. @item top, t
  4899. top field first
  4900. @item bottom, b
  4901. bottom field first
  4902. The default value is @code{top}.
  4903. @end table
  4904. @item pattern
  4905. A string of numbers representing the pulldown pattern you wish to apply.
  4906. The default value is @code{23}.
  4907. @item start_frame
  4908. A number representing position of the first frame with respect to the telecine
  4909. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4910. @end table
  4911. @section dilation
  4912. Apply dilation effect to the video.
  4913. This filter replaces the pixel by the local(3x3) maximum.
  4914. It accepts the following options:
  4915. @table @option
  4916. @item threshold0
  4917. @item threshold1
  4918. @item threshold2
  4919. @item threshold3
  4920. Limit the maximum change for each plane, default is 65535.
  4921. If 0, plane will remain unchanged.
  4922. @item coordinates
  4923. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4924. pixels are used.
  4925. Flags to local 3x3 coordinates maps like this:
  4926. 1 2 3
  4927. 4 5
  4928. 6 7 8
  4929. @end table
  4930. @section displace
  4931. Displace pixels as indicated by second and third input stream.
  4932. It takes three input streams and outputs one stream, the first input is the
  4933. source, and second and third input are displacement maps.
  4934. The second input specifies how much to displace pixels along the
  4935. x-axis, while the third input specifies how much to displace pixels
  4936. along the y-axis.
  4937. If one of displacement map streams terminates, last frame from that
  4938. displacement map will be used.
  4939. Note that once generated, displacements maps can be reused over and over again.
  4940. A description of the accepted options follows.
  4941. @table @option
  4942. @item edge
  4943. Set displace behavior for pixels that are out of range.
  4944. Available values are:
  4945. @table @samp
  4946. @item blank
  4947. Missing pixels are replaced by black pixels.
  4948. @item smear
  4949. Adjacent pixels will spread out to replace missing pixels.
  4950. @item wrap
  4951. Out of range pixels are wrapped so they point to pixels of other side.
  4952. @end table
  4953. Default is @samp{smear}.
  4954. @end table
  4955. @subsection Examples
  4956. @itemize
  4957. @item
  4958. Add ripple effect to rgb input of video size hd720:
  4959. @example
  4960. 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
  4961. @end example
  4962. @item
  4963. Add wave effect to rgb input of video size hd720:
  4964. @example
  4965. 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
  4966. @end example
  4967. @end itemize
  4968. @section drawbox
  4969. Draw a colored box on the input image.
  4970. It accepts the following parameters:
  4971. @table @option
  4972. @item x
  4973. @item y
  4974. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4975. @item width, w
  4976. @item height, h
  4977. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4978. the input width and height. It defaults to 0.
  4979. @item color, c
  4980. Specify the color of the box to write. For the general syntax of this option,
  4981. check the "Color" section in the ffmpeg-utils manual. If the special
  4982. value @code{invert} is used, the box edge color is the same as the
  4983. video with inverted luma.
  4984. @item thickness, t
  4985. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4986. See below for the list of accepted constants.
  4987. @end table
  4988. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4989. following constants:
  4990. @table @option
  4991. @item dar
  4992. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4993. @item hsub
  4994. @item vsub
  4995. horizontal and vertical chroma subsample values. For example for the
  4996. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4997. @item in_h, ih
  4998. @item in_w, iw
  4999. The input width and height.
  5000. @item sar
  5001. The input sample aspect ratio.
  5002. @item x
  5003. @item y
  5004. The x and y offset coordinates where the box is drawn.
  5005. @item w
  5006. @item h
  5007. The width and height of the drawn box.
  5008. @item t
  5009. The thickness of the drawn box.
  5010. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5011. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5012. @end table
  5013. @subsection Examples
  5014. @itemize
  5015. @item
  5016. Draw a black box around the edge of the input image:
  5017. @example
  5018. drawbox
  5019. @end example
  5020. @item
  5021. Draw a box with color red and an opacity of 50%:
  5022. @example
  5023. drawbox=10:20:200:60:red@@0.5
  5024. @end example
  5025. The previous example can be specified as:
  5026. @example
  5027. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5028. @end example
  5029. @item
  5030. Fill the box with pink color:
  5031. @example
  5032. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5033. @end example
  5034. @item
  5035. Draw a 2-pixel red 2.40:1 mask:
  5036. @example
  5037. 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
  5038. @end example
  5039. @end itemize
  5040. @section drawgrid
  5041. Draw a grid on the input image.
  5042. It accepts the following parameters:
  5043. @table @option
  5044. @item x
  5045. @item y
  5046. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5047. @item width, w
  5048. @item height, h
  5049. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5050. input width and height, respectively, minus @code{thickness}, so image gets
  5051. framed. Default to 0.
  5052. @item color, c
  5053. Specify the color of the grid. For the general syntax of this option,
  5054. check the "Color" section in the ffmpeg-utils manual. If the special
  5055. value @code{invert} is used, the grid color is the same as the
  5056. video with inverted luma.
  5057. @item thickness, t
  5058. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5059. See below for the list of accepted constants.
  5060. @end table
  5061. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5062. following constants:
  5063. @table @option
  5064. @item dar
  5065. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5066. @item hsub
  5067. @item vsub
  5068. horizontal and vertical chroma subsample values. For example for the
  5069. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5070. @item in_h, ih
  5071. @item in_w, iw
  5072. The input grid cell width and height.
  5073. @item sar
  5074. The input sample aspect ratio.
  5075. @item x
  5076. @item y
  5077. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5078. @item w
  5079. @item h
  5080. The width and height of the drawn cell.
  5081. @item t
  5082. The thickness of the drawn cell.
  5083. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5084. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5085. @end table
  5086. @subsection Examples
  5087. @itemize
  5088. @item
  5089. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5090. @example
  5091. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5092. @end example
  5093. @item
  5094. Draw a white 3x3 grid with an opacity of 50%:
  5095. @example
  5096. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5097. @end example
  5098. @end itemize
  5099. @anchor{drawtext}
  5100. @section drawtext
  5101. Draw a text string or text from a specified file on top of a video, using the
  5102. libfreetype library.
  5103. To enable compilation of this filter, you need to configure FFmpeg with
  5104. @code{--enable-libfreetype}.
  5105. To enable default font fallback and the @var{font} option you need to
  5106. configure FFmpeg with @code{--enable-libfontconfig}.
  5107. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5108. @code{--enable-libfribidi}.
  5109. @subsection Syntax
  5110. It accepts the following parameters:
  5111. @table @option
  5112. @item box
  5113. Used to draw a box around text using the background color.
  5114. The value must be either 1 (enable) or 0 (disable).
  5115. The default value of @var{box} is 0.
  5116. @item boxborderw
  5117. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5118. The default value of @var{boxborderw} is 0.
  5119. @item boxcolor
  5120. The color to be used for drawing box around text. For the syntax of this
  5121. option, check the "Color" section in the ffmpeg-utils manual.
  5122. The default value of @var{boxcolor} is "white".
  5123. @item borderw
  5124. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5125. The default value of @var{borderw} is 0.
  5126. @item bordercolor
  5127. Set the color to be used for drawing border around text. For the syntax of this
  5128. option, check the "Color" section in the ffmpeg-utils manual.
  5129. The default value of @var{bordercolor} is "black".
  5130. @item expansion
  5131. Select how the @var{text} is expanded. Can be either @code{none},
  5132. @code{strftime} (deprecated) or
  5133. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5134. below for details.
  5135. @item fix_bounds
  5136. If true, check and fix text coords to avoid clipping.
  5137. @item fontcolor
  5138. The color to be used for drawing fonts. For the syntax of this option, check
  5139. the "Color" section in the ffmpeg-utils manual.
  5140. The default value of @var{fontcolor} is "black".
  5141. @item fontcolor_expr
  5142. String which is expanded the same way as @var{text} to obtain dynamic
  5143. @var{fontcolor} value. By default this option has empty value and is not
  5144. processed. When this option is set, it overrides @var{fontcolor} option.
  5145. @item font
  5146. The font family to be used for drawing text. By default Sans.
  5147. @item fontfile
  5148. The font file to be used for drawing text. The path must be included.
  5149. This parameter is mandatory if the fontconfig support is disabled.
  5150. @item draw
  5151. This option does not exist, please see the timeline system
  5152. @item alpha
  5153. Draw the text applying alpha blending. The value can
  5154. be either a number between 0.0 and 1.0
  5155. The expression accepts the same variables @var{x, y} do.
  5156. The default value is 1.
  5157. Please see fontcolor_expr
  5158. @item fontsize
  5159. The font size to be used for drawing text.
  5160. The default value of @var{fontsize} is 16.
  5161. @item text_shaping
  5162. If set to 1, attempt to shape the text (for example, reverse the order of
  5163. right-to-left text and join Arabic characters) before drawing it.
  5164. Otherwise, just draw the text exactly as given.
  5165. By default 1 (if supported).
  5166. @item ft_load_flags
  5167. The flags to be used for loading the fonts.
  5168. The flags map the corresponding flags supported by libfreetype, and are
  5169. a combination of the following values:
  5170. @table @var
  5171. @item default
  5172. @item no_scale
  5173. @item no_hinting
  5174. @item render
  5175. @item no_bitmap
  5176. @item vertical_layout
  5177. @item force_autohint
  5178. @item crop_bitmap
  5179. @item pedantic
  5180. @item ignore_global_advance_width
  5181. @item no_recurse
  5182. @item ignore_transform
  5183. @item monochrome
  5184. @item linear_design
  5185. @item no_autohint
  5186. @end table
  5187. Default value is "default".
  5188. For more information consult the documentation for the FT_LOAD_*
  5189. libfreetype flags.
  5190. @item shadowcolor
  5191. The color to be used for drawing a shadow behind the drawn text. For the
  5192. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5193. The default value of @var{shadowcolor} is "black".
  5194. @item shadowx
  5195. @item shadowy
  5196. The x and y offsets for the text shadow position with respect to the
  5197. position of the text. They can be either positive or negative
  5198. values. The default value for both is "0".
  5199. @item start_number
  5200. The starting frame number for the n/frame_num variable. The default value
  5201. is "0".
  5202. @item tabsize
  5203. The size in number of spaces to use for rendering the tab.
  5204. Default value is 4.
  5205. @item timecode
  5206. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5207. format. It can be used with or without text parameter. @var{timecode_rate}
  5208. option must be specified.
  5209. @item timecode_rate, rate, r
  5210. Set the timecode frame rate (timecode only).
  5211. @item text
  5212. The text string to be drawn. The text must be a sequence of UTF-8
  5213. encoded characters.
  5214. This parameter is mandatory if no file is specified with the parameter
  5215. @var{textfile}.
  5216. @item textfile
  5217. A text file containing text to be drawn. The text must be a sequence
  5218. of UTF-8 encoded characters.
  5219. This parameter is mandatory if no text string is specified with the
  5220. parameter @var{text}.
  5221. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5222. @item reload
  5223. If set to 1, the @var{textfile} will be reloaded before each frame.
  5224. Be sure to update it atomically, or it may be read partially, or even fail.
  5225. @item x
  5226. @item y
  5227. The expressions which specify the offsets where text will be drawn
  5228. within the video frame. They are relative to the top/left border of the
  5229. output image.
  5230. The default value of @var{x} and @var{y} is "0".
  5231. See below for the list of accepted constants and functions.
  5232. @end table
  5233. The parameters for @var{x} and @var{y} are expressions containing the
  5234. following constants and functions:
  5235. @table @option
  5236. @item dar
  5237. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5238. @item hsub
  5239. @item vsub
  5240. horizontal and vertical chroma subsample values. For example for the
  5241. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5242. @item line_h, lh
  5243. the height of each text line
  5244. @item main_h, h, H
  5245. the input height
  5246. @item main_w, w, W
  5247. the input width
  5248. @item max_glyph_a, ascent
  5249. the maximum distance from the baseline to the highest/upper grid
  5250. coordinate used to place a glyph outline point, for all the rendered
  5251. glyphs.
  5252. It is a positive value, due to the grid's orientation with the Y axis
  5253. upwards.
  5254. @item max_glyph_d, descent
  5255. the maximum distance from the baseline to the lowest grid coordinate
  5256. used to place a glyph outline point, for all the rendered glyphs.
  5257. This is a negative value, due to the grid's orientation, with the Y axis
  5258. upwards.
  5259. @item max_glyph_h
  5260. maximum glyph height, that is the maximum height for all the glyphs
  5261. contained in the rendered text, it is equivalent to @var{ascent} -
  5262. @var{descent}.
  5263. @item max_glyph_w
  5264. maximum glyph width, that is the maximum width for all the glyphs
  5265. contained in the rendered text
  5266. @item n
  5267. the number of input frame, starting from 0
  5268. @item rand(min, max)
  5269. return a random number included between @var{min} and @var{max}
  5270. @item sar
  5271. The input sample aspect ratio.
  5272. @item t
  5273. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5274. @item text_h, th
  5275. the height of the rendered text
  5276. @item text_w, tw
  5277. the width of the rendered text
  5278. @item x
  5279. @item y
  5280. the x and y offset coordinates where the text is drawn.
  5281. These parameters allow the @var{x} and @var{y} expressions to refer
  5282. each other, so you can for example specify @code{y=x/dar}.
  5283. @end table
  5284. @anchor{drawtext_expansion}
  5285. @subsection Text expansion
  5286. If @option{expansion} is set to @code{strftime},
  5287. the filter recognizes strftime() sequences in the provided text and
  5288. expands them accordingly. Check the documentation of strftime(). This
  5289. feature is deprecated.
  5290. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5291. If @option{expansion} is set to @code{normal} (which is the default),
  5292. the following expansion mechanism is used.
  5293. The backslash character @samp{\}, followed by any character, always expands to
  5294. the second character.
  5295. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5296. braces is a function name, possibly followed by arguments separated by ':'.
  5297. If the arguments contain special characters or delimiters (':' or '@}'),
  5298. they should be escaped.
  5299. Note that they probably must also be escaped as the value for the
  5300. @option{text} option in the filter argument string and as the filter
  5301. argument in the filtergraph description, and possibly also for the shell,
  5302. that makes up to four levels of escaping; using a text file avoids these
  5303. problems.
  5304. The following functions are available:
  5305. @table @command
  5306. @item expr, e
  5307. The expression evaluation result.
  5308. It must take one argument specifying the expression to be evaluated,
  5309. which accepts the same constants and functions as the @var{x} and
  5310. @var{y} values. Note that not all constants should be used, for
  5311. example the text size is not known when evaluating the expression, so
  5312. the constants @var{text_w} and @var{text_h} will have an undefined
  5313. value.
  5314. @item expr_int_format, eif
  5315. Evaluate the expression's value and output as formatted integer.
  5316. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5317. The second argument specifies the output format. Allowed values are @samp{x},
  5318. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5319. @code{printf} function.
  5320. The third parameter is optional and sets the number of positions taken by the output.
  5321. It can be used to add padding with zeros from the left.
  5322. @item gmtime
  5323. The time at which the filter is running, expressed in UTC.
  5324. It can accept an argument: a strftime() format string.
  5325. @item localtime
  5326. The time at which the filter is running, expressed in the local time zone.
  5327. It can accept an argument: a strftime() format string.
  5328. @item metadata
  5329. Frame metadata. Takes one or two arguments.
  5330. The first argument is mandatory and specifies the metadata key.
  5331. The second argument is optional and specifies a default value, used when the
  5332. metadata key is not found or empty.
  5333. @item n, frame_num
  5334. The frame number, starting from 0.
  5335. @item pict_type
  5336. A 1 character description of the current picture type.
  5337. @item pts
  5338. The timestamp of the current frame.
  5339. It can take up to three arguments.
  5340. The first argument is the format of the timestamp; it defaults to @code{flt}
  5341. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5342. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5343. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5344. @code{localtime} stands for the timestamp of the frame formatted as
  5345. local time zone time.
  5346. The second argument is an offset added to the timestamp.
  5347. If the format is set to @code{localtime} or @code{gmtime},
  5348. a third argument may be supplied: a strftime() format string.
  5349. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5350. @end table
  5351. @subsection Examples
  5352. @itemize
  5353. @item
  5354. Draw "Test Text" with font FreeSerif, using the default values for the
  5355. optional parameters.
  5356. @example
  5357. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5358. @end example
  5359. @item
  5360. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5361. and y=50 (counting from the top-left corner of the screen), text is
  5362. yellow with a red box around it. Both the text and the box have an
  5363. opacity of 20%.
  5364. @example
  5365. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5366. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5367. @end example
  5368. Note that the double quotes are not necessary if spaces are not used
  5369. within the parameter list.
  5370. @item
  5371. Show the text at the center of the video frame:
  5372. @example
  5373. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5374. @end example
  5375. @item
  5376. Show the text at a random position, switching to a new position every 30 seconds:
  5377. @example
  5378. 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)"
  5379. @end example
  5380. @item
  5381. Show a text line sliding from right to left in the last row of the video
  5382. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5383. with no newlines.
  5384. @example
  5385. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5386. @end example
  5387. @item
  5388. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5389. @example
  5390. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5391. @end example
  5392. @item
  5393. Draw a single green letter "g", at the center of the input video.
  5394. The glyph baseline is placed at half screen height.
  5395. @example
  5396. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5397. @end example
  5398. @item
  5399. Show text for 1 second every 3 seconds:
  5400. @example
  5401. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5402. @end example
  5403. @item
  5404. Use fontconfig to set the font. Note that the colons need to be escaped.
  5405. @example
  5406. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5407. @end example
  5408. @item
  5409. Print the date of a real-time encoding (see strftime(3)):
  5410. @example
  5411. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5412. @end example
  5413. @item
  5414. Show text fading in and out (appearing/disappearing):
  5415. @example
  5416. #!/bin/sh
  5417. DS=1.0 # display start
  5418. DE=10.0 # display end
  5419. FID=1.5 # fade in duration
  5420. FOD=5 # fade out duration
  5421. 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 @}"
  5422. @end example
  5423. @end itemize
  5424. For more information about libfreetype, check:
  5425. @url{http://www.freetype.org/}.
  5426. For more information about fontconfig, check:
  5427. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5428. For more information about libfribidi, check:
  5429. @url{http://fribidi.org/}.
  5430. @section edgedetect
  5431. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5432. The filter accepts the following options:
  5433. @table @option
  5434. @item low
  5435. @item high
  5436. Set low and high threshold values used by the Canny thresholding
  5437. algorithm.
  5438. The high threshold selects the "strong" edge pixels, which are then
  5439. connected through 8-connectivity with the "weak" edge pixels selected
  5440. by the low threshold.
  5441. @var{low} and @var{high} threshold values must be chosen in the range
  5442. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5443. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5444. is @code{50/255}.
  5445. @item mode
  5446. Define the drawing mode.
  5447. @table @samp
  5448. @item wires
  5449. Draw white/gray wires on black background.
  5450. @item colormix
  5451. Mix the colors to create a paint/cartoon effect.
  5452. @end table
  5453. Default value is @var{wires}.
  5454. @end table
  5455. @subsection Examples
  5456. @itemize
  5457. @item
  5458. Standard edge detection with custom values for the hysteresis thresholding:
  5459. @example
  5460. edgedetect=low=0.1:high=0.4
  5461. @end example
  5462. @item
  5463. Painting effect without thresholding:
  5464. @example
  5465. edgedetect=mode=colormix:high=0
  5466. @end example
  5467. @end itemize
  5468. @section eq
  5469. Set brightness, contrast, saturation and approximate gamma adjustment.
  5470. The filter accepts the following options:
  5471. @table @option
  5472. @item contrast
  5473. Set the contrast expression. The value must be a float value in range
  5474. @code{-2.0} to @code{2.0}. The default value is "1".
  5475. @item brightness
  5476. Set the brightness expression. The value must be a float value in
  5477. range @code{-1.0} to @code{1.0}. The default value is "0".
  5478. @item saturation
  5479. Set the saturation expression. The value must be a float in
  5480. range @code{0.0} to @code{3.0}. The default value is "1".
  5481. @item gamma
  5482. Set the gamma expression. The value must be a float in range
  5483. @code{0.1} to @code{10.0}. The default value is "1".
  5484. @item gamma_r
  5485. Set the gamma expression for red. The value must be a float in
  5486. range @code{0.1} to @code{10.0}. The default value is "1".
  5487. @item gamma_g
  5488. Set the gamma expression for green. The value must be a float in range
  5489. @code{0.1} to @code{10.0}. The default value is "1".
  5490. @item gamma_b
  5491. Set the gamma expression for blue. The value must be a float in range
  5492. @code{0.1} to @code{10.0}. The default value is "1".
  5493. @item gamma_weight
  5494. Set the gamma weight expression. It can be used to reduce the effect
  5495. of a high gamma value on bright image areas, e.g. keep them from
  5496. getting overamplified and just plain white. The value must be a float
  5497. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5498. gamma correction all the way down while @code{1.0} leaves it at its
  5499. full strength. Default is "1".
  5500. @item eval
  5501. Set when the expressions for brightness, contrast, saturation and
  5502. gamma expressions are evaluated.
  5503. It accepts the following values:
  5504. @table @samp
  5505. @item init
  5506. only evaluate expressions once during the filter initialization or
  5507. when a command is processed
  5508. @item frame
  5509. evaluate expressions for each incoming frame
  5510. @end table
  5511. Default value is @samp{init}.
  5512. @end table
  5513. The expressions accept the following parameters:
  5514. @table @option
  5515. @item n
  5516. frame count of the input frame starting from 0
  5517. @item pos
  5518. byte position of the corresponding packet in the input file, NAN if
  5519. unspecified
  5520. @item r
  5521. frame rate of the input video, NAN if the input frame rate is unknown
  5522. @item t
  5523. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5524. @end table
  5525. @subsection Commands
  5526. The filter supports the following commands:
  5527. @table @option
  5528. @item contrast
  5529. Set the contrast expression.
  5530. @item brightness
  5531. Set the brightness expression.
  5532. @item saturation
  5533. Set the saturation expression.
  5534. @item gamma
  5535. Set the gamma expression.
  5536. @item gamma_r
  5537. Set the gamma_r expression.
  5538. @item gamma_g
  5539. Set gamma_g expression.
  5540. @item gamma_b
  5541. Set gamma_b expression.
  5542. @item gamma_weight
  5543. Set gamma_weight expression.
  5544. The command accepts the same syntax of the corresponding option.
  5545. If the specified expression is not valid, it is kept at its current
  5546. value.
  5547. @end table
  5548. @section erosion
  5549. Apply erosion effect to the video.
  5550. This filter replaces the pixel by the local(3x3) minimum.
  5551. It accepts the following options:
  5552. @table @option
  5553. @item threshold0
  5554. @item threshold1
  5555. @item threshold2
  5556. @item threshold3
  5557. Limit the maximum change for each plane, default is 65535.
  5558. If 0, plane will remain unchanged.
  5559. @item coordinates
  5560. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5561. pixels are used.
  5562. Flags to local 3x3 coordinates maps like this:
  5563. 1 2 3
  5564. 4 5
  5565. 6 7 8
  5566. @end table
  5567. @section extractplanes
  5568. Extract color channel components from input video stream into
  5569. separate grayscale video streams.
  5570. The filter accepts the following option:
  5571. @table @option
  5572. @item planes
  5573. Set plane(s) to extract.
  5574. Available values for planes are:
  5575. @table @samp
  5576. @item y
  5577. @item u
  5578. @item v
  5579. @item a
  5580. @item r
  5581. @item g
  5582. @item b
  5583. @end table
  5584. Choosing planes not available in the input will result in an error.
  5585. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5586. with @code{y}, @code{u}, @code{v} planes at same time.
  5587. @end table
  5588. @subsection Examples
  5589. @itemize
  5590. @item
  5591. Extract luma, u and v color channel component from input video frame
  5592. into 3 grayscale outputs:
  5593. @example
  5594. 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
  5595. @end example
  5596. @end itemize
  5597. @section elbg
  5598. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5599. For each input image, the filter will compute the optimal mapping from
  5600. the input to the output given the codebook length, that is the number
  5601. of distinct output colors.
  5602. This filter accepts the following options.
  5603. @table @option
  5604. @item codebook_length, l
  5605. Set codebook length. The value must be a positive integer, and
  5606. represents the number of distinct output colors. Default value is 256.
  5607. @item nb_steps, n
  5608. Set the maximum number of iterations to apply for computing the optimal
  5609. mapping. The higher the value the better the result and the higher the
  5610. computation time. Default value is 1.
  5611. @item seed, s
  5612. Set a random seed, must be an integer included between 0 and
  5613. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5614. will try to use a good random seed on a best effort basis.
  5615. @item pal8
  5616. Set pal8 output pixel format. This option does not work with codebook
  5617. length greater than 256.
  5618. @end table
  5619. @section fade
  5620. Apply a fade-in/out effect to the input video.
  5621. It accepts the following parameters:
  5622. @table @option
  5623. @item type, t
  5624. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5625. effect.
  5626. Default is @code{in}.
  5627. @item start_frame, s
  5628. Specify the number of the frame to start applying the fade
  5629. effect at. Default is 0.
  5630. @item nb_frames, n
  5631. The number of frames that the fade effect lasts. At the end of the
  5632. fade-in effect, the output video will have the same intensity as the input video.
  5633. At the end of the fade-out transition, the output video will be filled with the
  5634. selected @option{color}.
  5635. Default is 25.
  5636. @item alpha
  5637. If set to 1, fade only alpha channel, if one exists on the input.
  5638. Default value is 0.
  5639. @item start_time, st
  5640. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5641. effect. If both start_frame and start_time are specified, the fade will start at
  5642. whichever comes last. Default is 0.
  5643. @item duration, d
  5644. The number of seconds for which the fade effect has to last. At the end of the
  5645. fade-in effect the output video will have the same intensity as the input video,
  5646. at the end of the fade-out transition the output video will be filled with the
  5647. selected @option{color}.
  5648. If both duration and nb_frames are specified, duration is used. Default is 0
  5649. (nb_frames is used by default).
  5650. @item color, c
  5651. Specify the color of the fade. Default is "black".
  5652. @end table
  5653. @subsection Examples
  5654. @itemize
  5655. @item
  5656. Fade in the first 30 frames of video:
  5657. @example
  5658. fade=in:0:30
  5659. @end example
  5660. The command above is equivalent to:
  5661. @example
  5662. fade=t=in:s=0:n=30
  5663. @end example
  5664. @item
  5665. Fade out the last 45 frames of a 200-frame video:
  5666. @example
  5667. fade=out:155:45
  5668. fade=type=out:start_frame=155:nb_frames=45
  5669. @end example
  5670. @item
  5671. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5672. @example
  5673. fade=in:0:25, fade=out:975:25
  5674. @end example
  5675. @item
  5676. Make the first 5 frames yellow, then fade in from frame 5-24:
  5677. @example
  5678. fade=in:5:20:color=yellow
  5679. @end example
  5680. @item
  5681. Fade in alpha over first 25 frames of video:
  5682. @example
  5683. fade=in:0:25:alpha=1
  5684. @end example
  5685. @item
  5686. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5687. @example
  5688. fade=t=in:st=5.5:d=0.5
  5689. @end example
  5690. @end itemize
  5691. @section fftfilt
  5692. Apply arbitrary expressions to samples in frequency domain
  5693. @table @option
  5694. @item dc_Y
  5695. Adjust the dc value (gain) of the luma plane of the image. The filter
  5696. accepts an integer value in range @code{0} to @code{1000}. The default
  5697. value is set to @code{0}.
  5698. @item dc_U
  5699. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5700. filter accepts an integer value in range @code{0} to @code{1000}. The
  5701. default value is set to @code{0}.
  5702. @item dc_V
  5703. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5704. filter accepts an integer value in range @code{0} to @code{1000}. The
  5705. default value is set to @code{0}.
  5706. @item weight_Y
  5707. Set the frequency domain weight expression for the luma plane.
  5708. @item weight_U
  5709. Set the frequency domain weight expression for the 1st chroma plane.
  5710. @item weight_V
  5711. Set the frequency domain weight expression for the 2nd chroma plane.
  5712. The filter accepts the following variables:
  5713. @item X
  5714. @item Y
  5715. The coordinates of the current sample.
  5716. @item W
  5717. @item H
  5718. The width and height of the image.
  5719. @end table
  5720. @subsection Examples
  5721. @itemize
  5722. @item
  5723. High-pass:
  5724. @example
  5725. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5726. @end example
  5727. @item
  5728. Low-pass:
  5729. @example
  5730. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5731. @end example
  5732. @item
  5733. Sharpen:
  5734. @example
  5735. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5736. @end example
  5737. @item
  5738. Blur:
  5739. @example
  5740. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5741. @end example
  5742. @end itemize
  5743. @section field
  5744. Extract a single field from an interlaced image using stride
  5745. arithmetic to avoid wasting CPU time. The output frames are marked as
  5746. non-interlaced.
  5747. The filter accepts the following options:
  5748. @table @option
  5749. @item type
  5750. Specify whether to extract the top (if the value is @code{0} or
  5751. @code{top}) or the bottom field (if the value is @code{1} or
  5752. @code{bottom}).
  5753. @end table
  5754. @section fieldhint
  5755. Create new frames by copying the top and bottom fields from surrounding frames
  5756. supplied as numbers by the hint file.
  5757. @table @option
  5758. @item hint
  5759. Set file containing hints: absolute/relative frame numbers.
  5760. There must be one line for each frame in a clip. Each line must contain two
  5761. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5762. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5763. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5764. for @code{relative} mode. First number tells from which frame to pick up top
  5765. field and second number tells from which frame to pick up bottom field.
  5766. If optionally followed by @code{+} output frame will be marked as interlaced,
  5767. else if followed by @code{-} output frame will be marked as progressive, else
  5768. it will be marked same as input frame.
  5769. If line starts with @code{#} or @code{;} that line is skipped.
  5770. @item mode
  5771. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5772. @end table
  5773. Example of first several lines of @code{hint} file for @code{relative} mode:
  5774. @example
  5775. 0,0 - # first frame
  5776. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5777. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5778. 1,0 -
  5779. 0,0 -
  5780. 0,0 -
  5781. 1,0 -
  5782. 1,0 -
  5783. 1,0 -
  5784. 0,0 -
  5785. 0,0 -
  5786. 1,0 -
  5787. 1,0 -
  5788. 1,0 -
  5789. 0,0 -
  5790. @end example
  5791. @section fieldmatch
  5792. Field matching filter for inverse telecine. It is meant to reconstruct the
  5793. progressive frames from a telecined stream. The filter does not drop duplicated
  5794. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5795. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5796. The separation of the field matching and the decimation is notably motivated by
  5797. the possibility of inserting a de-interlacing filter fallback between the two.
  5798. If the source has mixed telecined and real interlaced content,
  5799. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5800. But these remaining combed frames will be marked as interlaced, and thus can be
  5801. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5802. In addition to the various configuration options, @code{fieldmatch} can take an
  5803. optional second stream, activated through the @option{ppsrc} option. If
  5804. enabled, the frames reconstruction will be based on the fields and frames from
  5805. this second stream. This allows the first input to be pre-processed in order to
  5806. help the various algorithms of the filter, while keeping the output lossless
  5807. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5808. or brightness/contrast adjustments can help.
  5809. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5810. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5811. which @code{fieldmatch} is based on. While the semantic and usage are very
  5812. close, some behaviour and options names can differ.
  5813. The @ref{decimate} filter currently only works for constant frame rate input.
  5814. If your input has mixed telecined (30fps) and progressive content with a lower
  5815. framerate like 24fps use the following filterchain to produce the necessary cfr
  5816. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5817. The filter accepts the following options:
  5818. @table @option
  5819. @item order
  5820. Specify the assumed field order of the input stream. Available values are:
  5821. @table @samp
  5822. @item auto
  5823. Auto detect parity (use FFmpeg's internal parity value).
  5824. @item bff
  5825. Assume bottom field first.
  5826. @item tff
  5827. Assume top field first.
  5828. @end table
  5829. Note that it is sometimes recommended not to trust the parity announced by the
  5830. stream.
  5831. Default value is @var{auto}.
  5832. @item mode
  5833. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5834. sense that it won't risk creating jerkiness due to duplicate frames when
  5835. possible, but if there are bad edits or blended fields it will end up
  5836. outputting combed frames when a good match might actually exist. On the other
  5837. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5838. but will almost always find a good frame if there is one. The other values are
  5839. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5840. jerkiness and creating duplicate frames versus finding good matches in sections
  5841. with bad edits, orphaned fields, blended fields, etc.
  5842. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5843. Available values are:
  5844. @table @samp
  5845. @item pc
  5846. 2-way matching (p/c)
  5847. @item pc_n
  5848. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5849. @item pc_u
  5850. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5851. @item pc_n_ub
  5852. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5853. still combed (p/c + n + u/b)
  5854. @item pcn
  5855. 3-way matching (p/c/n)
  5856. @item pcn_ub
  5857. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5858. detected as combed (p/c/n + u/b)
  5859. @end table
  5860. The parenthesis at the end indicate the matches that would be used for that
  5861. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5862. @var{top}).
  5863. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5864. the slowest.
  5865. Default value is @var{pc_n}.
  5866. @item ppsrc
  5867. Mark the main input stream as a pre-processed input, and enable the secondary
  5868. input stream as the clean source to pick the fields from. See the filter
  5869. introduction for more details. It is similar to the @option{clip2} feature from
  5870. VFM/TFM.
  5871. Default value is @code{0} (disabled).
  5872. @item field
  5873. Set the field to match from. It is recommended to set this to the same value as
  5874. @option{order} unless you experience matching failures with that setting. In
  5875. certain circumstances changing the field that is used to match from can have a
  5876. large impact on matching performance. Available values are:
  5877. @table @samp
  5878. @item auto
  5879. Automatic (same value as @option{order}).
  5880. @item bottom
  5881. Match from the bottom field.
  5882. @item top
  5883. Match from the top field.
  5884. @end table
  5885. Default value is @var{auto}.
  5886. @item mchroma
  5887. Set whether or not chroma is included during the match comparisons. In most
  5888. cases it is recommended to leave this enabled. You should set this to @code{0}
  5889. only if your clip has bad chroma problems such as heavy rainbowing or other
  5890. artifacts. Setting this to @code{0} could also be used to speed things up at
  5891. the cost of some accuracy.
  5892. Default value is @code{1}.
  5893. @item y0
  5894. @item y1
  5895. These define an exclusion band which excludes the lines between @option{y0} and
  5896. @option{y1} from being included in the field matching decision. An exclusion
  5897. band can be used to ignore subtitles, a logo, or other things that may
  5898. interfere with the matching. @option{y0} sets the starting scan line and
  5899. @option{y1} sets the ending line; all lines in between @option{y0} and
  5900. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5901. @option{y0} and @option{y1} to the same value will disable the feature.
  5902. @option{y0} and @option{y1} defaults to @code{0}.
  5903. @item scthresh
  5904. Set the scene change detection threshold as a percentage of maximum change on
  5905. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5906. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5907. @option{scthresh} is @code{[0.0, 100.0]}.
  5908. Default value is @code{12.0}.
  5909. @item combmatch
  5910. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5911. account the combed scores of matches when deciding what match to use as the
  5912. final match. Available values are:
  5913. @table @samp
  5914. @item none
  5915. No final matching based on combed scores.
  5916. @item sc
  5917. Combed scores are only used when a scene change is detected.
  5918. @item full
  5919. Use combed scores all the time.
  5920. @end table
  5921. Default is @var{sc}.
  5922. @item combdbg
  5923. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5924. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5925. Available values are:
  5926. @table @samp
  5927. @item none
  5928. No forced calculation.
  5929. @item pcn
  5930. Force p/c/n calculations.
  5931. @item pcnub
  5932. Force p/c/n/u/b calculations.
  5933. @end table
  5934. Default value is @var{none}.
  5935. @item cthresh
  5936. This is the area combing threshold used for combed frame detection. This
  5937. essentially controls how "strong" or "visible" combing must be to be detected.
  5938. Larger values mean combing must be more visible and smaller values mean combing
  5939. can be less visible or strong and still be detected. Valid settings are from
  5940. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5941. be detected as combed). This is basically a pixel difference value. A good
  5942. range is @code{[8, 12]}.
  5943. Default value is @code{9}.
  5944. @item chroma
  5945. Sets whether or not chroma is considered in the combed frame decision. Only
  5946. disable this if your source has chroma problems (rainbowing, etc.) that are
  5947. causing problems for the combed frame detection with chroma enabled. Actually,
  5948. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5949. where there is chroma only combing in the source.
  5950. Default value is @code{0}.
  5951. @item blockx
  5952. @item blocky
  5953. Respectively set the x-axis and y-axis size of the window used during combed
  5954. frame detection. This has to do with the size of the area in which
  5955. @option{combpel} pixels are required to be detected as combed for a frame to be
  5956. declared combed. See the @option{combpel} parameter description for more info.
  5957. Possible values are any number that is a power of 2 starting at 4 and going up
  5958. to 512.
  5959. Default value is @code{16}.
  5960. @item combpel
  5961. The number of combed pixels inside any of the @option{blocky} by
  5962. @option{blockx} size blocks on the frame for the frame to be detected as
  5963. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5964. setting controls "how much" combing there must be in any localized area (a
  5965. window defined by the @option{blockx} and @option{blocky} settings) on the
  5966. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5967. which point no frames will ever be detected as combed). This setting is known
  5968. as @option{MI} in TFM/VFM vocabulary.
  5969. Default value is @code{80}.
  5970. @end table
  5971. @anchor{p/c/n/u/b meaning}
  5972. @subsection p/c/n/u/b meaning
  5973. @subsubsection p/c/n
  5974. We assume the following telecined stream:
  5975. @example
  5976. Top fields: 1 2 2 3 4
  5977. Bottom fields: 1 2 3 4 4
  5978. @end example
  5979. The numbers correspond to the progressive frame the fields relate to. Here, the
  5980. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5981. When @code{fieldmatch} is configured to run a matching from bottom
  5982. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5983. @example
  5984. Input stream:
  5985. T 1 2 2 3 4
  5986. B 1 2 3 4 4 <-- matching reference
  5987. Matches: c c n n c
  5988. Output stream:
  5989. T 1 2 3 4 4
  5990. B 1 2 3 4 4
  5991. @end example
  5992. As a result of the field matching, we can see that some frames get duplicated.
  5993. To perform a complete inverse telecine, you need to rely on a decimation filter
  5994. after this operation. See for instance the @ref{decimate} filter.
  5995. The same operation now matching from top fields (@option{field}=@var{top})
  5996. looks like this:
  5997. @example
  5998. Input stream:
  5999. T 1 2 2 3 4 <-- matching reference
  6000. B 1 2 3 4 4
  6001. Matches: c c p p c
  6002. Output stream:
  6003. T 1 2 2 3 4
  6004. B 1 2 2 3 4
  6005. @end example
  6006. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6007. basically, they refer to the frame and field of the opposite parity:
  6008. @itemize
  6009. @item @var{p} matches the field of the opposite parity in the previous frame
  6010. @item @var{c} matches the field of the opposite parity in the current frame
  6011. @item @var{n} matches the field of the opposite parity in the next frame
  6012. @end itemize
  6013. @subsubsection u/b
  6014. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6015. from the opposite parity flag. In the following examples, we assume that we are
  6016. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6017. 'x' is placed above and below each matched fields.
  6018. With bottom matching (@option{field}=@var{bottom}):
  6019. @example
  6020. Match: c p n b u
  6021. x x x x x
  6022. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6023. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6024. x x x x x
  6025. Output frames:
  6026. 2 1 2 2 2
  6027. 2 2 2 1 3
  6028. @end example
  6029. With top matching (@option{field}=@var{top}):
  6030. @example
  6031. Match: c p n b u
  6032. x x x x x
  6033. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6034. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6035. x x x x x
  6036. Output frames:
  6037. 2 2 2 1 2
  6038. 2 1 3 2 2
  6039. @end example
  6040. @subsection Examples
  6041. Simple IVTC of a top field first telecined stream:
  6042. @example
  6043. fieldmatch=order=tff:combmatch=none, decimate
  6044. @end example
  6045. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6046. @example
  6047. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6048. @end example
  6049. @section fieldorder
  6050. Transform the field order of the input video.
  6051. It accepts the following parameters:
  6052. @table @option
  6053. @item order
  6054. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6055. for bottom field first.
  6056. @end table
  6057. The default value is @samp{tff}.
  6058. The transformation is done by shifting the picture content up or down
  6059. by one line, and filling the remaining line with appropriate picture content.
  6060. This method is consistent with most broadcast field order converters.
  6061. If the input video is not flagged as being interlaced, or it is already
  6062. flagged as being of the required output field order, then this filter does
  6063. not alter the incoming video.
  6064. It is very useful when converting to or from PAL DV material,
  6065. which is bottom field first.
  6066. For example:
  6067. @example
  6068. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6069. @end example
  6070. @section fifo, afifo
  6071. Buffer input images and send them when they are requested.
  6072. It is mainly useful when auto-inserted by the libavfilter
  6073. framework.
  6074. It does not take parameters.
  6075. @section find_rect
  6076. Find a rectangular object
  6077. It accepts the following options:
  6078. @table @option
  6079. @item object
  6080. Filepath of the object image, needs to be in gray8.
  6081. @item threshold
  6082. Detection threshold, default is 0.5.
  6083. @item mipmaps
  6084. Number of mipmaps, default is 3.
  6085. @item xmin, ymin, xmax, ymax
  6086. Specifies the rectangle in which to search.
  6087. @end table
  6088. @subsection Examples
  6089. @itemize
  6090. @item
  6091. Generate a representative palette of a given video using @command{ffmpeg}:
  6092. @example
  6093. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6094. @end example
  6095. @end itemize
  6096. @section cover_rect
  6097. Cover a rectangular object
  6098. It accepts the following options:
  6099. @table @option
  6100. @item cover
  6101. Filepath of the optional cover image, needs to be in yuv420.
  6102. @item mode
  6103. Set covering mode.
  6104. It accepts the following values:
  6105. @table @samp
  6106. @item cover
  6107. cover it by the supplied image
  6108. @item blur
  6109. cover it by interpolating the surrounding pixels
  6110. @end table
  6111. Default value is @var{blur}.
  6112. @end table
  6113. @subsection Examples
  6114. @itemize
  6115. @item
  6116. Generate a representative palette of a given video using @command{ffmpeg}:
  6117. @example
  6118. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6119. @end example
  6120. @end itemize
  6121. @anchor{format}
  6122. @section format
  6123. Convert the input video to one of the specified pixel formats.
  6124. Libavfilter will try to pick one that is suitable as input to
  6125. the next filter.
  6126. It accepts the following parameters:
  6127. @table @option
  6128. @item pix_fmts
  6129. A '|'-separated list of pixel format names, such as
  6130. "pix_fmts=yuv420p|monow|rgb24".
  6131. @end table
  6132. @subsection Examples
  6133. @itemize
  6134. @item
  6135. Convert the input video to the @var{yuv420p} format
  6136. @example
  6137. format=pix_fmts=yuv420p
  6138. @end example
  6139. Convert the input video to any of the formats in the list
  6140. @example
  6141. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6142. @end example
  6143. @end itemize
  6144. @anchor{fps}
  6145. @section fps
  6146. Convert the video to specified constant frame rate by duplicating or dropping
  6147. frames as necessary.
  6148. It accepts the following parameters:
  6149. @table @option
  6150. @item fps
  6151. The desired output frame rate. The default is @code{25}.
  6152. @item round
  6153. Rounding method.
  6154. Possible values are:
  6155. @table @option
  6156. @item zero
  6157. zero round towards 0
  6158. @item inf
  6159. round away from 0
  6160. @item down
  6161. round towards -infinity
  6162. @item up
  6163. round towards +infinity
  6164. @item near
  6165. round to nearest
  6166. @end table
  6167. The default is @code{near}.
  6168. @item start_time
  6169. Assume the first PTS should be the given value, in seconds. This allows for
  6170. padding/trimming at the start of stream. By default, no assumption is made
  6171. about the first frame's expected PTS, so no padding or trimming is done.
  6172. For example, this could be set to 0 to pad the beginning with duplicates of
  6173. the first frame if a video stream starts after the audio stream or to trim any
  6174. frames with a negative PTS.
  6175. @end table
  6176. Alternatively, the options can be specified as a flat string:
  6177. @var{fps}[:@var{round}].
  6178. See also the @ref{setpts} filter.
  6179. @subsection Examples
  6180. @itemize
  6181. @item
  6182. A typical usage in order to set the fps to 25:
  6183. @example
  6184. fps=fps=25
  6185. @end example
  6186. @item
  6187. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6188. @example
  6189. fps=fps=film:round=near
  6190. @end example
  6191. @end itemize
  6192. @section framepack
  6193. Pack two different video streams into a stereoscopic video, setting proper
  6194. metadata on supported codecs. The two views should have the same size and
  6195. framerate and processing will stop when the shorter video ends. Please note
  6196. that you may conveniently adjust view properties with the @ref{scale} and
  6197. @ref{fps} filters.
  6198. It accepts the following parameters:
  6199. @table @option
  6200. @item format
  6201. The desired packing format. Supported values are:
  6202. @table @option
  6203. @item sbs
  6204. The views are next to each other (default).
  6205. @item tab
  6206. The views are on top of each other.
  6207. @item lines
  6208. The views are packed by line.
  6209. @item columns
  6210. The views are packed by column.
  6211. @item frameseq
  6212. The views are temporally interleaved.
  6213. @end table
  6214. @end table
  6215. Some examples:
  6216. @example
  6217. # Convert left and right views into a frame-sequential video
  6218. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6219. # Convert views into a side-by-side video with the same output resolution as the input
  6220. 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
  6221. @end example
  6222. @section framerate
  6223. Change the frame rate by interpolating new video output frames from the source
  6224. frames.
  6225. This filter is not designed to function correctly with interlaced media. If
  6226. you wish to change the frame rate of interlaced media then you are required
  6227. to deinterlace before this filter and re-interlace after this filter.
  6228. A description of the accepted options follows.
  6229. @table @option
  6230. @item fps
  6231. Specify the output frames per second. This option can also be specified
  6232. as a value alone. The default is @code{50}.
  6233. @item interp_start
  6234. Specify the start of a range where the output frame will be created as a
  6235. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6236. the default is @code{15}.
  6237. @item interp_end
  6238. Specify the end of a range where the output frame will be created as a
  6239. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6240. the default is @code{240}.
  6241. @item scene
  6242. Specify the level at which a scene change is detected as a value between
  6243. 0 and 100 to indicate a new scene; a low value reflects a low
  6244. probability for the current frame to introduce a new scene, while a higher
  6245. value means the current frame is more likely to be one.
  6246. The default is @code{7}.
  6247. @item flags
  6248. Specify flags influencing the filter process.
  6249. Available value for @var{flags} is:
  6250. @table @option
  6251. @item scene_change_detect, scd
  6252. Enable scene change detection using the value of the option @var{scene}.
  6253. This flag is enabled by default.
  6254. @end table
  6255. @end table
  6256. @section framestep
  6257. Select one frame every N-th frame.
  6258. This filter accepts the following option:
  6259. @table @option
  6260. @item step
  6261. Select frame after every @code{step} frames.
  6262. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6263. @end table
  6264. @anchor{frei0r}
  6265. @section frei0r
  6266. Apply a frei0r effect to the input video.
  6267. To enable the compilation of this filter, you need to install the frei0r
  6268. header and configure FFmpeg with @code{--enable-frei0r}.
  6269. It accepts the following parameters:
  6270. @table @option
  6271. @item filter_name
  6272. The name of the frei0r effect to load. If the environment variable
  6273. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6274. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6275. Otherwise, the standard frei0r paths are searched, in this order:
  6276. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6277. @file{/usr/lib/frei0r-1/}.
  6278. @item filter_params
  6279. A '|'-separated list of parameters to pass to the frei0r effect.
  6280. @end table
  6281. A frei0r effect parameter can be a boolean (its value is either
  6282. "y" or "n"), a double, a color (specified as
  6283. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6284. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6285. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6286. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6287. The number and types of parameters depend on the loaded effect. If an
  6288. effect parameter is not specified, the default value is set.
  6289. @subsection Examples
  6290. @itemize
  6291. @item
  6292. Apply the distort0r effect, setting the first two double parameters:
  6293. @example
  6294. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6295. @end example
  6296. @item
  6297. Apply the colordistance effect, taking a color as the first parameter:
  6298. @example
  6299. frei0r=colordistance:0.2/0.3/0.4
  6300. frei0r=colordistance:violet
  6301. frei0r=colordistance:0x112233
  6302. @end example
  6303. @item
  6304. Apply the perspective effect, specifying the top left and top right image
  6305. positions:
  6306. @example
  6307. frei0r=perspective:0.2/0.2|0.8/0.2
  6308. @end example
  6309. @end itemize
  6310. For more information, see
  6311. @url{http://frei0r.dyne.org}
  6312. @section fspp
  6313. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6314. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6315. processing filter, one of them is performed once per block, not per pixel.
  6316. This allows for much higher speed.
  6317. The filter accepts the following options:
  6318. @table @option
  6319. @item quality
  6320. Set quality. This option defines the number of levels for averaging. It accepts
  6321. an integer in the range 4-5. Default value is @code{4}.
  6322. @item qp
  6323. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6324. If not set, the filter will use the QP from the video stream (if available).
  6325. @item strength
  6326. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6327. more details but also more artifacts, while higher values make the image smoother
  6328. but also blurrier. Default value is @code{0} − PSNR optimal.
  6329. @item use_bframe_qp
  6330. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6331. option may cause flicker since the B-Frames have often larger QP. Default is
  6332. @code{0} (not enabled).
  6333. @end table
  6334. @section geq
  6335. The filter accepts the following options:
  6336. @table @option
  6337. @item lum_expr, lum
  6338. Set the luminance expression.
  6339. @item cb_expr, cb
  6340. Set the chrominance blue expression.
  6341. @item cr_expr, cr
  6342. Set the chrominance red expression.
  6343. @item alpha_expr, a
  6344. Set the alpha expression.
  6345. @item red_expr, r
  6346. Set the red expression.
  6347. @item green_expr, g
  6348. Set the green expression.
  6349. @item blue_expr, b
  6350. Set the blue expression.
  6351. @end table
  6352. The colorspace is selected according to the specified options. If one
  6353. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6354. options is specified, the filter will automatically select a YCbCr
  6355. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6356. @option{blue_expr} options is specified, it will select an RGB
  6357. colorspace.
  6358. If one of the chrominance expression is not defined, it falls back on the other
  6359. one. If no alpha expression is specified it will evaluate to opaque value.
  6360. If none of chrominance expressions are specified, they will evaluate
  6361. to the luminance expression.
  6362. The expressions can use the following variables and functions:
  6363. @table @option
  6364. @item N
  6365. The sequential number of the filtered frame, starting from @code{0}.
  6366. @item X
  6367. @item Y
  6368. The coordinates of the current sample.
  6369. @item W
  6370. @item H
  6371. The width and height of the image.
  6372. @item SW
  6373. @item SH
  6374. Width and height scale depending on the currently filtered plane. It is the
  6375. ratio between the corresponding luma plane number of pixels and the current
  6376. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6377. @code{0.5,0.5} for chroma planes.
  6378. @item T
  6379. Time of the current frame, expressed in seconds.
  6380. @item p(x, y)
  6381. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6382. plane.
  6383. @item lum(x, y)
  6384. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6385. plane.
  6386. @item cb(x, y)
  6387. Return the value of the pixel at location (@var{x},@var{y}) of the
  6388. blue-difference chroma plane. Return 0 if there is no such plane.
  6389. @item cr(x, y)
  6390. Return the value of the pixel at location (@var{x},@var{y}) of the
  6391. red-difference chroma plane. Return 0 if there is no such plane.
  6392. @item r(x, y)
  6393. @item g(x, y)
  6394. @item b(x, y)
  6395. Return the value of the pixel at location (@var{x},@var{y}) of the
  6396. red/green/blue component. Return 0 if there is no such component.
  6397. @item alpha(x, y)
  6398. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6399. plane. Return 0 if there is no such plane.
  6400. @end table
  6401. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6402. automatically clipped to the closer edge.
  6403. @subsection Examples
  6404. @itemize
  6405. @item
  6406. Flip the image horizontally:
  6407. @example
  6408. geq=p(W-X\,Y)
  6409. @end example
  6410. @item
  6411. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6412. wavelength of 100 pixels:
  6413. @example
  6414. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6415. @end example
  6416. @item
  6417. Generate a fancy enigmatic moving light:
  6418. @example
  6419. 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
  6420. @end example
  6421. @item
  6422. Generate a quick emboss effect:
  6423. @example
  6424. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6425. @end example
  6426. @item
  6427. Modify RGB components depending on pixel position:
  6428. @example
  6429. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6430. @end example
  6431. @item
  6432. Create a radial gradient that is the same size as the input (also see
  6433. the @ref{vignette} filter):
  6434. @example
  6435. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6436. @end example
  6437. @end itemize
  6438. @section gradfun
  6439. Fix the banding artifacts that are sometimes introduced into nearly flat
  6440. regions by truncation to 8-bit color depth.
  6441. Interpolate the gradients that should go where the bands are, and
  6442. dither them.
  6443. It is designed for playback only. Do not use it prior to
  6444. lossy compression, because compression tends to lose the dither and
  6445. bring back the bands.
  6446. It accepts the following parameters:
  6447. @table @option
  6448. @item strength
  6449. The maximum amount by which the filter will change any one pixel. This is also
  6450. the threshold for detecting nearly flat regions. Acceptable values range from
  6451. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6452. valid range.
  6453. @item radius
  6454. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6455. gradients, but also prevents the filter from modifying the pixels near detailed
  6456. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6457. values will be clipped to the valid range.
  6458. @end table
  6459. Alternatively, the options can be specified as a flat string:
  6460. @var{strength}[:@var{radius}]
  6461. @subsection Examples
  6462. @itemize
  6463. @item
  6464. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6465. @example
  6466. gradfun=3.5:8
  6467. @end example
  6468. @item
  6469. Specify radius, omitting the strength (which will fall-back to the default
  6470. value):
  6471. @example
  6472. gradfun=radius=8
  6473. @end example
  6474. @end itemize
  6475. @anchor{haldclut}
  6476. @section haldclut
  6477. Apply a Hald CLUT to a video stream.
  6478. First input is the video stream to process, and second one is the Hald CLUT.
  6479. The Hald CLUT input can be a simple picture or a complete video stream.
  6480. The filter accepts the following options:
  6481. @table @option
  6482. @item shortest
  6483. Force termination when the shortest input terminates. Default is @code{0}.
  6484. @item repeatlast
  6485. Continue applying the last CLUT after the end of the stream. A value of
  6486. @code{0} disable the filter after the last frame of the CLUT is reached.
  6487. Default is @code{1}.
  6488. @end table
  6489. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6490. filters share the same internals).
  6491. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6492. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6493. @subsection Workflow examples
  6494. @subsubsection Hald CLUT video stream
  6495. Generate an identity Hald CLUT stream altered with various effects:
  6496. @example
  6497. 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
  6498. @end example
  6499. Note: make sure you use a lossless codec.
  6500. Then use it with @code{haldclut} to apply it on some random stream:
  6501. @example
  6502. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6503. @end example
  6504. The Hald CLUT will be applied to the 10 first seconds (duration of
  6505. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6506. to the remaining frames of the @code{mandelbrot} stream.
  6507. @subsubsection Hald CLUT with preview
  6508. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6509. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6510. biggest possible square starting at the top left of the picture. The remaining
  6511. padding pixels (bottom or right) will be ignored. This area can be used to add
  6512. a preview of the Hald CLUT.
  6513. Typically, the following generated Hald CLUT will be supported by the
  6514. @code{haldclut} filter:
  6515. @example
  6516. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6517. pad=iw+320 [padded_clut];
  6518. smptebars=s=320x256, split [a][b];
  6519. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6520. [main][b] overlay=W-320" -frames:v 1 clut.png
  6521. @end example
  6522. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6523. bars are displayed on the right-top, and below the same color bars processed by
  6524. the color changes.
  6525. Then, the effect of this Hald CLUT can be visualized with:
  6526. @example
  6527. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6528. @end example
  6529. @section hflip
  6530. Flip the input video horizontally.
  6531. For example, to horizontally flip the input video with @command{ffmpeg}:
  6532. @example
  6533. ffmpeg -i in.avi -vf "hflip" out.avi
  6534. @end example
  6535. @section histeq
  6536. This filter applies a global color histogram equalization on a
  6537. per-frame basis.
  6538. It can be used to correct video that has a compressed range of pixel
  6539. intensities. The filter redistributes the pixel intensities to
  6540. equalize their distribution across the intensity range. It may be
  6541. viewed as an "automatically adjusting contrast filter". This filter is
  6542. useful only for correcting degraded or poorly captured source
  6543. video.
  6544. The filter accepts the following options:
  6545. @table @option
  6546. @item strength
  6547. Determine the amount of equalization to be applied. As the strength
  6548. is reduced, the distribution of pixel intensities more-and-more
  6549. approaches that of the input frame. The value must be a float number
  6550. in the range [0,1] and defaults to 0.200.
  6551. @item intensity
  6552. Set the maximum intensity that can generated and scale the output
  6553. values appropriately. The strength should be set as desired and then
  6554. the intensity can be limited if needed to avoid washing-out. The value
  6555. must be a float number in the range [0,1] and defaults to 0.210.
  6556. @item antibanding
  6557. Set the antibanding level. If enabled the filter will randomly vary
  6558. the luminance of output pixels by a small amount to avoid banding of
  6559. the histogram. Possible values are @code{none}, @code{weak} or
  6560. @code{strong}. It defaults to @code{none}.
  6561. @end table
  6562. @section histogram
  6563. Compute and draw a color distribution histogram for the input video.
  6564. The computed histogram is a representation of the color component
  6565. distribution in an image.
  6566. Standard histogram displays the color components distribution in an image.
  6567. Displays color graph for each color component. Shows distribution of
  6568. the Y, U, V, A or R, G, B components, depending on input format, in the
  6569. current frame. Below each graph a color component scale meter is shown.
  6570. The filter accepts the following options:
  6571. @table @option
  6572. @item level_height
  6573. Set height of level. Default value is @code{200}.
  6574. Allowed range is [50, 2048].
  6575. @item scale_height
  6576. Set height of color scale. Default value is @code{12}.
  6577. Allowed range is [0, 40].
  6578. @item display_mode
  6579. Set display mode.
  6580. It accepts the following values:
  6581. @table @samp
  6582. @item parade
  6583. Per color component graphs are placed below each other.
  6584. @item overlay
  6585. Presents information identical to that in the @code{parade}, except
  6586. that the graphs representing color components are superimposed directly
  6587. over one another.
  6588. @end table
  6589. Default is @code{parade}.
  6590. @item levels_mode
  6591. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6592. Default is @code{linear}.
  6593. @item components
  6594. Set what color components to display.
  6595. Default is @code{7}.
  6596. @end table
  6597. @subsection Examples
  6598. @itemize
  6599. @item
  6600. Calculate and draw histogram:
  6601. @example
  6602. ffplay -i input -vf histogram
  6603. @end example
  6604. @end itemize
  6605. @anchor{hqdn3d}
  6606. @section hqdn3d
  6607. This is a high precision/quality 3d denoise filter. It aims to reduce
  6608. image noise, producing smooth images and making still images really
  6609. still. It should enhance compressibility.
  6610. It accepts the following optional parameters:
  6611. @table @option
  6612. @item luma_spatial
  6613. A non-negative floating point number which specifies spatial luma strength.
  6614. It defaults to 4.0.
  6615. @item chroma_spatial
  6616. A non-negative floating point number which specifies spatial chroma strength.
  6617. It defaults to 3.0*@var{luma_spatial}/4.0.
  6618. @item luma_tmp
  6619. A floating point number which specifies luma temporal strength. It defaults to
  6620. 6.0*@var{luma_spatial}/4.0.
  6621. @item chroma_tmp
  6622. A floating point number which specifies chroma temporal strength. It defaults to
  6623. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6624. @end table
  6625. @anchor{hwupload_cuda}
  6626. @section hwupload_cuda
  6627. Upload system memory frames to a CUDA device.
  6628. It accepts the following optional parameters:
  6629. @table @option
  6630. @item device
  6631. The number of the CUDA device to use
  6632. @end table
  6633. @section hqx
  6634. Apply a high-quality magnification filter designed for pixel art. This filter
  6635. was originally created by Maxim Stepin.
  6636. It accepts the following option:
  6637. @table @option
  6638. @item n
  6639. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6640. @code{hq3x} and @code{4} for @code{hq4x}.
  6641. Default is @code{3}.
  6642. @end table
  6643. @section hstack
  6644. Stack input videos horizontally.
  6645. All streams must be of same pixel format and of same height.
  6646. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6647. to create same output.
  6648. The filter accept the following option:
  6649. @table @option
  6650. @item inputs
  6651. Set number of input streams. Default is 2.
  6652. @item shortest
  6653. If set to 1, force the output to terminate when the shortest input
  6654. terminates. Default value is 0.
  6655. @end table
  6656. @section hue
  6657. Modify the hue and/or the saturation of the input.
  6658. It accepts the following parameters:
  6659. @table @option
  6660. @item h
  6661. Specify the hue angle as a number of degrees. It accepts an expression,
  6662. and defaults to "0".
  6663. @item s
  6664. Specify the saturation in the [-10,10] range. It accepts an expression and
  6665. defaults to "1".
  6666. @item H
  6667. Specify the hue angle as a number of radians. It accepts an
  6668. expression, and defaults to "0".
  6669. @item b
  6670. Specify the brightness in the [-10,10] range. It accepts an expression and
  6671. defaults to "0".
  6672. @end table
  6673. @option{h} and @option{H} are mutually exclusive, and can't be
  6674. specified at the same time.
  6675. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6676. expressions containing the following constants:
  6677. @table @option
  6678. @item n
  6679. frame count of the input frame starting from 0
  6680. @item pts
  6681. presentation timestamp of the input frame expressed in time base units
  6682. @item r
  6683. frame rate of the input video, NAN if the input frame rate is unknown
  6684. @item t
  6685. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6686. @item tb
  6687. time base of the input video
  6688. @end table
  6689. @subsection Examples
  6690. @itemize
  6691. @item
  6692. Set the hue to 90 degrees and the saturation to 1.0:
  6693. @example
  6694. hue=h=90:s=1
  6695. @end example
  6696. @item
  6697. Same command but expressing the hue in radians:
  6698. @example
  6699. hue=H=PI/2:s=1
  6700. @end example
  6701. @item
  6702. Rotate hue and make the saturation swing between 0
  6703. and 2 over a period of 1 second:
  6704. @example
  6705. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6706. @end example
  6707. @item
  6708. Apply a 3 seconds saturation fade-in effect starting at 0:
  6709. @example
  6710. hue="s=min(t/3\,1)"
  6711. @end example
  6712. The general fade-in expression can be written as:
  6713. @example
  6714. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6715. @end example
  6716. @item
  6717. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6718. @example
  6719. hue="s=max(0\, min(1\, (8-t)/3))"
  6720. @end example
  6721. The general fade-out expression can be written as:
  6722. @example
  6723. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6724. @end example
  6725. @end itemize
  6726. @subsection Commands
  6727. This filter supports the following commands:
  6728. @table @option
  6729. @item b
  6730. @item s
  6731. @item h
  6732. @item H
  6733. Modify the hue and/or the saturation and/or brightness of the input video.
  6734. The command accepts the same syntax of the corresponding option.
  6735. If the specified expression is not valid, it is kept at its current
  6736. value.
  6737. @end table
  6738. @section idet
  6739. Detect video interlacing type.
  6740. This filter tries to detect if the input frames as interlaced, progressive,
  6741. top or bottom field first. It will also try and detect fields that are
  6742. repeated between adjacent frames (a sign of telecine).
  6743. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6744. Multiple frame detection incorporates the classification history of previous frames.
  6745. The filter will log these metadata values:
  6746. @table @option
  6747. @item single.current_frame
  6748. Detected type of current frame using single-frame detection. One of:
  6749. ``tff'' (top field first), ``bff'' (bottom field first),
  6750. ``progressive'', or ``undetermined''
  6751. @item single.tff
  6752. Cumulative number of frames detected as top field first using single-frame detection.
  6753. @item multiple.tff
  6754. Cumulative number of frames detected as top field first using multiple-frame detection.
  6755. @item single.bff
  6756. Cumulative number of frames detected as bottom field first using single-frame detection.
  6757. @item multiple.current_frame
  6758. Detected type of current frame using multiple-frame detection. One of:
  6759. ``tff'' (top field first), ``bff'' (bottom field first),
  6760. ``progressive'', or ``undetermined''
  6761. @item multiple.bff
  6762. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6763. @item single.progressive
  6764. Cumulative number of frames detected as progressive using single-frame detection.
  6765. @item multiple.progressive
  6766. Cumulative number of frames detected as progressive using multiple-frame detection.
  6767. @item single.undetermined
  6768. Cumulative number of frames that could not be classified using single-frame detection.
  6769. @item multiple.undetermined
  6770. Cumulative number of frames that could not be classified using multiple-frame detection.
  6771. @item repeated.current_frame
  6772. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6773. @item repeated.neither
  6774. Cumulative number of frames with no repeated field.
  6775. @item repeated.top
  6776. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6777. @item repeated.bottom
  6778. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6779. @end table
  6780. The filter accepts the following options:
  6781. @table @option
  6782. @item intl_thres
  6783. Set interlacing threshold.
  6784. @item prog_thres
  6785. Set progressive threshold.
  6786. @item rep_thres
  6787. Threshold for repeated field detection.
  6788. @item half_life
  6789. Number of frames after which a given frame's contribution to the
  6790. statistics is halved (i.e., it contributes only 0.5 to it's
  6791. classification). The default of 0 means that all frames seen are given
  6792. full weight of 1.0 forever.
  6793. @item analyze_interlaced_flag
  6794. When this is not 0 then idet will use the specified number of frames to determine
  6795. if the interlaced flag is accurate, it will not count undetermined frames.
  6796. If the flag is found to be accurate it will be used without any further
  6797. computations, if it is found to be inaccurate it will be cleared without any
  6798. further computations. This allows inserting the idet filter as a low computational
  6799. method to clean up the interlaced flag
  6800. @end table
  6801. @section il
  6802. Deinterleave or interleave fields.
  6803. This filter allows one to process interlaced images fields without
  6804. deinterlacing them. Deinterleaving splits the input frame into 2
  6805. fields (so called half pictures). Odd lines are moved to the top
  6806. half of the output image, even lines to the bottom half.
  6807. You can process (filter) them independently and then re-interleave them.
  6808. The filter accepts the following options:
  6809. @table @option
  6810. @item luma_mode, l
  6811. @item chroma_mode, c
  6812. @item alpha_mode, a
  6813. Available values for @var{luma_mode}, @var{chroma_mode} and
  6814. @var{alpha_mode} are:
  6815. @table @samp
  6816. @item none
  6817. Do nothing.
  6818. @item deinterleave, d
  6819. Deinterleave fields, placing one above the other.
  6820. @item interleave, i
  6821. Interleave fields. Reverse the effect of deinterleaving.
  6822. @end table
  6823. Default value is @code{none}.
  6824. @item luma_swap, ls
  6825. @item chroma_swap, cs
  6826. @item alpha_swap, as
  6827. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6828. @end table
  6829. @section inflate
  6830. Apply inflate effect to the video.
  6831. This filter replaces the pixel by the local(3x3) average by taking into account
  6832. only values higher than the pixel.
  6833. It accepts the following options:
  6834. @table @option
  6835. @item threshold0
  6836. @item threshold1
  6837. @item threshold2
  6838. @item threshold3
  6839. Limit the maximum change for each plane, default is 65535.
  6840. If 0, plane will remain unchanged.
  6841. @end table
  6842. @section interlace
  6843. Simple interlacing filter from progressive contents. This interleaves upper (or
  6844. lower) lines from odd frames with lower (or upper) lines from even frames,
  6845. halving the frame rate and preserving image height.
  6846. @example
  6847. Original Original New Frame
  6848. Frame 'j' Frame 'j+1' (tff)
  6849. ========== =========== ==================
  6850. Line 0 --------------------> Frame 'j' Line 0
  6851. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6852. Line 2 ---------------------> Frame 'j' Line 2
  6853. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6854. ... ... ...
  6855. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6856. @end example
  6857. It accepts the following optional parameters:
  6858. @table @option
  6859. @item scan
  6860. This determines whether the interlaced frame is taken from the even
  6861. (tff - default) or odd (bff) lines of the progressive frame.
  6862. @item lowpass
  6863. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6864. interlacing and reduce moire patterns.
  6865. @end table
  6866. @section kerndeint
  6867. Deinterlace input video by applying Donald Graft's adaptive kernel
  6868. deinterling. Work on interlaced parts of a video to produce
  6869. progressive frames.
  6870. The description of the accepted parameters follows.
  6871. @table @option
  6872. @item thresh
  6873. Set the threshold which affects the filter's tolerance when
  6874. determining if a pixel line must be processed. It must be an integer
  6875. in the range [0,255] and defaults to 10. A value of 0 will result in
  6876. applying the process on every pixels.
  6877. @item map
  6878. Paint pixels exceeding the threshold value to white if set to 1.
  6879. Default is 0.
  6880. @item order
  6881. Set the fields order. Swap fields if set to 1, leave fields alone if
  6882. 0. Default is 0.
  6883. @item sharp
  6884. Enable additional sharpening if set to 1. Default is 0.
  6885. @item twoway
  6886. Enable twoway sharpening if set to 1. Default is 0.
  6887. @end table
  6888. @subsection Examples
  6889. @itemize
  6890. @item
  6891. Apply default values:
  6892. @example
  6893. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6894. @end example
  6895. @item
  6896. Enable additional sharpening:
  6897. @example
  6898. kerndeint=sharp=1
  6899. @end example
  6900. @item
  6901. Paint processed pixels in white:
  6902. @example
  6903. kerndeint=map=1
  6904. @end example
  6905. @end itemize
  6906. @section lenscorrection
  6907. Correct radial lens distortion
  6908. This filter can be used to correct for radial distortion as can result from the use
  6909. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6910. one can use tools available for example as part of opencv or simply trial-and-error.
  6911. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6912. and extract the k1 and k2 coefficients from the resulting matrix.
  6913. Note that effectively the same filter is available in the open-source tools Krita and
  6914. Digikam from the KDE project.
  6915. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6916. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6917. brightness distribution, so you may want to use both filters together in certain
  6918. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6919. be applied before or after lens correction.
  6920. @subsection Options
  6921. The filter accepts the following options:
  6922. @table @option
  6923. @item cx
  6924. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6925. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6926. width.
  6927. @item cy
  6928. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6929. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6930. height.
  6931. @item k1
  6932. Coefficient of the quadratic correction term. 0.5 means no correction.
  6933. @item k2
  6934. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6935. @end table
  6936. The formula that generates the correction is:
  6937. @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)
  6938. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6939. distances from the focal point in the source and target images, respectively.
  6940. @section loop
  6941. Loop video frames.
  6942. The filter accepts the following options:
  6943. @table @option
  6944. @item loop
  6945. Set the number of loops.
  6946. @item size
  6947. Set maximal size in number of frames.
  6948. @item start
  6949. Set first frame of loop.
  6950. @end table
  6951. @anchor{lut3d}
  6952. @section lut3d
  6953. Apply a 3D LUT to an input video.
  6954. The filter accepts the following options:
  6955. @table @option
  6956. @item file
  6957. Set the 3D LUT file name.
  6958. Currently supported formats:
  6959. @table @samp
  6960. @item 3dl
  6961. AfterEffects
  6962. @item cube
  6963. Iridas
  6964. @item dat
  6965. DaVinci
  6966. @item m3d
  6967. Pandora
  6968. @end table
  6969. @item interp
  6970. Select interpolation mode.
  6971. Available values are:
  6972. @table @samp
  6973. @item nearest
  6974. Use values from the nearest defined point.
  6975. @item trilinear
  6976. Interpolate values using the 8 points defining a cube.
  6977. @item tetrahedral
  6978. Interpolate values using a tetrahedron.
  6979. @end table
  6980. @end table
  6981. @section lut, lutrgb, lutyuv
  6982. Compute a look-up table for binding each pixel component input value
  6983. to an output value, and apply it to the input video.
  6984. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6985. to an RGB input video.
  6986. These filters accept the following parameters:
  6987. @table @option
  6988. @item c0
  6989. set first pixel component expression
  6990. @item c1
  6991. set second pixel component expression
  6992. @item c2
  6993. set third pixel component expression
  6994. @item c3
  6995. set fourth pixel component expression, corresponds to the alpha component
  6996. @item r
  6997. set red component expression
  6998. @item g
  6999. set green component expression
  7000. @item b
  7001. set blue component expression
  7002. @item a
  7003. alpha component expression
  7004. @item y
  7005. set Y/luminance component expression
  7006. @item u
  7007. set U/Cb component expression
  7008. @item v
  7009. set V/Cr component expression
  7010. @end table
  7011. Each of them specifies the expression to use for computing the lookup table for
  7012. the corresponding pixel component values.
  7013. The exact component associated to each of the @var{c*} options depends on the
  7014. format in input.
  7015. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7016. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7017. The expressions can contain the following constants and functions:
  7018. @table @option
  7019. @item w
  7020. @item h
  7021. The input width and height.
  7022. @item val
  7023. The input value for the pixel component.
  7024. @item clipval
  7025. The input value, clipped to the @var{minval}-@var{maxval} range.
  7026. @item maxval
  7027. The maximum value for the pixel component.
  7028. @item minval
  7029. The minimum value for the pixel component.
  7030. @item negval
  7031. The negated value for the pixel component value, clipped to the
  7032. @var{minval}-@var{maxval} range; it corresponds to the expression
  7033. "maxval-clipval+minval".
  7034. @item clip(val)
  7035. The computed value in @var{val}, clipped to the
  7036. @var{minval}-@var{maxval} range.
  7037. @item gammaval(gamma)
  7038. The computed gamma correction value of the pixel component value,
  7039. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7040. expression
  7041. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7042. @end table
  7043. All expressions default to "val".
  7044. @subsection Examples
  7045. @itemize
  7046. @item
  7047. Negate input video:
  7048. @example
  7049. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7050. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7051. @end example
  7052. The above is the same as:
  7053. @example
  7054. lutrgb="r=negval:g=negval:b=negval"
  7055. lutyuv="y=negval:u=negval:v=negval"
  7056. @end example
  7057. @item
  7058. Negate luminance:
  7059. @example
  7060. lutyuv=y=negval
  7061. @end example
  7062. @item
  7063. Remove chroma components, turning the video into a graytone image:
  7064. @example
  7065. lutyuv="u=128:v=128"
  7066. @end example
  7067. @item
  7068. Apply a luma burning effect:
  7069. @example
  7070. lutyuv="y=2*val"
  7071. @end example
  7072. @item
  7073. Remove green and blue components:
  7074. @example
  7075. lutrgb="g=0:b=0"
  7076. @end example
  7077. @item
  7078. Set a constant alpha channel value on input:
  7079. @example
  7080. format=rgba,lutrgb=a="maxval-minval/2"
  7081. @end example
  7082. @item
  7083. Correct luminance gamma by a factor of 0.5:
  7084. @example
  7085. lutyuv=y=gammaval(0.5)
  7086. @end example
  7087. @item
  7088. Discard least significant bits of luma:
  7089. @example
  7090. lutyuv=y='bitand(val, 128+64+32)'
  7091. @end example
  7092. @item
  7093. Technicolor like effect:
  7094. @example
  7095. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7096. @end example
  7097. @end itemize
  7098. @section maskedmerge
  7099. Merge the first input stream with the second input stream using per pixel
  7100. weights in the third input stream.
  7101. A value of 0 in the third stream pixel component means that pixel component
  7102. from first stream is returned unchanged, while maximum value (eg. 255 for
  7103. 8-bit videos) means that pixel component from second stream is returned
  7104. unchanged. Intermediate values define the amount of merging between both
  7105. input stream's pixel components.
  7106. This filter accepts the following options:
  7107. @table @option
  7108. @item planes
  7109. Set which planes will be processed as bitmap, unprocessed planes will be
  7110. copied from first stream.
  7111. By default value 0xf, all planes will be processed.
  7112. @end table
  7113. @section mcdeint
  7114. Apply motion-compensation deinterlacing.
  7115. It needs one field per frame as input and must thus be used together
  7116. with yadif=1/3 or equivalent.
  7117. This filter accepts the following options:
  7118. @table @option
  7119. @item mode
  7120. Set the deinterlacing mode.
  7121. It accepts one of the following values:
  7122. @table @samp
  7123. @item fast
  7124. @item medium
  7125. @item slow
  7126. use iterative motion estimation
  7127. @item extra_slow
  7128. like @samp{slow}, but use multiple reference frames.
  7129. @end table
  7130. Default value is @samp{fast}.
  7131. @item parity
  7132. Set the picture field parity assumed for the input video. It must be
  7133. one of the following values:
  7134. @table @samp
  7135. @item 0, tff
  7136. assume top field first
  7137. @item 1, bff
  7138. assume bottom field first
  7139. @end table
  7140. Default value is @samp{bff}.
  7141. @item qp
  7142. Set per-block quantization parameter (QP) used by the internal
  7143. encoder.
  7144. Higher values should result in a smoother motion vector field but less
  7145. optimal individual vectors. Default value is 1.
  7146. @end table
  7147. @section mergeplanes
  7148. Merge color channel components from several video streams.
  7149. The filter accepts up to 4 input streams, and merge selected input
  7150. planes to the output video.
  7151. This filter accepts the following options:
  7152. @table @option
  7153. @item mapping
  7154. Set input to output plane mapping. Default is @code{0}.
  7155. The mappings is specified as a bitmap. It should be specified as a
  7156. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7157. mapping for the first plane of the output stream. 'A' sets the number of
  7158. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7159. corresponding input to use (from 0 to 3). The rest of the mappings is
  7160. similar, 'Bb' describes the mapping for the output stream second
  7161. plane, 'Cc' describes the mapping for the output stream third plane and
  7162. 'Dd' describes the mapping for the output stream fourth plane.
  7163. @item format
  7164. Set output pixel format. Default is @code{yuva444p}.
  7165. @end table
  7166. @subsection Examples
  7167. @itemize
  7168. @item
  7169. Merge three gray video streams of same width and height into single video stream:
  7170. @example
  7171. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7172. @end example
  7173. @item
  7174. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7175. @example
  7176. [a0][a1]mergeplanes=0x00010210:yuva444p
  7177. @end example
  7178. @item
  7179. Swap Y and A plane in yuva444p stream:
  7180. @example
  7181. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7182. @end example
  7183. @item
  7184. Swap U and V plane in yuv420p stream:
  7185. @example
  7186. format=yuv420p,mergeplanes=0x000201:yuv420p
  7187. @end example
  7188. @item
  7189. Cast a rgb24 clip to yuv444p:
  7190. @example
  7191. format=rgb24,mergeplanes=0x000102:yuv444p
  7192. @end example
  7193. @end itemize
  7194. @section mpdecimate
  7195. Drop frames that do not differ greatly from the previous frame in
  7196. order to reduce frame rate.
  7197. The main use of this filter is for very-low-bitrate encoding
  7198. (e.g. streaming over dialup modem), but it could in theory be used for
  7199. fixing movies that were inverse-telecined incorrectly.
  7200. A description of the accepted options follows.
  7201. @table @option
  7202. @item max
  7203. Set the maximum number of consecutive frames which can be dropped (if
  7204. positive), or the minimum interval between dropped frames (if
  7205. negative). If the value is 0, the frame is dropped unregarding the
  7206. number of previous sequentially dropped frames.
  7207. Default value is 0.
  7208. @item hi
  7209. @item lo
  7210. @item frac
  7211. Set the dropping threshold values.
  7212. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7213. represent actual pixel value differences, so a threshold of 64
  7214. corresponds to 1 unit of difference for each pixel, or the same spread
  7215. out differently over the block.
  7216. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7217. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7218. meaning the whole image) differ by more than a threshold of @option{lo}.
  7219. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7220. 64*5, and default value for @option{frac} is 0.33.
  7221. @end table
  7222. @section negate
  7223. Negate input video.
  7224. It accepts an integer in input; if non-zero it negates the
  7225. alpha component (if available). The default value in input is 0.
  7226. @section nnedi
  7227. Deinterlace video using neural network edge directed interpolation.
  7228. This filter accepts the following options:
  7229. @table @option
  7230. @item weights
  7231. Mandatory option, without binary file filter can not work.
  7232. Currently file can be found here:
  7233. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7234. @item deint
  7235. Set which frames to deinterlace, by default it is @code{all}.
  7236. Can be @code{all} or @code{interlaced}.
  7237. @item field
  7238. Set mode of operation.
  7239. Can be one of the following:
  7240. @table @samp
  7241. @item af
  7242. Use frame flags, both fields.
  7243. @item a
  7244. Use frame flags, single field.
  7245. @item t
  7246. Use top field only.
  7247. @item b
  7248. Use bottom field only.
  7249. @item tf
  7250. Use both fields, top first.
  7251. @item bf
  7252. Use both fields, bottom first.
  7253. @end table
  7254. @item planes
  7255. Set which planes to process, by default filter process all frames.
  7256. @item nsize
  7257. Set size of local neighborhood around each pixel, used by the predictor neural
  7258. network.
  7259. Can be one of the following:
  7260. @table @samp
  7261. @item s8x6
  7262. @item s16x6
  7263. @item s32x6
  7264. @item s48x6
  7265. @item s8x4
  7266. @item s16x4
  7267. @item s32x4
  7268. @end table
  7269. @item nns
  7270. Set the number of neurons in predicctor neural network.
  7271. Can be one of the following:
  7272. @table @samp
  7273. @item n16
  7274. @item n32
  7275. @item n64
  7276. @item n128
  7277. @item n256
  7278. @end table
  7279. @item qual
  7280. Controls the number of different neural network predictions that are blended
  7281. together to compute the final output value. Can be @code{fast}, default or
  7282. @code{slow}.
  7283. @item etype
  7284. Set which set of weights to use in the predictor.
  7285. Can be one of the following:
  7286. @table @samp
  7287. @item a
  7288. weights trained to minimize absolute error
  7289. @item s
  7290. weights trained to minimize squared error
  7291. @end table
  7292. @item pscrn
  7293. Controls whether or not the prescreener neural network is used to decide
  7294. which pixels should be processed by the predictor neural network and which
  7295. can be handled by simple cubic interpolation.
  7296. The prescreener is trained to know whether cubic interpolation will be
  7297. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7298. The computational complexity of the prescreener nn is much less than that of
  7299. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7300. using the prescreener generally results in much faster processing.
  7301. The prescreener is pretty accurate, so the difference between using it and not
  7302. using it is almost always unnoticeable.
  7303. Can be one of the following:
  7304. @table @samp
  7305. @item none
  7306. @item original
  7307. @item new
  7308. @end table
  7309. Default is @code{new}.
  7310. @item fapprox
  7311. Set various debugging flags.
  7312. @end table
  7313. @section noformat
  7314. Force libavfilter not to use any of the specified pixel formats for the
  7315. input to the next filter.
  7316. It accepts the following parameters:
  7317. @table @option
  7318. @item pix_fmts
  7319. A '|'-separated list of pixel format names, such as
  7320. apix_fmts=yuv420p|monow|rgb24".
  7321. @end table
  7322. @subsection Examples
  7323. @itemize
  7324. @item
  7325. Force libavfilter to use a format different from @var{yuv420p} for the
  7326. input to the vflip filter:
  7327. @example
  7328. noformat=pix_fmts=yuv420p,vflip
  7329. @end example
  7330. @item
  7331. Convert the input video to any of the formats not contained in the list:
  7332. @example
  7333. noformat=yuv420p|yuv444p|yuv410p
  7334. @end example
  7335. @end itemize
  7336. @section noise
  7337. Add noise on video input frame.
  7338. The filter accepts the following options:
  7339. @table @option
  7340. @item all_seed
  7341. @item c0_seed
  7342. @item c1_seed
  7343. @item c2_seed
  7344. @item c3_seed
  7345. Set noise seed for specific pixel component or all pixel components in case
  7346. of @var{all_seed}. Default value is @code{123457}.
  7347. @item all_strength, alls
  7348. @item c0_strength, c0s
  7349. @item c1_strength, c1s
  7350. @item c2_strength, c2s
  7351. @item c3_strength, c3s
  7352. Set noise strength for specific pixel component or all pixel components in case
  7353. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7354. @item all_flags, allf
  7355. @item c0_flags, c0f
  7356. @item c1_flags, c1f
  7357. @item c2_flags, c2f
  7358. @item c3_flags, c3f
  7359. Set pixel component flags or set flags for all components if @var{all_flags}.
  7360. Available values for component flags are:
  7361. @table @samp
  7362. @item a
  7363. averaged temporal noise (smoother)
  7364. @item p
  7365. mix random noise with a (semi)regular pattern
  7366. @item t
  7367. temporal noise (noise pattern changes between frames)
  7368. @item u
  7369. uniform noise (gaussian otherwise)
  7370. @end table
  7371. @end table
  7372. @subsection Examples
  7373. Add temporal and uniform noise to input video:
  7374. @example
  7375. noise=alls=20:allf=t+u
  7376. @end example
  7377. @section null
  7378. Pass the video source unchanged to the output.
  7379. @section ocr
  7380. Optical Character Recognition
  7381. This filter uses Tesseract for optical character recognition.
  7382. It accepts the following options:
  7383. @table @option
  7384. @item datapath
  7385. Set datapath to tesseract data. Default is to use whatever was
  7386. set at installation.
  7387. @item language
  7388. Set language, default is "eng".
  7389. @item whitelist
  7390. Set character whitelist.
  7391. @item blacklist
  7392. Set character blacklist.
  7393. @end table
  7394. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7395. @section ocv
  7396. Apply a video transform using libopencv.
  7397. To enable this filter, install the libopencv library and headers and
  7398. configure FFmpeg with @code{--enable-libopencv}.
  7399. It accepts the following parameters:
  7400. @table @option
  7401. @item filter_name
  7402. The name of the libopencv filter to apply.
  7403. @item filter_params
  7404. The parameters to pass to the libopencv filter. If not specified, the default
  7405. values are assumed.
  7406. @end table
  7407. Refer to the official libopencv documentation for more precise
  7408. information:
  7409. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7410. Several libopencv filters are supported; see the following subsections.
  7411. @anchor{dilate}
  7412. @subsection dilate
  7413. Dilate an image by using a specific structuring element.
  7414. It corresponds to the libopencv function @code{cvDilate}.
  7415. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7416. @var{struct_el} represents a structuring element, and has the syntax:
  7417. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7418. @var{cols} and @var{rows} represent the number of columns and rows of
  7419. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7420. point, and @var{shape} the shape for the structuring element. @var{shape}
  7421. must be "rect", "cross", "ellipse", or "custom".
  7422. If the value for @var{shape} is "custom", it must be followed by a
  7423. string of the form "=@var{filename}". The file with name
  7424. @var{filename} is assumed to represent a binary image, with each
  7425. printable character corresponding to a bright pixel. When a custom
  7426. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7427. or columns and rows of the read file are assumed instead.
  7428. The default value for @var{struct_el} is "3x3+0x0/rect".
  7429. @var{nb_iterations} specifies the number of times the transform is
  7430. applied to the image, and defaults to 1.
  7431. Some examples:
  7432. @example
  7433. # Use the default values
  7434. ocv=dilate
  7435. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7436. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7437. # Read the shape from the file diamond.shape, iterating two times.
  7438. # The file diamond.shape may contain a pattern of characters like this
  7439. # *
  7440. # ***
  7441. # *****
  7442. # ***
  7443. # *
  7444. # The specified columns and rows are ignored
  7445. # but the anchor point coordinates are not
  7446. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7447. @end example
  7448. @subsection erode
  7449. Erode an image by using a specific structuring element.
  7450. It corresponds to the libopencv function @code{cvErode}.
  7451. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7452. with the same syntax and semantics as the @ref{dilate} filter.
  7453. @subsection smooth
  7454. Smooth the input video.
  7455. The filter takes the following parameters:
  7456. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7457. @var{type} is the type of smooth filter to apply, and must be one of
  7458. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7459. or "bilateral". The default value is "gaussian".
  7460. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7461. depend on the smooth type. @var{param1} and
  7462. @var{param2} accept integer positive values or 0. @var{param3} and
  7463. @var{param4} accept floating point values.
  7464. The default value for @var{param1} is 3. The default value for the
  7465. other parameters is 0.
  7466. These parameters correspond to the parameters assigned to the
  7467. libopencv function @code{cvSmooth}.
  7468. @anchor{overlay}
  7469. @section overlay
  7470. Overlay one video on top of another.
  7471. It takes two inputs and has one output. The first input is the "main"
  7472. video on which the second input is overlaid.
  7473. It accepts the following parameters:
  7474. A description of the accepted options follows.
  7475. @table @option
  7476. @item x
  7477. @item y
  7478. Set the expression for the x and y coordinates of the overlaid video
  7479. on the main video. Default value is "0" for both expressions. In case
  7480. the expression is invalid, it is set to a huge value (meaning that the
  7481. overlay will not be displayed within the output visible area).
  7482. @item eof_action
  7483. The action to take when EOF is encountered on the secondary input; it accepts
  7484. one of the following values:
  7485. @table @option
  7486. @item repeat
  7487. Repeat the last frame (the default).
  7488. @item endall
  7489. End both streams.
  7490. @item pass
  7491. Pass the main input through.
  7492. @end table
  7493. @item eval
  7494. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7495. It accepts the following values:
  7496. @table @samp
  7497. @item init
  7498. only evaluate expressions once during the filter initialization or
  7499. when a command is processed
  7500. @item frame
  7501. evaluate expressions for each incoming frame
  7502. @end table
  7503. Default value is @samp{frame}.
  7504. @item shortest
  7505. If set to 1, force the output to terminate when the shortest input
  7506. terminates. Default value is 0.
  7507. @item format
  7508. Set the format for the output video.
  7509. It accepts the following values:
  7510. @table @samp
  7511. @item yuv420
  7512. force YUV420 output
  7513. @item yuv422
  7514. force YUV422 output
  7515. @item yuv444
  7516. force YUV444 output
  7517. @item rgb
  7518. force RGB output
  7519. @end table
  7520. Default value is @samp{yuv420}.
  7521. @item rgb @emph{(deprecated)}
  7522. If set to 1, force the filter to accept inputs in the RGB
  7523. color space. Default value is 0. This option is deprecated, use
  7524. @option{format} instead.
  7525. @item repeatlast
  7526. If set to 1, force the filter to draw the last overlay frame over the
  7527. main input until the end of the stream. A value of 0 disables this
  7528. behavior. Default value is 1.
  7529. @end table
  7530. The @option{x}, and @option{y} expressions can contain the following
  7531. parameters.
  7532. @table @option
  7533. @item main_w, W
  7534. @item main_h, H
  7535. The main input width and height.
  7536. @item overlay_w, w
  7537. @item overlay_h, h
  7538. The overlay input width and height.
  7539. @item x
  7540. @item y
  7541. The computed values for @var{x} and @var{y}. They are evaluated for
  7542. each new frame.
  7543. @item hsub
  7544. @item vsub
  7545. horizontal and vertical chroma subsample values of the output
  7546. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7547. @var{vsub} is 1.
  7548. @item n
  7549. the number of input frame, starting from 0
  7550. @item pos
  7551. the position in the file of the input frame, NAN if unknown
  7552. @item t
  7553. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7554. @end table
  7555. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7556. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7557. when @option{eval} is set to @samp{init}.
  7558. Be aware that frames are taken from each input video in timestamp
  7559. order, hence, if their initial timestamps differ, it is a good idea
  7560. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7561. have them begin in the same zero timestamp, as the example for
  7562. the @var{movie} filter does.
  7563. You can chain together more overlays but you should test the
  7564. efficiency of such approach.
  7565. @subsection Commands
  7566. This filter supports the following commands:
  7567. @table @option
  7568. @item x
  7569. @item y
  7570. Modify the x and y of the overlay input.
  7571. The command accepts the same syntax of the corresponding option.
  7572. If the specified expression is not valid, it is kept at its current
  7573. value.
  7574. @end table
  7575. @subsection Examples
  7576. @itemize
  7577. @item
  7578. Draw the overlay at 10 pixels from the bottom right corner of the main
  7579. video:
  7580. @example
  7581. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7582. @end example
  7583. Using named options the example above becomes:
  7584. @example
  7585. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7586. @end example
  7587. @item
  7588. Insert a transparent PNG logo in the bottom left corner of the input,
  7589. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7590. @example
  7591. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7592. @end example
  7593. @item
  7594. Insert 2 different transparent PNG logos (second logo on bottom
  7595. right corner) using the @command{ffmpeg} tool:
  7596. @example
  7597. 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
  7598. @end example
  7599. @item
  7600. Add a transparent color layer on top of the main video; @code{WxH}
  7601. must specify the size of the main input to the overlay filter:
  7602. @example
  7603. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7604. @end example
  7605. @item
  7606. Play an original video and a filtered version (here with the deshake
  7607. filter) side by side using the @command{ffplay} tool:
  7608. @example
  7609. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7610. @end example
  7611. The above command is the same as:
  7612. @example
  7613. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7614. @end example
  7615. @item
  7616. Make a sliding overlay appearing from the left to the right top part of the
  7617. screen starting since time 2:
  7618. @example
  7619. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7620. @end example
  7621. @item
  7622. Compose output by putting two input videos side to side:
  7623. @example
  7624. ffmpeg -i left.avi -i right.avi -filter_complex "
  7625. nullsrc=size=200x100 [background];
  7626. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7627. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7628. [background][left] overlay=shortest=1 [background+left];
  7629. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7630. "
  7631. @end example
  7632. @item
  7633. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7634. @example
  7635. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7636. -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]'
  7637. masked.avi
  7638. @end example
  7639. @item
  7640. Chain several overlays in cascade:
  7641. @example
  7642. nullsrc=s=200x200 [bg];
  7643. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7644. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7645. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7646. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7647. [in3] null, [mid2] overlay=100:100 [out0]
  7648. @end example
  7649. @end itemize
  7650. @section owdenoise
  7651. Apply Overcomplete Wavelet denoiser.
  7652. The filter accepts the following options:
  7653. @table @option
  7654. @item depth
  7655. Set depth.
  7656. Larger depth values will denoise lower frequency components more, but
  7657. slow down filtering.
  7658. Must be an int in the range 8-16, default is @code{8}.
  7659. @item luma_strength, ls
  7660. Set luma strength.
  7661. Must be a double value in the range 0-1000, default is @code{1.0}.
  7662. @item chroma_strength, cs
  7663. Set chroma strength.
  7664. Must be a double value in the range 0-1000, default is @code{1.0}.
  7665. @end table
  7666. @anchor{pad}
  7667. @section pad
  7668. Add paddings to the input image, and place the original input at the
  7669. provided @var{x}, @var{y} coordinates.
  7670. It accepts the following parameters:
  7671. @table @option
  7672. @item width, w
  7673. @item height, h
  7674. Specify an expression for the size of the output image with the
  7675. paddings added. If the value for @var{width} or @var{height} is 0, the
  7676. corresponding input size is used for the output.
  7677. The @var{width} expression can reference the value set by the
  7678. @var{height} expression, and vice versa.
  7679. The default value of @var{width} and @var{height} is 0.
  7680. @item x
  7681. @item y
  7682. Specify the offsets to place the input image at within the padded area,
  7683. with respect to the top/left border of the output image.
  7684. The @var{x} expression can reference the value set by the @var{y}
  7685. expression, and vice versa.
  7686. The default value of @var{x} and @var{y} is 0.
  7687. @item color
  7688. Specify the color of the padded area. For the syntax of this option,
  7689. check the "Color" section in the ffmpeg-utils manual.
  7690. The default value of @var{color} is "black".
  7691. @end table
  7692. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7693. options are expressions containing the following constants:
  7694. @table @option
  7695. @item in_w
  7696. @item in_h
  7697. The input video width and height.
  7698. @item iw
  7699. @item ih
  7700. These are the same as @var{in_w} and @var{in_h}.
  7701. @item out_w
  7702. @item out_h
  7703. The output width and height (the size of the padded area), as
  7704. specified by the @var{width} and @var{height} expressions.
  7705. @item ow
  7706. @item oh
  7707. These are the same as @var{out_w} and @var{out_h}.
  7708. @item x
  7709. @item y
  7710. The x and y offsets as specified by the @var{x} and @var{y}
  7711. expressions, or NAN if not yet specified.
  7712. @item a
  7713. same as @var{iw} / @var{ih}
  7714. @item sar
  7715. input sample aspect ratio
  7716. @item dar
  7717. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7718. @item hsub
  7719. @item vsub
  7720. The horizontal and vertical chroma subsample values. For example for the
  7721. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7722. @end table
  7723. @subsection Examples
  7724. @itemize
  7725. @item
  7726. Add paddings with the color "violet" to the input video. The output video
  7727. size is 640x480, and the top-left corner of the input video is placed at
  7728. column 0, row 40
  7729. @example
  7730. pad=640:480:0:40:violet
  7731. @end example
  7732. The example above is equivalent to the following command:
  7733. @example
  7734. pad=width=640:height=480:x=0:y=40:color=violet
  7735. @end example
  7736. @item
  7737. Pad the input to get an output with dimensions increased by 3/2,
  7738. and put the input video at the center of the padded area:
  7739. @example
  7740. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7741. @end example
  7742. @item
  7743. Pad the input to get a squared output with size equal to the maximum
  7744. value between the input width and height, and put the input video at
  7745. the center of the padded area:
  7746. @example
  7747. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7748. @end example
  7749. @item
  7750. Pad the input to get a final w/h ratio of 16:9:
  7751. @example
  7752. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7753. @end example
  7754. @item
  7755. In case of anamorphic video, in order to set the output display aspect
  7756. correctly, it is necessary to use @var{sar} in the expression,
  7757. according to the relation:
  7758. @example
  7759. (ih * X / ih) * sar = output_dar
  7760. X = output_dar / sar
  7761. @end example
  7762. Thus the previous example needs to be modified to:
  7763. @example
  7764. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7765. @end example
  7766. @item
  7767. Double the output size and put the input video in the bottom-right
  7768. corner of the output padded area:
  7769. @example
  7770. pad="2*iw:2*ih:ow-iw:oh-ih"
  7771. @end example
  7772. @end itemize
  7773. @anchor{palettegen}
  7774. @section palettegen
  7775. Generate one palette for a whole video stream.
  7776. It accepts the following options:
  7777. @table @option
  7778. @item max_colors
  7779. Set the maximum number of colors to quantize in the palette.
  7780. Note: the palette will still contain 256 colors; the unused palette entries
  7781. will be black.
  7782. @item reserve_transparent
  7783. Create a palette of 255 colors maximum and reserve the last one for
  7784. transparency. Reserving the transparency color is useful for GIF optimization.
  7785. If not set, the maximum of colors in the palette will be 256. You probably want
  7786. to disable this option for a standalone image.
  7787. Set by default.
  7788. @item stats_mode
  7789. Set statistics mode.
  7790. It accepts the following values:
  7791. @table @samp
  7792. @item full
  7793. Compute full frame histograms.
  7794. @item diff
  7795. Compute histograms only for the part that differs from previous frame. This
  7796. might be relevant to give more importance to the moving part of your input if
  7797. the background is static.
  7798. @end table
  7799. Default value is @var{full}.
  7800. @end table
  7801. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7802. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7803. color quantization of the palette. This information is also visible at
  7804. @var{info} logging level.
  7805. @subsection Examples
  7806. @itemize
  7807. @item
  7808. Generate a representative palette of a given video using @command{ffmpeg}:
  7809. @example
  7810. ffmpeg -i input.mkv -vf palettegen palette.png
  7811. @end example
  7812. @end itemize
  7813. @section paletteuse
  7814. Use a palette to downsample an input video stream.
  7815. The filter takes two inputs: one video stream and a palette. The palette must
  7816. be a 256 pixels image.
  7817. It accepts the following options:
  7818. @table @option
  7819. @item dither
  7820. Select dithering mode. Available algorithms are:
  7821. @table @samp
  7822. @item bayer
  7823. Ordered 8x8 bayer dithering (deterministic)
  7824. @item heckbert
  7825. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7826. Note: this dithering is sometimes considered "wrong" and is included as a
  7827. reference.
  7828. @item floyd_steinberg
  7829. Floyd and Steingberg dithering (error diffusion)
  7830. @item sierra2
  7831. Frankie Sierra dithering v2 (error diffusion)
  7832. @item sierra2_4a
  7833. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7834. @end table
  7835. Default is @var{sierra2_4a}.
  7836. @item bayer_scale
  7837. When @var{bayer} dithering is selected, this option defines the scale of the
  7838. pattern (how much the crosshatch pattern is visible). A low value means more
  7839. visible pattern for less banding, and higher value means less visible pattern
  7840. at the cost of more banding.
  7841. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7842. @item diff_mode
  7843. If set, define the zone to process
  7844. @table @samp
  7845. @item rectangle
  7846. Only the changing rectangle will be reprocessed. This is similar to GIF
  7847. cropping/offsetting compression mechanism. This option can be useful for speed
  7848. if only a part of the image is changing, and has use cases such as limiting the
  7849. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7850. moving scene (it leads to more deterministic output if the scene doesn't change
  7851. much, and as a result less moving noise and better GIF compression).
  7852. @end table
  7853. Default is @var{none}.
  7854. @end table
  7855. @subsection Examples
  7856. @itemize
  7857. @item
  7858. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7859. using @command{ffmpeg}:
  7860. @example
  7861. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7862. @end example
  7863. @end itemize
  7864. @section perspective
  7865. Correct perspective of video not recorded perpendicular to the screen.
  7866. A description of the accepted parameters follows.
  7867. @table @option
  7868. @item x0
  7869. @item y0
  7870. @item x1
  7871. @item y1
  7872. @item x2
  7873. @item y2
  7874. @item x3
  7875. @item y3
  7876. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7877. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7878. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7879. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7880. then the corners of the source will be sent to the specified coordinates.
  7881. The expressions can use the following variables:
  7882. @table @option
  7883. @item W
  7884. @item H
  7885. the width and height of video frame.
  7886. @item in
  7887. Input frame count.
  7888. @item on
  7889. Output frame count.
  7890. @end table
  7891. @item interpolation
  7892. Set interpolation for perspective correction.
  7893. It accepts the following values:
  7894. @table @samp
  7895. @item linear
  7896. @item cubic
  7897. @end table
  7898. Default value is @samp{linear}.
  7899. @item sense
  7900. Set interpretation of coordinate options.
  7901. It accepts the following values:
  7902. @table @samp
  7903. @item 0, source
  7904. Send point in the source specified by the given coordinates to
  7905. the corners of the destination.
  7906. @item 1, destination
  7907. Send the corners of the source to the point in the destination specified
  7908. by the given coordinates.
  7909. Default value is @samp{source}.
  7910. @end table
  7911. @item eval
  7912. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7913. It accepts the following values:
  7914. @table @samp
  7915. @item init
  7916. only evaluate expressions once during the filter initialization or
  7917. when a command is processed
  7918. @item frame
  7919. evaluate expressions for each incoming frame
  7920. @end table
  7921. Default value is @samp{init}.
  7922. @end table
  7923. @section phase
  7924. Delay interlaced video by one field time so that the field order changes.
  7925. The intended use is to fix PAL movies that have been captured with the
  7926. opposite field order to the film-to-video transfer.
  7927. A description of the accepted parameters follows.
  7928. @table @option
  7929. @item mode
  7930. Set phase mode.
  7931. It accepts the following values:
  7932. @table @samp
  7933. @item t
  7934. Capture field order top-first, transfer bottom-first.
  7935. Filter will delay the bottom field.
  7936. @item b
  7937. Capture field order bottom-first, transfer top-first.
  7938. Filter will delay the top field.
  7939. @item p
  7940. Capture and transfer with the same field order. This mode only exists
  7941. for the documentation of the other options to refer to, but if you
  7942. actually select it, the filter will faithfully do nothing.
  7943. @item a
  7944. Capture field order determined automatically by field flags, transfer
  7945. opposite.
  7946. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7947. basis using field flags. If no field information is available,
  7948. then this works just like @samp{u}.
  7949. @item u
  7950. Capture unknown or varying, transfer opposite.
  7951. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7952. analyzing the images and selecting the alternative that produces best
  7953. match between the fields.
  7954. @item T
  7955. Capture top-first, transfer unknown or varying.
  7956. Filter selects among @samp{t} and @samp{p} using image analysis.
  7957. @item B
  7958. Capture bottom-first, transfer unknown or varying.
  7959. Filter selects among @samp{b} and @samp{p} using image analysis.
  7960. @item A
  7961. Capture determined by field flags, transfer unknown or varying.
  7962. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7963. image analysis. If no field information is available, then this works just
  7964. like @samp{U}. This is the default mode.
  7965. @item U
  7966. Both capture and transfer unknown or varying.
  7967. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7968. @end table
  7969. @end table
  7970. @section pixdesctest
  7971. Pixel format descriptor test filter, mainly useful for internal
  7972. testing. The output video should be equal to the input video.
  7973. For example:
  7974. @example
  7975. format=monow, pixdesctest
  7976. @end example
  7977. can be used to test the monowhite pixel format descriptor definition.
  7978. @section pp
  7979. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7980. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7981. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7982. Each subfilter and some options have a short and a long name that can be used
  7983. interchangeably, i.e. dr/dering are the same.
  7984. The filters accept the following options:
  7985. @table @option
  7986. @item subfilters
  7987. Set postprocessing subfilters string.
  7988. @end table
  7989. All subfilters share common options to determine their scope:
  7990. @table @option
  7991. @item a/autoq
  7992. Honor the quality commands for this subfilter.
  7993. @item c/chrom
  7994. Do chrominance filtering, too (default).
  7995. @item y/nochrom
  7996. Do luminance filtering only (no chrominance).
  7997. @item n/noluma
  7998. Do chrominance filtering only (no luminance).
  7999. @end table
  8000. These options can be appended after the subfilter name, separated by a '|'.
  8001. Available subfilters are:
  8002. @table @option
  8003. @item hb/hdeblock[|difference[|flatness]]
  8004. Horizontal deblocking filter
  8005. @table @option
  8006. @item difference
  8007. Difference factor where higher values mean more deblocking (default: @code{32}).
  8008. @item flatness
  8009. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8010. @end table
  8011. @item vb/vdeblock[|difference[|flatness]]
  8012. Vertical deblocking filter
  8013. @table @option
  8014. @item difference
  8015. Difference factor where higher values mean more deblocking (default: @code{32}).
  8016. @item flatness
  8017. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8018. @end table
  8019. @item ha/hadeblock[|difference[|flatness]]
  8020. Accurate horizontal deblocking filter
  8021. @table @option
  8022. @item difference
  8023. Difference factor where higher values mean more deblocking (default: @code{32}).
  8024. @item flatness
  8025. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8026. @end table
  8027. @item va/vadeblock[|difference[|flatness]]
  8028. Accurate vertical deblocking filter
  8029. @table @option
  8030. @item difference
  8031. Difference factor where higher values mean more deblocking (default: @code{32}).
  8032. @item flatness
  8033. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8034. @end table
  8035. @end table
  8036. The horizontal and vertical deblocking filters share the difference and
  8037. flatness values so you cannot set different horizontal and vertical
  8038. thresholds.
  8039. @table @option
  8040. @item h1/x1hdeblock
  8041. Experimental horizontal deblocking filter
  8042. @item v1/x1vdeblock
  8043. Experimental vertical deblocking filter
  8044. @item dr/dering
  8045. Deringing filter
  8046. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8047. @table @option
  8048. @item threshold1
  8049. larger -> stronger filtering
  8050. @item threshold2
  8051. larger -> stronger filtering
  8052. @item threshold3
  8053. larger -> stronger filtering
  8054. @end table
  8055. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8056. @table @option
  8057. @item f/fullyrange
  8058. Stretch luminance to @code{0-255}.
  8059. @end table
  8060. @item lb/linblenddeint
  8061. Linear blend deinterlacing filter that deinterlaces the given block by
  8062. filtering all lines with a @code{(1 2 1)} filter.
  8063. @item li/linipoldeint
  8064. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8065. linearly interpolating every second line.
  8066. @item ci/cubicipoldeint
  8067. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8068. cubically interpolating every second line.
  8069. @item md/mediandeint
  8070. Median deinterlacing filter that deinterlaces the given block by applying a
  8071. median filter to every second line.
  8072. @item fd/ffmpegdeint
  8073. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8074. second line with a @code{(-1 4 2 4 -1)} filter.
  8075. @item l5/lowpass5
  8076. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8077. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8078. @item fq/forceQuant[|quantizer]
  8079. Overrides the quantizer table from the input with the constant quantizer you
  8080. specify.
  8081. @table @option
  8082. @item quantizer
  8083. Quantizer to use
  8084. @end table
  8085. @item de/default
  8086. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8087. @item fa/fast
  8088. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8089. @item ac
  8090. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8091. @end table
  8092. @subsection Examples
  8093. @itemize
  8094. @item
  8095. Apply horizontal and vertical deblocking, deringing and automatic
  8096. brightness/contrast:
  8097. @example
  8098. pp=hb/vb/dr/al
  8099. @end example
  8100. @item
  8101. Apply default filters without brightness/contrast correction:
  8102. @example
  8103. pp=de/-al
  8104. @end example
  8105. @item
  8106. Apply default filters and temporal denoiser:
  8107. @example
  8108. pp=default/tmpnoise|1|2|3
  8109. @end example
  8110. @item
  8111. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8112. automatically depending on available CPU time:
  8113. @example
  8114. pp=hb|y/vb|a
  8115. @end example
  8116. @end itemize
  8117. @section pp7
  8118. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8119. similar to spp = 6 with 7 point DCT, where only the center sample is
  8120. used after IDCT.
  8121. The filter accepts the following options:
  8122. @table @option
  8123. @item qp
  8124. Force a constant quantization parameter. It accepts an integer in range
  8125. 0 to 63. If not set, the filter will use the QP from the video stream
  8126. (if available).
  8127. @item mode
  8128. Set thresholding mode. Available modes are:
  8129. @table @samp
  8130. @item hard
  8131. Set hard thresholding.
  8132. @item soft
  8133. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8134. @item medium
  8135. Set medium thresholding (good results, default).
  8136. @end table
  8137. @end table
  8138. @section psnr
  8139. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8140. Ratio) between two input videos.
  8141. This filter takes in input two input videos, the first input is
  8142. considered the "main" source and is passed unchanged to the
  8143. output. The second input is used as a "reference" video for computing
  8144. the PSNR.
  8145. Both video inputs must have the same resolution and pixel format for
  8146. this filter to work correctly. Also it assumes that both inputs
  8147. have the same number of frames, which are compared one by one.
  8148. The obtained average PSNR is printed through the logging system.
  8149. The filter stores the accumulated MSE (mean squared error) of each
  8150. frame, and at the end of the processing it is averaged across all frames
  8151. equally, and the following formula is applied to obtain the PSNR:
  8152. @example
  8153. PSNR = 10*log10(MAX^2/MSE)
  8154. @end example
  8155. Where MAX is the average of the maximum values of each component of the
  8156. image.
  8157. The description of the accepted parameters follows.
  8158. @table @option
  8159. @item stats_file, f
  8160. If specified the filter will use the named file to save the PSNR of
  8161. each individual frame. When filename equals "-" the data is sent to
  8162. standard output.
  8163. @item stats_version
  8164. Specifies which version of the stats file format to use. Details of
  8165. each format are written below.
  8166. Default value is 1.
  8167. @end table
  8168. The file printed if @var{stats_file} is selected, contains a sequence of
  8169. key/value pairs of the form @var{key}:@var{value} for each compared
  8170. couple of frames.
  8171. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8172. the list of per-frame-pair stats, with key value pairs following the frame
  8173. format with the following parameters:
  8174. @table @option
  8175. @item psnr_log_version
  8176. The version of the log file format. Will match @var{stats_version}.
  8177. @item fields
  8178. A comma separated list of the per-frame-pair parameters included in
  8179. the log.
  8180. @end table
  8181. A description of each shown per-frame-pair parameter follows:
  8182. @table @option
  8183. @item n
  8184. sequential number of the input frame, starting from 1
  8185. @item mse_avg
  8186. Mean Square Error pixel-by-pixel average difference of the compared
  8187. frames, averaged over all the image components.
  8188. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8189. Mean Square Error pixel-by-pixel average difference of the compared
  8190. frames for the component specified by the suffix.
  8191. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8192. Peak Signal to Noise ratio of the compared frames for the component
  8193. specified by the suffix.
  8194. @end table
  8195. For example:
  8196. @example
  8197. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8198. [main][ref] psnr="stats_file=stats.log" [out]
  8199. @end example
  8200. On this example the input file being processed is compared with the
  8201. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8202. is stored in @file{stats.log}.
  8203. @anchor{pullup}
  8204. @section pullup
  8205. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8206. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8207. content.
  8208. The pullup filter is designed to take advantage of future context in making
  8209. its decisions. This filter is stateless in the sense that it does not lock
  8210. onto a pattern to follow, but it instead looks forward to the following
  8211. fields in order to identify matches and rebuild progressive frames.
  8212. To produce content with an even framerate, insert the fps filter after
  8213. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8214. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8215. The filter accepts the following options:
  8216. @table @option
  8217. @item jl
  8218. @item jr
  8219. @item jt
  8220. @item jb
  8221. These options set the amount of "junk" to ignore at the left, right, top, and
  8222. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8223. while top and bottom are in units of 2 lines.
  8224. The default is 8 pixels on each side.
  8225. @item sb
  8226. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8227. filter generating an occasional mismatched frame, but it may also cause an
  8228. excessive number of frames to be dropped during high motion sequences.
  8229. Conversely, setting it to -1 will make filter match fields more easily.
  8230. This may help processing of video where there is slight blurring between
  8231. the fields, but may also cause there to be interlaced frames in the output.
  8232. Default value is @code{0}.
  8233. @item mp
  8234. Set the metric plane to use. It accepts the following values:
  8235. @table @samp
  8236. @item l
  8237. Use luma plane.
  8238. @item u
  8239. Use chroma blue plane.
  8240. @item v
  8241. Use chroma red plane.
  8242. @end table
  8243. This option may be set to use chroma plane instead of the default luma plane
  8244. for doing filter's computations. This may improve accuracy on very clean
  8245. source material, but more likely will decrease accuracy, especially if there
  8246. is chroma noise (rainbow effect) or any grayscale video.
  8247. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8248. load and make pullup usable in realtime on slow machines.
  8249. @end table
  8250. For best results (without duplicated frames in the output file) it is
  8251. necessary to change the output frame rate. For example, to inverse
  8252. telecine NTSC input:
  8253. @example
  8254. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8255. @end example
  8256. @section qp
  8257. Change video quantization parameters (QP).
  8258. The filter accepts the following option:
  8259. @table @option
  8260. @item qp
  8261. Set expression for quantization parameter.
  8262. @end table
  8263. The expression is evaluated through the eval API and can contain, among others,
  8264. the following constants:
  8265. @table @var
  8266. @item known
  8267. 1 if index is not 129, 0 otherwise.
  8268. @item qp
  8269. Sequentional index starting from -129 to 128.
  8270. @end table
  8271. @subsection Examples
  8272. @itemize
  8273. @item
  8274. Some equation like:
  8275. @example
  8276. qp=2+2*sin(PI*qp)
  8277. @end example
  8278. @end itemize
  8279. @section random
  8280. Flush video frames from internal cache of frames into a random order.
  8281. No frame is discarded.
  8282. Inspired by @ref{frei0r} nervous filter.
  8283. @table @option
  8284. @item frames
  8285. Set size in number of frames of internal cache, in range from @code{2} to
  8286. @code{512}. Default is @code{30}.
  8287. @item seed
  8288. Set seed for random number generator, must be an integer included between
  8289. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8290. less than @code{0}, the filter will try to use a good random seed on a
  8291. best effort basis.
  8292. @end table
  8293. @section readvitc
  8294. Read vertical interval timecode (VITC) information from the top lines of a
  8295. video frame.
  8296. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8297. timecode value, if a valid timecode has been detected. Further metadata key
  8298. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8299. timecode data has been found or not.
  8300. This filter accepts the following options:
  8301. @table @option
  8302. @item scan_max
  8303. Set the maximum number of lines to scan for VITC data. If the value is set to
  8304. @code{-1} the full video frame is scanned. Default is @code{45}.
  8305. @item thr_b
  8306. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8307. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8308. @item thr_w
  8309. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8310. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8311. @end table
  8312. @subsection Examples
  8313. @itemize
  8314. @item
  8315. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8316. draw @code{--:--:--:--} as a placeholder:
  8317. @example
  8318. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8319. @end example
  8320. @end itemize
  8321. @section remap
  8322. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8323. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8324. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8325. value for pixel will be used for destination pixel.
  8326. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8327. will have Xmap/Ymap video stream dimensions.
  8328. Xmap and Ymap input video streams are 16bit depth, single channel.
  8329. @section removegrain
  8330. The removegrain filter is a spatial denoiser for progressive video.
  8331. @table @option
  8332. @item m0
  8333. Set mode for the first plane.
  8334. @item m1
  8335. Set mode for the second plane.
  8336. @item m2
  8337. Set mode for the third plane.
  8338. @item m3
  8339. Set mode for the fourth plane.
  8340. @end table
  8341. Range of mode is from 0 to 24. Description of each mode follows:
  8342. @table @var
  8343. @item 0
  8344. Leave input plane unchanged. Default.
  8345. @item 1
  8346. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8347. @item 2
  8348. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8349. @item 3
  8350. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8351. @item 4
  8352. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8353. This is equivalent to a median filter.
  8354. @item 5
  8355. Line-sensitive clipping giving the minimal change.
  8356. @item 6
  8357. Line-sensitive clipping, intermediate.
  8358. @item 7
  8359. Line-sensitive clipping, intermediate.
  8360. @item 8
  8361. Line-sensitive clipping, intermediate.
  8362. @item 9
  8363. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8364. @item 10
  8365. Replaces the target pixel with the closest neighbour.
  8366. @item 11
  8367. [1 2 1] horizontal and vertical kernel blur.
  8368. @item 12
  8369. Same as mode 11.
  8370. @item 13
  8371. Bob mode, interpolates top field from the line where the neighbours
  8372. pixels are the closest.
  8373. @item 14
  8374. Bob mode, interpolates bottom field from the line where the neighbours
  8375. pixels are the closest.
  8376. @item 15
  8377. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8378. interpolation formula.
  8379. @item 16
  8380. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8381. interpolation formula.
  8382. @item 17
  8383. Clips the pixel with the minimum and maximum of respectively the maximum and
  8384. minimum of each pair of opposite neighbour pixels.
  8385. @item 18
  8386. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8387. the current pixel is minimal.
  8388. @item 19
  8389. Replaces the pixel with the average of its 8 neighbours.
  8390. @item 20
  8391. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8392. @item 21
  8393. Clips pixels using the averages of opposite neighbour.
  8394. @item 22
  8395. Same as mode 21 but simpler and faster.
  8396. @item 23
  8397. Small edge and halo removal, but reputed useless.
  8398. @item 24
  8399. Similar as 23.
  8400. @end table
  8401. @section removelogo
  8402. Suppress a TV station logo, using an image file to determine which
  8403. pixels comprise the logo. It works by filling in the pixels that
  8404. comprise the logo with neighboring pixels.
  8405. The filter accepts the following options:
  8406. @table @option
  8407. @item filename, f
  8408. Set the filter bitmap file, which can be any image format supported by
  8409. libavformat. The width and height of the image file must match those of the
  8410. video stream being processed.
  8411. @end table
  8412. Pixels in the provided bitmap image with a value of zero are not
  8413. considered part of the logo, non-zero pixels are considered part of
  8414. the logo. If you use white (255) for the logo and black (0) for the
  8415. rest, you will be safe. For making the filter bitmap, it is
  8416. recommended to take a screen capture of a black frame with the logo
  8417. visible, and then using a threshold filter followed by the erode
  8418. filter once or twice.
  8419. If needed, little splotches can be fixed manually. Remember that if
  8420. logo pixels are not covered, the filter quality will be much
  8421. reduced. Marking too many pixels as part of the logo does not hurt as
  8422. much, but it will increase the amount of blurring needed to cover over
  8423. the image and will destroy more information than necessary, and extra
  8424. pixels will slow things down on a large logo.
  8425. @section repeatfields
  8426. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8427. fields based on its value.
  8428. @section reverse
  8429. Reverse a video clip.
  8430. Warning: This filter requires memory to buffer the entire clip, so trimming
  8431. is suggested.
  8432. @subsection Examples
  8433. @itemize
  8434. @item
  8435. Take the first 5 seconds of a clip, and reverse it.
  8436. @example
  8437. trim=end=5,reverse
  8438. @end example
  8439. @end itemize
  8440. @section rotate
  8441. Rotate video by an arbitrary angle expressed in radians.
  8442. The filter accepts the following options:
  8443. A description of the optional parameters follows.
  8444. @table @option
  8445. @item angle, a
  8446. Set an expression for the angle by which to rotate the input video
  8447. clockwise, expressed as a number of radians. A negative value will
  8448. result in a counter-clockwise rotation. By default it is set to "0".
  8449. This expression is evaluated for each frame.
  8450. @item out_w, ow
  8451. Set the output width expression, default value is "iw".
  8452. This expression is evaluated just once during configuration.
  8453. @item out_h, oh
  8454. Set the output height expression, default value is "ih".
  8455. This expression is evaluated just once during configuration.
  8456. @item bilinear
  8457. Enable bilinear interpolation if set to 1, a value of 0 disables
  8458. it. Default value is 1.
  8459. @item fillcolor, c
  8460. Set the color used to fill the output area not covered by the rotated
  8461. image. For the general syntax of this option, check the "Color" section in the
  8462. ffmpeg-utils manual. If the special value "none" is selected then no
  8463. background is printed (useful for example if the background is never shown).
  8464. Default value is "black".
  8465. @end table
  8466. The expressions for the angle and the output size can contain the
  8467. following constants and functions:
  8468. @table @option
  8469. @item n
  8470. sequential number of the input frame, starting from 0. It is always NAN
  8471. before the first frame is filtered.
  8472. @item t
  8473. time in seconds of the input frame, it is set to 0 when the filter is
  8474. configured. It is always NAN before the first frame is filtered.
  8475. @item hsub
  8476. @item vsub
  8477. horizontal and vertical chroma subsample values. For example for the
  8478. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8479. @item in_w, iw
  8480. @item in_h, ih
  8481. the input video width and height
  8482. @item out_w, ow
  8483. @item out_h, oh
  8484. the output width and height, that is the size of the padded area as
  8485. specified by the @var{width} and @var{height} expressions
  8486. @item rotw(a)
  8487. @item roth(a)
  8488. the minimal width/height required for completely containing the input
  8489. video rotated by @var{a} radians.
  8490. These are only available when computing the @option{out_w} and
  8491. @option{out_h} expressions.
  8492. @end table
  8493. @subsection Examples
  8494. @itemize
  8495. @item
  8496. Rotate the input by PI/6 radians clockwise:
  8497. @example
  8498. rotate=PI/6
  8499. @end example
  8500. @item
  8501. Rotate the input by PI/6 radians counter-clockwise:
  8502. @example
  8503. rotate=-PI/6
  8504. @end example
  8505. @item
  8506. Rotate the input by 45 degrees clockwise:
  8507. @example
  8508. rotate=45*PI/180
  8509. @end example
  8510. @item
  8511. Apply a constant rotation with period T, starting from an angle of PI/3:
  8512. @example
  8513. rotate=PI/3+2*PI*t/T
  8514. @end example
  8515. @item
  8516. Make the input video rotation oscillating with a period of T
  8517. seconds and an amplitude of A radians:
  8518. @example
  8519. rotate=A*sin(2*PI/T*t)
  8520. @end example
  8521. @item
  8522. Rotate the video, output size is chosen so that the whole rotating
  8523. input video is always completely contained in the output:
  8524. @example
  8525. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8526. @end example
  8527. @item
  8528. Rotate the video, reduce the output size so that no background is ever
  8529. shown:
  8530. @example
  8531. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8532. @end example
  8533. @end itemize
  8534. @subsection Commands
  8535. The filter supports the following commands:
  8536. @table @option
  8537. @item a, angle
  8538. Set the angle expression.
  8539. The command accepts the same syntax of the corresponding option.
  8540. If the specified expression is not valid, it is kept at its current
  8541. value.
  8542. @end table
  8543. @section sab
  8544. Apply Shape Adaptive Blur.
  8545. The filter accepts the following options:
  8546. @table @option
  8547. @item luma_radius, lr
  8548. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8549. value is 1.0. A greater value will result in a more blurred image, and
  8550. in slower processing.
  8551. @item luma_pre_filter_radius, lpfr
  8552. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8553. value is 1.0.
  8554. @item luma_strength, ls
  8555. Set luma maximum difference between pixels to still be considered, must
  8556. be a value in the 0.1-100.0 range, default value is 1.0.
  8557. @item chroma_radius, cr
  8558. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8559. greater value will result in a more blurred image, and in slower
  8560. processing.
  8561. @item chroma_pre_filter_radius, cpfr
  8562. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8563. @item chroma_strength, cs
  8564. Set chroma maximum difference between pixels to still be considered,
  8565. must be a value in the -0.9-100.0 range.
  8566. @end table
  8567. Each chroma option value, if not explicitly specified, is set to the
  8568. corresponding luma option value.
  8569. @anchor{scale}
  8570. @section scale
  8571. Scale (resize) the input video, using the libswscale library.
  8572. The scale filter forces the output display aspect ratio to be the same
  8573. of the input, by changing the output sample aspect ratio.
  8574. If the input image format is different from the format requested by
  8575. the next filter, the scale filter will convert the input to the
  8576. requested format.
  8577. @subsection Options
  8578. The filter accepts the following options, or any of the options
  8579. supported by the libswscale scaler.
  8580. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8581. the complete list of scaler options.
  8582. @table @option
  8583. @item width, w
  8584. @item height, h
  8585. Set the output video dimension expression. Default value is the input
  8586. dimension.
  8587. If the value is 0, the input width is used for the output.
  8588. If one of the values is -1, the scale filter will use a value that
  8589. maintains the aspect ratio of the input image, calculated from the
  8590. other specified dimension. If both of them are -1, the input size is
  8591. used
  8592. If one of the values is -n with n > 1, the scale filter will also use a value
  8593. that maintains the aspect ratio of the input image, calculated from the other
  8594. specified dimension. After that it will, however, make sure that the calculated
  8595. dimension is divisible by n and adjust the value if necessary.
  8596. See below for the list of accepted constants for use in the dimension
  8597. expression.
  8598. @item eval
  8599. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8600. @table @samp
  8601. @item init
  8602. Only evaluate expressions once during the filter initialization or when a command is processed.
  8603. @item frame
  8604. Evaluate expressions for each incoming frame.
  8605. @end table
  8606. Default value is @samp{init}.
  8607. @item interl
  8608. Set the interlacing mode. It accepts the following values:
  8609. @table @samp
  8610. @item 1
  8611. Force interlaced aware scaling.
  8612. @item 0
  8613. Do not apply interlaced scaling.
  8614. @item -1
  8615. Select interlaced aware scaling depending on whether the source frames
  8616. are flagged as interlaced or not.
  8617. @end table
  8618. Default value is @samp{0}.
  8619. @item flags
  8620. Set libswscale scaling flags. See
  8621. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8622. complete list of values. If not explicitly specified the filter applies
  8623. the default flags.
  8624. @item param0, param1
  8625. Set libswscale input parameters for scaling algorithms that need them. See
  8626. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8627. complete documentation. If not explicitly specified the filter applies
  8628. empty parameters.
  8629. @item size, s
  8630. Set the video size. For the syntax of this option, check the
  8631. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8632. @item in_color_matrix
  8633. @item out_color_matrix
  8634. Set in/output YCbCr color space type.
  8635. This allows the autodetected value to be overridden as well as allows forcing
  8636. a specific value used for the output and encoder.
  8637. If not specified, the color space type depends on the pixel format.
  8638. Possible values:
  8639. @table @samp
  8640. @item auto
  8641. Choose automatically.
  8642. @item bt709
  8643. Format conforming to International Telecommunication Union (ITU)
  8644. Recommendation BT.709.
  8645. @item fcc
  8646. Set color space conforming to the United States Federal Communications
  8647. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8648. @item bt601
  8649. Set color space conforming to:
  8650. @itemize
  8651. @item
  8652. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8653. @item
  8654. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8655. @item
  8656. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8657. @end itemize
  8658. @item smpte240m
  8659. Set color space conforming to SMPTE ST 240:1999.
  8660. @end table
  8661. @item in_range
  8662. @item out_range
  8663. Set in/output YCbCr sample range.
  8664. This allows the autodetected value to be overridden as well as allows forcing
  8665. a specific value used for the output and encoder. If not specified, the
  8666. range depends on the pixel format. Possible values:
  8667. @table @samp
  8668. @item auto
  8669. Choose automatically.
  8670. @item jpeg/full/pc
  8671. Set full range (0-255 in case of 8-bit luma).
  8672. @item mpeg/tv
  8673. Set "MPEG" range (16-235 in case of 8-bit luma).
  8674. @end table
  8675. @item force_original_aspect_ratio
  8676. Enable decreasing or increasing output video width or height if necessary to
  8677. keep the original aspect ratio. Possible values:
  8678. @table @samp
  8679. @item disable
  8680. Scale the video as specified and disable this feature.
  8681. @item decrease
  8682. The output video dimensions will automatically be decreased if needed.
  8683. @item increase
  8684. The output video dimensions will automatically be increased if needed.
  8685. @end table
  8686. One useful instance of this option is that when you know a specific device's
  8687. maximum allowed resolution, you can use this to limit the output video to
  8688. that, while retaining the aspect ratio. For example, device A allows
  8689. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8690. decrease) and specifying 1280x720 to the command line makes the output
  8691. 1280x533.
  8692. Please note that this is a different thing than specifying -1 for @option{w}
  8693. or @option{h}, you still need to specify the output resolution for this option
  8694. to work.
  8695. @end table
  8696. The values of the @option{w} and @option{h} options are expressions
  8697. containing the following constants:
  8698. @table @var
  8699. @item in_w
  8700. @item in_h
  8701. The input width and height
  8702. @item iw
  8703. @item ih
  8704. These are the same as @var{in_w} and @var{in_h}.
  8705. @item out_w
  8706. @item out_h
  8707. The output (scaled) width and height
  8708. @item ow
  8709. @item oh
  8710. These are the same as @var{out_w} and @var{out_h}
  8711. @item a
  8712. The same as @var{iw} / @var{ih}
  8713. @item sar
  8714. input sample aspect ratio
  8715. @item dar
  8716. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8717. @item hsub
  8718. @item vsub
  8719. horizontal and vertical input chroma subsample values. For example for the
  8720. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8721. @item ohsub
  8722. @item ovsub
  8723. horizontal and vertical output chroma subsample values. For example for the
  8724. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8725. @end table
  8726. @subsection Examples
  8727. @itemize
  8728. @item
  8729. Scale the input video to a size of 200x100
  8730. @example
  8731. scale=w=200:h=100
  8732. @end example
  8733. This is equivalent to:
  8734. @example
  8735. scale=200:100
  8736. @end example
  8737. or:
  8738. @example
  8739. scale=200x100
  8740. @end example
  8741. @item
  8742. Specify a size abbreviation for the output size:
  8743. @example
  8744. scale=qcif
  8745. @end example
  8746. which can also be written as:
  8747. @example
  8748. scale=size=qcif
  8749. @end example
  8750. @item
  8751. Scale the input to 2x:
  8752. @example
  8753. scale=w=2*iw:h=2*ih
  8754. @end example
  8755. @item
  8756. The above is the same as:
  8757. @example
  8758. scale=2*in_w:2*in_h
  8759. @end example
  8760. @item
  8761. Scale the input to 2x with forced interlaced scaling:
  8762. @example
  8763. scale=2*iw:2*ih:interl=1
  8764. @end example
  8765. @item
  8766. Scale the input to half size:
  8767. @example
  8768. scale=w=iw/2:h=ih/2
  8769. @end example
  8770. @item
  8771. Increase the width, and set the height to the same size:
  8772. @example
  8773. scale=3/2*iw:ow
  8774. @end example
  8775. @item
  8776. Seek Greek harmony:
  8777. @example
  8778. scale=iw:1/PHI*iw
  8779. scale=ih*PHI:ih
  8780. @end example
  8781. @item
  8782. Increase the height, and set the width to 3/2 of the height:
  8783. @example
  8784. scale=w=3/2*oh:h=3/5*ih
  8785. @end example
  8786. @item
  8787. Increase the size, making the size a multiple of the chroma
  8788. subsample values:
  8789. @example
  8790. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8791. @end example
  8792. @item
  8793. Increase the width to a maximum of 500 pixels,
  8794. keeping the same aspect ratio as the input:
  8795. @example
  8796. scale=w='min(500\, iw*3/2):h=-1'
  8797. @end example
  8798. @end itemize
  8799. @subsection Commands
  8800. This filter supports the following commands:
  8801. @table @option
  8802. @item width, w
  8803. @item height, h
  8804. Set the output video dimension expression.
  8805. The command accepts the same syntax of the corresponding option.
  8806. If the specified expression is not valid, it is kept at its current
  8807. value.
  8808. @end table
  8809. @section scale_npp
  8810. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  8811. format conversion on CUDA video frames. Setting the output width and height
  8812. works in the same way as for the @var{scale} filter.
  8813. The following additional options are accepted:
  8814. @table @option
  8815. @item format
  8816. The pixel format of the output CUDA frames. If set to the string "same" (the
  8817. default), the input format will be kept. Note that automatic format negotiation
  8818. and conversion is not yet supported for hardware frames
  8819. @item interp_algo
  8820. The interpolation algorithm used for resizing. One of the following:
  8821. @table @option
  8822. @item nn
  8823. Nearest neighbour.
  8824. @item linear
  8825. @item cubic
  8826. @item cubic2p_bspline
  8827. 2-parameter cubic (B=1, C=0)
  8828. @item cubic2p_catmullrom
  8829. 2-parameter cubic (B=0, C=1/2)
  8830. @item cubic2p_b05c03
  8831. 2-parameter cubic (B=1/2, C=3/10)
  8832. @item super
  8833. Supersampling
  8834. @item lanczos
  8835. @end table
  8836. @end table
  8837. @section scale2ref
  8838. Scale (resize) the input video, based on a reference video.
  8839. See the scale filter for available options, scale2ref supports the same but
  8840. uses the reference video instead of the main input as basis.
  8841. @subsection Examples
  8842. @itemize
  8843. @item
  8844. Scale a subtitle stream to match the main video in size before overlaying
  8845. @example
  8846. 'scale2ref[b][a];[a][b]overlay'
  8847. @end example
  8848. @end itemize
  8849. @anchor{selectivecolor}
  8850. @section selectivecolor
  8851. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8852. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8853. by the "purity" of the color (that is, how saturated it already is).
  8854. This filter is similar to the Adobe Photoshop Selective Color tool.
  8855. The filter accepts the following options:
  8856. @table @option
  8857. @item correction_method
  8858. Select color correction method.
  8859. Available values are:
  8860. @table @samp
  8861. @item absolute
  8862. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8863. component value).
  8864. @item relative
  8865. Specified adjustments are relative to the original component value.
  8866. @end table
  8867. Default is @code{absolute}.
  8868. @item reds
  8869. Adjustments for red pixels (pixels where the red component is the maximum)
  8870. @item yellows
  8871. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8872. @item greens
  8873. Adjustments for green pixels (pixels where the green component is the maximum)
  8874. @item cyans
  8875. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8876. @item blues
  8877. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8878. @item magentas
  8879. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8880. @item whites
  8881. Adjustments for white pixels (pixels where all components are greater than 128)
  8882. @item neutrals
  8883. Adjustments for all pixels except pure black and pure white
  8884. @item blacks
  8885. Adjustments for black pixels (pixels where all components are lesser than 128)
  8886. @item psfile
  8887. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8888. @end table
  8889. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8890. 4 space separated floating point adjustment values in the [-1,1] range,
  8891. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8892. pixels of its range.
  8893. @subsection Examples
  8894. @itemize
  8895. @item
  8896. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8897. increase magenta by 27% in blue areas:
  8898. @example
  8899. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8900. @end example
  8901. @item
  8902. Use a Photoshop selective color preset:
  8903. @example
  8904. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8905. @end example
  8906. @end itemize
  8907. @section separatefields
  8908. The @code{separatefields} takes a frame-based video input and splits
  8909. each frame into its components fields, producing a new half height clip
  8910. with twice the frame rate and twice the frame count.
  8911. This filter use field-dominance information in frame to decide which
  8912. of each pair of fields to place first in the output.
  8913. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8914. @section setdar, setsar
  8915. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8916. output video.
  8917. This is done by changing the specified Sample (aka Pixel) Aspect
  8918. Ratio, according to the following equation:
  8919. @example
  8920. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8921. @end example
  8922. Keep in mind that the @code{setdar} filter does not modify the pixel
  8923. dimensions of the video frame. Also, the display aspect ratio set by
  8924. this filter may be changed by later filters in the filterchain,
  8925. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8926. applied.
  8927. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8928. the filter output video.
  8929. Note that as a consequence of the application of this filter, the
  8930. output display aspect ratio will change according to the equation
  8931. above.
  8932. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8933. filter may be changed by later filters in the filterchain, e.g. if
  8934. another "setsar" or a "setdar" filter is applied.
  8935. It accepts the following parameters:
  8936. @table @option
  8937. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8938. Set the aspect ratio used by the filter.
  8939. The parameter can be a floating point number string, an expression, or
  8940. a string of the form @var{num}:@var{den}, where @var{num} and
  8941. @var{den} are the numerator and denominator of the aspect ratio. If
  8942. the parameter is not specified, it is assumed the value "0".
  8943. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8944. should be escaped.
  8945. @item max
  8946. Set the maximum integer value to use for expressing numerator and
  8947. denominator when reducing the expressed aspect ratio to a rational.
  8948. Default value is @code{100}.
  8949. @end table
  8950. The parameter @var{sar} is an expression containing
  8951. the following constants:
  8952. @table @option
  8953. @item E, PI, PHI
  8954. These are approximated values for the mathematical constants e
  8955. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8956. @item w, h
  8957. The input width and height.
  8958. @item a
  8959. These are the same as @var{w} / @var{h}.
  8960. @item sar
  8961. The input sample aspect ratio.
  8962. @item dar
  8963. The input display aspect ratio. It is the same as
  8964. (@var{w} / @var{h}) * @var{sar}.
  8965. @item hsub, vsub
  8966. Horizontal and vertical chroma subsample values. For example, for the
  8967. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8968. @end table
  8969. @subsection Examples
  8970. @itemize
  8971. @item
  8972. To change the display aspect ratio to 16:9, specify one of the following:
  8973. @example
  8974. setdar=dar=1.77777
  8975. setdar=dar=16/9
  8976. @end example
  8977. @item
  8978. To change the sample aspect ratio to 10:11, specify:
  8979. @example
  8980. setsar=sar=10/11
  8981. @end example
  8982. @item
  8983. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8984. 1000 in the aspect ratio reduction, use the command:
  8985. @example
  8986. setdar=ratio=16/9:max=1000
  8987. @end example
  8988. @end itemize
  8989. @anchor{setfield}
  8990. @section setfield
  8991. Force field for the output video frame.
  8992. The @code{setfield} filter marks the interlace type field for the
  8993. output frames. It does not change the input frame, but only sets the
  8994. corresponding property, which affects how the frame is treated by
  8995. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8996. The filter accepts the following options:
  8997. @table @option
  8998. @item mode
  8999. Available values are:
  9000. @table @samp
  9001. @item auto
  9002. Keep the same field property.
  9003. @item bff
  9004. Mark the frame as bottom-field-first.
  9005. @item tff
  9006. Mark the frame as top-field-first.
  9007. @item prog
  9008. Mark the frame as progressive.
  9009. @end table
  9010. @end table
  9011. @section showinfo
  9012. Show a line containing various information for each input video frame.
  9013. The input video is not modified.
  9014. The shown line contains a sequence of key/value pairs of the form
  9015. @var{key}:@var{value}.
  9016. The following values are shown in the output:
  9017. @table @option
  9018. @item n
  9019. The (sequential) number of the input frame, starting from 0.
  9020. @item pts
  9021. The Presentation TimeStamp of the input frame, expressed as a number of
  9022. time base units. The time base unit depends on the filter input pad.
  9023. @item pts_time
  9024. The Presentation TimeStamp of the input frame, expressed as a number of
  9025. seconds.
  9026. @item pos
  9027. The position of the frame in the input stream, or -1 if this information is
  9028. unavailable and/or meaningless (for example in case of synthetic video).
  9029. @item fmt
  9030. The pixel format name.
  9031. @item sar
  9032. The sample aspect ratio of the input frame, expressed in the form
  9033. @var{num}/@var{den}.
  9034. @item s
  9035. The size of the input frame. For the syntax of this option, check the
  9036. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9037. @item i
  9038. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9039. for bottom field first).
  9040. @item iskey
  9041. This is 1 if the frame is a key frame, 0 otherwise.
  9042. @item type
  9043. The picture type of the input frame ("I" for an I-frame, "P" for a
  9044. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9045. Also refer to the documentation of the @code{AVPictureType} enum and of
  9046. the @code{av_get_picture_type_char} function defined in
  9047. @file{libavutil/avutil.h}.
  9048. @item checksum
  9049. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9050. @item plane_checksum
  9051. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9052. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9053. @end table
  9054. @section showpalette
  9055. Displays the 256 colors palette of each frame. This filter is only relevant for
  9056. @var{pal8} pixel format frames.
  9057. It accepts the following option:
  9058. @table @option
  9059. @item s
  9060. Set the size of the box used to represent one palette color entry. Default is
  9061. @code{30} (for a @code{30x30} pixel box).
  9062. @end table
  9063. @section shuffleframes
  9064. Reorder and/or duplicate video frames.
  9065. It accepts the following parameters:
  9066. @table @option
  9067. @item mapping
  9068. Set the destination indexes of input frames.
  9069. This is space or '|' separated list of indexes that maps input frames to output
  9070. frames. Number of indexes also sets maximal value that each index may have.
  9071. @end table
  9072. The first frame has the index 0. The default is to keep the input unchanged.
  9073. Swap second and third frame of every three frames of the input:
  9074. @example
  9075. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9076. @end example
  9077. @section shuffleplanes
  9078. Reorder and/or duplicate video planes.
  9079. It accepts the following parameters:
  9080. @table @option
  9081. @item map0
  9082. The index of the input plane to be used as the first output plane.
  9083. @item map1
  9084. The index of the input plane to be used as the second output plane.
  9085. @item map2
  9086. The index of the input plane to be used as the third output plane.
  9087. @item map3
  9088. The index of the input plane to be used as the fourth output plane.
  9089. @end table
  9090. The first plane has the index 0. The default is to keep the input unchanged.
  9091. Swap the second and third planes of the input:
  9092. @example
  9093. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9094. @end example
  9095. @anchor{signalstats}
  9096. @section signalstats
  9097. Evaluate various visual metrics that assist in determining issues associated
  9098. with the digitization of analog video media.
  9099. By default the filter will log these metadata values:
  9100. @table @option
  9101. @item YMIN
  9102. Display the minimal Y value contained within the input frame. Expressed in
  9103. range of [0-255].
  9104. @item YLOW
  9105. Display the Y value at the 10% percentile within the input frame. Expressed in
  9106. range of [0-255].
  9107. @item YAVG
  9108. Display the average Y value within the input frame. Expressed in range of
  9109. [0-255].
  9110. @item YHIGH
  9111. Display the Y value at the 90% percentile within the input frame. Expressed in
  9112. range of [0-255].
  9113. @item YMAX
  9114. Display the maximum Y value contained within the input frame. Expressed in
  9115. range of [0-255].
  9116. @item UMIN
  9117. Display the minimal U value contained within the input frame. Expressed in
  9118. range of [0-255].
  9119. @item ULOW
  9120. Display the U value at the 10% percentile within the input frame. Expressed in
  9121. range of [0-255].
  9122. @item UAVG
  9123. Display the average U value within the input frame. Expressed in range of
  9124. [0-255].
  9125. @item UHIGH
  9126. Display the U value at the 90% percentile within the input frame. Expressed in
  9127. range of [0-255].
  9128. @item UMAX
  9129. Display the maximum U value contained within the input frame. Expressed in
  9130. range of [0-255].
  9131. @item VMIN
  9132. Display the minimal V value contained within the input frame. Expressed in
  9133. range of [0-255].
  9134. @item VLOW
  9135. Display the V value at the 10% percentile within the input frame. Expressed in
  9136. range of [0-255].
  9137. @item VAVG
  9138. Display the average V value within the input frame. Expressed in range of
  9139. [0-255].
  9140. @item VHIGH
  9141. Display the V value at the 90% percentile within the input frame. Expressed in
  9142. range of [0-255].
  9143. @item VMAX
  9144. Display the maximum V value contained within the input frame. Expressed in
  9145. range of [0-255].
  9146. @item SATMIN
  9147. Display the minimal saturation value contained within the input frame.
  9148. Expressed in range of [0-~181.02].
  9149. @item SATLOW
  9150. Display the saturation value at the 10% percentile within the input frame.
  9151. Expressed in range of [0-~181.02].
  9152. @item SATAVG
  9153. Display the average saturation value within the input frame. Expressed in range
  9154. of [0-~181.02].
  9155. @item SATHIGH
  9156. Display the saturation value at the 90% percentile within the input frame.
  9157. Expressed in range of [0-~181.02].
  9158. @item SATMAX
  9159. Display the maximum saturation value contained within the input frame.
  9160. Expressed in range of [0-~181.02].
  9161. @item HUEMED
  9162. Display the median value for hue within the input frame. Expressed in range of
  9163. [0-360].
  9164. @item HUEAVG
  9165. Display the average value for hue within the input frame. Expressed in range of
  9166. [0-360].
  9167. @item YDIF
  9168. Display the average of sample value difference between all values of the Y
  9169. plane in the current frame and corresponding values of the previous input frame.
  9170. Expressed in range of [0-255].
  9171. @item UDIF
  9172. Display the average of sample value difference between all values of the U
  9173. plane in the current frame and corresponding values of the previous input frame.
  9174. Expressed in range of [0-255].
  9175. @item VDIF
  9176. Display the average of sample value difference between all values of the V
  9177. plane in the current frame and corresponding values of the previous input frame.
  9178. Expressed in range of [0-255].
  9179. @item YBITDEPTH
  9180. Display bit depth of Y plane in current frame.
  9181. Expressed in range of [0-16].
  9182. @item UBITDEPTH
  9183. Display bit depth of U plane in current frame.
  9184. Expressed in range of [0-16].
  9185. @item VBITDEPTH
  9186. Display bit depth of V plane in current frame.
  9187. Expressed in range of [0-16].
  9188. @end table
  9189. The filter accepts the following options:
  9190. @table @option
  9191. @item stat
  9192. @item out
  9193. @option{stat} specify an additional form of image analysis.
  9194. @option{out} output video with the specified type of pixel highlighted.
  9195. Both options accept the following values:
  9196. @table @samp
  9197. @item tout
  9198. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9199. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9200. include the results of video dropouts, head clogs, or tape tracking issues.
  9201. @item vrep
  9202. Identify @var{vertical line repetition}. Vertical line repetition includes
  9203. similar rows of pixels within a frame. In born-digital video vertical line
  9204. repetition is common, but this pattern is uncommon in video digitized from an
  9205. analog source. When it occurs in video that results from the digitization of an
  9206. analog source it can indicate concealment from a dropout compensator.
  9207. @item brng
  9208. Identify pixels that fall outside of legal broadcast range.
  9209. @end table
  9210. @item color, c
  9211. Set the highlight color for the @option{out} option. The default color is
  9212. yellow.
  9213. @end table
  9214. @subsection Examples
  9215. @itemize
  9216. @item
  9217. Output data of various video metrics:
  9218. @example
  9219. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9220. @end example
  9221. @item
  9222. Output specific data about the minimum and maximum values of the Y plane per frame:
  9223. @example
  9224. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9225. @end example
  9226. @item
  9227. Playback video while highlighting pixels that are outside of broadcast range in red.
  9228. @example
  9229. ffplay example.mov -vf signalstats="out=brng:color=red"
  9230. @end example
  9231. @item
  9232. Playback video with signalstats metadata drawn over the frame.
  9233. @example
  9234. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9235. @end example
  9236. The contents of signalstat_drawtext.txt used in the command are:
  9237. @example
  9238. time %@{pts:hms@}
  9239. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9240. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9241. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9242. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9243. @end example
  9244. @end itemize
  9245. @anchor{smartblur}
  9246. @section smartblur
  9247. Blur the input video without impacting the outlines.
  9248. It accepts the following options:
  9249. @table @option
  9250. @item luma_radius, lr
  9251. Set the luma radius. The option value must be a float number in
  9252. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9253. used to blur the image (slower if larger). Default value is 1.0.
  9254. @item luma_strength, ls
  9255. Set the luma strength. The option value must be a float number
  9256. in the range [-1.0,1.0] that configures the blurring. A value included
  9257. in [0.0,1.0] will blur the image whereas a value included in
  9258. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9259. @item luma_threshold, lt
  9260. Set the luma threshold used as a coefficient to determine
  9261. whether a pixel should be blurred or not. The option value must be an
  9262. integer in the range [-30,30]. A value of 0 will filter all the image,
  9263. a value included in [0,30] will filter flat areas and a value included
  9264. in [-30,0] will filter edges. Default value is 0.
  9265. @item chroma_radius, cr
  9266. Set the chroma radius. The option value must be a float number in
  9267. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9268. used to blur the image (slower if larger). Default value is 1.0.
  9269. @item chroma_strength, cs
  9270. Set the chroma strength. The option value must be a float number
  9271. in the range [-1.0,1.0] that configures the blurring. A value included
  9272. in [0.0,1.0] will blur the image whereas a value included in
  9273. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9274. @item chroma_threshold, ct
  9275. Set the chroma threshold used as a coefficient to determine
  9276. whether a pixel should be blurred or not. The option value must be an
  9277. integer in the range [-30,30]. A value of 0 will filter all the image,
  9278. a value included in [0,30] will filter flat areas and a value included
  9279. in [-30,0] will filter edges. Default value is 0.
  9280. @end table
  9281. If a chroma option is not explicitly set, the corresponding luma value
  9282. is set.
  9283. @section ssim
  9284. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9285. This filter takes in input two input videos, the first input is
  9286. considered the "main" source and is passed unchanged to the
  9287. output. The second input is used as a "reference" video for computing
  9288. the SSIM.
  9289. Both video inputs must have the same resolution and pixel format for
  9290. this filter to work correctly. Also it assumes that both inputs
  9291. have the same number of frames, which are compared one by one.
  9292. The filter stores the calculated SSIM of each frame.
  9293. The description of the accepted parameters follows.
  9294. @table @option
  9295. @item stats_file, f
  9296. If specified the filter will use the named file to save the SSIM of
  9297. each individual frame. When filename equals "-" the data is sent to
  9298. standard output.
  9299. @end table
  9300. The file printed if @var{stats_file} is selected, contains a sequence of
  9301. key/value pairs of the form @var{key}:@var{value} for each compared
  9302. couple of frames.
  9303. A description of each shown parameter follows:
  9304. @table @option
  9305. @item n
  9306. sequential number of the input frame, starting from 1
  9307. @item Y, U, V, R, G, B
  9308. SSIM of the compared frames for the component specified by the suffix.
  9309. @item All
  9310. SSIM of the compared frames for the whole frame.
  9311. @item dB
  9312. Same as above but in dB representation.
  9313. @end table
  9314. For example:
  9315. @example
  9316. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9317. [main][ref] ssim="stats_file=stats.log" [out]
  9318. @end example
  9319. On this example the input file being processed is compared with the
  9320. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9321. is stored in @file{stats.log}.
  9322. Another example with both psnr and ssim at same time:
  9323. @example
  9324. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9325. @end example
  9326. @section stereo3d
  9327. Convert between different stereoscopic image formats.
  9328. The filters accept the following options:
  9329. @table @option
  9330. @item in
  9331. Set stereoscopic image format of input.
  9332. Available values for input image formats are:
  9333. @table @samp
  9334. @item sbsl
  9335. side by side parallel (left eye left, right eye right)
  9336. @item sbsr
  9337. side by side crosseye (right eye left, left eye right)
  9338. @item sbs2l
  9339. side by side parallel with half width resolution
  9340. (left eye left, right eye right)
  9341. @item sbs2r
  9342. side by side crosseye with half width resolution
  9343. (right eye left, left eye right)
  9344. @item abl
  9345. above-below (left eye above, right eye below)
  9346. @item abr
  9347. above-below (right eye above, left eye below)
  9348. @item ab2l
  9349. above-below with half height resolution
  9350. (left eye above, right eye below)
  9351. @item ab2r
  9352. above-below with half height resolution
  9353. (right eye above, left eye below)
  9354. @item al
  9355. alternating frames (left eye first, right eye second)
  9356. @item ar
  9357. alternating frames (right eye first, left eye second)
  9358. @item irl
  9359. interleaved rows (left eye has top row, right eye starts on next row)
  9360. @item irr
  9361. interleaved rows (right eye has top row, left eye starts on next row)
  9362. @item icl
  9363. interleaved columns, left eye first
  9364. @item icr
  9365. interleaved columns, right eye first
  9366. Default value is @samp{sbsl}.
  9367. @end table
  9368. @item out
  9369. Set stereoscopic image format of output.
  9370. @table @samp
  9371. @item sbsl
  9372. side by side parallel (left eye left, right eye right)
  9373. @item sbsr
  9374. side by side crosseye (right eye left, left eye right)
  9375. @item sbs2l
  9376. side by side parallel with half width resolution
  9377. (left eye left, right eye right)
  9378. @item sbs2r
  9379. side by side crosseye with half width resolution
  9380. (right eye left, left eye right)
  9381. @item abl
  9382. above-below (left eye above, right eye below)
  9383. @item abr
  9384. above-below (right eye above, left eye below)
  9385. @item ab2l
  9386. above-below with half height resolution
  9387. (left eye above, right eye below)
  9388. @item ab2r
  9389. above-below with half height resolution
  9390. (right eye above, left eye below)
  9391. @item al
  9392. alternating frames (left eye first, right eye second)
  9393. @item ar
  9394. alternating frames (right eye first, left eye second)
  9395. @item irl
  9396. interleaved rows (left eye has top row, right eye starts on next row)
  9397. @item irr
  9398. interleaved rows (right eye has top row, left eye starts on next row)
  9399. @item arbg
  9400. anaglyph red/blue gray
  9401. (red filter on left eye, blue filter on right eye)
  9402. @item argg
  9403. anaglyph red/green gray
  9404. (red filter on left eye, green filter on right eye)
  9405. @item arcg
  9406. anaglyph red/cyan gray
  9407. (red filter on left eye, cyan filter on right eye)
  9408. @item arch
  9409. anaglyph red/cyan half colored
  9410. (red filter on left eye, cyan filter on right eye)
  9411. @item arcc
  9412. anaglyph red/cyan color
  9413. (red filter on left eye, cyan filter on right eye)
  9414. @item arcd
  9415. anaglyph red/cyan color optimized with the least squares projection of dubois
  9416. (red filter on left eye, cyan filter on right eye)
  9417. @item agmg
  9418. anaglyph green/magenta gray
  9419. (green filter on left eye, magenta filter on right eye)
  9420. @item agmh
  9421. anaglyph green/magenta half colored
  9422. (green filter on left eye, magenta filter on right eye)
  9423. @item agmc
  9424. anaglyph green/magenta colored
  9425. (green filter on left eye, magenta filter on right eye)
  9426. @item agmd
  9427. anaglyph green/magenta color optimized with the least squares projection of dubois
  9428. (green filter on left eye, magenta filter on right eye)
  9429. @item aybg
  9430. anaglyph yellow/blue gray
  9431. (yellow filter on left eye, blue filter on right eye)
  9432. @item aybh
  9433. anaglyph yellow/blue half colored
  9434. (yellow filter on left eye, blue filter on right eye)
  9435. @item aybc
  9436. anaglyph yellow/blue colored
  9437. (yellow filter on left eye, blue filter on right eye)
  9438. @item aybd
  9439. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9440. (yellow filter on left eye, blue filter on right eye)
  9441. @item ml
  9442. mono output (left eye only)
  9443. @item mr
  9444. mono output (right eye only)
  9445. @item chl
  9446. checkerboard, left eye first
  9447. @item chr
  9448. checkerboard, right eye first
  9449. @item icl
  9450. interleaved columns, left eye first
  9451. @item icr
  9452. interleaved columns, right eye first
  9453. @item hdmi
  9454. HDMI frame pack
  9455. @end table
  9456. Default value is @samp{arcd}.
  9457. @end table
  9458. @subsection Examples
  9459. @itemize
  9460. @item
  9461. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9462. @example
  9463. stereo3d=sbsl:aybd
  9464. @end example
  9465. @item
  9466. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9467. @example
  9468. stereo3d=abl:sbsr
  9469. @end example
  9470. @end itemize
  9471. @section streamselect, astreamselect
  9472. Select video or audio streams.
  9473. The filter accepts the following options:
  9474. @table @option
  9475. @item inputs
  9476. Set number of inputs. Default is 2.
  9477. @item map
  9478. Set input indexes to remap to outputs.
  9479. @end table
  9480. @subsection Commands
  9481. The @code{streamselect} and @code{astreamselect} filter supports the following
  9482. commands:
  9483. @table @option
  9484. @item map
  9485. Set input indexes to remap to outputs.
  9486. @end table
  9487. @subsection Examples
  9488. @itemize
  9489. @item
  9490. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9491. @example
  9492. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9493. @end example
  9494. @item
  9495. Same as above, but for audio:
  9496. @example
  9497. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9498. @end example
  9499. @end itemize
  9500. @anchor{spp}
  9501. @section spp
  9502. Apply a simple postprocessing filter that compresses and decompresses the image
  9503. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9504. and average the results.
  9505. The filter accepts the following options:
  9506. @table @option
  9507. @item quality
  9508. Set quality. This option defines the number of levels for averaging. It accepts
  9509. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9510. effect. A value of @code{6} means the higher quality. For each increment of
  9511. that value the speed drops by a factor of approximately 2. Default value is
  9512. @code{3}.
  9513. @item qp
  9514. Force a constant quantization parameter. If not set, the filter will use the QP
  9515. from the video stream (if available).
  9516. @item mode
  9517. Set thresholding mode. Available modes are:
  9518. @table @samp
  9519. @item hard
  9520. Set hard thresholding (default).
  9521. @item soft
  9522. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9523. @end table
  9524. @item use_bframe_qp
  9525. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9526. option may cause flicker since the B-Frames have often larger QP. Default is
  9527. @code{0} (not enabled).
  9528. @end table
  9529. @anchor{subtitles}
  9530. @section subtitles
  9531. Draw subtitles on top of input video using the libass library.
  9532. To enable compilation of this filter you need to configure FFmpeg with
  9533. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9534. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9535. Alpha) subtitles format.
  9536. The filter accepts the following options:
  9537. @table @option
  9538. @item filename, f
  9539. Set the filename of the subtitle file to read. It must be specified.
  9540. @item original_size
  9541. Specify the size of the original video, the video for which the ASS file
  9542. was composed. For the syntax of this option, check the
  9543. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9544. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9545. correctly scale the fonts if the aspect ratio has been changed.
  9546. @item fontsdir
  9547. Set a directory path containing fonts that can be used by the filter.
  9548. These fonts will be used in addition to whatever the font provider uses.
  9549. @item charenc
  9550. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9551. useful if not UTF-8.
  9552. @item stream_index, si
  9553. Set subtitles stream index. @code{subtitles} filter only.
  9554. @item force_style
  9555. Override default style or script info parameters of the subtitles. It accepts a
  9556. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9557. @end table
  9558. If the first key is not specified, it is assumed that the first value
  9559. specifies the @option{filename}.
  9560. For example, to render the file @file{sub.srt} on top of the input
  9561. video, use the command:
  9562. @example
  9563. subtitles=sub.srt
  9564. @end example
  9565. which is equivalent to:
  9566. @example
  9567. subtitles=filename=sub.srt
  9568. @end example
  9569. To render the default subtitles stream from file @file{video.mkv}, use:
  9570. @example
  9571. subtitles=video.mkv
  9572. @end example
  9573. To render the second subtitles stream from that file, use:
  9574. @example
  9575. subtitles=video.mkv:si=1
  9576. @end example
  9577. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9578. @code{DejaVu Serif}, use:
  9579. @example
  9580. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9581. @end example
  9582. @section super2xsai
  9583. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9584. Interpolate) pixel art scaling algorithm.
  9585. Useful for enlarging pixel art images without reducing sharpness.
  9586. @section swaprect
  9587. Swap two rectangular objects in video.
  9588. This filter accepts the following options:
  9589. @table @option
  9590. @item w
  9591. Set object width.
  9592. @item h
  9593. Set object height.
  9594. @item x1
  9595. Set 1st rect x coordinate.
  9596. @item y1
  9597. Set 1st rect y coordinate.
  9598. @item x2
  9599. Set 2nd rect x coordinate.
  9600. @item y2
  9601. Set 2nd rect y coordinate.
  9602. All expressions are evaluated once for each frame.
  9603. @end table
  9604. The all options are expressions containing the following constants:
  9605. @table @option
  9606. @item w
  9607. @item h
  9608. The input width and height.
  9609. @item a
  9610. same as @var{w} / @var{h}
  9611. @item sar
  9612. input sample aspect ratio
  9613. @item dar
  9614. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9615. @item n
  9616. The number of the input frame, starting from 0.
  9617. @item t
  9618. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9619. @item pos
  9620. the position in the file of the input frame, NAN if unknown
  9621. @end table
  9622. @section swapuv
  9623. Swap U & V plane.
  9624. @section telecine
  9625. Apply telecine process to the video.
  9626. This filter accepts the following options:
  9627. @table @option
  9628. @item first_field
  9629. @table @samp
  9630. @item top, t
  9631. top field first
  9632. @item bottom, b
  9633. bottom field first
  9634. The default value is @code{top}.
  9635. @end table
  9636. @item pattern
  9637. A string of numbers representing the pulldown pattern you wish to apply.
  9638. The default value is @code{23}.
  9639. @end table
  9640. @example
  9641. Some typical patterns:
  9642. NTSC output (30i):
  9643. 27.5p: 32222
  9644. 24p: 23 (classic)
  9645. 24p: 2332 (preferred)
  9646. 20p: 33
  9647. 18p: 334
  9648. 16p: 3444
  9649. PAL output (25i):
  9650. 27.5p: 12222
  9651. 24p: 222222222223 ("Euro pulldown")
  9652. 16.67p: 33
  9653. 16p: 33333334
  9654. @end example
  9655. @section thumbnail
  9656. Select the most representative frame in a given sequence of consecutive frames.
  9657. The filter accepts the following options:
  9658. @table @option
  9659. @item n
  9660. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9661. will pick one of them, and then handle the next batch of @var{n} frames until
  9662. the end. Default is @code{100}.
  9663. @end table
  9664. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9665. value will result in a higher memory usage, so a high value is not recommended.
  9666. @subsection Examples
  9667. @itemize
  9668. @item
  9669. Extract one picture each 50 frames:
  9670. @example
  9671. thumbnail=50
  9672. @end example
  9673. @item
  9674. Complete example of a thumbnail creation with @command{ffmpeg}:
  9675. @example
  9676. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9677. @end example
  9678. @end itemize
  9679. @section tile
  9680. Tile several successive frames together.
  9681. The filter accepts the following options:
  9682. @table @option
  9683. @item layout
  9684. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9685. this option, check the
  9686. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9687. @item nb_frames
  9688. Set the maximum number of frames to render in the given area. It must be less
  9689. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9690. the area will be used.
  9691. @item margin
  9692. Set the outer border margin in pixels.
  9693. @item padding
  9694. Set the inner border thickness (i.e. the number of pixels between frames). For
  9695. more advanced padding options (such as having different values for the edges),
  9696. refer to the pad video filter.
  9697. @item color
  9698. Specify the color of the unused area. For the syntax of this option, check the
  9699. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9700. is "black".
  9701. @end table
  9702. @subsection Examples
  9703. @itemize
  9704. @item
  9705. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9706. @example
  9707. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9708. @end example
  9709. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9710. duplicating each output frame to accommodate the originally detected frame
  9711. rate.
  9712. @item
  9713. Display @code{5} pictures in an area of @code{3x2} frames,
  9714. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9715. mixed flat and named options:
  9716. @example
  9717. tile=3x2:nb_frames=5:padding=7:margin=2
  9718. @end example
  9719. @end itemize
  9720. @section tinterlace
  9721. Perform various types of temporal field interlacing.
  9722. Frames are counted starting from 1, so the first input frame is
  9723. considered odd.
  9724. The filter accepts the following options:
  9725. @table @option
  9726. @item mode
  9727. Specify the mode of the interlacing. This option can also be specified
  9728. as a value alone. See below for a list of values for this option.
  9729. Available values are:
  9730. @table @samp
  9731. @item merge, 0
  9732. Move odd frames into the upper field, even into the lower field,
  9733. generating a double height frame at half frame rate.
  9734. @example
  9735. ------> time
  9736. Input:
  9737. Frame 1 Frame 2 Frame 3 Frame 4
  9738. 11111 22222 33333 44444
  9739. 11111 22222 33333 44444
  9740. 11111 22222 33333 44444
  9741. 11111 22222 33333 44444
  9742. Output:
  9743. 11111 33333
  9744. 22222 44444
  9745. 11111 33333
  9746. 22222 44444
  9747. 11111 33333
  9748. 22222 44444
  9749. 11111 33333
  9750. 22222 44444
  9751. @end example
  9752. @item drop_even, 1
  9753. Only output odd frames, even frames are dropped, generating a frame with
  9754. unchanged height at half frame rate.
  9755. @example
  9756. ------> time
  9757. Input:
  9758. Frame 1 Frame 2 Frame 3 Frame 4
  9759. 11111 22222 33333 44444
  9760. 11111 22222 33333 44444
  9761. 11111 22222 33333 44444
  9762. 11111 22222 33333 44444
  9763. Output:
  9764. 11111 33333
  9765. 11111 33333
  9766. 11111 33333
  9767. 11111 33333
  9768. @end example
  9769. @item drop_odd, 2
  9770. Only output even frames, odd frames are dropped, generating a frame with
  9771. unchanged height at half frame rate.
  9772. @example
  9773. ------> time
  9774. Input:
  9775. Frame 1 Frame 2 Frame 3 Frame 4
  9776. 11111 22222 33333 44444
  9777. 11111 22222 33333 44444
  9778. 11111 22222 33333 44444
  9779. 11111 22222 33333 44444
  9780. Output:
  9781. 22222 44444
  9782. 22222 44444
  9783. 22222 44444
  9784. 22222 44444
  9785. @end example
  9786. @item pad, 3
  9787. Expand each frame to full height, but pad alternate lines with black,
  9788. generating a frame with double height at the same input frame rate.
  9789. @example
  9790. ------> time
  9791. Input:
  9792. Frame 1 Frame 2 Frame 3 Frame 4
  9793. 11111 22222 33333 44444
  9794. 11111 22222 33333 44444
  9795. 11111 22222 33333 44444
  9796. 11111 22222 33333 44444
  9797. Output:
  9798. 11111 ..... 33333 .....
  9799. ..... 22222 ..... 44444
  9800. 11111 ..... 33333 .....
  9801. ..... 22222 ..... 44444
  9802. 11111 ..... 33333 .....
  9803. ..... 22222 ..... 44444
  9804. 11111 ..... 33333 .....
  9805. ..... 22222 ..... 44444
  9806. @end example
  9807. @item interleave_top, 4
  9808. Interleave the upper field from odd frames with the lower field from
  9809. even frames, generating a frame with unchanged height at half frame rate.
  9810. @example
  9811. ------> time
  9812. Input:
  9813. Frame 1 Frame 2 Frame 3 Frame 4
  9814. 11111<- 22222 33333<- 44444
  9815. 11111 22222<- 33333 44444<-
  9816. 11111<- 22222 33333<- 44444
  9817. 11111 22222<- 33333 44444<-
  9818. Output:
  9819. 11111 33333
  9820. 22222 44444
  9821. 11111 33333
  9822. 22222 44444
  9823. @end example
  9824. @item interleave_bottom, 5
  9825. Interleave the lower field from odd frames with the upper field from
  9826. even frames, generating a frame with unchanged height at half frame rate.
  9827. @example
  9828. ------> time
  9829. Input:
  9830. Frame 1 Frame 2 Frame 3 Frame 4
  9831. 11111 22222<- 33333 44444<-
  9832. 11111<- 22222 33333<- 44444
  9833. 11111 22222<- 33333 44444<-
  9834. 11111<- 22222 33333<- 44444
  9835. Output:
  9836. 22222 44444
  9837. 11111 33333
  9838. 22222 44444
  9839. 11111 33333
  9840. @end example
  9841. @item interlacex2, 6
  9842. Double frame rate with unchanged height. Frames are inserted each
  9843. containing the second temporal field from the previous input frame and
  9844. the first temporal field from the next input frame. This mode relies on
  9845. the top_field_first flag. Useful for interlaced video displays with no
  9846. field synchronisation.
  9847. @example
  9848. ------> time
  9849. Input:
  9850. Frame 1 Frame 2 Frame 3 Frame 4
  9851. 11111 22222 33333 44444
  9852. 11111 22222 33333 44444
  9853. 11111 22222 33333 44444
  9854. 11111 22222 33333 44444
  9855. Output:
  9856. 11111 22222 22222 33333 33333 44444 44444
  9857. 11111 11111 22222 22222 33333 33333 44444
  9858. 11111 22222 22222 33333 33333 44444 44444
  9859. 11111 11111 22222 22222 33333 33333 44444
  9860. @end example
  9861. @item mergex2, 7
  9862. Move odd frames into the upper field, even into the lower field,
  9863. generating a double height frame at same frame rate.
  9864. @example
  9865. ------> time
  9866. Input:
  9867. Frame 1 Frame 2 Frame 3 Frame 4
  9868. 11111 22222 33333 44444
  9869. 11111 22222 33333 44444
  9870. 11111 22222 33333 44444
  9871. 11111 22222 33333 44444
  9872. Output:
  9873. 11111 33333 33333 55555
  9874. 22222 22222 44444 44444
  9875. 11111 33333 33333 55555
  9876. 22222 22222 44444 44444
  9877. 11111 33333 33333 55555
  9878. 22222 22222 44444 44444
  9879. 11111 33333 33333 55555
  9880. 22222 22222 44444 44444
  9881. @end example
  9882. @end table
  9883. Numeric values are deprecated but are accepted for backward
  9884. compatibility reasons.
  9885. Default mode is @code{merge}.
  9886. @item flags
  9887. Specify flags influencing the filter process.
  9888. Available value for @var{flags} is:
  9889. @table @option
  9890. @item low_pass_filter, vlfp
  9891. Enable vertical low-pass filtering in the filter.
  9892. Vertical low-pass filtering is required when creating an interlaced
  9893. destination from a progressive source which contains high-frequency
  9894. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9895. patterning.
  9896. Vertical low-pass filtering can only be enabled for @option{mode}
  9897. @var{interleave_top} and @var{interleave_bottom}.
  9898. @end table
  9899. @end table
  9900. @section transpose
  9901. Transpose rows with columns in the input video and optionally flip it.
  9902. It accepts the following parameters:
  9903. @table @option
  9904. @item dir
  9905. Specify the transposition direction.
  9906. Can assume the following values:
  9907. @table @samp
  9908. @item 0, 4, cclock_flip
  9909. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9910. @example
  9911. L.R L.l
  9912. . . -> . .
  9913. l.r R.r
  9914. @end example
  9915. @item 1, 5, clock
  9916. Rotate by 90 degrees clockwise, that is:
  9917. @example
  9918. L.R l.L
  9919. . . -> . .
  9920. l.r r.R
  9921. @end example
  9922. @item 2, 6, cclock
  9923. Rotate by 90 degrees counterclockwise, that is:
  9924. @example
  9925. L.R R.r
  9926. . . -> . .
  9927. l.r L.l
  9928. @end example
  9929. @item 3, 7, clock_flip
  9930. Rotate by 90 degrees clockwise and vertically flip, that is:
  9931. @example
  9932. L.R r.R
  9933. . . -> . .
  9934. l.r l.L
  9935. @end example
  9936. @end table
  9937. For values between 4-7, the transposition is only done if the input
  9938. video geometry is portrait and not landscape. These values are
  9939. deprecated, the @code{passthrough} option should be used instead.
  9940. Numerical values are deprecated, and should be dropped in favor of
  9941. symbolic constants.
  9942. @item passthrough
  9943. Do not apply the transposition if the input geometry matches the one
  9944. specified by the specified value. It accepts the following values:
  9945. @table @samp
  9946. @item none
  9947. Always apply transposition.
  9948. @item portrait
  9949. Preserve portrait geometry (when @var{height} >= @var{width}).
  9950. @item landscape
  9951. Preserve landscape geometry (when @var{width} >= @var{height}).
  9952. @end table
  9953. Default value is @code{none}.
  9954. @end table
  9955. For example to rotate by 90 degrees clockwise and preserve portrait
  9956. layout:
  9957. @example
  9958. transpose=dir=1:passthrough=portrait
  9959. @end example
  9960. The command above can also be specified as:
  9961. @example
  9962. transpose=1:portrait
  9963. @end example
  9964. @section trim
  9965. Trim the input so that the output contains one continuous subpart of the input.
  9966. It accepts the following parameters:
  9967. @table @option
  9968. @item start
  9969. Specify the time of the start of the kept section, i.e. the frame with the
  9970. timestamp @var{start} will be the first frame in the output.
  9971. @item end
  9972. Specify the time of the first frame that will be dropped, i.e. the frame
  9973. immediately preceding the one with the timestamp @var{end} will be the last
  9974. frame in the output.
  9975. @item start_pts
  9976. This is the same as @var{start}, except this option sets the start timestamp
  9977. in timebase units instead of seconds.
  9978. @item end_pts
  9979. This is the same as @var{end}, except this option sets the end timestamp
  9980. in timebase units instead of seconds.
  9981. @item duration
  9982. The maximum duration of the output in seconds.
  9983. @item start_frame
  9984. The number of the first frame that should be passed to the output.
  9985. @item end_frame
  9986. The number of the first frame that should be dropped.
  9987. @end table
  9988. @option{start}, @option{end}, and @option{duration} are expressed as time
  9989. duration specifications; see
  9990. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9991. for the accepted syntax.
  9992. Note that the first two sets of the start/end options and the @option{duration}
  9993. option look at the frame timestamp, while the _frame variants simply count the
  9994. frames that pass through the filter. Also note that this filter does not modify
  9995. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9996. setpts filter after the trim filter.
  9997. If multiple start or end options are set, this filter tries to be greedy and
  9998. keep all the frames that match at least one of the specified constraints. To keep
  9999. only the part that matches all the constraints at once, chain multiple trim
  10000. filters.
  10001. The defaults are such that all the input is kept. So it is possible to set e.g.
  10002. just the end values to keep everything before the specified time.
  10003. Examples:
  10004. @itemize
  10005. @item
  10006. Drop everything except the second minute of input:
  10007. @example
  10008. ffmpeg -i INPUT -vf trim=60:120
  10009. @end example
  10010. @item
  10011. Keep only the first second:
  10012. @example
  10013. ffmpeg -i INPUT -vf trim=duration=1
  10014. @end example
  10015. @end itemize
  10016. @anchor{unsharp}
  10017. @section unsharp
  10018. Sharpen or blur the input video.
  10019. It accepts the following parameters:
  10020. @table @option
  10021. @item luma_msize_x, lx
  10022. Set the luma matrix horizontal size. It must be an odd integer between
  10023. 3 and 63. The default value is 5.
  10024. @item luma_msize_y, ly
  10025. Set the luma matrix vertical size. It must be an odd integer between 3
  10026. and 63. The default value is 5.
  10027. @item luma_amount, la
  10028. Set the luma effect strength. It must be a floating point number, reasonable
  10029. values lay between -1.5 and 1.5.
  10030. Negative values will blur the input video, while positive values will
  10031. sharpen it, a value of zero will disable the effect.
  10032. Default value is 1.0.
  10033. @item chroma_msize_x, cx
  10034. Set the chroma matrix horizontal size. It must be an odd integer
  10035. between 3 and 63. The default value is 5.
  10036. @item chroma_msize_y, cy
  10037. Set the chroma matrix vertical size. It must be an odd integer
  10038. between 3 and 63. The default value is 5.
  10039. @item chroma_amount, ca
  10040. Set the chroma effect strength. It must be a floating point number, reasonable
  10041. values lay between -1.5 and 1.5.
  10042. Negative values will blur the input video, while positive values will
  10043. sharpen it, a value of zero will disable the effect.
  10044. Default value is 0.0.
  10045. @item opencl
  10046. If set to 1, specify using OpenCL capabilities, only available if
  10047. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10048. @end table
  10049. All parameters are optional and default to the equivalent of the
  10050. string '5:5:1.0:5:5:0.0'.
  10051. @subsection Examples
  10052. @itemize
  10053. @item
  10054. Apply strong luma sharpen effect:
  10055. @example
  10056. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10057. @end example
  10058. @item
  10059. Apply a strong blur of both luma and chroma parameters:
  10060. @example
  10061. unsharp=7:7:-2:7:7:-2
  10062. @end example
  10063. @end itemize
  10064. @section uspp
  10065. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10066. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10067. shifts and average the results.
  10068. The way this differs from the behavior of spp is that uspp actually encodes &
  10069. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10070. DCT similar to MJPEG.
  10071. The filter accepts the following options:
  10072. @table @option
  10073. @item quality
  10074. Set quality. This option defines the number of levels for averaging. It accepts
  10075. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10076. effect. A value of @code{8} means the higher quality. For each increment of
  10077. that value the speed drops by a factor of approximately 2. Default value is
  10078. @code{3}.
  10079. @item qp
  10080. Force a constant quantization parameter. If not set, the filter will use the QP
  10081. from the video stream (if available).
  10082. @end table
  10083. @section vectorscope
  10084. Display 2 color component values in the two dimensional graph (which is called
  10085. a vectorscope).
  10086. This filter accepts the following options:
  10087. @table @option
  10088. @item mode, m
  10089. Set vectorscope mode.
  10090. It accepts the following values:
  10091. @table @samp
  10092. @item gray
  10093. Gray values are displayed on graph, higher brightness means more pixels have
  10094. same component color value on location in graph. This is the default mode.
  10095. @item color
  10096. Gray values are displayed on graph. Surrounding pixels values which are not
  10097. present in video frame are drawn in gradient of 2 color components which are
  10098. set by option @code{x} and @code{y}. The 3rd color component is static.
  10099. @item color2
  10100. Actual color components values present in video frame are displayed on graph.
  10101. @item color3
  10102. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10103. on graph increases value of another color component, which is luminance by
  10104. default values of @code{x} and @code{y}.
  10105. @item color4
  10106. Actual colors present in video frame are displayed on graph. If two different
  10107. colors map to same position on graph then color with higher value of component
  10108. not present in graph is picked.
  10109. @item color5
  10110. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10111. component picked from radial gradient.
  10112. @end table
  10113. @item x
  10114. Set which color component will be represented on X-axis. Default is @code{1}.
  10115. @item y
  10116. Set which color component will be represented on Y-axis. Default is @code{2}.
  10117. @item intensity, i
  10118. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10119. of color component which represents frequency of (X, Y) location in graph.
  10120. @item envelope, e
  10121. @table @samp
  10122. @item none
  10123. No envelope, this is default.
  10124. @item instant
  10125. Instant envelope, even darkest single pixel will be clearly highlighted.
  10126. @item peak
  10127. Hold maximum and minimum values presented in graph over time. This way you
  10128. can still spot out of range values without constantly looking at vectorscope.
  10129. @item peak+instant
  10130. Peak and instant envelope combined together.
  10131. @end table
  10132. @item graticule, g
  10133. Set what kind of graticule to draw.
  10134. @table @samp
  10135. @item none
  10136. @item green
  10137. @item color
  10138. @end table
  10139. @item opacity, o
  10140. Set graticule opacity.
  10141. @item flags, f
  10142. Set graticule flags.
  10143. @table @samp
  10144. @item white
  10145. Draw graticule for white point.
  10146. @item black
  10147. Draw graticule for black point.
  10148. @item name
  10149. Draw color points short names.
  10150. @end table
  10151. @item bgopacity, b
  10152. Set background opacity.
  10153. @item lthreshold, l
  10154. Set low threshold for color component not represented on X or Y axis.
  10155. Values lower than this value will be ignored. Default is 0.
  10156. Note this value is multiplied with actual max possible value one pixel component
  10157. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10158. is 0.1 * 255 = 25.
  10159. @item hthreshold, h
  10160. Set high threshold for color component not represented on X or Y axis.
  10161. Values higher than this value will be ignored. Default is 1.
  10162. Note this value is multiplied with actual max possible value one pixel component
  10163. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10164. is 0.9 * 255 = 230.
  10165. @item colorspace, c
  10166. Set what kind of colorspace to use when drawing graticule.
  10167. @table @samp
  10168. @item auto
  10169. @item 601
  10170. @item 709
  10171. @end table
  10172. Default is auto.
  10173. @end table
  10174. @anchor{vidstabdetect}
  10175. @section vidstabdetect
  10176. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10177. @ref{vidstabtransform} for pass 2.
  10178. This filter generates a file with relative translation and rotation
  10179. transform information about subsequent frames, which is then used by
  10180. the @ref{vidstabtransform} filter.
  10181. To enable compilation of this filter you need to configure FFmpeg with
  10182. @code{--enable-libvidstab}.
  10183. This filter accepts the following options:
  10184. @table @option
  10185. @item result
  10186. Set the path to the file used to write the transforms information.
  10187. Default value is @file{transforms.trf}.
  10188. @item shakiness
  10189. Set how shaky the video is and how quick the camera is. It accepts an
  10190. integer in the range 1-10, a value of 1 means little shakiness, a
  10191. value of 10 means strong shakiness. Default value is 5.
  10192. @item accuracy
  10193. Set the accuracy of the detection process. It must be a value in the
  10194. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10195. accuracy. Default value is 15.
  10196. @item stepsize
  10197. Set stepsize of the search process. The region around minimum is
  10198. scanned with 1 pixel resolution. Default value is 6.
  10199. @item mincontrast
  10200. Set minimum contrast. Below this value a local measurement field is
  10201. discarded. Must be a floating point value in the range 0-1. Default
  10202. value is 0.3.
  10203. @item tripod
  10204. Set reference frame number for tripod mode.
  10205. If enabled, the motion of the frames is compared to a reference frame
  10206. in the filtered stream, identified by the specified number. The idea
  10207. is to compensate all movements in a more-or-less static scene and keep
  10208. the camera view absolutely still.
  10209. If set to 0, it is disabled. The frames are counted starting from 1.
  10210. @item show
  10211. Show fields and transforms in the resulting frames. It accepts an
  10212. integer in the range 0-2. Default value is 0, which disables any
  10213. visualization.
  10214. @end table
  10215. @subsection Examples
  10216. @itemize
  10217. @item
  10218. Use default values:
  10219. @example
  10220. vidstabdetect
  10221. @end example
  10222. @item
  10223. Analyze strongly shaky movie and put the results in file
  10224. @file{mytransforms.trf}:
  10225. @example
  10226. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10227. @end example
  10228. @item
  10229. Visualize the result of internal transformations in the resulting
  10230. video:
  10231. @example
  10232. vidstabdetect=show=1
  10233. @end example
  10234. @item
  10235. Analyze a video with medium shakiness using @command{ffmpeg}:
  10236. @example
  10237. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10238. @end example
  10239. @end itemize
  10240. @anchor{vidstabtransform}
  10241. @section vidstabtransform
  10242. Video stabilization/deshaking: pass 2 of 2,
  10243. see @ref{vidstabdetect} for pass 1.
  10244. Read a file with transform information for each frame and
  10245. apply/compensate them. Together with the @ref{vidstabdetect}
  10246. filter this can be used to deshake videos. See also
  10247. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10248. the @ref{unsharp} filter, see below.
  10249. To enable compilation of this filter you need to configure FFmpeg with
  10250. @code{--enable-libvidstab}.
  10251. @subsection Options
  10252. @table @option
  10253. @item input
  10254. Set path to the file used to read the transforms. Default value is
  10255. @file{transforms.trf}.
  10256. @item smoothing
  10257. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10258. camera movements. Default value is 10.
  10259. For example a number of 10 means that 21 frames are used (10 in the
  10260. past and 10 in the future) to smoothen the motion in the video. A
  10261. larger value leads to a smoother video, but limits the acceleration of
  10262. the camera (pan/tilt movements). 0 is a special case where a static
  10263. camera is simulated.
  10264. @item optalgo
  10265. Set the camera path optimization algorithm.
  10266. Accepted values are:
  10267. @table @samp
  10268. @item gauss
  10269. gaussian kernel low-pass filter on camera motion (default)
  10270. @item avg
  10271. averaging on transformations
  10272. @end table
  10273. @item maxshift
  10274. Set maximal number of pixels to translate frames. Default value is -1,
  10275. meaning no limit.
  10276. @item maxangle
  10277. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10278. value is -1, meaning no limit.
  10279. @item crop
  10280. Specify how to deal with borders that may be visible due to movement
  10281. compensation.
  10282. Available values are:
  10283. @table @samp
  10284. @item keep
  10285. keep image information from previous frame (default)
  10286. @item black
  10287. fill the border black
  10288. @end table
  10289. @item invert
  10290. Invert transforms if set to 1. Default value is 0.
  10291. @item relative
  10292. Consider transforms as relative to previous frame if set to 1,
  10293. absolute if set to 0. Default value is 0.
  10294. @item zoom
  10295. Set percentage to zoom. A positive value will result in a zoom-in
  10296. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10297. zoom).
  10298. @item optzoom
  10299. Set optimal zooming to avoid borders.
  10300. Accepted values are:
  10301. @table @samp
  10302. @item 0
  10303. disabled
  10304. @item 1
  10305. optimal static zoom value is determined (only very strong movements
  10306. will lead to visible borders) (default)
  10307. @item 2
  10308. optimal adaptive zoom value is determined (no borders will be
  10309. visible), see @option{zoomspeed}
  10310. @end table
  10311. Note that the value given at zoom is added to the one calculated here.
  10312. @item zoomspeed
  10313. Set percent to zoom maximally each frame (enabled when
  10314. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10315. 0.25.
  10316. @item interpol
  10317. Specify type of interpolation.
  10318. Available values are:
  10319. @table @samp
  10320. @item no
  10321. no interpolation
  10322. @item linear
  10323. linear only horizontal
  10324. @item bilinear
  10325. linear in both directions (default)
  10326. @item bicubic
  10327. cubic in both directions (slow)
  10328. @end table
  10329. @item tripod
  10330. Enable virtual tripod mode if set to 1, which is equivalent to
  10331. @code{relative=0:smoothing=0}. Default value is 0.
  10332. Use also @code{tripod} option of @ref{vidstabdetect}.
  10333. @item debug
  10334. Increase log verbosity if set to 1. Also the detected global motions
  10335. are written to the temporary file @file{global_motions.trf}. Default
  10336. value is 0.
  10337. @end table
  10338. @subsection Examples
  10339. @itemize
  10340. @item
  10341. Use @command{ffmpeg} for a typical stabilization with default values:
  10342. @example
  10343. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10344. @end example
  10345. Note the use of the @ref{unsharp} filter which is always recommended.
  10346. @item
  10347. Zoom in a bit more and load transform data from a given file:
  10348. @example
  10349. vidstabtransform=zoom=5:input="mytransforms.trf"
  10350. @end example
  10351. @item
  10352. Smoothen the video even more:
  10353. @example
  10354. vidstabtransform=smoothing=30
  10355. @end example
  10356. @end itemize
  10357. @section vflip
  10358. Flip the input video vertically.
  10359. For example, to vertically flip a video with @command{ffmpeg}:
  10360. @example
  10361. ffmpeg -i in.avi -vf "vflip" out.avi
  10362. @end example
  10363. @anchor{vignette}
  10364. @section vignette
  10365. Make or reverse a natural vignetting effect.
  10366. The filter accepts the following options:
  10367. @table @option
  10368. @item angle, a
  10369. Set lens angle expression as a number of radians.
  10370. The value is clipped in the @code{[0,PI/2]} range.
  10371. Default value: @code{"PI/5"}
  10372. @item x0
  10373. @item y0
  10374. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10375. by default.
  10376. @item mode
  10377. Set forward/backward mode.
  10378. Available modes are:
  10379. @table @samp
  10380. @item forward
  10381. The larger the distance from the central point, the darker the image becomes.
  10382. @item backward
  10383. The larger the distance from the central point, the brighter the image becomes.
  10384. This can be used to reverse a vignette effect, though there is no automatic
  10385. detection to extract the lens @option{angle} and other settings (yet). It can
  10386. also be used to create a burning effect.
  10387. @end table
  10388. Default value is @samp{forward}.
  10389. @item eval
  10390. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10391. It accepts the following values:
  10392. @table @samp
  10393. @item init
  10394. Evaluate expressions only once during the filter initialization.
  10395. @item frame
  10396. Evaluate expressions for each incoming frame. This is way slower than the
  10397. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10398. allows advanced dynamic expressions.
  10399. @end table
  10400. Default value is @samp{init}.
  10401. @item dither
  10402. Set dithering to reduce the circular banding effects. Default is @code{1}
  10403. (enabled).
  10404. @item aspect
  10405. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10406. Setting this value to the SAR of the input will make a rectangular vignetting
  10407. following the dimensions of the video.
  10408. Default is @code{1/1}.
  10409. @end table
  10410. @subsection Expressions
  10411. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10412. following parameters.
  10413. @table @option
  10414. @item w
  10415. @item h
  10416. input width and height
  10417. @item n
  10418. the number of input frame, starting from 0
  10419. @item pts
  10420. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10421. @var{TB} units, NAN if undefined
  10422. @item r
  10423. frame rate of the input video, NAN if the input frame rate is unknown
  10424. @item t
  10425. the PTS (Presentation TimeStamp) of the filtered video frame,
  10426. expressed in seconds, NAN if undefined
  10427. @item tb
  10428. time base of the input video
  10429. @end table
  10430. @subsection Examples
  10431. @itemize
  10432. @item
  10433. Apply simple strong vignetting effect:
  10434. @example
  10435. vignette=PI/4
  10436. @end example
  10437. @item
  10438. Make a flickering vignetting:
  10439. @example
  10440. vignette='PI/4+random(1)*PI/50':eval=frame
  10441. @end example
  10442. @end itemize
  10443. @section vstack
  10444. Stack input videos vertically.
  10445. All streams must be of same pixel format and of same width.
  10446. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10447. to create same output.
  10448. The filter accept the following option:
  10449. @table @option
  10450. @item inputs
  10451. Set number of input streams. Default is 2.
  10452. @item shortest
  10453. If set to 1, force the output to terminate when the shortest input
  10454. terminates. Default value is 0.
  10455. @end table
  10456. @section w3fdif
  10457. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10458. Deinterlacing Filter").
  10459. Based on the process described by Martin Weston for BBC R&D, and
  10460. implemented based on the de-interlace algorithm written by Jim
  10461. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10462. uses filter coefficients calculated by BBC R&D.
  10463. There are two sets of filter coefficients, so called "simple":
  10464. and "complex". Which set of filter coefficients is used can
  10465. be set by passing an optional parameter:
  10466. @table @option
  10467. @item filter
  10468. Set the interlacing filter coefficients. Accepts one of the following values:
  10469. @table @samp
  10470. @item simple
  10471. Simple filter coefficient set.
  10472. @item complex
  10473. More-complex filter coefficient set.
  10474. @end table
  10475. Default value is @samp{complex}.
  10476. @item deint
  10477. Specify which frames to deinterlace. Accept one of the following values:
  10478. @table @samp
  10479. @item all
  10480. Deinterlace all frames,
  10481. @item interlaced
  10482. Only deinterlace frames marked as interlaced.
  10483. @end table
  10484. Default value is @samp{all}.
  10485. @end table
  10486. @section waveform
  10487. Video waveform monitor.
  10488. The waveform monitor plots color component intensity. By default luminance
  10489. only. Each column of the waveform corresponds to a column of pixels in the
  10490. source video.
  10491. It accepts the following options:
  10492. @table @option
  10493. @item mode, m
  10494. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10495. In row mode, the graph on the left side represents color component value 0 and
  10496. the right side represents value = 255. In column mode, the top side represents
  10497. color component value = 0 and bottom side represents value = 255.
  10498. @item intensity, i
  10499. Set intensity. Smaller values are useful to find out how many values of the same
  10500. luminance are distributed across input rows/columns.
  10501. Default value is @code{0.04}. Allowed range is [0, 1].
  10502. @item mirror, r
  10503. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10504. In mirrored mode, higher values will be represented on the left
  10505. side for @code{row} mode and at the top for @code{column} mode. Default is
  10506. @code{1} (mirrored).
  10507. @item display, d
  10508. Set display mode.
  10509. It accepts the following values:
  10510. @table @samp
  10511. @item overlay
  10512. Presents information identical to that in the @code{parade}, except
  10513. that the graphs representing color components are superimposed directly
  10514. over one another.
  10515. This display mode makes it easier to spot relative differences or similarities
  10516. in overlapping areas of the color components that are supposed to be identical,
  10517. such as neutral whites, grays, or blacks.
  10518. @item stack
  10519. Display separate graph for the color components side by side in
  10520. @code{row} mode or one below the other in @code{column} mode.
  10521. @item parade
  10522. Display separate graph for the color components side by side in
  10523. @code{column} mode or one below the other in @code{row} mode.
  10524. Using this display mode makes it easy to spot color casts in the highlights
  10525. and shadows of an image, by comparing the contours of the top and the bottom
  10526. graphs of each waveform. Since whites, grays, and blacks are characterized
  10527. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10528. should display three waveforms of roughly equal width/height. If not, the
  10529. correction is easy to perform by making level adjustments the three waveforms.
  10530. @end table
  10531. Default is @code{stack}.
  10532. @item components, c
  10533. Set which color components to display. Default is 1, which means only luminance
  10534. or red color component if input is in RGB colorspace. If is set for example to
  10535. 7 it will display all 3 (if) available color components.
  10536. @item envelope, e
  10537. @table @samp
  10538. @item none
  10539. No envelope, this is default.
  10540. @item instant
  10541. Instant envelope, minimum and maximum values presented in graph will be easily
  10542. visible even with small @code{step} value.
  10543. @item peak
  10544. Hold minimum and maximum values presented in graph across time. This way you
  10545. can still spot out of range values without constantly looking at waveforms.
  10546. @item peak+instant
  10547. Peak and instant envelope combined together.
  10548. @end table
  10549. @item filter, f
  10550. @table @samp
  10551. @item lowpass
  10552. No filtering, this is default.
  10553. @item flat
  10554. Luma and chroma combined together.
  10555. @item aflat
  10556. Similar as above, but shows difference between blue and red chroma.
  10557. @item chroma
  10558. Displays only chroma.
  10559. @item color
  10560. Displays actual color value on waveform.
  10561. @item acolor
  10562. Similar as above, but with luma showing frequency of chroma values.
  10563. @end table
  10564. @item graticule, g
  10565. Set which graticule to display.
  10566. @table @samp
  10567. @item none
  10568. Do not display graticule.
  10569. @item green
  10570. Display green graticule showing legal broadcast ranges.
  10571. @end table
  10572. @item opacity, o
  10573. Set graticule opacity.
  10574. @item flags, fl
  10575. Set graticule flags.
  10576. @table @samp
  10577. @item numbers
  10578. Draw numbers above lines. By default enabled.
  10579. @item dots
  10580. Draw dots instead of lines.
  10581. @end table
  10582. @item scale, s
  10583. Set scale used for displaying graticule.
  10584. @table @samp
  10585. @item digital
  10586. @item millivolts
  10587. @item ire
  10588. @end table
  10589. Default is digital.
  10590. @end table
  10591. @section xbr
  10592. Apply the xBR high-quality magnification filter which is designed for pixel
  10593. art. It follows a set of edge-detection rules, see
  10594. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10595. It accepts the following option:
  10596. @table @option
  10597. @item n
  10598. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10599. @code{3xBR} and @code{4} for @code{4xBR}.
  10600. Default is @code{3}.
  10601. @end table
  10602. @anchor{yadif}
  10603. @section yadif
  10604. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10605. filter").
  10606. It accepts the following parameters:
  10607. @table @option
  10608. @item mode
  10609. The interlacing mode to adopt. It accepts one of the following values:
  10610. @table @option
  10611. @item 0, send_frame
  10612. Output one frame for each frame.
  10613. @item 1, send_field
  10614. Output one frame for each field.
  10615. @item 2, send_frame_nospatial
  10616. Like @code{send_frame}, but it skips the spatial interlacing check.
  10617. @item 3, send_field_nospatial
  10618. Like @code{send_field}, but it skips the spatial interlacing check.
  10619. @end table
  10620. The default value is @code{send_frame}.
  10621. @item parity
  10622. The picture field parity assumed for the input interlaced video. It accepts one
  10623. of the following values:
  10624. @table @option
  10625. @item 0, tff
  10626. Assume the top field is first.
  10627. @item 1, bff
  10628. Assume the bottom field is first.
  10629. @item -1, auto
  10630. Enable automatic detection of field parity.
  10631. @end table
  10632. The default value is @code{auto}.
  10633. If the interlacing is unknown or the decoder does not export this information,
  10634. top field first will be assumed.
  10635. @item deint
  10636. Specify which frames to deinterlace. Accept one of the following
  10637. values:
  10638. @table @option
  10639. @item 0, all
  10640. Deinterlace all frames.
  10641. @item 1, interlaced
  10642. Only deinterlace frames marked as interlaced.
  10643. @end table
  10644. The default value is @code{all}.
  10645. @end table
  10646. @section zoompan
  10647. Apply Zoom & Pan effect.
  10648. This filter accepts the following options:
  10649. @table @option
  10650. @item zoom, z
  10651. Set the zoom expression. Default is 1.
  10652. @item x
  10653. @item y
  10654. Set the x and y expression. Default is 0.
  10655. @item d
  10656. Set the duration expression in number of frames.
  10657. This sets for how many number of frames effect will last for
  10658. single input image.
  10659. @item s
  10660. Set the output image size, default is 'hd720'.
  10661. @item fps
  10662. Set the output frame rate, default is '25'.
  10663. @end table
  10664. Each expression can contain the following constants:
  10665. @table @option
  10666. @item in_w, iw
  10667. Input width.
  10668. @item in_h, ih
  10669. Input height.
  10670. @item out_w, ow
  10671. Output width.
  10672. @item out_h, oh
  10673. Output height.
  10674. @item in
  10675. Input frame count.
  10676. @item on
  10677. Output frame count.
  10678. @item x
  10679. @item y
  10680. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10681. for current input frame.
  10682. @item px
  10683. @item py
  10684. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10685. not yet such frame (first input frame).
  10686. @item zoom
  10687. Last calculated zoom from 'z' expression for current input frame.
  10688. @item pzoom
  10689. Last calculated zoom of last output frame of previous input frame.
  10690. @item duration
  10691. Number of output frames for current input frame. Calculated from 'd' expression
  10692. for each input frame.
  10693. @item pduration
  10694. number of output frames created for previous input frame
  10695. @item a
  10696. Rational number: input width / input height
  10697. @item sar
  10698. sample aspect ratio
  10699. @item dar
  10700. display aspect ratio
  10701. @end table
  10702. @subsection Examples
  10703. @itemize
  10704. @item
  10705. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10706. @example
  10707. 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
  10708. @end example
  10709. @item
  10710. Zoom-in up to 1.5 and pan always at center of picture:
  10711. @example
  10712. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10713. @end example
  10714. @item
  10715. Same as above but without pausing:
  10716. @example
  10717. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10718. @end example
  10719. @end itemize
  10720. @section zscale
  10721. Scale (resize) the input video, using the z.lib library:
  10722. https://github.com/sekrit-twc/zimg.
  10723. The zscale filter forces the output display aspect ratio to be the same
  10724. as the input, by changing the output sample aspect ratio.
  10725. If the input image format is different from the format requested by
  10726. the next filter, the zscale filter will convert the input to the
  10727. requested format.
  10728. @subsection Options
  10729. The filter accepts the following options.
  10730. @table @option
  10731. @item width, w
  10732. @item height, h
  10733. Set the output video dimension expression. Default value is the input
  10734. dimension.
  10735. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10736. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10737. If one of the values is -1, the zscale filter will use a value that
  10738. maintains the aspect ratio of the input image, calculated from the
  10739. other specified dimension. If both of them are -1, the input size is
  10740. used
  10741. If one of the values is -n with n > 1, the zscale filter will also use a value
  10742. that maintains the aspect ratio of the input image, calculated from the other
  10743. specified dimension. After that it will, however, make sure that the calculated
  10744. dimension is divisible by n and adjust the value if necessary.
  10745. See below for the list of accepted constants for use in the dimension
  10746. expression.
  10747. @item size, s
  10748. Set the video size. For the syntax of this option, check the
  10749. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10750. @item dither, d
  10751. Set the dither type.
  10752. Possible values are:
  10753. @table @var
  10754. @item none
  10755. @item ordered
  10756. @item random
  10757. @item error_diffusion
  10758. @end table
  10759. Default is none.
  10760. @item filter, f
  10761. Set the resize filter type.
  10762. Possible values are:
  10763. @table @var
  10764. @item point
  10765. @item bilinear
  10766. @item bicubic
  10767. @item spline16
  10768. @item spline36
  10769. @item lanczos
  10770. @end table
  10771. Default is bilinear.
  10772. @item range, r
  10773. Set the color range.
  10774. Possible values are:
  10775. @table @var
  10776. @item input
  10777. @item limited
  10778. @item full
  10779. @end table
  10780. Default is same as input.
  10781. @item primaries, p
  10782. Set the color primaries.
  10783. Possible values are:
  10784. @table @var
  10785. @item input
  10786. @item 709
  10787. @item unspecified
  10788. @item 170m
  10789. @item 240m
  10790. @item 2020
  10791. @end table
  10792. Default is same as input.
  10793. @item transfer, t
  10794. Set the transfer characteristics.
  10795. Possible values are:
  10796. @table @var
  10797. @item input
  10798. @item 709
  10799. @item unspecified
  10800. @item 601
  10801. @item linear
  10802. @item 2020_10
  10803. @item 2020_12
  10804. @end table
  10805. Default is same as input.
  10806. @item matrix, m
  10807. Set the colorspace matrix.
  10808. Possible value are:
  10809. @table @var
  10810. @item input
  10811. @item 709
  10812. @item unspecified
  10813. @item 470bg
  10814. @item 170m
  10815. @item 2020_ncl
  10816. @item 2020_cl
  10817. @end table
  10818. Default is same as input.
  10819. @item rangein, rin
  10820. Set the input color range.
  10821. Possible values are:
  10822. @table @var
  10823. @item input
  10824. @item limited
  10825. @item full
  10826. @end table
  10827. Default is same as input.
  10828. @item primariesin, pin
  10829. Set the input color primaries.
  10830. Possible values are:
  10831. @table @var
  10832. @item input
  10833. @item 709
  10834. @item unspecified
  10835. @item 170m
  10836. @item 240m
  10837. @item 2020
  10838. @end table
  10839. Default is same as input.
  10840. @item transferin, tin
  10841. Set the input transfer characteristics.
  10842. Possible values are:
  10843. @table @var
  10844. @item input
  10845. @item 709
  10846. @item unspecified
  10847. @item 601
  10848. @item linear
  10849. @item 2020_10
  10850. @item 2020_12
  10851. @end table
  10852. Default is same as input.
  10853. @item matrixin, min
  10854. Set the input colorspace matrix.
  10855. Possible value are:
  10856. @table @var
  10857. @item input
  10858. @item 709
  10859. @item unspecified
  10860. @item 470bg
  10861. @item 170m
  10862. @item 2020_ncl
  10863. @item 2020_cl
  10864. @end table
  10865. @end table
  10866. The values of the @option{w} and @option{h} options are expressions
  10867. containing the following constants:
  10868. @table @var
  10869. @item in_w
  10870. @item in_h
  10871. The input width and height
  10872. @item iw
  10873. @item ih
  10874. These are the same as @var{in_w} and @var{in_h}.
  10875. @item out_w
  10876. @item out_h
  10877. The output (scaled) width and height
  10878. @item ow
  10879. @item oh
  10880. These are the same as @var{out_w} and @var{out_h}
  10881. @item a
  10882. The same as @var{iw} / @var{ih}
  10883. @item sar
  10884. input sample aspect ratio
  10885. @item dar
  10886. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10887. @item hsub
  10888. @item vsub
  10889. horizontal and vertical input chroma subsample values. For example for the
  10890. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10891. @item ohsub
  10892. @item ovsub
  10893. horizontal and vertical output chroma subsample values. For example for the
  10894. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10895. @end table
  10896. @table @option
  10897. @end table
  10898. @c man end VIDEO FILTERS
  10899. @chapter Video Sources
  10900. @c man begin VIDEO SOURCES
  10901. Below is a description of the currently available video sources.
  10902. @section buffer
  10903. Buffer video frames, and make them available to the filter chain.
  10904. This source is mainly intended for a programmatic use, in particular
  10905. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10906. It accepts the following parameters:
  10907. @table @option
  10908. @item video_size
  10909. Specify the size (width and height) of the buffered video frames. For the
  10910. syntax of this option, check the
  10911. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10912. @item width
  10913. The input video width.
  10914. @item height
  10915. The input video height.
  10916. @item pix_fmt
  10917. A string representing the pixel format of the buffered video frames.
  10918. It may be a number corresponding to a pixel format, or a pixel format
  10919. name.
  10920. @item time_base
  10921. Specify the timebase assumed by the timestamps of the buffered frames.
  10922. @item frame_rate
  10923. Specify the frame rate expected for the video stream.
  10924. @item pixel_aspect, sar
  10925. The sample (pixel) aspect ratio of the input video.
  10926. @item sws_param
  10927. Specify the optional parameters to be used for the scale filter which
  10928. is automatically inserted when an input change is detected in the
  10929. input size or format.
  10930. @item hw_frames_ctx
  10931. When using a hardware pixel format, this should be a reference to an
  10932. AVHWFramesContext describing input frames.
  10933. @end table
  10934. For example:
  10935. @example
  10936. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10937. @end example
  10938. will instruct the source to accept video frames with size 320x240 and
  10939. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10940. square pixels (1:1 sample aspect ratio).
  10941. Since the pixel format with name "yuv410p" corresponds to the number 6
  10942. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10943. this example corresponds to:
  10944. @example
  10945. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10946. @end example
  10947. Alternatively, the options can be specified as a flat string, but this
  10948. syntax is deprecated:
  10949. @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}]
  10950. @section cellauto
  10951. Create a pattern generated by an elementary cellular automaton.
  10952. The initial state of the cellular automaton can be defined through the
  10953. @option{filename}, and @option{pattern} options. If such options are
  10954. not specified an initial state is created randomly.
  10955. At each new frame a new row in the video is filled with the result of
  10956. the cellular automaton next generation. The behavior when the whole
  10957. frame is filled is defined by the @option{scroll} option.
  10958. This source accepts the following options:
  10959. @table @option
  10960. @item filename, f
  10961. Read the initial cellular automaton state, i.e. the starting row, from
  10962. the specified file.
  10963. In the file, each non-whitespace character is considered an alive
  10964. cell, a newline will terminate the row, and further characters in the
  10965. file will be ignored.
  10966. @item pattern, p
  10967. Read the initial cellular automaton state, i.e. the starting row, from
  10968. the specified string.
  10969. Each non-whitespace character in the string is considered an alive
  10970. cell, a newline will terminate the row, and further characters in the
  10971. string will be ignored.
  10972. @item rate, r
  10973. Set the video rate, that is the number of frames generated per second.
  10974. Default is 25.
  10975. @item random_fill_ratio, ratio
  10976. Set the random fill ratio for the initial cellular automaton row. It
  10977. is a floating point number value ranging from 0 to 1, defaults to
  10978. 1/PHI.
  10979. This option is ignored when a file or a pattern is specified.
  10980. @item random_seed, seed
  10981. Set the seed for filling randomly the initial row, must be an integer
  10982. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10983. set to -1, the filter will try to use a good random seed on a best
  10984. effort basis.
  10985. @item rule
  10986. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10987. Default value is 110.
  10988. @item size, s
  10989. Set the size of the output video. For the syntax of this option, check the
  10990. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10991. If @option{filename} or @option{pattern} is specified, the size is set
  10992. by default to the width of the specified initial state row, and the
  10993. height is set to @var{width} * PHI.
  10994. If @option{size} is set, it must contain the width of the specified
  10995. pattern string, and the specified pattern will be centered in the
  10996. larger row.
  10997. If a filename or a pattern string is not specified, the size value
  10998. defaults to "320x518" (used for a randomly generated initial state).
  10999. @item scroll
  11000. If set to 1, scroll the output upward when all the rows in the output
  11001. have been already filled. If set to 0, the new generated row will be
  11002. written over the top row just after the bottom row is filled.
  11003. Defaults to 1.
  11004. @item start_full, full
  11005. If set to 1, completely fill the output with generated rows before
  11006. outputting the first frame.
  11007. This is the default behavior, for disabling set the value to 0.
  11008. @item stitch
  11009. If set to 1, stitch the left and right row edges together.
  11010. This is the default behavior, for disabling set the value to 0.
  11011. @end table
  11012. @subsection Examples
  11013. @itemize
  11014. @item
  11015. Read the initial state from @file{pattern}, and specify an output of
  11016. size 200x400.
  11017. @example
  11018. cellauto=f=pattern:s=200x400
  11019. @end example
  11020. @item
  11021. Generate a random initial row with a width of 200 cells, with a fill
  11022. ratio of 2/3:
  11023. @example
  11024. cellauto=ratio=2/3:s=200x200
  11025. @end example
  11026. @item
  11027. Create a pattern generated by rule 18 starting by a single alive cell
  11028. centered on an initial row with width 100:
  11029. @example
  11030. cellauto=p=@@:s=100x400:full=0:rule=18
  11031. @end example
  11032. @item
  11033. Specify a more elaborated initial pattern:
  11034. @example
  11035. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11036. @end example
  11037. @end itemize
  11038. @anchor{coreimagesrc}
  11039. @section coreimagesrc
  11040. Video source generated on GPU using Apple's CoreImage API on OSX.
  11041. This video source is a specialized version of the @ref{coreimage} video filter.
  11042. Use a core image generator at the beginning of the applied filterchain to
  11043. generate the content.
  11044. The coreimagesrc video source accepts the following options:
  11045. @table @option
  11046. @item list_generators
  11047. List all available generators along with all their respective options as well as
  11048. possible minimum and maximum values along with the default values.
  11049. @example
  11050. list_generators=true
  11051. @end example
  11052. @item size, s
  11053. Specify the size of the sourced video. For the syntax of this option, check the
  11054. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11055. The default value is @code{320x240}.
  11056. @item rate, r
  11057. Specify the frame rate of the sourced video, as the number of frames
  11058. generated per second. It has to be a string in the format
  11059. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11060. number or a valid video frame rate abbreviation. The default value is
  11061. "25".
  11062. @item sar
  11063. Set the sample aspect ratio of the sourced video.
  11064. @item duration, d
  11065. Set the duration of the sourced video. See
  11066. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11067. for the accepted syntax.
  11068. If not specified, or the expressed duration is negative, the video is
  11069. supposed to be generated forever.
  11070. @end table
  11071. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11072. A complete filterchain can be used for further processing of the
  11073. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11074. and examples for details.
  11075. @subsection Examples
  11076. @itemize
  11077. @item
  11078. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11079. given as complete and escaped command-line for Apple's standard bash shell:
  11080. @example
  11081. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11082. @end example
  11083. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11084. need for a nullsrc video source.
  11085. @end itemize
  11086. @section mandelbrot
  11087. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11088. point specified with @var{start_x} and @var{start_y}.
  11089. This source accepts the following options:
  11090. @table @option
  11091. @item end_pts
  11092. Set the terminal pts value. Default value is 400.
  11093. @item end_scale
  11094. Set the terminal scale value.
  11095. Must be a floating point value. Default value is 0.3.
  11096. @item inner
  11097. Set the inner coloring mode, that is the algorithm used to draw the
  11098. Mandelbrot fractal internal region.
  11099. It shall assume one of the following values:
  11100. @table @option
  11101. @item black
  11102. Set black mode.
  11103. @item convergence
  11104. Show time until convergence.
  11105. @item mincol
  11106. Set color based on point closest to the origin of the iterations.
  11107. @item period
  11108. Set period mode.
  11109. @end table
  11110. Default value is @var{mincol}.
  11111. @item bailout
  11112. Set the bailout value. Default value is 10.0.
  11113. @item maxiter
  11114. Set the maximum of iterations performed by the rendering
  11115. algorithm. Default value is 7189.
  11116. @item outer
  11117. Set outer coloring mode.
  11118. It shall assume one of following values:
  11119. @table @option
  11120. @item iteration_count
  11121. Set iteration cound mode.
  11122. @item normalized_iteration_count
  11123. set normalized iteration count mode.
  11124. @end table
  11125. Default value is @var{normalized_iteration_count}.
  11126. @item rate, r
  11127. Set frame rate, expressed as number of frames per second. Default
  11128. value is "25".
  11129. @item size, s
  11130. Set frame size. For the syntax of this option, check the "Video
  11131. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11132. @item start_scale
  11133. Set the initial scale value. Default value is 3.0.
  11134. @item start_x
  11135. Set the initial x position. Must be a floating point value between
  11136. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11137. @item start_y
  11138. Set the initial y position. Must be a floating point value between
  11139. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11140. @end table
  11141. @section mptestsrc
  11142. Generate various test patterns, as generated by the MPlayer test filter.
  11143. The size of the generated video is fixed, and is 256x256.
  11144. This source is useful in particular for testing encoding features.
  11145. This source accepts the following options:
  11146. @table @option
  11147. @item rate, r
  11148. Specify the frame rate of the sourced video, as the number of frames
  11149. generated per second. It has to be a string in the format
  11150. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11151. number or a valid video frame rate abbreviation. The default value is
  11152. "25".
  11153. @item duration, d
  11154. Set the duration of the sourced video. See
  11155. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11156. for the accepted syntax.
  11157. If not specified, or the expressed duration is negative, the video is
  11158. supposed to be generated forever.
  11159. @item test, t
  11160. Set the number or the name of the test to perform. Supported tests are:
  11161. @table @option
  11162. @item dc_luma
  11163. @item dc_chroma
  11164. @item freq_luma
  11165. @item freq_chroma
  11166. @item amp_luma
  11167. @item amp_chroma
  11168. @item cbp
  11169. @item mv
  11170. @item ring1
  11171. @item ring2
  11172. @item all
  11173. @end table
  11174. Default value is "all", which will cycle through the list of all tests.
  11175. @end table
  11176. Some examples:
  11177. @example
  11178. mptestsrc=t=dc_luma
  11179. @end example
  11180. will generate a "dc_luma" test pattern.
  11181. @section frei0r_src
  11182. Provide a frei0r source.
  11183. To enable compilation of this filter you need to install the frei0r
  11184. header and configure FFmpeg with @code{--enable-frei0r}.
  11185. This source accepts the following parameters:
  11186. @table @option
  11187. @item size
  11188. The size of the video to generate. For the syntax of this option, check the
  11189. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11190. @item framerate
  11191. The framerate of the generated video. It may be a string of the form
  11192. @var{num}/@var{den} or a frame rate abbreviation.
  11193. @item filter_name
  11194. The name to the frei0r source to load. For more information regarding frei0r and
  11195. how to set the parameters, read the @ref{frei0r} section in the video filters
  11196. documentation.
  11197. @item filter_params
  11198. A '|'-separated list of parameters to pass to the frei0r source.
  11199. @end table
  11200. For example, to generate a frei0r partik0l source with size 200x200
  11201. and frame rate 10 which is overlaid on the overlay filter main input:
  11202. @example
  11203. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11204. @end example
  11205. @section life
  11206. Generate a life pattern.
  11207. This source is based on a generalization of John Conway's life game.
  11208. The sourced input represents a life grid, each pixel represents a cell
  11209. which can be in one of two possible states, alive or dead. Every cell
  11210. interacts with its eight neighbours, which are the cells that are
  11211. horizontally, vertically, or diagonally adjacent.
  11212. At each interaction the grid evolves according to the adopted rule,
  11213. which specifies the number of neighbor alive cells which will make a
  11214. cell stay alive or born. The @option{rule} option allows one to specify
  11215. the rule to adopt.
  11216. This source accepts the following options:
  11217. @table @option
  11218. @item filename, f
  11219. Set the file from which to read the initial grid state. In the file,
  11220. each non-whitespace character is considered an alive cell, and newline
  11221. is used to delimit the end of each row.
  11222. If this option is not specified, the initial grid is generated
  11223. randomly.
  11224. @item rate, r
  11225. Set the video rate, that is the number of frames generated per second.
  11226. Default is 25.
  11227. @item random_fill_ratio, ratio
  11228. Set the random fill ratio for the initial random grid. It is a
  11229. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11230. It is ignored when a file is specified.
  11231. @item random_seed, seed
  11232. Set the seed for filling the initial random grid, must be an integer
  11233. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11234. set to -1, the filter will try to use a good random seed on a best
  11235. effort basis.
  11236. @item rule
  11237. Set the life rule.
  11238. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11239. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11240. @var{NS} specifies the number of alive neighbor cells which make a
  11241. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11242. which make a dead cell to become alive (i.e. to "born").
  11243. "s" and "b" can be used in place of "S" and "B", respectively.
  11244. Alternatively a rule can be specified by an 18-bits integer. The 9
  11245. high order bits are used to encode the next cell state if it is alive
  11246. for each number of neighbor alive cells, the low order bits specify
  11247. the rule for "borning" new cells. Higher order bits encode for an
  11248. higher number of neighbor cells.
  11249. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11250. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11251. Default value is "S23/B3", which is the original Conway's game of life
  11252. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11253. cells, and will born a new cell if there are three alive cells around
  11254. a dead cell.
  11255. @item size, s
  11256. Set the size of the output video. For the syntax of this option, check the
  11257. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11258. If @option{filename} is specified, the size is set by default to the
  11259. same size of the input file. If @option{size} is set, it must contain
  11260. the size specified in the input file, and the initial grid defined in
  11261. that file is centered in the larger resulting area.
  11262. If a filename is not specified, the size value defaults to "320x240"
  11263. (used for a randomly generated initial grid).
  11264. @item stitch
  11265. If set to 1, stitch the left and right grid edges together, and the
  11266. top and bottom edges also. Defaults to 1.
  11267. @item mold
  11268. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11269. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11270. value from 0 to 255.
  11271. @item life_color
  11272. Set the color of living (or new born) cells.
  11273. @item death_color
  11274. Set the color of dead cells. If @option{mold} is set, this is the first color
  11275. used to represent a dead cell.
  11276. @item mold_color
  11277. Set mold color, for definitely dead and moldy cells.
  11278. For the syntax of these 3 color options, check the "Color" section in the
  11279. ffmpeg-utils manual.
  11280. @end table
  11281. @subsection Examples
  11282. @itemize
  11283. @item
  11284. Read a grid from @file{pattern}, and center it on a grid of size
  11285. 300x300 pixels:
  11286. @example
  11287. life=f=pattern:s=300x300
  11288. @end example
  11289. @item
  11290. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11291. @example
  11292. life=ratio=2/3:s=200x200
  11293. @end example
  11294. @item
  11295. Specify a custom rule for evolving a randomly generated grid:
  11296. @example
  11297. life=rule=S14/B34
  11298. @end example
  11299. @item
  11300. Full example with slow death effect (mold) using @command{ffplay}:
  11301. @example
  11302. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11303. @end example
  11304. @end itemize
  11305. @anchor{allrgb}
  11306. @anchor{allyuv}
  11307. @anchor{color}
  11308. @anchor{haldclutsrc}
  11309. @anchor{nullsrc}
  11310. @anchor{rgbtestsrc}
  11311. @anchor{smptebars}
  11312. @anchor{smptehdbars}
  11313. @anchor{testsrc}
  11314. @anchor{testsrc2}
  11315. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11316. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11317. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11318. The @code{color} source provides an uniformly colored input.
  11319. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11320. @ref{haldclut} filter.
  11321. The @code{nullsrc} source returns unprocessed video frames. It is
  11322. mainly useful to be employed in analysis / debugging tools, or as the
  11323. source for filters which ignore the input data.
  11324. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11325. detecting RGB vs BGR issues. You should see a red, green and blue
  11326. stripe from top to bottom.
  11327. The @code{smptebars} source generates a color bars pattern, based on
  11328. the SMPTE Engineering Guideline EG 1-1990.
  11329. The @code{smptehdbars} source generates a color bars pattern, based on
  11330. the SMPTE RP 219-2002.
  11331. The @code{testsrc} source generates a test video pattern, showing a
  11332. color pattern, a scrolling gradient and a timestamp. This is mainly
  11333. intended for testing purposes.
  11334. The @code{testsrc2} source is similar to testsrc, but supports more
  11335. pixel formats instead of just @code{rgb24}. This allows using it as an
  11336. input for other tests without requiring a format conversion.
  11337. The sources accept the following parameters:
  11338. @table @option
  11339. @item color, c
  11340. Specify the color of the source, only available in the @code{color}
  11341. source. For the syntax of this option, check the "Color" section in the
  11342. ffmpeg-utils manual.
  11343. @item level
  11344. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11345. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11346. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11347. coded on a @code{1/(N*N)} scale.
  11348. @item size, s
  11349. Specify the size of the sourced video. For the syntax of this option, check the
  11350. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11351. The default value is @code{320x240}.
  11352. This option is not available with the @code{haldclutsrc} filter.
  11353. @item rate, r
  11354. Specify the frame rate of the sourced video, as the number of frames
  11355. generated per second. It has to be a string in the format
  11356. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11357. number or a valid video frame rate abbreviation. The default value is
  11358. "25".
  11359. @item sar
  11360. Set the sample aspect ratio of the sourced video.
  11361. @item duration, d
  11362. Set the duration of the sourced video. See
  11363. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11364. for the accepted syntax.
  11365. If not specified, or the expressed duration is negative, the video is
  11366. supposed to be generated forever.
  11367. @item decimals, n
  11368. Set the number of decimals to show in the timestamp, only available in the
  11369. @code{testsrc} source.
  11370. The displayed timestamp value will correspond to the original
  11371. timestamp value multiplied by the power of 10 of the specified
  11372. value. Default value is 0.
  11373. @end table
  11374. For example the following:
  11375. @example
  11376. testsrc=duration=5.3:size=qcif:rate=10
  11377. @end example
  11378. will generate a video with a duration of 5.3 seconds, with size
  11379. 176x144 and a frame rate of 10 frames per second.
  11380. The following graph description will generate a red source
  11381. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11382. frames per second.
  11383. @example
  11384. color=c=red@@0.2:s=qcif:r=10
  11385. @end example
  11386. If the input content is to be ignored, @code{nullsrc} can be used. The
  11387. following command generates noise in the luminance plane by employing
  11388. the @code{geq} filter:
  11389. @example
  11390. nullsrc=s=256x256, geq=random(1)*255:128:128
  11391. @end example
  11392. @subsection Commands
  11393. The @code{color} source supports the following commands:
  11394. @table @option
  11395. @item c, color
  11396. Set the color of the created image. Accepts the same syntax of the
  11397. corresponding @option{color} option.
  11398. @end table
  11399. @c man end VIDEO SOURCES
  11400. @chapter Video Sinks
  11401. @c man begin VIDEO SINKS
  11402. Below is a description of the currently available video sinks.
  11403. @section buffersink
  11404. Buffer video frames, and make them available to the end of the filter
  11405. graph.
  11406. This sink is mainly intended for programmatic use, in particular
  11407. through the interface defined in @file{libavfilter/buffersink.h}
  11408. or the options system.
  11409. It accepts a pointer to an AVBufferSinkContext structure, which
  11410. defines the incoming buffers' formats, to be passed as the opaque
  11411. parameter to @code{avfilter_init_filter} for initialization.
  11412. @section nullsink
  11413. Null video sink: do absolutely nothing with the input video. It is
  11414. mainly useful as a template and for use in analysis / debugging
  11415. tools.
  11416. @c man end VIDEO SINKS
  11417. @chapter Multimedia Filters
  11418. @c man begin MULTIMEDIA FILTERS
  11419. Below is a description of the currently available multimedia filters.
  11420. @section ahistogram
  11421. Convert input audio to a video output, displaying the volume histogram.
  11422. The filter accepts the following options:
  11423. @table @option
  11424. @item dmode
  11425. Specify how histogram is calculated.
  11426. It accepts the following values:
  11427. @table @samp
  11428. @item single
  11429. Use single histogram for all channels.
  11430. @item separate
  11431. Use separate histogram for each channel.
  11432. @end table
  11433. Default is @code{single}.
  11434. @item rate, r
  11435. Set frame rate, expressed as number of frames per second. Default
  11436. value is "25".
  11437. @item size, s
  11438. Specify the video size for the output. For the syntax of this option, check the
  11439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11440. Default value is @code{hd720}.
  11441. @item scale
  11442. Set display scale.
  11443. It accepts the following values:
  11444. @table @samp
  11445. @item log
  11446. logarithmic
  11447. @item sqrt
  11448. square root
  11449. @item cbrt
  11450. cubic root
  11451. @item lin
  11452. linear
  11453. @item rlog
  11454. reverse logarithmic
  11455. @end table
  11456. Default is @code{log}.
  11457. @item ascale
  11458. Set amplitude scale.
  11459. It accepts the following values:
  11460. @table @samp
  11461. @item log
  11462. logarithmic
  11463. @item lin
  11464. linear
  11465. @end table
  11466. Default is @code{log}.
  11467. @item acount
  11468. Set how much frames to accumulate in histogram.
  11469. Defauls is 1. Setting this to -1 accumulates all frames.
  11470. @item rheight
  11471. Set histogram ratio of window height.
  11472. @item slide
  11473. Set sonogram sliding.
  11474. It accepts the following values:
  11475. @table @samp
  11476. @item replace
  11477. replace old rows with new ones.
  11478. @item scroll
  11479. scroll from top to bottom.
  11480. @end table
  11481. Default is @code{replace}.
  11482. @end table
  11483. @section aphasemeter
  11484. Convert input audio to a video output, displaying the audio phase.
  11485. The filter accepts the following options:
  11486. @table @option
  11487. @item rate, r
  11488. Set the output frame rate. Default value is @code{25}.
  11489. @item size, s
  11490. Set the video size for the output. For the syntax of this option, check the
  11491. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11492. Default value is @code{800x400}.
  11493. @item rc
  11494. @item gc
  11495. @item bc
  11496. Specify the red, green, blue contrast. Default values are @code{2},
  11497. @code{7} and @code{1}.
  11498. Allowed range is @code{[0, 255]}.
  11499. @item mpc
  11500. Set color which will be used for drawing median phase. If color is
  11501. @code{none} which is default, no median phase value will be drawn.
  11502. @end table
  11503. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11504. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11505. The @code{-1} means left and right channels are completely out of phase and
  11506. @code{1} means channels are in phase.
  11507. @section avectorscope
  11508. Convert input audio to a video output, representing the audio vector
  11509. scope.
  11510. The filter is used to measure the difference between channels of stereo
  11511. audio stream. A monoaural signal, consisting of identical left and right
  11512. signal, results in straight vertical line. Any stereo separation is visible
  11513. as a deviation from this line, creating a Lissajous figure.
  11514. If the straight (or deviation from it) but horizontal line appears this
  11515. indicates that the left and right channels are out of phase.
  11516. The filter accepts the following options:
  11517. @table @option
  11518. @item mode, m
  11519. Set the vectorscope mode.
  11520. Available values are:
  11521. @table @samp
  11522. @item lissajous
  11523. Lissajous rotated by 45 degrees.
  11524. @item lissajous_xy
  11525. Same as above but not rotated.
  11526. @item polar
  11527. Shape resembling half of circle.
  11528. @end table
  11529. Default value is @samp{lissajous}.
  11530. @item size, s
  11531. Set the video size for the output. For the syntax of this option, check the
  11532. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11533. Default value is @code{400x400}.
  11534. @item rate, r
  11535. Set the output frame rate. Default value is @code{25}.
  11536. @item rc
  11537. @item gc
  11538. @item bc
  11539. @item ac
  11540. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11541. @code{160}, @code{80} and @code{255}.
  11542. Allowed range is @code{[0, 255]}.
  11543. @item rf
  11544. @item gf
  11545. @item bf
  11546. @item af
  11547. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11548. @code{10}, @code{5} and @code{5}.
  11549. Allowed range is @code{[0, 255]}.
  11550. @item zoom
  11551. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11552. @item draw
  11553. Set the vectorscope drawing mode.
  11554. Available values are:
  11555. @table @samp
  11556. @item dot
  11557. Draw dot for each sample.
  11558. @item line
  11559. Draw line between previous and current sample.
  11560. @end table
  11561. Default value is @samp{dot}.
  11562. @item scale
  11563. Specify amplitude scale of audio samples.
  11564. Available values are:
  11565. @table @samp
  11566. @item lin
  11567. Linear.
  11568. @item sqrt
  11569. Square root.
  11570. @item cbrt
  11571. Cubic root.
  11572. @item log
  11573. Logarithmic.
  11574. @end table
  11575. @end table
  11576. @subsection Examples
  11577. @itemize
  11578. @item
  11579. Complete example using @command{ffplay}:
  11580. @example
  11581. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11582. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11583. @end example
  11584. @end itemize
  11585. @section bench, abench
  11586. Benchmark part of a filtergraph.
  11587. The filter accepts the following options:
  11588. @table @option
  11589. @item action
  11590. Start or stop a timer.
  11591. Available values are:
  11592. @table @samp
  11593. @item start
  11594. Get the current time, set it as frame metadata (using the key
  11595. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11596. @item stop
  11597. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11598. the input frame metadata to get the time difference. Time difference, average,
  11599. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11600. @code{min}) are then printed. The timestamps are expressed in seconds.
  11601. @end table
  11602. @end table
  11603. @subsection Examples
  11604. @itemize
  11605. @item
  11606. Benchmark @ref{selectivecolor} filter:
  11607. @example
  11608. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11609. @end example
  11610. @end itemize
  11611. @section concat
  11612. Concatenate audio and video streams, joining them together one after the
  11613. other.
  11614. The filter works on segments of synchronized video and audio streams. All
  11615. segments must have the same number of streams of each type, and that will
  11616. also be the number of streams at output.
  11617. The filter accepts the following options:
  11618. @table @option
  11619. @item n
  11620. Set the number of segments. Default is 2.
  11621. @item v
  11622. Set the number of output video streams, that is also the number of video
  11623. streams in each segment. Default is 1.
  11624. @item a
  11625. Set the number of output audio streams, that is also the number of audio
  11626. streams in each segment. Default is 0.
  11627. @item unsafe
  11628. Activate unsafe mode: do not fail if segments have a different format.
  11629. @end table
  11630. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11631. @var{a} audio outputs.
  11632. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11633. segment, in the same order as the outputs, then the inputs for the second
  11634. segment, etc.
  11635. Related streams do not always have exactly the same duration, for various
  11636. reasons including codec frame size or sloppy authoring. For that reason,
  11637. related synchronized streams (e.g. a video and its audio track) should be
  11638. concatenated at once. The concat filter will use the duration of the longest
  11639. stream in each segment (except the last one), and if necessary pad shorter
  11640. audio streams with silence.
  11641. For this filter to work correctly, all segments must start at timestamp 0.
  11642. All corresponding streams must have the same parameters in all segments; the
  11643. filtering system will automatically select a common pixel format for video
  11644. streams, and a common sample format, sample rate and channel layout for
  11645. audio streams, but other settings, such as resolution, must be converted
  11646. explicitly by the user.
  11647. Different frame rates are acceptable but will result in variable frame rate
  11648. at output; be sure to configure the output file to handle it.
  11649. @subsection Examples
  11650. @itemize
  11651. @item
  11652. Concatenate an opening, an episode and an ending, all in bilingual version
  11653. (video in stream 0, audio in streams 1 and 2):
  11654. @example
  11655. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11656. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11657. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11658. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11659. @end example
  11660. @item
  11661. Concatenate two parts, handling audio and video separately, using the
  11662. (a)movie sources, and adjusting the resolution:
  11663. @example
  11664. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11665. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11666. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11667. @end example
  11668. Note that a desync will happen at the stitch if the audio and video streams
  11669. do not have exactly the same duration in the first file.
  11670. @end itemize
  11671. @section drawgraph, adrawgraph
  11672. Draw a graph using input video or audio metadata.
  11673. It accepts the following parameters:
  11674. @table @option
  11675. @item m1
  11676. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  11677. @item fg1
  11678. Set 1st foreground color expression.
  11679. @item m2
  11680. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  11681. @item fg2
  11682. Set 2nd foreground color expression.
  11683. @item m3
  11684. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  11685. @item fg3
  11686. Set 3rd foreground color expression.
  11687. @item m4
  11688. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  11689. @item fg4
  11690. Set 4th foreground color expression.
  11691. @item min
  11692. Set minimal value of metadata value.
  11693. @item max
  11694. Set maximal value of metadata value.
  11695. @item bg
  11696. Set graph background color. Default is white.
  11697. @item mode
  11698. Set graph mode.
  11699. Available values for mode is:
  11700. @table @samp
  11701. @item bar
  11702. @item dot
  11703. @item line
  11704. @end table
  11705. Default is @code{line}.
  11706. @item slide
  11707. Set slide mode.
  11708. Available values for slide is:
  11709. @table @samp
  11710. @item frame
  11711. Draw new frame when right border is reached.
  11712. @item replace
  11713. Replace old columns with new ones.
  11714. @item scroll
  11715. Scroll from right to left.
  11716. @item rscroll
  11717. Scroll from left to right.
  11718. @item picture
  11719. Draw single picture.
  11720. @end table
  11721. Default is @code{frame}.
  11722. @item size
  11723. Set size of graph video. For the syntax of this option, check the
  11724. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11725. The default value is @code{900x256}.
  11726. The foreground color expressions can use the following variables:
  11727. @table @option
  11728. @item MIN
  11729. Minimal value of metadata value.
  11730. @item MAX
  11731. Maximal value of metadata value.
  11732. @item VAL
  11733. Current metadata key value.
  11734. @end table
  11735. The color is defined as 0xAABBGGRR.
  11736. @end table
  11737. Example using metadata from @ref{signalstats} filter:
  11738. @example
  11739. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  11740. @end example
  11741. Example using metadata from @ref{ebur128} filter:
  11742. @example
  11743. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  11744. @end example
  11745. @anchor{ebur128}
  11746. @section ebur128
  11747. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11748. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11749. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11750. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11751. The filter also has a video output (see the @var{video} option) with a real
  11752. time graph to observe the loudness evolution. The graphic contains the logged
  11753. message mentioned above, so it is not printed anymore when this option is set,
  11754. unless the verbose logging is set. The main graphing area contains the
  11755. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11756. the momentary loudness (400 milliseconds).
  11757. More information about the Loudness Recommendation EBU R128 on
  11758. @url{http://tech.ebu.ch/loudness}.
  11759. The filter accepts the following options:
  11760. @table @option
  11761. @item video
  11762. Activate the video output. The audio stream is passed unchanged whether this
  11763. option is set or no. The video stream will be the first output stream if
  11764. activated. Default is @code{0}.
  11765. @item size
  11766. Set the video size. This option is for video only. For the syntax of this
  11767. option, check the
  11768. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11769. Default and minimum resolution is @code{640x480}.
  11770. @item meter
  11771. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11772. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11773. other integer value between this range is allowed.
  11774. @item metadata
  11775. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11776. into 100ms output frames, each of them containing various loudness information
  11777. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11778. Default is @code{0}.
  11779. @item framelog
  11780. Force the frame logging level.
  11781. Available values are:
  11782. @table @samp
  11783. @item info
  11784. information logging level
  11785. @item verbose
  11786. verbose logging level
  11787. @end table
  11788. By default, the logging level is set to @var{info}. If the @option{video} or
  11789. the @option{metadata} options are set, it switches to @var{verbose}.
  11790. @item peak
  11791. Set peak mode(s).
  11792. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11793. values are:
  11794. @table @samp
  11795. @item none
  11796. Disable any peak mode (default).
  11797. @item sample
  11798. Enable sample-peak mode.
  11799. Simple peak mode looking for the higher sample value. It logs a message
  11800. for sample-peak (identified by @code{SPK}).
  11801. @item true
  11802. Enable true-peak mode.
  11803. If enabled, the peak lookup is done on an over-sampled version of the input
  11804. stream for better peak accuracy. It logs a message for true-peak.
  11805. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11806. This mode requires a build with @code{libswresample}.
  11807. @end table
  11808. @item dualmono
  11809. Treat mono input files as "dual mono". If a mono file is intended for playback
  11810. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11811. If set to @code{true}, this option will compensate for this effect.
  11812. Multi-channel input files are not affected by this option.
  11813. @item panlaw
  11814. Set a specific pan law to be used for the measurement of dual mono files.
  11815. This parameter is optional, and has a default value of -3.01dB.
  11816. @end table
  11817. @subsection Examples
  11818. @itemize
  11819. @item
  11820. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11821. @example
  11822. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11823. @end example
  11824. @item
  11825. Run an analysis with @command{ffmpeg}:
  11826. @example
  11827. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11828. @end example
  11829. @end itemize
  11830. @section interleave, ainterleave
  11831. Temporally interleave frames from several inputs.
  11832. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11833. These filters read frames from several inputs and send the oldest
  11834. queued frame to the output.
  11835. Input streams must have a well defined, monotonically increasing frame
  11836. timestamp values.
  11837. In order to submit one frame to output, these filters need to enqueue
  11838. at least one frame for each input, so they cannot work in case one
  11839. input is not yet terminated and will not receive incoming frames.
  11840. For example consider the case when one input is a @code{select} filter
  11841. which always drop input frames. The @code{interleave} filter will keep
  11842. reading from that input, but it will never be able to send new frames
  11843. to output until the input will send an end-of-stream signal.
  11844. Also, depending on inputs synchronization, the filters will drop
  11845. frames in case one input receives more frames than the other ones, and
  11846. the queue is already filled.
  11847. These filters accept the following options:
  11848. @table @option
  11849. @item nb_inputs, n
  11850. Set the number of different inputs, it is 2 by default.
  11851. @end table
  11852. @subsection Examples
  11853. @itemize
  11854. @item
  11855. Interleave frames belonging to different streams using @command{ffmpeg}:
  11856. @example
  11857. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11858. @end example
  11859. @item
  11860. Add flickering blur effect:
  11861. @example
  11862. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11863. @end example
  11864. @end itemize
  11865. @section metadata, ametadata
  11866. Manipulate frame metadata.
  11867. This filter accepts the following options:
  11868. @table @option
  11869. @item mode
  11870. Set mode of operation of the filter.
  11871. Can be one of the following:
  11872. @table @samp
  11873. @item select
  11874. If both @code{value} and @code{key} is set, select frames
  11875. which have such metadata. If only @code{key} is set, select
  11876. every frame that has such key in metadata.
  11877. @item add
  11878. Add new metadata @code{key} and @code{value}. If key is already available
  11879. do nothing.
  11880. @item modify
  11881. Modify value of already present key.
  11882. @item delete
  11883. If @code{value} is set, delete only keys that have such value.
  11884. Otherwise, delete key.
  11885. @item print
  11886. Print key and its value if metadata was found. If @code{key} is not set print all
  11887. metadata values available in frame.
  11888. @end table
  11889. @item key
  11890. Set key used with all modes. Must be set for all modes except @code{print}.
  11891. @item value
  11892. Set metadata value which will be used. This option is mandatory for
  11893. @code{modify} and @code{add} mode.
  11894. @item function
  11895. Which function to use when comparing metadata value and @code{value}.
  11896. Can be one of following:
  11897. @table @samp
  11898. @item same_str
  11899. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  11900. @item starts_with
  11901. Values are interpreted as strings, returns true if metadata value starts with
  11902. the @code{value} option string.
  11903. @item less
  11904. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  11905. @item equal
  11906. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  11907. @item greater
  11908. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  11909. @item expr
  11910. Values are interpreted as floats, returns true if expression from option @code{expr}
  11911. evaluates to true.
  11912. @end table
  11913. @item expr
  11914. Set expression which is used when @code{function} is set to @code{expr}.
  11915. The expression is evaluated through the eval API and can contain the following
  11916. constants:
  11917. @table @option
  11918. @item VALUE1
  11919. Float representation of @code{value} from metadata key.
  11920. @item VALUE2
  11921. Float representation of @code{value} as supplied by user in @code{value} option.
  11922. @item file
  11923. If specified in @code{print} mode, output is written to the named file. Instead of
  11924. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  11925. for standard output. If @code{file} option is not set, output is written to the log
  11926. with AV_LOG_INFO loglevel.
  11927. @end table
  11928. @end table
  11929. @subsection Examples
  11930. @itemize
  11931. @item
  11932. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  11933. between 0 and 1.
  11934. @example
  11935. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  11936. @end example
  11937. @item
  11938. Print silencedetect output to file @file{metadata.txt}.
  11939. @example
  11940. silencedetect,ametadata=mode=print:file=metadata.txt
  11941. @end example
  11942. @item
  11943. Direct all metadata to a pipe with file descriptor 4.
  11944. @example
  11945. metadata=mode=print:file='pipe\:4'
  11946. @end example
  11947. @end itemize
  11948. @section perms, aperms
  11949. Set read/write permissions for the output frames.
  11950. These filters are mainly aimed at developers to test direct path in the
  11951. following filter in the filtergraph.
  11952. The filters accept the following options:
  11953. @table @option
  11954. @item mode
  11955. Select the permissions mode.
  11956. It accepts the following values:
  11957. @table @samp
  11958. @item none
  11959. Do nothing. This is the default.
  11960. @item ro
  11961. Set all the output frames read-only.
  11962. @item rw
  11963. Set all the output frames directly writable.
  11964. @item toggle
  11965. Make the frame read-only if writable, and writable if read-only.
  11966. @item random
  11967. Set each output frame read-only or writable randomly.
  11968. @end table
  11969. @item seed
  11970. Set the seed for the @var{random} mode, must be an integer included between
  11971. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11972. @code{-1}, the filter will try to use a good random seed on a best effort
  11973. basis.
  11974. @end table
  11975. Note: in case of auto-inserted filter between the permission filter and the
  11976. following one, the permission might not be received as expected in that
  11977. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11978. perms/aperms filter can avoid this problem.
  11979. @section realtime, arealtime
  11980. Slow down filtering to match real time approximatively.
  11981. These filters will pause the filtering for a variable amount of time to
  11982. match the output rate with the input timestamps.
  11983. They are similar to the @option{re} option to @code{ffmpeg}.
  11984. They accept the following options:
  11985. @table @option
  11986. @item limit
  11987. Time limit for the pauses. Any pause longer than that will be considered
  11988. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11989. @end table
  11990. @section select, aselect
  11991. Select frames to pass in output.
  11992. This filter accepts the following options:
  11993. @table @option
  11994. @item expr, e
  11995. Set expression, which is evaluated for each input frame.
  11996. If the expression is evaluated to zero, the frame is discarded.
  11997. If the evaluation result is negative or NaN, the frame is sent to the
  11998. first output; otherwise it is sent to the output with index
  11999. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12000. For example a value of @code{1.2} corresponds to the output with index
  12001. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12002. @item outputs, n
  12003. Set the number of outputs. The output to which to send the selected
  12004. frame is based on the result of the evaluation. Default value is 1.
  12005. @end table
  12006. The expression can contain the following constants:
  12007. @table @option
  12008. @item n
  12009. The (sequential) number of the filtered frame, starting from 0.
  12010. @item selected_n
  12011. The (sequential) number of the selected frame, starting from 0.
  12012. @item prev_selected_n
  12013. The sequential number of the last selected frame. It's NAN if undefined.
  12014. @item TB
  12015. The timebase of the input timestamps.
  12016. @item pts
  12017. The PTS (Presentation TimeStamp) of the filtered video frame,
  12018. expressed in @var{TB} units. It's NAN if undefined.
  12019. @item t
  12020. The PTS of the filtered video frame,
  12021. expressed in seconds. It's NAN if undefined.
  12022. @item prev_pts
  12023. The PTS of the previously filtered video frame. It's NAN if undefined.
  12024. @item prev_selected_pts
  12025. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12026. @item prev_selected_t
  12027. The PTS of the last previously selected video frame. It's NAN if undefined.
  12028. @item start_pts
  12029. The PTS of the first video frame in the video. It's NAN if undefined.
  12030. @item start_t
  12031. The time of the first video frame in the video. It's NAN if undefined.
  12032. @item pict_type @emph{(video only)}
  12033. The type of the filtered frame. It can assume one of the following
  12034. values:
  12035. @table @option
  12036. @item I
  12037. @item P
  12038. @item B
  12039. @item S
  12040. @item SI
  12041. @item SP
  12042. @item BI
  12043. @end table
  12044. @item interlace_type @emph{(video only)}
  12045. The frame interlace type. It can assume one of the following values:
  12046. @table @option
  12047. @item PROGRESSIVE
  12048. The frame is progressive (not interlaced).
  12049. @item TOPFIRST
  12050. The frame is top-field-first.
  12051. @item BOTTOMFIRST
  12052. The frame is bottom-field-first.
  12053. @end table
  12054. @item consumed_sample_n @emph{(audio only)}
  12055. the number of selected samples before the current frame
  12056. @item samples_n @emph{(audio only)}
  12057. the number of samples in the current frame
  12058. @item sample_rate @emph{(audio only)}
  12059. the input sample rate
  12060. @item key
  12061. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12062. @item pos
  12063. the position in the file of the filtered frame, -1 if the information
  12064. is not available (e.g. for synthetic video)
  12065. @item scene @emph{(video only)}
  12066. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12067. probability for the current frame to introduce a new scene, while a higher
  12068. value means the current frame is more likely to be one (see the example below)
  12069. @item concatdec_select
  12070. The concat demuxer can select only part of a concat input file by setting an
  12071. inpoint and an outpoint, but the output packets may not be entirely contained
  12072. in the selected interval. By using this variable, it is possible to skip frames
  12073. generated by the concat demuxer which are not exactly contained in the selected
  12074. interval.
  12075. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12076. and the @var{lavf.concat.duration} packet metadata values which are also
  12077. present in the decoded frames.
  12078. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12079. start_time and either the duration metadata is missing or the frame pts is less
  12080. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12081. missing.
  12082. That basically means that an input frame is selected if its pts is within the
  12083. interval set by the concat demuxer.
  12084. @end table
  12085. The default value of the select expression is "1".
  12086. @subsection Examples
  12087. @itemize
  12088. @item
  12089. Select all frames in input:
  12090. @example
  12091. select
  12092. @end example
  12093. The example above is the same as:
  12094. @example
  12095. select=1
  12096. @end example
  12097. @item
  12098. Skip all frames:
  12099. @example
  12100. select=0
  12101. @end example
  12102. @item
  12103. Select only I-frames:
  12104. @example
  12105. select='eq(pict_type\,I)'
  12106. @end example
  12107. @item
  12108. Select one frame every 100:
  12109. @example
  12110. select='not(mod(n\,100))'
  12111. @end example
  12112. @item
  12113. Select only frames contained in the 10-20 time interval:
  12114. @example
  12115. select=between(t\,10\,20)
  12116. @end example
  12117. @item
  12118. Select only I-frames contained in the 10-20 time interval:
  12119. @example
  12120. select=between(t\,10\,20)*eq(pict_type\,I)
  12121. @end example
  12122. @item
  12123. Select frames with a minimum distance of 10 seconds:
  12124. @example
  12125. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12126. @end example
  12127. @item
  12128. Use aselect to select only audio frames with samples number > 100:
  12129. @example
  12130. aselect='gt(samples_n\,100)'
  12131. @end example
  12132. @item
  12133. Create a mosaic of the first scenes:
  12134. @example
  12135. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12136. @end example
  12137. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12138. choice.
  12139. @item
  12140. Send even and odd frames to separate outputs, and compose them:
  12141. @example
  12142. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12143. @end example
  12144. @item
  12145. Select useful frames from an ffconcat file which is using inpoints and
  12146. outpoints but where the source files are not intra frame only.
  12147. @example
  12148. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12149. @end example
  12150. @end itemize
  12151. @section sendcmd, asendcmd
  12152. Send commands to filters in the filtergraph.
  12153. These filters read commands to be sent to other filters in the
  12154. filtergraph.
  12155. @code{sendcmd} must be inserted between two video filters,
  12156. @code{asendcmd} must be inserted between two audio filters, but apart
  12157. from that they act the same way.
  12158. The specification of commands can be provided in the filter arguments
  12159. with the @var{commands} option, or in a file specified by the
  12160. @var{filename} option.
  12161. These filters accept the following options:
  12162. @table @option
  12163. @item commands, c
  12164. Set the commands to be read and sent to the other filters.
  12165. @item filename, f
  12166. Set the filename of the commands to be read and sent to the other
  12167. filters.
  12168. @end table
  12169. @subsection Commands syntax
  12170. A commands description consists of a sequence of interval
  12171. specifications, comprising a list of commands to be executed when a
  12172. particular event related to that interval occurs. The occurring event
  12173. is typically the current frame time entering or leaving a given time
  12174. interval.
  12175. An interval is specified by the following syntax:
  12176. @example
  12177. @var{START}[-@var{END}] @var{COMMANDS};
  12178. @end example
  12179. The time interval is specified by the @var{START} and @var{END} times.
  12180. @var{END} is optional and defaults to the maximum time.
  12181. The current frame time is considered within the specified interval if
  12182. it is included in the interval [@var{START}, @var{END}), that is when
  12183. the time is greater or equal to @var{START} and is lesser than
  12184. @var{END}.
  12185. @var{COMMANDS} consists of a sequence of one or more command
  12186. specifications, separated by ",", relating to that interval. The
  12187. syntax of a command specification is given by:
  12188. @example
  12189. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12190. @end example
  12191. @var{FLAGS} is optional and specifies the type of events relating to
  12192. the time interval which enable sending the specified command, and must
  12193. be a non-null sequence of identifier flags separated by "+" or "|" and
  12194. enclosed between "[" and "]".
  12195. The following flags are recognized:
  12196. @table @option
  12197. @item enter
  12198. The command is sent when the current frame timestamp enters the
  12199. specified interval. In other words, the command is sent when the
  12200. previous frame timestamp was not in the given interval, and the
  12201. current is.
  12202. @item leave
  12203. The command is sent when the current frame timestamp leaves the
  12204. specified interval. In other words, the command is sent when the
  12205. previous frame timestamp was in the given interval, and the
  12206. current is not.
  12207. @end table
  12208. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12209. assumed.
  12210. @var{TARGET} specifies the target of the command, usually the name of
  12211. the filter class or a specific filter instance name.
  12212. @var{COMMAND} specifies the name of the command for the target filter.
  12213. @var{ARG} is optional and specifies the optional list of argument for
  12214. the given @var{COMMAND}.
  12215. Between one interval specification and another, whitespaces, or
  12216. sequences of characters starting with @code{#} until the end of line,
  12217. are ignored and can be used to annotate comments.
  12218. A simplified BNF description of the commands specification syntax
  12219. follows:
  12220. @example
  12221. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12222. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12223. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12224. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12225. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12226. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12227. @end example
  12228. @subsection Examples
  12229. @itemize
  12230. @item
  12231. Specify audio tempo change at second 4:
  12232. @example
  12233. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12234. @end example
  12235. @item
  12236. Specify a list of drawtext and hue commands in a file.
  12237. @example
  12238. # show text in the interval 5-10
  12239. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12240. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12241. # desaturate the image in the interval 15-20
  12242. 15.0-20.0 [enter] hue s 0,
  12243. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12244. [leave] hue s 1,
  12245. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12246. # apply an exponential saturation fade-out effect, starting from time 25
  12247. 25 [enter] hue s exp(25-t)
  12248. @end example
  12249. A filtergraph allowing to read and process the above command list
  12250. stored in a file @file{test.cmd}, can be specified with:
  12251. @example
  12252. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12253. @end example
  12254. @end itemize
  12255. @anchor{setpts}
  12256. @section setpts, asetpts
  12257. Change the PTS (presentation timestamp) of the input frames.
  12258. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12259. This filter accepts the following options:
  12260. @table @option
  12261. @item expr
  12262. The expression which is evaluated for each frame to construct its timestamp.
  12263. @end table
  12264. The expression is evaluated through the eval API and can contain the following
  12265. constants:
  12266. @table @option
  12267. @item FRAME_RATE
  12268. frame rate, only defined for constant frame-rate video
  12269. @item PTS
  12270. The presentation timestamp in input
  12271. @item N
  12272. The count of the input frame for video or the number of consumed samples,
  12273. not including the current frame for audio, starting from 0.
  12274. @item NB_CONSUMED_SAMPLES
  12275. The number of consumed samples, not including the current frame (only
  12276. audio)
  12277. @item NB_SAMPLES, S
  12278. The number of samples in the current frame (only audio)
  12279. @item SAMPLE_RATE, SR
  12280. The audio sample rate.
  12281. @item STARTPTS
  12282. The PTS of the first frame.
  12283. @item STARTT
  12284. the time in seconds of the first frame
  12285. @item INTERLACED
  12286. State whether the current frame is interlaced.
  12287. @item T
  12288. the time in seconds of the current frame
  12289. @item POS
  12290. original position in the file of the frame, or undefined if undefined
  12291. for the current frame
  12292. @item PREV_INPTS
  12293. The previous input PTS.
  12294. @item PREV_INT
  12295. previous input time in seconds
  12296. @item PREV_OUTPTS
  12297. The previous output PTS.
  12298. @item PREV_OUTT
  12299. previous output time in seconds
  12300. @item RTCTIME
  12301. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12302. instead.
  12303. @item RTCSTART
  12304. The wallclock (RTC) time at the start of the movie in microseconds.
  12305. @item TB
  12306. The timebase of the input timestamps.
  12307. @end table
  12308. @subsection Examples
  12309. @itemize
  12310. @item
  12311. Start counting PTS from zero
  12312. @example
  12313. setpts=PTS-STARTPTS
  12314. @end example
  12315. @item
  12316. Apply fast motion effect:
  12317. @example
  12318. setpts=0.5*PTS
  12319. @end example
  12320. @item
  12321. Apply slow motion effect:
  12322. @example
  12323. setpts=2.0*PTS
  12324. @end example
  12325. @item
  12326. Set fixed rate of 25 frames per second:
  12327. @example
  12328. setpts=N/(25*TB)
  12329. @end example
  12330. @item
  12331. Set fixed rate 25 fps with some jitter:
  12332. @example
  12333. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12334. @end example
  12335. @item
  12336. Apply an offset of 10 seconds to the input PTS:
  12337. @example
  12338. setpts=PTS+10/TB
  12339. @end example
  12340. @item
  12341. Generate timestamps from a "live source" and rebase onto the current timebase:
  12342. @example
  12343. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12344. @end example
  12345. @item
  12346. Generate timestamps by counting samples:
  12347. @example
  12348. asetpts=N/SR/TB
  12349. @end example
  12350. @end itemize
  12351. @section settb, asettb
  12352. Set the timebase to use for the output frames timestamps.
  12353. It is mainly useful for testing timebase configuration.
  12354. It accepts the following parameters:
  12355. @table @option
  12356. @item expr, tb
  12357. The expression which is evaluated into the output timebase.
  12358. @end table
  12359. The value for @option{tb} is an arithmetic expression representing a
  12360. rational. The expression can contain the constants "AVTB" (the default
  12361. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12362. audio only). Default value is "intb".
  12363. @subsection Examples
  12364. @itemize
  12365. @item
  12366. Set the timebase to 1/25:
  12367. @example
  12368. settb=expr=1/25
  12369. @end example
  12370. @item
  12371. Set the timebase to 1/10:
  12372. @example
  12373. settb=expr=0.1
  12374. @end example
  12375. @item
  12376. Set the timebase to 1001/1000:
  12377. @example
  12378. settb=1+0.001
  12379. @end example
  12380. @item
  12381. Set the timebase to 2*intb:
  12382. @example
  12383. settb=2*intb
  12384. @end example
  12385. @item
  12386. Set the default timebase value:
  12387. @example
  12388. settb=AVTB
  12389. @end example
  12390. @end itemize
  12391. @section showcqt
  12392. Convert input audio to a video output representing frequency spectrum
  12393. logarithmically using Brown-Puckette constant Q transform algorithm with
  12394. direct frequency domain coefficient calculation (but the transform itself
  12395. is not really constant Q, instead the Q factor is actually variable/clamped),
  12396. with musical tone scale, from E0 to D#10.
  12397. The filter accepts the following options:
  12398. @table @option
  12399. @item size, s
  12400. Specify the video size for the output. It must be even. For the syntax of this option,
  12401. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12402. Default value is @code{1920x1080}.
  12403. @item fps, rate, r
  12404. Set the output frame rate. Default value is @code{25}.
  12405. @item bar_h
  12406. Set the bargraph height. It must be even. Default value is @code{-1} which
  12407. computes the bargraph height automatically.
  12408. @item axis_h
  12409. Set the axis height. It must be even. Default value is @code{-1} which computes
  12410. the axis height automatically.
  12411. @item sono_h
  12412. Set the sonogram height. It must be even. Default value is @code{-1} which
  12413. computes the sonogram height automatically.
  12414. @item fullhd
  12415. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12416. instead. Default value is @code{1}.
  12417. @item sono_v, volume
  12418. Specify the sonogram volume expression. It can contain variables:
  12419. @table @option
  12420. @item bar_v
  12421. the @var{bar_v} evaluated expression
  12422. @item frequency, freq, f
  12423. the frequency where it is evaluated
  12424. @item timeclamp, tc
  12425. the value of @var{timeclamp} option
  12426. @end table
  12427. and functions:
  12428. @table @option
  12429. @item a_weighting(f)
  12430. A-weighting of equal loudness
  12431. @item b_weighting(f)
  12432. B-weighting of equal loudness
  12433. @item c_weighting(f)
  12434. C-weighting of equal loudness.
  12435. @end table
  12436. Default value is @code{16}.
  12437. @item bar_v, volume2
  12438. Specify the bargraph volume expression. It can contain variables:
  12439. @table @option
  12440. @item sono_v
  12441. the @var{sono_v} evaluated expression
  12442. @item frequency, freq, f
  12443. the frequency where it is evaluated
  12444. @item timeclamp, tc
  12445. the value of @var{timeclamp} option
  12446. @end table
  12447. and functions:
  12448. @table @option
  12449. @item a_weighting(f)
  12450. A-weighting of equal loudness
  12451. @item b_weighting(f)
  12452. B-weighting of equal loudness
  12453. @item c_weighting(f)
  12454. C-weighting of equal loudness.
  12455. @end table
  12456. Default value is @code{sono_v}.
  12457. @item sono_g, gamma
  12458. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12459. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12460. Acceptable range is @code{[1, 7]}.
  12461. @item bar_g, gamma2
  12462. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12463. @code{[1, 7]}.
  12464. @item timeclamp, tc
  12465. Specify the transform timeclamp. At low frequency, there is trade-off between
  12466. accuracy in time domain and frequency domain. If timeclamp is lower,
  12467. event in time domain is represented more accurately (such as fast bass drum),
  12468. otherwise event in frequency domain is represented more accurately
  12469. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12470. @item basefreq
  12471. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12472. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12473. @item endfreq
  12474. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12475. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12476. @item coeffclamp
  12477. This option is deprecated and ignored.
  12478. @item tlength
  12479. Specify the transform length in time domain. Use this option to control accuracy
  12480. trade-off between time domain and frequency domain at every frequency sample.
  12481. It can contain variables:
  12482. @table @option
  12483. @item frequency, freq, f
  12484. the frequency where it is evaluated
  12485. @item timeclamp, tc
  12486. the value of @var{timeclamp} option.
  12487. @end table
  12488. Default value is @code{384*tc/(384+tc*f)}.
  12489. @item count
  12490. Specify the transform count for every video frame. Default value is @code{6}.
  12491. Acceptable range is @code{[1, 30]}.
  12492. @item fcount
  12493. Specify the transform count for every single pixel. Default value is @code{0},
  12494. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12495. @item fontfile
  12496. Specify font file for use with freetype to draw the axis. If not specified,
  12497. use embedded font. Note that drawing with font file or embedded font is not
  12498. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12499. option instead.
  12500. @item fontcolor
  12501. Specify font color expression. This is arithmetic expression that should return
  12502. integer value 0xRRGGBB. It can contain variables:
  12503. @table @option
  12504. @item frequency, freq, f
  12505. the frequency where it is evaluated
  12506. @item timeclamp, tc
  12507. the value of @var{timeclamp} option
  12508. @end table
  12509. and functions:
  12510. @table @option
  12511. @item midi(f)
  12512. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12513. @item r(x), g(x), b(x)
  12514. red, green, and blue value of intensity x.
  12515. @end table
  12516. Default value is @code{st(0, (midi(f)-59.5)/12);
  12517. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12518. r(1-ld(1)) + b(ld(1))}.
  12519. @item axisfile
  12520. Specify image file to draw the axis. This option override @var{fontfile} and
  12521. @var{fontcolor} option.
  12522. @item axis, text
  12523. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12524. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12525. Default value is @code{1}.
  12526. @end table
  12527. @subsection Examples
  12528. @itemize
  12529. @item
  12530. Playing audio while showing the spectrum:
  12531. @example
  12532. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12533. @end example
  12534. @item
  12535. Same as above, but with frame rate 30 fps:
  12536. @example
  12537. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12538. @end example
  12539. @item
  12540. Playing at 1280x720:
  12541. @example
  12542. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12543. @end example
  12544. @item
  12545. Disable sonogram display:
  12546. @example
  12547. sono_h=0
  12548. @end example
  12549. @item
  12550. A1 and its harmonics: A1, A2, (near)E3, A3:
  12551. @example
  12552. 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),
  12553. asplit[a][out1]; [a] showcqt [out0]'
  12554. @end example
  12555. @item
  12556. Same as above, but with more accuracy in frequency domain:
  12557. @example
  12558. 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),
  12559. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12560. @end example
  12561. @item
  12562. Custom volume:
  12563. @example
  12564. bar_v=10:sono_v=bar_v*a_weighting(f)
  12565. @end example
  12566. @item
  12567. Custom gamma, now spectrum is linear to the amplitude.
  12568. @example
  12569. bar_g=2:sono_g=2
  12570. @end example
  12571. @item
  12572. Custom tlength equation:
  12573. @example
  12574. 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)))'
  12575. @end example
  12576. @item
  12577. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12578. @example
  12579. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12580. @end example
  12581. @item
  12582. Custom frequency range with custom axis using image file:
  12583. @example
  12584. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12585. @end example
  12586. @end itemize
  12587. @section showfreqs
  12588. Convert input audio to video output representing the audio power spectrum.
  12589. Audio amplitude is on Y-axis while frequency is on X-axis.
  12590. The filter accepts the following options:
  12591. @table @option
  12592. @item size, s
  12593. Specify size of video. For the syntax of this option, check the
  12594. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12595. Default is @code{1024x512}.
  12596. @item mode
  12597. Set display mode.
  12598. This set how each frequency bin will be represented.
  12599. It accepts the following values:
  12600. @table @samp
  12601. @item line
  12602. @item bar
  12603. @item dot
  12604. @end table
  12605. Default is @code{bar}.
  12606. @item ascale
  12607. Set amplitude scale.
  12608. It accepts the following values:
  12609. @table @samp
  12610. @item lin
  12611. Linear scale.
  12612. @item sqrt
  12613. Square root scale.
  12614. @item cbrt
  12615. Cubic root scale.
  12616. @item log
  12617. Logarithmic scale.
  12618. @end table
  12619. Default is @code{log}.
  12620. @item fscale
  12621. Set frequency scale.
  12622. It accepts the following values:
  12623. @table @samp
  12624. @item lin
  12625. Linear scale.
  12626. @item log
  12627. Logarithmic scale.
  12628. @item rlog
  12629. Reverse logarithmic scale.
  12630. @end table
  12631. Default is @code{lin}.
  12632. @item win_size
  12633. Set window size.
  12634. It accepts the following values:
  12635. @table @samp
  12636. @item w16
  12637. @item w32
  12638. @item w64
  12639. @item w128
  12640. @item w256
  12641. @item w512
  12642. @item w1024
  12643. @item w2048
  12644. @item w4096
  12645. @item w8192
  12646. @item w16384
  12647. @item w32768
  12648. @item w65536
  12649. @end table
  12650. Default is @code{w2048}
  12651. @item win_func
  12652. Set windowing function.
  12653. It accepts the following values:
  12654. @table @samp
  12655. @item rect
  12656. @item bartlett
  12657. @item hanning
  12658. @item hamming
  12659. @item blackman
  12660. @item welch
  12661. @item flattop
  12662. @item bharris
  12663. @item bnuttall
  12664. @item bhann
  12665. @item sine
  12666. @item nuttall
  12667. @item lanczos
  12668. @item gauss
  12669. @item tukey
  12670. @item dolph
  12671. @item cauchy
  12672. @item parzen
  12673. @item poisson
  12674. @end table
  12675. Default is @code{hanning}.
  12676. @item overlap
  12677. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12678. which means optimal overlap for selected window function will be picked.
  12679. @item averaging
  12680. Set time averaging. Setting this to 0 will display current maximal peaks.
  12681. Default is @code{1}, which means time averaging is disabled.
  12682. @item colors
  12683. Specify list of colors separated by space or by '|' which will be used to
  12684. draw channel frequencies. Unrecognized or missing colors will be replaced
  12685. by white color.
  12686. @item cmode
  12687. Set channel display mode.
  12688. It accepts the following values:
  12689. @table @samp
  12690. @item combined
  12691. @item separate
  12692. @end table
  12693. Default is @code{combined}.
  12694. @item minamp
  12695. Set minimum amplitude used in @code{log} amplitude scaler.
  12696. @end table
  12697. @anchor{showspectrum}
  12698. @section showspectrum
  12699. Convert input audio to a video output, representing the audio frequency
  12700. spectrum.
  12701. The filter accepts the following options:
  12702. @table @option
  12703. @item size, s
  12704. Specify the video size for the output. For the syntax of this option, check the
  12705. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12706. Default value is @code{640x512}.
  12707. @item slide
  12708. Specify how the spectrum should slide along the window.
  12709. It accepts the following values:
  12710. @table @samp
  12711. @item replace
  12712. the samples start again on the left when they reach the right
  12713. @item scroll
  12714. the samples scroll from right to left
  12715. @item rscroll
  12716. the samples scroll from left to right
  12717. @item fullframe
  12718. frames are only produced when the samples reach the right
  12719. @end table
  12720. Default value is @code{replace}.
  12721. @item mode
  12722. Specify display mode.
  12723. It accepts the following values:
  12724. @table @samp
  12725. @item combined
  12726. all channels are displayed in the same row
  12727. @item separate
  12728. all channels are displayed in separate rows
  12729. @end table
  12730. Default value is @samp{combined}.
  12731. @item color
  12732. Specify display color mode.
  12733. It accepts the following values:
  12734. @table @samp
  12735. @item channel
  12736. each channel is displayed in a separate color
  12737. @item intensity
  12738. each channel is displayed using the same color scheme
  12739. @item rainbow
  12740. each channel is displayed using the rainbow color scheme
  12741. @item moreland
  12742. each channel is displayed using the moreland color scheme
  12743. @item nebulae
  12744. each channel is displayed using the nebulae color scheme
  12745. @item fire
  12746. each channel is displayed using the fire color scheme
  12747. @item fiery
  12748. each channel is displayed using the fiery color scheme
  12749. @item fruit
  12750. each channel is displayed using the fruit color scheme
  12751. @item cool
  12752. each channel is displayed using the cool color scheme
  12753. @end table
  12754. Default value is @samp{channel}.
  12755. @item scale
  12756. Specify scale used for calculating intensity color values.
  12757. It accepts the following values:
  12758. @table @samp
  12759. @item lin
  12760. linear
  12761. @item sqrt
  12762. square root, default
  12763. @item cbrt
  12764. cubic root
  12765. @item 4thrt
  12766. 4th root
  12767. @item 5thrt
  12768. 5th root
  12769. @item log
  12770. logarithmic
  12771. @end table
  12772. Default value is @samp{sqrt}.
  12773. @item saturation
  12774. Set saturation modifier for displayed colors. Negative values provide
  12775. alternative color scheme. @code{0} is no saturation at all.
  12776. Saturation must be in [-10.0, 10.0] range.
  12777. Default value is @code{1}.
  12778. @item win_func
  12779. Set window function.
  12780. It accepts the following values:
  12781. @table @samp
  12782. @item rect
  12783. @item bartlett
  12784. @item hann
  12785. @item hanning
  12786. @item hamming
  12787. @item blackman
  12788. @item welch
  12789. @item flattop
  12790. @item bharris
  12791. @item bnuttall
  12792. @item bhann
  12793. @item sine
  12794. @item nuttall
  12795. @item lanczos
  12796. @item gauss
  12797. @item tukey
  12798. @item dolph
  12799. @item cauchy
  12800. @item parzen
  12801. @item poisson
  12802. @end table
  12803. Default value is @code{hann}.
  12804. @item orientation
  12805. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12806. @code{horizontal}. Default is @code{vertical}.
  12807. @item overlap
  12808. Set ratio of overlap window. Default value is @code{0}.
  12809. When value is @code{1} overlap is set to recommended size for specific
  12810. window function currently used.
  12811. @item gain
  12812. Set scale gain for calculating intensity color values.
  12813. Default value is @code{1}.
  12814. @item data
  12815. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12816. @item rotation
  12817. Set color rotation, must be in [-1.0, 1.0] range.
  12818. Default value is @code{0}.
  12819. @end table
  12820. The usage is very similar to the showwaves filter; see the examples in that
  12821. section.
  12822. @subsection Examples
  12823. @itemize
  12824. @item
  12825. Large window with logarithmic color scaling:
  12826. @example
  12827. showspectrum=s=1280x480:scale=log
  12828. @end example
  12829. @item
  12830. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12831. @example
  12832. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12833. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12834. @end example
  12835. @end itemize
  12836. @section showspectrumpic
  12837. Convert input audio to a single video frame, representing the audio frequency
  12838. spectrum.
  12839. The filter accepts the following options:
  12840. @table @option
  12841. @item size, s
  12842. Specify the video size for the output. For the syntax of this option, check the
  12843. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12844. Default value is @code{4096x2048}.
  12845. @item mode
  12846. Specify display mode.
  12847. It accepts the following values:
  12848. @table @samp
  12849. @item combined
  12850. all channels are displayed in the same row
  12851. @item separate
  12852. all channels are displayed in separate rows
  12853. @end table
  12854. Default value is @samp{combined}.
  12855. @item color
  12856. Specify display color mode.
  12857. It accepts the following values:
  12858. @table @samp
  12859. @item channel
  12860. each channel is displayed in a separate color
  12861. @item intensity
  12862. each channel is displayed using the same color scheme
  12863. @item rainbow
  12864. each channel is displayed using the rainbow color scheme
  12865. @item moreland
  12866. each channel is displayed using the moreland color scheme
  12867. @item nebulae
  12868. each channel is displayed using the nebulae color scheme
  12869. @item fire
  12870. each channel is displayed using the fire color scheme
  12871. @item fiery
  12872. each channel is displayed using the fiery color scheme
  12873. @item fruit
  12874. each channel is displayed using the fruit color scheme
  12875. @item cool
  12876. each channel is displayed using the cool color scheme
  12877. @end table
  12878. Default value is @samp{intensity}.
  12879. @item scale
  12880. Specify scale used for calculating intensity color values.
  12881. It accepts the following values:
  12882. @table @samp
  12883. @item lin
  12884. linear
  12885. @item sqrt
  12886. square root, default
  12887. @item cbrt
  12888. cubic root
  12889. @item 4thrt
  12890. 4th root
  12891. @item 5thrt
  12892. 5th root
  12893. @item log
  12894. logarithmic
  12895. @end table
  12896. Default value is @samp{log}.
  12897. @item saturation
  12898. Set saturation modifier for displayed colors. Negative values provide
  12899. alternative color scheme. @code{0} is no saturation at all.
  12900. Saturation must be in [-10.0, 10.0] range.
  12901. Default value is @code{1}.
  12902. @item win_func
  12903. Set window function.
  12904. It accepts the following values:
  12905. @table @samp
  12906. @item rect
  12907. @item bartlett
  12908. @item hann
  12909. @item hanning
  12910. @item hamming
  12911. @item blackman
  12912. @item welch
  12913. @item flattop
  12914. @item bharris
  12915. @item bnuttall
  12916. @item bhann
  12917. @item sine
  12918. @item nuttall
  12919. @item lanczos
  12920. @item gauss
  12921. @item tukey
  12922. @item dolph
  12923. @item cauchy
  12924. @item parzen
  12925. @item poisson
  12926. @end table
  12927. Default value is @code{hann}.
  12928. @item orientation
  12929. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12930. @code{horizontal}. Default is @code{vertical}.
  12931. @item gain
  12932. Set scale gain for calculating intensity color values.
  12933. Default value is @code{1}.
  12934. @item legend
  12935. Draw time and frequency axes and legends. Default is enabled.
  12936. @item rotation
  12937. Set color rotation, must be in [-1.0, 1.0] range.
  12938. Default value is @code{0}.
  12939. @end table
  12940. @subsection Examples
  12941. @itemize
  12942. @item
  12943. Extract an audio spectrogram of a whole audio track
  12944. in a 1024x1024 picture using @command{ffmpeg}:
  12945. @example
  12946. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12947. @end example
  12948. @end itemize
  12949. @section showvolume
  12950. Convert input audio volume to a video output.
  12951. The filter accepts the following options:
  12952. @table @option
  12953. @item rate, r
  12954. Set video rate.
  12955. @item b
  12956. Set border width, allowed range is [0, 5]. Default is 1.
  12957. @item w
  12958. Set channel width, allowed range is [80, 8192]. Default is 400.
  12959. @item h
  12960. Set channel height, allowed range is [1, 900]. Default is 20.
  12961. @item f
  12962. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12963. @item c
  12964. Set volume color expression.
  12965. The expression can use the following variables:
  12966. @table @option
  12967. @item VOLUME
  12968. Current max volume of channel in dB.
  12969. @item CHANNEL
  12970. Current channel number, starting from 0.
  12971. @end table
  12972. @item t
  12973. If set, displays channel names. Default is enabled.
  12974. @item v
  12975. If set, displays volume values. Default is enabled.
  12976. @item o
  12977. Set orientation, can be @code{horizontal} or @code{vertical},
  12978. default is @code{horizontal}.
  12979. @item s
  12980. Set step size, allowed range s [0, 5]. Default is 0, which means
  12981. step is disabled.
  12982. @end table
  12983. @section showwaves
  12984. Convert input audio to a video output, representing the samples waves.
  12985. The filter accepts the following options:
  12986. @table @option
  12987. @item size, s
  12988. Specify the video size for the output. For the syntax of this option, check the
  12989. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12990. Default value is @code{600x240}.
  12991. @item mode
  12992. Set display mode.
  12993. Available values are:
  12994. @table @samp
  12995. @item point
  12996. Draw a point for each sample.
  12997. @item line
  12998. Draw a vertical line for each sample.
  12999. @item p2p
  13000. Draw a point for each sample and a line between them.
  13001. @item cline
  13002. Draw a centered vertical line for each sample.
  13003. @end table
  13004. Default value is @code{point}.
  13005. @item n
  13006. Set the number of samples which are printed on the same column. A
  13007. larger value will decrease the frame rate. Must be a positive
  13008. integer. This option can be set only if the value for @var{rate}
  13009. is not explicitly specified.
  13010. @item rate, r
  13011. Set the (approximate) output frame rate. This is done by setting the
  13012. option @var{n}. Default value is "25".
  13013. @item split_channels
  13014. Set if channels should be drawn separately or overlap. Default value is 0.
  13015. @item colors
  13016. Set colors separated by '|' which are going to be used for drawing of each channel.
  13017. @item scale
  13018. Set amplitude scale.
  13019. Available values are:
  13020. @table @samp
  13021. @item lin
  13022. Linear.
  13023. @item log
  13024. Logarithmic.
  13025. @item sqrt
  13026. Square root.
  13027. @item cbrt
  13028. Cubic root.
  13029. @end table
  13030. Default is linear.
  13031. @end table
  13032. @subsection Examples
  13033. @itemize
  13034. @item
  13035. Output the input file audio and the corresponding video representation
  13036. at the same time:
  13037. @example
  13038. amovie=a.mp3,asplit[out0],showwaves[out1]
  13039. @end example
  13040. @item
  13041. Create a synthetic signal and show it with showwaves, forcing a
  13042. frame rate of 30 frames per second:
  13043. @example
  13044. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13045. @end example
  13046. @end itemize
  13047. @section showwavespic
  13048. Convert input audio to a single video frame, representing the samples waves.
  13049. The filter accepts the following options:
  13050. @table @option
  13051. @item size, s
  13052. Specify the video size for the output. For the syntax of this option, check the
  13053. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13054. Default value is @code{600x240}.
  13055. @item split_channels
  13056. Set if channels should be drawn separately or overlap. Default value is 0.
  13057. @item colors
  13058. Set colors separated by '|' which are going to be used for drawing of each channel.
  13059. @item scale
  13060. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13061. Default is linear.
  13062. @end table
  13063. @subsection Examples
  13064. @itemize
  13065. @item
  13066. Extract a channel split representation of the wave form of a whole audio track
  13067. in a 1024x800 picture using @command{ffmpeg}:
  13068. @example
  13069. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13070. @end example
  13071. @end itemize
  13072. @section spectrumsynth
  13073. Sythesize audio from 2 input video spectrums, first input stream represents
  13074. magnitude across time and second represents phase across time.
  13075. The filter will transform from frequency domain as displayed in videos back
  13076. to time domain as presented in audio output.
  13077. This filter is primarly created for reversing processed @ref{showspectrum}
  13078. filter outputs, but can synthesize sound from other spectrograms too.
  13079. But in such case results are going to be poor if the phase data is not
  13080. available, because in such cases phase data need to be recreated, usually
  13081. its just recreated from random noise.
  13082. For best results use gray only output (@code{channel} color mode in
  13083. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13084. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13085. @code{data} option. Inputs videos should generally use @code{fullframe}
  13086. slide mode as that saves resources needed for decoding video.
  13087. The filter accepts the following options:
  13088. @table @option
  13089. @item sample_rate
  13090. Specify sample rate of output audio, the sample rate of audio from which
  13091. spectrum was generated may differ.
  13092. @item channels
  13093. Set number of channels represented in input video spectrums.
  13094. @item scale
  13095. Set scale which was used when generating magnitude input spectrum.
  13096. Can be @code{lin} or @code{log}. Default is @code{log}.
  13097. @item slide
  13098. Set slide which was used when generating inputs spectrums.
  13099. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13100. Default is @code{fullframe}.
  13101. @item win_func
  13102. Set window function used for resynthesis.
  13103. @item overlap
  13104. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13105. which means optimal overlap for selected window function will be picked.
  13106. @item orientation
  13107. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13108. Default is @code{vertical}.
  13109. @end table
  13110. @subsection Examples
  13111. @itemize
  13112. @item
  13113. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13114. then resynthesize videos back to audio with spectrumsynth:
  13115. @example
  13116. 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
  13117. 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
  13118. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13119. @end example
  13120. @end itemize
  13121. @section split, asplit
  13122. Split input into several identical outputs.
  13123. @code{asplit} works with audio input, @code{split} with video.
  13124. The filter accepts a single parameter which specifies the number of outputs. If
  13125. unspecified, it defaults to 2.
  13126. @subsection Examples
  13127. @itemize
  13128. @item
  13129. Create two separate outputs from the same input:
  13130. @example
  13131. [in] split [out0][out1]
  13132. @end example
  13133. @item
  13134. To create 3 or more outputs, you need to specify the number of
  13135. outputs, like in:
  13136. @example
  13137. [in] asplit=3 [out0][out1][out2]
  13138. @end example
  13139. @item
  13140. Create two separate outputs from the same input, one cropped and
  13141. one padded:
  13142. @example
  13143. [in] split [splitout1][splitout2];
  13144. [splitout1] crop=100:100:0:0 [cropout];
  13145. [splitout2] pad=200:200:100:100 [padout];
  13146. @end example
  13147. @item
  13148. Create 5 copies of the input audio with @command{ffmpeg}:
  13149. @example
  13150. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13151. @end example
  13152. @end itemize
  13153. @section zmq, azmq
  13154. Receive commands sent through a libzmq client, and forward them to
  13155. filters in the filtergraph.
  13156. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13157. must be inserted between two video filters, @code{azmq} between two
  13158. audio filters.
  13159. To enable these filters you need to install the libzmq library and
  13160. headers and configure FFmpeg with @code{--enable-libzmq}.
  13161. For more information about libzmq see:
  13162. @url{http://www.zeromq.org/}
  13163. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13164. receives messages sent through a network interface defined by the
  13165. @option{bind_address} option.
  13166. The received message must be in the form:
  13167. @example
  13168. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13169. @end example
  13170. @var{TARGET} specifies the target of the command, usually the name of
  13171. the filter class or a specific filter instance name.
  13172. @var{COMMAND} specifies the name of the command for the target filter.
  13173. @var{ARG} is optional and specifies the optional argument list for the
  13174. given @var{COMMAND}.
  13175. Upon reception, the message is processed and the corresponding command
  13176. is injected into the filtergraph. Depending on the result, the filter
  13177. will send a reply to the client, adopting the format:
  13178. @example
  13179. @var{ERROR_CODE} @var{ERROR_REASON}
  13180. @var{MESSAGE}
  13181. @end example
  13182. @var{MESSAGE} is optional.
  13183. @subsection Examples
  13184. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13185. be used to send commands processed by these filters.
  13186. Consider the following filtergraph generated by @command{ffplay}
  13187. @example
  13188. ffplay -dumpgraph 1 -f lavfi "
  13189. color=s=100x100:c=red [l];
  13190. color=s=100x100:c=blue [r];
  13191. nullsrc=s=200x100, zmq [bg];
  13192. [bg][l] overlay [bg+l];
  13193. [bg+l][r] overlay=x=100 "
  13194. @end example
  13195. To change the color of the left side of the video, the following
  13196. command can be used:
  13197. @example
  13198. echo Parsed_color_0 c yellow | tools/zmqsend
  13199. @end example
  13200. To change the right side:
  13201. @example
  13202. echo Parsed_color_1 c pink | tools/zmqsend
  13203. @end example
  13204. @c man end MULTIMEDIA FILTERS
  13205. @chapter Multimedia Sources
  13206. @c man begin MULTIMEDIA SOURCES
  13207. Below is a description of the currently available multimedia sources.
  13208. @section amovie
  13209. This is the same as @ref{movie} source, except it selects an audio
  13210. stream by default.
  13211. @anchor{movie}
  13212. @section movie
  13213. Read audio and/or video stream(s) from a movie container.
  13214. It accepts the following parameters:
  13215. @table @option
  13216. @item filename
  13217. The name of the resource to read (not necessarily a file; it can also be a
  13218. device or a stream accessed through some protocol).
  13219. @item format_name, f
  13220. Specifies the format assumed for the movie to read, and can be either
  13221. the name of a container or an input device. If not specified, the
  13222. format is guessed from @var{movie_name} or by probing.
  13223. @item seek_point, sp
  13224. Specifies the seek point in seconds. The frames will be output
  13225. starting from this seek point. The parameter is evaluated with
  13226. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13227. postfix. The default value is "0".
  13228. @item streams, s
  13229. Specifies the streams to read. Several streams can be specified,
  13230. separated by "+". The source will then have as many outputs, in the
  13231. same order. The syntax is explained in the ``Stream specifiers''
  13232. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13233. respectively the default (best suited) video and audio stream. Default
  13234. is "dv", or "da" if the filter is called as "amovie".
  13235. @item stream_index, si
  13236. Specifies the index of the video stream to read. If the value is -1,
  13237. the most suitable video stream will be automatically selected. The default
  13238. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13239. audio instead of video.
  13240. @item loop
  13241. Specifies how many times to read the stream in sequence.
  13242. If the value is less than 1, the stream will be read again and again.
  13243. Default value is "1".
  13244. Note that when the movie is looped the source timestamps are not
  13245. changed, so it will generate non monotonically increasing timestamps.
  13246. @item discontinuity
  13247. Specifies the time difference between frames above which the point is
  13248. considered a timestamp discontinuity which is removed by adjusting the later
  13249. timestamps.
  13250. @end table
  13251. It allows overlaying a second video on top of the main input of
  13252. a filtergraph, as shown in this graph:
  13253. @example
  13254. input -----------> deltapts0 --> overlay --> output
  13255. ^
  13256. |
  13257. movie --> scale--> deltapts1 -------+
  13258. @end example
  13259. @subsection Examples
  13260. @itemize
  13261. @item
  13262. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13263. on top of the input labelled "in":
  13264. @example
  13265. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13266. [in] setpts=PTS-STARTPTS [main];
  13267. [main][over] overlay=16:16 [out]
  13268. @end example
  13269. @item
  13270. Read from a video4linux2 device, and overlay it on top of the input
  13271. labelled "in":
  13272. @example
  13273. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13274. [in] setpts=PTS-STARTPTS [main];
  13275. [main][over] overlay=16:16 [out]
  13276. @end example
  13277. @item
  13278. Read the first video stream and the audio stream with id 0x81 from
  13279. dvd.vob; the video is connected to the pad named "video" and the audio is
  13280. connected to the pad named "audio":
  13281. @example
  13282. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13283. @end example
  13284. @end itemize
  13285. @subsection Commands
  13286. Both movie and amovie support the following commands:
  13287. @table @option
  13288. @item seek
  13289. Perform seek using "av_seek_frame".
  13290. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13291. @itemize
  13292. @item
  13293. @var{stream_index}: If stream_index is -1, a default
  13294. stream is selected, and @var{timestamp} is automatically converted
  13295. from AV_TIME_BASE units to the stream specific time_base.
  13296. @item
  13297. @var{timestamp}: Timestamp in AVStream.time_base units
  13298. or, if no stream is specified, in AV_TIME_BASE units.
  13299. @item
  13300. @var{flags}: Flags which select direction and seeking mode.
  13301. @end itemize
  13302. @item get_duration
  13303. Get movie duration in AV_TIME_BASE units.
  13304. @end table
  13305. @c man end MULTIMEDIA SOURCES