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.

17353 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. @item exact
  4365. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4366. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4367. It defaults to 0.
  4368. @end table
  4369. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4370. expressions containing the following constants:
  4371. @table @option
  4372. @item x
  4373. @item y
  4374. The computed values for @var{x} and @var{y}. They are evaluated for
  4375. each new frame.
  4376. @item in_w
  4377. @item in_h
  4378. The input width and height.
  4379. @item iw
  4380. @item ih
  4381. These are the same as @var{in_w} and @var{in_h}.
  4382. @item out_w
  4383. @item out_h
  4384. The output (cropped) width and height.
  4385. @item ow
  4386. @item oh
  4387. These are the same as @var{out_w} and @var{out_h}.
  4388. @item a
  4389. same as @var{iw} / @var{ih}
  4390. @item sar
  4391. input sample aspect ratio
  4392. @item dar
  4393. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4394. @item hsub
  4395. @item vsub
  4396. horizontal and vertical chroma subsample values. For example for the
  4397. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4398. @item n
  4399. The number of the input frame, starting from 0.
  4400. @item pos
  4401. the position in the file of the input frame, NAN if unknown
  4402. @item t
  4403. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4404. @end table
  4405. The expression for @var{out_w} may depend on the value of @var{out_h},
  4406. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4407. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4408. evaluated after @var{out_w} and @var{out_h}.
  4409. The @var{x} and @var{y} parameters specify the expressions for the
  4410. position of the top-left corner of the output (non-cropped) area. They
  4411. are evaluated for each frame. If the evaluated value is not valid, it
  4412. is approximated to the nearest valid value.
  4413. The expression for @var{x} may depend on @var{y}, and the expression
  4414. for @var{y} may depend on @var{x}.
  4415. @subsection Examples
  4416. @itemize
  4417. @item
  4418. Crop area with size 100x100 at position (12,34).
  4419. @example
  4420. crop=100:100:12:34
  4421. @end example
  4422. Using named options, the example above becomes:
  4423. @example
  4424. crop=w=100:h=100:x=12:y=34
  4425. @end example
  4426. @item
  4427. Crop the central input area with size 100x100:
  4428. @example
  4429. crop=100:100
  4430. @end example
  4431. @item
  4432. Crop the central input area with size 2/3 of the input video:
  4433. @example
  4434. crop=2/3*in_w:2/3*in_h
  4435. @end example
  4436. @item
  4437. Crop the input video central square:
  4438. @example
  4439. crop=out_w=in_h
  4440. crop=in_h
  4441. @end example
  4442. @item
  4443. Delimit the rectangle with the top-left corner placed at position
  4444. 100:100 and the right-bottom corner corresponding to the right-bottom
  4445. corner of the input image.
  4446. @example
  4447. crop=in_w-100:in_h-100:100:100
  4448. @end example
  4449. @item
  4450. Crop 10 pixels from the left and right borders, and 20 pixels from
  4451. the top and bottom borders
  4452. @example
  4453. crop=in_w-2*10:in_h-2*20
  4454. @end example
  4455. @item
  4456. Keep only the bottom right quarter of the input image:
  4457. @example
  4458. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4459. @end example
  4460. @item
  4461. Crop height for getting Greek harmony:
  4462. @example
  4463. crop=in_w:1/PHI*in_w
  4464. @end example
  4465. @item
  4466. Apply trembling effect:
  4467. @example
  4468. 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)
  4469. @end example
  4470. @item
  4471. Apply erratic camera effect depending on timestamp:
  4472. @example
  4473. 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)"
  4474. @end example
  4475. @item
  4476. Set x depending on the value of y:
  4477. @example
  4478. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4479. @end example
  4480. @end itemize
  4481. @subsection Commands
  4482. This filter supports the following commands:
  4483. @table @option
  4484. @item w, out_w
  4485. @item h, out_h
  4486. @item x
  4487. @item y
  4488. Set width/height of the output video and the horizontal/vertical position
  4489. in the input video.
  4490. The command accepts the same syntax of the corresponding option.
  4491. If the specified expression is not valid, it is kept at its current
  4492. value.
  4493. @end table
  4494. @section cropdetect
  4495. Auto-detect the crop size.
  4496. It calculates the necessary cropping parameters and prints the
  4497. recommended parameters via the logging system. The detected dimensions
  4498. correspond to the non-black area of the input video.
  4499. It accepts the following parameters:
  4500. @table @option
  4501. @item limit
  4502. Set higher black value threshold, which can be optionally specified
  4503. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4504. value greater to the set value is considered non-black. It defaults to 24.
  4505. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4506. on the bitdepth of the pixel format.
  4507. @item round
  4508. The value which the width/height should be divisible by. It defaults to
  4509. 16. The offset is automatically adjusted to center the video. Use 2 to
  4510. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4511. encoding to most video codecs.
  4512. @item reset_count, reset
  4513. Set the counter that determines after how many frames cropdetect will
  4514. reset the previously detected largest video area and start over to
  4515. detect the current optimal crop area. Default value is 0.
  4516. This can be useful when channel logos distort the video area. 0
  4517. indicates 'never reset', and returns the largest area encountered during
  4518. playback.
  4519. @end table
  4520. @anchor{curves}
  4521. @section curves
  4522. Apply color adjustments using curves.
  4523. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4524. component (red, green and blue) has its values defined by @var{N} key points
  4525. tied from each other using a smooth curve. The x-axis represents the pixel
  4526. values from the input frame, and the y-axis the new pixel values to be set for
  4527. the output frame.
  4528. By default, a component curve is defined by the two points @var{(0;0)} and
  4529. @var{(1;1)}. This creates a straight line where each original pixel value is
  4530. "adjusted" to its own value, which means no change to the image.
  4531. The filter allows you to redefine these two points and add some more. A new
  4532. curve (using a natural cubic spline interpolation) will be define to pass
  4533. smoothly through all these new coordinates. The new defined points needs to be
  4534. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4535. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4536. the vector spaces, the values will be clipped accordingly.
  4537. The filter accepts the following options:
  4538. @table @option
  4539. @item preset
  4540. Select one of the available color presets. This option can be used in addition
  4541. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4542. options takes priority on the preset values.
  4543. Available presets are:
  4544. @table @samp
  4545. @item none
  4546. @item color_negative
  4547. @item cross_process
  4548. @item darker
  4549. @item increase_contrast
  4550. @item lighter
  4551. @item linear_contrast
  4552. @item medium_contrast
  4553. @item negative
  4554. @item strong_contrast
  4555. @item vintage
  4556. @end table
  4557. Default is @code{none}.
  4558. @item master, m
  4559. Set the master key points. These points will define a second pass mapping. It
  4560. is sometimes called a "luminance" or "value" mapping. It can be used with
  4561. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4562. post-processing LUT.
  4563. @item red, r
  4564. Set the key points for the red component.
  4565. @item green, g
  4566. Set the key points for the green component.
  4567. @item blue, b
  4568. Set the key points for the blue component.
  4569. @item all
  4570. Set the key points for all components (not including master).
  4571. Can be used in addition to the other key points component
  4572. options. In this case, the unset component(s) will fallback on this
  4573. @option{all} setting.
  4574. @item psfile
  4575. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4576. @item plot
  4577. Save Gnuplot script of the curves in specified file.
  4578. @end table
  4579. To avoid some filtergraph syntax conflicts, each key points list need to be
  4580. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4581. @subsection Examples
  4582. @itemize
  4583. @item
  4584. Increase slightly the middle level of blue:
  4585. @example
  4586. curves=blue='0/0 0.5/0.58 1/1'
  4587. @end example
  4588. @item
  4589. Vintage effect:
  4590. @example
  4591. 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'
  4592. @end example
  4593. Here we obtain the following coordinates for each components:
  4594. @table @var
  4595. @item red
  4596. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4597. @item green
  4598. @code{(0;0) (0.50;0.48) (1;1)}
  4599. @item blue
  4600. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4601. @end table
  4602. @item
  4603. The previous example can also be achieved with the associated built-in preset:
  4604. @example
  4605. curves=preset=vintage
  4606. @end example
  4607. @item
  4608. Or simply:
  4609. @example
  4610. curves=vintage
  4611. @end example
  4612. @item
  4613. Use a Photoshop preset and redefine the points of the green component:
  4614. @example
  4615. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4616. @end example
  4617. @item
  4618. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4619. and @command{gnuplot}:
  4620. @example
  4621. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4622. gnuplot -p /tmp/curves.plt
  4623. @end example
  4624. @end itemize
  4625. @section datascope
  4626. Video data analysis filter.
  4627. This filter shows hexadecimal pixel values of part of video.
  4628. The filter accepts the following options:
  4629. @table @option
  4630. @item size, s
  4631. Set output video size.
  4632. @item x
  4633. Set x offset from where to pick pixels.
  4634. @item y
  4635. Set y offset from where to pick pixels.
  4636. @item mode
  4637. Set scope mode, can be one of the following:
  4638. @table @samp
  4639. @item mono
  4640. Draw hexadecimal pixel values with white color on black background.
  4641. @item color
  4642. Draw hexadecimal pixel values with input video pixel color on black
  4643. background.
  4644. @item color2
  4645. Draw hexadecimal pixel values on color background picked from input video,
  4646. the text color is picked in such way so its always visible.
  4647. @end table
  4648. @item axis
  4649. Draw rows and columns numbers on left and top of video.
  4650. @end table
  4651. @section dctdnoiz
  4652. Denoise frames using 2D DCT (frequency domain filtering).
  4653. This filter is not designed for real time.
  4654. The filter accepts the following options:
  4655. @table @option
  4656. @item sigma, s
  4657. Set the noise sigma constant.
  4658. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4659. coefficient (absolute value) below this threshold with be dropped.
  4660. If you need a more advanced filtering, see @option{expr}.
  4661. Default is @code{0}.
  4662. @item overlap
  4663. Set number overlapping pixels for each block. Since the filter can be slow, you
  4664. may want to reduce this value, at the cost of a less effective filter and the
  4665. risk of various artefacts.
  4666. If the overlapping value doesn't permit processing the whole input width or
  4667. height, a warning will be displayed and according borders won't be denoised.
  4668. Default value is @var{blocksize}-1, which is the best possible setting.
  4669. @item expr, e
  4670. Set the coefficient factor expression.
  4671. For each coefficient of a DCT block, this expression will be evaluated as a
  4672. multiplier value for the coefficient.
  4673. If this is option is set, the @option{sigma} option will be ignored.
  4674. The absolute value of the coefficient can be accessed through the @var{c}
  4675. variable.
  4676. @item n
  4677. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4678. @var{blocksize}, which is the width and height of the processed blocks.
  4679. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4680. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4681. on the speed processing. Also, a larger block size does not necessarily means a
  4682. better de-noising.
  4683. @end table
  4684. @subsection Examples
  4685. Apply a denoise with a @option{sigma} of @code{4.5}:
  4686. @example
  4687. dctdnoiz=4.5
  4688. @end example
  4689. The same operation can be achieved using the expression system:
  4690. @example
  4691. dctdnoiz=e='gte(c, 4.5*3)'
  4692. @end example
  4693. Violent denoise using a block size of @code{16x16}:
  4694. @example
  4695. dctdnoiz=15:n=4
  4696. @end example
  4697. @section deband
  4698. Remove banding artifacts from input video.
  4699. It works by replacing banded pixels with average value of referenced pixels.
  4700. The filter accepts the following options:
  4701. @table @option
  4702. @item 1thr
  4703. @item 2thr
  4704. @item 3thr
  4705. @item 4thr
  4706. Set banding detection threshold for each plane. Default is 0.02.
  4707. Valid range is 0.00003 to 0.5.
  4708. If difference between current pixel and reference pixel is less than threshold,
  4709. it will be considered as banded.
  4710. @item range, r
  4711. Banding detection range in pixels. Default is 16. If positive, random number
  4712. in range 0 to set value will be used. If negative, exact absolute value
  4713. will be used.
  4714. The range defines square of four pixels around current pixel.
  4715. @item direction, d
  4716. Set direction in radians from which four pixel will be compared. If positive,
  4717. random direction from 0 to set direction will be picked. If negative, exact of
  4718. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4719. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4720. column.
  4721. @item blur
  4722. If enabled, current pixel is compared with average value of all four
  4723. surrounding pixels. The default is enabled. If disabled current pixel is
  4724. compared with all four surrounding pixels. The pixel is considered banded
  4725. if only all four differences with surrounding pixels are less than threshold.
  4726. @end table
  4727. @anchor{decimate}
  4728. @section decimate
  4729. Drop duplicated frames at regular intervals.
  4730. The filter accepts the following options:
  4731. @table @option
  4732. @item cycle
  4733. Set the number of frames from which one will be dropped. Setting this to
  4734. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4735. Default is @code{5}.
  4736. @item dupthresh
  4737. Set the threshold for duplicate detection. If the difference metric for a frame
  4738. is less than or equal to this value, then it is declared as duplicate. Default
  4739. is @code{1.1}
  4740. @item scthresh
  4741. Set scene change threshold. Default is @code{15}.
  4742. @item blockx
  4743. @item blocky
  4744. Set the size of the x and y-axis blocks used during metric calculations.
  4745. Larger blocks give better noise suppression, but also give worse detection of
  4746. small movements. Must be a power of two. Default is @code{32}.
  4747. @item ppsrc
  4748. Mark main input as a pre-processed input and activate clean source input
  4749. stream. This allows the input to be pre-processed with various filters to help
  4750. the metrics calculation while keeping the frame selection lossless. When set to
  4751. @code{1}, the first stream is for the pre-processed input, and the second
  4752. stream is the clean source from where the kept frames are chosen. Default is
  4753. @code{0}.
  4754. @item chroma
  4755. Set whether or not chroma is considered in the metric calculations. Default is
  4756. @code{1}.
  4757. @end table
  4758. @section deflate
  4759. Apply deflate effect to the video.
  4760. This filter replaces the pixel by the local(3x3) average by taking into account
  4761. only values lower than the pixel.
  4762. It accepts the following options:
  4763. @table @option
  4764. @item threshold0
  4765. @item threshold1
  4766. @item threshold2
  4767. @item threshold3
  4768. Limit the maximum change for each plane, default is 65535.
  4769. If 0, plane will remain unchanged.
  4770. @end table
  4771. @section dejudder
  4772. Remove judder produced by partially interlaced telecined content.
  4773. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4774. source was partially telecined content then the output of @code{pullup,dejudder}
  4775. will have a variable frame rate. May change the recorded frame rate of the
  4776. container. Aside from that change, this filter will not affect constant frame
  4777. rate video.
  4778. The option available in this filter is:
  4779. @table @option
  4780. @item cycle
  4781. Specify the length of the window over which the judder repeats.
  4782. Accepts any integer greater than 1. Useful values are:
  4783. @table @samp
  4784. @item 4
  4785. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4786. @item 5
  4787. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4788. @item 20
  4789. If a mixture of the two.
  4790. @end table
  4791. The default is @samp{4}.
  4792. @end table
  4793. @section delogo
  4794. Suppress a TV station logo by a simple interpolation of the surrounding
  4795. pixels. Just set a rectangle covering the logo and watch it disappear
  4796. (and sometimes something even uglier appear - your mileage may vary).
  4797. It accepts the following parameters:
  4798. @table @option
  4799. @item x
  4800. @item y
  4801. Specify the top left corner coordinates of the logo. They must be
  4802. specified.
  4803. @item w
  4804. @item h
  4805. Specify the width and height of the logo to clear. They must be
  4806. specified.
  4807. @item band, t
  4808. Specify the thickness of the fuzzy edge of the rectangle (added to
  4809. @var{w} and @var{h}). The default value is 1. This option is
  4810. deprecated, setting higher values should no longer be necessary and
  4811. is not recommended.
  4812. @item show
  4813. When set to 1, a green rectangle is drawn on the screen to simplify
  4814. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4815. The default value is 0.
  4816. The rectangle is drawn on the outermost pixels which will be (partly)
  4817. replaced with interpolated values. The values of the next pixels
  4818. immediately outside this rectangle in each direction will be used to
  4819. compute the interpolated pixel values inside the rectangle.
  4820. @end table
  4821. @subsection Examples
  4822. @itemize
  4823. @item
  4824. Set a rectangle covering the area with top left corner coordinates 0,0
  4825. and size 100x77, and a band of size 10:
  4826. @example
  4827. delogo=x=0:y=0:w=100:h=77:band=10
  4828. @end example
  4829. @end itemize
  4830. @section deshake
  4831. Attempt to fix small changes in horizontal and/or vertical shift. This
  4832. filter helps remove camera shake from hand-holding a camera, bumping a
  4833. tripod, moving on a vehicle, etc.
  4834. The filter accepts the following options:
  4835. @table @option
  4836. @item x
  4837. @item y
  4838. @item w
  4839. @item h
  4840. Specify a rectangular area where to limit the search for motion
  4841. vectors.
  4842. If desired the search for motion vectors can be limited to a
  4843. rectangular area of the frame defined by its top left corner, width
  4844. and height. These parameters have the same meaning as the drawbox
  4845. filter which can be used to visualise the position of the bounding
  4846. box.
  4847. This is useful when simultaneous movement of subjects within the frame
  4848. might be confused for camera motion by the motion vector search.
  4849. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4850. then the full frame is used. This allows later options to be set
  4851. without specifying the bounding box for the motion vector search.
  4852. Default - search the whole frame.
  4853. @item rx
  4854. @item ry
  4855. Specify the maximum extent of movement in x and y directions in the
  4856. range 0-64 pixels. Default 16.
  4857. @item edge
  4858. Specify how to generate pixels to fill blanks at the edge of the
  4859. frame. Available values are:
  4860. @table @samp
  4861. @item blank, 0
  4862. Fill zeroes at blank locations
  4863. @item original, 1
  4864. Original image at blank locations
  4865. @item clamp, 2
  4866. Extruded edge value at blank locations
  4867. @item mirror, 3
  4868. Mirrored edge at blank locations
  4869. @end table
  4870. Default value is @samp{mirror}.
  4871. @item blocksize
  4872. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4873. default 8.
  4874. @item contrast
  4875. Specify the contrast threshold for blocks. Only blocks with more than
  4876. the specified contrast (difference between darkest and lightest
  4877. pixels) will be considered. Range 1-255, default 125.
  4878. @item search
  4879. Specify the search strategy. Available values are:
  4880. @table @samp
  4881. @item exhaustive, 0
  4882. Set exhaustive search
  4883. @item less, 1
  4884. Set less exhaustive search.
  4885. @end table
  4886. Default value is @samp{exhaustive}.
  4887. @item filename
  4888. If set then a detailed log of the motion search is written to the
  4889. specified file.
  4890. @item opencl
  4891. If set to 1, specify using OpenCL capabilities, only available if
  4892. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4893. @end table
  4894. @section detelecine
  4895. Apply an exact inverse of the telecine operation. It requires a predefined
  4896. pattern specified using the pattern option which must be the same as that passed
  4897. to the telecine filter.
  4898. This filter accepts the following options:
  4899. @table @option
  4900. @item first_field
  4901. @table @samp
  4902. @item top, t
  4903. top field first
  4904. @item bottom, b
  4905. bottom field first
  4906. The default value is @code{top}.
  4907. @end table
  4908. @item pattern
  4909. A string of numbers representing the pulldown pattern you wish to apply.
  4910. The default value is @code{23}.
  4911. @item start_frame
  4912. A number representing position of the first frame with respect to the telecine
  4913. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4914. @end table
  4915. @section dilation
  4916. Apply dilation effect to the video.
  4917. This filter replaces the pixel by the local(3x3) maximum.
  4918. It accepts the following options:
  4919. @table @option
  4920. @item threshold0
  4921. @item threshold1
  4922. @item threshold2
  4923. @item threshold3
  4924. Limit the maximum change for each plane, default is 65535.
  4925. If 0, plane will remain unchanged.
  4926. @item coordinates
  4927. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4928. pixels are used.
  4929. Flags to local 3x3 coordinates maps like this:
  4930. 1 2 3
  4931. 4 5
  4932. 6 7 8
  4933. @end table
  4934. @section displace
  4935. Displace pixels as indicated by second and third input stream.
  4936. It takes three input streams and outputs one stream, the first input is the
  4937. source, and second and third input are displacement maps.
  4938. The second input specifies how much to displace pixels along the
  4939. x-axis, while the third input specifies how much to displace pixels
  4940. along the y-axis.
  4941. If one of displacement map streams terminates, last frame from that
  4942. displacement map will be used.
  4943. Note that once generated, displacements maps can be reused over and over again.
  4944. A description of the accepted options follows.
  4945. @table @option
  4946. @item edge
  4947. Set displace behavior for pixels that are out of range.
  4948. Available values are:
  4949. @table @samp
  4950. @item blank
  4951. Missing pixels are replaced by black pixels.
  4952. @item smear
  4953. Adjacent pixels will spread out to replace missing pixels.
  4954. @item wrap
  4955. Out of range pixels are wrapped so they point to pixels of other side.
  4956. @end table
  4957. Default is @samp{smear}.
  4958. @end table
  4959. @subsection Examples
  4960. @itemize
  4961. @item
  4962. Add ripple effect to rgb input of video size hd720:
  4963. @example
  4964. 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
  4965. @end example
  4966. @item
  4967. Add wave effect to rgb input of video size hd720:
  4968. @example
  4969. 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
  4970. @end example
  4971. @end itemize
  4972. @section drawbox
  4973. Draw a colored box on the input image.
  4974. It accepts the following parameters:
  4975. @table @option
  4976. @item x
  4977. @item y
  4978. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4979. @item width, w
  4980. @item height, h
  4981. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4982. the input width and height. It defaults to 0.
  4983. @item color, c
  4984. Specify the color of the box to write. For the general syntax of this option,
  4985. check the "Color" section in the ffmpeg-utils manual. If the special
  4986. value @code{invert} is used, the box edge color is the same as the
  4987. video with inverted luma.
  4988. @item thickness, t
  4989. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4990. See below for the list of accepted constants.
  4991. @end table
  4992. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4993. following constants:
  4994. @table @option
  4995. @item dar
  4996. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4997. @item hsub
  4998. @item vsub
  4999. horizontal and vertical chroma subsample values. For example for the
  5000. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5001. @item in_h, ih
  5002. @item in_w, iw
  5003. The input width and height.
  5004. @item sar
  5005. The input sample aspect ratio.
  5006. @item x
  5007. @item y
  5008. The x and y offset coordinates where the box is drawn.
  5009. @item w
  5010. @item h
  5011. The width and height of the drawn box.
  5012. @item t
  5013. The thickness of the drawn box.
  5014. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5015. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5016. @end table
  5017. @subsection Examples
  5018. @itemize
  5019. @item
  5020. Draw a black box around the edge of the input image:
  5021. @example
  5022. drawbox
  5023. @end example
  5024. @item
  5025. Draw a box with color red and an opacity of 50%:
  5026. @example
  5027. drawbox=10:20:200:60:red@@0.5
  5028. @end example
  5029. The previous example can be specified as:
  5030. @example
  5031. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5032. @end example
  5033. @item
  5034. Fill the box with pink color:
  5035. @example
  5036. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5037. @end example
  5038. @item
  5039. Draw a 2-pixel red 2.40:1 mask:
  5040. @example
  5041. 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
  5042. @end example
  5043. @end itemize
  5044. @section drawgrid
  5045. Draw a grid on the input image.
  5046. It accepts the following parameters:
  5047. @table @option
  5048. @item x
  5049. @item y
  5050. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5051. @item width, w
  5052. @item height, h
  5053. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5054. input width and height, respectively, minus @code{thickness}, so image gets
  5055. framed. Default to 0.
  5056. @item color, c
  5057. Specify the color of the grid. For the general syntax of this option,
  5058. check the "Color" section in the ffmpeg-utils manual. If the special
  5059. value @code{invert} is used, the grid color is the same as the
  5060. video with inverted luma.
  5061. @item thickness, t
  5062. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5063. See below for the list of accepted constants.
  5064. @end table
  5065. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5066. following constants:
  5067. @table @option
  5068. @item dar
  5069. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5070. @item hsub
  5071. @item vsub
  5072. horizontal and vertical chroma subsample values. For example for the
  5073. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5074. @item in_h, ih
  5075. @item in_w, iw
  5076. The input grid cell width and height.
  5077. @item sar
  5078. The input sample aspect ratio.
  5079. @item x
  5080. @item y
  5081. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5082. @item w
  5083. @item h
  5084. The width and height of the drawn cell.
  5085. @item t
  5086. The thickness of the drawn cell.
  5087. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5088. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5089. @end table
  5090. @subsection Examples
  5091. @itemize
  5092. @item
  5093. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5094. @example
  5095. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5096. @end example
  5097. @item
  5098. Draw a white 3x3 grid with an opacity of 50%:
  5099. @example
  5100. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5101. @end example
  5102. @end itemize
  5103. @anchor{drawtext}
  5104. @section drawtext
  5105. Draw a text string or text from a specified file on top of a video, using the
  5106. libfreetype library.
  5107. To enable compilation of this filter, you need to configure FFmpeg with
  5108. @code{--enable-libfreetype}.
  5109. To enable default font fallback and the @var{font} option you need to
  5110. configure FFmpeg with @code{--enable-libfontconfig}.
  5111. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5112. @code{--enable-libfribidi}.
  5113. @subsection Syntax
  5114. It accepts the following parameters:
  5115. @table @option
  5116. @item box
  5117. Used to draw a box around text using the background color.
  5118. The value must be either 1 (enable) or 0 (disable).
  5119. The default value of @var{box} is 0.
  5120. @item boxborderw
  5121. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5122. The default value of @var{boxborderw} is 0.
  5123. @item boxcolor
  5124. The color to be used for drawing box around text. For the syntax of this
  5125. option, check the "Color" section in the ffmpeg-utils manual.
  5126. The default value of @var{boxcolor} is "white".
  5127. @item borderw
  5128. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5129. The default value of @var{borderw} is 0.
  5130. @item bordercolor
  5131. Set the color to be used for drawing border around text. For the syntax of this
  5132. option, check the "Color" section in the ffmpeg-utils manual.
  5133. The default value of @var{bordercolor} is "black".
  5134. @item expansion
  5135. Select how the @var{text} is expanded. Can be either @code{none},
  5136. @code{strftime} (deprecated) or
  5137. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5138. below for details.
  5139. @item fix_bounds
  5140. If true, check and fix text coords to avoid clipping.
  5141. @item fontcolor
  5142. The color to be used for drawing fonts. For the syntax of this option, check
  5143. the "Color" section in the ffmpeg-utils manual.
  5144. The default value of @var{fontcolor} is "black".
  5145. @item fontcolor_expr
  5146. String which is expanded the same way as @var{text} to obtain dynamic
  5147. @var{fontcolor} value. By default this option has empty value and is not
  5148. processed. When this option is set, it overrides @var{fontcolor} option.
  5149. @item font
  5150. The font family to be used for drawing text. By default Sans.
  5151. @item fontfile
  5152. The font file to be used for drawing text. The path must be included.
  5153. This parameter is mandatory if the fontconfig support is disabled.
  5154. @item draw
  5155. This option does not exist, please see the timeline system
  5156. @item alpha
  5157. Draw the text applying alpha blending. The value can
  5158. be either a number between 0.0 and 1.0
  5159. The expression accepts the same variables @var{x, y} do.
  5160. The default value is 1.
  5161. Please see fontcolor_expr
  5162. @item fontsize
  5163. The font size to be used for drawing text.
  5164. The default value of @var{fontsize} is 16.
  5165. @item text_shaping
  5166. If set to 1, attempt to shape the text (for example, reverse the order of
  5167. right-to-left text and join Arabic characters) before drawing it.
  5168. Otherwise, just draw the text exactly as given.
  5169. By default 1 (if supported).
  5170. @item ft_load_flags
  5171. The flags to be used for loading the fonts.
  5172. The flags map the corresponding flags supported by libfreetype, and are
  5173. a combination of the following values:
  5174. @table @var
  5175. @item default
  5176. @item no_scale
  5177. @item no_hinting
  5178. @item render
  5179. @item no_bitmap
  5180. @item vertical_layout
  5181. @item force_autohint
  5182. @item crop_bitmap
  5183. @item pedantic
  5184. @item ignore_global_advance_width
  5185. @item no_recurse
  5186. @item ignore_transform
  5187. @item monochrome
  5188. @item linear_design
  5189. @item no_autohint
  5190. @end table
  5191. Default value is "default".
  5192. For more information consult the documentation for the FT_LOAD_*
  5193. libfreetype flags.
  5194. @item shadowcolor
  5195. The color to be used for drawing a shadow behind the drawn text. For the
  5196. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5197. The default value of @var{shadowcolor} is "black".
  5198. @item shadowx
  5199. @item shadowy
  5200. The x and y offsets for the text shadow position with respect to the
  5201. position of the text. They can be either positive or negative
  5202. values. The default value for both is "0".
  5203. @item start_number
  5204. The starting frame number for the n/frame_num variable. The default value
  5205. is "0".
  5206. @item tabsize
  5207. The size in number of spaces to use for rendering the tab.
  5208. Default value is 4.
  5209. @item timecode
  5210. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5211. format. It can be used with or without text parameter. @var{timecode_rate}
  5212. option must be specified.
  5213. @item timecode_rate, rate, r
  5214. Set the timecode frame rate (timecode only).
  5215. @item text
  5216. The text string to be drawn. The text must be a sequence of UTF-8
  5217. encoded characters.
  5218. This parameter is mandatory if no file is specified with the parameter
  5219. @var{textfile}.
  5220. @item textfile
  5221. A text file containing text to be drawn. The text must be a sequence
  5222. of UTF-8 encoded characters.
  5223. This parameter is mandatory if no text string is specified with the
  5224. parameter @var{text}.
  5225. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5226. @item reload
  5227. If set to 1, the @var{textfile} will be reloaded before each frame.
  5228. Be sure to update it atomically, or it may be read partially, or even fail.
  5229. @item x
  5230. @item y
  5231. The expressions which specify the offsets where text will be drawn
  5232. within the video frame. They are relative to the top/left border of the
  5233. output image.
  5234. The default value of @var{x} and @var{y} is "0".
  5235. See below for the list of accepted constants and functions.
  5236. @end table
  5237. The parameters for @var{x} and @var{y} are expressions containing the
  5238. following constants and functions:
  5239. @table @option
  5240. @item dar
  5241. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5242. @item hsub
  5243. @item vsub
  5244. horizontal and vertical chroma subsample values. For example for the
  5245. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5246. @item line_h, lh
  5247. the height of each text line
  5248. @item main_h, h, H
  5249. the input height
  5250. @item main_w, w, W
  5251. the input width
  5252. @item max_glyph_a, ascent
  5253. the maximum distance from the baseline to the highest/upper grid
  5254. coordinate used to place a glyph outline point, for all the rendered
  5255. glyphs.
  5256. It is a positive value, due to the grid's orientation with the Y axis
  5257. upwards.
  5258. @item max_glyph_d, descent
  5259. the maximum distance from the baseline to the lowest grid coordinate
  5260. used to place a glyph outline point, for all the rendered glyphs.
  5261. This is a negative value, due to the grid's orientation, with the Y axis
  5262. upwards.
  5263. @item max_glyph_h
  5264. maximum glyph height, that is the maximum height for all the glyphs
  5265. contained in the rendered text, it is equivalent to @var{ascent} -
  5266. @var{descent}.
  5267. @item max_glyph_w
  5268. maximum glyph width, that is the maximum width for all the glyphs
  5269. contained in the rendered text
  5270. @item n
  5271. the number of input frame, starting from 0
  5272. @item rand(min, max)
  5273. return a random number included between @var{min} and @var{max}
  5274. @item sar
  5275. The input sample aspect ratio.
  5276. @item t
  5277. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5278. @item text_h, th
  5279. the height of the rendered text
  5280. @item text_w, tw
  5281. the width of the rendered text
  5282. @item x
  5283. @item y
  5284. the x and y offset coordinates where the text is drawn.
  5285. These parameters allow the @var{x} and @var{y} expressions to refer
  5286. each other, so you can for example specify @code{y=x/dar}.
  5287. @end table
  5288. @anchor{drawtext_expansion}
  5289. @subsection Text expansion
  5290. If @option{expansion} is set to @code{strftime},
  5291. the filter recognizes strftime() sequences in the provided text and
  5292. expands them accordingly. Check the documentation of strftime(). This
  5293. feature is deprecated.
  5294. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5295. If @option{expansion} is set to @code{normal} (which is the default),
  5296. the following expansion mechanism is used.
  5297. The backslash character @samp{\}, followed by any character, always expands to
  5298. the second character.
  5299. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5300. braces is a function name, possibly followed by arguments separated by ':'.
  5301. If the arguments contain special characters or delimiters (':' or '@}'),
  5302. they should be escaped.
  5303. Note that they probably must also be escaped as the value for the
  5304. @option{text} option in the filter argument string and as the filter
  5305. argument in the filtergraph description, and possibly also for the shell,
  5306. that makes up to four levels of escaping; using a text file avoids these
  5307. problems.
  5308. The following functions are available:
  5309. @table @command
  5310. @item expr, e
  5311. The expression evaluation result.
  5312. It must take one argument specifying the expression to be evaluated,
  5313. which accepts the same constants and functions as the @var{x} and
  5314. @var{y} values. Note that not all constants should be used, for
  5315. example the text size is not known when evaluating the expression, so
  5316. the constants @var{text_w} and @var{text_h} will have an undefined
  5317. value.
  5318. @item expr_int_format, eif
  5319. Evaluate the expression's value and output as formatted integer.
  5320. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5321. The second argument specifies the output format. Allowed values are @samp{x},
  5322. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5323. @code{printf} function.
  5324. The third parameter is optional and sets the number of positions taken by the output.
  5325. It can be used to add padding with zeros from the left.
  5326. @item gmtime
  5327. The time at which the filter is running, expressed in UTC.
  5328. It can accept an argument: a strftime() format string.
  5329. @item localtime
  5330. The time at which the filter is running, expressed in the local time zone.
  5331. It can accept an argument: a strftime() format string.
  5332. @item metadata
  5333. Frame metadata. Takes one or two arguments.
  5334. The first argument is mandatory and specifies the metadata key.
  5335. The second argument is optional and specifies a default value, used when the
  5336. metadata key is not found or empty.
  5337. @item n, frame_num
  5338. The frame number, starting from 0.
  5339. @item pict_type
  5340. A 1 character description of the current picture type.
  5341. @item pts
  5342. The timestamp of the current frame.
  5343. It can take up to three arguments.
  5344. The first argument is the format of the timestamp; it defaults to @code{flt}
  5345. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5346. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5347. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5348. @code{localtime} stands for the timestamp of the frame formatted as
  5349. local time zone time.
  5350. The second argument is an offset added to the timestamp.
  5351. If the format is set to @code{localtime} or @code{gmtime},
  5352. a third argument may be supplied: a strftime() format string.
  5353. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5354. @end table
  5355. @subsection Examples
  5356. @itemize
  5357. @item
  5358. Draw "Test Text" with font FreeSerif, using the default values for the
  5359. optional parameters.
  5360. @example
  5361. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5362. @end example
  5363. @item
  5364. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5365. and y=50 (counting from the top-left corner of the screen), text is
  5366. yellow with a red box around it. Both the text and the box have an
  5367. opacity of 20%.
  5368. @example
  5369. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5370. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5371. @end example
  5372. Note that the double quotes are not necessary if spaces are not used
  5373. within the parameter list.
  5374. @item
  5375. Show the text at the center of the video frame:
  5376. @example
  5377. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5378. @end example
  5379. @item
  5380. Show the text at a random position, switching to a new position every 30 seconds:
  5381. @example
  5382. 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)"
  5383. @end example
  5384. @item
  5385. Show a text line sliding from right to left in the last row of the video
  5386. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5387. with no newlines.
  5388. @example
  5389. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5390. @end example
  5391. @item
  5392. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5393. @example
  5394. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5395. @end example
  5396. @item
  5397. Draw a single green letter "g", at the center of the input video.
  5398. The glyph baseline is placed at half screen height.
  5399. @example
  5400. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5401. @end example
  5402. @item
  5403. Show text for 1 second every 3 seconds:
  5404. @example
  5405. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5406. @end example
  5407. @item
  5408. Use fontconfig to set the font. Note that the colons need to be escaped.
  5409. @example
  5410. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5411. @end example
  5412. @item
  5413. Print the date of a real-time encoding (see strftime(3)):
  5414. @example
  5415. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5416. @end example
  5417. @item
  5418. Show text fading in and out (appearing/disappearing):
  5419. @example
  5420. #!/bin/sh
  5421. DS=1.0 # display start
  5422. DE=10.0 # display end
  5423. FID=1.5 # fade in duration
  5424. FOD=5 # fade out duration
  5425. 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 @}"
  5426. @end example
  5427. @end itemize
  5428. For more information about libfreetype, check:
  5429. @url{http://www.freetype.org/}.
  5430. For more information about fontconfig, check:
  5431. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5432. For more information about libfribidi, check:
  5433. @url{http://fribidi.org/}.
  5434. @section edgedetect
  5435. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5436. The filter accepts the following options:
  5437. @table @option
  5438. @item low
  5439. @item high
  5440. Set low and high threshold values used by the Canny thresholding
  5441. algorithm.
  5442. The high threshold selects the "strong" edge pixels, which are then
  5443. connected through 8-connectivity with the "weak" edge pixels selected
  5444. by the low threshold.
  5445. @var{low} and @var{high} threshold values must be chosen in the range
  5446. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5447. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5448. is @code{50/255}.
  5449. @item mode
  5450. Define the drawing mode.
  5451. @table @samp
  5452. @item wires
  5453. Draw white/gray wires on black background.
  5454. @item colormix
  5455. Mix the colors to create a paint/cartoon effect.
  5456. @end table
  5457. Default value is @var{wires}.
  5458. @end table
  5459. @subsection Examples
  5460. @itemize
  5461. @item
  5462. Standard edge detection with custom values for the hysteresis thresholding:
  5463. @example
  5464. edgedetect=low=0.1:high=0.4
  5465. @end example
  5466. @item
  5467. Painting effect without thresholding:
  5468. @example
  5469. edgedetect=mode=colormix:high=0
  5470. @end example
  5471. @end itemize
  5472. @section eq
  5473. Set brightness, contrast, saturation and approximate gamma adjustment.
  5474. The filter accepts the following options:
  5475. @table @option
  5476. @item contrast
  5477. Set the contrast expression. The value must be a float value in range
  5478. @code{-2.0} to @code{2.0}. The default value is "1".
  5479. @item brightness
  5480. Set the brightness expression. The value must be a float value in
  5481. range @code{-1.0} to @code{1.0}. The default value is "0".
  5482. @item saturation
  5483. Set the saturation expression. The value must be a float in
  5484. range @code{0.0} to @code{3.0}. The default value is "1".
  5485. @item gamma
  5486. Set the gamma expression. The value must be a float in range
  5487. @code{0.1} to @code{10.0}. The default value is "1".
  5488. @item gamma_r
  5489. Set the gamma expression for red. The value must be a float in
  5490. range @code{0.1} to @code{10.0}. The default value is "1".
  5491. @item gamma_g
  5492. Set the gamma expression for green. The value must be a float in range
  5493. @code{0.1} to @code{10.0}. The default value is "1".
  5494. @item gamma_b
  5495. Set the gamma expression for blue. The value must be a float in range
  5496. @code{0.1} to @code{10.0}. The default value is "1".
  5497. @item gamma_weight
  5498. Set the gamma weight expression. It can be used to reduce the effect
  5499. of a high gamma value on bright image areas, e.g. keep them from
  5500. getting overamplified and just plain white. The value must be a float
  5501. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5502. gamma correction all the way down while @code{1.0} leaves it at its
  5503. full strength. Default is "1".
  5504. @item eval
  5505. Set when the expressions for brightness, contrast, saturation and
  5506. gamma expressions are evaluated.
  5507. It accepts the following values:
  5508. @table @samp
  5509. @item init
  5510. only evaluate expressions once during the filter initialization or
  5511. when a command is processed
  5512. @item frame
  5513. evaluate expressions for each incoming frame
  5514. @end table
  5515. Default value is @samp{init}.
  5516. @end table
  5517. The expressions accept the following parameters:
  5518. @table @option
  5519. @item n
  5520. frame count of the input frame starting from 0
  5521. @item pos
  5522. byte position of the corresponding packet in the input file, NAN if
  5523. unspecified
  5524. @item r
  5525. frame rate of the input video, NAN if the input frame rate is unknown
  5526. @item t
  5527. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5528. @end table
  5529. @subsection Commands
  5530. The filter supports the following commands:
  5531. @table @option
  5532. @item contrast
  5533. Set the contrast expression.
  5534. @item brightness
  5535. Set the brightness expression.
  5536. @item saturation
  5537. Set the saturation expression.
  5538. @item gamma
  5539. Set the gamma expression.
  5540. @item gamma_r
  5541. Set the gamma_r expression.
  5542. @item gamma_g
  5543. Set gamma_g expression.
  5544. @item gamma_b
  5545. Set gamma_b expression.
  5546. @item gamma_weight
  5547. Set gamma_weight expression.
  5548. The command accepts the same syntax of the corresponding option.
  5549. If the specified expression is not valid, it is kept at its current
  5550. value.
  5551. @end table
  5552. @section erosion
  5553. Apply erosion effect to the video.
  5554. This filter replaces the pixel by the local(3x3) minimum.
  5555. It accepts the following options:
  5556. @table @option
  5557. @item threshold0
  5558. @item threshold1
  5559. @item threshold2
  5560. @item threshold3
  5561. Limit the maximum change for each plane, default is 65535.
  5562. If 0, plane will remain unchanged.
  5563. @item coordinates
  5564. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5565. pixels are used.
  5566. Flags to local 3x3 coordinates maps like this:
  5567. 1 2 3
  5568. 4 5
  5569. 6 7 8
  5570. @end table
  5571. @section extractplanes
  5572. Extract color channel components from input video stream into
  5573. separate grayscale video streams.
  5574. The filter accepts the following option:
  5575. @table @option
  5576. @item planes
  5577. Set plane(s) to extract.
  5578. Available values for planes are:
  5579. @table @samp
  5580. @item y
  5581. @item u
  5582. @item v
  5583. @item a
  5584. @item r
  5585. @item g
  5586. @item b
  5587. @end table
  5588. Choosing planes not available in the input will result in an error.
  5589. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5590. with @code{y}, @code{u}, @code{v} planes at same time.
  5591. @end table
  5592. @subsection Examples
  5593. @itemize
  5594. @item
  5595. Extract luma, u and v color channel component from input video frame
  5596. into 3 grayscale outputs:
  5597. @example
  5598. 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
  5599. @end example
  5600. @end itemize
  5601. @section elbg
  5602. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5603. For each input image, the filter will compute the optimal mapping from
  5604. the input to the output given the codebook length, that is the number
  5605. of distinct output colors.
  5606. This filter accepts the following options.
  5607. @table @option
  5608. @item codebook_length, l
  5609. Set codebook length. The value must be a positive integer, and
  5610. represents the number of distinct output colors. Default value is 256.
  5611. @item nb_steps, n
  5612. Set the maximum number of iterations to apply for computing the optimal
  5613. mapping. The higher the value the better the result and the higher the
  5614. computation time. Default value is 1.
  5615. @item seed, s
  5616. Set a random seed, must be an integer included between 0 and
  5617. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5618. will try to use a good random seed on a best effort basis.
  5619. @item pal8
  5620. Set pal8 output pixel format. This option does not work with codebook
  5621. length greater than 256.
  5622. @end table
  5623. @section fade
  5624. Apply a fade-in/out effect to the input video.
  5625. It accepts the following parameters:
  5626. @table @option
  5627. @item type, t
  5628. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5629. effect.
  5630. Default is @code{in}.
  5631. @item start_frame, s
  5632. Specify the number of the frame to start applying the fade
  5633. effect at. Default is 0.
  5634. @item nb_frames, n
  5635. The number of frames that the fade effect lasts. At the end of the
  5636. fade-in effect, the output video will have the same intensity as the input video.
  5637. At the end of the fade-out transition, the output video will be filled with the
  5638. selected @option{color}.
  5639. Default is 25.
  5640. @item alpha
  5641. If set to 1, fade only alpha channel, if one exists on the input.
  5642. Default value is 0.
  5643. @item start_time, st
  5644. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5645. effect. If both start_frame and start_time are specified, the fade will start at
  5646. whichever comes last. Default is 0.
  5647. @item duration, d
  5648. The number of seconds for which the fade effect has to last. At the end of the
  5649. fade-in effect the output video will have the same intensity as the input video,
  5650. at the end of the fade-out transition the output video will be filled with the
  5651. selected @option{color}.
  5652. If both duration and nb_frames are specified, duration is used. Default is 0
  5653. (nb_frames is used by default).
  5654. @item color, c
  5655. Specify the color of the fade. Default is "black".
  5656. @end table
  5657. @subsection Examples
  5658. @itemize
  5659. @item
  5660. Fade in the first 30 frames of video:
  5661. @example
  5662. fade=in:0:30
  5663. @end example
  5664. The command above is equivalent to:
  5665. @example
  5666. fade=t=in:s=0:n=30
  5667. @end example
  5668. @item
  5669. Fade out the last 45 frames of a 200-frame video:
  5670. @example
  5671. fade=out:155:45
  5672. fade=type=out:start_frame=155:nb_frames=45
  5673. @end example
  5674. @item
  5675. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5676. @example
  5677. fade=in:0:25, fade=out:975:25
  5678. @end example
  5679. @item
  5680. Make the first 5 frames yellow, then fade in from frame 5-24:
  5681. @example
  5682. fade=in:5:20:color=yellow
  5683. @end example
  5684. @item
  5685. Fade in alpha over first 25 frames of video:
  5686. @example
  5687. fade=in:0:25:alpha=1
  5688. @end example
  5689. @item
  5690. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5691. @example
  5692. fade=t=in:st=5.5:d=0.5
  5693. @end example
  5694. @end itemize
  5695. @section fftfilt
  5696. Apply arbitrary expressions to samples in frequency domain
  5697. @table @option
  5698. @item dc_Y
  5699. Adjust the dc value (gain) of the luma plane of the image. The filter
  5700. accepts an integer value in range @code{0} to @code{1000}. The default
  5701. value is set to @code{0}.
  5702. @item dc_U
  5703. Adjust the dc value (gain) of the 1st 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 dc_V
  5707. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5708. filter accepts an integer value in range @code{0} to @code{1000}. The
  5709. default value is set to @code{0}.
  5710. @item weight_Y
  5711. Set the frequency domain weight expression for the luma plane.
  5712. @item weight_U
  5713. Set the frequency domain weight expression for the 1st chroma plane.
  5714. @item weight_V
  5715. Set the frequency domain weight expression for the 2nd chroma plane.
  5716. The filter accepts the following variables:
  5717. @item X
  5718. @item Y
  5719. The coordinates of the current sample.
  5720. @item W
  5721. @item H
  5722. The width and height of the image.
  5723. @end table
  5724. @subsection Examples
  5725. @itemize
  5726. @item
  5727. High-pass:
  5728. @example
  5729. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5730. @end example
  5731. @item
  5732. Low-pass:
  5733. @example
  5734. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5735. @end example
  5736. @item
  5737. Sharpen:
  5738. @example
  5739. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5740. @end example
  5741. @item
  5742. Blur:
  5743. @example
  5744. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5745. @end example
  5746. @end itemize
  5747. @section field
  5748. Extract a single field from an interlaced image using stride
  5749. arithmetic to avoid wasting CPU time. The output frames are marked as
  5750. non-interlaced.
  5751. The filter accepts the following options:
  5752. @table @option
  5753. @item type
  5754. Specify whether to extract the top (if the value is @code{0} or
  5755. @code{top}) or the bottom field (if the value is @code{1} or
  5756. @code{bottom}).
  5757. @end table
  5758. @section fieldhint
  5759. Create new frames by copying the top and bottom fields from surrounding frames
  5760. supplied as numbers by the hint file.
  5761. @table @option
  5762. @item hint
  5763. Set file containing hints: absolute/relative frame numbers.
  5764. There must be one line for each frame in a clip. Each line must contain two
  5765. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5766. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5767. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5768. for @code{relative} mode. First number tells from which frame to pick up top
  5769. field and second number tells from which frame to pick up bottom field.
  5770. If optionally followed by @code{+} output frame will be marked as interlaced,
  5771. else if followed by @code{-} output frame will be marked as progressive, else
  5772. it will be marked same as input frame.
  5773. If line starts with @code{#} or @code{;} that line is skipped.
  5774. @item mode
  5775. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5776. @end table
  5777. Example of first several lines of @code{hint} file for @code{relative} mode:
  5778. @example
  5779. 0,0 - # first frame
  5780. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5781. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5782. 1,0 -
  5783. 0,0 -
  5784. 0,0 -
  5785. 1,0 -
  5786. 1,0 -
  5787. 1,0 -
  5788. 0,0 -
  5789. 0,0 -
  5790. 1,0 -
  5791. 1,0 -
  5792. 1,0 -
  5793. 0,0 -
  5794. @end example
  5795. @section fieldmatch
  5796. Field matching filter for inverse telecine. It is meant to reconstruct the
  5797. progressive frames from a telecined stream. The filter does not drop duplicated
  5798. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5799. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5800. The separation of the field matching and the decimation is notably motivated by
  5801. the possibility of inserting a de-interlacing filter fallback between the two.
  5802. If the source has mixed telecined and real interlaced content,
  5803. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5804. But these remaining combed frames will be marked as interlaced, and thus can be
  5805. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5806. In addition to the various configuration options, @code{fieldmatch} can take an
  5807. optional second stream, activated through the @option{ppsrc} option. If
  5808. enabled, the frames reconstruction will be based on the fields and frames from
  5809. this second stream. This allows the first input to be pre-processed in order to
  5810. help the various algorithms of the filter, while keeping the output lossless
  5811. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5812. or brightness/contrast adjustments can help.
  5813. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5814. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5815. which @code{fieldmatch} is based on. While the semantic and usage are very
  5816. close, some behaviour and options names can differ.
  5817. The @ref{decimate} filter currently only works for constant frame rate input.
  5818. If your input has mixed telecined (30fps) and progressive content with a lower
  5819. framerate like 24fps use the following filterchain to produce the necessary cfr
  5820. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5821. The filter accepts the following options:
  5822. @table @option
  5823. @item order
  5824. Specify the assumed field order of the input stream. Available values are:
  5825. @table @samp
  5826. @item auto
  5827. Auto detect parity (use FFmpeg's internal parity value).
  5828. @item bff
  5829. Assume bottom field first.
  5830. @item tff
  5831. Assume top field first.
  5832. @end table
  5833. Note that it is sometimes recommended not to trust the parity announced by the
  5834. stream.
  5835. Default value is @var{auto}.
  5836. @item mode
  5837. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5838. sense that it won't risk creating jerkiness due to duplicate frames when
  5839. possible, but if there are bad edits or blended fields it will end up
  5840. outputting combed frames when a good match might actually exist. On the other
  5841. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5842. but will almost always find a good frame if there is one. The other values are
  5843. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5844. jerkiness and creating duplicate frames versus finding good matches in sections
  5845. with bad edits, orphaned fields, blended fields, etc.
  5846. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5847. Available values are:
  5848. @table @samp
  5849. @item pc
  5850. 2-way matching (p/c)
  5851. @item pc_n
  5852. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5853. @item pc_u
  5854. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5855. @item pc_n_ub
  5856. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5857. still combed (p/c + n + u/b)
  5858. @item pcn
  5859. 3-way matching (p/c/n)
  5860. @item pcn_ub
  5861. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5862. detected as combed (p/c/n + u/b)
  5863. @end table
  5864. The parenthesis at the end indicate the matches that would be used for that
  5865. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5866. @var{top}).
  5867. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5868. the slowest.
  5869. Default value is @var{pc_n}.
  5870. @item ppsrc
  5871. Mark the main input stream as a pre-processed input, and enable the secondary
  5872. input stream as the clean source to pick the fields from. See the filter
  5873. introduction for more details. It is similar to the @option{clip2} feature from
  5874. VFM/TFM.
  5875. Default value is @code{0} (disabled).
  5876. @item field
  5877. Set the field to match from. It is recommended to set this to the same value as
  5878. @option{order} unless you experience matching failures with that setting. In
  5879. certain circumstances changing the field that is used to match from can have a
  5880. large impact on matching performance. Available values are:
  5881. @table @samp
  5882. @item auto
  5883. Automatic (same value as @option{order}).
  5884. @item bottom
  5885. Match from the bottom field.
  5886. @item top
  5887. Match from the top field.
  5888. @end table
  5889. Default value is @var{auto}.
  5890. @item mchroma
  5891. Set whether or not chroma is included during the match comparisons. In most
  5892. cases it is recommended to leave this enabled. You should set this to @code{0}
  5893. only if your clip has bad chroma problems such as heavy rainbowing or other
  5894. artifacts. Setting this to @code{0} could also be used to speed things up at
  5895. the cost of some accuracy.
  5896. Default value is @code{1}.
  5897. @item y0
  5898. @item y1
  5899. These define an exclusion band which excludes the lines between @option{y0} and
  5900. @option{y1} from being included in the field matching decision. An exclusion
  5901. band can be used to ignore subtitles, a logo, or other things that may
  5902. interfere with the matching. @option{y0} sets the starting scan line and
  5903. @option{y1} sets the ending line; all lines in between @option{y0} and
  5904. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5905. @option{y0} and @option{y1} to the same value will disable the feature.
  5906. @option{y0} and @option{y1} defaults to @code{0}.
  5907. @item scthresh
  5908. Set the scene change detection threshold as a percentage of maximum change on
  5909. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5910. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5911. @option{scthresh} is @code{[0.0, 100.0]}.
  5912. Default value is @code{12.0}.
  5913. @item combmatch
  5914. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5915. account the combed scores of matches when deciding what match to use as the
  5916. final match. Available values are:
  5917. @table @samp
  5918. @item none
  5919. No final matching based on combed scores.
  5920. @item sc
  5921. Combed scores are only used when a scene change is detected.
  5922. @item full
  5923. Use combed scores all the time.
  5924. @end table
  5925. Default is @var{sc}.
  5926. @item combdbg
  5927. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5928. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5929. Available values are:
  5930. @table @samp
  5931. @item none
  5932. No forced calculation.
  5933. @item pcn
  5934. Force p/c/n calculations.
  5935. @item pcnub
  5936. Force p/c/n/u/b calculations.
  5937. @end table
  5938. Default value is @var{none}.
  5939. @item cthresh
  5940. This is the area combing threshold used for combed frame detection. This
  5941. essentially controls how "strong" or "visible" combing must be to be detected.
  5942. Larger values mean combing must be more visible and smaller values mean combing
  5943. can be less visible or strong and still be detected. Valid settings are from
  5944. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5945. be detected as combed). This is basically a pixel difference value. A good
  5946. range is @code{[8, 12]}.
  5947. Default value is @code{9}.
  5948. @item chroma
  5949. Sets whether or not chroma is considered in the combed frame decision. Only
  5950. disable this if your source has chroma problems (rainbowing, etc.) that are
  5951. causing problems for the combed frame detection with chroma enabled. Actually,
  5952. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5953. where there is chroma only combing in the source.
  5954. Default value is @code{0}.
  5955. @item blockx
  5956. @item blocky
  5957. Respectively set the x-axis and y-axis size of the window used during combed
  5958. frame detection. This has to do with the size of the area in which
  5959. @option{combpel} pixels are required to be detected as combed for a frame to be
  5960. declared combed. See the @option{combpel} parameter description for more info.
  5961. Possible values are any number that is a power of 2 starting at 4 and going up
  5962. to 512.
  5963. Default value is @code{16}.
  5964. @item combpel
  5965. The number of combed pixels inside any of the @option{blocky} by
  5966. @option{blockx} size blocks on the frame for the frame to be detected as
  5967. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5968. setting controls "how much" combing there must be in any localized area (a
  5969. window defined by the @option{blockx} and @option{blocky} settings) on the
  5970. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5971. which point no frames will ever be detected as combed). This setting is known
  5972. as @option{MI} in TFM/VFM vocabulary.
  5973. Default value is @code{80}.
  5974. @end table
  5975. @anchor{p/c/n/u/b meaning}
  5976. @subsection p/c/n/u/b meaning
  5977. @subsubsection p/c/n
  5978. We assume the following telecined stream:
  5979. @example
  5980. Top fields: 1 2 2 3 4
  5981. Bottom fields: 1 2 3 4 4
  5982. @end example
  5983. The numbers correspond to the progressive frame the fields relate to. Here, the
  5984. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5985. When @code{fieldmatch} is configured to run a matching from bottom
  5986. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5987. @example
  5988. Input stream:
  5989. T 1 2 2 3 4
  5990. B 1 2 3 4 4 <-- matching reference
  5991. Matches: c c n n c
  5992. Output stream:
  5993. T 1 2 3 4 4
  5994. B 1 2 3 4 4
  5995. @end example
  5996. As a result of the field matching, we can see that some frames get duplicated.
  5997. To perform a complete inverse telecine, you need to rely on a decimation filter
  5998. after this operation. See for instance the @ref{decimate} filter.
  5999. The same operation now matching from top fields (@option{field}=@var{top})
  6000. looks like this:
  6001. @example
  6002. Input stream:
  6003. T 1 2 2 3 4 <-- matching reference
  6004. B 1 2 3 4 4
  6005. Matches: c c p p c
  6006. Output stream:
  6007. T 1 2 2 3 4
  6008. B 1 2 2 3 4
  6009. @end example
  6010. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6011. basically, they refer to the frame and field of the opposite parity:
  6012. @itemize
  6013. @item @var{p} matches the field of the opposite parity in the previous frame
  6014. @item @var{c} matches the field of the opposite parity in the current frame
  6015. @item @var{n} matches the field of the opposite parity in the next frame
  6016. @end itemize
  6017. @subsubsection u/b
  6018. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6019. from the opposite parity flag. In the following examples, we assume that we are
  6020. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6021. 'x' is placed above and below each matched fields.
  6022. With bottom matching (@option{field}=@var{bottom}):
  6023. @example
  6024. Match: c p n b u
  6025. x x x x x
  6026. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6027. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6028. x x x x x
  6029. Output frames:
  6030. 2 1 2 2 2
  6031. 2 2 2 1 3
  6032. @end example
  6033. With top matching (@option{field}=@var{top}):
  6034. @example
  6035. Match: c p n b u
  6036. x x x x x
  6037. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6038. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6039. x x x x x
  6040. Output frames:
  6041. 2 2 2 1 2
  6042. 2 1 3 2 2
  6043. @end example
  6044. @subsection Examples
  6045. Simple IVTC of a top field first telecined stream:
  6046. @example
  6047. fieldmatch=order=tff:combmatch=none, decimate
  6048. @end example
  6049. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6050. @example
  6051. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6052. @end example
  6053. @section fieldorder
  6054. Transform the field order of the input video.
  6055. It accepts the following parameters:
  6056. @table @option
  6057. @item order
  6058. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6059. for bottom field first.
  6060. @end table
  6061. The default value is @samp{tff}.
  6062. The transformation is done by shifting the picture content up or down
  6063. by one line, and filling the remaining line with appropriate picture content.
  6064. This method is consistent with most broadcast field order converters.
  6065. If the input video is not flagged as being interlaced, or it is already
  6066. flagged as being of the required output field order, then this filter does
  6067. not alter the incoming video.
  6068. It is very useful when converting to or from PAL DV material,
  6069. which is bottom field first.
  6070. For example:
  6071. @example
  6072. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6073. @end example
  6074. @section fifo, afifo
  6075. Buffer input images and send them when they are requested.
  6076. It is mainly useful when auto-inserted by the libavfilter
  6077. framework.
  6078. It does not take parameters.
  6079. @section find_rect
  6080. Find a rectangular object
  6081. It accepts the following options:
  6082. @table @option
  6083. @item object
  6084. Filepath of the object image, needs to be in gray8.
  6085. @item threshold
  6086. Detection threshold, default is 0.5.
  6087. @item mipmaps
  6088. Number of mipmaps, default is 3.
  6089. @item xmin, ymin, xmax, ymax
  6090. Specifies the rectangle in which to search.
  6091. @end table
  6092. @subsection Examples
  6093. @itemize
  6094. @item
  6095. Generate a representative palette of a given video using @command{ffmpeg}:
  6096. @example
  6097. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6098. @end example
  6099. @end itemize
  6100. @section cover_rect
  6101. Cover a rectangular object
  6102. It accepts the following options:
  6103. @table @option
  6104. @item cover
  6105. Filepath of the optional cover image, needs to be in yuv420.
  6106. @item mode
  6107. Set covering mode.
  6108. It accepts the following values:
  6109. @table @samp
  6110. @item cover
  6111. cover it by the supplied image
  6112. @item blur
  6113. cover it by interpolating the surrounding pixels
  6114. @end table
  6115. Default value is @var{blur}.
  6116. @end table
  6117. @subsection Examples
  6118. @itemize
  6119. @item
  6120. Generate a representative palette of a given video using @command{ffmpeg}:
  6121. @example
  6122. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6123. @end example
  6124. @end itemize
  6125. @anchor{format}
  6126. @section format
  6127. Convert the input video to one of the specified pixel formats.
  6128. Libavfilter will try to pick one that is suitable as input to
  6129. the next filter.
  6130. It accepts the following parameters:
  6131. @table @option
  6132. @item pix_fmts
  6133. A '|'-separated list of pixel format names, such as
  6134. "pix_fmts=yuv420p|monow|rgb24".
  6135. @end table
  6136. @subsection Examples
  6137. @itemize
  6138. @item
  6139. Convert the input video to the @var{yuv420p} format
  6140. @example
  6141. format=pix_fmts=yuv420p
  6142. @end example
  6143. Convert the input video to any of the formats in the list
  6144. @example
  6145. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6146. @end example
  6147. @end itemize
  6148. @anchor{fps}
  6149. @section fps
  6150. Convert the video to specified constant frame rate by duplicating or dropping
  6151. frames as necessary.
  6152. It accepts the following parameters:
  6153. @table @option
  6154. @item fps
  6155. The desired output frame rate. The default is @code{25}.
  6156. @item round
  6157. Rounding method.
  6158. Possible values are:
  6159. @table @option
  6160. @item zero
  6161. zero round towards 0
  6162. @item inf
  6163. round away from 0
  6164. @item down
  6165. round towards -infinity
  6166. @item up
  6167. round towards +infinity
  6168. @item near
  6169. round to nearest
  6170. @end table
  6171. The default is @code{near}.
  6172. @item start_time
  6173. Assume the first PTS should be the given value, in seconds. This allows for
  6174. padding/trimming at the start of stream. By default, no assumption is made
  6175. about the first frame's expected PTS, so no padding or trimming is done.
  6176. For example, this could be set to 0 to pad the beginning with duplicates of
  6177. the first frame if a video stream starts after the audio stream or to trim any
  6178. frames with a negative PTS.
  6179. @end table
  6180. Alternatively, the options can be specified as a flat string:
  6181. @var{fps}[:@var{round}].
  6182. See also the @ref{setpts} filter.
  6183. @subsection Examples
  6184. @itemize
  6185. @item
  6186. A typical usage in order to set the fps to 25:
  6187. @example
  6188. fps=fps=25
  6189. @end example
  6190. @item
  6191. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6192. @example
  6193. fps=fps=film:round=near
  6194. @end example
  6195. @end itemize
  6196. @section framepack
  6197. Pack two different video streams into a stereoscopic video, setting proper
  6198. metadata on supported codecs. The two views should have the same size and
  6199. framerate and processing will stop when the shorter video ends. Please note
  6200. that you may conveniently adjust view properties with the @ref{scale} and
  6201. @ref{fps} filters.
  6202. It accepts the following parameters:
  6203. @table @option
  6204. @item format
  6205. The desired packing format. Supported values are:
  6206. @table @option
  6207. @item sbs
  6208. The views are next to each other (default).
  6209. @item tab
  6210. The views are on top of each other.
  6211. @item lines
  6212. The views are packed by line.
  6213. @item columns
  6214. The views are packed by column.
  6215. @item frameseq
  6216. The views are temporally interleaved.
  6217. @end table
  6218. @end table
  6219. Some examples:
  6220. @example
  6221. # Convert left and right views into a frame-sequential video
  6222. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6223. # Convert views into a side-by-side video with the same output resolution as the input
  6224. 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
  6225. @end example
  6226. @section framerate
  6227. Change the frame rate by interpolating new video output frames from the source
  6228. frames.
  6229. This filter is not designed to function correctly with interlaced media. If
  6230. you wish to change the frame rate of interlaced media then you are required
  6231. to deinterlace before this filter and re-interlace after this filter.
  6232. A description of the accepted options follows.
  6233. @table @option
  6234. @item fps
  6235. Specify the output frames per second. This option can also be specified
  6236. as a value alone. The default is @code{50}.
  6237. @item interp_start
  6238. Specify the start 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{15}.
  6241. @item interp_end
  6242. Specify the end of a range where the output frame will be created as a
  6243. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6244. the default is @code{240}.
  6245. @item scene
  6246. Specify the level at which a scene change is detected as a value between
  6247. 0 and 100 to indicate a new scene; a low value reflects a low
  6248. probability for the current frame to introduce a new scene, while a higher
  6249. value means the current frame is more likely to be one.
  6250. The default is @code{7}.
  6251. @item flags
  6252. Specify flags influencing the filter process.
  6253. Available value for @var{flags} is:
  6254. @table @option
  6255. @item scene_change_detect, scd
  6256. Enable scene change detection using the value of the option @var{scene}.
  6257. This flag is enabled by default.
  6258. @end table
  6259. @end table
  6260. @section framestep
  6261. Select one frame every N-th frame.
  6262. This filter accepts the following option:
  6263. @table @option
  6264. @item step
  6265. Select frame after every @code{step} frames.
  6266. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6267. @end table
  6268. @anchor{frei0r}
  6269. @section frei0r
  6270. Apply a frei0r effect to the input video.
  6271. To enable the compilation of this filter, you need to install the frei0r
  6272. header and configure FFmpeg with @code{--enable-frei0r}.
  6273. It accepts the following parameters:
  6274. @table @option
  6275. @item filter_name
  6276. The name of the frei0r effect to load. If the environment variable
  6277. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6278. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6279. Otherwise, the standard frei0r paths are searched, in this order:
  6280. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6281. @file{/usr/lib/frei0r-1/}.
  6282. @item filter_params
  6283. A '|'-separated list of parameters to pass to the frei0r effect.
  6284. @end table
  6285. A frei0r effect parameter can be a boolean (its value is either
  6286. "y" or "n"), a double, a color (specified as
  6287. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6288. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6289. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6290. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6291. The number and types of parameters depend on the loaded effect. If an
  6292. effect parameter is not specified, the default value is set.
  6293. @subsection Examples
  6294. @itemize
  6295. @item
  6296. Apply the distort0r effect, setting the first two double parameters:
  6297. @example
  6298. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6299. @end example
  6300. @item
  6301. Apply the colordistance effect, taking a color as the first parameter:
  6302. @example
  6303. frei0r=colordistance:0.2/0.3/0.4
  6304. frei0r=colordistance:violet
  6305. frei0r=colordistance:0x112233
  6306. @end example
  6307. @item
  6308. Apply the perspective effect, specifying the top left and top right image
  6309. positions:
  6310. @example
  6311. frei0r=perspective:0.2/0.2|0.8/0.2
  6312. @end example
  6313. @end itemize
  6314. For more information, see
  6315. @url{http://frei0r.dyne.org}
  6316. @section fspp
  6317. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6318. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6319. processing filter, one of them is performed once per block, not per pixel.
  6320. This allows for much higher speed.
  6321. The filter accepts the following options:
  6322. @table @option
  6323. @item quality
  6324. Set quality. This option defines the number of levels for averaging. It accepts
  6325. an integer in the range 4-5. Default value is @code{4}.
  6326. @item qp
  6327. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6328. If not set, the filter will use the QP from the video stream (if available).
  6329. @item strength
  6330. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6331. more details but also more artifacts, while higher values make the image smoother
  6332. but also blurrier. Default value is @code{0} − PSNR optimal.
  6333. @item use_bframe_qp
  6334. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6335. option may cause flicker since the B-Frames have often larger QP. Default is
  6336. @code{0} (not enabled).
  6337. @end table
  6338. @section geq
  6339. The filter accepts the following options:
  6340. @table @option
  6341. @item lum_expr, lum
  6342. Set the luminance expression.
  6343. @item cb_expr, cb
  6344. Set the chrominance blue expression.
  6345. @item cr_expr, cr
  6346. Set the chrominance red expression.
  6347. @item alpha_expr, a
  6348. Set the alpha expression.
  6349. @item red_expr, r
  6350. Set the red expression.
  6351. @item green_expr, g
  6352. Set the green expression.
  6353. @item blue_expr, b
  6354. Set the blue expression.
  6355. @end table
  6356. The colorspace is selected according to the specified options. If one
  6357. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6358. options is specified, the filter will automatically select a YCbCr
  6359. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6360. @option{blue_expr} options is specified, it will select an RGB
  6361. colorspace.
  6362. If one of the chrominance expression is not defined, it falls back on the other
  6363. one. If no alpha expression is specified it will evaluate to opaque value.
  6364. If none of chrominance expressions are specified, they will evaluate
  6365. to the luminance expression.
  6366. The expressions can use the following variables and functions:
  6367. @table @option
  6368. @item N
  6369. The sequential number of the filtered frame, starting from @code{0}.
  6370. @item X
  6371. @item Y
  6372. The coordinates of the current sample.
  6373. @item W
  6374. @item H
  6375. The width and height of the image.
  6376. @item SW
  6377. @item SH
  6378. Width and height scale depending on the currently filtered plane. It is the
  6379. ratio between the corresponding luma plane number of pixels and the current
  6380. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6381. @code{0.5,0.5} for chroma planes.
  6382. @item T
  6383. Time of the current frame, expressed in seconds.
  6384. @item p(x, y)
  6385. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6386. plane.
  6387. @item lum(x, y)
  6388. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6389. plane.
  6390. @item cb(x, y)
  6391. Return the value of the pixel at location (@var{x},@var{y}) of the
  6392. blue-difference chroma plane. Return 0 if there is no such plane.
  6393. @item cr(x, y)
  6394. Return the value of the pixel at location (@var{x},@var{y}) of the
  6395. red-difference chroma plane. Return 0 if there is no such plane.
  6396. @item r(x, y)
  6397. @item g(x, y)
  6398. @item b(x, y)
  6399. Return the value of the pixel at location (@var{x},@var{y}) of the
  6400. red/green/blue component. Return 0 if there is no such component.
  6401. @item alpha(x, y)
  6402. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6403. plane. Return 0 if there is no such plane.
  6404. @end table
  6405. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6406. automatically clipped to the closer edge.
  6407. @subsection Examples
  6408. @itemize
  6409. @item
  6410. Flip the image horizontally:
  6411. @example
  6412. geq=p(W-X\,Y)
  6413. @end example
  6414. @item
  6415. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6416. wavelength of 100 pixels:
  6417. @example
  6418. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6419. @end example
  6420. @item
  6421. Generate a fancy enigmatic moving light:
  6422. @example
  6423. 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
  6424. @end example
  6425. @item
  6426. Generate a quick emboss effect:
  6427. @example
  6428. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6429. @end example
  6430. @item
  6431. Modify RGB components depending on pixel position:
  6432. @example
  6433. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6434. @end example
  6435. @item
  6436. Create a radial gradient that is the same size as the input (also see
  6437. the @ref{vignette} filter):
  6438. @example
  6439. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6440. @end example
  6441. @end itemize
  6442. @section gradfun
  6443. Fix the banding artifacts that are sometimes introduced into nearly flat
  6444. regions by truncation to 8-bit color depth.
  6445. Interpolate the gradients that should go where the bands are, and
  6446. dither them.
  6447. It is designed for playback only. Do not use it prior to
  6448. lossy compression, because compression tends to lose the dither and
  6449. bring back the bands.
  6450. It accepts the following parameters:
  6451. @table @option
  6452. @item strength
  6453. The maximum amount by which the filter will change any one pixel. This is also
  6454. the threshold for detecting nearly flat regions. Acceptable values range from
  6455. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6456. valid range.
  6457. @item radius
  6458. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6459. gradients, but also prevents the filter from modifying the pixels near detailed
  6460. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6461. values will be clipped to the valid range.
  6462. @end table
  6463. Alternatively, the options can be specified as a flat string:
  6464. @var{strength}[:@var{radius}]
  6465. @subsection Examples
  6466. @itemize
  6467. @item
  6468. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6469. @example
  6470. gradfun=3.5:8
  6471. @end example
  6472. @item
  6473. Specify radius, omitting the strength (which will fall-back to the default
  6474. value):
  6475. @example
  6476. gradfun=radius=8
  6477. @end example
  6478. @end itemize
  6479. @anchor{haldclut}
  6480. @section haldclut
  6481. Apply a Hald CLUT to a video stream.
  6482. First input is the video stream to process, and second one is the Hald CLUT.
  6483. The Hald CLUT input can be a simple picture or a complete video stream.
  6484. The filter accepts the following options:
  6485. @table @option
  6486. @item shortest
  6487. Force termination when the shortest input terminates. Default is @code{0}.
  6488. @item repeatlast
  6489. Continue applying the last CLUT after the end of the stream. A value of
  6490. @code{0} disable the filter after the last frame of the CLUT is reached.
  6491. Default is @code{1}.
  6492. @end table
  6493. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6494. filters share the same internals).
  6495. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6496. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6497. @subsection Workflow examples
  6498. @subsubsection Hald CLUT video stream
  6499. Generate an identity Hald CLUT stream altered with various effects:
  6500. @example
  6501. 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
  6502. @end example
  6503. Note: make sure you use a lossless codec.
  6504. Then use it with @code{haldclut} to apply it on some random stream:
  6505. @example
  6506. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6507. @end example
  6508. The Hald CLUT will be applied to the 10 first seconds (duration of
  6509. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6510. to the remaining frames of the @code{mandelbrot} stream.
  6511. @subsubsection Hald CLUT with preview
  6512. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6513. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6514. biggest possible square starting at the top left of the picture. The remaining
  6515. padding pixels (bottom or right) will be ignored. This area can be used to add
  6516. a preview of the Hald CLUT.
  6517. Typically, the following generated Hald CLUT will be supported by the
  6518. @code{haldclut} filter:
  6519. @example
  6520. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6521. pad=iw+320 [padded_clut];
  6522. smptebars=s=320x256, split [a][b];
  6523. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6524. [main][b] overlay=W-320" -frames:v 1 clut.png
  6525. @end example
  6526. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6527. bars are displayed on the right-top, and below the same color bars processed by
  6528. the color changes.
  6529. Then, the effect of this Hald CLUT can be visualized with:
  6530. @example
  6531. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6532. @end example
  6533. @section hflip
  6534. Flip the input video horizontally.
  6535. For example, to horizontally flip the input video with @command{ffmpeg}:
  6536. @example
  6537. ffmpeg -i in.avi -vf "hflip" out.avi
  6538. @end example
  6539. @section histeq
  6540. This filter applies a global color histogram equalization on a
  6541. per-frame basis.
  6542. It can be used to correct video that has a compressed range of pixel
  6543. intensities. The filter redistributes the pixel intensities to
  6544. equalize their distribution across the intensity range. It may be
  6545. viewed as an "automatically adjusting contrast filter". This filter is
  6546. useful only for correcting degraded or poorly captured source
  6547. video.
  6548. The filter accepts the following options:
  6549. @table @option
  6550. @item strength
  6551. Determine the amount of equalization to be applied. As the strength
  6552. is reduced, the distribution of pixel intensities more-and-more
  6553. approaches that of the input frame. The value must be a float number
  6554. in the range [0,1] and defaults to 0.200.
  6555. @item intensity
  6556. Set the maximum intensity that can generated and scale the output
  6557. values appropriately. The strength should be set as desired and then
  6558. the intensity can be limited if needed to avoid washing-out. The value
  6559. must be a float number in the range [0,1] and defaults to 0.210.
  6560. @item antibanding
  6561. Set the antibanding level. If enabled the filter will randomly vary
  6562. the luminance of output pixels by a small amount to avoid banding of
  6563. the histogram. Possible values are @code{none}, @code{weak} or
  6564. @code{strong}. It defaults to @code{none}.
  6565. @end table
  6566. @section histogram
  6567. Compute and draw a color distribution histogram for the input video.
  6568. The computed histogram is a representation of the color component
  6569. distribution in an image.
  6570. Standard histogram displays the color components distribution in an image.
  6571. Displays color graph for each color component. Shows distribution of
  6572. the Y, U, V, A or R, G, B components, depending on input format, in the
  6573. current frame. Below each graph a color component scale meter is shown.
  6574. The filter accepts the following options:
  6575. @table @option
  6576. @item level_height
  6577. Set height of level. Default value is @code{200}.
  6578. Allowed range is [50, 2048].
  6579. @item scale_height
  6580. Set height of color scale. Default value is @code{12}.
  6581. Allowed range is [0, 40].
  6582. @item display_mode
  6583. Set display mode.
  6584. It accepts the following values:
  6585. @table @samp
  6586. @item parade
  6587. Per color component graphs are placed below each other.
  6588. @item overlay
  6589. Presents information identical to that in the @code{parade}, except
  6590. that the graphs representing color components are superimposed directly
  6591. over one another.
  6592. @end table
  6593. Default is @code{parade}.
  6594. @item levels_mode
  6595. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6596. Default is @code{linear}.
  6597. @item components
  6598. Set what color components to display.
  6599. Default is @code{7}.
  6600. @item fgopacity
  6601. Set foreground opacity. Default is @code{0.7}.
  6602. @item bgopacity
  6603. Set background opacity. Default is @code{0.5}.
  6604. @end table
  6605. @subsection Examples
  6606. @itemize
  6607. @item
  6608. Calculate and draw histogram:
  6609. @example
  6610. ffplay -i input -vf histogram
  6611. @end example
  6612. @end itemize
  6613. @anchor{hqdn3d}
  6614. @section hqdn3d
  6615. This is a high precision/quality 3d denoise filter. It aims to reduce
  6616. image noise, producing smooth images and making still images really
  6617. still. It should enhance compressibility.
  6618. It accepts the following optional parameters:
  6619. @table @option
  6620. @item luma_spatial
  6621. A non-negative floating point number which specifies spatial luma strength.
  6622. It defaults to 4.0.
  6623. @item chroma_spatial
  6624. A non-negative floating point number which specifies spatial chroma strength.
  6625. It defaults to 3.0*@var{luma_spatial}/4.0.
  6626. @item luma_tmp
  6627. A floating point number which specifies luma temporal strength. It defaults to
  6628. 6.0*@var{luma_spatial}/4.0.
  6629. @item chroma_tmp
  6630. A floating point number which specifies chroma temporal strength. It defaults to
  6631. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6632. @end table
  6633. @anchor{hwupload_cuda}
  6634. @section hwupload_cuda
  6635. Upload system memory frames to a CUDA device.
  6636. It accepts the following optional parameters:
  6637. @table @option
  6638. @item device
  6639. The number of the CUDA device to use
  6640. @end table
  6641. @section hqx
  6642. Apply a high-quality magnification filter designed for pixel art. This filter
  6643. was originally created by Maxim Stepin.
  6644. It accepts the following option:
  6645. @table @option
  6646. @item n
  6647. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6648. @code{hq3x} and @code{4} for @code{hq4x}.
  6649. Default is @code{3}.
  6650. @end table
  6651. @section hstack
  6652. Stack input videos horizontally.
  6653. All streams must be of same pixel format and of same height.
  6654. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6655. to create same output.
  6656. The filter accept the following option:
  6657. @table @option
  6658. @item inputs
  6659. Set number of input streams. Default is 2.
  6660. @item shortest
  6661. If set to 1, force the output to terminate when the shortest input
  6662. terminates. Default value is 0.
  6663. @end table
  6664. @section hue
  6665. Modify the hue and/or the saturation of the input.
  6666. It accepts the following parameters:
  6667. @table @option
  6668. @item h
  6669. Specify the hue angle as a number of degrees. It accepts an expression,
  6670. and defaults to "0".
  6671. @item s
  6672. Specify the saturation in the [-10,10] range. It accepts an expression and
  6673. defaults to "1".
  6674. @item H
  6675. Specify the hue angle as a number of radians. It accepts an
  6676. expression, and defaults to "0".
  6677. @item b
  6678. Specify the brightness in the [-10,10] range. It accepts an expression and
  6679. defaults to "0".
  6680. @end table
  6681. @option{h} and @option{H} are mutually exclusive, and can't be
  6682. specified at the same time.
  6683. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6684. expressions containing the following constants:
  6685. @table @option
  6686. @item n
  6687. frame count of the input frame starting from 0
  6688. @item pts
  6689. presentation timestamp of the input frame expressed in time base units
  6690. @item r
  6691. frame rate of the input video, NAN if the input frame rate is unknown
  6692. @item t
  6693. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6694. @item tb
  6695. time base of the input video
  6696. @end table
  6697. @subsection Examples
  6698. @itemize
  6699. @item
  6700. Set the hue to 90 degrees and the saturation to 1.0:
  6701. @example
  6702. hue=h=90:s=1
  6703. @end example
  6704. @item
  6705. Same command but expressing the hue in radians:
  6706. @example
  6707. hue=H=PI/2:s=1
  6708. @end example
  6709. @item
  6710. Rotate hue and make the saturation swing between 0
  6711. and 2 over a period of 1 second:
  6712. @example
  6713. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6714. @end example
  6715. @item
  6716. Apply a 3 seconds saturation fade-in effect starting at 0:
  6717. @example
  6718. hue="s=min(t/3\,1)"
  6719. @end example
  6720. The general fade-in expression can be written as:
  6721. @example
  6722. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6723. @end example
  6724. @item
  6725. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6726. @example
  6727. hue="s=max(0\, min(1\, (8-t)/3))"
  6728. @end example
  6729. The general fade-out expression can be written as:
  6730. @example
  6731. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6732. @end example
  6733. @end itemize
  6734. @subsection Commands
  6735. This filter supports the following commands:
  6736. @table @option
  6737. @item b
  6738. @item s
  6739. @item h
  6740. @item H
  6741. Modify the hue and/or the saturation and/or brightness of the input video.
  6742. The command accepts the same syntax of the corresponding option.
  6743. If the specified expression is not valid, it is kept at its current
  6744. value.
  6745. @end table
  6746. @section idet
  6747. Detect video interlacing type.
  6748. This filter tries to detect if the input frames as interlaced, progressive,
  6749. top or bottom field first. It will also try and detect fields that are
  6750. repeated between adjacent frames (a sign of telecine).
  6751. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6752. Multiple frame detection incorporates the classification history of previous frames.
  6753. The filter will log these metadata values:
  6754. @table @option
  6755. @item single.current_frame
  6756. Detected type of current frame using single-frame detection. One of:
  6757. ``tff'' (top field first), ``bff'' (bottom field first),
  6758. ``progressive'', or ``undetermined''
  6759. @item single.tff
  6760. Cumulative number of frames detected as top field first using single-frame detection.
  6761. @item multiple.tff
  6762. Cumulative number of frames detected as top field first using multiple-frame detection.
  6763. @item single.bff
  6764. Cumulative number of frames detected as bottom field first using single-frame detection.
  6765. @item multiple.current_frame
  6766. Detected type of current frame using multiple-frame detection. One of:
  6767. ``tff'' (top field first), ``bff'' (bottom field first),
  6768. ``progressive'', or ``undetermined''
  6769. @item multiple.bff
  6770. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6771. @item single.progressive
  6772. Cumulative number of frames detected as progressive using single-frame detection.
  6773. @item multiple.progressive
  6774. Cumulative number of frames detected as progressive using multiple-frame detection.
  6775. @item single.undetermined
  6776. Cumulative number of frames that could not be classified using single-frame detection.
  6777. @item multiple.undetermined
  6778. Cumulative number of frames that could not be classified using multiple-frame detection.
  6779. @item repeated.current_frame
  6780. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6781. @item repeated.neither
  6782. Cumulative number of frames with no repeated field.
  6783. @item repeated.top
  6784. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6785. @item repeated.bottom
  6786. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6787. @end table
  6788. The filter accepts the following options:
  6789. @table @option
  6790. @item intl_thres
  6791. Set interlacing threshold.
  6792. @item prog_thres
  6793. Set progressive threshold.
  6794. @item rep_thres
  6795. Threshold for repeated field detection.
  6796. @item half_life
  6797. Number of frames after which a given frame's contribution to the
  6798. statistics is halved (i.e., it contributes only 0.5 to it's
  6799. classification). The default of 0 means that all frames seen are given
  6800. full weight of 1.0 forever.
  6801. @item analyze_interlaced_flag
  6802. When this is not 0 then idet will use the specified number of frames to determine
  6803. if the interlaced flag is accurate, it will not count undetermined frames.
  6804. If the flag is found to be accurate it will be used without any further
  6805. computations, if it is found to be inaccurate it will be cleared without any
  6806. further computations. This allows inserting the idet filter as a low computational
  6807. method to clean up the interlaced flag
  6808. @end table
  6809. @section il
  6810. Deinterleave or interleave fields.
  6811. This filter allows one to process interlaced images fields without
  6812. deinterlacing them. Deinterleaving splits the input frame into 2
  6813. fields (so called half pictures). Odd lines are moved to the top
  6814. half of the output image, even lines to the bottom half.
  6815. You can process (filter) them independently and then re-interleave them.
  6816. The filter accepts the following options:
  6817. @table @option
  6818. @item luma_mode, l
  6819. @item chroma_mode, c
  6820. @item alpha_mode, a
  6821. Available values for @var{luma_mode}, @var{chroma_mode} and
  6822. @var{alpha_mode} are:
  6823. @table @samp
  6824. @item none
  6825. Do nothing.
  6826. @item deinterleave, d
  6827. Deinterleave fields, placing one above the other.
  6828. @item interleave, i
  6829. Interleave fields. Reverse the effect of deinterleaving.
  6830. @end table
  6831. Default value is @code{none}.
  6832. @item luma_swap, ls
  6833. @item chroma_swap, cs
  6834. @item alpha_swap, as
  6835. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6836. @end table
  6837. @section inflate
  6838. Apply inflate effect to the video.
  6839. This filter replaces the pixel by the local(3x3) average by taking into account
  6840. only values higher than the pixel.
  6841. It accepts the following options:
  6842. @table @option
  6843. @item threshold0
  6844. @item threshold1
  6845. @item threshold2
  6846. @item threshold3
  6847. Limit the maximum change for each plane, default is 65535.
  6848. If 0, plane will remain unchanged.
  6849. @end table
  6850. @section interlace
  6851. Simple interlacing filter from progressive contents. This interleaves upper (or
  6852. lower) lines from odd frames with lower (or upper) lines from even frames,
  6853. halving the frame rate and preserving image height.
  6854. @example
  6855. Original Original New Frame
  6856. Frame 'j' Frame 'j+1' (tff)
  6857. ========== =========== ==================
  6858. Line 0 --------------------> Frame 'j' Line 0
  6859. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6860. Line 2 ---------------------> Frame 'j' Line 2
  6861. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6862. ... ... ...
  6863. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6864. @end example
  6865. It accepts the following optional parameters:
  6866. @table @option
  6867. @item scan
  6868. This determines whether the interlaced frame is taken from the even
  6869. (tff - default) or odd (bff) lines of the progressive frame.
  6870. @item lowpass
  6871. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6872. interlacing and reduce moire patterns.
  6873. @end table
  6874. @section kerndeint
  6875. Deinterlace input video by applying Donald Graft's adaptive kernel
  6876. deinterling. Work on interlaced parts of a video to produce
  6877. progressive frames.
  6878. The description of the accepted parameters follows.
  6879. @table @option
  6880. @item thresh
  6881. Set the threshold which affects the filter's tolerance when
  6882. determining if a pixel line must be processed. It must be an integer
  6883. in the range [0,255] and defaults to 10. A value of 0 will result in
  6884. applying the process on every pixels.
  6885. @item map
  6886. Paint pixels exceeding the threshold value to white if set to 1.
  6887. Default is 0.
  6888. @item order
  6889. Set the fields order. Swap fields if set to 1, leave fields alone if
  6890. 0. Default is 0.
  6891. @item sharp
  6892. Enable additional sharpening if set to 1. Default is 0.
  6893. @item twoway
  6894. Enable twoway sharpening if set to 1. Default is 0.
  6895. @end table
  6896. @subsection Examples
  6897. @itemize
  6898. @item
  6899. Apply default values:
  6900. @example
  6901. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6902. @end example
  6903. @item
  6904. Enable additional sharpening:
  6905. @example
  6906. kerndeint=sharp=1
  6907. @end example
  6908. @item
  6909. Paint processed pixels in white:
  6910. @example
  6911. kerndeint=map=1
  6912. @end example
  6913. @end itemize
  6914. @section lenscorrection
  6915. Correct radial lens distortion
  6916. This filter can be used to correct for radial distortion as can result from the use
  6917. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6918. one can use tools available for example as part of opencv or simply trial-and-error.
  6919. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6920. and extract the k1 and k2 coefficients from the resulting matrix.
  6921. Note that effectively the same filter is available in the open-source tools Krita and
  6922. Digikam from the KDE project.
  6923. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6924. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6925. brightness distribution, so you may want to use both filters together in certain
  6926. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6927. be applied before or after lens correction.
  6928. @subsection Options
  6929. The filter accepts the following options:
  6930. @table @option
  6931. @item cx
  6932. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6933. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6934. width.
  6935. @item cy
  6936. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6937. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6938. height.
  6939. @item k1
  6940. Coefficient of the quadratic correction term. 0.5 means no correction.
  6941. @item k2
  6942. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6943. @end table
  6944. The formula that generates the correction is:
  6945. @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)
  6946. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6947. distances from the focal point in the source and target images, respectively.
  6948. @section loop
  6949. Loop video frames.
  6950. The filter accepts the following options:
  6951. @table @option
  6952. @item loop
  6953. Set the number of loops.
  6954. @item size
  6955. Set maximal size in number of frames.
  6956. @item start
  6957. Set first frame of loop.
  6958. @end table
  6959. @anchor{lut3d}
  6960. @section lut3d
  6961. Apply a 3D LUT to an input video.
  6962. The filter accepts the following options:
  6963. @table @option
  6964. @item file
  6965. Set the 3D LUT file name.
  6966. Currently supported formats:
  6967. @table @samp
  6968. @item 3dl
  6969. AfterEffects
  6970. @item cube
  6971. Iridas
  6972. @item dat
  6973. DaVinci
  6974. @item m3d
  6975. Pandora
  6976. @end table
  6977. @item interp
  6978. Select interpolation mode.
  6979. Available values are:
  6980. @table @samp
  6981. @item nearest
  6982. Use values from the nearest defined point.
  6983. @item trilinear
  6984. Interpolate values using the 8 points defining a cube.
  6985. @item tetrahedral
  6986. Interpolate values using a tetrahedron.
  6987. @end table
  6988. @end table
  6989. @section lut, lutrgb, lutyuv
  6990. Compute a look-up table for binding each pixel component input value
  6991. to an output value, and apply it to the input video.
  6992. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6993. to an RGB input video.
  6994. These filters accept the following parameters:
  6995. @table @option
  6996. @item c0
  6997. set first pixel component expression
  6998. @item c1
  6999. set second pixel component expression
  7000. @item c2
  7001. set third pixel component expression
  7002. @item c3
  7003. set fourth pixel component expression, corresponds to the alpha component
  7004. @item r
  7005. set red component expression
  7006. @item g
  7007. set green component expression
  7008. @item b
  7009. set blue component expression
  7010. @item a
  7011. alpha component expression
  7012. @item y
  7013. set Y/luminance component expression
  7014. @item u
  7015. set U/Cb component expression
  7016. @item v
  7017. set V/Cr component expression
  7018. @end table
  7019. Each of them specifies the expression to use for computing the lookup table for
  7020. the corresponding pixel component values.
  7021. The exact component associated to each of the @var{c*} options depends on the
  7022. format in input.
  7023. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7024. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7025. The expressions can contain the following constants and functions:
  7026. @table @option
  7027. @item w
  7028. @item h
  7029. The input width and height.
  7030. @item val
  7031. The input value for the pixel component.
  7032. @item clipval
  7033. The input value, clipped to the @var{minval}-@var{maxval} range.
  7034. @item maxval
  7035. The maximum value for the pixel component.
  7036. @item minval
  7037. The minimum value for the pixel component.
  7038. @item negval
  7039. The negated value for the pixel component value, clipped to the
  7040. @var{minval}-@var{maxval} range; it corresponds to the expression
  7041. "maxval-clipval+minval".
  7042. @item clip(val)
  7043. The computed value in @var{val}, clipped to the
  7044. @var{minval}-@var{maxval} range.
  7045. @item gammaval(gamma)
  7046. The computed gamma correction value of the pixel component value,
  7047. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7048. expression
  7049. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7050. @end table
  7051. All expressions default to "val".
  7052. @subsection Examples
  7053. @itemize
  7054. @item
  7055. Negate input video:
  7056. @example
  7057. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7058. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7059. @end example
  7060. The above is the same as:
  7061. @example
  7062. lutrgb="r=negval:g=negval:b=negval"
  7063. lutyuv="y=negval:u=negval:v=negval"
  7064. @end example
  7065. @item
  7066. Negate luminance:
  7067. @example
  7068. lutyuv=y=negval
  7069. @end example
  7070. @item
  7071. Remove chroma components, turning the video into a graytone image:
  7072. @example
  7073. lutyuv="u=128:v=128"
  7074. @end example
  7075. @item
  7076. Apply a luma burning effect:
  7077. @example
  7078. lutyuv="y=2*val"
  7079. @end example
  7080. @item
  7081. Remove green and blue components:
  7082. @example
  7083. lutrgb="g=0:b=0"
  7084. @end example
  7085. @item
  7086. Set a constant alpha channel value on input:
  7087. @example
  7088. format=rgba,lutrgb=a="maxval-minval/2"
  7089. @end example
  7090. @item
  7091. Correct luminance gamma by a factor of 0.5:
  7092. @example
  7093. lutyuv=y=gammaval(0.5)
  7094. @end example
  7095. @item
  7096. Discard least significant bits of luma:
  7097. @example
  7098. lutyuv=y='bitand(val, 128+64+32)'
  7099. @end example
  7100. @item
  7101. Technicolor like effect:
  7102. @example
  7103. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7104. @end example
  7105. @end itemize
  7106. @section maskedmerge
  7107. Merge the first input stream with the second input stream using per pixel
  7108. weights in the third input stream.
  7109. A value of 0 in the third stream pixel component means that pixel component
  7110. from first stream is returned unchanged, while maximum value (eg. 255 for
  7111. 8-bit videos) means that pixel component from second stream is returned
  7112. unchanged. Intermediate values define the amount of merging between both
  7113. input stream's pixel components.
  7114. This filter accepts the following options:
  7115. @table @option
  7116. @item planes
  7117. Set which planes will be processed as bitmap, unprocessed planes will be
  7118. copied from first stream.
  7119. By default value 0xf, all planes will be processed.
  7120. @end table
  7121. @section mcdeint
  7122. Apply motion-compensation deinterlacing.
  7123. It needs one field per frame as input and must thus be used together
  7124. with yadif=1/3 or equivalent.
  7125. This filter accepts the following options:
  7126. @table @option
  7127. @item mode
  7128. Set the deinterlacing mode.
  7129. It accepts one of the following values:
  7130. @table @samp
  7131. @item fast
  7132. @item medium
  7133. @item slow
  7134. use iterative motion estimation
  7135. @item extra_slow
  7136. like @samp{slow}, but use multiple reference frames.
  7137. @end table
  7138. Default value is @samp{fast}.
  7139. @item parity
  7140. Set the picture field parity assumed for the input video. It must be
  7141. one of the following values:
  7142. @table @samp
  7143. @item 0, tff
  7144. assume top field first
  7145. @item 1, bff
  7146. assume bottom field first
  7147. @end table
  7148. Default value is @samp{bff}.
  7149. @item qp
  7150. Set per-block quantization parameter (QP) used by the internal
  7151. encoder.
  7152. Higher values should result in a smoother motion vector field but less
  7153. optimal individual vectors. Default value is 1.
  7154. @end table
  7155. @section mergeplanes
  7156. Merge color channel components from several video streams.
  7157. The filter accepts up to 4 input streams, and merge selected input
  7158. planes to the output video.
  7159. This filter accepts the following options:
  7160. @table @option
  7161. @item mapping
  7162. Set input to output plane mapping. Default is @code{0}.
  7163. The mappings is specified as a bitmap. It should be specified as a
  7164. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7165. mapping for the first plane of the output stream. 'A' sets the number of
  7166. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7167. corresponding input to use (from 0 to 3). The rest of the mappings is
  7168. similar, 'Bb' describes the mapping for the output stream second
  7169. plane, 'Cc' describes the mapping for the output stream third plane and
  7170. 'Dd' describes the mapping for the output stream fourth plane.
  7171. @item format
  7172. Set output pixel format. Default is @code{yuva444p}.
  7173. @end table
  7174. @subsection Examples
  7175. @itemize
  7176. @item
  7177. Merge three gray video streams of same width and height into single video stream:
  7178. @example
  7179. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7180. @end example
  7181. @item
  7182. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7183. @example
  7184. [a0][a1]mergeplanes=0x00010210:yuva444p
  7185. @end example
  7186. @item
  7187. Swap Y and A plane in yuva444p stream:
  7188. @example
  7189. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7190. @end example
  7191. @item
  7192. Swap U and V plane in yuv420p stream:
  7193. @example
  7194. format=yuv420p,mergeplanes=0x000201:yuv420p
  7195. @end example
  7196. @item
  7197. Cast a rgb24 clip to yuv444p:
  7198. @example
  7199. format=rgb24,mergeplanes=0x000102:yuv444p
  7200. @end example
  7201. @end itemize
  7202. @section mpdecimate
  7203. Drop frames that do not differ greatly from the previous frame in
  7204. order to reduce frame rate.
  7205. The main use of this filter is for very-low-bitrate encoding
  7206. (e.g. streaming over dialup modem), but it could in theory be used for
  7207. fixing movies that were inverse-telecined incorrectly.
  7208. A description of the accepted options follows.
  7209. @table @option
  7210. @item max
  7211. Set the maximum number of consecutive frames which can be dropped (if
  7212. positive), or the minimum interval between dropped frames (if
  7213. negative). If the value is 0, the frame is dropped unregarding the
  7214. number of previous sequentially dropped frames.
  7215. Default value is 0.
  7216. @item hi
  7217. @item lo
  7218. @item frac
  7219. Set the dropping threshold values.
  7220. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7221. represent actual pixel value differences, so a threshold of 64
  7222. corresponds to 1 unit of difference for each pixel, or the same spread
  7223. out differently over the block.
  7224. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7225. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7226. meaning the whole image) differ by more than a threshold of @option{lo}.
  7227. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7228. 64*5, and default value for @option{frac} is 0.33.
  7229. @end table
  7230. @section negate
  7231. Negate input video.
  7232. It accepts an integer in input; if non-zero it negates the
  7233. alpha component (if available). The default value in input is 0.
  7234. @section nnedi
  7235. Deinterlace video using neural network edge directed interpolation.
  7236. This filter accepts the following options:
  7237. @table @option
  7238. @item weights
  7239. Mandatory option, without binary file filter can not work.
  7240. Currently file can be found here:
  7241. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7242. @item deint
  7243. Set which frames to deinterlace, by default it is @code{all}.
  7244. Can be @code{all} or @code{interlaced}.
  7245. @item field
  7246. Set mode of operation.
  7247. Can be one of the following:
  7248. @table @samp
  7249. @item af
  7250. Use frame flags, both fields.
  7251. @item a
  7252. Use frame flags, single field.
  7253. @item t
  7254. Use top field only.
  7255. @item b
  7256. Use bottom field only.
  7257. @item tf
  7258. Use both fields, top first.
  7259. @item bf
  7260. Use both fields, bottom first.
  7261. @end table
  7262. @item planes
  7263. Set which planes to process, by default filter process all frames.
  7264. @item nsize
  7265. Set size of local neighborhood around each pixel, used by the predictor neural
  7266. network.
  7267. Can be one of the following:
  7268. @table @samp
  7269. @item s8x6
  7270. @item s16x6
  7271. @item s32x6
  7272. @item s48x6
  7273. @item s8x4
  7274. @item s16x4
  7275. @item s32x4
  7276. @end table
  7277. @item nns
  7278. Set the number of neurons in predicctor neural network.
  7279. Can be one of the following:
  7280. @table @samp
  7281. @item n16
  7282. @item n32
  7283. @item n64
  7284. @item n128
  7285. @item n256
  7286. @end table
  7287. @item qual
  7288. Controls the number of different neural network predictions that are blended
  7289. together to compute the final output value. Can be @code{fast}, default or
  7290. @code{slow}.
  7291. @item etype
  7292. Set which set of weights to use in the predictor.
  7293. Can be one of the following:
  7294. @table @samp
  7295. @item a
  7296. weights trained to minimize absolute error
  7297. @item s
  7298. weights trained to minimize squared error
  7299. @end table
  7300. @item pscrn
  7301. Controls whether or not the prescreener neural network is used to decide
  7302. which pixels should be processed by the predictor neural network and which
  7303. can be handled by simple cubic interpolation.
  7304. The prescreener is trained to know whether cubic interpolation will be
  7305. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7306. The computational complexity of the prescreener nn is much less than that of
  7307. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7308. using the prescreener generally results in much faster processing.
  7309. The prescreener is pretty accurate, so the difference between using it and not
  7310. using it is almost always unnoticeable.
  7311. Can be one of the following:
  7312. @table @samp
  7313. @item none
  7314. @item original
  7315. @item new
  7316. @end table
  7317. Default is @code{new}.
  7318. @item fapprox
  7319. Set various debugging flags.
  7320. @end table
  7321. @section noformat
  7322. Force libavfilter not to use any of the specified pixel formats for the
  7323. input to the next filter.
  7324. It accepts the following parameters:
  7325. @table @option
  7326. @item pix_fmts
  7327. A '|'-separated list of pixel format names, such as
  7328. apix_fmts=yuv420p|monow|rgb24".
  7329. @end table
  7330. @subsection Examples
  7331. @itemize
  7332. @item
  7333. Force libavfilter to use a format different from @var{yuv420p} for the
  7334. input to the vflip filter:
  7335. @example
  7336. noformat=pix_fmts=yuv420p,vflip
  7337. @end example
  7338. @item
  7339. Convert the input video to any of the formats not contained in the list:
  7340. @example
  7341. noformat=yuv420p|yuv444p|yuv410p
  7342. @end example
  7343. @end itemize
  7344. @section noise
  7345. Add noise on video input frame.
  7346. The filter accepts the following options:
  7347. @table @option
  7348. @item all_seed
  7349. @item c0_seed
  7350. @item c1_seed
  7351. @item c2_seed
  7352. @item c3_seed
  7353. Set noise seed for specific pixel component or all pixel components in case
  7354. of @var{all_seed}. Default value is @code{123457}.
  7355. @item all_strength, alls
  7356. @item c0_strength, c0s
  7357. @item c1_strength, c1s
  7358. @item c2_strength, c2s
  7359. @item c3_strength, c3s
  7360. Set noise strength for specific pixel component or all pixel components in case
  7361. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7362. @item all_flags, allf
  7363. @item c0_flags, c0f
  7364. @item c1_flags, c1f
  7365. @item c2_flags, c2f
  7366. @item c3_flags, c3f
  7367. Set pixel component flags or set flags for all components if @var{all_flags}.
  7368. Available values for component flags are:
  7369. @table @samp
  7370. @item a
  7371. averaged temporal noise (smoother)
  7372. @item p
  7373. mix random noise with a (semi)regular pattern
  7374. @item t
  7375. temporal noise (noise pattern changes between frames)
  7376. @item u
  7377. uniform noise (gaussian otherwise)
  7378. @end table
  7379. @end table
  7380. @subsection Examples
  7381. Add temporal and uniform noise to input video:
  7382. @example
  7383. noise=alls=20:allf=t+u
  7384. @end example
  7385. @section null
  7386. Pass the video source unchanged to the output.
  7387. @section ocr
  7388. Optical Character Recognition
  7389. This filter uses Tesseract for optical character recognition.
  7390. It accepts the following options:
  7391. @table @option
  7392. @item datapath
  7393. Set datapath to tesseract data. Default is to use whatever was
  7394. set at installation.
  7395. @item language
  7396. Set language, default is "eng".
  7397. @item whitelist
  7398. Set character whitelist.
  7399. @item blacklist
  7400. Set character blacklist.
  7401. @end table
  7402. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7403. @section ocv
  7404. Apply a video transform using libopencv.
  7405. To enable this filter, install the libopencv library and headers and
  7406. configure FFmpeg with @code{--enable-libopencv}.
  7407. It accepts the following parameters:
  7408. @table @option
  7409. @item filter_name
  7410. The name of the libopencv filter to apply.
  7411. @item filter_params
  7412. The parameters to pass to the libopencv filter. If not specified, the default
  7413. values are assumed.
  7414. @end table
  7415. Refer to the official libopencv documentation for more precise
  7416. information:
  7417. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7418. Several libopencv filters are supported; see the following subsections.
  7419. @anchor{dilate}
  7420. @subsection dilate
  7421. Dilate an image by using a specific structuring element.
  7422. It corresponds to the libopencv function @code{cvDilate}.
  7423. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7424. @var{struct_el} represents a structuring element, and has the syntax:
  7425. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7426. @var{cols} and @var{rows} represent the number of columns and rows of
  7427. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7428. point, and @var{shape} the shape for the structuring element. @var{shape}
  7429. must be "rect", "cross", "ellipse", or "custom".
  7430. If the value for @var{shape} is "custom", it must be followed by a
  7431. string of the form "=@var{filename}". The file with name
  7432. @var{filename} is assumed to represent a binary image, with each
  7433. printable character corresponding to a bright pixel. When a custom
  7434. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7435. or columns and rows of the read file are assumed instead.
  7436. The default value for @var{struct_el} is "3x3+0x0/rect".
  7437. @var{nb_iterations} specifies the number of times the transform is
  7438. applied to the image, and defaults to 1.
  7439. Some examples:
  7440. @example
  7441. # Use the default values
  7442. ocv=dilate
  7443. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7444. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7445. # Read the shape from the file diamond.shape, iterating two times.
  7446. # The file diamond.shape may contain a pattern of characters like this
  7447. # *
  7448. # ***
  7449. # *****
  7450. # ***
  7451. # *
  7452. # The specified columns and rows are ignored
  7453. # but the anchor point coordinates are not
  7454. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7455. @end example
  7456. @subsection erode
  7457. Erode an image by using a specific structuring element.
  7458. It corresponds to the libopencv function @code{cvErode}.
  7459. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7460. with the same syntax and semantics as the @ref{dilate} filter.
  7461. @subsection smooth
  7462. Smooth the input video.
  7463. The filter takes the following parameters:
  7464. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7465. @var{type} is the type of smooth filter to apply, and must be one of
  7466. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7467. or "bilateral". The default value is "gaussian".
  7468. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7469. depend on the smooth type. @var{param1} and
  7470. @var{param2} accept integer positive values or 0. @var{param3} and
  7471. @var{param4} accept floating point values.
  7472. The default value for @var{param1} is 3. The default value for the
  7473. other parameters is 0.
  7474. These parameters correspond to the parameters assigned to the
  7475. libopencv function @code{cvSmooth}.
  7476. @anchor{overlay}
  7477. @section overlay
  7478. Overlay one video on top of another.
  7479. It takes two inputs and has one output. The first input is the "main"
  7480. video on which the second input is overlaid.
  7481. It accepts the following parameters:
  7482. A description of the accepted options follows.
  7483. @table @option
  7484. @item x
  7485. @item y
  7486. Set the expression for the x and y coordinates of the overlaid video
  7487. on the main video. Default value is "0" for both expressions. In case
  7488. the expression is invalid, it is set to a huge value (meaning that the
  7489. overlay will not be displayed within the output visible area).
  7490. @item eof_action
  7491. The action to take when EOF is encountered on the secondary input; it accepts
  7492. one of the following values:
  7493. @table @option
  7494. @item repeat
  7495. Repeat the last frame (the default).
  7496. @item endall
  7497. End both streams.
  7498. @item pass
  7499. Pass the main input through.
  7500. @end table
  7501. @item eval
  7502. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7503. It accepts the following values:
  7504. @table @samp
  7505. @item init
  7506. only evaluate expressions once during the filter initialization or
  7507. when a command is processed
  7508. @item frame
  7509. evaluate expressions for each incoming frame
  7510. @end table
  7511. Default value is @samp{frame}.
  7512. @item shortest
  7513. If set to 1, force the output to terminate when the shortest input
  7514. terminates. Default value is 0.
  7515. @item format
  7516. Set the format for the output video.
  7517. It accepts the following values:
  7518. @table @samp
  7519. @item yuv420
  7520. force YUV420 output
  7521. @item yuv422
  7522. force YUV422 output
  7523. @item yuv444
  7524. force YUV444 output
  7525. @item rgb
  7526. force RGB output
  7527. @end table
  7528. Default value is @samp{yuv420}.
  7529. @item rgb @emph{(deprecated)}
  7530. If set to 1, force the filter to accept inputs in the RGB
  7531. color space. Default value is 0. This option is deprecated, use
  7532. @option{format} instead.
  7533. @item repeatlast
  7534. If set to 1, force the filter to draw the last overlay frame over the
  7535. main input until the end of the stream. A value of 0 disables this
  7536. behavior. Default value is 1.
  7537. @end table
  7538. The @option{x}, and @option{y} expressions can contain the following
  7539. parameters.
  7540. @table @option
  7541. @item main_w, W
  7542. @item main_h, H
  7543. The main input width and height.
  7544. @item overlay_w, w
  7545. @item overlay_h, h
  7546. The overlay input width and height.
  7547. @item x
  7548. @item y
  7549. The computed values for @var{x} and @var{y}. They are evaluated for
  7550. each new frame.
  7551. @item hsub
  7552. @item vsub
  7553. horizontal and vertical chroma subsample values of the output
  7554. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7555. @var{vsub} is 1.
  7556. @item n
  7557. the number of input frame, starting from 0
  7558. @item pos
  7559. the position in the file of the input frame, NAN if unknown
  7560. @item t
  7561. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7562. @end table
  7563. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7564. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7565. when @option{eval} is set to @samp{init}.
  7566. Be aware that frames are taken from each input video in timestamp
  7567. order, hence, if their initial timestamps differ, it is a good idea
  7568. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7569. have them begin in the same zero timestamp, as the example for
  7570. the @var{movie} filter does.
  7571. You can chain together more overlays but you should test the
  7572. efficiency of such approach.
  7573. @subsection Commands
  7574. This filter supports the following commands:
  7575. @table @option
  7576. @item x
  7577. @item y
  7578. Modify the x and y of the overlay input.
  7579. The command accepts the same syntax of the corresponding option.
  7580. If the specified expression is not valid, it is kept at its current
  7581. value.
  7582. @end table
  7583. @subsection Examples
  7584. @itemize
  7585. @item
  7586. Draw the overlay at 10 pixels from the bottom right corner of the main
  7587. video:
  7588. @example
  7589. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7590. @end example
  7591. Using named options the example above becomes:
  7592. @example
  7593. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7594. @end example
  7595. @item
  7596. Insert a transparent PNG logo in the bottom left corner of the input,
  7597. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7598. @example
  7599. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7600. @end example
  7601. @item
  7602. Insert 2 different transparent PNG logos (second logo on bottom
  7603. right corner) using the @command{ffmpeg} tool:
  7604. @example
  7605. 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
  7606. @end example
  7607. @item
  7608. Add a transparent color layer on top of the main video; @code{WxH}
  7609. must specify the size of the main input to the overlay filter:
  7610. @example
  7611. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7612. @end example
  7613. @item
  7614. Play an original video and a filtered version (here with the deshake
  7615. filter) side by side using the @command{ffplay} tool:
  7616. @example
  7617. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7618. @end example
  7619. The above command is the same as:
  7620. @example
  7621. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7622. @end example
  7623. @item
  7624. Make a sliding overlay appearing from the left to the right top part of the
  7625. screen starting since time 2:
  7626. @example
  7627. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7628. @end example
  7629. @item
  7630. Compose output by putting two input videos side to side:
  7631. @example
  7632. ffmpeg -i left.avi -i right.avi -filter_complex "
  7633. nullsrc=size=200x100 [background];
  7634. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7635. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7636. [background][left] overlay=shortest=1 [background+left];
  7637. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7638. "
  7639. @end example
  7640. @item
  7641. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7642. @example
  7643. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7644. -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]'
  7645. masked.avi
  7646. @end example
  7647. @item
  7648. Chain several overlays in cascade:
  7649. @example
  7650. nullsrc=s=200x200 [bg];
  7651. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7652. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7653. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7654. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7655. [in3] null, [mid2] overlay=100:100 [out0]
  7656. @end example
  7657. @end itemize
  7658. @section owdenoise
  7659. Apply Overcomplete Wavelet denoiser.
  7660. The filter accepts the following options:
  7661. @table @option
  7662. @item depth
  7663. Set depth.
  7664. Larger depth values will denoise lower frequency components more, but
  7665. slow down filtering.
  7666. Must be an int in the range 8-16, default is @code{8}.
  7667. @item luma_strength, ls
  7668. Set luma strength.
  7669. Must be a double value in the range 0-1000, default is @code{1.0}.
  7670. @item chroma_strength, cs
  7671. Set chroma strength.
  7672. Must be a double value in the range 0-1000, default is @code{1.0}.
  7673. @end table
  7674. @anchor{pad}
  7675. @section pad
  7676. Add paddings to the input image, and place the original input at the
  7677. provided @var{x}, @var{y} coordinates.
  7678. It accepts the following parameters:
  7679. @table @option
  7680. @item width, w
  7681. @item height, h
  7682. Specify an expression for the size of the output image with the
  7683. paddings added. If the value for @var{width} or @var{height} is 0, the
  7684. corresponding input size is used for the output.
  7685. The @var{width} expression can reference the value set by the
  7686. @var{height} expression, and vice versa.
  7687. The default value of @var{width} and @var{height} is 0.
  7688. @item x
  7689. @item y
  7690. Specify the offsets to place the input image at within the padded area,
  7691. with respect to the top/left border of the output image.
  7692. The @var{x} expression can reference the value set by the @var{y}
  7693. expression, and vice versa.
  7694. The default value of @var{x} and @var{y} is 0.
  7695. @item color
  7696. Specify the color of the padded area. For the syntax of this option,
  7697. check the "Color" section in the ffmpeg-utils manual.
  7698. The default value of @var{color} is "black".
  7699. @end table
  7700. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7701. options are expressions containing the following constants:
  7702. @table @option
  7703. @item in_w
  7704. @item in_h
  7705. The input video width and height.
  7706. @item iw
  7707. @item ih
  7708. These are the same as @var{in_w} and @var{in_h}.
  7709. @item out_w
  7710. @item out_h
  7711. The output width and height (the size of the padded area), as
  7712. specified by the @var{width} and @var{height} expressions.
  7713. @item ow
  7714. @item oh
  7715. These are the same as @var{out_w} and @var{out_h}.
  7716. @item x
  7717. @item y
  7718. The x and y offsets as specified by the @var{x} and @var{y}
  7719. expressions, or NAN if not yet specified.
  7720. @item a
  7721. same as @var{iw} / @var{ih}
  7722. @item sar
  7723. input sample aspect ratio
  7724. @item dar
  7725. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7726. @item hsub
  7727. @item vsub
  7728. The horizontal and vertical chroma subsample values. For example for the
  7729. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7730. @end table
  7731. @subsection Examples
  7732. @itemize
  7733. @item
  7734. Add paddings with the color "violet" to the input video. The output video
  7735. size is 640x480, and the top-left corner of the input video is placed at
  7736. column 0, row 40
  7737. @example
  7738. pad=640:480:0:40:violet
  7739. @end example
  7740. The example above is equivalent to the following command:
  7741. @example
  7742. pad=width=640:height=480:x=0:y=40:color=violet
  7743. @end example
  7744. @item
  7745. Pad the input to get an output with dimensions increased by 3/2,
  7746. and put the input video at the center of the padded area:
  7747. @example
  7748. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7749. @end example
  7750. @item
  7751. Pad the input to get a squared output with size equal to the maximum
  7752. value between the input width and height, and put the input video at
  7753. the center of the padded area:
  7754. @example
  7755. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7756. @end example
  7757. @item
  7758. Pad the input to get a final w/h ratio of 16:9:
  7759. @example
  7760. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7761. @end example
  7762. @item
  7763. In case of anamorphic video, in order to set the output display aspect
  7764. correctly, it is necessary to use @var{sar} in the expression,
  7765. according to the relation:
  7766. @example
  7767. (ih * X / ih) * sar = output_dar
  7768. X = output_dar / sar
  7769. @end example
  7770. Thus the previous example needs to be modified to:
  7771. @example
  7772. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7773. @end example
  7774. @item
  7775. Double the output size and put the input video in the bottom-right
  7776. corner of the output padded area:
  7777. @example
  7778. pad="2*iw:2*ih:ow-iw:oh-ih"
  7779. @end example
  7780. @end itemize
  7781. @anchor{palettegen}
  7782. @section palettegen
  7783. Generate one palette for a whole video stream.
  7784. It accepts the following options:
  7785. @table @option
  7786. @item max_colors
  7787. Set the maximum number of colors to quantize in the palette.
  7788. Note: the palette will still contain 256 colors; the unused palette entries
  7789. will be black.
  7790. @item reserve_transparent
  7791. Create a palette of 255 colors maximum and reserve the last one for
  7792. transparency. Reserving the transparency color is useful for GIF optimization.
  7793. If not set, the maximum of colors in the palette will be 256. You probably want
  7794. to disable this option for a standalone image.
  7795. Set by default.
  7796. @item stats_mode
  7797. Set statistics mode.
  7798. It accepts the following values:
  7799. @table @samp
  7800. @item full
  7801. Compute full frame histograms.
  7802. @item diff
  7803. Compute histograms only for the part that differs from previous frame. This
  7804. might be relevant to give more importance to the moving part of your input if
  7805. the background is static.
  7806. @end table
  7807. Default value is @var{full}.
  7808. @end table
  7809. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7810. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7811. color quantization of the palette. This information is also visible at
  7812. @var{info} logging level.
  7813. @subsection Examples
  7814. @itemize
  7815. @item
  7816. Generate a representative palette of a given video using @command{ffmpeg}:
  7817. @example
  7818. ffmpeg -i input.mkv -vf palettegen palette.png
  7819. @end example
  7820. @end itemize
  7821. @section paletteuse
  7822. Use a palette to downsample an input video stream.
  7823. The filter takes two inputs: one video stream and a palette. The palette must
  7824. be a 256 pixels image.
  7825. It accepts the following options:
  7826. @table @option
  7827. @item dither
  7828. Select dithering mode. Available algorithms are:
  7829. @table @samp
  7830. @item bayer
  7831. Ordered 8x8 bayer dithering (deterministic)
  7832. @item heckbert
  7833. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7834. Note: this dithering is sometimes considered "wrong" and is included as a
  7835. reference.
  7836. @item floyd_steinberg
  7837. Floyd and Steingberg dithering (error diffusion)
  7838. @item sierra2
  7839. Frankie Sierra dithering v2 (error diffusion)
  7840. @item sierra2_4a
  7841. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7842. @end table
  7843. Default is @var{sierra2_4a}.
  7844. @item bayer_scale
  7845. When @var{bayer} dithering is selected, this option defines the scale of the
  7846. pattern (how much the crosshatch pattern is visible). A low value means more
  7847. visible pattern for less banding, and higher value means less visible pattern
  7848. at the cost of more banding.
  7849. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7850. @item diff_mode
  7851. If set, define the zone to process
  7852. @table @samp
  7853. @item rectangle
  7854. Only the changing rectangle will be reprocessed. This is similar to GIF
  7855. cropping/offsetting compression mechanism. This option can be useful for speed
  7856. if only a part of the image is changing, and has use cases such as limiting the
  7857. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7858. moving scene (it leads to more deterministic output if the scene doesn't change
  7859. much, and as a result less moving noise and better GIF compression).
  7860. @end table
  7861. Default is @var{none}.
  7862. @end table
  7863. @subsection Examples
  7864. @itemize
  7865. @item
  7866. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7867. using @command{ffmpeg}:
  7868. @example
  7869. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7870. @end example
  7871. @end itemize
  7872. @section perspective
  7873. Correct perspective of video not recorded perpendicular to the screen.
  7874. A description of the accepted parameters follows.
  7875. @table @option
  7876. @item x0
  7877. @item y0
  7878. @item x1
  7879. @item y1
  7880. @item x2
  7881. @item y2
  7882. @item x3
  7883. @item y3
  7884. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7885. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7886. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7887. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7888. then the corners of the source will be sent to the specified coordinates.
  7889. The expressions can use the following variables:
  7890. @table @option
  7891. @item W
  7892. @item H
  7893. the width and height of video frame.
  7894. @item in
  7895. Input frame count.
  7896. @item on
  7897. Output frame count.
  7898. @end table
  7899. @item interpolation
  7900. Set interpolation for perspective correction.
  7901. It accepts the following values:
  7902. @table @samp
  7903. @item linear
  7904. @item cubic
  7905. @end table
  7906. Default value is @samp{linear}.
  7907. @item sense
  7908. Set interpretation of coordinate options.
  7909. It accepts the following values:
  7910. @table @samp
  7911. @item 0, source
  7912. Send point in the source specified by the given coordinates to
  7913. the corners of the destination.
  7914. @item 1, destination
  7915. Send the corners of the source to the point in the destination specified
  7916. by the given coordinates.
  7917. Default value is @samp{source}.
  7918. @end table
  7919. @item eval
  7920. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7921. It accepts the following values:
  7922. @table @samp
  7923. @item init
  7924. only evaluate expressions once during the filter initialization or
  7925. when a command is processed
  7926. @item frame
  7927. evaluate expressions for each incoming frame
  7928. @end table
  7929. Default value is @samp{init}.
  7930. @end table
  7931. @section phase
  7932. Delay interlaced video by one field time so that the field order changes.
  7933. The intended use is to fix PAL movies that have been captured with the
  7934. opposite field order to the film-to-video transfer.
  7935. A description of the accepted parameters follows.
  7936. @table @option
  7937. @item mode
  7938. Set phase mode.
  7939. It accepts the following values:
  7940. @table @samp
  7941. @item t
  7942. Capture field order top-first, transfer bottom-first.
  7943. Filter will delay the bottom field.
  7944. @item b
  7945. Capture field order bottom-first, transfer top-first.
  7946. Filter will delay the top field.
  7947. @item p
  7948. Capture and transfer with the same field order. This mode only exists
  7949. for the documentation of the other options to refer to, but if you
  7950. actually select it, the filter will faithfully do nothing.
  7951. @item a
  7952. Capture field order determined automatically by field flags, transfer
  7953. opposite.
  7954. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7955. basis using field flags. If no field information is available,
  7956. then this works just like @samp{u}.
  7957. @item u
  7958. Capture unknown or varying, transfer opposite.
  7959. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7960. analyzing the images and selecting the alternative that produces best
  7961. match between the fields.
  7962. @item T
  7963. Capture top-first, transfer unknown or varying.
  7964. Filter selects among @samp{t} and @samp{p} using image analysis.
  7965. @item B
  7966. Capture bottom-first, transfer unknown or varying.
  7967. Filter selects among @samp{b} and @samp{p} using image analysis.
  7968. @item A
  7969. Capture determined by field flags, transfer unknown or varying.
  7970. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7971. image analysis. If no field information is available, then this works just
  7972. like @samp{U}. This is the default mode.
  7973. @item U
  7974. Both capture and transfer unknown or varying.
  7975. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7976. @end table
  7977. @end table
  7978. @section pixdesctest
  7979. Pixel format descriptor test filter, mainly useful for internal
  7980. testing. The output video should be equal to the input video.
  7981. For example:
  7982. @example
  7983. format=monow, pixdesctest
  7984. @end example
  7985. can be used to test the monowhite pixel format descriptor definition.
  7986. @section pp
  7987. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7988. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7989. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7990. Each subfilter and some options have a short and a long name that can be used
  7991. interchangeably, i.e. dr/dering are the same.
  7992. The filters accept the following options:
  7993. @table @option
  7994. @item subfilters
  7995. Set postprocessing subfilters string.
  7996. @end table
  7997. All subfilters share common options to determine their scope:
  7998. @table @option
  7999. @item a/autoq
  8000. Honor the quality commands for this subfilter.
  8001. @item c/chrom
  8002. Do chrominance filtering, too (default).
  8003. @item y/nochrom
  8004. Do luminance filtering only (no chrominance).
  8005. @item n/noluma
  8006. Do chrominance filtering only (no luminance).
  8007. @end table
  8008. These options can be appended after the subfilter name, separated by a '|'.
  8009. Available subfilters are:
  8010. @table @option
  8011. @item hb/hdeblock[|difference[|flatness]]
  8012. Horizontal 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 vb/vdeblock[|difference[|flatness]]
  8020. Vertical 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 ha/hadeblock[|difference[|flatness]]
  8028. Accurate horizontal 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. @item va/vadeblock[|difference[|flatness]]
  8036. Accurate vertical deblocking filter
  8037. @table @option
  8038. @item difference
  8039. Difference factor where higher values mean more deblocking (default: @code{32}).
  8040. @item flatness
  8041. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8042. @end table
  8043. @end table
  8044. The horizontal and vertical deblocking filters share the difference and
  8045. flatness values so you cannot set different horizontal and vertical
  8046. thresholds.
  8047. @table @option
  8048. @item h1/x1hdeblock
  8049. Experimental horizontal deblocking filter
  8050. @item v1/x1vdeblock
  8051. Experimental vertical deblocking filter
  8052. @item dr/dering
  8053. Deringing filter
  8054. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8055. @table @option
  8056. @item threshold1
  8057. larger -> stronger filtering
  8058. @item threshold2
  8059. larger -> stronger filtering
  8060. @item threshold3
  8061. larger -> stronger filtering
  8062. @end table
  8063. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8064. @table @option
  8065. @item f/fullyrange
  8066. Stretch luminance to @code{0-255}.
  8067. @end table
  8068. @item lb/linblenddeint
  8069. Linear blend deinterlacing filter that deinterlaces the given block by
  8070. filtering all lines with a @code{(1 2 1)} filter.
  8071. @item li/linipoldeint
  8072. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8073. linearly interpolating every second line.
  8074. @item ci/cubicipoldeint
  8075. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8076. cubically interpolating every second line.
  8077. @item md/mediandeint
  8078. Median deinterlacing filter that deinterlaces the given block by applying a
  8079. median filter to every second line.
  8080. @item fd/ffmpegdeint
  8081. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8082. second line with a @code{(-1 4 2 4 -1)} filter.
  8083. @item l5/lowpass5
  8084. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8085. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8086. @item fq/forceQuant[|quantizer]
  8087. Overrides the quantizer table from the input with the constant quantizer you
  8088. specify.
  8089. @table @option
  8090. @item quantizer
  8091. Quantizer to use
  8092. @end table
  8093. @item de/default
  8094. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8095. @item fa/fast
  8096. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8097. @item ac
  8098. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8099. @end table
  8100. @subsection Examples
  8101. @itemize
  8102. @item
  8103. Apply horizontal and vertical deblocking, deringing and automatic
  8104. brightness/contrast:
  8105. @example
  8106. pp=hb/vb/dr/al
  8107. @end example
  8108. @item
  8109. Apply default filters without brightness/contrast correction:
  8110. @example
  8111. pp=de/-al
  8112. @end example
  8113. @item
  8114. Apply default filters and temporal denoiser:
  8115. @example
  8116. pp=default/tmpnoise|1|2|3
  8117. @end example
  8118. @item
  8119. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8120. automatically depending on available CPU time:
  8121. @example
  8122. pp=hb|y/vb|a
  8123. @end example
  8124. @end itemize
  8125. @section pp7
  8126. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8127. similar to spp = 6 with 7 point DCT, where only the center sample is
  8128. used after IDCT.
  8129. The filter accepts the following options:
  8130. @table @option
  8131. @item qp
  8132. Force a constant quantization parameter. It accepts an integer in range
  8133. 0 to 63. If not set, the filter will use the QP from the video stream
  8134. (if available).
  8135. @item mode
  8136. Set thresholding mode. Available modes are:
  8137. @table @samp
  8138. @item hard
  8139. Set hard thresholding.
  8140. @item soft
  8141. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8142. @item medium
  8143. Set medium thresholding (good results, default).
  8144. @end table
  8145. @end table
  8146. @section psnr
  8147. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8148. Ratio) between two input videos.
  8149. This filter takes in input two input videos, the first input is
  8150. considered the "main" source and is passed unchanged to the
  8151. output. The second input is used as a "reference" video for computing
  8152. the PSNR.
  8153. Both video inputs must have the same resolution and pixel format for
  8154. this filter to work correctly. Also it assumes that both inputs
  8155. have the same number of frames, which are compared one by one.
  8156. The obtained average PSNR is printed through the logging system.
  8157. The filter stores the accumulated MSE (mean squared error) of each
  8158. frame, and at the end of the processing it is averaged across all frames
  8159. equally, and the following formula is applied to obtain the PSNR:
  8160. @example
  8161. PSNR = 10*log10(MAX^2/MSE)
  8162. @end example
  8163. Where MAX is the average of the maximum values of each component of the
  8164. image.
  8165. The description of the accepted parameters follows.
  8166. @table @option
  8167. @item stats_file, f
  8168. If specified the filter will use the named file to save the PSNR of
  8169. each individual frame. When filename equals "-" the data is sent to
  8170. standard output.
  8171. @item stats_version
  8172. Specifies which version of the stats file format to use. Details of
  8173. each format are written below.
  8174. Default value is 1.
  8175. @end table
  8176. The file printed if @var{stats_file} is selected, contains a sequence of
  8177. key/value pairs of the form @var{key}:@var{value} for each compared
  8178. couple of frames.
  8179. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8180. the list of per-frame-pair stats, with key value pairs following the frame
  8181. format with the following parameters:
  8182. @table @option
  8183. @item psnr_log_version
  8184. The version of the log file format. Will match @var{stats_version}.
  8185. @item fields
  8186. A comma separated list of the per-frame-pair parameters included in
  8187. the log.
  8188. @end table
  8189. A description of each shown per-frame-pair parameter follows:
  8190. @table @option
  8191. @item n
  8192. sequential number of the input frame, starting from 1
  8193. @item mse_avg
  8194. Mean Square Error pixel-by-pixel average difference of the compared
  8195. frames, averaged over all the image components.
  8196. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8197. Mean Square Error pixel-by-pixel average difference of the compared
  8198. frames for the component specified by the suffix.
  8199. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8200. Peak Signal to Noise ratio of the compared frames for the component
  8201. specified by the suffix.
  8202. @end table
  8203. For example:
  8204. @example
  8205. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8206. [main][ref] psnr="stats_file=stats.log" [out]
  8207. @end example
  8208. On this example the input file being processed is compared with the
  8209. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8210. is stored in @file{stats.log}.
  8211. @anchor{pullup}
  8212. @section pullup
  8213. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8214. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8215. content.
  8216. The pullup filter is designed to take advantage of future context in making
  8217. its decisions. This filter is stateless in the sense that it does not lock
  8218. onto a pattern to follow, but it instead looks forward to the following
  8219. fields in order to identify matches and rebuild progressive frames.
  8220. To produce content with an even framerate, insert the fps filter after
  8221. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8222. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8223. The filter accepts the following options:
  8224. @table @option
  8225. @item jl
  8226. @item jr
  8227. @item jt
  8228. @item jb
  8229. These options set the amount of "junk" to ignore at the left, right, top, and
  8230. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8231. while top and bottom are in units of 2 lines.
  8232. The default is 8 pixels on each side.
  8233. @item sb
  8234. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8235. filter generating an occasional mismatched frame, but it may also cause an
  8236. excessive number of frames to be dropped during high motion sequences.
  8237. Conversely, setting it to -1 will make filter match fields more easily.
  8238. This may help processing of video where there is slight blurring between
  8239. the fields, but may also cause there to be interlaced frames in the output.
  8240. Default value is @code{0}.
  8241. @item mp
  8242. Set the metric plane to use. It accepts the following values:
  8243. @table @samp
  8244. @item l
  8245. Use luma plane.
  8246. @item u
  8247. Use chroma blue plane.
  8248. @item v
  8249. Use chroma red plane.
  8250. @end table
  8251. This option may be set to use chroma plane instead of the default luma plane
  8252. for doing filter's computations. This may improve accuracy on very clean
  8253. source material, but more likely will decrease accuracy, especially if there
  8254. is chroma noise (rainbow effect) or any grayscale video.
  8255. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8256. load and make pullup usable in realtime on slow machines.
  8257. @end table
  8258. For best results (without duplicated frames in the output file) it is
  8259. necessary to change the output frame rate. For example, to inverse
  8260. telecine NTSC input:
  8261. @example
  8262. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8263. @end example
  8264. @section qp
  8265. Change video quantization parameters (QP).
  8266. The filter accepts the following option:
  8267. @table @option
  8268. @item qp
  8269. Set expression for quantization parameter.
  8270. @end table
  8271. The expression is evaluated through the eval API and can contain, among others,
  8272. the following constants:
  8273. @table @var
  8274. @item known
  8275. 1 if index is not 129, 0 otherwise.
  8276. @item qp
  8277. Sequentional index starting from -129 to 128.
  8278. @end table
  8279. @subsection Examples
  8280. @itemize
  8281. @item
  8282. Some equation like:
  8283. @example
  8284. qp=2+2*sin(PI*qp)
  8285. @end example
  8286. @end itemize
  8287. @section random
  8288. Flush video frames from internal cache of frames into a random order.
  8289. No frame is discarded.
  8290. Inspired by @ref{frei0r} nervous filter.
  8291. @table @option
  8292. @item frames
  8293. Set size in number of frames of internal cache, in range from @code{2} to
  8294. @code{512}. Default is @code{30}.
  8295. @item seed
  8296. Set seed for random number generator, must be an integer included between
  8297. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8298. less than @code{0}, the filter will try to use a good random seed on a
  8299. best effort basis.
  8300. @end table
  8301. @section readvitc
  8302. Read vertical interval timecode (VITC) information from the top lines of a
  8303. video frame.
  8304. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8305. timecode value, if a valid timecode has been detected. Further metadata key
  8306. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8307. timecode data has been found or not.
  8308. This filter accepts the following options:
  8309. @table @option
  8310. @item scan_max
  8311. Set the maximum number of lines to scan for VITC data. If the value is set to
  8312. @code{-1} the full video frame is scanned. Default is @code{45}.
  8313. @item thr_b
  8314. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8315. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8316. @item thr_w
  8317. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8318. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8319. @end table
  8320. @subsection Examples
  8321. @itemize
  8322. @item
  8323. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8324. draw @code{--:--:--:--} as a placeholder:
  8325. @example
  8326. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8327. @end example
  8328. @end itemize
  8329. @section remap
  8330. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8331. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8332. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8333. value for pixel will be used for destination pixel.
  8334. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8335. will have Xmap/Ymap video stream dimensions.
  8336. Xmap and Ymap input video streams are 16bit depth, single channel.
  8337. @section removegrain
  8338. The removegrain filter is a spatial denoiser for progressive video.
  8339. @table @option
  8340. @item m0
  8341. Set mode for the first plane.
  8342. @item m1
  8343. Set mode for the second plane.
  8344. @item m2
  8345. Set mode for the third plane.
  8346. @item m3
  8347. Set mode for the fourth plane.
  8348. @end table
  8349. Range of mode is from 0 to 24. Description of each mode follows:
  8350. @table @var
  8351. @item 0
  8352. Leave input plane unchanged. Default.
  8353. @item 1
  8354. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8355. @item 2
  8356. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8357. @item 3
  8358. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8359. @item 4
  8360. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8361. This is equivalent to a median filter.
  8362. @item 5
  8363. Line-sensitive clipping giving the minimal change.
  8364. @item 6
  8365. Line-sensitive clipping, intermediate.
  8366. @item 7
  8367. Line-sensitive clipping, intermediate.
  8368. @item 8
  8369. Line-sensitive clipping, intermediate.
  8370. @item 9
  8371. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8372. @item 10
  8373. Replaces the target pixel with the closest neighbour.
  8374. @item 11
  8375. [1 2 1] horizontal and vertical kernel blur.
  8376. @item 12
  8377. Same as mode 11.
  8378. @item 13
  8379. Bob mode, interpolates top field from the line where the neighbours
  8380. pixels are the closest.
  8381. @item 14
  8382. Bob mode, interpolates bottom field from the line where the neighbours
  8383. pixels are the closest.
  8384. @item 15
  8385. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8386. interpolation formula.
  8387. @item 16
  8388. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8389. interpolation formula.
  8390. @item 17
  8391. Clips the pixel with the minimum and maximum of respectively the maximum and
  8392. minimum of each pair of opposite neighbour pixels.
  8393. @item 18
  8394. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8395. the current pixel is minimal.
  8396. @item 19
  8397. Replaces the pixel with the average of its 8 neighbours.
  8398. @item 20
  8399. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8400. @item 21
  8401. Clips pixels using the averages of opposite neighbour.
  8402. @item 22
  8403. Same as mode 21 but simpler and faster.
  8404. @item 23
  8405. Small edge and halo removal, but reputed useless.
  8406. @item 24
  8407. Similar as 23.
  8408. @end table
  8409. @section removelogo
  8410. Suppress a TV station logo, using an image file to determine which
  8411. pixels comprise the logo. It works by filling in the pixels that
  8412. comprise the logo with neighboring pixels.
  8413. The filter accepts the following options:
  8414. @table @option
  8415. @item filename, f
  8416. Set the filter bitmap file, which can be any image format supported by
  8417. libavformat. The width and height of the image file must match those of the
  8418. video stream being processed.
  8419. @end table
  8420. Pixels in the provided bitmap image with a value of zero are not
  8421. considered part of the logo, non-zero pixels are considered part of
  8422. the logo. If you use white (255) for the logo and black (0) for the
  8423. rest, you will be safe. For making the filter bitmap, it is
  8424. recommended to take a screen capture of a black frame with the logo
  8425. visible, and then using a threshold filter followed by the erode
  8426. filter once or twice.
  8427. If needed, little splotches can be fixed manually. Remember that if
  8428. logo pixels are not covered, the filter quality will be much
  8429. reduced. Marking too many pixels as part of the logo does not hurt as
  8430. much, but it will increase the amount of blurring needed to cover over
  8431. the image and will destroy more information than necessary, and extra
  8432. pixels will slow things down on a large logo.
  8433. @section repeatfields
  8434. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8435. fields based on its value.
  8436. @section reverse
  8437. Reverse a video clip.
  8438. Warning: This filter requires memory to buffer the entire clip, so trimming
  8439. is suggested.
  8440. @subsection Examples
  8441. @itemize
  8442. @item
  8443. Take the first 5 seconds of a clip, and reverse it.
  8444. @example
  8445. trim=end=5,reverse
  8446. @end example
  8447. @end itemize
  8448. @section rotate
  8449. Rotate video by an arbitrary angle expressed in radians.
  8450. The filter accepts the following options:
  8451. A description of the optional parameters follows.
  8452. @table @option
  8453. @item angle, a
  8454. Set an expression for the angle by which to rotate the input video
  8455. clockwise, expressed as a number of radians. A negative value will
  8456. result in a counter-clockwise rotation. By default it is set to "0".
  8457. This expression is evaluated for each frame.
  8458. @item out_w, ow
  8459. Set the output width expression, default value is "iw".
  8460. This expression is evaluated just once during configuration.
  8461. @item out_h, oh
  8462. Set the output height expression, default value is "ih".
  8463. This expression is evaluated just once during configuration.
  8464. @item bilinear
  8465. Enable bilinear interpolation if set to 1, a value of 0 disables
  8466. it. Default value is 1.
  8467. @item fillcolor, c
  8468. Set the color used to fill the output area not covered by the rotated
  8469. image. For the general syntax of this option, check the "Color" section in the
  8470. ffmpeg-utils manual. If the special value "none" is selected then no
  8471. background is printed (useful for example if the background is never shown).
  8472. Default value is "black".
  8473. @end table
  8474. The expressions for the angle and the output size can contain the
  8475. following constants and functions:
  8476. @table @option
  8477. @item n
  8478. sequential number of the input frame, starting from 0. It is always NAN
  8479. before the first frame is filtered.
  8480. @item t
  8481. time in seconds of the input frame, it is set to 0 when the filter is
  8482. configured. It is always NAN before the first frame is filtered.
  8483. @item hsub
  8484. @item vsub
  8485. horizontal and vertical chroma subsample values. For example for the
  8486. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8487. @item in_w, iw
  8488. @item in_h, ih
  8489. the input video width and height
  8490. @item out_w, ow
  8491. @item out_h, oh
  8492. the output width and height, that is the size of the padded area as
  8493. specified by the @var{width} and @var{height} expressions
  8494. @item rotw(a)
  8495. @item roth(a)
  8496. the minimal width/height required for completely containing the input
  8497. video rotated by @var{a} radians.
  8498. These are only available when computing the @option{out_w} and
  8499. @option{out_h} expressions.
  8500. @end table
  8501. @subsection Examples
  8502. @itemize
  8503. @item
  8504. Rotate the input by PI/6 radians clockwise:
  8505. @example
  8506. rotate=PI/6
  8507. @end example
  8508. @item
  8509. Rotate the input by PI/6 radians counter-clockwise:
  8510. @example
  8511. rotate=-PI/6
  8512. @end example
  8513. @item
  8514. Rotate the input by 45 degrees clockwise:
  8515. @example
  8516. rotate=45*PI/180
  8517. @end example
  8518. @item
  8519. Apply a constant rotation with period T, starting from an angle of PI/3:
  8520. @example
  8521. rotate=PI/3+2*PI*t/T
  8522. @end example
  8523. @item
  8524. Make the input video rotation oscillating with a period of T
  8525. seconds and an amplitude of A radians:
  8526. @example
  8527. rotate=A*sin(2*PI/T*t)
  8528. @end example
  8529. @item
  8530. Rotate the video, output size is chosen so that the whole rotating
  8531. input video is always completely contained in the output:
  8532. @example
  8533. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8534. @end example
  8535. @item
  8536. Rotate the video, reduce the output size so that no background is ever
  8537. shown:
  8538. @example
  8539. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8540. @end example
  8541. @end itemize
  8542. @subsection Commands
  8543. The filter supports the following commands:
  8544. @table @option
  8545. @item a, angle
  8546. Set the angle expression.
  8547. The command accepts the same syntax of the corresponding option.
  8548. If the specified expression is not valid, it is kept at its current
  8549. value.
  8550. @end table
  8551. @section sab
  8552. Apply Shape Adaptive Blur.
  8553. The filter accepts the following options:
  8554. @table @option
  8555. @item luma_radius, lr
  8556. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8557. value is 1.0. A greater value will result in a more blurred image, and
  8558. in slower processing.
  8559. @item luma_pre_filter_radius, lpfr
  8560. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8561. value is 1.0.
  8562. @item luma_strength, ls
  8563. Set luma maximum difference between pixels to still be considered, must
  8564. be a value in the 0.1-100.0 range, default value is 1.0.
  8565. @item chroma_radius, cr
  8566. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8567. greater value will result in a more blurred image, and in slower
  8568. processing.
  8569. @item chroma_pre_filter_radius, cpfr
  8570. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8571. @item chroma_strength, cs
  8572. Set chroma maximum difference between pixels to still be considered,
  8573. must be a value in the -0.9-100.0 range.
  8574. @end table
  8575. Each chroma option value, if not explicitly specified, is set to the
  8576. corresponding luma option value.
  8577. @anchor{scale}
  8578. @section scale
  8579. Scale (resize) the input video, using the libswscale library.
  8580. The scale filter forces the output display aspect ratio to be the same
  8581. of the input, by changing the output sample aspect ratio.
  8582. If the input image format is different from the format requested by
  8583. the next filter, the scale filter will convert the input to the
  8584. requested format.
  8585. @subsection Options
  8586. The filter accepts the following options, or any of the options
  8587. supported by the libswscale scaler.
  8588. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8589. the complete list of scaler options.
  8590. @table @option
  8591. @item width, w
  8592. @item height, h
  8593. Set the output video dimension expression. Default value is the input
  8594. dimension.
  8595. If the value is 0, the input width is used for the output.
  8596. If one of the values is -1, the scale filter will use a value that
  8597. maintains the aspect ratio of the input image, calculated from the
  8598. other specified dimension. If both of them are -1, the input size is
  8599. used
  8600. If one of the values is -n with n > 1, the scale filter will also use a value
  8601. that maintains the aspect ratio of the input image, calculated from the other
  8602. specified dimension. After that it will, however, make sure that the calculated
  8603. dimension is divisible by n and adjust the value if necessary.
  8604. See below for the list of accepted constants for use in the dimension
  8605. expression.
  8606. @item eval
  8607. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8608. @table @samp
  8609. @item init
  8610. Only evaluate expressions once during the filter initialization or when a command is processed.
  8611. @item frame
  8612. Evaluate expressions for each incoming frame.
  8613. @end table
  8614. Default value is @samp{init}.
  8615. @item interl
  8616. Set the interlacing mode. It accepts the following values:
  8617. @table @samp
  8618. @item 1
  8619. Force interlaced aware scaling.
  8620. @item 0
  8621. Do not apply interlaced scaling.
  8622. @item -1
  8623. Select interlaced aware scaling depending on whether the source frames
  8624. are flagged as interlaced or not.
  8625. @end table
  8626. Default value is @samp{0}.
  8627. @item flags
  8628. Set libswscale scaling flags. See
  8629. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8630. complete list of values. If not explicitly specified the filter applies
  8631. the default flags.
  8632. @item param0, param1
  8633. Set libswscale input parameters for scaling algorithms that need them. See
  8634. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8635. complete documentation. If not explicitly specified the filter applies
  8636. empty parameters.
  8637. @item size, s
  8638. Set the video size. For the syntax of this option, check the
  8639. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8640. @item in_color_matrix
  8641. @item out_color_matrix
  8642. Set in/output YCbCr color space type.
  8643. This allows the autodetected value to be overridden as well as allows forcing
  8644. a specific value used for the output and encoder.
  8645. If not specified, the color space type depends on the pixel format.
  8646. Possible values:
  8647. @table @samp
  8648. @item auto
  8649. Choose automatically.
  8650. @item bt709
  8651. Format conforming to International Telecommunication Union (ITU)
  8652. Recommendation BT.709.
  8653. @item fcc
  8654. Set color space conforming to the United States Federal Communications
  8655. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8656. @item bt601
  8657. Set color space conforming to:
  8658. @itemize
  8659. @item
  8660. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8661. @item
  8662. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8663. @item
  8664. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8665. @end itemize
  8666. @item smpte240m
  8667. Set color space conforming to SMPTE ST 240:1999.
  8668. @end table
  8669. @item in_range
  8670. @item out_range
  8671. Set in/output YCbCr sample range.
  8672. This allows the autodetected value to be overridden as well as allows forcing
  8673. a specific value used for the output and encoder. If not specified, the
  8674. range depends on the pixel format. Possible values:
  8675. @table @samp
  8676. @item auto
  8677. Choose automatically.
  8678. @item jpeg/full/pc
  8679. Set full range (0-255 in case of 8-bit luma).
  8680. @item mpeg/tv
  8681. Set "MPEG" range (16-235 in case of 8-bit luma).
  8682. @end table
  8683. @item force_original_aspect_ratio
  8684. Enable decreasing or increasing output video width or height if necessary to
  8685. keep the original aspect ratio. Possible values:
  8686. @table @samp
  8687. @item disable
  8688. Scale the video as specified and disable this feature.
  8689. @item decrease
  8690. The output video dimensions will automatically be decreased if needed.
  8691. @item increase
  8692. The output video dimensions will automatically be increased if needed.
  8693. @end table
  8694. One useful instance of this option is that when you know a specific device's
  8695. maximum allowed resolution, you can use this to limit the output video to
  8696. that, while retaining the aspect ratio. For example, device A allows
  8697. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8698. decrease) and specifying 1280x720 to the command line makes the output
  8699. 1280x533.
  8700. Please note that this is a different thing than specifying -1 for @option{w}
  8701. or @option{h}, you still need to specify the output resolution for this option
  8702. to work.
  8703. @end table
  8704. The values of the @option{w} and @option{h} options are expressions
  8705. containing the following constants:
  8706. @table @var
  8707. @item in_w
  8708. @item in_h
  8709. The input width and height
  8710. @item iw
  8711. @item ih
  8712. These are the same as @var{in_w} and @var{in_h}.
  8713. @item out_w
  8714. @item out_h
  8715. The output (scaled) width and height
  8716. @item ow
  8717. @item oh
  8718. These are the same as @var{out_w} and @var{out_h}
  8719. @item a
  8720. The same as @var{iw} / @var{ih}
  8721. @item sar
  8722. input sample aspect ratio
  8723. @item dar
  8724. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8725. @item hsub
  8726. @item vsub
  8727. horizontal and vertical input chroma subsample values. For example for the
  8728. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8729. @item ohsub
  8730. @item ovsub
  8731. horizontal and vertical output chroma subsample values. For example for the
  8732. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8733. @end table
  8734. @subsection Examples
  8735. @itemize
  8736. @item
  8737. Scale the input video to a size of 200x100
  8738. @example
  8739. scale=w=200:h=100
  8740. @end example
  8741. This is equivalent to:
  8742. @example
  8743. scale=200:100
  8744. @end example
  8745. or:
  8746. @example
  8747. scale=200x100
  8748. @end example
  8749. @item
  8750. Specify a size abbreviation for the output size:
  8751. @example
  8752. scale=qcif
  8753. @end example
  8754. which can also be written as:
  8755. @example
  8756. scale=size=qcif
  8757. @end example
  8758. @item
  8759. Scale the input to 2x:
  8760. @example
  8761. scale=w=2*iw:h=2*ih
  8762. @end example
  8763. @item
  8764. The above is the same as:
  8765. @example
  8766. scale=2*in_w:2*in_h
  8767. @end example
  8768. @item
  8769. Scale the input to 2x with forced interlaced scaling:
  8770. @example
  8771. scale=2*iw:2*ih:interl=1
  8772. @end example
  8773. @item
  8774. Scale the input to half size:
  8775. @example
  8776. scale=w=iw/2:h=ih/2
  8777. @end example
  8778. @item
  8779. Increase the width, and set the height to the same size:
  8780. @example
  8781. scale=3/2*iw:ow
  8782. @end example
  8783. @item
  8784. Seek Greek harmony:
  8785. @example
  8786. scale=iw:1/PHI*iw
  8787. scale=ih*PHI:ih
  8788. @end example
  8789. @item
  8790. Increase the height, and set the width to 3/2 of the height:
  8791. @example
  8792. scale=w=3/2*oh:h=3/5*ih
  8793. @end example
  8794. @item
  8795. Increase the size, making the size a multiple of the chroma
  8796. subsample values:
  8797. @example
  8798. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8799. @end example
  8800. @item
  8801. Increase the width to a maximum of 500 pixels,
  8802. keeping the same aspect ratio as the input:
  8803. @example
  8804. scale=w='min(500\, iw*3/2):h=-1'
  8805. @end example
  8806. @end itemize
  8807. @subsection Commands
  8808. This filter supports the following commands:
  8809. @table @option
  8810. @item width, w
  8811. @item height, h
  8812. Set the output video dimension expression.
  8813. The command accepts the same syntax of the corresponding option.
  8814. If the specified expression is not valid, it is kept at its current
  8815. value.
  8816. @end table
  8817. @section scale_npp
  8818. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  8819. format conversion on CUDA video frames. Setting the output width and height
  8820. works in the same way as for the @var{scale} filter.
  8821. The following additional options are accepted:
  8822. @table @option
  8823. @item format
  8824. The pixel format of the output CUDA frames. If set to the string "same" (the
  8825. default), the input format will be kept. Note that automatic format negotiation
  8826. and conversion is not yet supported for hardware frames
  8827. @item interp_algo
  8828. The interpolation algorithm used for resizing. One of the following:
  8829. @table @option
  8830. @item nn
  8831. Nearest neighbour.
  8832. @item linear
  8833. @item cubic
  8834. @item cubic2p_bspline
  8835. 2-parameter cubic (B=1, C=0)
  8836. @item cubic2p_catmullrom
  8837. 2-parameter cubic (B=0, C=1/2)
  8838. @item cubic2p_b05c03
  8839. 2-parameter cubic (B=1/2, C=3/10)
  8840. @item super
  8841. Supersampling
  8842. @item lanczos
  8843. @end table
  8844. @end table
  8845. @section scale2ref
  8846. Scale (resize) the input video, based on a reference video.
  8847. See the scale filter for available options, scale2ref supports the same but
  8848. uses the reference video instead of the main input as basis.
  8849. @subsection Examples
  8850. @itemize
  8851. @item
  8852. Scale a subtitle stream to match the main video in size before overlaying
  8853. @example
  8854. 'scale2ref[b][a];[a][b]overlay'
  8855. @end example
  8856. @end itemize
  8857. @anchor{selectivecolor}
  8858. @section selectivecolor
  8859. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8860. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8861. by the "purity" of the color (that is, how saturated it already is).
  8862. This filter is similar to the Adobe Photoshop Selective Color tool.
  8863. The filter accepts the following options:
  8864. @table @option
  8865. @item correction_method
  8866. Select color correction method.
  8867. Available values are:
  8868. @table @samp
  8869. @item absolute
  8870. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8871. component value).
  8872. @item relative
  8873. Specified adjustments are relative to the original component value.
  8874. @end table
  8875. Default is @code{absolute}.
  8876. @item reds
  8877. Adjustments for red pixels (pixels where the red component is the maximum)
  8878. @item yellows
  8879. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8880. @item greens
  8881. Adjustments for green pixels (pixels where the green component is the maximum)
  8882. @item cyans
  8883. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8884. @item blues
  8885. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8886. @item magentas
  8887. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8888. @item whites
  8889. Adjustments for white pixels (pixels where all components are greater than 128)
  8890. @item neutrals
  8891. Adjustments for all pixels except pure black and pure white
  8892. @item blacks
  8893. Adjustments for black pixels (pixels where all components are lesser than 128)
  8894. @item psfile
  8895. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8896. @end table
  8897. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8898. 4 space separated floating point adjustment values in the [-1,1] range,
  8899. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8900. pixels of its range.
  8901. @subsection Examples
  8902. @itemize
  8903. @item
  8904. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8905. increase magenta by 27% in blue areas:
  8906. @example
  8907. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8908. @end example
  8909. @item
  8910. Use a Photoshop selective color preset:
  8911. @example
  8912. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8913. @end example
  8914. @end itemize
  8915. @section separatefields
  8916. The @code{separatefields} takes a frame-based video input and splits
  8917. each frame into its components fields, producing a new half height clip
  8918. with twice the frame rate and twice the frame count.
  8919. This filter use field-dominance information in frame to decide which
  8920. of each pair of fields to place first in the output.
  8921. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8922. @section setdar, setsar
  8923. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8924. output video.
  8925. This is done by changing the specified Sample (aka Pixel) Aspect
  8926. Ratio, according to the following equation:
  8927. @example
  8928. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8929. @end example
  8930. Keep in mind that the @code{setdar} filter does not modify the pixel
  8931. dimensions of the video frame. Also, the display aspect ratio set by
  8932. this filter may be changed by later filters in the filterchain,
  8933. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8934. applied.
  8935. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8936. the filter output video.
  8937. Note that as a consequence of the application of this filter, the
  8938. output display aspect ratio will change according to the equation
  8939. above.
  8940. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8941. filter may be changed by later filters in the filterchain, e.g. if
  8942. another "setsar" or a "setdar" filter is applied.
  8943. It accepts the following parameters:
  8944. @table @option
  8945. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8946. Set the aspect ratio used by the filter.
  8947. The parameter can be a floating point number string, an expression, or
  8948. a string of the form @var{num}:@var{den}, where @var{num} and
  8949. @var{den} are the numerator and denominator of the aspect ratio. If
  8950. the parameter is not specified, it is assumed the value "0".
  8951. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8952. should be escaped.
  8953. @item max
  8954. Set the maximum integer value to use for expressing numerator and
  8955. denominator when reducing the expressed aspect ratio to a rational.
  8956. Default value is @code{100}.
  8957. @end table
  8958. The parameter @var{sar} is an expression containing
  8959. the following constants:
  8960. @table @option
  8961. @item E, PI, PHI
  8962. These are approximated values for the mathematical constants e
  8963. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8964. @item w, h
  8965. The input width and height.
  8966. @item a
  8967. These are the same as @var{w} / @var{h}.
  8968. @item sar
  8969. The input sample aspect ratio.
  8970. @item dar
  8971. The input display aspect ratio. It is the same as
  8972. (@var{w} / @var{h}) * @var{sar}.
  8973. @item hsub, vsub
  8974. Horizontal and vertical chroma subsample values. For example, for the
  8975. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8976. @end table
  8977. @subsection Examples
  8978. @itemize
  8979. @item
  8980. To change the display aspect ratio to 16:9, specify one of the following:
  8981. @example
  8982. setdar=dar=1.77777
  8983. setdar=dar=16/9
  8984. @end example
  8985. @item
  8986. To change the sample aspect ratio to 10:11, specify:
  8987. @example
  8988. setsar=sar=10/11
  8989. @end example
  8990. @item
  8991. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8992. 1000 in the aspect ratio reduction, use the command:
  8993. @example
  8994. setdar=ratio=16/9:max=1000
  8995. @end example
  8996. @end itemize
  8997. @anchor{setfield}
  8998. @section setfield
  8999. Force field for the output video frame.
  9000. The @code{setfield} filter marks the interlace type field for the
  9001. output frames. It does not change the input frame, but only sets the
  9002. corresponding property, which affects how the frame is treated by
  9003. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9004. The filter accepts the following options:
  9005. @table @option
  9006. @item mode
  9007. Available values are:
  9008. @table @samp
  9009. @item auto
  9010. Keep the same field property.
  9011. @item bff
  9012. Mark the frame as bottom-field-first.
  9013. @item tff
  9014. Mark the frame as top-field-first.
  9015. @item prog
  9016. Mark the frame as progressive.
  9017. @end table
  9018. @end table
  9019. @section showinfo
  9020. Show a line containing various information for each input video frame.
  9021. The input video is not modified.
  9022. The shown line contains a sequence of key/value pairs of the form
  9023. @var{key}:@var{value}.
  9024. The following values are shown in the output:
  9025. @table @option
  9026. @item n
  9027. The (sequential) number of the input frame, starting from 0.
  9028. @item pts
  9029. The Presentation TimeStamp of the input frame, expressed as a number of
  9030. time base units. The time base unit depends on the filter input pad.
  9031. @item pts_time
  9032. The Presentation TimeStamp of the input frame, expressed as a number of
  9033. seconds.
  9034. @item pos
  9035. The position of the frame in the input stream, or -1 if this information is
  9036. unavailable and/or meaningless (for example in case of synthetic video).
  9037. @item fmt
  9038. The pixel format name.
  9039. @item sar
  9040. The sample aspect ratio of the input frame, expressed in the form
  9041. @var{num}/@var{den}.
  9042. @item s
  9043. The size of the input frame. For the syntax of this option, check the
  9044. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9045. @item i
  9046. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9047. for bottom field first).
  9048. @item iskey
  9049. This is 1 if the frame is a key frame, 0 otherwise.
  9050. @item type
  9051. The picture type of the input frame ("I" for an I-frame, "P" for a
  9052. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9053. Also refer to the documentation of the @code{AVPictureType} enum and of
  9054. the @code{av_get_picture_type_char} function defined in
  9055. @file{libavutil/avutil.h}.
  9056. @item checksum
  9057. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9058. @item plane_checksum
  9059. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9060. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9061. @end table
  9062. @section showpalette
  9063. Displays the 256 colors palette of each frame. This filter is only relevant for
  9064. @var{pal8} pixel format frames.
  9065. It accepts the following option:
  9066. @table @option
  9067. @item s
  9068. Set the size of the box used to represent one palette color entry. Default is
  9069. @code{30} (for a @code{30x30} pixel box).
  9070. @end table
  9071. @section shuffleframes
  9072. Reorder and/or duplicate video frames.
  9073. It accepts the following parameters:
  9074. @table @option
  9075. @item mapping
  9076. Set the destination indexes of input frames.
  9077. This is space or '|' separated list of indexes that maps input frames to output
  9078. frames. Number of indexes also sets maximal value that each index may have.
  9079. @end table
  9080. The first frame has the index 0. The default is to keep the input unchanged.
  9081. Swap second and third frame of every three frames of the input:
  9082. @example
  9083. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9084. @end example
  9085. @section shuffleplanes
  9086. Reorder and/or duplicate video planes.
  9087. It accepts the following parameters:
  9088. @table @option
  9089. @item map0
  9090. The index of the input plane to be used as the first output plane.
  9091. @item map1
  9092. The index of the input plane to be used as the second output plane.
  9093. @item map2
  9094. The index of the input plane to be used as the third output plane.
  9095. @item map3
  9096. The index of the input plane to be used as the fourth output plane.
  9097. @end table
  9098. The first plane has the index 0. The default is to keep the input unchanged.
  9099. Swap the second and third planes of the input:
  9100. @example
  9101. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9102. @end example
  9103. @anchor{signalstats}
  9104. @section signalstats
  9105. Evaluate various visual metrics that assist in determining issues associated
  9106. with the digitization of analog video media.
  9107. By default the filter will log these metadata values:
  9108. @table @option
  9109. @item YMIN
  9110. Display the minimal Y value contained within the input frame. Expressed in
  9111. range of [0-255].
  9112. @item YLOW
  9113. Display the Y value at the 10% percentile within the input frame. Expressed in
  9114. range of [0-255].
  9115. @item YAVG
  9116. Display the average Y value within the input frame. Expressed in range of
  9117. [0-255].
  9118. @item YHIGH
  9119. Display the Y value at the 90% percentile within the input frame. Expressed in
  9120. range of [0-255].
  9121. @item YMAX
  9122. Display the maximum Y value contained within the input frame. Expressed in
  9123. range of [0-255].
  9124. @item UMIN
  9125. Display the minimal U value contained within the input frame. Expressed in
  9126. range of [0-255].
  9127. @item ULOW
  9128. Display the U value at the 10% percentile within the input frame. Expressed in
  9129. range of [0-255].
  9130. @item UAVG
  9131. Display the average U value within the input frame. Expressed in range of
  9132. [0-255].
  9133. @item UHIGH
  9134. Display the U value at the 90% percentile within the input frame. Expressed in
  9135. range of [0-255].
  9136. @item UMAX
  9137. Display the maximum U value contained within the input frame. Expressed in
  9138. range of [0-255].
  9139. @item VMIN
  9140. Display the minimal V value contained within the input frame. Expressed in
  9141. range of [0-255].
  9142. @item VLOW
  9143. Display the V value at the 10% percentile within the input frame. Expressed in
  9144. range of [0-255].
  9145. @item VAVG
  9146. Display the average V value within the input frame. Expressed in range of
  9147. [0-255].
  9148. @item VHIGH
  9149. Display the V value at the 90% percentile within the input frame. Expressed in
  9150. range of [0-255].
  9151. @item VMAX
  9152. Display the maximum V value contained within the input frame. Expressed in
  9153. range of [0-255].
  9154. @item SATMIN
  9155. Display the minimal saturation value contained within the input frame.
  9156. Expressed in range of [0-~181.02].
  9157. @item SATLOW
  9158. Display the saturation value at the 10% percentile within the input frame.
  9159. Expressed in range of [0-~181.02].
  9160. @item SATAVG
  9161. Display the average saturation value within the input frame. Expressed in range
  9162. of [0-~181.02].
  9163. @item SATHIGH
  9164. Display the saturation value at the 90% percentile within the input frame.
  9165. Expressed in range of [0-~181.02].
  9166. @item SATMAX
  9167. Display the maximum saturation value contained within the input frame.
  9168. Expressed in range of [0-~181.02].
  9169. @item HUEMED
  9170. Display the median value for hue within the input frame. Expressed in range of
  9171. [0-360].
  9172. @item HUEAVG
  9173. Display the average value for hue within the input frame. Expressed in range of
  9174. [0-360].
  9175. @item YDIF
  9176. Display the average of sample value difference between all values of the Y
  9177. plane in the current frame and corresponding values of the previous input frame.
  9178. Expressed in range of [0-255].
  9179. @item UDIF
  9180. Display the average of sample value difference between all values of the U
  9181. plane in the current frame and corresponding values of the previous input frame.
  9182. Expressed in range of [0-255].
  9183. @item VDIF
  9184. Display the average of sample value difference between all values of the V
  9185. plane in the current frame and corresponding values of the previous input frame.
  9186. Expressed in range of [0-255].
  9187. @item YBITDEPTH
  9188. Display bit depth of Y plane in current frame.
  9189. Expressed in range of [0-16].
  9190. @item UBITDEPTH
  9191. Display bit depth of U plane in current frame.
  9192. Expressed in range of [0-16].
  9193. @item VBITDEPTH
  9194. Display bit depth of V plane in current frame.
  9195. Expressed in range of [0-16].
  9196. @end table
  9197. The filter accepts the following options:
  9198. @table @option
  9199. @item stat
  9200. @item out
  9201. @option{stat} specify an additional form of image analysis.
  9202. @option{out} output video with the specified type of pixel highlighted.
  9203. Both options accept the following values:
  9204. @table @samp
  9205. @item tout
  9206. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9207. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9208. include the results of video dropouts, head clogs, or tape tracking issues.
  9209. @item vrep
  9210. Identify @var{vertical line repetition}. Vertical line repetition includes
  9211. similar rows of pixels within a frame. In born-digital video vertical line
  9212. repetition is common, but this pattern is uncommon in video digitized from an
  9213. analog source. When it occurs in video that results from the digitization of an
  9214. analog source it can indicate concealment from a dropout compensator.
  9215. @item brng
  9216. Identify pixels that fall outside of legal broadcast range.
  9217. @end table
  9218. @item color, c
  9219. Set the highlight color for the @option{out} option. The default color is
  9220. yellow.
  9221. @end table
  9222. @subsection Examples
  9223. @itemize
  9224. @item
  9225. Output data of various video metrics:
  9226. @example
  9227. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9228. @end example
  9229. @item
  9230. Output specific data about the minimum and maximum values of the Y plane per frame:
  9231. @example
  9232. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9233. @end example
  9234. @item
  9235. Playback video while highlighting pixels that are outside of broadcast range in red.
  9236. @example
  9237. ffplay example.mov -vf signalstats="out=brng:color=red"
  9238. @end example
  9239. @item
  9240. Playback video with signalstats metadata drawn over the frame.
  9241. @example
  9242. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9243. @end example
  9244. The contents of signalstat_drawtext.txt used in the command are:
  9245. @example
  9246. time %@{pts:hms@}
  9247. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9248. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9249. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9250. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9251. @end example
  9252. @end itemize
  9253. @anchor{smartblur}
  9254. @section smartblur
  9255. Blur the input video without impacting the outlines.
  9256. It accepts the following options:
  9257. @table @option
  9258. @item luma_radius, lr
  9259. Set the luma radius. The option value must be a float number in
  9260. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9261. used to blur the image (slower if larger). Default value is 1.0.
  9262. @item luma_strength, ls
  9263. Set the luma strength. The option value must be a float number
  9264. in the range [-1.0,1.0] that configures the blurring. A value included
  9265. in [0.0,1.0] will blur the image whereas a value included in
  9266. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9267. @item luma_threshold, lt
  9268. Set the luma threshold used as a coefficient to determine
  9269. whether a pixel should be blurred or not. The option value must be an
  9270. integer in the range [-30,30]. A value of 0 will filter all the image,
  9271. a value included in [0,30] will filter flat areas and a value included
  9272. in [-30,0] will filter edges. Default value is 0.
  9273. @item chroma_radius, cr
  9274. Set the chroma radius. The option value must be a float number in
  9275. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9276. used to blur the image (slower if larger). Default value is 1.0.
  9277. @item chroma_strength, cs
  9278. Set the chroma strength. The option value must be a float number
  9279. in the range [-1.0,1.0] that configures the blurring. A value included
  9280. in [0.0,1.0] will blur the image whereas a value included in
  9281. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9282. @item chroma_threshold, ct
  9283. Set the chroma threshold used as a coefficient to determine
  9284. whether a pixel should be blurred or not. The option value must be an
  9285. integer in the range [-30,30]. A value of 0 will filter all the image,
  9286. a value included in [0,30] will filter flat areas and a value included
  9287. in [-30,0] will filter edges. Default value is 0.
  9288. @end table
  9289. If a chroma option is not explicitly set, the corresponding luma value
  9290. is set.
  9291. @section ssim
  9292. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9293. This filter takes in input two input videos, the first input is
  9294. considered the "main" source and is passed unchanged to the
  9295. output. The second input is used as a "reference" video for computing
  9296. the SSIM.
  9297. Both video inputs must have the same resolution and pixel format for
  9298. this filter to work correctly. Also it assumes that both inputs
  9299. have the same number of frames, which are compared one by one.
  9300. The filter stores the calculated SSIM of each frame.
  9301. The description of the accepted parameters follows.
  9302. @table @option
  9303. @item stats_file, f
  9304. If specified the filter will use the named file to save the SSIM of
  9305. each individual frame. When filename equals "-" the data is sent to
  9306. standard output.
  9307. @end table
  9308. The file printed if @var{stats_file} is selected, contains a sequence of
  9309. key/value pairs of the form @var{key}:@var{value} for each compared
  9310. couple of frames.
  9311. A description of each shown parameter follows:
  9312. @table @option
  9313. @item n
  9314. sequential number of the input frame, starting from 1
  9315. @item Y, U, V, R, G, B
  9316. SSIM of the compared frames for the component specified by the suffix.
  9317. @item All
  9318. SSIM of the compared frames for the whole frame.
  9319. @item dB
  9320. Same as above but in dB representation.
  9321. @end table
  9322. For example:
  9323. @example
  9324. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9325. [main][ref] ssim="stats_file=stats.log" [out]
  9326. @end example
  9327. On this example the input file being processed is compared with the
  9328. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9329. is stored in @file{stats.log}.
  9330. Another example with both psnr and ssim at same time:
  9331. @example
  9332. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9333. @end example
  9334. @section stereo3d
  9335. Convert between different stereoscopic image formats.
  9336. The filters accept the following options:
  9337. @table @option
  9338. @item in
  9339. Set stereoscopic image format of input.
  9340. Available values for input image formats are:
  9341. @table @samp
  9342. @item sbsl
  9343. side by side parallel (left eye left, right eye right)
  9344. @item sbsr
  9345. side by side crosseye (right eye left, left eye right)
  9346. @item sbs2l
  9347. side by side parallel with half width resolution
  9348. (left eye left, right eye right)
  9349. @item sbs2r
  9350. side by side crosseye with half width resolution
  9351. (right eye left, left eye right)
  9352. @item abl
  9353. above-below (left eye above, right eye below)
  9354. @item abr
  9355. above-below (right eye above, left eye below)
  9356. @item ab2l
  9357. above-below with half height resolution
  9358. (left eye above, right eye below)
  9359. @item ab2r
  9360. above-below with half height resolution
  9361. (right eye above, left eye below)
  9362. @item al
  9363. alternating frames (left eye first, right eye second)
  9364. @item ar
  9365. alternating frames (right eye first, left eye second)
  9366. @item irl
  9367. interleaved rows (left eye has top row, right eye starts on next row)
  9368. @item irr
  9369. interleaved rows (right eye has top row, left eye starts on next row)
  9370. @item icl
  9371. interleaved columns, left eye first
  9372. @item icr
  9373. interleaved columns, right eye first
  9374. Default value is @samp{sbsl}.
  9375. @end table
  9376. @item out
  9377. Set stereoscopic image format of output.
  9378. @table @samp
  9379. @item sbsl
  9380. side by side parallel (left eye left, right eye right)
  9381. @item sbsr
  9382. side by side crosseye (right eye left, left eye right)
  9383. @item sbs2l
  9384. side by side parallel with half width resolution
  9385. (left eye left, right eye right)
  9386. @item sbs2r
  9387. side by side crosseye with half width resolution
  9388. (right eye left, left eye right)
  9389. @item abl
  9390. above-below (left eye above, right eye below)
  9391. @item abr
  9392. above-below (right eye above, left eye below)
  9393. @item ab2l
  9394. above-below with half height resolution
  9395. (left eye above, right eye below)
  9396. @item ab2r
  9397. above-below with half height resolution
  9398. (right eye above, left eye below)
  9399. @item al
  9400. alternating frames (left eye first, right eye second)
  9401. @item ar
  9402. alternating frames (right eye first, left eye second)
  9403. @item irl
  9404. interleaved rows (left eye has top row, right eye starts on next row)
  9405. @item irr
  9406. interleaved rows (right eye has top row, left eye starts on next row)
  9407. @item arbg
  9408. anaglyph red/blue gray
  9409. (red filter on left eye, blue filter on right eye)
  9410. @item argg
  9411. anaglyph red/green gray
  9412. (red filter on left eye, green filter on right eye)
  9413. @item arcg
  9414. anaglyph red/cyan gray
  9415. (red filter on left eye, cyan filter on right eye)
  9416. @item arch
  9417. anaglyph red/cyan half colored
  9418. (red filter on left eye, cyan filter on right eye)
  9419. @item arcc
  9420. anaglyph red/cyan color
  9421. (red filter on left eye, cyan filter on right eye)
  9422. @item arcd
  9423. anaglyph red/cyan color optimized with the least squares projection of dubois
  9424. (red filter on left eye, cyan filter on right eye)
  9425. @item agmg
  9426. anaglyph green/magenta gray
  9427. (green filter on left eye, magenta filter on right eye)
  9428. @item agmh
  9429. anaglyph green/magenta half colored
  9430. (green filter on left eye, magenta filter on right eye)
  9431. @item agmc
  9432. anaglyph green/magenta colored
  9433. (green filter on left eye, magenta filter on right eye)
  9434. @item agmd
  9435. anaglyph green/magenta color optimized with the least squares projection of dubois
  9436. (green filter on left eye, magenta filter on right eye)
  9437. @item aybg
  9438. anaglyph yellow/blue gray
  9439. (yellow filter on left eye, blue filter on right eye)
  9440. @item aybh
  9441. anaglyph yellow/blue half colored
  9442. (yellow filter on left eye, blue filter on right eye)
  9443. @item aybc
  9444. anaglyph yellow/blue colored
  9445. (yellow filter on left eye, blue filter on right eye)
  9446. @item aybd
  9447. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9448. (yellow filter on left eye, blue filter on right eye)
  9449. @item ml
  9450. mono output (left eye only)
  9451. @item mr
  9452. mono output (right eye only)
  9453. @item chl
  9454. checkerboard, left eye first
  9455. @item chr
  9456. checkerboard, right eye first
  9457. @item icl
  9458. interleaved columns, left eye first
  9459. @item icr
  9460. interleaved columns, right eye first
  9461. @item hdmi
  9462. HDMI frame pack
  9463. @end table
  9464. Default value is @samp{arcd}.
  9465. @end table
  9466. @subsection Examples
  9467. @itemize
  9468. @item
  9469. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9470. @example
  9471. stereo3d=sbsl:aybd
  9472. @end example
  9473. @item
  9474. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9475. @example
  9476. stereo3d=abl:sbsr
  9477. @end example
  9478. @end itemize
  9479. @section streamselect, astreamselect
  9480. Select video or audio streams.
  9481. The filter accepts the following options:
  9482. @table @option
  9483. @item inputs
  9484. Set number of inputs. Default is 2.
  9485. @item map
  9486. Set input indexes to remap to outputs.
  9487. @end table
  9488. @subsection Commands
  9489. The @code{streamselect} and @code{astreamselect} filter supports the following
  9490. commands:
  9491. @table @option
  9492. @item map
  9493. Set input indexes to remap to outputs.
  9494. @end table
  9495. @subsection Examples
  9496. @itemize
  9497. @item
  9498. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9499. @example
  9500. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9501. @end example
  9502. @item
  9503. Same as above, but for audio:
  9504. @example
  9505. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9506. @end example
  9507. @end itemize
  9508. @anchor{spp}
  9509. @section spp
  9510. Apply a simple postprocessing filter that compresses and decompresses the image
  9511. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9512. and average the results.
  9513. The filter accepts the following options:
  9514. @table @option
  9515. @item quality
  9516. Set quality. This option defines the number of levels for averaging. It accepts
  9517. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9518. effect. A value of @code{6} means the higher quality. For each increment of
  9519. that value the speed drops by a factor of approximately 2. Default value is
  9520. @code{3}.
  9521. @item qp
  9522. Force a constant quantization parameter. If not set, the filter will use the QP
  9523. from the video stream (if available).
  9524. @item mode
  9525. Set thresholding mode. Available modes are:
  9526. @table @samp
  9527. @item hard
  9528. Set hard thresholding (default).
  9529. @item soft
  9530. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9531. @end table
  9532. @item use_bframe_qp
  9533. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9534. option may cause flicker since the B-Frames have often larger QP. Default is
  9535. @code{0} (not enabled).
  9536. @end table
  9537. @anchor{subtitles}
  9538. @section subtitles
  9539. Draw subtitles on top of input video using the libass library.
  9540. To enable compilation of this filter you need to configure FFmpeg with
  9541. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9542. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9543. Alpha) subtitles format.
  9544. The filter accepts the following options:
  9545. @table @option
  9546. @item filename, f
  9547. Set the filename of the subtitle file to read. It must be specified.
  9548. @item original_size
  9549. Specify the size of the original video, the video for which the ASS file
  9550. was composed. For the syntax of this option, check the
  9551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9552. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9553. correctly scale the fonts if the aspect ratio has been changed.
  9554. @item fontsdir
  9555. Set a directory path containing fonts that can be used by the filter.
  9556. These fonts will be used in addition to whatever the font provider uses.
  9557. @item charenc
  9558. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9559. useful if not UTF-8.
  9560. @item stream_index, si
  9561. Set subtitles stream index. @code{subtitles} filter only.
  9562. @item force_style
  9563. Override default style or script info parameters of the subtitles. It accepts a
  9564. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9565. @end table
  9566. If the first key is not specified, it is assumed that the first value
  9567. specifies the @option{filename}.
  9568. For example, to render the file @file{sub.srt} on top of the input
  9569. video, use the command:
  9570. @example
  9571. subtitles=sub.srt
  9572. @end example
  9573. which is equivalent to:
  9574. @example
  9575. subtitles=filename=sub.srt
  9576. @end example
  9577. To render the default subtitles stream from file @file{video.mkv}, use:
  9578. @example
  9579. subtitles=video.mkv
  9580. @end example
  9581. To render the second subtitles stream from that file, use:
  9582. @example
  9583. subtitles=video.mkv:si=1
  9584. @end example
  9585. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9586. @code{DejaVu Serif}, use:
  9587. @example
  9588. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9589. @end example
  9590. @section super2xsai
  9591. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9592. Interpolate) pixel art scaling algorithm.
  9593. Useful for enlarging pixel art images without reducing sharpness.
  9594. @section swaprect
  9595. Swap two rectangular objects in video.
  9596. This filter accepts the following options:
  9597. @table @option
  9598. @item w
  9599. Set object width.
  9600. @item h
  9601. Set object height.
  9602. @item x1
  9603. Set 1st rect x coordinate.
  9604. @item y1
  9605. Set 1st rect y coordinate.
  9606. @item x2
  9607. Set 2nd rect x coordinate.
  9608. @item y2
  9609. Set 2nd rect y coordinate.
  9610. All expressions are evaluated once for each frame.
  9611. @end table
  9612. The all options are expressions containing the following constants:
  9613. @table @option
  9614. @item w
  9615. @item h
  9616. The input width and height.
  9617. @item a
  9618. same as @var{w} / @var{h}
  9619. @item sar
  9620. input sample aspect ratio
  9621. @item dar
  9622. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9623. @item n
  9624. The number of the input frame, starting from 0.
  9625. @item t
  9626. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9627. @item pos
  9628. the position in the file of the input frame, NAN if unknown
  9629. @end table
  9630. @section swapuv
  9631. Swap U & V plane.
  9632. @section telecine
  9633. Apply telecine process to the video.
  9634. This filter accepts the following options:
  9635. @table @option
  9636. @item first_field
  9637. @table @samp
  9638. @item top, t
  9639. top field first
  9640. @item bottom, b
  9641. bottom field first
  9642. The default value is @code{top}.
  9643. @end table
  9644. @item pattern
  9645. A string of numbers representing the pulldown pattern you wish to apply.
  9646. The default value is @code{23}.
  9647. @end table
  9648. @example
  9649. Some typical patterns:
  9650. NTSC output (30i):
  9651. 27.5p: 32222
  9652. 24p: 23 (classic)
  9653. 24p: 2332 (preferred)
  9654. 20p: 33
  9655. 18p: 334
  9656. 16p: 3444
  9657. PAL output (25i):
  9658. 27.5p: 12222
  9659. 24p: 222222222223 ("Euro pulldown")
  9660. 16.67p: 33
  9661. 16p: 33333334
  9662. @end example
  9663. @section thumbnail
  9664. Select the most representative frame in a given sequence of consecutive frames.
  9665. The filter accepts the following options:
  9666. @table @option
  9667. @item n
  9668. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9669. will pick one of them, and then handle the next batch of @var{n} frames until
  9670. the end. Default is @code{100}.
  9671. @end table
  9672. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9673. value will result in a higher memory usage, so a high value is not recommended.
  9674. @subsection Examples
  9675. @itemize
  9676. @item
  9677. Extract one picture each 50 frames:
  9678. @example
  9679. thumbnail=50
  9680. @end example
  9681. @item
  9682. Complete example of a thumbnail creation with @command{ffmpeg}:
  9683. @example
  9684. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9685. @end example
  9686. @end itemize
  9687. @section tile
  9688. Tile several successive frames together.
  9689. The filter accepts the following options:
  9690. @table @option
  9691. @item layout
  9692. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9693. this option, check the
  9694. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9695. @item nb_frames
  9696. Set the maximum number of frames to render in the given area. It must be less
  9697. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9698. the area will be used.
  9699. @item margin
  9700. Set the outer border margin in pixels.
  9701. @item padding
  9702. Set the inner border thickness (i.e. the number of pixels between frames). For
  9703. more advanced padding options (such as having different values for the edges),
  9704. refer to the pad video filter.
  9705. @item color
  9706. Specify the color of the unused area. For the syntax of this option, check the
  9707. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9708. is "black".
  9709. @end table
  9710. @subsection Examples
  9711. @itemize
  9712. @item
  9713. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9714. @example
  9715. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9716. @end example
  9717. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9718. duplicating each output frame to accommodate the originally detected frame
  9719. rate.
  9720. @item
  9721. Display @code{5} pictures in an area of @code{3x2} frames,
  9722. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9723. mixed flat and named options:
  9724. @example
  9725. tile=3x2:nb_frames=5:padding=7:margin=2
  9726. @end example
  9727. @end itemize
  9728. @section tinterlace
  9729. Perform various types of temporal field interlacing.
  9730. Frames are counted starting from 1, so the first input frame is
  9731. considered odd.
  9732. The filter accepts the following options:
  9733. @table @option
  9734. @item mode
  9735. Specify the mode of the interlacing. This option can also be specified
  9736. as a value alone. See below for a list of values for this option.
  9737. Available values are:
  9738. @table @samp
  9739. @item merge, 0
  9740. Move odd frames into the upper field, even into the lower field,
  9741. generating a double height frame at half frame rate.
  9742. @example
  9743. ------> time
  9744. Input:
  9745. Frame 1 Frame 2 Frame 3 Frame 4
  9746. 11111 22222 33333 44444
  9747. 11111 22222 33333 44444
  9748. 11111 22222 33333 44444
  9749. 11111 22222 33333 44444
  9750. Output:
  9751. 11111 33333
  9752. 22222 44444
  9753. 11111 33333
  9754. 22222 44444
  9755. 11111 33333
  9756. 22222 44444
  9757. 11111 33333
  9758. 22222 44444
  9759. @end example
  9760. @item drop_even, 1
  9761. Only output odd frames, even frames are dropped, generating a frame with
  9762. unchanged height at half frame rate.
  9763. @example
  9764. ------> time
  9765. Input:
  9766. Frame 1 Frame 2 Frame 3 Frame 4
  9767. 11111 22222 33333 44444
  9768. 11111 22222 33333 44444
  9769. 11111 22222 33333 44444
  9770. 11111 22222 33333 44444
  9771. Output:
  9772. 11111 33333
  9773. 11111 33333
  9774. 11111 33333
  9775. 11111 33333
  9776. @end example
  9777. @item drop_odd, 2
  9778. Only output even frames, odd frames are dropped, generating a frame with
  9779. unchanged height at half frame rate.
  9780. @example
  9781. ------> time
  9782. Input:
  9783. Frame 1 Frame 2 Frame 3 Frame 4
  9784. 11111 22222 33333 44444
  9785. 11111 22222 33333 44444
  9786. 11111 22222 33333 44444
  9787. 11111 22222 33333 44444
  9788. Output:
  9789. 22222 44444
  9790. 22222 44444
  9791. 22222 44444
  9792. 22222 44444
  9793. @end example
  9794. @item pad, 3
  9795. Expand each frame to full height, but pad alternate lines with black,
  9796. generating a frame with double height at the same input frame rate.
  9797. @example
  9798. ------> time
  9799. Input:
  9800. Frame 1 Frame 2 Frame 3 Frame 4
  9801. 11111 22222 33333 44444
  9802. 11111 22222 33333 44444
  9803. 11111 22222 33333 44444
  9804. 11111 22222 33333 44444
  9805. Output:
  9806. 11111 ..... 33333 .....
  9807. ..... 22222 ..... 44444
  9808. 11111 ..... 33333 .....
  9809. ..... 22222 ..... 44444
  9810. 11111 ..... 33333 .....
  9811. ..... 22222 ..... 44444
  9812. 11111 ..... 33333 .....
  9813. ..... 22222 ..... 44444
  9814. @end example
  9815. @item interleave_top, 4
  9816. Interleave the upper field from odd frames with the lower field from
  9817. even frames, generating a frame with unchanged height at half frame rate.
  9818. @example
  9819. ------> time
  9820. Input:
  9821. Frame 1 Frame 2 Frame 3 Frame 4
  9822. 11111<- 22222 33333<- 44444
  9823. 11111 22222<- 33333 44444<-
  9824. 11111<- 22222 33333<- 44444
  9825. 11111 22222<- 33333 44444<-
  9826. Output:
  9827. 11111 33333
  9828. 22222 44444
  9829. 11111 33333
  9830. 22222 44444
  9831. @end example
  9832. @item interleave_bottom, 5
  9833. Interleave the lower field from odd frames with the upper field from
  9834. even frames, generating a frame with unchanged height at half frame rate.
  9835. @example
  9836. ------> time
  9837. Input:
  9838. Frame 1 Frame 2 Frame 3 Frame 4
  9839. 11111 22222<- 33333 44444<-
  9840. 11111<- 22222 33333<- 44444
  9841. 11111 22222<- 33333 44444<-
  9842. 11111<- 22222 33333<- 44444
  9843. Output:
  9844. 22222 44444
  9845. 11111 33333
  9846. 22222 44444
  9847. 11111 33333
  9848. @end example
  9849. @item interlacex2, 6
  9850. Double frame rate with unchanged height. Frames are inserted each
  9851. containing the second temporal field from the previous input frame and
  9852. the first temporal field from the next input frame. This mode relies on
  9853. the top_field_first flag. Useful for interlaced video displays with no
  9854. field synchronisation.
  9855. @example
  9856. ------> time
  9857. Input:
  9858. Frame 1 Frame 2 Frame 3 Frame 4
  9859. 11111 22222 33333 44444
  9860. 11111 22222 33333 44444
  9861. 11111 22222 33333 44444
  9862. 11111 22222 33333 44444
  9863. Output:
  9864. 11111 22222 22222 33333 33333 44444 44444
  9865. 11111 11111 22222 22222 33333 33333 44444
  9866. 11111 22222 22222 33333 33333 44444 44444
  9867. 11111 11111 22222 22222 33333 33333 44444
  9868. @end example
  9869. @item mergex2, 7
  9870. Move odd frames into the upper field, even into the lower field,
  9871. generating a double height frame at same frame rate.
  9872. @example
  9873. ------> time
  9874. Input:
  9875. Frame 1 Frame 2 Frame 3 Frame 4
  9876. 11111 22222 33333 44444
  9877. 11111 22222 33333 44444
  9878. 11111 22222 33333 44444
  9879. 11111 22222 33333 44444
  9880. Output:
  9881. 11111 33333 33333 55555
  9882. 22222 22222 44444 44444
  9883. 11111 33333 33333 55555
  9884. 22222 22222 44444 44444
  9885. 11111 33333 33333 55555
  9886. 22222 22222 44444 44444
  9887. 11111 33333 33333 55555
  9888. 22222 22222 44444 44444
  9889. @end example
  9890. @end table
  9891. Numeric values are deprecated but are accepted for backward
  9892. compatibility reasons.
  9893. Default mode is @code{merge}.
  9894. @item flags
  9895. Specify flags influencing the filter process.
  9896. Available value for @var{flags} is:
  9897. @table @option
  9898. @item low_pass_filter, vlfp
  9899. Enable vertical low-pass filtering in the filter.
  9900. Vertical low-pass filtering is required when creating an interlaced
  9901. destination from a progressive source which contains high-frequency
  9902. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9903. patterning.
  9904. Vertical low-pass filtering can only be enabled for @option{mode}
  9905. @var{interleave_top} and @var{interleave_bottom}.
  9906. @end table
  9907. @end table
  9908. @section transpose
  9909. Transpose rows with columns in the input video and optionally flip it.
  9910. It accepts the following parameters:
  9911. @table @option
  9912. @item dir
  9913. Specify the transposition direction.
  9914. Can assume the following values:
  9915. @table @samp
  9916. @item 0, 4, cclock_flip
  9917. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9918. @example
  9919. L.R L.l
  9920. . . -> . .
  9921. l.r R.r
  9922. @end example
  9923. @item 1, 5, clock
  9924. Rotate by 90 degrees clockwise, that is:
  9925. @example
  9926. L.R l.L
  9927. . . -> . .
  9928. l.r r.R
  9929. @end example
  9930. @item 2, 6, cclock
  9931. Rotate by 90 degrees counterclockwise, that is:
  9932. @example
  9933. L.R R.r
  9934. . . -> . .
  9935. l.r L.l
  9936. @end example
  9937. @item 3, 7, clock_flip
  9938. Rotate by 90 degrees clockwise and vertically flip, that is:
  9939. @example
  9940. L.R r.R
  9941. . . -> . .
  9942. l.r l.L
  9943. @end example
  9944. @end table
  9945. For values between 4-7, the transposition is only done if the input
  9946. video geometry is portrait and not landscape. These values are
  9947. deprecated, the @code{passthrough} option should be used instead.
  9948. Numerical values are deprecated, and should be dropped in favor of
  9949. symbolic constants.
  9950. @item passthrough
  9951. Do not apply the transposition if the input geometry matches the one
  9952. specified by the specified value. It accepts the following values:
  9953. @table @samp
  9954. @item none
  9955. Always apply transposition.
  9956. @item portrait
  9957. Preserve portrait geometry (when @var{height} >= @var{width}).
  9958. @item landscape
  9959. Preserve landscape geometry (when @var{width} >= @var{height}).
  9960. @end table
  9961. Default value is @code{none}.
  9962. @end table
  9963. For example to rotate by 90 degrees clockwise and preserve portrait
  9964. layout:
  9965. @example
  9966. transpose=dir=1:passthrough=portrait
  9967. @end example
  9968. The command above can also be specified as:
  9969. @example
  9970. transpose=1:portrait
  9971. @end example
  9972. @section trim
  9973. Trim the input so that the output contains one continuous subpart of the input.
  9974. It accepts the following parameters:
  9975. @table @option
  9976. @item start
  9977. Specify the time of the start of the kept section, i.e. the frame with the
  9978. timestamp @var{start} will be the first frame in the output.
  9979. @item end
  9980. Specify the time of the first frame that will be dropped, i.e. the frame
  9981. immediately preceding the one with the timestamp @var{end} will be the last
  9982. frame in the output.
  9983. @item start_pts
  9984. This is the same as @var{start}, except this option sets the start timestamp
  9985. in timebase units instead of seconds.
  9986. @item end_pts
  9987. This is the same as @var{end}, except this option sets the end timestamp
  9988. in timebase units instead of seconds.
  9989. @item duration
  9990. The maximum duration of the output in seconds.
  9991. @item start_frame
  9992. The number of the first frame that should be passed to the output.
  9993. @item end_frame
  9994. The number of the first frame that should be dropped.
  9995. @end table
  9996. @option{start}, @option{end}, and @option{duration} are expressed as time
  9997. duration specifications; see
  9998. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9999. for the accepted syntax.
  10000. Note that the first two sets of the start/end options and the @option{duration}
  10001. option look at the frame timestamp, while the _frame variants simply count the
  10002. frames that pass through the filter. Also note that this filter does not modify
  10003. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10004. setpts filter after the trim filter.
  10005. If multiple start or end options are set, this filter tries to be greedy and
  10006. keep all the frames that match at least one of the specified constraints. To keep
  10007. only the part that matches all the constraints at once, chain multiple trim
  10008. filters.
  10009. The defaults are such that all the input is kept. So it is possible to set e.g.
  10010. just the end values to keep everything before the specified time.
  10011. Examples:
  10012. @itemize
  10013. @item
  10014. Drop everything except the second minute of input:
  10015. @example
  10016. ffmpeg -i INPUT -vf trim=60:120
  10017. @end example
  10018. @item
  10019. Keep only the first second:
  10020. @example
  10021. ffmpeg -i INPUT -vf trim=duration=1
  10022. @end example
  10023. @end itemize
  10024. @anchor{unsharp}
  10025. @section unsharp
  10026. Sharpen or blur the input video.
  10027. It accepts the following parameters:
  10028. @table @option
  10029. @item luma_msize_x, lx
  10030. Set the luma matrix horizontal size. It must be an odd integer between
  10031. 3 and 63. The default value is 5.
  10032. @item luma_msize_y, ly
  10033. Set the luma matrix vertical size. It must be an odd integer between 3
  10034. and 63. The default value is 5.
  10035. @item luma_amount, la
  10036. Set the luma effect strength. It must be a floating point number, reasonable
  10037. values lay between -1.5 and 1.5.
  10038. Negative values will blur the input video, while positive values will
  10039. sharpen it, a value of zero will disable the effect.
  10040. Default value is 1.0.
  10041. @item chroma_msize_x, cx
  10042. Set the chroma matrix horizontal size. It must be an odd integer
  10043. between 3 and 63. The default value is 5.
  10044. @item chroma_msize_y, cy
  10045. Set the chroma matrix vertical size. It must be an odd integer
  10046. between 3 and 63. The default value is 5.
  10047. @item chroma_amount, ca
  10048. Set the chroma effect strength. It must be a floating point number, reasonable
  10049. values lay between -1.5 and 1.5.
  10050. Negative values will blur the input video, while positive values will
  10051. sharpen it, a value of zero will disable the effect.
  10052. Default value is 0.0.
  10053. @item opencl
  10054. If set to 1, specify using OpenCL capabilities, only available if
  10055. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10056. @end table
  10057. All parameters are optional and default to the equivalent of the
  10058. string '5:5:1.0:5:5:0.0'.
  10059. @subsection Examples
  10060. @itemize
  10061. @item
  10062. Apply strong luma sharpen effect:
  10063. @example
  10064. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10065. @end example
  10066. @item
  10067. Apply a strong blur of both luma and chroma parameters:
  10068. @example
  10069. unsharp=7:7:-2:7:7:-2
  10070. @end example
  10071. @end itemize
  10072. @section uspp
  10073. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10074. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10075. shifts and average the results.
  10076. The way this differs from the behavior of spp is that uspp actually encodes &
  10077. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10078. DCT similar to MJPEG.
  10079. The filter accepts the following options:
  10080. @table @option
  10081. @item quality
  10082. Set quality. This option defines the number of levels for averaging. It accepts
  10083. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10084. effect. A value of @code{8} means the higher quality. For each increment of
  10085. that value the speed drops by a factor of approximately 2. Default value is
  10086. @code{3}.
  10087. @item qp
  10088. Force a constant quantization parameter. If not set, the filter will use the QP
  10089. from the video stream (if available).
  10090. @end table
  10091. @section vectorscope
  10092. Display 2 color component values in the two dimensional graph (which is called
  10093. a vectorscope).
  10094. This filter accepts the following options:
  10095. @table @option
  10096. @item mode, m
  10097. Set vectorscope mode.
  10098. It accepts the following values:
  10099. @table @samp
  10100. @item gray
  10101. Gray values are displayed on graph, higher brightness means more pixels have
  10102. same component color value on location in graph. This is the default mode.
  10103. @item color
  10104. Gray values are displayed on graph. Surrounding pixels values which are not
  10105. present in video frame are drawn in gradient of 2 color components which are
  10106. set by option @code{x} and @code{y}. The 3rd color component is static.
  10107. @item color2
  10108. Actual color components values present in video frame are displayed on graph.
  10109. @item color3
  10110. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10111. on graph increases value of another color component, which is luminance by
  10112. default values of @code{x} and @code{y}.
  10113. @item color4
  10114. Actual colors present in video frame are displayed on graph. If two different
  10115. colors map to same position on graph then color with higher value of component
  10116. not present in graph is picked.
  10117. @item color5
  10118. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10119. component picked from radial gradient.
  10120. @end table
  10121. @item x
  10122. Set which color component will be represented on X-axis. Default is @code{1}.
  10123. @item y
  10124. Set which color component will be represented on Y-axis. Default is @code{2}.
  10125. @item intensity, i
  10126. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10127. of color component which represents frequency of (X, Y) location in graph.
  10128. @item envelope, e
  10129. @table @samp
  10130. @item none
  10131. No envelope, this is default.
  10132. @item instant
  10133. Instant envelope, even darkest single pixel will be clearly highlighted.
  10134. @item peak
  10135. Hold maximum and minimum values presented in graph over time. This way you
  10136. can still spot out of range values without constantly looking at vectorscope.
  10137. @item peak+instant
  10138. Peak and instant envelope combined together.
  10139. @end table
  10140. @item graticule, g
  10141. Set what kind of graticule to draw.
  10142. @table @samp
  10143. @item none
  10144. @item green
  10145. @item color
  10146. @end table
  10147. @item opacity, o
  10148. Set graticule opacity.
  10149. @item flags, f
  10150. Set graticule flags.
  10151. @table @samp
  10152. @item white
  10153. Draw graticule for white point.
  10154. @item black
  10155. Draw graticule for black point.
  10156. @item name
  10157. Draw color points short names.
  10158. @end table
  10159. @item bgopacity, b
  10160. Set background opacity.
  10161. @item lthreshold, l
  10162. Set low threshold for color component not represented on X or Y axis.
  10163. Values lower than this value will be ignored. Default is 0.
  10164. Note this value is multiplied with actual max possible value one pixel component
  10165. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10166. is 0.1 * 255 = 25.
  10167. @item hthreshold, h
  10168. Set high threshold for color component not represented on X or Y axis.
  10169. Values higher than this value will be ignored. Default is 1.
  10170. Note this value is multiplied with actual max possible value one pixel component
  10171. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10172. is 0.9 * 255 = 230.
  10173. @item colorspace, c
  10174. Set what kind of colorspace to use when drawing graticule.
  10175. @table @samp
  10176. @item auto
  10177. @item 601
  10178. @item 709
  10179. @end table
  10180. Default is auto.
  10181. @end table
  10182. @anchor{vidstabdetect}
  10183. @section vidstabdetect
  10184. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10185. @ref{vidstabtransform} for pass 2.
  10186. This filter generates a file with relative translation and rotation
  10187. transform information about subsequent frames, which is then used by
  10188. the @ref{vidstabtransform} filter.
  10189. To enable compilation of this filter you need to configure FFmpeg with
  10190. @code{--enable-libvidstab}.
  10191. This filter accepts the following options:
  10192. @table @option
  10193. @item result
  10194. Set the path to the file used to write the transforms information.
  10195. Default value is @file{transforms.trf}.
  10196. @item shakiness
  10197. Set how shaky the video is and how quick the camera is. It accepts an
  10198. integer in the range 1-10, a value of 1 means little shakiness, a
  10199. value of 10 means strong shakiness. Default value is 5.
  10200. @item accuracy
  10201. Set the accuracy of the detection process. It must be a value in the
  10202. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10203. accuracy. Default value is 15.
  10204. @item stepsize
  10205. Set stepsize of the search process. The region around minimum is
  10206. scanned with 1 pixel resolution. Default value is 6.
  10207. @item mincontrast
  10208. Set minimum contrast. Below this value a local measurement field is
  10209. discarded. Must be a floating point value in the range 0-1. Default
  10210. value is 0.3.
  10211. @item tripod
  10212. Set reference frame number for tripod mode.
  10213. If enabled, the motion of the frames is compared to a reference frame
  10214. in the filtered stream, identified by the specified number. The idea
  10215. is to compensate all movements in a more-or-less static scene and keep
  10216. the camera view absolutely still.
  10217. If set to 0, it is disabled. The frames are counted starting from 1.
  10218. @item show
  10219. Show fields and transforms in the resulting frames. It accepts an
  10220. integer in the range 0-2. Default value is 0, which disables any
  10221. visualization.
  10222. @end table
  10223. @subsection Examples
  10224. @itemize
  10225. @item
  10226. Use default values:
  10227. @example
  10228. vidstabdetect
  10229. @end example
  10230. @item
  10231. Analyze strongly shaky movie and put the results in file
  10232. @file{mytransforms.trf}:
  10233. @example
  10234. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10235. @end example
  10236. @item
  10237. Visualize the result of internal transformations in the resulting
  10238. video:
  10239. @example
  10240. vidstabdetect=show=1
  10241. @end example
  10242. @item
  10243. Analyze a video with medium shakiness using @command{ffmpeg}:
  10244. @example
  10245. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10246. @end example
  10247. @end itemize
  10248. @anchor{vidstabtransform}
  10249. @section vidstabtransform
  10250. Video stabilization/deshaking: pass 2 of 2,
  10251. see @ref{vidstabdetect} for pass 1.
  10252. Read a file with transform information for each frame and
  10253. apply/compensate them. Together with the @ref{vidstabdetect}
  10254. filter this can be used to deshake videos. See also
  10255. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10256. the @ref{unsharp} filter, see below.
  10257. To enable compilation of this filter you need to configure FFmpeg with
  10258. @code{--enable-libvidstab}.
  10259. @subsection Options
  10260. @table @option
  10261. @item input
  10262. Set path to the file used to read the transforms. Default value is
  10263. @file{transforms.trf}.
  10264. @item smoothing
  10265. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10266. camera movements. Default value is 10.
  10267. For example a number of 10 means that 21 frames are used (10 in the
  10268. past and 10 in the future) to smoothen the motion in the video. A
  10269. larger value leads to a smoother video, but limits the acceleration of
  10270. the camera (pan/tilt movements). 0 is a special case where a static
  10271. camera is simulated.
  10272. @item optalgo
  10273. Set the camera path optimization algorithm.
  10274. Accepted values are:
  10275. @table @samp
  10276. @item gauss
  10277. gaussian kernel low-pass filter on camera motion (default)
  10278. @item avg
  10279. averaging on transformations
  10280. @end table
  10281. @item maxshift
  10282. Set maximal number of pixels to translate frames. Default value is -1,
  10283. meaning no limit.
  10284. @item maxangle
  10285. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10286. value is -1, meaning no limit.
  10287. @item crop
  10288. Specify how to deal with borders that may be visible due to movement
  10289. compensation.
  10290. Available values are:
  10291. @table @samp
  10292. @item keep
  10293. keep image information from previous frame (default)
  10294. @item black
  10295. fill the border black
  10296. @end table
  10297. @item invert
  10298. Invert transforms if set to 1. Default value is 0.
  10299. @item relative
  10300. Consider transforms as relative to previous frame if set to 1,
  10301. absolute if set to 0. Default value is 0.
  10302. @item zoom
  10303. Set percentage to zoom. A positive value will result in a zoom-in
  10304. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10305. zoom).
  10306. @item optzoom
  10307. Set optimal zooming to avoid borders.
  10308. Accepted values are:
  10309. @table @samp
  10310. @item 0
  10311. disabled
  10312. @item 1
  10313. optimal static zoom value is determined (only very strong movements
  10314. will lead to visible borders) (default)
  10315. @item 2
  10316. optimal adaptive zoom value is determined (no borders will be
  10317. visible), see @option{zoomspeed}
  10318. @end table
  10319. Note that the value given at zoom is added to the one calculated here.
  10320. @item zoomspeed
  10321. Set percent to zoom maximally each frame (enabled when
  10322. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10323. 0.25.
  10324. @item interpol
  10325. Specify type of interpolation.
  10326. Available values are:
  10327. @table @samp
  10328. @item no
  10329. no interpolation
  10330. @item linear
  10331. linear only horizontal
  10332. @item bilinear
  10333. linear in both directions (default)
  10334. @item bicubic
  10335. cubic in both directions (slow)
  10336. @end table
  10337. @item tripod
  10338. Enable virtual tripod mode if set to 1, which is equivalent to
  10339. @code{relative=0:smoothing=0}. Default value is 0.
  10340. Use also @code{tripod} option of @ref{vidstabdetect}.
  10341. @item debug
  10342. Increase log verbosity if set to 1. Also the detected global motions
  10343. are written to the temporary file @file{global_motions.trf}. Default
  10344. value is 0.
  10345. @end table
  10346. @subsection Examples
  10347. @itemize
  10348. @item
  10349. Use @command{ffmpeg} for a typical stabilization with default values:
  10350. @example
  10351. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10352. @end example
  10353. Note the use of the @ref{unsharp} filter which is always recommended.
  10354. @item
  10355. Zoom in a bit more and load transform data from a given file:
  10356. @example
  10357. vidstabtransform=zoom=5:input="mytransforms.trf"
  10358. @end example
  10359. @item
  10360. Smoothen the video even more:
  10361. @example
  10362. vidstabtransform=smoothing=30
  10363. @end example
  10364. @end itemize
  10365. @section vflip
  10366. Flip the input video vertically.
  10367. For example, to vertically flip a video with @command{ffmpeg}:
  10368. @example
  10369. ffmpeg -i in.avi -vf "vflip" out.avi
  10370. @end example
  10371. @anchor{vignette}
  10372. @section vignette
  10373. Make or reverse a natural vignetting effect.
  10374. The filter accepts the following options:
  10375. @table @option
  10376. @item angle, a
  10377. Set lens angle expression as a number of radians.
  10378. The value is clipped in the @code{[0,PI/2]} range.
  10379. Default value: @code{"PI/5"}
  10380. @item x0
  10381. @item y0
  10382. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10383. by default.
  10384. @item mode
  10385. Set forward/backward mode.
  10386. Available modes are:
  10387. @table @samp
  10388. @item forward
  10389. The larger the distance from the central point, the darker the image becomes.
  10390. @item backward
  10391. The larger the distance from the central point, the brighter the image becomes.
  10392. This can be used to reverse a vignette effect, though there is no automatic
  10393. detection to extract the lens @option{angle} and other settings (yet). It can
  10394. also be used to create a burning effect.
  10395. @end table
  10396. Default value is @samp{forward}.
  10397. @item eval
  10398. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10399. It accepts the following values:
  10400. @table @samp
  10401. @item init
  10402. Evaluate expressions only once during the filter initialization.
  10403. @item frame
  10404. Evaluate expressions for each incoming frame. This is way slower than the
  10405. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10406. allows advanced dynamic expressions.
  10407. @end table
  10408. Default value is @samp{init}.
  10409. @item dither
  10410. Set dithering to reduce the circular banding effects. Default is @code{1}
  10411. (enabled).
  10412. @item aspect
  10413. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10414. Setting this value to the SAR of the input will make a rectangular vignetting
  10415. following the dimensions of the video.
  10416. Default is @code{1/1}.
  10417. @end table
  10418. @subsection Expressions
  10419. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10420. following parameters.
  10421. @table @option
  10422. @item w
  10423. @item h
  10424. input width and height
  10425. @item n
  10426. the number of input frame, starting from 0
  10427. @item pts
  10428. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10429. @var{TB} units, NAN if undefined
  10430. @item r
  10431. frame rate of the input video, NAN if the input frame rate is unknown
  10432. @item t
  10433. the PTS (Presentation TimeStamp) of the filtered video frame,
  10434. expressed in seconds, NAN if undefined
  10435. @item tb
  10436. time base of the input video
  10437. @end table
  10438. @subsection Examples
  10439. @itemize
  10440. @item
  10441. Apply simple strong vignetting effect:
  10442. @example
  10443. vignette=PI/4
  10444. @end example
  10445. @item
  10446. Make a flickering vignetting:
  10447. @example
  10448. vignette='PI/4+random(1)*PI/50':eval=frame
  10449. @end example
  10450. @end itemize
  10451. @section vstack
  10452. Stack input videos vertically.
  10453. All streams must be of same pixel format and of same width.
  10454. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10455. to create same output.
  10456. The filter accept the following option:
  10457. @table @option
  10458. @item inputs
  10459. Set number of input streams. Default is 2.
  10460. @item shortest
  10461. If set to 1, force the output to terminate when the shortest input
  10462. terminates. Default value is 0.
  10463. @end table
  10464. @section w3fdif
  10465. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10466. Deinterlacing Filter").
  10467. Based on the process described by Martin Weston for BBC R&D, and
  10468. implemented based on the de-interlace algorithm written by Jim
  10469. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10470. uses filter coefficients calculated by BBC R&D.
  10471. There are two sets of filter coefficients, so called "simple":
  10472. and "complex". Which set of filter coefficients is used can
  10473. be set by passing an optional parameter:
  10474. @table @option
  10475. @item filter
  10476. Set the interlacing filter coefficients. Accepts one of the following values:
  10477. @table @samp
  10478. @item simple
  10479. Simple filter coefficient set.
  10480. @item complex
  10481. More-complex filter coefficient set.
  10482. @end table
  10483. Default value is @samp{complex}.
  10484. @item deint
  10485. Specify which frames to deinterlace. Accept one of the following values:
  10486. @table @samp
  10487. @item all
  10488. Deinterlace all frames,
  10489. @item interlaced
  10490. Only deinterlace frames marked as interlaced.
  10491. @end table
  10492. Default value is @samp{all}.
  10493. @end table
  10494. @section waveform
  10495. Video waveform monitor.
  10496. The waveform monitor plots color component intensity. By default luminance
  10497. only. Each column of the waveform corresponds to a column of pixels in the
  10498. source video.
  10499. It accepts the following options:
  10500. @table @option
  10501. @item mode, m
  10502. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10503. In row mode, the graph on the left side represents color component value 0 and
  10504. the right side represents value = 255. In column mode, the top side represents
  10505. color component value = 0 and bottom side represents value = 255.
  10506. @item intensity, i
  10507. Set intensity. Smaller values are useful to find out how many values of the same
  10508. luminance are distributed across input rows/columns.
  10509. Default value is @code{0.04}. Allowed range is [0, 1].
  10510. @item mirror, r
  10511. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10512. In mirrored mode, higher values will be represented on the left
  10513. side for @code{row} mode and at the top for @code{column} mode. Default is
  10514. @code{1} (mirrored).
  10515. @item display, d
  10516. Set display mode.
  10517. It accepts the following values:
  10518. @table @samp
  10519. @item overlay
  10520. Presents information identical to that in the @code{parade}, except
  10521. that the graphs representing color components are superimposed directly
  10522. over one another.
  10523. This display mode makes it easier to spot relative differences or similarities
  10524. in overlapping areas of the color components that are supposed to be identical,
  10525. such as neutral whites, grays, or blacks.
  10526. @item stack
  10527. Display separate graph for the color components side by side in
  10528. @code{row} mode or one below the other in @code{column} mode.
  10529. @item parade
  10530. Display separate graph for the color components side by side in
  10531. @code{column} mode or one below the other in @code{row} mode.
  10532. Using this display mode makes it easy to spot color casts in the highlights
  10533. and shadows of an image, by comparing the contours of the top and the bottom
  10534. graphs of each waveform. Since whites, grays, and blacks are characterized
  10535. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10536. should display three waveforms of roughly equal width/height. If not, the
  10537. correction is easy to perform by making level adjustments the three waveforms.
  10538. @end table
  10539. Default is @code{stack}.
  10540. @item components, c
  10541. Set which color components to display. Default is 1, which means only luminance
  10542. or red color component if input is in RGB colorspace. If is set for example to
  10543. 7 it will display all 3 (if) available color components.
  10544. @item envelope, e
  10545. @table @samp
  10546. @item none
  10547. No envelope, this is default.
  10548. @item instant
  10549. Instant envelope, minimum and maximum values presented in graph will be easily
  10550. visible even with small @code{step} value.
  10551. @item peak
  10552. Hold minimum and maximum values presented in graph across time. This way you
  10553. can still spot out of range values without constantly looking at waveforms.
  10554. @item peak+instant
  10555. Peak and instant envelope combined together.
  10556. @end table
  10557. @item filter, f
  10558. @table @samp
  10559. @item lowpass
  10560. No filtering, this is default.
  10561. @item flat
  10562. Luma and chroma combined together.
  10563. @item aflat
  10564. Similar as above, but shows difference between blue and red chroma.
  10565. @item chroma
  10566. Displays only chroma.
  10567. @item color
  10568. Displays actual color value on waveform.
  10569. @item acolor
  10570. Similar as above, but with luma showing frequency of chroma values.
  10571. @end table
  10572. @item graticule, g
  10573. Set which graticule to display.
  10574. @table @samp
  10575. @item none
  10576. Do not display graticule.
  10577. @item green
  10578. Display green graticule showing legal broadcast ranges.
  10579. @end table
  10580. @item opacity, o
  10581. Set graticule opacity.
  10582. @item flags, fl
  10583. Set graticule flags.
  10584. @table @samp
  10585. @item numbers
  10586. Draw numbers above lines. By default enabled.
  10587. @item dots
  10588. Draw dots instead of lines.
  10589. @end table
  10590. @item scale, s
  10591. Set scale used for displaying graticule.
  10592. @table @samp
  10593. @item digital
  10594. @item millivolts
  10595. @item ire
  10596. @end table
  10597. Default is digital.
  10598. @end table
  10599. @section xbr
  10600. Apply the xBR high-quality magnification filter which is designed for pixel
  10601. art. It follows a set of edge-detection rules, see
  10602. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10603. It accepts the following option:
  10604. @table @option
  10605. @item n
  10606. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10607. @code{3xBR} and @code{4} for @code{4xBR}.
  10608. Default is @code{3}.
  10609. @end table
  10610. @anchor{yadif}
  10611. @section yadif
  10612. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10613. filter").
  10614. It accepts the following parameters:
  10615. @table @option
  10616. @item mode
  10617. The interlacing mode to adopt. It accepts one of the following values:
  10618. @table @option
  10619. @item 0, send_frame
  10620. Output one frame for each frame.
  10621. @item 1, send_field
  10622. Output one frame for each field.
  10623. @item 2, send_frame_nospatial
  10624. Like @code{send_frame}, but it skips the spatial interlacing check.
  10625. @item 3, send_field_nospatial
  10626. Like @code{send_field}, but it skips the spatial interlacing check.
  10627. @end table
  10628. The default value is @code{send_frame}.
  10629. @item parity
  10630. The picture field parity assumed for the input interlaced video. It accepts one
  10631. of the following values:
  10632. @table @option
  10633. @item 0, tff
  10634. Assume the top field is first.
  10635. @item 1, bff
  10636. Assume the bottom field is first.
  10637. @item -1, auto
  10638. Enable automatic detection of field parity.
  10639. @end table
  10640. The default value is @code{auto}.
  10641. If the interlacing is unknown or the decoder does not export this information,
  10642. top field first will be assumed.
  10643. @item deint
  10644. Specify which frames to deinterlace. Accept one of the following
  10645. values:
  10646. @table @option
  10647. @item 0, all
  10648. Deinterlace all frames.
  10649. @item 1, interlaced
  10650. Only deinterlace frames marked as interlaced.
  10651. @end table
  10652. The default value is @code{all}.
  10653. @end table
  10654. @section zoompan
  10655. Apply Zoom & Pan effect.
  10656. This filter accepts the following options:
  10657. @table @option
  10658. @item zoom, z
  10659. Set the zoom expression. Default is 1.
  10660. @item x
  10661. @item y
  10662. Set the x and y expression. Default is 0.
  10663. @item d
  10664. Set the duration expression in number of frames.
  10665. This sets for how many number of frames effect will last for
  10666. single input image.
  10667. @item s
  10668. Set the output image size, default is 'hd720'.
  10669. @item fps
  10670. Set the output frame rate, default is '25'.
  10671. @end table
  10672. Each expression can contain the following constants:
  10673. @table @option
  10674. @item in_w, iw
  10675. Input width.
  10676. @item in_h, ih
  10677. Input height.
  10678. @item out_w, ow
  10679. Output width.
  10680. @item out_h, oh
  10681. Output height.
  10682. @item in
  10683. Input frame count.
  10684. @item on
  10685. Output frame count.
  10686. @item x
  10687. @item y
  10688. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10689. for current input frame.
  10690. @item px
  10691. @item py
  10692. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10693. not yet such frame (first input frame).
  10694. @item zoom
  10695. Last calculated zoom from 'z' expression for current input frame.
  10696. @item pzoom
  10697. Last calculated zoom of last output frame of previous input frame.
  10698. @item duration
  10699. Number of output frames for current input frame. Calculated from 'd' expression
  10700. for each input frame.
  10701. @item pduration
  10702. number of output frames created for previous input frame
  10703. @item a
  10704. Rational number: input width / input height
  10705. @item sar
  10706. sample aspect ratio
  10707. @item dar
  10708. display aspect ratio
  10709. @end table
  10710. @subsection Examples
  10711. @itemize
  10712. @item
  10713. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10714. @example
  10715. 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
  10716. @end example
  10717. @item
  10718. Zoom-in up to 1.5 and pan always at center of picture:
  10719. @example
  10720. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10721. @end example
  10722. @item
  10723. Same as above but without pausing:
  10724. @example
  10725. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10726. @end example
  10727. @end itemize
  10728. @section zscale
  10729. Scale (resize) the input video, using the z.lib library:
  10730. https://github.com/sekrit-twc/zimg.
  10731. The zscale filter forces the output display aspect ratio to be the same
  10732. as the input, by changing the output sample aspect ratio.
  10733. If the input image format is different from the format requested by
  10734. the next filter, the zscale filter will convert the input to the
  10735. requested format.
  10736. @subsection Options
  10737. The filter accepts the following options.
  10738. @table @option
  10739. @item width, w
  10740. @item height, h
  10741. Set the output video dimension expression. Default value is the input
  10742. dimension.
  10743. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10744. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10745. If one of the values is -1, the zscale filter will use a value that
  10746. maintains the aspect ratio of the input image, calculated from the
  10747. other specified dimension. If both of them are -1, the input size is
  10748. used
  10749. If one of the values is -n with n > 1, the zscale filter will also use a value
  10750. that maintains the aspect ratio of the input image, calculated from the other
  10751. specified dimension. After that it will, however, make sure that the calculated
  10752. dimension is divisible by n and adjust the value if necessary.
  10753. See below for the list of accepted constants for use in the dimension
  10754. expression.
  10755. @item size, s
  10756. Set the video size. For the syntax of this option, check the
  10757. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10758. @item dither, d
  10759. Set the dither type.
  10760. Possible values are:
  10761. @table @var
  10762. @item none
  10763. @item ordered
  10764. @item random
  10765. @item error_diffusion
  10766. @end table
  10767. Default is none.
  10768. @item filter, f
  10769. Set the resize filter type.
  10770. Possible values are:
  10771. @table @var
  10772. @item point
  10773. @item bilinear
  10774. @item bicubic
  10775. @item spline16
  10776. @item spline36
  10777. @item lanczos
  10778. @end table
  10779. Default is bilinear.
  10780. @item range, r
  10781. Set the color range.
  10782. Possible values are:
  10783. @table @var
  10784. @item input
  10785. @item limited
  10786. @item full
  10787. @end table
  10788. Default is same as input.
  10789. @item primaries, p
  10790. Set the color primaries.
  10791. Possible values are:
  10792. @table @var
  10793. @item input
  10794. @item 709
  10795. @item unspecified
  10796. @item 170m
  10797. @item 240m
  10798. @item 2020
  10799. @end table
  10800. Default is same as input.
  10801. @item transfer, t
  10802. Set the transfer characteristics.
  10803. Possible values are:
  10804. @table @var
  10805. @item input
  10806. @item 709
  10807. @item unspecified
  10808. @item 601
  10809. @item linear
  10810. @item 2020_10
  10811. @item 2020_12
  10812. @end table
  10813. Default is same as input.
  10814. @item matrix, m
  10815. Set the colorspace matrix.
  10816. Possible value are:
  10817. @table @var
  10818. @item input
  10819. @item 709
  10820. @item unspecified
  10821. @item 470bg
  10822. @item 170m
  10823. @item 2020_ncl
  10824. @item 2020_cl
  10825. @end table
  10826. Default is same as input.
  10827. @item rangein, rin
  10828. Set the input color range.
  10829. Possible values are:
  10830. @table @var
  10831. @item input
  10832. @item limited
  10833. @item full
  10834. @end table
  10835. Default is same as input.
  10836. @item primariesin, pin
  10837. Set the input color primaries.
  10838. Possible values are:
  10839. @table @var
  10840. @item input
  10841. @item 709
  10842. @item unspecified
  10843. @item 170m
  10844. @item 240m
  10845. @item 2020
  10846. @end table
  10847. Default is same as input.
  10848. @item transferin, tin
  10849. Set the input transfer characteristics.
  10850. Possible values are:
  10851. @table @var
  10852. @item input
  10853. @item 709
  10854. @item unspecified
  10855. @item 601
  10856. @item linear
  10857. @item 2020_10
  10858. @item 2020_12
  10859. @end table
  10860. Default is same as input.
  10861. @item matrixin, min
  10862. Set the input colorspace matrix.
  10863. Possible value are:
  10864. @table @var
  10865. @item input
  10866. @item 709
  10867. @item unspecified
  10868. @item 470bg
  10869. @item 170m
  10870. @item 2020_ncl
  10871. @item 2020_cl
  10872. @end table
  10873. @end table
  10874. The values of the @option{w} and @option{h} options are expressions
  10875. containing the following constants:
  10876. @table @var
  10877. @item in_w
  10878. @item in_h
  10879. The input width and height
  10880. @item iw
  10881. @item ih
  10882. These are the same as @var{in_w} and @var{in_h}.
  10883. @item out_w
  10884. @item out_h
  10885. The output (scaled) width and height
  10886. @item ow
  10887. @item oh
  10888. These are the same as @var{out_w} and @var{out_h}
  10889. @item a
  10890. The same as @var{iw} / @var{ih}
  10891. @item sar
  10892. input sample aspect ratio
  10893. @item dar
  10894. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10895. @item hsub
  10896. @item vsub
  10897. horizontal and vertical input chroma subsample values. For example for the
  10898. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10899. @item ohsub
  10900. @item ovsub
  10901. horizontal and vertical output chroma subsample values. For example for the
  10902. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10903. @end table
  10904. @table @option
  10905. @end table
  10906. @c man end VIDEO FILTERS
  10907. @chapter Video Sources
  10908. @c man begin VIDEO SOURCES
  10909. Below is a description of the currently available video sources.
  10910. @section buffer
  10911. Buffer video frames, and make them available to the filter chain.
  10912. This source is mainly intended for a programmatic use, in particular
  10913. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10914. It accepts the following parameters:
  10915. @table @option
  10916. @item video_size
  10917. Specify the size (width and height) of the buffered video frames. For the
  10918. syntax of this option, check the
  10919. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10920. @item width
  10921. The input video width.
  10922. @item height
  10923. The input video height.
  10924. @item pix_fmt
  10925. A string representing the pixel format of the buffered video frames.
  10926. It may be a number corresponding to a pixel format, or a pixel format
  10927. name.
  10928. @item time_base
  10929. Specify the timebase assumed by the timestamps of the buffered frames.
  10930. @item frame_rate
  10931. Specify the frame rate expected for the video stream.
  10932. @item pixel_aspect, sar
  10933. The sample (pixel) aspect ratio of the input video.
  10934. @item sws_param
  10935. Specify the optional parameters to be used for the scale filter which
  10936. is automatically inserted when an input change is detected in the
  10937. input size or format.
  10938. @item hw_frames_ctx
  10939. When using a hardware pixel format, this should be a reference to an
  10940. AVHWFramesContext describing input frames.
  10941. @end table
  10942. For example:
  10943. @example
  10944. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10945. @end example
  10946. will instruct the source to accept video frames with size 320x240 and
  10947. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10948. square pixels (1:1 sample aspect ratio).
  10949. Since the pixel format with name "yuv410p" corresponds to the number 6
  10950. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10951. this example corresponds to:
  10952. @example
  10953. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10954. @end example
  10955. Alternatively, the options can be specified as a flat string, but this
  10956. syntax is deprecated:
  10957. @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}]
  10958. @section cellauto
  10959. Create a pattern generated by an elementary cellular automaton.
  10960. The initial state of the cellular automaton can be defined through the
  10961. @option{filename}, and @option{pattern} options. If such options are
  10962. not specified an initial state is created randomly.
  10963. At each new frame a new row in the video is filled with the result of
  10964. the cellular automaton next generation. The behavior when the whole
  10965. frame is filled is defined by the @option{scroll} option.
  10966. This source accepts the following options:
  10967. @table @option
  10968. @item filename, f
  10969. Read the initial cellular automaton state, i.e. the starting row, from
  10970. the specified file.
  10971. In the file, each non-whitespace character is considered an alive
  10972. cell, a newline will terminate the row, and further characters in the
  10973. file will be ignored.
  10974. @item pattern, p
  10975. Read the initial cellular automaton state, i.e. the starting row, from
  10976. the specified string.
  10977. Each non-whitespace character in the string is considered an alive
  10978. cell, a newline will terminate the row, and further characters in the
  10979. string will be ignored.
  10980. @item rate, r
  10981. Set the video rate, that is the number of frames generated per second.
  10982. Default is 25.
  10983. @item random_fill_ratio, ratio
  10984. Set the random fill ratio for the initial cellular automaton row. It
  10985. is a floating point number value ranging from 0 to 1, defaults to
  10986. 1/PHI.
  10987. This option is ignored when a file or a pattern is specified.
  10988. @item random_seed, seed
  10989. Set the seed for filling randomly the initial row, must be an integer
  10990. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10991. set to -1, the filter will try to use a good random seed on a best
  10992. effort basis.
  10993. @item rule
  10994. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10995. Default value is 110.
  10996. @item size, s
  10997. Set the size of the output video. For the syntax of this option, check the
  10998. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10999. If @option{filename} or @option{pattern} is specified, the size is set
  11000. by default to the width of the specified initial state row, and the
  11001. height is set to @var{width} * PHI.
  11002. If @option{size} is set, it must contain the width of the specified
  11003. pattern string, and the specified pattern will be centered in the
  11004. larger row.
  11005. If a filename or a pattern string is not specified, the size value
  11006. defaults to "320x518" (used for a randomly generated initial state).
  11007. @item scroll
  11008. If set to 1, scroll the output upward when all the rows in the output
  11009. have been already filled. If set to 0, the new generated row will be
  11010. written over the top row just after the bottom row is filled.
  11011. Defaults to 1.
  11012. @item start_full, full
  11013. If set to 1, completely fill the output with generated rows before
  11014. outputting the first frame.
  11015. This is the default behavior, for disabling set the value to 0.
  11016. @item stitch
  11017. If set to 1, stitch the left and right row edges together.
  11018. This is the default behavior, for disabling set the value to 0.
  11019. @end table
  11020. @subsection Examples
  11021. @itemize
  11022. @item
  11023. Read the initial state from @file{pattern}, and specify an output of
  11024. size 200x400.
  11025. @example
  11026. cellauto=f=pattern:s=200x400
  11027. @end example
  11028. @item
  11029. Generate a random initial row with a width of 200 cells, with a fill
  11030. ratio of 2/3:
  11031. @example
  11032. cellauto=ratio=2/3:s=200x200
  11033. @end example
  11034. @item
  11035. Create a pattern generated by rule 18 starting by a single alive cell
  11036. centered on an initial row with width 100:
  11037. @example
  11038. cellauto=p=@@:s=100x400:full=0:rule=18
  11039. @end example
  11040. @item
  11041. Specify a more elaborated initial pattern:
  11042. @example
  11043. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11044. @end example
  11045. @end itemize
  11046. @anchor{coreimagesrc}
  11047. @section coreimagesrc
  11048. Video source generated on GPU using Apple's CoreImage API on OSX.
  11049. This video source is a specialized version of the @ref{coreimage} video filter.
  11050. Use a core image generator at the beginning of the applied filterchain to
  11051. generate the content.
  11052. The coreimagesrc video source accepts the following options:
  11053. @table @option
  11054. @item list_generators
  11055. List all available generators along with all their respective options as well as
  11056. possible minimum and maximum values along with the default values.
  11057. @example
  11058. list_generators=true
  11059. @end example
  11060. @item size, s
  11061. Specify the size of the sourced video. For the syntax of this option, check the
  11062. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11063. The default value is @code{320x240}.
  11064. @item rate, r
  11065. Specify the frame rate of the sourced video, as the number of frames
  11066. generated per second. It has to be a string in the format
  11067. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11068. number or a valid video frame rate abbreviation. The default value is
  11069. "25".
  11070. @item sar
  11071. Set the sample aspect ratio of the sourced video.
  11072. @item duration, d
  11073. Set the duration of the sourced video. See
  11074. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11075. for the accepted syntax.
  11076. If not specified, or the expressed duration is negative, the video is
  11077. supposed to be generated forever.
  11078. @end table
  11079. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11080. A complete filterchain can be used for further processing of the
  11081. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11082. and examples for details.
  11083. @subsection Examples
  11084. @itemize
  11085. @item
  11086. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11087. given as complete and escaped command-line for Apple's standard bash shell:
  11088. @example
  11089. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11090. @end example
  11091. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11092. need for a nullsrc video source.
  11093. @end itemize
  11094. @section mandelbrot
  11095. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11096. point specified with @var{start_x} and @var{start_y}.
  11097. This source accepts the following options:
  11098. @table @option
  11099. @item end_pts
  11100. Set the terminal pts value. Default value is 400.
  11101. @item end_scale
  11102. Set the terminal scale value.
  11103. Must be a floating point value. Default value is 0.3.
  11104. @item inner
  11105. Set the inner coloring mode, that is the algorithm used to draw the
  11106. Mandelbrot fractal internal region.
  11107. It shall assume one of the following values:
  11108. @table @option
  11109. @item black
  11110. Set black mode.
  11111. @item convergence
  11112. Show time until convergence.
  11113. @item mincol
  11114. Set color based on point closest to the origin of the iterations.
  11115. @item period
  11116. Set period mode.
  11117. @end table
  11118. Default value is @var{mincol}.
  11119. @item bailout
  11120. Set the bailout value. Default value is 10.0.
  11121. @item maxiter
  11122. Set the maximum of iterations performed by the rendering
  11123. algorithm. Default value is 7189.
  11124. @item outer
  11125. Set outer coloring mode.
  11126. It shall assume one of following values:
  11127. @table @option
  11128. @item iteration_count
  11129. Set iteration cound mode.
  11130. @item normalized_iteration_count
  11131. set normalized iteration count mode.
  11132. @end table
  11133. Default value is @var{normalized_iteration_count}.
  11134. @item rate, r
  11135. Set frame rate, expressed as number of frames per second. Default
  11136. value is "25".
  11137. @item size, s
  11138. Set frame size. For the syntax of this option, check the "Video
  11139. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11140. @item start_scale
  11141. Set the initial scale value. Default value is 3.0.
  11142. @item start_x
  11143. Set the initial x position. Must be a floating point value between
  11144. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11145. @item start_y
  11146. Set the initial y position. Must be a floating point value between
  11147. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11148. @end table
  11149. @section mptestsrc
  11150. Generate various test patterns, as generated by the MPlayer test filter.
  11151. The size of the generated video is fixed, and is 256x256.
  11152. This source is useful in particular for testing encoding features.
  11153. This source accepts the following options:
  11154. @table @option
  11155. @item rate, r
  11156. Specify the frame rate of the sourced video, as the number of frames
  11157. generated per second. It has to be a string in the format
  11158. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11159. number or a valid video frame rate abbreviation. The default value is
  11160. "25".
  11161. @item duration, d
  11162. Set the duration of the sourced video. See
  11163. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11164. for the accepted syntax.
  11165. If not specified, or the expressed duration is negative, the video is
  11166. supposed to be generated forever.
  11167. @item test, t
  11168. Set the number or the name of the test to perform. Supported tests are:
  11169. @table @option
  11170. @item dc_luma
  11171. @item dc_chroma
  11172. @item freq_luma
  11173. @item freq_chroma
  11174. @item amp_luma
  11175. @item amp_chroma
  11176. @item cbp
  11177. @item mv
  11178. @item ring1
  11179. @item ring2
  11180. @item all
  11181. @end table
  11182. Default value is "all", which will cycle through the list of all tests.
  11183. @end table
  11184. Some examples:
  11185. @example
  11186. mptestsrc=t=dc_luma
  11187. @end example
  11188. will generate a "dc_luma" test pattern.
  11189. @section frei0r_src
  11190. Provide a frei0r source.
  11191. To enable compilation of this filter you need to install the frei0r
  11192. header and configure FFmpeg with @code{--enable-frei0r}.
  11193. This source accepts the following parameters:
  11194. @table @option
  11195. @item size
  11196. The size of the video to generate. For the syntax of this option, check the
  11197. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11198. @item framerate
  11199. The framerate of the generated video. It may be a string of the form
  11200. @var{num}/@var{den} or a frame rate abbreviation.
  11201. @item filter_name
  11202. The name to the frei0r source to load. For more information regarding frei0r and
  11203. how to set the parameters, read the @ref{frei0r} section in the video filters
  11204. documentation.
  11205. @item filter_params
  11206. A '|'-separated list of parameters to pass to the frei0r source.
  11207. @end table
  11208. For example, to generate a frei0r partik0l source with size 200x200
  11209. and frame rate 10 which is overlaid on the overlay filter main input:
  11210. @example
  11211. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11212. @end example
  11213. @section life
  11214. Generate a life pattern.
  11215. This source is based on a generalization of John Conway's life game.
  11216. The sourced input represents a life grid, each pixel represents a cell
  11217. which can be in one of two possible states, alive or dead. Every cell
  11218. interacts with its eight neighbours, which are the cells that are
  11219. horizontally, vertically, or diagonally adjacent.
  11220. At each interaction the grid evolves according to the adopted rule,
  11221. which specifies the number of neighbor alive cells which will make a
  11222. cell stay alive or born. The @option{rule} option allows one to specify
  11223. the rule to adopt.
  11224. This source accepts the following options:
  11225. @table @option
  11226. @item filename, f
  11227. Set the file from which to read the initial grid state. In the file,
  11228. each non-whitespace character is considered an alive cell, and newline
  11229. is used to delimit the end of each row.
  11230. If this option is not specified, the initial grid is generated
  11231. randomly.
  11232. @item rate, r
  11233. Set the video rate, that is the number of frames generated per second.
  11234. Default is 25.
  11235. @item random_fill_ratio, ratio
  11236. Set the random fill ratio for the initial random grid. It is a
  11237. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11238. It is ignored when a file is specified.
  11239. @item random_seed, seed
  11240. Set the seed for filling the initial random grid, must be an integer
  11241. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11242. set to -1, the filter will try to use a good random seed on a best
  11243. effort basis.
  11244. @item rule
  11245. Set the life rule.
  11246. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11247. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11248. @var{NS} specifies the number of alive neighbor cells which make a
  11249. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11250. which make a dead cell to become alive (i.e. to "born").
  11251. "s" and "b" can be used in place of "S" and "B", respectively.
  11252. Alternatively a rule can be specified by an 18-bits integer. The 9
  11253. high order bits are used to encode the next cell state if it is alive
  11254. for each number of neighbor alive cells, the low order bits specify
  11255. the rule for "borning" new cells. Higher order bits encode for an
  11256. higher number of neighbor cells.
  11257. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11258. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11259. Default value is "S23/B3", which is the original Conway's game of life
  11260. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11261. cells, and will born a new cell if there are three alive cells around
  11262. a dead cell.
  11263. @item size, s
  11264. Set the size of the output video. For the syntax of this option, check the
  11265. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11266. If @option{filename} is specified, the size is set by default to the
  11267. same size of the input file. If @option{size} is set, it must contain
  11268. the size specified in the input file, and the initial grid defined in
  11269. that file is centered in the larger resulting area.
  11270. If a filename is not specified, the size value defaults to "320x240"
  11271. (used for a randomly generated initial grid).
  11272. @item stitch
  11273. If set to 1, stitch the left and right grid edges together, and the
  11274. top and bottom edges also. Defaults to 1.
  11275. @item mold
  11276. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11277. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11278. value from 0 to 255.
  11279. @item life_color
  11280. Set the color of living (or new born) cells.
  11281. @item death_color
  11282. Set the color of dead cells. If @option{mold} is set, this is the first color
  11283. used to represent a dead cell.
  11284. @item mold_color
  11285. Set mold color, for definitely dead and moldy cells.
  11286. For the syntax of these 3 color options, check the "Color" section in the
  11287. ffmpeg-utils manual.
  11288. @end table
  11289. @subsection Examples
  11290. @itemize
  11291. @item
  11292. Read a grid from @file{pattern}, and center it on a grid of size
  11293. 300x300 pixels:
  11294. @example
  11295. life=f=pattern:s=300x300
  11296. @end example
  11297. @item
  11298. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11299. @example
  11300. life=ratio=2/3:s=200x200
  11301. @end example
  11302. @item
  11303. Specify a custom rule for evolving a randomly generated grid:
  11304. @example
  11305. life=rule=S14/B34
  11306. @end example
  11307. @item
  11308. Full example with slow death effect (mold) using @command{ffplay}:
  11309. @example
  11310. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11311. @end example
  11312. @end itemize
  11313. @anchor{allrgb}
  11314. @anchor{allyuv}
  11315. @anchor{color}
  11316. @anchor{haldclutsrc}
  11317. @anchor{nullsrc}
  11318. @anchor{rgbtestsrc}
  11319. @anchor{smptebars}
  11320. @anchor{smptehdbars}
  11321. @anchor{testsrc}
  11322. @anchor{testsrc2}
  11323. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11324. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11325. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11326. The @code{color} source provides an uniformly colored input.
  11327. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11328. @ref{haldclut} filter.
  11329. The @code{nullsrc} source returns unprocessed video frames. It is
  11330. mainly useful to be employed in analysis / debugging tools, or as the
  11331. source for filters which ignore the input data.
  11332. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11333. detecting RGB vs BGR issues. You should see a red, green and blue
  11334. stripe from top to bottom.
  11335. The @code{smptebars} source generates a color bars pattern, based on
  11336. the SMPTE Engineering Guideline EG 1-1990.
  11337. The @code{smptehdbars} source generates a color bars pattern, based on
  11338. the SMPTE RP 219-2002.
  11339. The @code{testsrc} source generates a test video pattern, showing a
  11340. color pattern, a scrolling gradient and a timestamp. This is mainly
  11341. intended for testing purposes.
  11342. The @code{testsrc2} source is similar to testsrc, but supports more
  11343. pixel formats instead of just @code{rgb24}. This allows using it as an
  11344. input for other tests without requiring a format conversion.
  11345. The sources accept the following parameters:
  11346. @table @option
  11347. @item color, c
  11348. Specify the color of the source, only available in the @code{color}
  11349. source. For the syntax of this option, check the "Color" section in the
  11350. ffmpeg-utils manual.
  11351. @item level
  11352. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11353. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11354. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11355. coded on a @code{1/(N*N)} scale.
  11356. @item size, s
  11357. Specify the size of the sourced video. For the syntax of this option, check the
  11358. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11359. The default value is @code{320x240}.
  11360. This option is not available with the @code{haldclutsrc} filter.
  11361. @item rate, r
  11362. Specify the frame rate of the sourced video, as the number of frames
  11363. generated per second. It has to be a string in the format
  11364. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11365. number or a valid video frame rate abbreviation. The default value is
  11366. "25".
  11367. @item sar
  11368. Set the sample aspect ratio of the sourced video.
  11369. @item duration, d
  11370. Set the duration of the sourced video. See
  11371. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11372. for the accepted syntax.
  11373. If not specified, or the expressed duration is negative, the video is
  11374. supposed to be generated forever.
  11375. @item decimals, n
  11376. Set the number of decimals to show in the timestamp, only available in the
  11377. @code{testsrc} source.
  11378. The displayed timestamp value will correspond to the original
  11379. timestamp value multiplied by the power of 10 of the specified
  11380. value. Default value is 0.
  11381. @end table
  11382. For example the following:
  11383. @example
  11384. testsrc=duration=5.3:size=qcif:rate=10
  11385. @end example
  11386. will generate a video with a duration of 5.3 seconds, with size
  11387. 176x144 and a frame rate of 10 frames per second.
  11388. The following graph description will generate a red source
  11389. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11390. frames per second.
  11391. @example
  11392. color=c=red@@0.2:s=qcif:r=10
  11393. @end example
  11394. If the input content is to be ignored, @code{nullsrc} can be used. The
  11395. following command generates noise in the luminance plane by employing
  11396. the @code{geq} filter:
  11397. @example
  11398. nullsrc=s=256x256, geq=random(1)*255:128:128
  11399. @end example
  11400. @subsection Commands
  11401. The @code{color} source supports the following commands:
  11402. @table @option
  11403. @item c, color
  11404. Set the color of the created image. Accepts the same syntax of the
  11405. corresponding @option{color} option.
  11406. @end table
  11407. @c man end VIDEO SOURCES
  11408. @chapter Video Sinks
  11409. @c man begin VIDEO SINKS
  11410. Below is a description of the currently available video sinks.
  11411. @section buffersink
  11412. Buffer video frames, and make them available to the end of the filter
  11413. graph.
  11414. This sink is mainly intended for programmatic use, in particular
  11415. through the interface defined in @file{libavfilter/buffersink.h}
  11416. or the options system.
  11417. It accepts a pointer to an AVBufferSinkContext structure, which
  11418. defines the incoming buffers' formats, to be passed as the opaque
  11419. parameter to @code{avfilter_init_filter} for initialization.
  11420. @section nullsink
  11421. Null video sink: do absolutely nothing with the input video. It is
  11422. mainly useful as a template and for use in analysis / debugging
  11423. tools.
  11424. @c man end VIDEO SINKS
  11425. @chapter Multimedia Filters
  11426. @c man begin MULTIMEDIA FILTERS
  11427. Below is a description of the currently available multimedia filters.
  11428. @section ahistogram
  11429. Convert input audio to a video output, displaying the volume histogram.
  11430. The filter accepts the following options:
  11431. @table @option
  11432. @item dmode
  11433. Specify how histogram is calculated.
  11434. It accepts the following values:
  11435. @table @samp
  11436. @item single
  11437. Use single histogram for all channels.
  11438. @item separate
  11439. Use separate histogram for each channel.
  11440. @end table
  11441. Default is @code{single}.
  11442. @item rate, r
  11443. Set frame rate, expressed as number of frames per second. Default
  11444. value is "25".
  11445. @item size, s
  11446. Specify the video size for the output. For the syntax of this option, check the
  11447. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11448. Default value is @code{hd720}.
  11449. @item scale
  11450. Set display scale.
  11451. It accepts the following values:
  11452. @table @samp
  11453. @item log
  11454. logarithmic
  11455. @item sqrt
  11456. square root
  11457. @item cbrt
  11458. cubic root
  11459. @item lin
  11460. linear
  11461. @item rlog
  11462. reverse logarithmic
  11463. @end table
  11464. Default is @code{log}.
  11465. @item ascale
  11466. Set amplitude scale.
  11467. It accepts the following values:
  11468. @table @samp
  11469. @item log
  11470. logarithmic
  11471. @item lin
  11472. linear
  11473. @end table
  11474. Default is @code{log}.
  11475. @item acount
  11476. Set how much frames to accumulate in histogram.
  11477. Defauls is 1. Setting this to -1 accumulates all frames.
  11478. @item rheight
  11479. Set histogram ratio of window height.
  11480. @item slide
  11481. Set sonogram sliding.
  11482. It accepts the following values:
  11483. @table @samp
  11484. @item replace
  11485. replace old rows with new ones.
  11486. @item scroll
  11487. scroll from top to bottom.
  11488. @end table
  11489. Default is @code{replace}.
  11490. @end table
  11491. @section aphasemeter
  11492. Convert input audio to a video output, displaying the audio phase.
  11493. The filter accepts the following options:
  11494. @table @option
  11495. @item rate, r
  11496. Set the output frame rate. Default value is @code{25}.
  11497. @item size, s
  11498. Set the video size for the output. For the syntax of this option, check the
  11499. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11500. Default value is @code{800x400}.
  11501. @item rc
  11502. @item gc
  11503. @item bc
  11504. Specify the red, green, blue contrast. Default values are @code{2},
  11505. @code{7} and @code{1}.
  11506. Allowed range is @code{[0, 255]}.
  11507. @item mpc
  11508. Set color which will be used for drawing median phase. If color is
  11509. @code{none} which is default, no median phase value will be drawn.
  11510. @end table
  11511. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11512. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11513. The @code{-1} means left and right channels are completely out of phase and
  11514. @code{1} means channels are in phase.
  11515. @section avectorscope
  11516. Convert input audio to a video output, representing the audio vector
  11517. scope.
  11518. The filter is used to measure the difference between channels of stereo
  11519. audio stream. A monoaural signal, consisting of identical left and right
  11520. signal, results in straight vertical line. Any stereo separation is visible
  11521. as a deviation from this line, creating a Lissajous figure.
  11522. If the straight (or deviation from it) but horizontal line appears this
  11523. indicates that the left and right channels are out of phase.
  11524. The filter accepts the following options:
  11525. @table @option
  11526. @item mode, m
  11527. Set the vectorscope mode.
  11528. Available values are:
  11529. @table @samp
  11530. @item lissajous
  11531. Lissajous rotated by 45 degrees.
  11532. @item lissajous_xy
  11533. Same as above but not rotated.
  11534. @item polar
  11535. Shape resembling half of circle.
  11536. @end table
  11537. Default value is @samp{lissajous}.
  11538. @item size, s
  11539. Set the video size for the output. For the syntax of this option, check the
  11540. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11541. Default value is @code{400x400}.
  11542. @item rate, r
  11543. Set the output frame rate. Default value is @code{25}.
  11544. @item rc
  11545. @item gc
  11546. @item bc
  11547. @item ac
  11548. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11549. @code{160}, @code{80} and @code{255}.
  11550. Allowed range is @code{[0, 255]}.
  11551. @item rf
  11552. @item gf
  11553. @item bf
  11554. @item af
  11555. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11556. @code{10}, @code{5} and @code{5}.
  11557. Allowed range is @code{[0, 255]}.
  11558. @item zoom
  11559. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11560. @item draw
  11561. Set the vectorscope drawing mode.
  11562. Available values are:
  11563. @table @samp
  11564. @item dot
  11565. Draw dot for each sample.
  11566. @item line
  11567. Draw line between previous and current sample.
  11568. @end table
  11569. Default value is @samp{dot}.
  11570. @item scale
  11571. Specify amplitude scale of audio samples.
  11572. Available values are:
  11573. @table @samp
  11574. @item lin
  11575. Linear.
  11576. @item sqrt
  11577. Square root.
  11578. @item cbrt
  11579. Cubic root.
  11580. @item log
  11581. Logarithmic.
  11582. @end table
  11583. @end table
  11584. @subsection Examples
  11585. @itemize
  11586. @item
  11587. Complete example using @command{ffplay}:
  11588. @example
  11589. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11590. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11591. @end example
  11592. @end itemize
  11593. @section bench, abench
  11594. Benchmark part of a filtergraph.
  11595. The filter accepts the following options:
  11596. @table @option
  11597. @item action
  11598. Start or stop a timer.
  11599. Available values are:
  11600. @table @samp
  11601. @item start
  11602. Get the current time, set it as frame metadata (using the key
  11603. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11604. @item stop
  11605. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11606. the input frame metadata to get the time difference. Time difference, average,
  11607. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11608. @code{min}) are then printed. The timestamps are expressed in seconds.
  11609. @end table
  11610. @end table
  11611. @subsection Examples
  11612. @itemize
  11613. @item
  11614. Benchmark @ref{selectivecolor} filter:
  11615. @example
  11616. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11617. @end example
  11618. @end itemize
  11619. @section concat
  11620. Concatenate audio and video streams, joining them together one after the
  11621. other.
  11622. The filter works on segments of synchronized video and audio streams. All
  11623. segments must have the same number of streams of each type, and that will
  11624. also be the number of streams at output.
  11625. The filter accepts the following options:
  11626. @table @option
  11627. @item n
  11628. Set the number of segments. Default is 2.
  11629. @item v
  11630. Set the number of output video streams, that is also the number of video
  11631. streams in each segment. Default is 1.
  11632. @item a
  11633. Set the number of output audio streams, that is also the number of audio
  11634. streams in each segment. Default is 0.
  11635. @item unsafe
  11636. Activate unsafe mode: do not fail if segments have a different format.
  11637. @end table
  11638. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11639. @var{a} audio outputs.
  11640. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11641. segment, in the same order as the outputs, then the inputs for the second
  11642. segment, etc.
  11643. Related streams do not always have exactly the same duration, for various
  11644. reasons including codec frame size or sloppy authoring. For that reason,
  11645. related synchronized streams (e.g. a video and its audio track) should be
  11646. concatenated at once. The concat filter will use the duration of the longest
  11647. stream in each segment (except the last one), and if necessary pad shorter
  11648. audio streams with silence.
  11649. For this filter to work correctly, all segments must start at timestamp 0.
  11650. All corresponding streams must have the same parameters in all segments; the
  11651. filtering system will automatically select a common pixel format for video
  11652. streams, and a common sample format, sample rate and channel layout for
  11653. audio streams, but other settings, such as resolution, must be converted
  11654. explicitly by the user.
  11655. Different frame rates are acceptable but will result in variable frame rate
  11656. at output; be sure to configure the output file to handle it.
  11657. @subsection Examples
  11658. @itemize
  11659. @item
  11660. Concatenate an opening, an episode and an ending, all in bilingual version
  11661. (video in stream 0, audio in streams 1 and 2):
  11662. @example
  11663. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11664. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11665. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11666. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11667. @end example
  11668. @item
  11669. Concatenate two parts, handling audio and video separately, using the
  11670. (a)movie sources, and adjusting the resolution:
  11671. @example
  11672. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11673. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11674. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11675. @end example
  11676. Note that a desync will happen at the stitch if the audio and video streams
  11677. do not have exactly the same duration in the first file.
  11678. @end itemize
  11679. @section drawgraph, adrawgraph
  11680. Draw a graph using input video or audio metadata.
  11681. It accepts the following parameters:
  11682. @table @option
  11683. @item m1
  11684. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  11685. @item fg1
  11686. Set 1st foreground color expression.
  11687. @item m2
  11688. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  11689. @item fg2
  11690. Set 2nd foreground color expression.
  11691. @item m3
  11692. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  11693. @item fg3
  11694. Set 3rd foreground color expression.
  11695. @item m4
  11696. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  11697. @item fg4
  11698. Set 4th foreground color expression.
  11699. @item min
  11700. Set minimal value of metadata value.
  11701. @item max
  11702. Set maximal value of metadata value.
  11703. @item bg
  11704. Set graph background color. Default is white.
  11705. @item mode
  11706. Set graph mode.
  11707. Available values for mode is:
  11708. @table @samp
  11709. @item bar
  11710. @item dot
  11711. @item line
  11712. @end table
  11713. Default is @code{line}.
  11714. @item slide
  11715. Set slide mode.
  11716. Available values for slide is:
  11717. @table @samp
  11718. @item frame
  11719. Draw new frame when right border is reached.
  11720. @item replace
  11721. Replace old columns with new ones.
  11722. @item scroll
  11723. Scroll from right to left.
  11724. @item rscroll
  11725. Scroll from left to right.
  11726. @item picture
  11727. Draw single picture.
  11728. @end table
  11729. Default is @code{frame}.
  11730. @item size
  11731. Set size of graph video. For the syntax of this option, check the
  11732. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11733. The default value is @code{900x256}.
  11734. The foreground color expressions can use the following variables:
  11735. @table @option
  11736. @item MIN
  11737. Minimal value of metadata value.
  11738. @item MAX
  11739. Maximal value of metadata value.
  11740. @item VAL
  11741. Current metadata key value.
  11742. @end table
  11743. The color is defined as 0xAABBGGRR.
  11744. @end table
  11745. Example using metadata from @ref{signalstats} filter:
  11746. @example
  11747. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  11748. @end example
  11749. Example using metadata from @ref{ebur128} filter:
  11750. @example
  11751. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  11752. @end example
  11753. @anchor{ebur128}
  11754. @section ebur128
  11755. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11756. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11757. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11758. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11759. The filter also has a video output (see the @var{video} option) with a real
  11760. time graph to observe the loudness evolution. The graphic contains the logged
  11761. message mentioned above, so it is not printed anymore when this option is set,
  11762. unless the verbose logging is set. The main graphing area contains the
  11763. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11764. the momentary loudness (400 milliseconds).
  11765. More information about the Loudness Recommendation EBU R128 on
  11766. @url{http://tech.ebu.ch/loudness}.
  11767. The filter accepts the following options:
  11768. @table @option
  11769. @item video
  11770. Activate the video output. The audio stream is passed unchanged whether this
  11771. option is set or no. The video stream will be the first output stream if
  11772. activated. Default is @code{0}.
  11773. @item size
  11774. Set the video size. This option is for video only. For the syntax of this
  11775. option, check the
  11776. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11777. Default and minimum resolution is @code{640x480}.
  11778. @item meter
  11779. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11780. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11781. other integer value between this range is allowed.
  11782. @item metadata
  11783. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11784. into 100ms output frames, each of them containing various loudness information
  11785. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11786. Default is @code{0}.
  11787. @item framelog
  11788. Force the frame logging level.
  11789. Available values are:
  11790. @table @samp
  11791. @item info
  11792. information logging level
  11793. @item verbose
  11794. verbose logging level
  11795. @end table
  11796. By default, the logging level is set to @var{info}. If the @option{video} or
  11797. the @option{metadata} options are set, it switches to @var{verbose}.
  11798. @item peak
  11799. Set peak mode(s).
  11800. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11801. values are:
  11802. @table @samp
  11803. @item none
  11804. Disable any peak mode (default).
  11805. @item sample
  11806. Enable sample-peak mode.
  11807. Simple peak mode looking for the higher sample value. It logs a message
  11808. for sample-peak (identified by @code{SPK}).
  11809. @item true
  11810. Enable true-peak mode.
  11811. If enabled, the peak lookup is done on an over-sampled version of the input
  11812. stream for better peak accuracy. It logs a message for true-peak.
  11813. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11814. This mode requires a build with @code{libswresample}.
  11815. @end table
  11816. @item dualmono
  11817. Treat mono input files as "dual mono". If a mono file is intended for playback
  11818. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11819. If set to @code{true}, this option will compensate for this effect.
  11820. Multi-channel input files are not affected by this option.
  11821. @item panlaw
  11822. Set a specific pan law to be used for the measurement of dual mono files.
  11823. This parameter is optional, and has a default value of -3.01dB.
  11824. @end table
  11825. @subsection Examples
  11826. @itemize
  11827. @item
  11828. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11829. @example
  11830. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11831. @end example
  11832. @item
  11833. Run an analysis with @command{ffmpeg}:
  11834. @example
  11835. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11836. @end example
  11837. @end itemize
  11838. @section interleave, ainterleave
  11839. Temporally interleave frames from several inputs.
  11840. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11841. These filters read frames from several inputs and send the oldest
  11842. queued frame to the output.
  11843. Input streams must have a well defined, monotonically increasing frame
  11844. timestamp values.
  11845. In order to submit one frame to output, these filters need to enqueue
  11846. at least one frame for each input, so they cannot work in case one
  11847. input is not yet terminated and will not receive incoming frames.
  11848. For example consider the case when one input is a @code{select} filter
  11849. which always drop input frames. The @code{interleave} filter will keep
  11850. reading from that input, but it will never be able to send new frames
  11851. to output until the input will send an end-of-stream signal.
  11852. Also, depending on inputs synchronization, the filters will drop
  11853. frames in case one input receives more frames than the other ones, and
  11854. the queue is already filled.
  11855. These filters accept the following options:
  11856. @table @option
  11857. @item nb_inputs, n
  11858. Set the number of different inputs, it is 2 by default.
  11859. @end table
  11860. @subsection Examples
  11861. @itemize
  11862. @item
  11863. Interleave frames belonging to different streams using @command{ffmpeg}:
  11864. @example
  11865. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11866. @end example
  11867. @item
  11868. Add flickering blur effect:
  11869. @example
  11870. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11871. @end example
  11872. @end itemize
  11873. @section metadata, ametadata
  11874. Manipulate frame metadata.
  11875. This filter accepts the following options:
  11876. @table @option
  11877. @item mode
  11878. Set mode of operation of the filter.
  11879. Can be one of the following:
  11880. @table @samp
  11881. @item select
  11882. If both @code{value} and @code{key} is set, select frames
  11883. which have such metadata. If only @code{key} is set, select
  11884. every frame that has such key in metadata.
  11885. @item add
  11886. Add new metadata @code{key} and @code{value}. If key is already available
  11887. do nothing.
  11888. @item modify
  11889. Modify value of already present key.
  11890. @item delete
  11891. If @code{value} is set, delete only keys that have such value.
  11892. Otherwise, delete key.
  11893. @item print
  11894. Print key and its value if metadata was found. If @code{key} is not set print all
  11895. metadata values available in frame.
  11896. @end table
  11897. @item key
  11898. Set key used with all modes. Must be set for all modes except @code{print}.
  11899. @item value
  11900. Set metadata value which will be used. This option is mandatory for
  11901. @code{modify} and @code{add} mode.
  11902. @item function
  11903. Which function to use when comparing metadata value and @code{value}.
  11904. Can be one of following:
  11905. @table @samp
  11906. @item same_str
  11907. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  11908. @item starts_with
  11909. Values are interpreted as strings, returns true if metadata value starts with
  11910. the @code{value} option string.
  11911. @item less
  11912. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  11913. @item equal
  11914. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  11915. @item greater
  11916. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  11917. @item expr
  11918. Values are interpreted as floats, returns true if expression from option @code{expr}
  11919. evaluates to true.
  11920. @end table
  11921. @item expr
  11922. Set expression which is used when @code{function} is set to @code{expr}.
  11923. The expression is evaluated through the eval API and can contain the following
  11924. constants:
  11925. @table @option
  11926. @item VALUE1
  11927. Float representation of @code{value} from metadata key.
  11928. @item VALUE2
  11929. Float representation of @code{value} as supplied by user in @code{value} option.
  11930. @item file
  11931. If specified in @code{print} mode, output is written to the named file. Instead of
  11932. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  11933. for standard output. If @code{file} option is not set, output is written to the log
  11934. with AV_LOG_INFO loglevel.
  11935. @end table
  11936. @end table
  11937. @subsection Examples
  11938. @itemize
  11939. @item
  11940. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  11941. between 0 and 1.
  11942. @example
  11943. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  11944. @end example
  11945. @item
  11946. Print silencedetect output to file @file{metadata.txt}.
  11947. @example
  11948. silencedetect,ametadata=mode=print:file=metadata.txt
  11949. @end example
  11950. @item
  11951. Direct all metadata to a pipe with file descriptor 4.
  11952. @example
  11953. metadata=mode=print:file='pipe\:4'
  11954. @end example
  11955. @end itemize
  11956. @section perms, aperms
  11957. Set read/write permissions for the output frames.
  11958. These filters are mainly aimed at developers to test direct path in the
  11959. following filter in the filtergraph.
  11960. The filters accept the following options:
  11961. @table @option
  11962. @item mode
  11963. Select the permissions mode.
  11964. It accepts the following values:
  11965. @table @samp
  11966. @item none
  11967. Do nothing. This is the default.
  11968. @item ro
  11969. Set all the output frames read-only.
  11970. @item rw
  11971. Set all the output frames directly writable.
  11972. @item toggle
  11973. Make the frame read-only if writable, and writable if read-only.
  11974. @item random
  11975. Set each output frame read-only or writable randomly.
  11976. @end table
  11977. @item seed
  11978. Set the seed for the @var{random} mode, must be an integer included between
  11979. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11980. @code{-1}, the filter will try to use a good random seed on a best effort
  11981. basis.
  11982. @end table
  11983. Note: in case of auto-inserted filter between the permission filter and the
  11984. following one, the permission might not be received as expected in that
  11985. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11986. perms/aperms filter can avoid this problem.
  11987. @section realtime, arealtime
  11988. Slow down filtering to match real time approximatively.
  11989. These filters will pause the filtering for a variable amount of time to
  11990. match the output rate with the input timestamps.
  11991. They are similar to the @option{re} option to @code{ffmpeg}.
  11992. They accept the following options:
  11993. @table @option
  11994. @item limit
  11995. Time limit for the pauses. Any pause longer than that will be considered
  11996. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11997. @end table
  11998. @section select, aselect
  11999. Select frames to pass in output.
  12000. This filter accepts the following options:
  12001. @table @option
  12002. @item expr, e
  12003. Set expression, which is evaluated for each input frame.
  12004. If the expression is evaluated to zero, the frame is discarded.
  12005. If the evaluation result is negative or NaN, the frame is sent to the
  12006. first output; otherwise it is sent to the output with index
  12007. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12008. For example a value of @code{1.2} corresponds to the output with index
  12009. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12010. @item outputs, n
  12011. Set the number of outputs. The output to which to send the selected
  12012. frame is based on the result of the evaluation. Default value is 1.
  12013. @end table
  12014. The expression can contain the following constants:
  12015. @table @option
  12016. @item n
  12017. The (sequential) number of the filtered frame, starting from 0.
  12018. @item selected_n
  12019. The (sequential) number of the selected frame, starting from 0.
  12020. @item prev_selected_n
  12021. The sequential number of the last selected frame. It's NAN if undefined.
  12022. @item TB
  12023. The timebase of the input timestamps.
  12024. @item pts
  12025. The PTS (Presentation TimeStamp) of the filtered video frame,
  12026. expressed in @var{TB} units. It's NAN if undefined.
  12027. @item t
  12028. The PTS of the filtered video frame,
  12029. expressed in seconds. It's NAN if undefined.
  12030. @item prev_pts
  12031. The PTS of the previously filtered video frame. It's NAN if undefined.
  12032. @item prev_selected_pts
  12033. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12034. @item prev_selected_t
  12035. The PTS of the last previously selected video frame. It's NAN if undefined.
  12036. @item start_pts
  12037. The PTS of the first video frame in the video. It's NAN if undefined.
  12038. @item start_t
  12039. The time of the first video frame in the video. It's NAN if undefined.
  12040. @item pict_type @emph{(video only)}
  12041. The type of the filtered frame. It can assume one of the following
  12042. values:
  12043. @table @option
  12044. @item I
  12045. @item P
  12046. @item B
  12047. @item S
  12048. @item SI
  12049. @item SP
  12050. @item BI
  12051. @end table
  12052. @item interlace_type @emph{(video only)}
  12053. The frame interlace type. It can assume one of the following values:
  12054. @table @option
  12055. @item PROGRESSIVE
  12056. The frame is progressive (not interlaced).
  12057. @item TOPFIRST
  12058. The frame is top-field-first.
  12059. @item BOTTOMFIRST
  12060. The frame is bottom-field-first.
  12061. @end table
  12062. @item consumed_sample_n @emph{(audio only)}
  12063. the number of selected samples before the current frame
  12064. @item samples_n @emph{(audio only)}
  12065. the number of samples in the current frame
  12066. @item sample_rate @emph{(audio only)}
  12067. the input sample rate
  12068. @item key
  12069. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12070. @item pos
  12071. the position in the file of the filtered frame, -1 if the information
  12072. is not available (e.g. for synthetic video)
  12073. @item scene @emph{(video only)}
  12074. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12075. probability for the current frame to introduce a new scene, while a higher
  12076. value means the current frame is more likely to be one (see the example below)
  12077. @item concatdec_select
  12078. The concat demuxer can select only part of a concat input file by setting an
  12079. inpoint and an outpoint, but the output packets may not be entirely contained
  12080. in the selected interval. By using this variable, it is possible to skip frames
  12081. generated by the concat demuxer which are not exactly contained in the selected
  12082. interval.
  12083. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12084. and the @var{lavf.concat.duration} packet metadata values which are also
  12085. present in the decoded frames.
  12086. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12087. start_time and either the duration metadata is missing or the frame pts is less
  12088. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12089. missing.
  12090. That basically means that an input frame is selected if its pts is within the
  12091. interval set by the concat demuxer.
  12092. @end table
  12093. The default value of the select expression is "1".
  12094. @subsection Examples
  12095. @itemize
  12096. @item
  12097. Select all frames in input:
  12098. @example
  12099. select
  12100. @end example
  12101. The example above is the same as:
  12102. @example
  12103. select=1
  12104. @end example
  12105. @item
  12106. Skip all frames:
  12107. @example
  12108. select=0
  12109. @end example
  12110. @item
  12111. Select only I-frames:
  12112. @example
  12113. select='eq(pict_type\,I)'
  12114. @end example
  12115. @item
  12116. Select one frame every 100:
  12117. @example
  12118. select='not(mod(n\,100))'
  12119. @end example
  12120. @item
  12121. Select only frames contained in the 10-20 time interval:
  12122. @example
  12123. select=between(t\,10\,20)
  12124. @end example
  12125. @item
  12126. Select only I-frames contained in the 10-20 time interval:
  12127. @example
  12128. select=between(t\,10\,20)*eq(pict_type\,I)
  12129. @end example
  12130. @item
  12131. Select frames with a minimum distance of 10 seconds:
  12132. @example
  12133. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12134. @end example
  12135. @item
  12136. Use aselect to select only audio frames with samples number > 100:
  12137. @example
  12138. aselect='gt(samples_n\,100)'
  12139. @end example
  12140. @item
  12141. Create a mosaic of the first scenes:
  12142. @example
  12143. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12144. @end example
  12145. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12146. choice.
  12147. @item
  12148. Send even and odd frames to separate outputs, and compose them:
  12149. @example
  12150. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12151. @end example
  12152. @item
  12153. Select useful frames from an ffconcat file which is using inpoints and
  12154. outpoints but where the source files are not intra frame only.
  12155. @example
  12156. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12157. @end example
  12158. @end itemize
  12159. @section sendcmd, asendcmd
  12160. Send commands to filters in the filtergraph.
  12161. These filters read commands to be sent to other filters in the
  12162. filtergraph.
  12163. @code{sendcmd} must be inserted between two video filters,
  12164. @code{asendcmd} must be inserted between two audio filters, but apart
  12165. from that they act the same way.
  12166. The specification of commands can be provided in the filter arguments
  12167. with the @var{commands} option, or in a file specified by the
  12168. @var{filename} option.
  12169. These filters accept the following options:
  12170. @table @option
  12171. @item commands, c
  12172. Set the commands to be read and sent to the other filters.
  12173. @item filename, f
  12174. Set the filename of the commands to be read and sent to the other
  12175. filters.
  12176. @end table
  12177. @subsection Commands syntax
  12178. A commands description consists of a sequence of interval
  12179. specifications, comprising a list of commands to be executed when a
  12180. particular event related to that interval occurs. The occurring event
  12181. is typically the current frame time entering or leaving a given time
  12182. interval.
  12183. An interval is specified by the following syntax:
  12184. @example
  12185. @var{START}[-@var{END}] @var{COMMANDS};
  12186. @end example
  12187. The time interval is specified by the @var{START} and @var{END} times.
  12188. @var{END} is optional and defaults to the maximum time.
  12189. The current frame time is considered within the specified interval if
  12190. it is included in the interval [@var{START}, @var{END}), that is when
  12191. the time is greater or equal to @var{START} and is lesser than
  12192. @var{END}.
  12193. @var{COMMANDS} consists of a sequence of one or more command
  12194. specifications, separated by ",", relating to that interval. The
  12195. syntax of a command specification is given by:
  12196. @example
  12197. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12198. @end example
  12199. @var{FLAGS} is optional and specifies the type of events relating to
  12200. the time interval which enable sending the specified command, and must
  12201. be a non-null sequence of identifier flags separated by "+" or "|" and
  12202. enclosed between "[" and "]".
  12203. The following flags are recognized:
  12204. @table @option
  12205. @item enter
  12206. The command is sent when the current frame timestamp enters the
  12207. specified interval. In other words, the command is sent when the
  12208. previous frame timestamp was not in the given interval, and the
  12209. current is.
  12210. @item leave
  12211. The command is sent when the current frame timestamp leaves the
  12212. specified interval. In other words, the command is sent when the
  12213. previous frame timestamp was in the given interval, and the
  12214. current is not.
  12215. @end table
  12216. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12217. assumed.
  12218. @var{TARGET} specifies the target of the command, usually the name of
  12219. the filter class or a specific filter instance name.
  12220. @var{COMMAND} specifies the name of the command for the target filter.
  12221. @var{ARG} is optional and specifies the optional list of argument for
  12222. the given @var{COMMAND}.
  12223. Between one interval specification and another, whitespaces, or
  12224. sequences of characters starting with @code{#} until the end of line,
  12225. are ignored and can be used to annotate comments.
  12226. A simplified BNF description of the commands specification syntax
  12227. follows:
  12228. @example
  12229. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12230. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12231. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12232. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12233. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12234. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12235. @end example
  12236. @subsection Examples
  12237. @itemize
  12238. @item
  12239. Specify audio tempo change at second 4:
  12240. @example
  12241. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12242. @end example
  12243. @item
  12244. Specify a list of drawtext and hue commands in a file.
  12245. @example
  12246. # show text in the interval 5-10
  12247. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12248. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12249. # desaturate the image in the interval 15-20
  12250. 15.0-20.0 [enter] hue s 0,
  12251. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12252. [leave] hue s 1,
  12253. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12254. # apply an exponential saturation fade-out effect, starting from time 25
  12255. 25 [enter] hue s exp(25-t)
  12256. @end example
  12257. A filtergraph allowing to read and process the above command list
  12258. stored in a file @file{test.cmd}, can be specified with:
  12259. @example
  12260. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12261. @end example
  12262. @end itemize
  12263. @anchor{setpts}
  12264. @section setpts, asetpts
  12265. Change the PTS (presentation timestamp) of the input frames.
  12266. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12267. This filter accepts the following options:
  12268. @table @option
  12269. @item expr
  12270. The expression which is evaluated for each frame to construct its timestamp.
  12271. @end table
  12272. The expression is evaluated through the eval API and can contain the following
  12273. constants:
  12274. @table @option
  12275. @item FRAME_RATE
  12276. frame rate, only defined for constant frame-rate video
  12277. @item PTS
  12278. The presentation timestamp in input
  12279. @item N
  12280. The count of the input frame for video or the number of consumed samples,
  12281. not including the current frame for audio, starting from 0.
  12282. @item NB_CONSUMED_SAMPLES
  12283. The number of consumed samples, not including the current frame (only
  12284. audio)
  12285. @item NB_SAMPLES, S
  12286. The number of samples in the current frame (only audio)
  12287. @item SAMPLE_RATE, SR
  12288. The audio sample rate.
  12289. @item STARTPTS
  12290. The PTS of the first frame.
  12291. @item STARTT
  12292. the time in seconds of the first frame
  12293. @item INTERLACED
  12294. State whether the current frame is interlaced.
  12295. @item T
  12296. the time in seconds of the current frame
  12297. @item POS
  12298. original position in the file of the frame, or undefined if undefined
  12299. for the current frame
  12300. @item PREV_INPTS
  12301. The previous input PTS.
  12302. @item PREV_INT
  12303. previous input time in seconds
  12304. @item PREV_OUTPTS
  12305. The previous output PTS.
  12306. @item PREV_OUTT
  12307. previous output time in seconds
  12308. @item RTCTIME
  12309. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12310. instead.
  12311. @item RTCSTART
  12312. The wallclock (RTC) time at the start of the movie in microseconds.
  12313. @item TB
  12314. The timebase of the input timestamps.
  12315. @end table
  12316. @subsection Examples
  12317. @itemize
  12318. @item
  12319. Start counting PTS from zero
  12320. @example
  12321. setpts=PTS-STARTPTS
  12322. @end example
  12323. @item
  12324. Apply fast motion effect:
  12325. @example
  12326. setpts=0.5*PTS
  12327. @end example
  12328. @item
  12329. Apply slow motion effect:
  12330. @example
  12331. setpts=2.0*PTS
  12332. @end example
  12333. @item
  12334. Set fixed rate of 25 frames per second:
  12335. @example
  12336. setpts=N/(25*TB)
  12337. @end example
  12338. @item
  12339. Set fixed rate 25 fps with some jitter:
  12340. @example
  12341. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12342. @end example
  12343. @item
  12344. Apply an offset of 10 seconds to the input PTS:
  12345. @example
  12346. setpts=PTS+10/TB
  12347. @end example
  12348. @item
  12349. Generate timestamps from a "live source" and rebase onto the current timebase:
  12350. @example
  12351. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12352. @end example
  12353. @item
  12354. Generate timestamps by counting samples:
  12355. @example
  12356. asetpts=N/SR/TB
  12357. @end example
  12358. @end itemize
  12359. @section settb, asettb
  12360. Set the timebase to use for the output frames timestamps.
  12361. It is mainly useful for testing timebase configuration.
  12362. It accepts the following parameters:
  12363. @table @option
  12364. @item expr, tb
  12365. The expression which is evaluated into the output timebase.
  12366. @end table
  12367. The value for @option{tb} is an arithmetic expression representing a
  12368. rational. The expression can contain the constants "AVTB" (the default
  12369. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12370. audio only). Default value is "intb".
  12371. @subsection Examples
  12372. @itemize
  12373. @item
  12374. Set the timebase to 1/25:
  12375. @example
  12376. settb=expr=1/25
  12377. @end example
  12378. @item
  12379. Set the timebase to 1/10:
  12380. @example
  12381. settb=expr=0.1
  12382. @end example
  12383. @item
  12384. Set the timebase to 1001/1000:
  12385. @example
  12386. settb=1+0.001
  12387. @end example
  12388. @item
  12389. Set the timebase to 2*intb:
  12390. @example
  12391. settb=2*intb
  12392. @end example
  12393. @item
  12394. Set the default timebase value:
  12395. @example
  12396. settb=AVTB
  12397. @end example
  12398. @end itemize
  12399. @section showcqt
  12400. Convert input audio to a video output representing frequency spectrum
  12401. logarithmically using Brown-Puckette constant Q transform algorithm with
  12402. direct frequency domain coefficient calculation (but the transform itself
  12403. is not really constant Q, instead the Q factor is actually variable/clamped),
  12404. with musical tone scale, from E0 to D#10.
  12405. The filter accepts the following options:
  12406. @table @option
  12407. @item size, s
  12408. Specify the video size for the output. It must be even. For the syntax of this option,
  12409. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12410. Default value is @code{1920x1080}.
  12411. @item fps, rate, r
  12412. Set the output frame rate. Default value is @code{25}.
  12413. @item bar_h
  12414. Set the bargraph height. It must be even. Default value is @code{-1} which
  12415. computes the bargraph height automatically.
  12416. @item axis_h
  12417. Set the axis height. It must be even. Default value is @code{-1} which computes
  12418. the axis height automatically.
  12419. @item sono_h
  12420. Set the sonogram height. It must be even. Default value is @code{-1} which
  12421. computes the sonogram height automatically.
  12422. @item fullhd
  12423. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12424. instead. Default value is @code{1}.
  12425. @item sono_v, volume
  12426. Specify the sonogram volume expression. It can contain variables:
  12427. @table @option
  12428. @item bar_v
  12429. the @var{bar_v} evaluated expression
  12430. @item frequency, freq, f
  12431. the frequency where it is evaluated
  12432. @item timeclamp, tc
  12433. the value of @var{timeclamp} option
  12434. @end table
  12435. and functions:
  12436. @table @option
  12437. @item a_weighting(f)
  12438. A-weighting of equal loudness
  12439. @item b_weighting(f)
  12440. B-weighting of equal loudness
  12441. @item c_weighting(f)
  12442. C-weighting of equal loudness.
  12443. @end table
  12444. Default value is @code{16}.
  12445. @item bar_v, volume2
  12446. Specify the bargraph volume expression. It can contain variables:
  12447. @table @option
  12448. @item sono_v
  12449. the @var{sono_v} evaluated expression
  12450. @item frequency, freq, f
  12451. the frequency where it is evaluated
  12452. @item timeclamp, tc
  12453. the value of @var{timeclamp} option
  12454. @end table
  12455. and functions:
  12456. @table @option
  12457. @item a_weighting(f)
  12458. A-weighting of equal loudness
  12459. @item b_weighting(f)
  12460. B-weighting of equal loudness
  12461. @item c_weighting(f)
  12462. C-weighting of equal loudness.
  12463. @end table
  12464. Default value is @code{sono_v}.
  12465. @item sono_g, gamma
  12466. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12467. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12468. Acceptable range is @code{[1, 7]}.
  12469. @item bar_g, gamma2
  12470. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12471. @code{[1, 7]}.
  12472. @item timeclamp, tc
  12473. Specify the transform timeclamp. At low frequency, there is trade-off between
  12474. accuracy in time domain and frequency domain. If timeclamp is lower,
  12475. event in time domain is represented more accurately (such as fast bass drum),
  12476. otherwise event in frequency domain is represented more accurately
  12477. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12478. @item basefreq
  12479. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12480. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12481. @item endfreq
  12482. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12483. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12484. @item coeffclamp
  12485. This option is deprecated and ignored.
  12486. @item tlength
  12487. Specify the transform length in time domain. Use this option to control accuracy
  12488. trade-off between time domain and frequency domain at every frequency sample.
  12489. It can contain variables:
  12490. @table @option
  12491. @item frequency, freq, f
  12492. the frequency where it is evaluated
  12493. @item timeclamp, tc
  12494. the value of @var{timeclamp} option.
  12495. @end table
  12496. Default value is @code{384*tc/(384+tc*f)}.
  12497. @item count
  12498. Specify the transform count for every video frame. Default value is @code{6}.
  12499. Acceptable range is @code{[1, 30]}.
  12500. @item fcount
  12501. Specify the transform count for every single pixel. Default value is @code{0},
  12502. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12503. @item fontfile
  12504. Specify font file for use with freetype to draw the axis. If not specified,
  12505. use embedded font. Note that drawing with font file or embedded font is not
  12506. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12507. option instead.
  12508. @item fontcolor
  12509. Specify font color expression. This is arithmetic expression that should return
  12510. integer value 0xRRGGBB. It can contain variables:
  12511. @table @option
  12512. @item frequency, freq, f
  12513. the frequency where it is evaluated
  12514. @item timeclamp, tc
  12515. the value of @var{timeclamp} option
  12516. @end table
  12517. and functions:
  12518. @table @option
  12519. @item midi(f)
  12520. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12521. @item r(x), g(x), b(x)
  12522. red, green, and blue value of intensity x.
  12523. @end table
  12524. Default value is @code{st(0, (midi(f)-59.5)/12);
  12525. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12526. r(1-ld(1)) + b(ld(1))}.
  12527. @item axisfile
  12528. Specify image file to draw the axis. This option override @var{fontfile} and
  12529. @var{fontcolor} option.
  12530. @item axis, text
  12531. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12532. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12533. Default value is @code{1}.
  12534. @end table
  12535. @subsection Examples
  12536. @itemize
  12537. @item
  12538. Playing audio while showing the spectrum:
  12539. @example
  12540. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12541. @end example
  12542. @item
  12543. Same as above, but with frame rate 30 fps:
  12544. @example
  12545. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12546. @end example
  12547. @item
  12548. Playing at 1280x720:
  12549. @example
  12550. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12551. @end example
  12552. @item
  12553. Disable sonogram display:
  12554. @example
  12555. sono_h=0
  12556. @end example
  12557. @item
  12558. A1 and its harmonics: A1, A2, (near)E3, A3:
  12559. @example
  12560. 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),
  12561. asplit[a][out1]; [a] showcqt [out0]'
  12562. @end example
  12563. @item
  12564. Same as above, but with more accuracy in frequency domain:
  12565. @example
  12566. 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),
  12567. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12568. @end example
  12569. @item
  12570. Custom volume:
  12571. @example
  12572. bar_v=10:sono_v=bar_v*a_weighting(f)
  12573. @end example
  12574. @item
  12575. Custom gamma, now spectrum is linear to the amplitude.
  12576. @example
  12577. bar_g=2:sono_g=2
  12578. @end example
  12579. @item
  12580. Custom tlength equation:
  12581. @example
  12582. 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)))'
  12583. @end example
  12584. @item
  12585. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12586. @example
  12587. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12588. @end example
  12589. @item
  12590. Custom frequency range with custom axis using image file:
  12591. @example
  12592. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12593. @end example
  12594. @end itemize
  12595. @section showfreqs
  12596. Convert input audio to video output representing the audio power spectrum.
  12597. Audio amplitude is on Y-axis while frequency is on X-axis.
  12598. The filter accepts the following options:
  12599. @table @option
  12600. @item size, s
  12601. Specify size of video. For the syntax of this option, check the
  12602. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12603. Default is @code{1024x512}.
  12604. @item mode
  12605. Set display mode.
  12606. This set how each frequency bin will be represented.
  12607. It accepts the following values:
  12608. @table @samp
  12609. @item line
  12610. @item bar
  12611. @item dot
  12612. @end table
  12613. Default is @code{bar}.
  12614. @item ascale
  12615. Set amplitude scale.
  12616. It accepts the following values:
  12617. @table @samp
  12618. @item lin
  12619. Linear scale.
  12620. @item sqrt
  12621. Square root scale.
  12622. @item cbrt
  12623. Cubic root scale.
  12624. @item log
  12625. Logarithmic scale.
  12626. @end table
  12627. Default is @code{log}.
  12628. @item fscale
  12629. Set frequency scale.
  12630. It accepts the following values:
  12631. @table @samp
  12632. @item lin
  12633. Linear scale.
  12634. @item log
  12635. Logarithmic scale.
  12636. @item rlog
  12637. Reverse logarithmic scale.
  12638. @end table
  12639. Default is @code{lin}.
  12640. @item win_size
  12641. Set window size.
  12642. It accepts the following values:
  12643. @table @samp
  12644. @item w16
  12645. @item w32
  12646. @item w64
  12647. @item w128
  12648. @item w256
  12649. @item w512
  12650. @item w1024
  12651. @item w2048
  12652. @item w4096
  12653. @item w8192
  12654. @item w16384
  12655. @item w32768
  12656. @item w65536
  12657. @end table
  12658. Default is @code{w2048}
  12659. @item win_func
  12660. Set windowing function.
  12661. It accepts the following values:
  12662. @table @samp
  12663. @item rect
  12664. @item bartlett
  12665. @item hanning
  12666. @item hamming
  12667. @item blackman
  12668. @item welch
  12669. @item flattop
  12670. @item bharris
  12671. @item bnuttall
  12672. @item bhann
  12673. @item sine
  12674. @item nuttall
  12675. @item lanczos
  12676. @item gauss
  12677. @item tukey
  12678. @item dolph
  12679. @item cauchy
  12680. @item parzen
  12681. @item poisson
  12682. @end table
  12683. Default is @code{hanning}.
  12684. @item overlap
  12685. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12686. which means optimal overlap for selected window function will be picked.
  12687. @item averaging
  12688. Set time averaging. Setting this to 0 will display current maximal peaks.
  12689. Default is @code{1}, which means time averaging is disabled.
  12690. @item colors
  12691. Specify list of colors separated by space or by '|' which will be used to
  12692. draw channel frequencies. Unrecognized or missing colors will be replaced
  12693. by white color.
  12694. @item cmode
  12695. Set channel display mode.
  12696. It accepts the following values:
  12697. @table @samp
  12698. @item combined
  12699. @item separate
  12700. @end table
  12701. Default is @code{combined}.
  12702. @item minamp
  12703. Set minimum amplitude used in @code{log} amplitude scaler.
  12704. @end table
  12705. @anchor{showspectrum}
  12706. @section showspectrum
  12707. Convert input audio to a video output, representing the audio frequency
  12708. spectrum.
  12709. The filter accepts the following options:
  12710. @table @option
  12711. @item size, s
  12712. Specify the video size for the output. For the syntax of this option, check the
  12713. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12714. Default value is @code{640x512}.
  12715. @item slide
  12716. Specify how the spectrum should slide along the window.
  12717. It accepts the following values:
  12718. @table @samp
  12719. @item replace
  12720. the samples start again on the left when they reach the right
  12721. @item scroll
  12722. the samples scroll from right to left
  12723. @item rscroll
  12724. the samples scroll from left to right
  12725. @item fullframe
  12726. frames are only produced when the samples reach the right
  12727. @end table
  12728. Default value is @code{replace}.
  12729. @item mode
  12730. Specify display mode.
  12731. It accepts the following values:
  12732. @table @samp
  12733. @item combined
  12734. all channels are displayed in the same row
  12735. @item separate
  12736. all channels are displayed in separate rows
  12737. @end table
  12738. Default value is @samp{combined}.
  12739. @item color
  12740. Specify display color mode.
  12741. It accepts the following values:
  12742. @table @samp
  12743. @item channel
  12744. each channel is displayed in a separate color
  12745. @item intensity
  12746. each channel is displayed using the same color scheme
  12747. @item rainbow
  12748. each channel is displayed using the rainbow color scheme
  12749. @item moreland
  12750. each channel is displayed using the moreland color scheme
  12751. @item nebulae
  12752. each channel is displayed using the nebulae color scheme
  12753. @item fire
  12754. each channel is displayed using the fire color scheme
  12755. @item fiery
  12756. each channel is displayed using the fiery color scheme
  12757. @item fruit
  12758. each channel is displayed using the fruit color scheme
  12759. @item cool
  12760. each channel is displayed using the cool color scheme
  12761. @end table
  12762. Default value is @samp{channel}.
  12763. @item scale
  12764. Specify scale used for calculating intensity color values.
  12765. It accepts the following values:
  12766. @table @samp
  12767. @item lin
  12768. linear
  12769. @item sqrt
  12770. square root, default
  12771. @item cbrt
  12772. cubic root
  12773. @item 4thrt
  12774. 4th root
  12775. @item 5thrt
  12776. 5th root
  12777. @item log
  12778. logarithmic
  12779. @end table
  12780. Default value is @samp{sqrt}.
  12781. @item saturation
  12782. Set saturation modifier for displayed colors. Negative values provide
  12783. alternative color scheme. @code{0} is no saturation at all.
  12784. Saturation must be in [-10.0, 10.0] range.
  12785. Default value is @code{1}.
  12786. @item win_func
  12787. Set window function.
  12788. It accepts the following values:
  12789. @table @samp
  12790. @item rect
  12791. @item bartlett
  12792. @item hann
  12793. @item hanning
  12794. @item hamming
  12795. @item blackman
  12796. @item welch
  12797. @item flattop
  12798. @item bharris
  12799. @item bnuttall
  12800. @item bhann
  12801. @item sine
  12802. @item nuttall
  12803. @item lanczos
  12804. @item gauss
  12805. @item tukey
  12806. @item dolph
  12807. @item cauchy
  12808. @item parzen
  12809. @item poisson
  12810. @end table
  12811. Default value is @code{hann}.
  12812. @item orientation
  12813. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12814. @code{horizontal}. Default is @code{vertical}.
  12815. @item overlap
  12816. Set ratio of overlap window. Default value is @code{0}.
  12817. When value is @code{1} overlap is set to recommended size for specific
  12818. window function currently used.
  12819. @item gain
  12820. Set scale gain for calculating intensity color values.
  12821. Default value is @code{1}.
  12822. @item data
  12823. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12824. @item rotation
  12825. Set color rotation, must be in [-1.0, 1.0] range.
  12826. Default value is @code{0}.
  12827. @end table
  12828. The usage is very similar to the showwaves filter; see the examples in that
  12829. section.
  12830. @subsection Examples
  12831. @itemize
  12832. @item
  12833. Large window with logarithmic color scaling:
  12834. @example
  12835. showspectrum=s=1280x480:scale=log
  12836. @end example
  12837. @item
  12838. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12839. @example
  12840. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12841. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12842. @end example
  12843. @end itemize
  12844. @section showspectrumpic
  12845. Convert input audio to a single video frame, representing the audio frequency
  12846. spectrum.
  12847. The filter accepts the following options:
  12848. @table @option
  12849. @item size, s
  12850. Specify the video size for the output. For the syntax of this option, check the
  12851. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12852. Default value is @code{4096x2048}.
  12853. @item mode
  12854. Specify display mode.
  12855. It accepts the following values:
  12856. @table @samp
  12857. @item combined
  12858. all channels are displayed in the same row
  12859. @item separate
  12860. all channels are displayed in separate rows
  12861. @end table
  12862. Default value is @samp{combined}.
  12863. @item color
  12864. Specify display color mode.
  12865. It accepts the following values:
  12866. @table @samp
  12867. @item channel
  12868. each channel is displayed in a separate color
  12869. @item intensity
  12870. each channel is displayed using the same color scheme
  12871. @item rainbow
  12872. each channel is displayed using the rainbow color scheme
  12873. @item moreland
  12874. each channel is displayed using the moreland color scheme
  12875. @item nebulae
  12876. each channel is displayed using the nebulae color scheme
  12877. @item fire
  12878. each channel is displayed using the fire color scheme
  12879. @item fiery
  12880. each channel is displayed using the fiery color scheme
  12881. @item fruit
  12882. each channel is displayed using the fruit color scheme
  12883. @item cool
  12884. each channel is displayed using the cool color scheme
  12885. @end table
  12886. Default value is @samp{intensity}.
  12887. @item scale
  12888. Specify scale used for calculating intensity color values.
  12889. It accepts the following values:
  12890. @table @samp
  12891. @item lin
  12892. linear
  12893. @item sqrt
  12894. square root, default
  12895. @item cbrt
  12896. cubic root
  12897. @item 4thrt
  12898. 4th root
  12899. @item 5thrt
  12900. 5th root
  12901. @item log
  12902. logarithmic
  12903. @end table
  12904. Default value is @samp{log}.
  12905. @item saturation
  12906. Set saturation modifier for displayed colors. Negative values provide
  12907. alternative color scheme. @code{0} is no saturation at all.
  12908. Saturation must be in [-10.0, 10.0] range.
  12909. Default value is @code{1}.
  12910. @item win_func
  12911. Set window function.
  12912. It accepts the following values:
  12913. @table @samp
  12914. @item rect
  12915. @item bartlett
  12916. @item hann
  12917. @item hanning
  12918. @item hamming
  12919. @item blackman
  12920. @item welch
  12921. @item flattop
  12922. @item bharris
  12923. @item bnuttall
  12924. @item bhann
  12925. @item sine
  12926. @item nuttall
  12927. @item lanczos
  12928. @item gauss
  12929. @item tukey
  12930. @item dolph
  12931. @item cauchy
  12932. @item parzen
  12933. @item poisson
  12934. @end table
  12935. Default value is @code{hann}.
  12936. @item orientation
  12937. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12938. @code{horizontal}. Default is @code{vertical}.
  12939. @item gain
  12940. Set scale gain for calculating intensity color values.
  12941. Default value is @code{1}.
  12942. @item legend
  12943. Draw time and frequency axes and legends. Default is enabled.
  12944. @item rotation
  12945. Set color rotation, must be in [-1.0, 1.0] range.
  12946. Default value is @code{0}.
  12947. @end table
  12948. @subsection Examples
  12949. @itemize
  12950. @item
  12951. Extract an audio spectrogram of a whole audio track
  12952. in a 1024x1024 picture using @command{ffmpeg}:
  12953. @example
  12954. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12955. @end example
  12956. @end itemize
  12957. @section showvolume
  12958. Convert input audio volume to a video output.
  12959. The filter accepts the following options:
  12960. @table @option
  12961. @item rate, r
  12962. Set video rate.
  12963. @item b
  12964. Set border width, allowed range is [0, 5]. Default is 1.
  12965. @item w
  12966. Set channel width, allowed range is [80, 8192]. Default is 400.
  12967. @item h
  12968. Set channel height, allowed range is [1, 900]. Default is 20.
  12969. @item f
  12970. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12971. @item c
  12972. Set volume color expression.
  12973. The expression can use the following variables:
  12974. @table @option
  12975. @item VOLUME
  12976. Current max volume of channel in dB.
  12977. @item PEAK
  12978. Current peak.
  12979. @item CHANNEL
  12980. Current channel number, starting from 0.
  12981. @end table
  12982. @item t
  12983. If set, displays channel names. Default is enabled.
  12984. @item v
  12985. If set, displays volume values. Default is enabled.
  12986. @item o
  12987. Set orientation, can be @code{horizontal} or @code{vertical},
  12988. default is @code{horizontal}.
  12989. @item s
  12990. Set step size, allowed range s [0, 5]. Default is 0, which means
  12991. step is disabled.
  12992. @end table
  12993. @section showwaves
  12994. Convert input audio to a video output, representing the samples waves.
  12995. The filter accepts the following options:
  12996. @table @option
  12997. @item size, s
  12998. Specify the video size for the output. For the syntax of this option, check the
  12999. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13000. Default value is @code{600x240}.
  13001. @item mode
  13002. Set display mode.
  13003. Available values are:
  13004. @table @samp
  13005. @item point
  13006. Draw a point for each sample.
  13007. @item line
  13008. Draw a vertical line for each sample.
  13009. @item p2p
  13010. Draw a point for each sample and a line between them.
  13011. @item cline
  13012. Draw a centered vertical line for each sample.
  13013. @end table
  13014. Default value is @code{point}.
  13015. @item n
  13016. Set the number of samples which are printed on the same column. A
  13017. larger value will decrease the frame rate. Must be a positive
  13018. integer. This option can be set only if the value for @var{rate}
  13019. is not explicitly specified.
  13020. @item rate, r
  13021. Set the (approximate) output frame rate. This is done by setting the
  13022. option @var{n}. Default value is "25".
  13023. @item split_channels
  13024. Set if channels should be drawn separately or overlap. Default value is 0.
  13025. @item colors
  13026. Set colors separated by '|' which are going to be used for drawing of each channel.
  13027. @item scale
  13028. Set amplitude scale.
  13029. Available values are:
  13030. @table @samp
  13031. @item lin
  13032. Linear.
  13033. @item log
  13034. Logarithmic.
  13035. @item sqrt
  13036. Square root.
  13037. @item cbrt
  13038. Cubic root.
  13039. @end table
  13040. Default is linear.
  13041. @end table
  13042. @subsection Examples
  13043. @itemize
  13044. @item
  13045. Output the input file audio and the corresponding video representation
  13046. at the same time:
  13047. @example
  13048. amovie=a.mp3,asplit[out0],showwaves[out1]
  13049. @end example
  13050. @item
  13051. Create a synthetic signal and show it with showwaves, forcing a
  13052. frame rate of 30 frames per second:
  13053. @example
  13054. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13055. @end example
  13056. @end itemize
  13057. @section showwavespic
  13058. Convert input audio to a single video frame, representing the samples waves.
  13059. The filter accepts the following options:
  13060. @table @option
  13061. @item size, s
  13062. Specify the video size for the output. For the syntax of this option, check the
  13063. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13064. Default value is @code{600x240}.
  13065. @item split_channels
  13066. Set if channels should be drawn separately or overlap. Default value is 0.
  13067. @item colors
  13068. Set colors separated by '|' which are going to be used for drawing of each channel.
  13069. @item scale
  13070. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13071. Default is linear.
  13072. @end table
  13073. @subsection Examples
  13074. @itemize
  13075. @item
  13076. Extract a channel split representation of the wave form of a whole audio track
  13077. in a 1024x800 picture using @command{ffmpeg}:
  13078. @example
  13079. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13080. @end example
  13081. @end itemize
  13082. @section spectrumsynth
  13083. Sythesize audio from 2 input video spectrums, first input stream represents
  13084. magnitude across time and second represents phase across time.
  13085. The filter will transform from frequency domain as displayed in videos back
  13086. to time domain as presented in audio output.
  13087. This filter is primarly created for reversing processed @ref{showspectrum}
  13088. filter outputs, but can synthesize sound from other spectrograms too.
  13089. But in such case results are going to be poor if the phase data is not
  13090. available, because in such cases phase data need to be recreated, usually
  13091. its just recreated from random noise.
  13092. For best results use gray only output (@code{channel} color mode in
  13093. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13094. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13095. @code{data} option. Inputs videos should generally use @code{fullframe}
  13096. slide mode as that saves resources needed for decoding video.
  13097. The filter accepts the following options:
  13098. @table @option
  13099. @item sample_rate
  13100. Specify sample rate of output audio, the sample rate of audio from which
  13101. spectrum was generated may differ.
  13102. @item channels
  13103. Set number of channels represented in input video spectrums.
  13104. @item scale
  13105. Set scale which was used when generating magnitude input spectrum.
  13106. Can be @code{lin} or @code{log}. Default is @code{log}.
  13107. @item slide
  13108. Set slide which was used when generating inputs spectrums.
  13109. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13110. Default is @code{fullframe}.
  13111. @item win_func
  13112. Set window function used for resynthesis.
  13113. @item overlap
  13114. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13115. which means optimal overlap for selected window function will be picked.
  13116. @item orientation
  13117. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13118. Default is @code{vertical}.
  13119. @end table
  13120. @subsection Examples
  13121. @itemize
  13122. @item
  13123. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13124. then resynthesize videos back to audio with spectrumsynth:
  13125. @example
  13126. 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
  13127. 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
  13128. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13129. @end example
  13130. @end itemize
  13131. @section split, asplit
  13132. Split input into several identical outputs.
  13133. @code{asplit} works with audio input, @code{split} with video.
  13134. The filter accepts a single parameter which specifies the number of outputs. If
  13135. unspecified, it defaults to 2.
  13136. @subsection Examples
  13137. @itemize
  13138. @item
  13139. Create two separate outputs from the same input:
  13140. @example
  13141. [in] split [out0][out1]
  13142. @end example
  13143. @item
  13144. To create 3 or more outputs, you need to specify the number of
  13145. outputs, like in:
  13146. @example
  13147. [in] asplit=3 [out0][out1][out2]
  13148. @end example
  13149. @item
  13150. Create two separate outputs from the same input, one cropped and
  13151. one padded:
  13152. @example
  13153. [in] split [splitout1][splitout2];
  13154. [splitout1] crop=100:100:0:0 [cropout];
  13155. [splitout2] pad=200:200:100:100 [padout];
  13156. @end example
  13157. @item
  13158. Create 5 copies of the input audio with @command{ffmpeg}:
  13159. @example
  13160. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13161. @end example
  13162. @end itemize
  13163. @section zmq, azmq
  13164. Receive commands sent through a libzmq client, and forward them to
  13165. filters in the filtergraph.
  13166. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13167. must be inserted between two video filters, @code{azmq} between two
  13168. audio filters.
  13169. To enable these filters you need to install the libzmq library and
  13170. headers and configure FFmpeg with @code{--enable-libzmq}.
  13171. For more information about libzmq see:
  13172. @url{http://www.zeromq.org/}
  13173. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13174. receives messages sent through a network interface defined by the
  13175. @option{bind_address} option.
  13176. The received message must be in the form:
  13177. @example
  13178. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13179. @end example
  13180. @var{TARGET} specifies the target of the command, usually the name of
  13181. the filter class or a specific filter instance name.
  13182. @var{COMMAND} specifies the name of the command for the target filter.
  13183. @var{ARG} is optional and specifies the optional argument list for the
  13184. given @var{COMMAND}.
  13185. Upon reception, the message is processed and the corresponding command
  13186. is injected into the filtergraph. Depending on the result, the filter
  13187. will send a reply to the client, adopting the format:
  13188. @example
  13189. @var{ERROR_CODE} @var{ERROR_REASON}
  13190. @var{MESSAGE}
  13191. @end example
  13192. @var{MESSAGE} is optional.
  13193. @subsection Examples
  13194. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13195. be used to send commands processed by these filters.
  13196. Consider the following filtergraph generated by @command{ffplay}
  13197. @example
  13198. ffplay -dumpgraph 1 -f lavfi "
  13199. color=s=100x100:c=red [l];
  13200. color=s=100x100:c=blue [r];
  13201. nullsrc=s=200x100, zmq [bg];
  13202. [bg][l] overlay [bg+l];
  13203. [bg+l][r] overlay=x=100 "
  13204. @end example
  13205. To change the color of the left side of the video, the following
  13206. command can be used:
  13207. @example
  13208. echo Parsed_color_0 c yellow | tools/zmqsend
  13209. @end example
  13210. To change the right side:
  13211. @example
  13212. echo Parsed_color_1 c pink | tools/zmqsend
  13213. @end example
  13214. @c man end MULTIMEDIA FILTERS
  13215. @chapter Multimedia Sources
  13216. @c man begin MULTIMEDIA SOURCES
  13217. Below is a description of the currently available multimedia sources.
  13218. @section amovie
  13219. This is the same as @ref{movie} source, except it selects an audio
  13220. stream by default.
  13221. @anchor{movie}
  13222. @section movie
  13223. Read audio and/or video stream(s) from a movie container.
  13224. It accepts the following parameters:
  13225. @table @option
  13226. @item filename
  13227. The name of the resource to read (not necessarily a file; it can also be a
  13228. device or a stream accessed through some protocol).
  13229. @item format_name, f
  13230. Specifies the format assumed for the movie to read, and can be either
  13231. the name of a container or an input device. If not specified, the
  13232. format is guessed from @var{movie_name} or by probing.
  13233. @item seek_point, sp
  13234. Specifies the seek point in seconds. The frames will be output
  13235. starting from this seek point. The parameter is evaluated with
  13236. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13237. postfix. The default value is "0".
  13238. @item streams, s
  13239. Specifies the streams to read. Several streams can be specified,
  13240. separated by "+". The source will then have as many outputs, in the
  13241. same order. The syntax is explained in the ``Stream specifiers''
  13242. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13243. respectively the default (best suited) video and audio stream. Default
  13244. is "dv", or "da" if the filter is called as "amovie".
  13245. @item stream_index, si
  13246. Specifies the index of the video stream to read. If the value is -1,
  13247. the most suitable video stream will be automatically selected. The default
  13248. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13249. audio instead of video.
  13250. @item loop
  13251. Specifies how many times to read the stream in sequence.
  13252. If the value is less than 1, the stream will be read again and again.
  13253. Default value is "1".
  13254. Note that when the movie is looped the source timestamps are not
  13255. changed, so it will generate non monotonically increasing timestamps.
  13256. @item discontinuity
  13257. Specifies the time difference between frames above which the point is
  13258. considered a timestamp discontinuity which is removed by adjusting the later
  13259. timestamps.
  13260. @end table
  13261. It allows overlaying a second video on top of the main input of
  13262. a filtergraph, as shown in this graph:
  13263. @example
  13264. input -----------> deltapts0 --> overlay --> output
  13265. ^
  13266. |
  13267. movie --> scale--> deltapts1 -------+
  13268. @end example
  13269. @subsection Examples
  13270. @itemize
  13271. @item
  13272. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13273. on top of the input labelled "in":
  13274. @example
  13275. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13276. [in] setpts=PTS-STARTPTS [main];
  13277. [main][over] overlay=16:16 [out]
  13278. @end example
  13279. @item
  13280. Read from a video4linux2 device, and overlay it on top of the input
  13281. labelled "in":
  13282. @example
  13283. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13284. [in] setpts=PTS-STARTPTS [main];
  13285. [main][over] overlay=16:16 [out]
  13286. @end example
  13287. @item
  13288. Read the first video stream and the audio stream with id 0x81 from
  13289. dvd.vob; the video is connected to the pad named "video" and the audio is
  13290. connected to the pad named "audio":
  13291. @example
  13292. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13293. @end example
  13294. @end itemize
  13295. @subsection Commands
  13296. Both movie and amovie support the following commands:
  13297. @table @option
  13298. @item seek
  13299. Perform seek using "av_seek_frame".
  13300. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13301. @itemize
  13302. @item
  13303. @var{stream_index}: If stream_index is -1, a default
  13304. stream is selected, and @var{timestamp} is automatically converted
  13305. from AV_TIME_BASE units to the stream specific time_base.
  13306. @item
  13307. @var{timestamp}: Timestamp in AVStream.time_base units
  13308. or, if no stream is specified, in AV_TIME_BASE units.
  13309. @item
  13310. @var{flags}: Flags which select direction and seeking mode.
  13311. @end itemize
  13312. @item get_duration
  13313. Get movie duration in AV_TIME_BASE units.
  13314. @end table
  13315. @c man end MULTIMEDIA SOURCES