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.

20116 lines
533KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @anchor{afir}
  735. @section afir
  736. Apply an arbitrary Frequency Impulse Response filter.
  737. This filter is designed for applying long FIR filters,
  738. up to 30 seconds long.
  739. It can be used as component for digital crossover filters,
  740. room equalization, cross talk cancellation, wavefield synthesis,
  741. auralization, ambiophonics and ambisonics.
  742. This filter uses second stream as FIR coefficients.
  743. If second stream holds single channel, it will be used
  744. for all input channels in first stream, otherwise
  745. number of channels in second stream must be same as
  746. number of channels in first stream.
  747. It accepts the following parameters:
  748. @table @option
  749. @item dry
  750. Set dry gain. This sets input gain.
  751. @item wet
  752. Set wet gain. This sets final output gain.
  753. @item length
  754. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  755. @item again
  756. Enable applying gain measured from power of IR.
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  762. @example
  763. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  764. @end example
  765. @end itemize
  766. @anchor{aformat}
  767. @section aformat
  768. Set output format constraints for the input audio. The framework will
  769. negotiate the most appropriate format to minimize conversions.
  770. It accepts the following parameters:
  771. @table @option
  772. @item sample_fmts
  773. A '|'-separated list of requested sample formats.
  774. @item sample_rates
  775. A '|'-separated list of requested sample rates.
  776. @item channel_layouts
  777. A '|'-separated list of requested channel layouts.
  778. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  779. for the required syntax.
  780. @end table
  781. If a parameter is omitted, all values are allowed.
  782. Force the output to either unsigned 8-bit or signed 16-bit stereo
  783. @example
  784. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  785. @end example
  786. @section agate
  787. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  788. processing reduces disturbing noise between useful signals.
  789. Gating is done by detecting the volume below a chosen level @var{threshold}
  790. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  791. floor is set via @var{range}. Because an exact manipulation of the signal
  792. would cause distortion of the waveform the reduction can be levelled over
  793. time. This is done by setting @var{attack} and @var{release}.
  794. @var{attack} determines how long the signal has to fall below the threshold
  795. before any reduction will occur and @var{release} sets the time the signal
  796. has to rise above the threshold to reduce the reduction again.
  797. Shorter signals than the chosen attack time will be left untouched.
  798. @table @option
  799. @item level_in
  800. Set input level before filtering.
  801. Default is 1. Allowed range is from 0.015625 to 64.
  802. @item range
  803. Set the level of gain reduction when the signal is below the threshold.
  804. Default is 0.06125. Allowed range is from 0 to 1.
  805. @item threshold
  806. If a signal rises above this level the gain reduction is released.
  807. Default is 0.125. Allowed range is from 0 to 1.
  808. @item ratio
  809. Set a ratio by which the signal is reduced.
  810. Default is 2. Allowed range is from 1 to 9000.
  811. @item attack
  812. Amount of milliseconds the signal has to rise above the threshold before gain
  813. reduction stops.
  814. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  815. @item release
  816. Amount of milliseconds the signal has to fall below the threshold before the
  817. reduction is increased again. Default is 250 milliseconds.
  818. Allowed range is from 0.01 to 9000.
  819. @item makeup
  820. Set amount of amplification of signal after processing.
  821. Default is 1. Allowed range is from 1 to 64.
  822. @item knee
  823. Curve the sharp knee around the threshold to enter gain reduction more softly.
  824. Default is 2.828427125. Allowed range is from 1 to 8.
  825. @item detection
  826. Choose if exact signal should be taken for detection or an RMS like one.
  827. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  828. @item link
  829. Choose if the average level between all channels or the louder channel affects
  830. the reduction.
  831. Default is @code{average}. Can be @code{average} or @code{maximum}.
  832. @end table
  833. @section aiir
  834. Apply an arbitrary Infinite Impulse Response filter.
  835. It accepts the following parameters:
  836. @table @option
  837. @item a
  838. Set denominator/poles coefficients.
  839. @item b
  840. Set nominator/zeros coefficients.
  841. @item dry_gain
  842. Set input gain.
  843. @item wet_gain
  844. Set output gain.
  845. @end table
  846. Coefficients are separated by spaces and are in ascending order.
  847. Different coefficients can be provided for every channel, in such case
  848. use '|' to separate coefficients. Last provided coefficients will be
  849. used for all remaining channels.
  850. @subsection Examples
  851. @itemize
  852. @item
  853. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  854. @example
  855. aiir=b=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:a=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1
  856. @end example
  857. @end itemize
  858. @section alimiter
  859. The limiter prevents an input signal from rising over a desired threshold.
  860. This limiter uses lookahead technology to prevent your signal from distorting.
  861. It means that there is a small delay after the signal is processed. Keep in mind
  862. that the delay it produces is the attack time you set.
  863. The filter accepts the following options:
  864. @table @option
  865. @item level_in
  866. Set input gain. Default is 1.
  867. @item level_out
  868. Set output gain. Default is 1.
  869. @item limit
  870. Don't let signals above this level pass the limiter. Default is 1.
  871. @item attack
  872. The limiter will reach its attenuation level in this amount of time in
  873. milliseconds. Default is 5 milliseconds.
  874. @item release
  875. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  876. Default is 50 milliseconds.
  877. @item asc
  878. When gain reduction is always needed ASC takes care of releasing to an
  879. average reduction level rather than reaching a reduction of 0 in the release
  880. time.
  881. @item asc_level
  882. Select how much the release time is affected by ASC, 0 means nearly no changes
  883. in release time while 1 produces higher release times.
  884. @item level
  885. Auto level output signal. Default is enabled.
  886. This normalizes audio back to 0dB if enabled.
  887. @end table
  888. Depending on picked setting it is recommended to upsample input 2x or 4x times
  889. with @ref{aresample} before applying this filter.
  890. @section allpass
  891. Apply a two-pole all-pass filter with central frequency (in Hz)
  892. @var{frequency}, and filter-width @var{width}.
  893. An all-pass filter changes the audio's frequency to phase relationship
  894. without changing its frequency to amplitude relationship.
  895. The filter accepts the following options:
  896. @table @option
  897. @item frequency, f
  898. Set frequency in Hz.
  899. @item width_type, t
  900. Set method to specify band-width of filter.
  901. @table @option
  902. @item h
  903. Hz
  904. @item q
  905. Q-Factor
  906. @item o
  907. octave
  908. @item s
  909. slope
  910. @item k
  911. kHz
  912. @end table
  913. @item width, w
  914. Specify the band-width of a filter in width_type units.
  915. @item channels, c
  916. Specify which channels to filter, by default all available are filtered.
  917. @end table
  918. @subsection Commands
  919. This filter supports the following commands:
  920. @table @option
  921. @item frequency, f
  922. Change allpass frequency.
  923. Syntax for the command is : "@var{frequency}"
  924. @item width_type, t
  925. Change allpass width_type.
  926. Syntax for the command is : "@var{width_type}"
  927. @item width, w
  928. Change allpass width.
  929. Syntax for the command is : "@var{width}"
  930. @end table
  931. @section aloop
  932. Loop audio samples.
  933. The filter accepts the following options:
  934. @table @option
  935. @item loop
  936. Set the number of loops. Setting this value to -1 will result in infinite loops.
  937. Default is 0.
  938. @item size
  939. Set maximal number of samples. Default is 0.
  940. @item start
  941. Set first sample of loop. Default is 0.
  942. @end table
  943. @anchor{amerge}
  944. @section amerge
  945. Merge two or more audio streams into a single multi-channel stream.
  946. The filter accepts the following options:
  947. @table @option
  948. @item inputs
  949. Set the number of inputs. Default is 2.
  950. @end table
  951. If the channel layouts of the inputs are disjoint, and therefore compatible,
  952. the channel layout of the output will be set accordingly and the channels
  953. will be reordered as necessary. If the channel layouts of the inputs are not
  954. disjoint, the output will have all the channels of the first input then all
  955. the channels of the second input, in that order, and the channel layout of
  956. the output will be the default value corresponding to the total number of
  957. channels.
  958. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  959. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  960. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  961. first input, b1 is the first channel of the second input).
  962. On the other hand, if both input are in stereo, the output channels will be
  963. in the default order: a1, a2, b1, b2, and the channel layout will be
  964. arbitrarily set to 4.0, which may or may not be the expected value.
  965. All inputs must have the same sample rate, and format.
  966. If inputs do not have the same duration, the output will stop with the
  967. shortest.
  968. @subsection Examples
  969. @itemize
  970. @item
  971. Merge two mono files into a stereo stream:
  972. @example
  973. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  974. @end example
  975. @item
  976. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  977. @example
  978. 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
  979. @end example
  980. @end itemize
  981. @section amix
  982. Mixes multiple audio inputs into a single output.
  983. Note that this filter only supports float samples (the @var{amerge}
  984. and @var{pan} audio filters support many formats). If the @var{amix}
  985. input has integer samples then @ref{aresample} will be automatically
  986. inserted to perform the conversion to float samples.
  987. For example
  988. @example
  989. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  990. @end example
  991. will mix 3 input audio streams to a single output with the same duration as the
  992. first input and a dropout transition time of 3 seconds.
  993. It accepts the following parameters:
  994. @table @option
  995. @item inputs
  996. The number of inputs. If unspecified, it defaults to 2.
  997. @item duration
  998. How to determine the end-of-stream.
  999. @table @option
  1000. @item longest
  1001. The duration of the longest input. (default)
  1002. @item shortest
  1003. The duration of the shortest input.
  1004. @item first
  1005. The duration of the first input.
  1006. @end table
  1007. @item dropout_transition
  1008. The transition time, in seconds, for volume renormalization when an input
  1009. stream ends. The default value is 2 seconds.
  1010. @end table
  1011. @section anequalizer
  1012. High-order parametric multiband equalizer for each channel.
  1013. It accepts the following parameters:
  1014. @table @option
  1015. @item params
  1016. This option string is in format:
  1017. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1018. Each equalizer band is separated by '|'.
  1019. @table @option
  1020. @item chn
  1021. Set channel number to which equalization will be applied.
  1022. If input doesn't have that channel the entry is ignored.
  1023. @item f
  1024. Set central frequency for band.
  1025. If input doesn't have that frequency the entry is ignored.
  1026. @item w
  1027. Set band width in hertz.
  1028. @item g
  1029. Set band gain in dB.
  1030. @item t
  1031. Set filter type for band, optional, can be:
  1032. @table @samp
  1033. @item 0
  1034. Butterworth, this is default.
  1035. @item 1
  1036. Chebyshev type 1.
  1037. @item 2
  1038. Chebyshev type 2.
  1039. @end table
  1040. @end table
  1041. @item curves
  1042. With this option activated frequency response of anequalizer is displayed
  1043. in video stream.
  1044. @item size
  1045. Set video stream size. Only useful if curves option is activated.
  1046. @item mgain
  1047. Set max gain that will be displayed. Only useful if curves option is activated.
  1048. Setting this to a reasonable value makes it possible to display gain which is derived from
  1049. neighbour bands which are too close to each other and thus produce higher gain
  1050. when both are activated.
  1051. @item fscale
  1052. Set frequency scale used to draw frequency response in video output.
  1053. Can be linear or logarithmic. Default is logarithmic.
  1054. @item colors
  1055. Set color for each channel curve which is going to be displayed in video stream.
  1056. This is list of color names separated by space or by '|'.
  1057. Unrecognised or missing colors will be replaced by white color.
  1058. @end table
  1059. @subsection Examples
  1060. @itemize
  1061. @item
  1062. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1063. for first 2 channels using Chebyshev type 1 filter:
  1064. @example
  1065. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1066. @end example
  1067. @end itemize
  1068. @subsection Commands
  1069. This filter supports the following commands:
  1070. @table @option
  1071. @item change
  1072. Alter existing filter parameters.
  1073. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1074. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1075. error is returned.
  1076. @var{freq} set new frequency parameter.
  1077. @var{width} set new width parameter in herz.
  1078. @var{gain} set new gain parameter in dB.
  1079. Full filter invocation with asendcmd may look like this:
  1080. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1081. @end table
  1082. @section anull
  1083. Pass the audio source unchanged to the output.
  1084. @section apad
  1085. Pad the end of an audio stream with silence.
  1086. This can be used together with @command{ffmpeg} @option{-shortest} to
  1087. extend audio streams to the same length as the video stream.
  1088. A description of the accepted options follows.
  1089. @table @option
  1090. @item packet_size
  1091. Set silence packet size. Default value is 4096.
  1092. @item pad_len
  1093. Set the number of samples of silence to add to the end. After the
  1094. value is reached, the stream is terminated. This option is mutually
  1095. exclusive with @option{whole_len}.
  1096. @item whole_len
  1097. Set the minimum total number of samples in the output audio stream. If
  1098. the value is longer than the input audio length, silence is added to
  1099. the end, until the value is reached. This option is mutually exclusive
  1100. with @option{pad_len}.
  1101. @end table
  1102. If neither the @option{pad_len} nor the @option{whole_len} option is
  1103. set, the filter will add silence to the end of the input stream
  1104. indefinitely.
  1105. @subsection Examples
  1106. @itemize
  1107. @item
  1108. Add 1024 samples of silence to the end of the input:
  1109. @example
  1110. apad=pad_len=1024
  1111. @end example
  1112. @item
  1113. Make sure the audio output will contain at least 10000 samples, pad
  1114. the input with silence if required:
  1115. @example
  1116. apad=whole_len=10000
  1117. @end example
  1118. @item
  1119. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1120. video stream will always result the shortest and will be converted
  1121. until the end in the output file when using the @option{shortest}
  1122. option:
  1123. @example
  1124. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1125. @end example
  1126. @end itemize
  1127. @section aphaser
  1128. Add a phasing effect to the input audio.
  1129. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1130. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1131. A description of the accepted parameters follows.
  1132. @table @option
  1133. @item in_gain
  1134. Set input gain. Default is 0.4.
  1135. @item out_gain
  1136. Set output gain. Default is 0.74
  1137. @item delay
  1138. Set delay in milliseconds. Default is 3.0.
  1139. @item decay
  1140. Set decay. Default is 0.4.
  1141. @item speed
  1142. Set modulation speed in Hz. Default is 0.5.
  1143. @item type
  1144. Set modulation type. Default is triangular.
  1145. It accepts the following values:
  1146. @table @samp
  1147. @item triangular, t
  1148. @item sinusoidal, s
  1149. @end table
  1150. @end table
  1151. @section apulsator
  1152. Audio pulsator is something between an autopanner and a tremolo.
  1153. But it can produce funny stereo effects as well. Pulsator changes the volume
  1154. of the left and right channel based on a LFO (low frequency oscillator) with
  1155. different waveforms and shifted phases.
  1156. This filter have the ability to define an offset between left and right
  1157. channel. An offset of 0 means that both LFO shapes match each other.
  1158. The left and right channel are altered equally - a conventional tremolo.
  1159. An offset of 50% means that the shape of the right channel is exactly shifted
  1160. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1161. an autopanner. At 1 both curves match again. Every setting in between moves the
  1162. phase shift gapless between all stages and produces some "bypassing" sounds with
  1163. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1164. the 0.5) the faster the signal passes from the left to the right speaker.
  1165. The filter accepts the following options:
  1166. @table @option
  1167. @item level_in
  1168. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1169. @item level_out
  1170. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1171. @item mode
  1172. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1173. sawup or sawdown. Default is sine.
  1174. @item amount
  1175. Set modulation. Define how much of original signal is affected by the LFO.
  1176. @item offset_l
  1177. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1178. @item offset_r
  1179. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1180. @item width
  1181. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1182. @item timing
  1183. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1184. @item bpm
  1185. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1186. is set to bpm.
  1187. @item ms
  1188. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1189. is set to ms.
  1190. @item hz
  1191. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1192. if timing is set to hz.
  1193. @end table
  1194. @anchor{aresample}
  1195. @section aresample
  1196. Resample the input audio to the specified parameters, using the
  1197. libswresample library. If none are specified then the filter will
  1198. automatically convert between its input and output.
  1199. This filter is also able to stretch/squeeze the audio data to make it match
  1200. the timestamps or to inject silence / cut out audio to make it match the
  1201. timestamps, do a combination of both or do neither.
  1202. The filter accepts the syntax
  1203. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1204. expresses a sample rate and @var{resampler_options} is a list of
  1205. @var{key}=@var{value} pairs, separated by ":". See the
  1206. @ref{Resampler Options,,the "Resampler Options" section in the
  1207. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1208. for the complete list of supported options.
  1209. @subsection Examples
  1210. @itemize
  1211. @item
  1212. Resample the input audio to 44100Hz:
  1213. @example
  1214. aresample=44100
  1215. @end example
  1216. @item
  1217. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1218. samples per second compensation:
  1219. @example
  1220. aresample=async=1000
  1221. @end example
  1222. @end itemize
  1223. @section areverse
  1224. Reverse an audio clip.
  1225. Warning: This filter requires memory to buffer the entire clip, so trimming
  1226. is suggested.
  1227. @subsection Examples
  1228. @itemize
  1229. @item
  1230. Take the first 5 seconds of a clip, and reverse it.
  1231. @example
  1232. atrim=end=5,areverse
  1233. @end example
  1234. @end itemize
  1235. @section asetnsamples
  1236. Set the number of samples per each output audio frame.
  1237. The last output packet may contain a different number of samples, as
  1238. the filter will flush all the remaining samples when the input audio
  1239. signals its end.
  1240. The filter accepts the following options:
  1241. @table @option
  1242. @item nb_out_samples, n
  1243. Set the number of frames per each output audio frame. The number is
  1244. intended as the number of samples @emph{per each channel}.
  1245. Default value is 1024.
  1246. @item pad, p
  1247. If set to 1, the filter will pad the last audio frame with zeroes, so
  1248. that the last frame will contain the same number of samples as the
  1249. previous ones. Default value is 1.
  1250. @end table
  1251. For example, to set the number of per-frame samples to 1234 and
  1252. disable padding for the last frame, use:
  1253. @example
  1254. asetnsamples=n=1234:p=0
  1255. @end example
  1256. @section asetrate
  1257. Set the sample rate without altering the PCM data.
  1258. This will result in a change of speed and pitch.
  1259. The filter accepts the following options:
  1260. @table @option
  1261. @item sample_rate, r
  1262. Set the output sample rate. Default is 44100 Hz.
  1263. @end table
  1264. @section ashowinfo
  1265. Show a line containing various information for each input audio frame.
  1266. The input audio is not modified.
  1267. The shown line contains a sequence of key/value pairs of the form
  1268. @var{key}:@var{value}.
  1269. The following values are shown in the output:
  1270. @table @option
  1271. @item n
  1272. The (sequential) number of the input frame, starting from 0.
  1273. @item pts
  1274. The presentation timestamp of the input frame, in time base units; the time base
  1275. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1276. @item pts_time
  1277. The presentation timestamp of the input frame in seconds.
  1278. @item pos
  1279. position of the frame in the input stream, -1 if this information in
  1280. unavailable and/or meaningless (for example in case of synthetic audio)
  1281. @item fmt
  1282. The sample format.
  1283. @item chlayout
  1284. The channel layout.
  1285. @item rate
  1286. The sample rate for the audio frame.
  1287. @item nb_samples
  1288. The number of samples (per channel) in the frame.
  1289. @item checksum
  1290. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1291. audio, the data is treated as if all the planes were concatenated.
  1292. @item plane_checksums
  1293. A list of Adler-32 checksums for each data plane.
  1294. @end table
  1295. @anchor{astats}
  1296. @section astats
  1297. Display time domain statistical information about the audio channels.
  1298. Statistics are calculated and displayed for each audio channel and,
  1299. where applicable, an overall figure is also given.
  1300. It accepts the following option:
  1301. @table @option
  1302. @item length
  1303. Short window length in seconds, used for peak and trough RMS measurement.
  1304. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1305. @item metadata
  1306. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1307. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1308. disabled.
  1309. Available keys for each channel are:
  1310. DC_offset
  1311. Min_level
  1312. Max_level
  1313. Min_difference
  1314. Max_difference
  1315. Mean_difference
  1316. RMS_difference
  1317. Peak_level
  1318. RMS_peak
  1319. RMS_trough
  1320. Crest_factor
  1321. Flat_factor
  1322. Peak_count
  1323. Bit_depth
  1324. Dynamic_range
  1325. and for Overall:
  1326. DC_offset
  1327. Min_level
  1328. Max_level
  1329. Min_difference
  1330. Max_difference
  1331. Mean_difference
  1332. RMS_difference
  1333. Peak_level
  1334. RMS_level
  1335. RMS_peak
  1336. RMS_trough
  1337. Flat_factor
  1338. Peak_count
  1339. Bit_depth
  1340. Number_of_samples
  1341. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1342. this @code{lavfi.astats.Overall.Peak_count}.
  1343. For description what each key means read below.
  1344. @item reset
  1345. Set number of frame after which stats are going to be recalculated.
  1346. Default is disabled.
  1347. @end table
  1348. A description of each shown parameter follows:
  1349. @table @option
  1350. @item DC offset
  1351. Mean amplitude displacement from zero.
  1352. @item Min level
  1353. Minimal sample level.
  1354. @item Max level
  1355. Maximal sample level.
  1356. @item Min difference
  1357. Minimal difference between two consecutive samples.
  1358. @item Max difference
  1359. Maximal difference between two consecutive samples.
  1360. @item Mean difference
  1361. Mean difference between two consecutive samples.
  1362. The average of each difference between two consecutive samples.
  1363. @item RMS difference
  1364. Root Mean Square difference between two consecutive samples.
  1365. @item Peak level dB
  1366. @item RMS level dB
  1367. Standard peak and RMS level measured in dBFS.
  1368. @item RMS peak dB
  1369. @item RMS trough dB
  1370. Peak and trough values for RMS level measured over a short window.
  1371. @item Crest factor
  1372. Standard ratio of peak to RMS level (note: not in dB).
  1373. @item Flat factor
  1374. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1375. (i.e. either @var{Min level} or @var{Max level}).
  1376. @item Peak count
  1377. Number of occasions (not the number of samples) that the signal attained either
  1378. @var{Min level} or @var{Max level}.
  1379. @item Bit depth
  1380. Overall bit depth of audio. Number of bits used for each sample.
  1381. @item Dynamic range
  1382. Measured dynamic range of audio in dB.
  1383. @end table
  1384. @section atempo
  1385. Adjust audio tempo.
  1386. The filter accepts exactly one parameter, the audio tempo. If not
  1387. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1388. be in the [0.5, 2.0] range.
  1389. @subsection Examples
  1390. @itemize
  1391. @item
  1392. Slow down audio to 80% tempo:
  1393. @example
  1394. atempo=0.8
  1395. @end example
  1396. @item
  1397. To speed up audio to 125% tempo:
  1398. @example
  1399. atempo=1.25
  1400. @end example
  1401. @end itemize
  1402. @section atrim
  1403. Trim the input so that the output contains one continuous subpart of the input.
  1404. It accepts the following parameters:
  1405. @table @option
  1406. @item start
  1407. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1408. sample with the timestamp @var{start} will be the first sample in the output.
  1409. @item end
  1410. Specify time of the first audio sample that will be dropped, i.e. the
  1411. audio sample immediately preceding the one with the timestamp @var{end} will be
  1412. the last sample in the output.
  1413. @item start_pts
  1414. Same as @var{start}, except this option sets the start timestamp in samples
  1415. instead of seconds.
  1416. @item end_pts
  1417. Same as @var{end}, except this option sets the end timestamp in samples instead
  1418. of seconds.
  1419. @item duration
  1420. The maximum duration of the output in seconds.
  1421. @item start_sample
  1422. The number of the first sample that should be output.
  1423. @item end_sample
  1424. The number of the first sample that should be dropped.
  1425. @end table
  1426. @option{start}, @option{end}, and @option{duration} are expressed as time
  1427. duration specifications; see
  1428. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1429. Note that the first two sets of the start/end options and the @option{duration}
  1430. option look at the frame timestamp, while the _sample options simply count the
  1431. samples that pass through the filter. So start/end_pts and start/end_sample will
  1432. give different results when the timestamps are wrong, inexact or do not start at
  1433. zero. Also note that this filter does not modify the timestamps. If you wish
  1434. to have the output timestamps start at zero, insert the asetpts filter after the
  1435. atrim filter.
  1436. If multiple start or end options are set, this filter tries to be greedy and
  1437. keep all samples that match at least one of the specified constraints. To keep
  1438. only the part that matches all the constraints at once, chain multiple atrim
  1439. filters.
  1440. The defaults are such that all the input is kept. So it is possible to set e.g.
  1441. just the end values to keep everything before the specified time.
  1442. Examples:
  1443. @itemize
  1444. @item
  1445. Drop everything except the second minute of input:
  1446. @example
  1447. ffmpeg -i INPUT -af atrim=60:120
  1448. @end example
  1449. @item
  1450. Keep only the first 1000 samples:
  1451. @example
  1452. ffmpeg -i INPUT -af atrim=end_sample=1000
  1453. @end example
  1454. @end itemize
  1455. @section bandpass
  1456. Apply a two-pole Butterworth band-pass filter with central
  1457. frequency @var{frequency}, and (3dB-point) band-width width.
  1458. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1459. instead of the default: constant 0dB peak gain.
  1460. The filter roll off at 6dB per octave (20dB per decade).
  1461. The filter accepts the following options:
  1462. @table @option
  1463. @item frequency, f
  1464. Set the filter's central frequency. Default is @code{3000}.
  1465. @item csg
  1466. Constant skirt gain if set to 1. Defaults to 0.
  1467. @item width_type, t
  1468. Set method to specify band-width of filter.
  1469. @table @option
  1470. @item h
  1471. Hz
  1472. @item q
  1473. Q-Factor
  1474. @item o
  1475. octave
  1476. @item s
  1477. slope
  1478. @item k
  1479. kHz
  1480. @end table
  1481. @item width, w
  1482. Specify the band-width of a filter in width_type units.
  1483. @item channels, c
  1484. Specify which channels to filter, by default all available are filtered.
  1485. @end table
  1486. @subsection Commands
  1487. This filter supports the following commands:
  1488. @table @option
  1489. @item frequency, f
  1490. Change bandpass frequency.
  1491. Syntax for the command is : "@var{frequency}"
  1492. @item width_type, t
  1493. Change bandpass width_type.
  1494. Syntax for the command is : "@var{width_type}"
  1495. @item width, w
  1496. Change bandpass width.
  1497. Syntax for the command is : "@var{width}"
  1498. @end table
  1499. @section bandreject
  1500. Apply a two-pole Butterworth band-reject filter with central
  1501. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1502. The filter roll off at 6dB per octave (20dB per decade).
  1503. The filter accepts the following options:
  1504. @table @option
  1505. @item frequency, f
  1506. Set the filter's central frequency. Default is @code{3000}.
  1507. @item width_type, t
  1508. Set method to specify band-width of filter.
  1509. @table @option
  1510. @item h
  1511. Hz
  1512. @item q
  1513. Q-Factor
  1514. @item o
  1515. octave
  1516. @item s
  1517. slope
  1518. @item k
  1519. kHz
  1520. @end table
  1521. @item width, w
  1522. Specify the band-width of a filter in width_type units.
  1523. @item channels, c
  1524. Specify which channels to filter, by default all available are filtered.
  1525. @end table
  1526. @subsection Commands
  1527. This filter supports the following commands:
  1528. @table @option
  1529. @item frequency, f
  1530. Change bandreject frequency.
  1531. Syntax for the command is : "@var{frequency}"
  1532. @item width_type, t
  1533. Change bandreject width_type.
  1534. Syntax for the command is : "@var{width_type}"
  1535. @item width, w
  1536. Change bandreject width.
  1537. Syntax for the command is : "@var{width}"
  1538. @end table
  1539. @section bass
  1540. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1541. shelving filter with a response similar to that of a standard
  1542. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1543. The filter accepts the following options:
  1544. @table @option
  1545. @item gain, g
  1546. Give the gain at 0 Hz. Its useful range is about -20
  1547. (for a large cut) to +20 (for a large boost).
  1548. Beware of clipping when using a positive gain.
  1549. @item frequency, f
  1550. Set the filter's central frequency and so can be used
  1551. to extend or reduce the frequency range to be boosted or cut.
  1552. The default value is @code{100} Hz.
  1553. @item width_type, t
  1554. Set method to specify band-width of filter.
  1555. @table @option
  1556. @item h
  1557. Hz
  1558. @item q
  1559. Q-Factor
  1560. @item o
  1561. octave
  1562. @item s
  1563. slope
  1564. @item k
  1565. kHz
  1566. @end table
  1567. @item width, w
  1568. Determine how steep is the filter's shelf transition.
  1569. @item channels, c
  1570. Specify which channels to filter, by default all available are filtered.
  1571. @end table
  1572. @subsection Commands
  1573. This filter supports the following commands:
  1574. @table @option
  1575. @item frequency, f
  1576. Change bass frequency.
  1577. Syntax for the command is : "@var{frequency}"
  1578. @item width_type, t
  1579. Change bass width_type.
  1580. Syntax for the command is : "@var{width_type}"
  1581. @item width, w
  1582. Change bass width.
  1583. Syntax for the command is : "@var{width}"
  1584. @item gain, g
  1585. Change bass gain.
  1586. Syntax for the command is : "@var{gain}"
  1587. @end table
  1588. @section biquad
  1589. Apply a biquad IIR filter with the given coefficients.
  1590. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1591. are the numerator and denominator coefficients respectively.
  1592. and @var{channels}, @var{c} specify which channels to filter, by default all
  1593. available are filtered.
  1594. @subsection Commands
  1595. This filter supports the following commands:
  1596. @table @option
  1597. @item a0
  1598. @item a1
  1599. @item a2
  1600. @item b0
  1601. @item b1
  1602. @item b2
  1603. Change biquad parameter.
  1604. Syntax for the command is : "@var{value}"
  1605. @end table
  1606. @section bs2b
  1607. Bauer stereo to binaural transformation, which improves headphone listening of
  1608. stereo audio records.
  1609. To enable compilation of this filter you need to configure FFmpeg with
  1610. @code{--enable-libbs2b}.
  1611. It accepts the following parameters:
  1612. @table @option
  1613. @item profile
  1614. Pre-defined crossfeed level.
  1615. @table @option
  1616. @item default
  1617. Default level (fcut=700, feed=50).
  1618. @item cmoy
  1619. Chu Moy circuit (fcut=700, feed=60).
  1620. @item jmeier
  1621. Jan Meier circuit (fcut=650, feed=95).
  1622. @end table
  1623. @item fcut
  1624. Cut frequency (in Hz).
  1625. @item feed
  1626. Feed level (in Hz).
  1627. @end table
  1628. @section channelmap
  1629. Remap input channels to new locations.
  1630. It accepts the following parameters:
  1631. @table @option
  1632. @item map
  1633. Map channels from input to output. The argument is a '|'-separated list of
  1634. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1635. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1636. channel (e.g. FL for front left) or its index in the input channel layout.
  1637. @var{out_channel} is the name of the output channel or its index in the output
  1638. channel layout. If @var{out_channel} is not given then it is implicitly an
  1639. index, starting with zero and increasing by one for each mapping.
  1640. @item channel_layout
  1641. The channel layout of the output stream.
  1642. @end table
  1643. If no mapping is present, the filter will implicitly map input channels to
  1644. output channels, preserving indices.
  1645. For example, assuming a 5.1+downmix input MOV file,
  1646. @example
  1647. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1648. @end example
  1649. will create an output WAV file tagged as stereo from the downmix channels of
  1650. the input.
  1651. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1652. @example
  1653. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1654. @end example
  1655. @section channelsplit
  1656. Split each channel from an input audio stream into a separate output stream.
  1657. It accepts the following parameters:
  1658. @table @option
  1659. @item channel_layout
  1660. The channel layout of the input stream. The default is "stereo".
  1661. @end table
  1662. For example, assuming a stereo input MP3 file,
  1663. @example
  1664. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1665. @end example
  1666. will create an output Matroska file with two audio streams, one containing only
  1667. the left channel and the other the right channel.
  1668. Split a 5.1 WAV file into per-channel files:
  1669. @example
  1670. ffmpeg -i in.wav -filter_complex
  1671. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1672. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1673. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1674. side_right.wav
  1675. @end example
  1676. @section chorus
  1677. Add a chorus effect to the audio.
  1678. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1679. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1680. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1681. The modulation depth defines the range the modulated delay is played before or after
  1682. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1683. sound tuned around the original one, like in a chorus where some vocals are slightly
  1684. off key.
  1685. It accepts the following parameters:
  1686. @table @option
  1687. @item in_gain
  1688. Set input gain. Default is 0.4.
  1689. @item out_gain
  1690. Set output gain. Default is 0.4.
  1691. @item delays
  1692. Set delays. A typical delay is around 40ms to 60ms.
  1693. @item decays
  1694. Set decays.
  1695. @item speeds
  1696. Set speeds.
  1697. @item depths
  1698. Set depths.
  1699. @end table
  1700. @subsection Examples
  1701. @itemize
  1702. @item
  1703. A single delay:
  1704. @example
  1705. chorus=0.7:0.9:55:0.4:0.25:2
  1706. @end example
  1707. @item
  1708. Two delays:
  1709. @example
  1710. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1711. @end example
  1712. @item
  1713. Fuller sounding chorus with three delays:
  1714. @example
  1715. 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
  1716. @end example
  1717. @end itemize
  1718. @section compand
  1719. Compress or expand the audio's dynamic range.
  1720. It accepts the following parameters:
  1721. @table @option
  1722. @item attacks
  1723. @item decays
  1724. A list of times in seconds for each channel over which the instantaneous level
  1725. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1726. increase of volume and @var{decays} refers to decrease of volume. For most
  1727. situations, the attack time (response to the audio getting louder) should be
  1728. shorter than the decay time, because the human ear is more sensitive to sudden
  1729. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1730. a typical value for decay is 0.8 seconds.
  1731. If specified number of attacks & decays is lower than number of channels, the last
  1732. set attack/decay will be used for all remaining channels.
  1733. @item points
  1734. A list of points for the transfer function, specified in dB relative to the
  1735. maximum possible signal amplitude. Each key points list must be defined using
  1736. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1737. @code{x0/y0 x1/y1 x2/y2 ....}
  1738. The input values must be in strictly increasing order but the transfer function
  1739. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1740. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1741. function are @code{-70/-70|-60/-20|1/0}.
  1742. @item soft-knee
  1743. Set the curve radius in dB for all joints. It defaults to 0.01.
  1744. @item gain
  1745. Set the additional gain in dB to be applied at all points on the transfer
  1746. function. This allows for easy adjustment of the overall gain.
  1747. It defaults to 0.
  1748. @item volume
  1749. Set an initial volume, in dB, to be assumed for each channel when filtering
  1750. starts. This permits the user to supply a nominal level initially, so that, for
  1751. example, a very large gain is not applied to initial signal levels before the
  1752. companding has begun to operate. A typical value for audio which is initially
  1753. quiet is -90 dB. It defaults to 0.
  1754. @item delay
  1755. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1756. delayed before being fed to the volume adjuster. Specifying a delay
  1757. approximately equal to the attack/decay times allows the filter to effectively
  1758. operate in predictive rather than reactive mode. It defaults to 0.
  1759. @end table
  1760. @subsection Examples
  1761. @itemize
  1762. @item
  1763. Make music with both quiet and loud passages suitable for listening to in a
  1764. noisy environment:
  1765. @example
  1766. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1767. @end example
  1768. Another example for audio with whisper and explosion parts:
  1769. @example
  1770. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1771. @end example
  1772. @item
  1773. A noise gate for when the noise is at a lower level than the signal:
  1774. @example
  1775. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1776. @end example
  1777. @item
  1778. Here is another noise gate, this time for when the noise is at a higher level
  1779. than the signal (making it, in some ways, similar to squelch):
  1780. @example
  1781. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1782. @end example
  1783. @item
  1784. 2:1 compression starting at -6dB:
  1785. @example
  1786. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1787. @end example
  1788. @item
  1789. 2:1 compression starting at -9dB:
  1790. @example
  1791. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1792. @end example
  1793. @item
  1794. 2:1 compression starting at -12dB:
  1795. @example
  1796. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1797. @end example
  1798. @item
  1799. 2:1 compression starting at -18dB:
  1800. @example
  1801. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1802. @end example
  1803. @item
  1804. 3:1 compression starting at -15dB:
  1805. @example
  1806. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1807. @end example
  1808. @item
  1809. Compressor/Gate:
  1810. @example
  1811. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1812. @end example
  1813. @item
  1814. Expander:
  1815. @example
  1816. 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
  1817. @end example
  1818. @item
  1819. Hard limiter at -6dB:
  1820. @example
  1821. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1822. @end example
  1823. @item
  1824. Hard limiter at -12dB:
  1825. @example
  1826. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1827. @end example
  1828. @item
  1829. Hard noise gate at -35 dB:
  1830. @example
  1831. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1832. @end example
  1833. @item
  1834. Soft limiter:
  1835. @example
  1836. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1837. @end example
  1838. @end itemize
  1839. @section compensationdelay
  1840. Compensation Delay Line is a metric based delay to compensate differing
  1841. positions of microphones or speakers.
  1842. For example, you have recorded guitar with two microphones placed in
  1843. different location. Because the front of sound wave has fixed speed in
  1844. normal conditions, the phasing of microphones can vary and depends on
  1845. their location and interposition. The best sound mix can be achieved when
  1846. these microphones are in phase (synchronized). Note that distance of
  1847. ~30 cm between microphones makes one microphone to capture signal in
  1848. antiphase to another microphone. That makes the final mix sounding moody.
  1849. This filter helps to solve phasing problems by adding different delays
  1850. to each microphone track and make them synchronized.
  1851. The best result can be reached when you take one track as base and
  1852. synchronize other tracks one by one with it.
  1853. Remember that synchronization/delay tolerance depends on sample rate, too.
  1854. Higher sample rates will give more tolerance.
  1855. It accepts the following parameters:
  1856. @table @option
  1857. @item mm
  1858. Set millimeters distance. This is compensation distance for fine tuning.
  1859. Default is 0.
  1860. @item cm
  1861. Set cm distance. This is compensation distance for tightening distance setup.
  1862. Default is 0.
  1863. @item m
  1864. Set meters distance. This is compensation distance for hard distance setup.
  1865. Default is 0.
  1866. @item dry
  1867. Set dry amount. Amount of unprocessed (dry) signal.
  1868. Default is 0.
  1869. @item wet
  1870. Set wet amount. Amount of processed (wet) signal.
  1871. Default is 1.
  1872. @item temp
  1873. Set temperature degree in Celsius. This is the temperature of the environment.
  1874. Default is 20.
  1875. @end table
  1876. @section crossfeed
  1877. Apply headphone crossfeed filter.
  1878. Crossfeed is the process of blending the left and right channels of stereo
  1879. audio recording.
  1880. It is mainly used to reduce extreme stereo separation of low frequencies.
  1881. The intent is to produce more speaker like sound to the listener.
  1882. The filter accepts the following options:
  1883. @table @option
  1884. @item strength
  1885. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1886. This sets gain of low shelf filter for side part of stereo image.
  1887. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1888. @item range
  1889. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1890. This sets cut off frequency of low shelf filter. Default is cut off near
  1891. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1892. @item level_in
  1893. Set input gain. Default is 0.9.
  1894. @item level_out
  1895. Set output gain. Default is 1.
  1896. @end table
  1897. @section crystalizer
  1898. Simple algorithm to expand audio dynamic range.
  1899. The filter accepts the following options:
  1900. @table @option
  1901. @item i
  1902. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1903. (unchanged sound) to 10.0 (maximum effect).
  1904. @item c
  1905. Enable clipping. By default is enabled.
  1906. @end table
  1907. @section dcshift
  1908. Apply a DC shift to the audio.
  1909. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1910. in the recording chain) from the audio. The effect of a DC offset is reduced
  1911. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1912. a signal has a DC offset.
  1913. @table @option
  1914. @item shift
  1915. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1916. the audio.
  1917. @item limitergain
  1918. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1919. used to prevent clipping.
  1920. @end table
  1921. @section dynaudnorm
  1922. Dynamic Audio Normalizer.
  1923. This filter applies a certain amount of gain to the input audio in order
  1924. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1925. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1926. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1927. This allows for applying extra gain to the "quiet" sections of the audio
  1928. while avoiding distortions or clipping the "loud" sections. In other words:
  1929. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1930. sections, in the sense that the volume of each section is brought to the
  1931. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1932. this goal *without* applying "dynamic range compressing". It will retain 100%
  1933. of the dynamic range *within* each section of the audio file.
  1934. @table @option
  1935. @item f
  1936. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1937. Default is 500 milliseconds.
  1938. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1939. referred to as frames. This is required, because a peak magnitude has no
  1940. meaning for just a single sample value. Instead, we need to determine the
  1941. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1942. normalizer would simply use the peak magnitude of the complete file, the
  1943. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1944. frame. The length of a frame is specified in milliseconds. By default, the
  1945. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1946. been found to give good results with most files.
  1947. Note that the exact frame length, in number of samples, will be determined
  1948. automatically, based on the sampling rate of the individual input audio file.
  1949. @item g
  1950. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1951. number. Default is 31.
  1952. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1953. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1954. is specified in frames, centered around the current frame. For the sake of
  1955. simplicity, this must be an odd number. Consequently, the default value of 31
  1956. takes into account the current frame, as well as the 15 preceding frames and
  1957. the 15 subsequent frames. Using a larger window results in a stronger
  1958. smoothing effect and thus in less gain variation, i.e. slower gain
  1959. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1960. effect and thus in more gain variation, i.e. faster gain adaptation.
  1961. In other words, the more you increase this value, the more the Dynamic Audio
  1962. Normalizer will behave like a "traditional" normalization filter. On the
  1963. contrary, the more you decrease this value, the more the Dynamic Audio
  1964. Normalizer will behave like a dynamic range compressor.
  1965. @item p
  1966. Set the target peak value. This specifies the highest permissible magnitude
  1967. level for the normalized audio input. This filter will try to approach the
  1968. target peak magnitude as closely as possible, but at the same time it also
  1969. makes sure that the normalized signal will never exceed the peak magnitude.
  1970. A frame's maximum local gain factor is imposed directly by the target peak
  1971. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1972. It is not recommended to go above this value.
  1973. @item m
  1974. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1975. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1976. factor for each input frame, i.e. the maximum gain factor that does not
  1977. result in clipping or distortion. The maximum gain factor is determined by
  1978. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1979. additionally bounds the frame's maximum gain factor by a predetermined
  1980. (global) maximum gain factor. This is done in order to avoid excessive gain
  1981. factors in "silent" or almost silent frames. By default, the maximum gain
  1982. factor is 10.0, For most inputs the default value should be sufficient and
  1983. it usually is not recommended to increase this value. Though, for input
  1984. with an extremely low overall volume level, it may be necessary to allow even
  1985. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1986. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1987. Instead, a "sigmoid" threshold function will be applied. This way, the
  1988. gain factors will smoothly approach the threshold value, but never exceed that
  1989. value.
  1990. @item r
  1991. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1992. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1993. This means that the maximum local gain factor for each frame is defined
  1994. (only) by the frame's highest magnitude sample. This way, the samples can
  1995. be amplified as much as possible without exceeding the maximum signal
  1996. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1997. Normalizer can also take into account the frame's root mean square,
  1998. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1999. determine the power of a time-varying signal. It is therefore considered
  2000. that the RMS is a better approximation of the "perceived loudness" than
  2001. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2002. frames to a constant RMS value, a uniform "perceived loudness" can be
  2003. established. If a target RMS value has been specified, a frame's local gain
  2004. factor is defined as the factor that would result in exactly that RMS value.
  2005. Note, however, that the maximum local gain factor is still restricted by the
  2006. frame's highest magnitude sample, in order to prevent clipping.
  2007. @item n
  2008. Enable channels coupling. By default is enabled.
  2009. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2010. amount. This means the same gain factor will be applied to all channels, i.e.
  2011. the maximum possible gain factor is determined by the "loudest" channel.
  2012. However, in some recordings, it may happen that the volume of the different
  2013. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2014. In this case, this option can be used to disable the channel coupling. This way,
  2015. the gain factor will be determined independently for each channel, depending
  2016. only on the individual channel's highest magnitude sample. This allows for
  2017. harmonizing the volume of the different channels.
  2018. @item c
  2019. Enable DC bias correction. By default is disabled.
  2020. An audio signal (in the time domain) is a sequence of sample values.
  2021. In the Dynamic Audio Normalizer these sample values are represented in the
  2022. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2023. audio signal, or "waveform", should be centered around the zero point.
  2024. That means if we calculate the mean value of all samples in a file, or in a
  2025. single frame, then the result should be 0.0 or at least very close to that
  2026. value. If, however, there is a significant deviation of the mean value from
  2027. 0.0, in either positive or negative direction, this is referred to as a
  2028. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2029. Audio Normalizer provides optional DC bias correction.
  2030. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2031. the mean value, or "DC correction" offset, of each input frame and subtract
  2032. that value from all of the frame's sample values which ensures those samples
  2033. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2034. boundaries, the DC correction offset values will be interpolated smoothly
  2035. between neighbouring frames.
  2036. @item b
  2037. Enable alternative boundary mode. By default is disabled.
  2038. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2039. around each frame. This includes the preceding frames as well as the
  2040. subsequent frames. However, for the "boundary" frames, located at the very
  2041. beginning and at the very end of the audio file, not all neighbouring
  2042. frames are available. In particular, for the first few frames in the audio
  2043. file, the preceding frames are not known. And, similarly, for the last few
  2044. frames in the audio file, the subsequent frames are not known. Thus, the
  2045. question arises which gain factors should be assumed for the missing frames
  2046. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2047. to deal with this situation. The default boundary mode assumes a gain factor
  2048. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2049. "fade out" at the beginning and at the end of the input, respectively.
  2050. @item s
  2051. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2052. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2053. compression. This means that signal peaks will not be pruned and thus the
  2054. full dynamic range will be retained within each local neighbourhood. However,
  2055. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2056. normalization algorithm with a more "traditional" compression.
  2057. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2058. (thresholding) function. If (and only if) the compression feature is enabled,
  2059. all input frames will be processed by a soft knee thresholding function prior
  2060. to the actual normalization process. Put simply, the thresholding function is
  2061. going to prune all samples whose magnitude exceeds a certain threshold value.
  2062. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2063. value. Instead, the threshold value will be adjusted for each individual
  2064. frame.
  2065. In general, smaller parameters result in stronger compression, and vice versa.
  2066. Values below 3.0 are not recommended, because audible distortion may appear.
  2067. @end table
  2068. @section earwax
  2069. Make audio easier to listen to on headphones.
  2070. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2071. so that when listened to on headphones the stereo image is moved from
  2072. inside your head (standard for headphones) to outside and in front of
  2073. the listener (standard for speakers).
  2074. Ported from SoX.
  2075. @section equalizer
  2076. Apply a two-pole peaking equalisation (EQ) filter. With this
  2077. filter, the signal-level at and around a selected frequency can
  2078. be increased or decreased, whilst (unlike bandpass and bandreject
  2079. filters) that at all other frequencies is unchanged.
  2080. In order to produce complex equalisation curves, this filter can
  2081. be given several times, each with a different central frequency.
  2082. The filter accepts the following options:
  2083. @table @option
  2084. @item frequency, f
  2085. Set the filter's central frequency in Hz.
  2086. @item width_type, t
  2087. Set method to specify band-width of filter.
  2088. @table @option
  2089. @item h
  2090. Hz
  2091. @item q
  2092. Q-Factor
  2093. @item o
  2094. octave
  2095. @item s
  2096. slope
  2097. @item k
  2098. kHz
  2099. @end table
  2100. @item width, w
  2101. Specify the band-width of a filter in width_type units.
  2102. @item gain, g
  2103. Set the required gain or attenuation in dB.
  2104. Beware of clipping when using a positive gain.
  2105. @item channels, c
  2106. Specify which channels to filter, by default all available are filtered.
  2107. @end table
  2108. @subsection Examples
  2109. @itemize
  2110. @item
  2111. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2112. @example
  2113. equalizer=f=1000:t=h:width=200:g=-10
  2114. @end example
  2115. @item
  2116. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2117. @example
  2118. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2119. @end example
  2120. @end itemize
  2121. @subsection Commands
  2122. This filter supports the following commands:
  2123. @table @option
  2124. @item frequency, f
  2125. Change equalizer frequency.
  2126. Syntax for the command is : "@var{frequency}"
  2127. @item width_type, t
  2128. Change equalizer width_type.
  2129. Syntax for the command is : "@var{width_type}"
  2130. @item width, w
  2131. Change equalizer width.
  2132. Syntax for the command is : "@var{width}"
  2133. @item gain, g
  2134. Change equalizer gain.
  2135. Syntax for the command is : "@var{gain}"
  2136. @end table
  2137. @section extrastereo
  2138. Linearly increases the difference between left and right channels which
  2139. adds some sort of "live" effect to playback.
  2140. The filter accepts the following options:
  2141. @table @option
  2142. @item m
  2143. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2144. (average of both channels), with 1.0 sound will be unchanged, with
  2145. -1.0 left and right channels will be swapped.
  2146. @item c
  2147. Enable clipping. By default is enabled.
  2148. @end table
  2149. @section firequalizer
  2150. Apply FIR Equalization using arbitrary frequency response.
  2151. The filter accepts the following option:
  2152. @table @option
  2153. @item gain
  2154. Set gain curve equation (in dB). The expression can contain variables:
  2155. @table @option
  2156. @item f
  2157. the evaluated frequency
  2158. @item sr
  2159. sample rate
  2160. @item ch
  2161. channel number, set to 0 when multichannels evaluation is disabled
  2162. @item chid
  2163. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2164. multichannels evaluation is disabled
  2165. @item chs
  2166. number of channels
  2167. @item chlayout
  2168. channel_layout, see libavutil/channel_layout.h
  2169. @end table
  2170. and functions:
  2171. @table @option
  2172. @item gain_interpolate(f)
  2173. interpolate gain on frequency f based on gain_entry
  2174. @item cubic_interpolate(f)
  2175. same as gain_interpolate, but smoother
  2176. @end table
  2177. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2178. @item gain_entry
  2179. Set gain entry for gain_interpolate function. The expression can
  2180. contain functions:
  2181. @table @option
  2182. @item entry(f, g)
  2183. store gain entry at frequency f with value g
  2184. @end table
  2185. This option is also available as command.
  2186. @item delay
  2187. Set filter delay in seconds. Higher value means more accurate.
  2188. Default is @code{0.01}.
  2189. @item accuracy
  2190. Set filter accuracy in Hz. Lower value means more accurate.
  2191. Default is @code{5}.
  2192. @item wfunc
  2193. Set window function. Acceptable values are:
  2194. @table @option
  2195. @item rectangular
  2196. rectangular window, useful when gain curve is already smooth
  2197. @item hann
  2198. hann window (default)
  2199. @item hamming
  2200. hamming window
  2201. @item blackman
  2202. blackman window
  2203. @item nuttall3
  2204. 3-terms continuous 1st derivative nuttall window
  2205. @item mnuttall3
  2206. minimum 3-terms discontinuous nuttall window
  2207. @item nuttall
  2208. 4-terms continuous 1st derivative nuttall window
  2209. @item bnuttall
  2210. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2211. @item bharris
  2212. blackman-harris window
  2213. @item tukey
  2214. tukey window
  2215. @end table
  2216. @item fixed
  2217. If enabled, use fixed number of audio samples. This improves speed when
  2218. filtering with large delay. Default is disabled.
  2219. @item multi
  2220. Enable multichannels evaluation on gain. Default is disabled.
  2221. @item zero_phase
  2222. Enable zero phase mode by subtracting timestamp to compensate delay.
  2223. Default is disabled.
  2224. @item scale
  2225. Set scale used by gain. Acceptable values are:
  2226. @table @option
  2227. @item linlin
  2228. linear frequency, linear gain
  2229. @item linlog
  2230. linear frequency, logarithmic (in dB) gain (default)
  2231. @item loglin
  2232. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2233. @item loglog
  2234. logarithmic frequency, logarithmic gain
  2235. @end table
  2236. @item dumpfile
  2237. Set file for dumping, suitable for gnuplot.
  2238. @item dumpscale
  2239. Set scale for dumpfile. Acceptable values are same with scale option.
  2240. Default is linlog.
  2241. @item fft2
  2242. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2243. Default is disabled.
  2244. @item min_phase
  2245. Enable minimum phase impulse response. Default is disabled.
  2246. @end table
  2247. @subsection Examples
  2248. @itemize
  2249. @item
  2250. lowpass at 1000 Hz:
  2251. @example
  2252. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2253. @end example
  2254. @item
  2255. lowpass at 1000 Hz with gain_entry:
  2256. @example
  2257. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2258. @end example
  2259. @item
  2260. custom equalization:
  2261. @example
  2262. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2263. @end example
  2264. @item
  2265. higher delay with zero phase to compensate delay:
  2266. @example
  2267. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2268. @end example
  2269. @item
  2270. lowpass on left channel, highpass on right channel:
  2271. @example
  2272. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2273. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2274. @end example
  2275. @end itemize
  2276. @section flanger
  2277. Apply a flanging effect to the audio.
  2278. The filter accepts the following options:
  2279. @table @option
  2280. @item delay
  2281. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2282. @item depth
  2283. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2284. @item regen
  2285. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2286. Default value is 0.
  2287. @item width
  2288. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2289. Default value is 71.
  2290. @item speed
  2291. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2292. @item shape
  2293. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2294. Default value is @var{sinusoidal}.
  2295. @item phase
  2296. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2297. Default value is 25.
  2298. @item interp
  2299. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2300. Default is @var{linear}.
  2301. @end table
  2302. @section haas
  2303. Apply Haas effect to audio.
  2304. Note that this makes most sense to apply on mono signals.
  2305. With this filter applied to mono signals it give some directionality and
  2306. stretches its stereo image.
  2307. The filter accepts the following options:
  2308. @table @option
  2309. @item level_in
  2310. Set input level. By default is @var{1}, or 0dB
  2311. @item level_out
  2312. Set output level. By default is @var{1}, or 0dB.
  2313. @item side_gain
  2314. Set gain applied to side part of signal. By default is @var{1}.
  2315. @item middle_source
  2316. Set kind of middle source. Can be one of the following:
  2317. @table @samp
  2318. @item left
  2319. Pick left channel.
  2320. @item right
  2321. Pick right channel.
  2322. @item mid
  2323. Pick middle part signal of stereo image.
  2324. @item side
  2325. Pick side part signal of stereo image.
  2326. @end table
  2327. @item middle_phase
  2328. Change middle phase. By default is disabled.
  2329. @item left_delay
  2330. Set left channel delay. By default is @var{2.05} milliseconds.
  2331. @item left_balance
  2332. Set left channel balance. By default is @var{-1}.
  2333. @item left_gain
  2334. Set left channel gain. By default is @var{1}.
  2335. @item left_phase
  2336. Change left phase. By default is disabled.
  2337. @item right_delay
  2338. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2339. @item right_balance
  2340. Set right channel balance. By default is @var{1}.
  2341. @item right_gain
  2342. Set right channel gain. By default is @var{1}.
  2343. @item right_phase
  2344. Change right phase. By default is enabled.
  2345. @end table
  2346. @section hdcd
  2347. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2348. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2349. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2350. of HDCD, and detects the Transient Filter flag.
  2351. @example
  2352. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2353. @end example
  2354. When using the filter with wav, note the default encoding for wav is 16-bit,
  2355. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2356. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2357. @example
  2358. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2359. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2360. @end example
  2361. The filter accepts the following options:
  2362. @table @option
  2363. @item disable_autoconvert
  2364. Disable any automatic format conversion or resampling in the filter graph.
  2365. @item process_stereo
  2366. Process the stereo channels together. If target_gain does not match between
  2367. channels, consider it invalid and use the last valid target_gain.
  2368. @item cdt_ms
  2369. Set the code detect timer period in ms.
  2370. @item force_pe
  2371. Always extend peaks above -3dBFS even if PE isn't signaled.
  2372. @item analyze_mode
  2373. Replace audio with a solid tone and adjust the amplitude to signal some
  2374. specific aspect of the decoding process. The output file can be loaded in
  2375. an audio editor alongside the original to aid analysis.
  2376. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2377. Modes are:
  2378. @table @samp
  2379. @item 0, off
  2380. Disabled
  2381. @item 1, lle
  2382. Gain adjustment level at each sample
  2383. @item 2, pe
  2384. Samples where peak extend occurs
  2385. @item 3, cdt
  2386. Samples where the code detect timer is active
  2387. @item 4, tgm
  2388. Samples where the target gain does not match between channels
  2389. @end table
  2390. @end table
  2391. @section headphone
  2392. Apply head-related transfer functions (HRTFs) to create virtual
  2393. loudspeakers around the user for binaural listening via headphones.
  2394. The HRIRs are provided via additional streams, for each channel
  2395. one stereo input stream is needed.
  2396. The filter accepts the following options:
  2397. @table @option
  2398. @item map
  2399. Set mapping of input streams for convolution.
  2400. The argument is a '|'-separated list of channel names in order as they
  2401. are given as additional stream inputs for filter.
  2402. This also specify number of input streams. Number of input streams
  2403. must be not less than number of channels in first stream plus one.
  2404. @item gain
  2405. Set gain applied to audio. Value is in dB. Default is 0.
  2406. @item type
  2407. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2408. processing audio in time domain which is slow.
  2409. @var{freq} is processing audio in frequency domain which is fast.
  2410. Default is @var{freq}.
  2411. @item lfe
  2412. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2413. @end table
  2414. @subsection Examples
  2415. @itemize
  2416. @item
  2417. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2418. each amovie filter use stereo file with IR coefficients as input.
  2419. The files give coefficients for each position of virtual loudspeaker:
  2420. @example
  2421. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2422. output.wav
  2423. @end example
  2424. @end itemize
  2425. @section highpass
  2426. Apply a high-pass filter with 3dB point frequency.
  2427. The filter can be either single-pole, or double-pole (the default).
  2428. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2429. The filter accepts the following options:
  2430. @table @option
  2431. @item frequency, f
  2432. Set frequency in Hz. Default is 3000.
  2433. @item poles, p
  2434. Set number of poles. Default is 2.
  2435. @item width_type, t
  2436. Set method to specify band-width of filter.
  2437. @table @option
  2438. @item h
  2439. Hz
  2440. @item q
  2441. Q-Factor
  2442. @item o
  2443. octave
  2444. @item s
  2445. slope
  2446. @item k
  2447. kHz
  2448. @end table
  2449. @item width, w
  2450. Specify the band-width of a filter in width_type units.
  2451. Applies only to double-pole filter.
  2452. The default is 0.707q and gives a Butterworth response.
  2453. @item channels, c
  2454. Specify which channels to filter, by default all available are filtered.
  2455. @end table
  2456. @subsection Commands
  2457. This filter supports the following commands:
  2458. @table @option
  2459. @item frequency, f
  2460. Change highpass frequency.
  2461. Syntax for the command is : "@var{frequency}"
  2462. @item width_type, t
  2463. Change highpass width_type.
  2464. Syntax for the command is : "@var{width_type}"
  2465. @item width, w
  2466. Change highpass width.
  2467. Syntax for the command is : "@var{width}"
  2468. @end table
  2469. @section join
  2470. Join multiple input streams into one multi-channel stream.
  2471. It accepts the following parameters:
  2472. @table @option
  2473. @item inputs
  2474. The number of input streams. It defaults to 2.
  2475. @item channel_layout
  2476. The desired output channel layout. It defaults to stereo.
  2477. @item map
  2478. Map channels from inputs to output. The argument is a '|'-separated list of
  2479. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2480. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2481. can be either the name of the input channel (e.g. FL for front left) or its
  2482. index in the specified input stream. @var{out_channel} is the name of the output
  2483. channel.
  2484. @end table
  2485. The filter will attempt to guess the mappings when they are not specified
  2486. explicitly. It does so by first trying to find an unused matching input channel
  2487. and if that fails it picks the first unused input channel.
  2488. Join 3 inputs (with properly set channel layouts):
  2489. @example
  2490. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2491. @end example
  2492. Build a 5.1 output from 6 single-channel streams:
  2493. @example
  2494. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2495. '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'
  2496. out
  2497. @end example
  2498. @section ladspa
  2499. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2500. To enable compilation of this filter you need to configure FFmpeg with
  2501. @code{--enable-ladspa}.
  2502. @table @option
  2503. @item file, f
  2504. Specifies the name of LADSPA plugin library to load. If the environment
  2505. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2506. each one of the directories specified by the colon separated list in
  2507. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2508. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2509. @file{/usr/lib/ladspa/}.
  2510. @item plugin, p
  2511. Specifies the plugin within the library. Some libraries contain only
  2512. one plugin, but others contain many of them. If this is not set filter
  2513. will list all available plugins within the specified library.
  2514. @item controls, c
  2515. Set the '|' separated list of controls which are zero or more floating point
  2516. values that determine the behavior of the loaded plugin (for example delay,
  2517. threshold or gain).
  2518. Controls need to be defined using the following syntax:
  2519. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2520. @var{valuei} is the value set on the @var{i}-th control.
  2521. Alternatively they can be also defined using the following syntax:
  2522. @var{value0}|@var{value1}|@var{value2}|..., where
  2523. @var{valuei} is the value set on the @var{i}-th control.
  2524. If @option{controls} is set to @code{help}, all available controls and
  2525. their valid ranges are printed.
  2526. @item sample_rate, s
  2527. Specify the sample rate, default to 44100. Only used if plugin have
  2528. zero inputs.
  2529. @item nb_samples, n
  2530. Set the number of samples per channel per each output frame, default
  2531. is 1024. Only used if plugin have zero inputs.
  2532. @item duration, d
  2533. Set the minimum duration of the sourced audio. See
  2534. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2535. for the accepted syntax.
  2536. Note that the resulting duration may be greater than the specified duration,
  2537. as the generated audio is always cut at the end of a complete frame.
  2538. If not specified, or the expressed duration is negative, the audio is
  2539. supposed to be generated forever.
  2540. Only used if plugin have zero inputs.
  2541. @end table
  2542. @subsection Examples
  2543. @itemize
  2544. @item
  2545. List all available plugins within amp (LADSPA example plugin) library:
  2546. @example
  2547. ladspa=file=amp
  2548. @end example
  2549. @item
  2550. List all available controls and their valid ranges for @code{vcf_notch}
  2551. plugin from @code{VCF} library:
  2552. @example
  2553. ladspa=f=vcf:p=vcf_notch:c=help
  2554. @end example
  2555. @item
  2556. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2557. plugin library:
  2558. @example
  2559. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2560. @end example
  2561. @item
  2562. Add reverberation to the audio using TAP-plugins
  2563. (Tom's Audio Processing plugins):
  2564. @example
  2565. ladspa=file=tap_reverb:tap_reverb
  2566. @end example
  2567. @item
  2568. Generate white noise, with 0.2 amplitude:
  2569. @example
  2570. ladspa=file=cmt:noise_source_white:c=c0=.2
  2571. @end example
  2572. @item
  2573. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2574. @code{C* Audio Plugin Suite} (CAPS) library:
  2575. @example
  2576. ladspa=file=caps:Click:c=c1=20'
  2577. @end example
  2578. @item
  2579. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2580. @example
  2581. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2582. @end example
  2583. @item
  2584. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2585. @code{SWH Plugins} collection:
  2586. @example
  2587. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2588. @end example
  2589. @item
  2590. Attenuate low frequencies using Multiband EQ from Steve Harris
  2591. @code{SWH Plugins} collection:
  2592. @example
  2593. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2594. @end example
  2595. @item
  2596. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2597. (CAPS) library:
  2598. @example
  2599. ladspa=caps:Narrower
  2600. @end example
  2601. @item
  2602. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2603. @example
  2604. ladspa=caps:White:.2
  2605. @end example
  2606. @item
  2607. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2608. @example
  2609. ladspa=caps:Fractal:c=c1=1
  2610. @end example
  2611. @item
  2612. Dynamic volume normalization using @code{VLevel} plugin:
  2613. @example
  2614. ladspa=vlevel-ladspa:vlevel_mono
  2615. @end example
  2616. @end itemize
  2617. @subsection Commands
  2618. This filter supports the following commands:
  2619. @table @option
  2620. @item cN
  2621. Modify the @var{N}-th control value.
  2622. If the specified value is not valid, it is ignored and prior one is kept.
  2623. @end table
  2624. @section loudnorm
  2625. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2626. Support for both single pass (livestreams, files) and double pass (files) modes.
  2627. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2628. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2629. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2630. The filter accepts the following options:
  2631. @table @option
  2632. @item I, i
  2633. Set integrated loudness target.
  2634. Range is -70.0 - -5.0. Default value is -24.0.
  2635. @item LRA, lra
  2636. Set loudness range target.
  2637. Range is 1.0 - 20.0. Default value is 7.0.
  2638. @item TP, tp
  2639. Set maximum true peak.
  2640. Range is -9.0 - +0.0. Default value is -2.0.
  2641. @item measured_I, measured_i
  2642. Measured IL of input file.
  2643. Range is -99.0 - +0.0.
  2644. @item measured_LRA, measured_lra
  2645. Measured LRA of input file.
  2646. Range is 0.0 - 99.0.
  2647. @item measured_TP, measured_tp
  2648. Measured true peak of input file.
  2649. Range is -99.0 - +99.0.
  2650. @item measured_thresh
  2651. Measured threshold of input file.
  2652. Range is -99.0 - +0.0.
  2653. @item offset
  2654. Set offset gain. Gain is applied before the true-peak limiter.
  2655. Range is -99.0 - +99.0. Default is +0.0.
  2656. @item linear
  2657. Normalize linearly if possible.
  2658. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2659. to be specified in order to use this mode.
  2660. Options are true or false. Default is true.
  2661. @item dual_mono
  2662. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2663. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2664. If set to @code{true}, this option will compensate for this effect.
  2665. Multi-channel input files are not affected by this option.
  2666. Options are true or false. Default is false.
  2667. @item print_format
  2668. Set print format for stats. Options are summary, json, or none.
  2669. Default value is none.
  2670. @end table
  2671. @section lowpass
  2672. Apply a low-pass filter with 3dB point frequency.
  2673. The filter can be either single-pole or double-pole (the default).
  2674. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2675. The filter accepts the following options:
  2676. @table @option
  2677. @item frequency, f
  2678. Set frequency in Hz. Default is 500.
  2679. @item poles, p
  2680. Set number of poles. Default is 2.
  2681. @item width_type, t
  2682. Set method to specify band-width of filter.
  2683. @table @option
  2684. @item h
  2685. Hz
  2686. @item q
  2687. Q-Factor
  2688. @item o
  2689. octave
  2690. @item s
  2691. slope
  2692. @item k
  2693. kHz
  2694. @end table
  2695. @item width, w
  2696. Specify the band-width of a filter in width_type units.
  2697. Applies only to double-pole filter.
  2698. The default is 0.707q and gives a Butterworth response.
  2699. @item channels, c
  2700. Specify which channels to filter, by default all available are filtered.
  2701. @end table
  2702. @subsection Examples
  2703. @itemize
  2704. @item
  2705. Lowpass only LFE channel, it LFE is not present it does nothing:
  2706. @example
  2707. lowpass=c=LFE
  2708. @end example
  2709. @end itemize
  2710. @subsection Commands
  2711. This filter supports the following commands:
  2712. @table @option
  2713. @item frequency, f
  2714. Change lowpass frequency.
  2715. Syntax for the command is : "@var{frequency}"
  2716. @item width_type, t
  2717. Change lowpass width_type.
  2718. Syntax for the command is : "@var{width_type}"
  2719. @item width, w
  2720. Change lowpass width.
  2721. Syntax for the command is : "@var{width}"
  2722. @end table
  2723. @section lv2
  2724. Load a LV2 (LADSPA Version 2) plugin.
  2725. To enable compilation of this filter you need to configure FFmpeg with
  2726. @code{--enable-lv2}.
  2727. @table @option
  2728. @item plugin, p
  2729. Specifies the plugin URI. You may need to escape ':'.
  2730. @item controls, c
  2731. Set the '|' separated list of controls which are zero or more floating point
  2732. values that determine the behavior of the loaded plugin (for example delay,
  2733. threshold or gain).
  2734. If @option{controls} is set to @code{help}, all available controls and
  2735. their valid ranges are printed.
  2736. @item sample_rate, s
  2737. Specify the sample rate, default to 44100. Only used if plugin have
  2738. zero inputs.
  2739. @item nb_samples, n
  2740. Set the number of samples per channel per each output frame, default
  2741. is 1024. Only used if plugin have zero inputs.
  2742. @item duration, d
  2743. Set the minimum duration of the sourced audio. See
  2744. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2745. for the accepted syntax.
  2746. Note that the resulting duration may be greater than the specified duration,
  2747. as the generated audio is always cut at the end of a complete frame.
  2748. If not specified, or the expressed duration is negative, the audio is
  2749. supposed to be generated forever.
  2750. Only used if plugin have zero inputs.
  2751. @end table
  2752. @subsection Examples
  2753. @itemize
  2754. @item
  2755. Apply bass enhancer plugin from Calf:
  2756. @example
  2757. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2758. @end example
  2759. @item
  2760. Apply bass vinyl plugin from Calf:
  2761. @example
  2762. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2763. @end example
  2764. @item
  2765. Apply bit crusher plugin from ArtyFX:
  2766. @example
  2767. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2768. @end example
  2769. @end itemize
  2770. @section mcompand
  2771. Multiband Compress or expand the audio's dynamic range.
  2772. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2773. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2774. response when absent compander action.
  2775. It accepts the following parameters:
  2776. @table @option
  2777. @item args
  2778. This option syntax is:
  2779. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2780. For explanation of each item refer to compand filter documentation.
  2781. @end table
  2782. @anchor{pan}
  2783. @section pan
  2784. Mix channels with specific gain levels. The filter accepts the output
  2785. channel layout followed by a set of channels definitions.
  2786. This filter is also designed to efficiently remap the channels of an audio
  2787. stream.
  2788. The filter accepts parameters of the form:
  2789. "@var{l}|@var{outdef}|@var{outdef}|..."
  2790. @table @option
  2791. @item l
  2792. output channel layout or number of channels
  2793. @item outdef
  2794. output channel specification, of the form:
  2795. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2796. @item out_name
  2797. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2798. number (c0, c1, etc.)
  2799. @item gain
  2800. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2801. @item in_name
  2802. input channel to use, see out_name for details; it is not possible to mix
  2803. named and numbered input channels
  2804. @end table
  2805. If the `=' in a channel specification is replaced by `<', then the gains for
  2806. that specification will be renormalized so that the total is 1, thus
  2807. avoiding clipping noise.
  2808. @subsection Mixing examples
  2809. For example, if you want to down-mix from stereo to mono, but with a bigger
  2810. factor for the left channel:
  2811. @example
  2812. pan=1c|c0=0.9*c0+0.1*c1
  2813. @end example
  2814. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2815. 7-channels surround:
  2816. @example
  2817. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2818. @end example
  2819. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2820. that should be preferred (see "-ac" option) unless you have very specific
  2821. needs.
  2822. @subsection Remapping examples
  2823. The channel remapping will be effective if, and only if:
  2824. @itemize
  2825. @item gain coefficients are zeroes or ones,
  2826. @item only one input per channel output,
  2827. @end itemize
  2828. If all these conditions are satisfied, the filter will notify the user ("Pure
  2829. channel mapping detected"), and use an optimized and lossless method to do the
  2830. remapping.
  2831. For example, if you have a 5.1 source and want a stereo audio stream by
  2832. dropping the extra channels:
  2833. @example
  2834. pan="stereo| c0=FL | c1=FR"
  2835. @end example
  2836. Given the same source, you can also switch front left and front right channels
  2837. and keep the input channel layout:
  2838. @example
  2839. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2840. @end example
  2841. If the input is a stereo audio stream, you can mute the front left channel (and
  2842. still keep the stereo channel layout) with:
  2843. @example
  2844. pan="stereo|c1=c1"
  2845. @end example
  2846. Still with a stereo audio stream input, you can copy the right channel in both
  2847. front left and right:
  2848. @example
  2849. pan="stereo| c0=FR | c1=FR"
  2850. @end example
  2851. @section replaygain
  2852. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2853. outputs it unchanged.
  2854. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2855. @section resample
  2856. Convert the audio sample format, sample rate and channel layout. It is
  2857. not meant to be used directly.
  2858. @section rubberband
  2859. Apply time-stretching and pitch-shifting with librubberband.
  2860. The filter accepts the following options:
  2861. @table @option
  2862. @item tempo
  2863. Set tempo scale factor.
  2864. @item pitch
  2865. Set pitch scale factor.
  2866. @item transients
  2867. Set transients detector.
  2868. Possible values are:
  2869. @table @var
  2870. @item crisp
  2871. @item mixed
  2872. @item smooth
  2873. @end table
  2874. @item detector
  2875. Set detector.
  2876. Possible values are:
  2877. @table @var
  2878. @item compound
  2879. @item percussive
  2880. @item soft
  2881. @end table
  2882. @item phase
  2883. Set phase.
  2884. Possible values are:
  2885. @table @var
  2886. @item laminar
  2887. @item independent
  2888. @end table
  2889. @item window
  2890. Set processing window size.
  2891. Possible values are:
  2892. @table @var
  2893. @item standard
  2894. @item short
  2895. @item long
  2896. @end table
  2897. @item smoothing
  2898. Set smoothing.
  2899. Possible values are:
  2900. @table @var
  2901. @item off
  2902. @item on
  2903. @end table
  2904. @item formant
  2905. Enable formant preservation when shift pitching.
  2906. Possible values are:
  2907. @table @var
  2908. @item shifted
  2909. @item preserved
  2910. @end table
  2911. @item pitchq
  2912. Set pitch quality.
  2913. Possible values are:
  2914. @table @var
  2915. @item quality
  2916. @item speed
  2917. @item consistency
  2918. @end table
  2919. @item channels
  2920. Set channels.
  2921. Possible values are:
  2922. @table @var
  2923. @item apart
  2924. @item together
  2925. @end table
  2926. @end table
  2927. @section sidechaincompress
  2928. This filter acts like normal compressor but has the ability to compress
  2929. detected signal using second input signal.
  2930. It needs two input streams and returns one output stream.
  2931. First input stream will be processed depending on second stream signal.
  2932. The filtered signal then can be filtered with other filters in later stages of
  2933. processing. See @ref{pan} and @ref{amerge} filter.
  2934. The filter accepts the following options:
  2935. @table @option
  2936. @item level_in
  2937. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2938. @item threshold
  2939. If a signal of second stream raises above this level it will affect the gain
  2940. reduction of first stream.
  2941. By default is 0.125. Range is between 0.00097563 and 1.
  2942. @item ratio
  2943. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2944. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2945. Default is 2. Range is between 1 and 20.
  2946. @item attack
  2947. Amount of milliseconds the signal has to rise above the threshold before gain
  2948. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2949. @item release
  2950. Amount of milliseconds the signal has to fall below the threshold before
  2951. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2952. @item makeup
  2953. Set the amount by how much signal will be amplified after processing.
  2954. Default is 1. Range is from 1 to 64.
  2955. @item knee
  2956. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2957. Default is 2.82843. Range is between 1 and 8.
  2958. @item link
  2959. Choose if the @code{average} level between all channels of side-chain stream
  2960. or the louder(@code{maximum}) channel of side-chain stream affects the
  2961. reduction. Default is @code{average}.
  2962. @item detection
  2963. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2964. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2965. @item level_sc
  2966. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2967. @item mix
  2968. How much to use compressed signal in output. Default is 1.
  2969. Range is between 0 and 1.
  2970. @end table
  2971. @subsection Examples
  2972. @itemize
  2973. @item
  2974. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2975. depending on the signal of 2nd input and later compressed signal to be
  2976. merged with 2nd input:
  2977. @example
  2978. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2979. @end example
  2980. @end itemize
  2981. @section sidechaingate
  2982. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2983. filter the detected signal before sending it to the gain reduction stage.
  2984. Normally a gate uses the full range signal to detect a level above the
  2985. threshold.
  2986. For example: If you cut all lower frequencies from your sidechain signal
  2987. the gate will decrease the volume of your track only if not enough highs
  2988. appear. With this technique you are able to reduce the resonation of a
  2989. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2990. guitar.
  2991. It needs two input streams and returns one output stream.
  2992. First input stream will be processed depending on second stream signal.
  2993. The filter accepts the following options:
  2994. @table @option
  2995. @item level_in
  2996. Set input level before filtering.
  2997. Default is 1. Allowed range is from 0.015625 to 64.
  2998. @item range
  2999. Set the level of gain reduction when the signal is below the threshold.
  3000. Default is 0.06125. Allowed range is from 0 to 1.
  3001. @item threshold
  3002. If a signal rises above this level the gain reduction is released.
  3003. Default is 0.125. Allowed range is from 0 to 1.
  3004. @item ratio
  3005. Set a ratio about which the signal is reduced.
  3006. Default is 2. Allowed range is from 1 to 9000.
  3007. @item attack
  3008. Amount of milliseconds the signal has to rise above the threshold before gain
  3009. reduction stops.
  3010. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3011. @item release
  3012. Amount of milliseconds the signal has to fall below the threshold before the
  3013. reduction is increased again. Default is 250 milliseconds.
  3014. Allowed range is from 0.01 to 9000.
  3015. @item makeup
  3016. Set amount of amplification of signal after processing.
  3017. Default is 1. Allowed range is from 1 to 64.
  3018. @item knee
  3019. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3020. Default is 2.828427125. Allowed range is from 1 to 8.
  3021. @item detection
  3022. Choose if exact signal should be taken for detection or an RMS like one.
  3023. Default is rms. Can be peak or rms.
  3024. @item link
  3025. Choose if the average level between all channels or the louder channel affects
  3026. the reduction.
  3027. Default is average. Can be average or maximum.
  3028. @item level_sc
  3029. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3030. @end table
  3031. @section silencedetect
  3032. Detect silence in an audio stream.
  3033. This filter logs a message when it detects that the input audio volume is less
  3034. or equal to a noise tolerance value for a duration greater or equal to the
  3035. minimum detected noise duration.
  3036. The printed times and duration are expressed in seconds.
  3037. The filter accepts the following options:
  3038. @table @option
  3039. @item duration, d
  3040. Set silence duration until notification (default is 2 seconds).
  3041. @item noise, n
  3042. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3043. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3044. @end table
  3045. @subsection Examples
  3046. @itemize
  3047. @item
  3048. Detect 5 seconds of silence with -50dB noise tolerance:
  3049. @example
  3050. silencedetect=n=-50dB:d=5
  3051. @end example
  3052. @item
  3053. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3054. tolerance in @file{silence.mp3}:
  3055. @example
  3056. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3057. @end example
  3058. @end itemize
  3059. @section silenceremove
  3060. Remove silence from the beginning, middle or end of the audio.
  3061. The filter accepts the following options:
  3062. @table @option
  3063. @item start_periods
  3064. This value is used to indicate if audio should be trimmed at beginning of
  3065. the audio. A value of zero indicates no silence should be trimmed from the
  3066. beginning. When specifying a non-zero value, it trims audio up until it
  3067. finds non-silence. Normally, when trimming silence from beginning of audio
  3068. the @var{start_periods} will be @code{1} but it can be increased to higher
  3069. values to trim all audio up to specific count of non-silence periods.
  3070. Default value is @code{0}.
  3071. @item start_duration
  3072. Specify the amount of time that non-silence must be detected before it stops
  3073. trimming audio. By increasing the duration, bursts of noises can be treated
  3074. as silence and trimmed off. Default value is @code{0}.
  3075. @item start_threshold
  3076. This indicates what sample value should be treated as silence. For digital
  3077. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3078. you may wish to increase the value to account for background noise.
  3079. Can be specified in dB (in case "dB" is appended to the specified value)
  3080. or amplitude ratio. Default value is @code{0}.
  3081. @item stop_periods
  3082. Set the count for trimming silence from the end of audio.
  3083. To remove silence from the middle of a file, specify a @var{stop_periods}
  3084. that is negative. This value is then treated as a positive value and is
  3085. used to indicate the effect should restart processing as specified by
  3086. @var{start_periods}, making it suitable for removing periods of silence
  3087. in the middle of the audio.
  3088. Default value is @code{0}.
  3089. @item stop_duration
  3090. Specify a duration of silence that must exist before audio is not copied any
  3091. more. By specifying a higher duration, silence that is wanted can be left in
  3092. the audio.
  3093. Default value is @code{0}.
  3094. @item stop_threshold
  3095. This is the same as @option{start_threshold} but for trimming silence from
  3096. the end of audio.
  3097. Can be specified in dB (in case "dB" is appended to the specified value)
  3098. or amplitude ratio. Default value is @code{0}.
  3099. @item leave_silence
  3100. This indicates that @var{stop_duration} length of audio should be left intact
  3101. at the beginning of each period of silence.
  3102. For example, if you want to remove long pauses between words but do not want
  3103. to remove the pauses completely. Default value is @code{0}.
  3104. @item detection
  3105. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3106. and works better with digital silence which is exactly 0.
  3107. Default value is @code{rms}.
  3108. @item window
  3109. Set ratio used to calculate size of window for detecting silence.
  3110. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3111. @end table
  3112. @subsection Examples
  3113. @itemize
  3114. @item
  3115. The following example shows how this filter can be used to start a recording
  3116. that does not contain the delay at the start which usually occurs between
  3117. pressing the record button and the start of the performance:
  3118. @example
  3119. silenceremove=1:5:0.02
  3120. @end example
  3121. @item
  3122. Trim all silence encountered from beginning to end where there is more than 1
  3123. second of silence in audio:
  3124. @example
  3125. silenceremove=0:0:0:-1:1:-90dB
  3126. @end example
  3127. @end itemize
  3128. @section sofalizer
  3129. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3130. loudspeakers around the user for binaural listening via headphones (audio
  3131. formats up to 9 channels supported).
  3132. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3133. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3134. Austrian Academy of Sciences.
  3135. To enable compilation of this filter you need to configure FFmpeg with
  3136. @code{--enable-libmysofa}.
  3137. The filter accepts the following options:
  3138. @table @option
  3139. @item sofa
  3140. Set the SOFA file used for rendering.
  3141. @item gain
  3142. Set gain applied to audio. Value is in dB. Default is 0.
  3143. @item rotation
  3144. Set rotation of virtual loudspeakers in deg. Default is 0.
  3145. @item elevation
  3146. Set elevation of virtual speakers in deg. Default is 0.
  3147. @item radius
  3148. Set distance in meters between loudspeakers and the listener with near-field
  3149. HRTFs. Default is 1.
  3150. @item type
  3151. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3152. processing audio in time domain which is slow.
  3153. @var{freq} is processing audio in frequency domain which is fast.
  3154. Default is @var{freq}.
  3155. @item speakers
  3156. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3157. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3158. Each virtual loudspeaker is described with short channel name following with
  3159. azimuth and elevation in degrees.
  3160. Each virtual loudspeaker description is separated by '|'.
  3161. For example to override front left and front right channel positions use:
  3162. 'speakers=FL 45 15|FR 345 15'.
  3163. Descriptions with unrecognised channel names are ignored.
  3164. @item lfegain
  3165. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3166. @end table
  3167. @subsection Examples
  3168. @itemize
  3169. @item
  3170. Using ClubFritz6 sofa file:
  3171. @example
  3172. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3173. @end example
  3174. @item
  3175. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3176. @example
  3177. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3178. @end example
  3179. @item
  3180. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3181. and also with custom gain:
  3182. @example
  3183. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3184. @end example
  3185. @end itemize
  3186. @section stereotools
  3187. This filter has some handy utilities to manage stereo signals, for converting
  3188. M/S stereo recordings to L/R signal while having control over the parameters
  3189. or spreading the stereo image of master track.
  3190. The filter accepts the following options:
  3191. @table @option
  3192. @item level_in
  3193. Set input level before filtering for both channels. Defaults is 1.
  3194. Allowed range is from 0.015625 to 64.
  3195. @item level_out
  3196. Set output level after filtering for both channels. Defaults is 1.
  3197. Allowed range is from 0.015625 to 64.
  3198. @item balance_in
  3199. Set input balance between both channels. Default is 0.
  3200. Allowed range is from -1 to 1.
  3201. @item balance_out
  3202. Set output balance between both channels. Default is 0.
  3203. Allowed range is from -1 to 1.
  3204. @item softclip
  3205. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3206. clipping. Disabled by default.
  3207. @item mutel
  3208. Mute the left channel. Disabled by default.
  3209. @item muter
  3210. Mute the right channel. Disabled by default.
  3211. @item phasel
  3212. Change the phase of the left channel. Disabled by default.
  3213. @item phaser
  3214. Change the phase of the right channel. Disabled by default.
  3215. @item mode
  3216. Set stereo mode. Available values are:
  3217. @table @samp
  3218. @item lr>lr
  3219. Left/Right to Left/Right, this is default.
  3220. @item lr>ms
  3221. Left/Right to Mid/Side.
  3222. @item ms>lr
  3223. Mid/Side to Left/Right.
  3224. @item lr>ll
  3225. Left/Right to Left/Left.
  3226. @item lr>rr
  3227. Left/Right to Right/Right.
  3228. @item lr>l+r
  3229. Left/Right to Left + Right.
  3230. @item lr>rl
  3231. Left/Right to Right/Left.
  3232. @item ms>ll
  3233. Mid/Side to Left/Left.
  3234. @item ms>rr
  3235. Mid/Side to Right/Right.
  3236. @end table
  3237. @item slev
  3238. Set level of side signal. Default is 1.
  3239. Allowed range is from 0.015625 to 64.
  3240. @item sbal
  3241. Set balance of side signal. Default is 0.
  3242. Allowed range is from -1 to 1.
  3243. @item mlev
  3244. Set level of the middle signal. Default is 1.
  3245. Allowed range is from 0.015625 to 64.
  3246. @item mpan
  3247. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3248. @item base
  3249. Set stereo base between mono and inversed channels. Default is 0.
  3250. Allowed range is from -1 to 1.
  3251. @item delay
  3252. Set delay in milliseconds how much to delay left from right channel and
  3253. vice versa. Default is 0. Allowed range is from -20 to 20.
  3254. @item sclevel
  3255. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3256. @item phase
  3257. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3258. @item bmode_in, bmode_out
  3259. Set balance mode for balance_in/balance_out option.
  3260. Can be one of the following:
  3261. @table @samp
  3262. @item balance
  3263. Classic balance mode. Attenuate one channel at time.
  3264. Gain is raised up to 1.
  3265. @item amplitude
  3266. Similar as classic mode above but gain is raised up to 2.
  3267. @item power
  3268. Equal power distribution, from -6dB to +6dB range.
  3269. @end table
  3270. @end table
  3271. @subsection Examples
  3272. @itemize
  3273. @item
  3274. Apply karaoke like effect:
  3275. @example
  3276. stereotools=mlev=0.015625
  3277. @end example
  3278. @item
  3279. Convert M/S signal to L/R:
  3280. @example
  3281. "stereotools=mode=ms>lr"
  3282. @end example
  3283. @end itemize
  3284. @section stereowiden
  3285. This filter enhance the stereo effect by suppressing signal common to both
  3286. channels and by delaying the signal of left into right and vice versa,
  3287. thereby widening the stereo effect.
  3288. The filter accepts the following options:
  3289. @table @option
  3290. @item delay
  3291. Time in milliseconds of the delay of left signal into right and vice versa.
  3292. Default is 20 milliseconds.
  3293. @item feedback
  3294. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3295. effect of left signal in right output and vice versa which gives widening
  3296. effect. Default is 0.3.
  3297. @item crossfeed
  3298. Cross feed of left into right with inverted phase. This helps in suppressing
  3299. the mono. If the value is 1 it will cancel all the signal common to both
  3300. channels. Default is 0.3.
  3301. @item drymix
  3302. Set level of input signal of original channel. Default is 0.8.
  3303. @end table
  3304. @section superequalizer
  3305. Apply 18 band equalizer.
  3306. The filter accepts the following options:
  3307. @table @option
  3308. @item 1b
  3309. Set 65Hz band gain.
  3310. @item 2b
  3311. Set 92Hz band gain.
  3312. @item 3b
  3313. Set 131Hz band gain.
  3314. @item 4b
  3315. Set 185Hz band gain.
  3316. @item 5b
  3317. Set 262Hz band gain.
  3318. @item 6b
  3319. Set 370Hz band gain.
  3320. @item 7b
  3321. Set 523Hz band gain.
  3322. @item 8b
  3323. Set 740Hz band gain.
  3324. @item 9b
  3325. Set 1047Hz band gain.
  3326. @item 10b
  3327. Set 1480Hz band gain.
  3328. @item 11b
  3329. Set 2093Hz band gain.
  3330. @item 12b
  3331. Set 2960Hz band gain.
  3332. @item 13b
  3333. Set 4186Hz band gain.
  3334. @item 14b
  3335. Set 5920Hz band gain.
  3336. @item 15b
  3337. Set 8372Hz band gain.
  3338. @item 16b
  3339. Set 11840Hz band gain.
  3340. @item 17b
  3341. Set 16744Hz band gain.
  3342. @item 18b
  3343. Set 20000Hz band gain.
  3344. @end table
  3345. @section surround
  3346. Apply audio surround upmix filter.
  3347. This filter allows to produce multichannel output from audio stream.
  3348. The filter accepts the following options:
  3349. @table @option
  3350. @item chl_out
  3351. Set output channel layout. By default, this is @var{5.1}.
  3352. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3353. for the required syntax.
  3354. @item chl_in
  3355. Set input channel layout. By default, this is @var{stereo}.
  3356. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3357. for the required syntax.
  3358. @item level_in
  3359. Set input volume level. By default, this is @var{1}.
  3360. @item level_out
  3361. Set output volume level. By default, this is @var{1}.
  3362. @item lfe
  3363. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3364. @item lfe_low
  3365. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3366. @item lfe_high
  3367. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3368. @item fc_in
  3369. Set front center input volume. By default, this is @var{1}.
  3370. @item fc_out
  3371. Set front center output volume. By default, this is @var{1}.
  3372. @item lfe_in
  3373. Set LFE input volume. By default, this is @var{1}.
  3374. @item lfe_out
  3375. Set LFE output volume. By default, this is @var{1}.
  3376. @end table
  3377. @section treble
  3378. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3379. shelving filter with a response similar to that of a standard
  3380. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3381. The filter accepts the following options:
  3382. @table @option
  3383. @item gain, g
  3384. Give the gain at whichever is the lower of ~22 kHz and the
  3385. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3386. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3387. @item frequency, f
  3388. Set the filter's central frequency and so can be used
  3389. to extend or reduce the frequency range to be boosted or cut.
  3390. The default value is @code{3000} Hz.
  3391. @item width_type, t
  3392. Set method to specify band-width of filter.
  3393. @table @option
  3394. @item h
  3395. Hz
  3396. @item q
  3397. Q-Factor
  3398. @item o
  3399. octave
  3400. @item s
  3401. slope
  3402. @item k
  3403. kHz
  3404. @end table
  3405. @item width, w
  3406. Determine how steep is the filter's shelf transition.
  3407. @item channels, c
  3408. Specify which channels to filter, by default all available are filtered.
  3409. @end table
  3410. @subsection Commands
  3411. This filter supports the following commands:
  3412. @table @option
  3413. @item frequency, f
  3414. Change treble frequency.
  3415. Syntax for the command is : "@var{frequency}"
  3416. @item width_type, t
  3417. Change treble width_type.
  3418. Syntax for the command is : "@var{width_type}"
  3419. @item width, w
  3420. Change treble width.
  3421. Syntax for the command is : "@var{width}"
  3422. @item gain, g
  3423. Change treble gain.
  3424. Syntax for the command is : "@var{gain}"
  3425. @end table
  3426. @section tremolo
  3427. Sinusoidal amplitude modulation.
  3428. The filter accepts the following options:
  3429. @table @option
  3430. @item f
  3431. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3432. (20 Hz or lower) will result in a tremolo effect.
  3433. This filter may also be used as a ring modulator by specifying
  3434. a modulation frequency higher than 20 Hz.
  3435. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3436. @item d
  3437. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3438. Default value is 0.5.
  3439. @end table
  3440. @section vibrato
  3441. Sinusoidal phase modulation.
  3442. The filter accepts the following options:
  3443. @table @option
  3444. @item f
  3445. Modulation frequency in Hertz.
  3446. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3447. @item d
  3448. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3449. Default value is 0.5.
  3450. @end table
  3451. @section volume
  3452. Adjust the input audio volume.
  3453. It accepts the following parameters:
  3454. @table @option
  3455. @item volume
  3456. Set audio volume expression.
  3457. Output values are clipped to the maximum value.
  3458. The output audio volume is given by the relation:
  3459. @example
  3460. @var{output_volume} = @var{volume} * @var{input_volume}
  3461. @end example
  3462. The default value for @var{volume} is "1.0".
  3463. @item precision
  3464. This parameter represents the mathematical precision.
  3465. It determines which input sample formats will be allowed, which affects the
  3466. precision of the volume scaling.
  3467. @table @option
  3468. @item fixed
  3469. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3470. @item float
  3471. 32-bit floating-point; this limits input sample format to FLT. (default)
  3472. @item double
  3473. 64-bit floating-point; this limits input sample format to DBL.
  3474. @end table
  3475. @item replaygain
  3476. Choose the behaviour on encountering ReplayGain side data in input frames.
  3477. @table @option
  3478. @item drop
  3479. Remove ReplayGain side data, ignoring its contents (the default).
  3480. @item ignore
  3481. Ignore ReplayGain side data, but leave it in the frame.
  3482. @item track
  3483. Prefer the track gain, if present.
  3484. @item album
  3485. Prefer the album gain, if present.
  3486. @end table
  3487. @item replaygain_preamp
  3488. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3489. Default value for @var{replaygain_preamp} is 0.0.
  3490. @item eval
  3491. Set when the volume expression is evaluated.
  3492. It accepts the following values:
  3493. @table @samp
  3494. @item once
  3495. only evaluate expression once during the filter initialization, or
  3496. when the @samp{volume} command is sent
  3497. @item frame
  3498. evaluate expression for each incoming frame
  3499. @end table
  3500. Default value is @samp{once}.
  3501. @end table
  3502. The volume expression can contain the following parameters.
  3503. @table @option
  3504. @item n
  3505. frame number (starting at zero)
  3506. @item nb_channels
  3507. number of channels
  3508. @item nb_consumed_samples
  3509. number of samples consumed by the filter
  3510. @item nb_samples
  3511. number of samples in the current frame
  3512. @item pos
  3513. original frame position in the file
  3514. @item pts
  3515. frame PTS
  3516. @item sample_rate
  3517. sample rate
  3518. @item startpts
  3519. PTS at start of stream
  3520. @item startt
  3521. time at start of stream
  3522. @item t
  3523. frame time
  3524. @item tb
  3525. timestamp timebase
  3526. @item volume
  3527. last set volume value
  3528. @end table
  3529. Note that when @option{eval} is set to @samp{once} only the
  3530. @var{sample_rate} and @var{tb} variables are available, all other
  3531. variables will evaluate to NAN.
  3532. @subsection Commands
  3533. This filter supports the following commands:
  3534. @table @option
  3535. @item volume
  3536. Modify the volume expression.
  3537. The command accepts the same syntax of the corresponding option.
  3538. If the specified expression is not valid, it is kept at its current
  3539. value.
  3540. @item replaygain_noclip
  3541. Prevent clipping by limiting the gain applied.
  3542. Default value for @var{replaygain_noclip} is 1.
  3543. @end table
  3544. @subsection Examples
  3545. @itemize
  3546. @item
  3547. Halve the input audio volume:
  3548. @example
  3549. volume=volume=0.5
  3550. volume=volume=1/2
  3551. volume=volume=-6.0206dB
  3552. @end example
  3553. In all the above example the named key for @option{volume} can be
  3554. omitted, for example like in:
  3555. @example
  3556. volume=0.5
  3557. @end example
  3558. @item
  3559. Increase input audio power by 6 decibels using fixed-point precision:
  3560. @example
  3561. volume=volume=6dB:precision=fixed
  3562. @end example
  3563. @item
  3564. Fade volume after time 10 with an annihilation period of 5 seconds:
  3565. @example
  3566. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3567. @end example
  3568. @end itemize
  3569. @section volumedetect
  3570. Detect the volume of the input video.
  3571. The filter has no parameters. The input is not modified. Statistics about
  3572. the volume will be printed in the log when the input stream end is reached.
  3573. In particular it will show the mean volume (root mean square), maximum
  3574. volume (on a per-sample basis), and the beginning of a histogram of the
  3575. registered volume values (from the maximum value to a cumulated 1/1000 of
  3576. the samples).
  3577. All volumes are in decibels relative to the maximum PCM value.
  3578. @subsection Examples
  3579. Here is an excerpt of the output:
  3580. @example
  3581. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3582. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3583. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3584. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3585. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3586. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3587. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3588. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3589. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3590. @end example
  3591. It means that:
  3592. @itemize
  3593. @item
  3594. The mean square energy is approximately -27 dB, or 10^-2.7.
  3595. @item
  3596. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3597. @item
  3598. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3599. @end itemize
  3600. In other words, raising the volume by +4 dB does not cause any clipping,
  3601. raising it by +5 dB causes clipping for 6 samples, etc.
  3602. @c man end AUDIO FILTERS
  3603. @chapter Audio Sources
  3604. @c man begin AUDIO SOURCES
  3605. Below is a description of the currently available audio sources.
  3606. @section abuffer
  3607. Buffer audio frames, and make them available to the filter chain.
  3608. This source is mainly intended for a programmatic use, in particular
  3609. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3610. It accepts the following parameters:
  3611. @table @option
  3612. @item time_base
  3613. The timebase which will be used for timestamps of submitted frames. It must be
  3614. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3615. @item sample_rate
  3616. The sample rate of the incoming audio buffers.
  3617. @item sample_fmt
  3618. The sample format of the incoming audio buffers.
  3619. Either a sample format name or its corresponding integer representation from
  3620. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3621. @item channel_layout
  3622. The channel layout of the incoming audio buffers.
  3623. Either a channel layout name from channel_layout_map in
  3624. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3625. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3626. @item channels
  3627. The number of channels of the incoming audio buffers.
  3628. If both @var{channels} and @var{channel_layout} are specified, then they
  3629. must be consistent.
  3630. @end table
  3631. @subsection Examples
  3632. @example
  3633. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3634. @end example
  3635. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3636. Since the sample format with name "s16p" corresponds to the number
  3637. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3638. equivalent to:
  3639. @example
  3640. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3641. @end example
  3642. @section aevalsrc
  3643. Generate an audio signal specified by an expression.
  3644. This source accepts in input one or more expressions (one for each
  3645. channel), which are evaluated and used to generate a corresponding
  3646. audio signal.
  3647. This source accepts the following options:
  3648. @table @option
  3649. @item exprs
  3650. Set the '|'-separated expressions list for each separate channel. In case the
  3651. @option{channel_layout} option is not specified, the selected channel layout
  3652. depends on the number of provided expressions. Otherwise the last
  3653. specified expression is applied to the remaining output channels.
  3654. @item channel_layout, c
  3655. Set the channel layout. The number of channels in the specified layout
  3656. must be equal to the number of specified expressions.
  3657. @item duration, d
  3658. Set the minimum duration of the sourced audio. See
  3659. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3660. for the accepted syntax.
  3661. Note that the resulting duration may be greater than the specified
  3662. duration, as the generated audio is always cut at the end of a
  3663. complete frame.
  3664. If not specified, or the expressed duration is negative, the audio is
  3665. supposed to be generated forever.
  3666. @item nb_samples, n
  3667. Set the number of samples per channel per each output frame,
  3668. default to 1024.
  3669. @item sample_rate, s
  3670. Specify the sample rate, default to 44100.
  3671. @end table
  3672. Each expression in @var{exprs} can contain the following constants:
  3673. @table @option
  3674. @item n
  3675. number of the evaluated sample, starting from 0
  3676. @item t
  3677. time of the evaluated sample expressed in seconds, starting from 0
  3678. @item s
  3679. sample rate
  3680. @end table
  3681. @subsection Examples
  3682. @itemize
  3683. @item
  3684. Generate silence:
  3685. @example
  3686. aevalsrc=0
  3687. @end example
  3688. @item
  3689. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3690. 8000 Hz:
  3691. @example
  3692. aevalsrc="sin(440*2*PI*t):s=8000"
  3693. @end example
  3694. @item
  3695. Generate a two channels signal, specify the channel layout (Front
  3696. Center + Back Center) explicitly:
  3697. @example
  3698. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3699. @end example
  3700. @item
  3701. Generate white noise:
  3702. @example
  3703. aevalsrc="-2+random(0)"
  3704. @end example
  3705. @item
  3706. Generate an amplitude modulated signal:
  3707. @example
  3708. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3709. @end example
  3710. @item
  3711. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3712. @example
  3713. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3714. @end example
  3715. @end itemize
  3716. @section anullsrc
  3717. The null audio source, return unprocessed audio frames. It is mainly useful
  3718. as a template and to be employed in analysis / debugging tools, or as
  3719. the source for filters which ignore the input data (for example the sox
  3720. synth filter).
  3721. This source accepts the following options:
  3722. @table @option
  3723. @item channel_layout, cl
  3724. Specifies the channel layout, and can be either an integer or a string
  3725. representing a channel layout. The default value of @var{channel_layout}
  3726. is "stereo".
  3727. Check the channel_layout_map definition in
  3728. @file{libavutil/channel_layout.c} for the mapping between strings and
  3729. channel layout values.
  3730. @item sample_rate, r
  3731. Specifies the sample rate, and defaults to 44100.
  3732. @item nb_samples, n
  3733. Set the number of samples per requested frames.
  3734. @end table
  3735. @subsection Examples
  3736. @itemize
  3737. @item
  3738. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3739. @example
  3740. anullsrc=r=48000:cl=4
  3741. @end example
  3742. @item
  3743. Do the same operation with a more obvious syntax:
  3744. @example
  3745. anullsrc=r=48000:cl=mono
  3746. @end example
  3747. @end itemize
  3748. All the parameters need to be explicitly defined.
  3749. @section flite
  3750. Synthesize a voice utterance using the libflite library.
  3751. To enable compilation of this filter you need to configure FFmpeg with
  3752. @code{--enable-libflite}.
  3753. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3754. The filter accepts the following options:
  3755. @table @option
  3756. @item list_voices
  3757. If set to 1, list the names of the available voices and exit
  3758. immediately. Default value is 0.
  3759. @item nb_samples, n
  3760. Set the maximum number of samples per frame. Default value is 512.
  3761. @item textfile
  3762. Set the filename containing the text to speak.
  3763. @item text
  3764. Set the text to speak.
  3765. @item voice, v
  3766. Set the voice to use for the speech synthesis. Default value is
  3767. @code{kal}. See also the @var{list_voices} option.
  3768. @end table
  3769. @subsection Examples
  3770. @itemize
  3771. @item
  3772. Read from file @file{speech.txt}, and synthesize the text using the
  3773. standard flite voice:
  3774. @example
  3775. flite=textfile=speech.txt
  3776. @end example
  3777. @item
  3778. Read the specified text selecting the @code{slt} voice:
  3779. @example
  3780. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3781. @end example
  3782. @item
  3783. Input text to ffmpeg:
  3784. @example
  3785. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3786. @end example
  3787. @item
  3788. Make @file{ffplay} speak the specified text, using @code{flite} and
  3789. the @code{lavfi} device:
  3790. @example
  3791. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3792. @end example
  3793. @end itemize
  3794. For more information about libflite, check:
  3795. @url{http://www.festvox.org/flite/}
  3796. @section anoisesrc
  3797. Generate a noise audio signal.
  3798. The filter accepts the following options:
  3799. @table @option
  3800. @item sample_rate, r
  3801. Specify the sample rate. Default value is 48000 Hz.
  3802. @item amplitude, a
  3803. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3804. is 1.0.
  3805. @item duration, d
  3806. Specify the duration of the generated audio stream. Not specifying this option
  3807. results in noise with an infinite length.
  3808. @item color, colour, c
  3809. Specify the color of noise. Available noise colors are white, pink, brown,
  3810. blue and violet. Default color is white.
  3811. @item seed, s
  3812. Specify a value used to seed the PRNG.
  3813. @item nb_samples, n
  3814. Set the number of samples per each output frame, default is 1024.
  3815. @end table
  3816. @subsection Examples
  3817. @itemize
  3818. @item
  3819. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3820. @example
  3821. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3822. @end example
  3823. @end itemize
  3824. @section hilbert
  3825. Generate odd-tap Hilbert transform FIR coefficients.
  3826. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3827. the signal by 90 degrees.
  3828. This is used in many matrix coding schemes and for analytic signal generation.
  3829. The process is often written as a multiplication by i (or j), the imaginary unit.
  3830. The filter accepts the following options:
  3831. @table @option
  3832. @item sample_rate, s
  3833. Set sample rate, default is 44100.
  3834. @item taps, t
  3835. Set length of FIR filter, default is 22051.
  3836. @item nb_samples, n
  3837. Set number of samples per each frame.
  3838. @item win_func, w
  3839. Set window function to be used when generating FIR coefficients.
  3840. @end table
  3841. @section sine
  3842. Generate an audio signal made of a sine wave with amplitude 1/8.
  3843. The audio signal is bit-exact.
  3844. The filter accepts the following options:
  3845. @table @option
  3846. @item frequency, f
  3847. Set the carrier frequency. Default is 440 Hz.
  3848. @item beep_factor, b
  3849. Enable a periodic beep every second with frequency @var{beep_factor} times
  3850. the carrier frequency. Default is 0, meaning the beep is disabled.
  3851. @item sample_rate, r
  3852. Specify the sample rate, default is 44100.
  3853. @item duration, d
  3854. Specify the duration of the generated audio stream.
  3855. @item samples_per_frame
  3856. Set the number of samples per output frame.
  3857. The expression can contain the following constants:
  3858. @table @option
  3859. @item n
  3860. The (sequential) number of the output audio frame, starting from 0.
  3861. @item pts
  3862. The PTS (Presentation TimeStamp) of the output audio frame,
  3863. expressed in @var{TB} units.
  3864. @item t
  3865. The PTS of the output audio frame, expressed in seconds.
  3866. @item TB
  3867. The timebase of the output audio frames.
  3868. @end table
  3869. Default is @code{1024}.
  3870. @end table
  3871. @subsection Examples
  3872. @itemize
  3873. @item
  3874. Generate a simple 440 Hz sine wave:
  3875. @example
  3876. sine
  3877. @end example
  3878. @item
  3879. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3880. @example
  3881. sine=220:4:d=5
  3882. sine=f=220:b=4:d=5
  3883. sine=frequency=220:beep_factor=4:duration=5
  3884. @end example
  3885. @item
  3886. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3887. pattern:
  3888. @example
  3889. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3890. @end example
  3891. @end itemize
  3892. @c man end AUDIO SOURCES
  3893. @chapter Audio Sinks
  3894. @c man begin AUDIO SINKS
  3895. Below is a description of the currently available audio sinks.
  3896. @section abuffersink
  3897. Buffer audio frames, and make them available to the end of filter chain.
  3898. This sink is mainly intended for programmatic use, in particular
  3899. through the interface defined in @file{libavfilter/buffersink.h}
  3900. or the options system.
  3901. It accepts a pointer to an AVABufferSinkContext structure, which
  3902. defines the incoming buffers' formats, to be passed as the opaque
  3903. parameter to @code{avfilter_init_filter} for initialization.
  3904. @section anullsink
  3905. Null audio sink; do absolutely nothing with the input audio. It is
  3906. mainly useful as a template and for use in analysis / debugging
  3907. tools.
  3908. @c man end AUDIO SINKS
  3909. @chapter Video Filters
  3910. @c man begin VIDEO FILTERS
  3911. When you configure your FFmpeg build, you can disable any of the
  3912. existing filters using @code{--disable-filters}.
  3913. The configure output will show the video filters included in your
  3914. build.
  3915. Below is a description of the currently available video filters.
  3916. @section alphaextract
  3917. Extract the alpha component from the input as a grayscale video. This
  3918. is especially useful with the @var{alphamerge} filter.
  3919. @section alphamerge
  3920. Add or replace the alpha component of the primary input with the
  3921. grayscale value of a second input. This is intended for use with
  3922. @var{alphaextract} to allow the transmission or storage of frame
  3923. sequences that have alpha in a format that doesn't support an alpha
  3924. channel.
  3925. For example, to reconstruct full frames from a normal YUV-encoded video
  3926. and a separate video created with @var{alphaextract}, you might use:
  3927. @example
  3928. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3929. @end example
  3930. Since this filter is designed for reconstruction, it operates on frame
  3931. sequences without considering timestamps, and terminates when either
  3932. input reaches end of stream. This will cause problems if your encoding
  3933. pipeline drops frames. If you're trying to apply an image as an
  3934. overlay to a video stream, consider the @var{overlay} filter instead.
  3935. @section ass
  3936. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3937. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3938. Substation Alpha) subtitles files.
  3939. This filter accepts the following option in addition to the common options from
  3940. the @ref{subtitles} filter:
  3941. @table @option
  3942. @item shaping
  3943. Set the shaping engine
  3944. Available values are:
  3945. @table @samp
  3946. @item auto
  3947. The default libass shaping engine, which is the best available.
  3948. @item simple
  3949. Fast, font-agnostic shaper that can do only substitutions
  3950. @item complex
  3951. Slower shaper using OpenType for substitutions and positioning
  3952. @end table
  3953. The default is @code{auto}.
  3954. @end table
  3955. @section atadenoise
  3956. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3957. The filter accepts the following options:
  3958. @table @option
  3959. @item 0a
  3960. Set threshold A for 1st plane. Default is 0.02.
  3961. Valid range is 0 to 0.3.
  3962. @item 0b
  3963. Set threshold B for 1st plane. Default is 0.04.
  3964. Valid range is 0 to 5.
  3965. @item 1a
  3966. Set threshold A for 2nd plane. Default is 0.02.
  3967. Valid range is 0 to 0.3.
  3968. @item 1b
  3969. Set threshold B for 2nd plane. Default is 0.04.
  3970. Valid range is 0 to 5.
  3971. @item 2a
  3972. Set threshold A for 3rd plane. Default is 0.02.
  3973. Valid range is 0 to 0.3.
  3974. @item 2b
  3975. Set threshold B for 3rd plane. Default is 0.04.
  3976. Valid range is 0 to 5.
  3977. Threshold A is designed to react on abrupt changes in the input signal and
  3978. threshold B is designed to react on continuous changes in the input signal.
  3979. @item s
  3980. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3981. number in range [5, 129].
  3982. @item p
  3983. Set what planes of frame filter will use for averaging. Default is all.
  3984. @end table
  3985. @section avgblur
  3986. Apply average blur filter.
  3987. The filter accepts the following options:
  3988. @table @option
  3989. @item sizeX
  3990. Set horizontal kernel size.
  3991. @item planes
  3992. Set which planes to filter. By default all planes are filtered.
  3993. @item sizeY
  3994. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3995. Default is @code{0}.
  3996. @end table
  3997. @section bbox
  3998. Compute the bounding box for the non-black pixels in the input frame
  3999. luminance plane.
  4000. This filter computes the bounding box containing all the pixels with a
  4001. luminance value greater than the minimum allowed value.
  4002. The parameters describing the bounding box are printed on the filter
  4003. log.
  4004. The filter accepts the following option:
  4005. @table @option
  4006. @item min_val
  4007. Set the minimal luminance value. Default is @code{16}.
  4008. @end table
  4009. @section bitplanenoise
  4010. Show and measure bit plane noise.
  4011. The filter accepts the following options:
  4012. @table @option
  4013. @item bitplane
  4014. Set which plane to analyze. Default is @code{1}.
  4015. @item filter
  4016. Filter out noisy pixels from @code{bitplane} set above.
  4017. Default is disabled.
  4018. @end table
  4019. @section blackdetect
  4020. Detect video intervals that are (almost) completely black. Can be
  4021. useful to detect chapter transitions, commercials, or invalid
  4022. recordings. Output lines contains the time for the start, end and
  4023. duration of the detected black interval expressed in seconds.
  4024. In order to display the output lines, you need to set the loglevel at
  4025. least to the AV_LOG_INFO value.
  4026. The filter accepts the following options:
  4027. @table @option
  4028. @item black_min_duration, d
  4029. Set the minimum detected black duration expressed in seconds. It must
  4030. be a non-negative floating point number.
  4031. Default value is 2.0.
  4032. @item picture_black_ratio_th, pic_th
  4033. Set the threshold for considering a picture "black".
  4034. Express the minimum value for the ratio:
  4035. @example
  4036. @var{nb_black_pixels} / @var{nb_pixels}
  4037. @end example
  4038. for which a picture is considered black.
  4039. Default value is 0.98.
  4040. @item pixel_black_th, pix_th
  4041. Set the threshold for considering a pixel "black".
  4042. The threshold expresses the maximum pixel luminance value for which a
  4043. pixel is considered "black". The provided value is scaled according to
  4044. the following equation:
  4045. @example
  4046. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4047. @end example
  4048. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4049. the input video format, the range is [0-255] for YUV full-range
  4050. formats and [16-235] for YUV non full-range formats.
  4051. Default value is 0.10.
  4052. @end table
  4053. The following example sets the maximum pixel threshold to the minimum
  4054. value, and detects only black intervals of 2 or more seconds:
  4055. @example
  4056. blackdetect=d=2:pix_th=0.00
  4057. @end example
  4058. @section blackframe
  4059. Detect frames that are (almost) completely black. Can be useful to
  4060. detect chapter transitions or commercials. Output lines consist of
  4061. the frame number of the detected frame, the percentage of blackness,
  4062. the position in the file if known or -1 and the timestamp in seconds.
  4063. In order to display the output lines, you need to set the loglevel at
  4064. least to the AV_LOG_INFO value.
  4065. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4066. The value represents the percentage of pixels in the picture that
  4067. are below the threshold value.
  4068. It accepts the following parameters:
  4069. @table @option
  4070. @item amount
  4071. The percentage of the pixels that have to be below the threshold; it defaults to
  4072. @code{98}.
  4073. @item threshold, thresh
  4074. The threshold below which a pixel value is considered black; it defaults to
  4075. @code{32}.
  4076. @end table
  4077. @section blend, tblend
  4078. Blend two video frames into each other.
  4079. The @code{blend} filter takes two input streams and outputs one
  4080. stream, the first input is the "top" layer and second input is
  4081. "bottom" layer. By default, the output terminates when the longest input terminates.
  4082. The @code{tblend} (time blend) filter takes two consecutive frames
  4083. from one single stream, and outputs the result obtained by blending
  4084. the new frame on top of the old frame.
  4085. A description of the accepted options follows.
  4086. @table @option
  4087. @item c0_mode
  4088. @item c1_mode
  4089. @item c2_mode
  4090. @item c3_mode
  4091. @item all_mode
  4092. Set blend mode for specific pixel component or all pixel components in case
  4093. of @var{all_mode}. Default value is @code{normal}.
  4094. Available values for component modes are:
  4095. @table @samp
  4096. @item addition
  4097. @item grainmerge
  4098. @item and
  4099. @item average
  4100. @item burn
  4101. @item darken
  4102. @item difference
  4103. @item grainextract
  4104. @item divide
  4105. @item dodge
  4106. @item freeze
  4107. @item exclusion
  4108. @item extremity
  4109. @item glow
  4110. @item hardlight
  4111. @item hardmix
  4112. @item heat
  4113. @item lighten
  4114. @item linearlight
  4115. @item multiply
  4116. @item multiply128
  4117. @item negation
  4118. @item normal
  4119. @item or
  4120. @item overlay
  4121. @item phoenix
  4122. @item pinlight
  4123. @item reflect
  4124. @item screen
  4125. @item softlight
  4126. @item subtract
  4127. @item vividlight
  4128. @item xor
  4129. @end table
  4130. @item c0_opacity
  4131. @item c1_opacity
  4132. @item c2_opacity
  4133. @item c3_opacity
  4134. @item all_opacity
  4135. Set blend opacity for specific pixel component or all pixel components in case
  4136. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4137. @item c0_expr
  4138. @item c1_expr
  4139. @item c2_expr
  4140. @item c3_expr
  4141. @item all_expr
  4142. Set blend expression for specific pixel component or all pixel components in case
  4143. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4144. The expressions can use the following variables:
  4145. @table @option
  4146. @item N
  4147. The sequential number of the filtered frame, starting from @code{0}.
  4148. @item X
  4149. @item Y
  4150. the coordinates of the current sample
  4151. @item W
  4152. @item H
  4153. the width and height of currently filtered plane
  4154. @item SW
  4155. @item SH
  4156. Width and height scale depending on the currently filtered plane. It is the
  4157. ratio between the corresponding luma plane number of pixels and the current
  4158. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4159. @code{0.5,0.5} for chroma planes.
  4160. @item T
  4161. Time of the current frame, expressed in seconds.
  4162. @item TOP, A
  4163. Value of pixel component at current location for first video frame (top layer).
  4164. @item BOTTOM, B
  4165. Value of pixel component at current location for second video frame (bottom layer).
  4166. @end table
  4167. @end table
  4168. The @code{blend} filter also supports the @ref{framesync} options.
  4169. @subsection Examples
  4170. @itemize
  4171. @item
  4172. Apply transition from bottom layer to top layer in first 10 seconds:
  4173. @example
  4174. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4175. @end example
  4176. @item
  4177. Apply linear horizontal transition from top layer to bottom layer:
  4178. @example
  4179. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4180. @end example
  4181. @item
  4182. Apply 1x1 checkerboard effect:
  4183. @example
  4184. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4185. @end example
  4186. @item
  4187. Apply uncover left effect:
  4188. @example
  4189. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4190. @end example
  4191. @item
  4192. Apply uncover down effect:
  4193. @example
  4194. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4195. @end example
  4196. @item
  4197. Apply uncover up-left effect:
  4198. @example
  4199. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4200. @end example
  4201. @item
  4202. Split diagonally video and shows top and bottom layer on each side:
  4203. @example
  4204. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4205. @end example
  4206. @item
  4207. Display differences between the current and the previous frame:
  4208. @example
  4209. tblend=all_mode=grainextract
  4210. @end example
  4211. @end itemize
  4212. @section boxblur
  4213. Apply a boxblur algorithm to the input video.
  4214. It accepts the following parameters:
  4215. @table @option
  4216. @item luma_radius, lr
  4217. @item luma_power, lp
  4218. @item chroma_radius, cr
  4219. @item chroma_power, cp
  4220. @item alpha_radius, ar
  4221. @item alpha_power, ap
  4222. @end table
  4223. A description of the accepted options follows.
  4224. @table @option
  4225. @item luma_radius, lr
  4226. @item chroma_radius, cr
  4227. @item alpha_radius, ar
  4228. Set an expression for the box radius in pixels used for blurring the
  4229. corresponding input plane.
  4230. The radius value must be a non-negative number, and must not be
  4231. greater than the value of the expression @code{min(w,h)/2} for the
  4232. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4233. planes.
  4234. Default value for @option{luma_radius} is "2". If not specified,
  4235. @option{chroma_radius} and @option{alpha_radius} default to the
  4236. corresponding value set for @option{luma_radius}.
  4237. The expressions can contain the following constants:
  4238. @table @option
  4239. @item w
  4240. @item h
  4241. The input width and height in pixels.
  4242. @item cw
  4243. @item ch
  4244. The input chroma image width and height in pixels.
  4245. @item hsub
  4246. @item vsub
  4247. The horizontal and vertical chroma subsample values. For example, for the
  4248. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4249. @end table
  4250. @item luma_power, lp
  4251. @item chroma_power, cp
  4252. @item alpha_power, ap
  4253. Specify how many times the boxblur filter is applied to the
  4254. corresponding plane.
  4255. Default value for @option{luma_power} is 2. If not specified,
  4256. @option{chroma_power} and @option{alpha_power} default to the
  4257. corresponding value set for @option{luma_power}.
  4258. A value of 0 will disable the effect.
  4259. @end table
  4260. @subsection Examples
  4261. @itemize
  4262. @item
  4263. Apply a boxblur filter with the luma, chroma, and alpha radii
  4264. set to 2:
  4265. @example
  4266. boxblur=luma_radius=2:luma_power=1
  4267. boxblur=2:1
  4268. @end example
  4269. @item
  4270. Set the luma radius to 2, and alpha and chroma radius to 0:
  4271. @example
  4272. boxblur=2:1:cr=0:ar=0
  4273. @end example
  4274. @item
  4275. Set the luma and chroma radii to a fraction of the video dimension:
  4276. @example
  4277. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4278. @end example
  4279. @end itemize
  4280. @section bwdif
  4281. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4282. Deinterlacing Filter").
  4283. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4284. interpolation algorithms.
  4285. It accepts the following parameters:
  4286. @table @option
  4287. @item mode
  4288. The interlacing mode to adopt. It accepts one of the following values:
  4289. @table @option
  4290. @item 0, send_frame
  4291. Output one frame for each frame.
  4292. @item 1, send_field
  4293. Output one frame for each field.
  4294. @end table
  4295. The default value is @code{send_field}.
  4296. @item parity
  4297. The picture field parity assumed for the input interlaced video. It accepts one
  4298. of the following values:
  4299. @table @option
  4300. @item 0, tff
  4301. Assume the top field is first.
  4302. @item 1, bff
  4303. Assume the bottom field is first.
  4304. @item -1, auto
  4305. Enable automatic detection of field parity.
  4306. @end table
  4307. The default value is @code{auto}.
  4308. If the interlacing is unknown or the decoder does not export this information,
  4309. top field first will be assumed.
  4310. @item deint
  4311. Specify which frames to deinterlace. Accept one of the following
  4312. values:
  4313. @table @option
  4314. @item 0, all
  4315. Deinterlace all frames.
  4316. @item 1, interlaced
  4317. Only deinterlace frames marked as interlaced.
  4318. @end table
  4319. The default value is @code{all}.
  4320. @end table
  4321. @section chromakey
  4322. YUV colorspace color/chroma keying.
  4323. The filter accepts the following options:
  4324. @table @option
  4325. @item color
  4326. The color which will be replaced with transparency.
  4327. @item similarity
  4328. Similarity percentage with the key color.
  4329. 0.01 matches only the exact key color, while 1.0 matches everything.
  4330. @item blend
  4331. Blend percentage.
  4332. 0.0 makes pixels either fully transparent, or not transparent at all.
  4333. Higher values result in semi-transparent pixels, with a higher transparency
  4334. the more similar the pixels color is to the key color.
  4335. @item yuv
  4336. Signals that the color passed is already in YUV instead of RGB.
  4337. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4338. This can be used to pass exact YUV values as hexadecimal numbers.
  4339. @end table
  4340. @subsection Examples
  4341. @itemize
  4342. @item
  4343. Make every green pixel in the input image transparent:
  4344. @example
  4345. ffmpeg -i input.png -vf chromakey=green out.png
  4346. @end example
  4347. @item
  4348. Overlay a greenscreen-video on top of a static black background.
  4349. @example
  4350. 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
  4351. @end example
  4352. @end itemize
  4353. @section ciescope
  4354. Display CIE color diagram with pixels overlaid onto it.
  4355. The filter accepts the following options:
  4356. @table @option
  4357. @item system
  4358. Set color system.
  4359. @table @samp
  4360. @item ntsc, 470m
  4361. @item ebu, 470bg
  4362. @item smpte
  4363. @item 240m
  4364. @item apple
  4365. @item widergb
  4366. @item cie1931
  4367. @item rec709, hdtv
  4368. @item uhdtv, rec2020
  4369. @end table
  4370. @item cie
  4371. Set CIE system.
  4372. @table @samp
  4373. @item xyy
  4374. @item ucs
  4375. @item luv
  4376. @end table
  4377. @item gamuts
  4378. Set what gamuts to draw.
  4379. See @code{system} option for available values.
  4380. @item size, s
  4381. Set ciescope size, by default set to 512.
  4382. @item intensity, i
  4383. Set intensity used to map input pixel values to CIE diagram.
  4384. @item contrast
  4385. Set contrast used to draw tongue colors that are out of active color system gamut.
  4386. @item corrgamma
  4387. Correct gamma displayed on scope, by default enabled.
  4388. @item showwhite
  4389. Show white point on CIE diagram, by default disabled.
  4390. @item gamma
  4391. Set input gamma. Used only with XYZ input color space.
  4392. @end table
  4393. @section codecview
  4394. Visualize information exported by some codecs.
  4395. Some codecs can export information through frames using side-data or other
  4396. means. For example, some MPEG based codecs export motion vectors through the
  4397. @var{export_mvs} flag in the codec @option{flags2} option.
  4398. The filter accepts the following option:
  4399. @table @option
  4400. @item mv
  4401. Set motion vectors to visualize.
  4402. Available flags for @var{mv} are:
  4403. @table @samp
  4404. @item pf
  4405. forward predicted MVs of P-frames
  4406. @item bf
  4407. forward predicted MVs of B-frames
  4408. @item bb
  4409. backward predicted MVs of B-frames
  4410. @end table
  4411. @item qp
  4412. Display quantization parameters using the chroma planes.
  4413. @item mv_type, mvt
  4414. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4415. Available flags for @var{mv_type} are:
  4416. @table @samp
  4417. @item fp
  4418. forward predicted MVs
  4419. @item bp
  4420. backward predicted MVs
  4421. @end table
  4422. @item frame_type, ft
  4423. Set frame type to visualize motion vectors of.
  4424. Available flags for @var{frame_type} are:
  4425. @table @samp
  4426. @item if
  4427. intra-coded frames (I-frames)
  4428. @item pf
  4429. predicted frames (P-frames)
  4430. @item bf
  4431. bi-directionally predicted frames (B-frames)
  4432. @end table
  4433. @end table
  4434. @subsection Examples
  4435. @itemize
  4436. @item
  4437. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4438. @example
  4439. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4440. @end example
  4441. @item
  4442. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4443. @example
  4444. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4445. @end example
  4446. @end itemize
  4447. @section colorbalance
  4448. Modify intensity of primary colors (red, green and blue) of input frames.
  4449. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4450. regions for the red-cyan, green-magenta or blue-yellow balance.
  4451. A positive adjustment value shifts the balance towards the primary color, a negative
  4452. value towards the complementary color.
  4453. The filter accepts the following options:
  4454. @table @option
  4455. @item rs
  4456. @item gs
  4457. @item bs
  4458. Adjust red, green and blue shadows (darkest pixels).
  4459. @item rm
  4460. @item gm
  4461. @item bm
  4462. Adjust red, green and blue midtones (medium pixels).
  4463. @item rh
  4464. @item gh
  4465. @item bh
  4466. Adjust red, green and blue highlights (brightest pixels).
  4467. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4468. @end table
  4469. @subsection Examples
  4470. @itemize
  4471. @item
  4472. Add red color cast to shadows:
  4473. @example
  4474. colorbalance=rs=.3
  4475. @end example
  4476. @end itemize
  4477. @section colorkey
  4478. RGB colorspace color keying.
  4479. The filter accepts the following options:
  4480. @table @option
  4481. @item color
  4482. The color which will be replaced with transparency.
  4483. @item similarity
  4484. Similarity percentage with the key color.
  4485. 0.01 matches only the exact key color, while 1.0 matches everything.
  4486. @item blend
  4487. Blend percentage.
  4488. 0.0 makes pixels either fully transparent, or not transparent at all.
  4489. Higher values result in semi-transparent pixels, with a higher transparency
  4490. the more similar the pixels color is to the key color.
  4491. @end table
  4492. @subsection Examples
  4493. @itemize
  4494. @item
  4495. Make every green pixel in the input image transparent:
  4496. @example
  4497. ffmpeg -i input.png -vf colorkey=green out.png
  4498. @end example
  4499. @item
  4500. Overlay a greenscreen-video on top of a static background image.
  4501. @example
  4502. 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
  4503. @end example
  4504. @end itemize
  4505. @section colorlevels
  4506. Adjust video input frames using levels.
  4507. The filter accepts the following options:
  4508. @table @option
  4509. @item rimin
  4510. @item gimin
  4511. @item bimin
  4512. @item aimin
  4513. Adjust red, green, blue and alpha input black point.
  4514. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4515. @item rimax
  4516. @item gimax
  4517. @item bimax
  4518. @item aimax
  4519. Adjust red, green, blue and alpha input white point.
  4520. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4521. Input levels are used to lighten highlights (bright tones), darken shadows
  4522. (dark tones), change the balance of bright and dark tones.
  4523. @item romin
  4524. @item gomin
  4525. @item bomin
  4526. @item aomin
  4527. Adjust red, green, blue and alpha output black point.
  4528. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4529. @item romax
  4530. @item gomax
  4531. @item bomax
  4532. @item aomax
  4533. Adjust red, green, blue and alpha output white point.
  4534. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4535. Output levels allows manual selection of a constrained output level range.
  4536. @end table
  4537. @subsection Examples
  4538. @itemize
  4539. @item
  4540. Make video output darker:
  4541. @example
  4542. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4543. @end example
  4544. @item
  4545. Increase contrast:
  4546. @example
  4547. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4548. @end example
  4549. @item
  4550. Make video output lighter:
  4551. @example
  4552. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4553. @end example
  4554. @item
  4555. Increase brightness:
  4556. @example
  4557. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4558. @end example
  4559. @end itemize
  4560. @section colorchannelmixer
  4561. Adjust video input frames by re-mixing color channels.
  4562. This filter modifies a color channel by adding the values associated to
  4563. the other channels of the same pixels. For example if the value to
  4564. modify is red, the output value will be:
  4565. @example
  4566. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4567. @end example
  4568. The filter accepts the following options:
  4569. @table @option
  4570. @item rr
  4571. @item rg
  4572. @item rb
  4573. @item ra
  4574. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4575. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4576. @item gr
  4577. @item gg
  4578. @item gb
  4579. @item ga
  4580. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4581. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4582. @item br
  4583. @item bg
  4584. @item bb
  4585. @item ba
  4586. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4587. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4588. @item ar
  4589. @item ag
  4590. @item ab
  4591. @item aa
  4592. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4593. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4594. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4595. @end table
  4596. @subsection Examples
  4597. @itemize
  4598. @item
  4599. Convert source to grayscale:
  4600. @example
  4601. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4602. @end example
  4603. @item
  4604. Simulate sepia tones:
  4605. @example
  4606. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4607. @end example
  4608. @end itemize
  4609. @section colormatrix
  4610. Convert color matrix.
  4611. The filter accepts the following options:
  4612. @table @option
  4613. @item src
  4614. @item dst
  4615. Specify the source and destination color matrix. Both values must be
  4616. specified.
  4617. The accepted values are:
  4618. @table @samp
  4619. @item bt709
  4620. BT.709
  4621. @item fcc
  4622. FCC
  4623. @item bt601
  4624. BT.601
  4625. @item bt470
  4626. BT.470
  4627. @item bt470bg
  4628. BT.470BG
  4629. @item smpte170m
  4630. SMPTE-170M
  4631. @item smpte240m
  4632. SMPTE-240M
  4633. @item bt2020
  4634. BT.2020
  4635. @end table
  4636. @end table
  4637. For example to convert from BT.601 to SMPTE-240M, use the command:
  4638. @example
  4639. colormatrix=bt601:smpte240m
  4640. @end example
  4641. @section colorspace
  4642. Convert colorspace, transfer characteristics or color primaries.
  4643. Input video needs to have an even size.
  4644. The filter accepts the following options:
  4645. @table @option
  4646. @anchor{all}
  4647. @item all
  4648. Specify all color properties at once.
  4649. The accepted values are:
  4650. @table @samp
  4651. @item bt470m
  4652. BT.470M
  4653. @item bt470bg
  4654. BT.470BG
  4655. @item bt601-6-525
  4656. BT.601-6 525
  4657. @item bt601-6-625
  4658. BT.601-6 625
  4659. @item bt709
  4660. BT.709
  4661. @item smpte170m
  4662. SMPTE-170M
  4663. @item smpte240m
  4664. SMPTE-240M
  4665. @item bt2020
  4666. BT.2020
  4667. @end table
  4668. @anchor{space}
  4669. @item space
  4670. Specify output colorspace.
  4671. The accepted values are:
  4672. @table @samp
  4673. @item bt709
  4674. BT.709
  4675. @item fcc
  4676. FCC
  4677. @item bt470bg
  4678. BT.470BG or BT.601-6 625
  4679. @item smpte170m
  4680. SMPTE-170M or BT.601-6 525
  4681. @item smpte240m
  4682. SMPTE-240M
  4683. @item ycgco
  4684. YCgCo
  4685. @item bt2020ncl
  4686. BT.2020 with non-constant luminance
  4687. @end table
  4688. @anchor{trc}
  4689. @item trc
  4690. Specify output transfer characteristics.
  4691. The accepted values are:
  4692. @table @samp
  4693. @item bt709
  4694. BT.709
  4695. @item bt470m
  4696. BT.470M
  4697. @item bt470bg
  4698. BT.470BG
  4699. @item gamma22
  4700. Constant gamma of 2.2
  4701. @item gamma28
  4702. Constant gamma of 2.8
  4703. @item smpte170m
  4704. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4705. @item smpte240m
  4706. SMPTE-240M
  4707. @item srgb
  4708. SRGB
  4709. @item iec61966-2-1
  4710. iec61966-2-1
  4711. @item iec61966-2-4
  4712. iec61966-2-4
  4713. @item xvycc
  4714. xvycc
  4715. @item bt2020-10
  4716. BT.2020 for 10-bits content
  4717. @item bt2020-12
  4718. BT.2020 for 12-bits content
  4719. @end table
  4720. @anchor{primaries}
  4721. @item primaries
  4722. Specify output color primaries.
  4723. The accepted values are:
  4724. @table @samp
  4725. @item bt709
  4726. BT.709
  4727. @item bt470m
  4728. BT.470M
  4729. @item bt470bg
  4730. BT.470BG or BT.601-6 625
  4731. @item smpte170m
  4732. SMPTE-170M or BT.601-6 525
  4733. @item smpte240m
  4734. SMPTE-240M
  4735. @item film
  4736. film
  4737. @item smpte431
  4738. SMPTE-431
  4739. @item smpte432
  4740. SMPTE-432
  4741. @item bt2020
  4742. BT.2020
  4743. @item jedec-p22
  4744. JEDEC P22 phosphors
  4745. @end table
  4746. @anchor{range}
  4747. @item range
  4748. Specify output color range.
  4749. The accepted values are:
  4750. @table @samp
  4751. @item tv
  4752. TV (restricted) range
  4753. @item mpeg
  4754. MPEG (restricted) range
  4755. @item pc
  4756. PC (full) range
  4757. @item jpeg
  4758. JPEG (full) range
  4759. @end table
  4760. @item format
  4761. Specify output color format.
  4762. The accepted values are:
  4763. @table @samp
  4764. @item yuv420p
  4765. YUV 4:2:0 planar 8-bits
  4766. @item yuv420p10
  4767. YUV 4:2:0 planar 10-bits
  4768. @item yuv420p12
  4769. YUV 4:2:0 planar 12-bits
  4770. @item yuv422p
  4771. YUV 4:2:2 planar 8-bits
  4772. @item yuv422p10
  4773. YUV 4:2:2 planar 10-bits
  4774. @item yuv422p12
  4775. YUV 4:2:2 planar 12-bits
  4776. @item yuv444p
  4777. YUV 4:4:4 planar 8-bits
  4778. @item yuv444p10
  4779. YUV 4:4:4 planar 10-bits
  4780. @item yuv444p12
  4781. YUV 4:4:4 planar 12-bits
  4782. @end table
  4783. @item fast
  4784. Do a fast conversion, which skips gamma/primary correction. This will take
  4785. significantly less CPU, but will be mathematically incorrect. To get output
  4786. compatible with that produced by the colormatrix filter, use fast=1.
  4787. @item dither
  4788. Specify dithering mode.
  4789. The accepted values are:
  4790. @table @samp
  4791. @item none
  4792. No dithering
  4793. @item fsb
  4794. Floyd-Steinberg dithering
  4795. @end table
  4796. @item wpadapt
  4797. Whitepoint adaptation mode.
  4798. The accepted values are:
  4799. @table @samp
  4800. @item bradford
  4801. Bradford whitepoint adaptation
  4802. @item vonkries
  4803. von Kries whitepoint adaptation
  4804. @item identity
  4805. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4806. @end table
  4807. @item iall
  4808. Override all input properties at once. Same accepted values as @ref{all}.
  4809. @item ispace
  4810. Override input colorspace. Same accepted values as @ref{space}.
  4811. @item iprimaries
  4812. Override input color primaries. Same accepted values as @ref{primaries}.
  4813. @item itrc
  4814. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4815. @item irange
  4816. Override input color range. Same accepted values as @ref{range}.
  4817. @end table
  4818. The filter converts the transfer characteristics, color space and color
  4819. primaries to the specified user values. The output value, if not specified,
  4820. is set to a default value based on the "all" property. If that property is
  4821. also not specified, the filter will log an error. The output color range and
  4822. format default to the same value as the input color range and format. The
  4823. input transfer characteristics, color space, color primaries and color range
  4824. should be set on the input data. If any of these are missing, the filter will
  4825. log an error and no conversion will take place.
  4826. For example to convert the input to SMPTE-240M, use the command:
  4827. @example
  4828. colorspace=smpte240m
  4829. @end example
  4830. @section convolution
  4831. Apply convolution 3x3, 5x5 or 7x7 filter.
  4832. The filter accepts the following options:
  4833. @table @option
  4834. @item 0m
  4835. @item 1m
  4836. @item 2m
  4837. @item 3m
  4838. Set matrix for each plane.
  4839. Matrix is sequence of 9, 25 or 49 signed integers.
  4840. @item 0rdiv
  4841. @item 1rdiv
  4842. @item 2rdiv
  4843. @item 3rdiv
  4844. Set multiplier for calculated value for each plane.
  4845. @item 0bias
  4846. @item 1bias
  4847. @item 2bias
  4848. @item 3bias
  4849. Set bias for each plane. This value is added to the result of the multiplication.
  4850. Useful for making the overall image brighter or darker. Default is 0.0.
  4851. @end table
  4852. @subsection Examples
  4853. @itemize
  4854. @item
  4855. Apply sharpen:
  4856. @example
  4857. 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"
  4858. @end example
  4859. @item
  4860. Apply blur:
  4861. @example
  4862. 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"
  4863. @end example
  4864. @item
  4865. Apply edge enhance:
  4866. @example
  4867. 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"
  4868. @end example
  4869. @item
  4870. Apply edge detect:
  4871. @example
  4872. 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"
  4873. @end example
  4874. @item
  4875. Apply laplacian edge detector which includes diagonals:
  4876. @example
  4877. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4878. @end example
  4879. @item
  4880. Apply emboss:
  4881. @example
  4882. 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"
  4883. @end example
  4884. @end itemize
  4885. @section convolve
  4886. Apply 2D convolution of video stream in frequency domain using second stream
  4887. as impulse.
  4888. The filter accepts the following options:
  4889. @table @option
  4890. @item planes
  4891. Set which planes to process.
  4892. @item impulse
  4893. Set which impulse video frames will be processed, can be @var{first}
  4894. or @var{all}. Default is @var{all}.
  4895. @end table
  4896. The @code{convolve} filter also supports the @ref{framesync} options.
  4897. @section copy
  4898. Copy the input video source unchanged to the output. This is mainly useful for
  4899. testing purposes.
  4900. @anchor{coreimage}
  4901. @section coreimage
  4902. Video filtering on GPU using Apple's CoreImage API on OSX.
  4903. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4904. processed by video hardware. However, software-based OpenGL implementations
  4905. exist which means there is no guarantee for hardware processing. It depends on
  4906. the respective OSX.
  4907. There are many filters and image generators provided by Apple that come with a
  4908. large variety of options. The filter has to be referenced by its name along
  4909. with its options.
  4910. The coreimage filter accepts the following options:
  4911. @table @option
  4912. @item list_filters
  4913. List all available filters and generators along with all their respective
  4914. options as well as possible minimum and maximum values along with the default
  4915. values.
  4916. @example
  4917. list_filters=true
  4918. @end example
  4919. @item filter
  4920. Specify all filters by their respective name and options.
  4921. Use @var{list_filters} to determine all valid filter names and options.
  4922. Numerical options are specified by a float value and are automatically clamped
  4923. to their respective value range. Vector and color options have to be specified
  4924. by a list of space separated float values. Character escaping has to be done.
  4925. A special option name @code{default} is available to use default options for a
  4926. filter.
  4927. It is required to specify either @code{default} or at least one of the filter options.
  4928. All omitted options are used with their default values.
  4929. The syntax of the filter string is as follows:
  4930. @example
  4931. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4932. @end example
  4933. @item output_rect
  4934. Specify a rectangle where the output of the filter chain is copied into the
  4935. input image. It is given by a list of space separated float values:
  4936. @example
  4937. output_rect=x\ y\ width\ height
  4938. @end example
  4939. If not given, the output rectangle equals the dimensions of the input image.
  4940. The output rectangle is automatically cropped at the borders of the input
  4941. image. Negative values are valid for each component.
  4942. @example
  4943. output_rect=25\ 25\ 100\ 100
  4944. @end example
  4945. @end table
  4946. Several filters can be chained for successive processing without GPU-HOST
  4947. transfers allowing for fast processing of complex filter chains.
  4948. Currently, only filters with zero (generators) or exactly one (filters) input
  4949. image and one output image are supported. Also, transition filters are not yet
  4950. usable as intended.
  4951. Some filters generate output images with additional padding depending on the
  4952. respective filter kernel. The padding is automatically removed to ensure the
  4953. filter output has the same size as the input image.
  4954. For image generators, the size of the output image is determined by the
  4955. previous output image of the filter chain or the input image of the whole
  4956. filterchain, respectively. The generators do not use the pixel information of
  4957. this image to generate their output. However, the generated output is
  4958. blended onto this image, resulting in partial or complete coverage of the
  4959. output image.
  4960. The @ref{coreimagesrc} video source can be used for generating input images
  4961. which are directly fed into the filter chain. By using it, providing input
  4962. images by another video source or an input video is not required.
  4963. @subsection Examples
  4964. @itemize
  4965. @item
  4966. List all filters available:
  4967. @example
  4968. coreimage=list_filters=true
  4969. @end example
  4970. @item
  4971. Use the CIBoxBlur filter with default options to blur an image:
  4972. @example
  4973. coreimage=filter=CIBoxBlur@@default
  4974. @end example
  4975. @item
  4976. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4977. its center at 100x100 and a radius of 50 pixels:
  4978. @example
  4979. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4980. @end example
  4981. @item
  4982. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4983. given as complete and escaped command-line for Apple's standard bash shell:
  4984. @example
  4985. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4986. @end example
  4987. @end itemize
  4988. @section crop
  4989. Crop the input video to given dimensions.
  4990. It accepts the following parameters:
  4991. @table @option
  4992. @item w, out_w
  4993. The width of the output video. It defaults to @code{iw}.
  4994. This expression is evaluated only once during the filter
  4995. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4996. @item h, out_h
  4997. The height of the output video. It defaults to @code{ih}.
  4998. This expression is evaluated only once during the filter
  4999. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5000. @item x
  5001. The horizontal position, in the input video, of the left edge of the output
  5002. video. It defaults to @code{(in_w-out_w)/2}.
  5003. This expression is evaluated per-frame.
  5004. @item y
  5005. The vertical position, in the input video, of the top edge of the output video.
  5006. It defaults to @code{(in_h-out_h)/2}.
  5007. This expression is evaluated per-frame.
  5008. @item keep_aspect
  5009. If set to 1 will force the output display aspect ratio
  5010. to be the same of the input, by changing the output sample aspect
  5011. ratio. It defaults to 0.
  5012. @item exact
  5013. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5014. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5015. It defaults to 0.
  5016. @end table
  5017. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5018. expressions containing the following constants:
  5019. @table @option
  5020. @item x
  5021. @item y
  5022. The computed values for @var{x} and @var{y}. They are evaluated for
  5023. each new frame.
  5024. @item in_w
  5025. @item in_h
  5026. The input width and height.
  5027. @item iw
  5028. @item ih
  5029. These are the same as @var{in_w} and @var{in_h}.
  5030. @item out_w
  5031. @item out_h
  5032. The output (cropped) width and height.
  5033. @item ow
  5034. @item oh
  5035. These are the same as @var{out_w} and @var{out_h}.
  5036. @item a
  5037. same as @var{iw} / @var{ih}
  5038. @item sar
  5039. input sample aspect ratio
  5040. @item dar
  5041. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5042. @item hsub
  5043. @item vsub
  5044. horizontal and vertical chroma subsample values. For example for the
  5045. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5046. @item n
  5047. The number of the input frame, starting from 0.
  5048. @item pos
  5049. the position in the file of the input frame, NAN if unknown
  5050. @item t
  5051. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5052. @end table
  5053. The expression for @var{out_w} may depend on the value of @var{out_h},
  5054. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5055. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5056. evaluated after @var{out_w} and @var{out_h}.
  5057. The @var{x} and @var{y} parameters specify the expressions for the
  5058. position of the top-left corner of the output (non-cropped) area. They
  5059. are evaluated for each frame. If the evaluated value is not valid, it
  5060. is approximated to the nearest valid value.
  5061. The expression for @var{x} may depend on @var{y}, and the expression
  5062. for @var{y} may depend on @var{x}.
  5063. @subsection Examples
  5064. @itemize
  5065. @item
  5066. Crop area with size 100x100 at position (12,34).
  5067. @example
  5068. crop=100:100:12:34
  5069. @end example
  5070. Using named options, the example above becomes:
  5071. @example
  5072. crop=w=100:h=100:x=12:y=34
  5073. @end example
  5074. @item
  5075. Crop the central input area with size 100x100:
  5076. @example
  5077. crop=100:100
  5078. @end example
  5079. @item
  5080. Crop the central input area with size 2/3 of the input video:
  5081. @example
  5082. crop=2/3*in_w:2/3*in_h
  5083. @end example
  5084. @item
  5085. Crop the input video central square:
  5086. @example
  5087. crop=out_w=in_h
  5088. crop=in_h
  5089. @end example
  5090. @item
  5091. Delimit the rectangle with the top-left corner placed at position
  5092. 100:100 and the right-bottom corner corresponding to the right-bottom
  5093. corner of the input image.
  5094. @example
  5095. crop=in_w-100:in_h-100:100:100
  5096. @end example
  5097. @item
  5098. Crop 10 pixels from the left and right borders, and 20 pixels from
  5099. the top and bottom borders
  5100. @example
  5101. crop=in_w-2*10:in_h-2*20
  5102. @end example
  5103. @item
  5104. Keep only the bottom right quarter of the input image:
  5105. @example
  5106. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5107. @end example
  5108. @item
  5109. Crop height for getting Greek harmony:
  5110. @example
  5111. crop=in_w:1/PHI*in_w
  5112. @end example
  5113. @item
  5114. Apply trembling effect:
  5115. @example
  5116. 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)
  5117. @end example
  5118. @item
  5119. Apply erratic camera effect depending on timestamp:
  5120. @example
  5121. 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)"
  5122. @end example
  5123. @item
  5124. Set x depending on the value of y:
  5125. @example
  5126. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5127. @end example
  5128. @end itemize
  5129. @subsection Commands
  5130. This filter supports the following commands:
  5131. @table @option
  5132. @item w, out_w
  5133. @item h, out_h
  5134. @item x
  5135. @item y
  5136. Set width/height of the output video and the horizontal/vertical position
  5137. in the input video.
  5138. The command accepts the same syntax of the corresponding option.
  5139. If the specified expression is not valid, it is kept at its current
  5140. value.
  5141. @end table
  5142. @section cropdetect
  5143. Auto-detect the crop size.
  5144. It calculates the necessary cropping parameters and prints the
  5145. recommended parameters via the logging system. The detected dimensions
  5146. correspond to the non-black area of the input video.
  5147. It accepts the following parameters:
  5148. @table @option
  5149. @item limit
  5150. Set higher black value threshold, which can be optionally specified
  5151. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5152. value greater to the set value is considered non-black. It defaults to 24.
  5153. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5154. on the bitdepth of the pixel format.
  5155. @item round
  5156. The value which the width/height should be divisible by. It defaults to
  5157. 16. The offset is automatically adjusted to center the video. Use 2 to
  5158. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5159. encoding to most video codecs.
  5160. @item reset_count, reset
  5161. Set the counter that determines after how many frames cropdetect will
  5162. reset the previously detected largest video area and start over to
  5163. detect the current optimal crop area. Default value is 0.
  5164. This can be useful when channel logos distort the video area. 0
  5165. indicates 'never reset', and returns the largest area encountered during
  5166. playback.
  5167. @end table
  5168. @anchor{curves}
  5169. @section curves
  5170. Apply color adjustments using curves.
  5171. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5172. component (red, green and blue) has its values defined by @var{N} key points
  5173. tied from each other using a smooth curve. The x-axis represents the pixel
  5174. values from the input frame, and the y-axis the new pixel values to be set for
  5175. the output frame.
  5176. By default, a component curve is defined by the two points @var{(0;0)} and
  5177. @var{(1;1)}. This creates a straight line where each original pixel value is
  5178. "adjusted" to its own value, which means no change to the image.
  5179. The filter allows you to redefine these two points and add some more. A new
  5180. curve (using a natural cubic spline interpolation) will be define to pass
  5181. smoothly through all these new coordinates. The new defined points needs to be
  5182. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5183. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5184. the vector spaces, the values will be clipped accordingly.
  5185. The filter accepts the following options:
  5186. @table @option
  5187. @item preset
  5188. Select one of the available color presets. This option can be used in addition
  5189. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5190. options takes priority on the preset values.
  5191. Available presets are:
  5192. @table @samp
  5193. @item none
  5194. @item color_negative
  5195. @item cross_process
  5196. @item darker
  5197. @item increase_contrast
  5198. @item lighter
  5199. @item linear_contrast
  5200. @item medium_contrast
  5201. @item negative
  5202. @item strong_contrast
  5203. @item vintage
  5204. @end table
  5205. Default is @code{none}.
  5206. @item master, m
  5207. Set the master key points. These points will define a second pass mapping. It
  5208. is sometimes called a "luminance" or "value" mapping. It can be used with
  5209. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5210. post-processing LUT.
  5211. @item red, r
  5212. Set the key points for the red component.
  5213. @item green, g
  5214. Set the key points for the green component.
  5215. @item blue, b
  5216. Set the key points for the blue component.
  5217. @item all
  5218. Set the key points for all components (not including master).
  5219. Can be used in addition to the other key points component
  5220. options. In this case, the unset component(s) will fallback on this
  5221. @option{all} setting.
  5222. @item psfile
  5223. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5224. @item plot
  5225. Save Gnuplot script of the curves in specified file.
  5226. @end table
  5227. To avoid some filtergraph syntax conflicts, each key points list need to be
  5228. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5229. @subsection Examples
  5230. @itemize
  5231. @item
  5232. Increase slightly the middle level of blue:
  5233. @example
  5234. curves=blue='0/0 0.5/0.58 1/1'
  5235. @end example
  5236. @item
  5237. Vintage effect:
  5238. @example
  5239. 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'
  5240. @end example
  5241. Here we obtain the following coordinates for each components:
  5242. @table @var
  5243. @item red
  5244. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5245. @item green
  5246. @code{(0;0) (0.50;0.48) (1;1)}
  5247. @item blue
  5248. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5249. @end table
  5250. @item
  5251. The previous example can also be achieved with the associated built-in preset:
  5252. @example
  5253. curves=preset=vintage
  5254. @end example
  5255. @item
  5256. Or simply:
  5257. @example
  5258. curves=vintage
  5259. @end example
  5260. @item
  5261. Use a Photoshop preset and redefine the points of the green component:
  5262. @example
  5263. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5264. @end example
  5265. @item
  5266. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5267. and @command{gnuplot}:
  5268. @example
  5269. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5270. gnuplot -p /tmp/curves.plt
  5271. @end example
  5272. @end itemize
  5273. @section datascope
  5274. Video data analysis filter.
  5275. This filter shows hexadecimal pixel values of part of video.
  5276. The filter accepts the following options:
  5277. @table @option
  5278. @item size, s
  5279. Set output video size.
  5280. @item x
  5281. Set x offset from where to pick pixels.
  5282. @item y
  5283. Set y offset from where to pick pixels.
  5284. @item mode
  5285. Set scope mode, can be one of the following:
  5286. @table @samp
  5287. @item mono
  5288. Draw hexadecimal pixel values with white color on black background.
  5289. @item color
  5290. Draw hexadecimal pixel values with input video pixel color on black
  5291. background.
  5292. @item color2
  5293. Draw hexadecimal pixel values on color background picked from input video,
  5294. the text color is picked in such way so its always visible.
  5295. @end table
  5296. @item axis
  5297. Draw rows and columns numbers on left and top of video.
  5298. @item opacity
  5299. Set background opacity.
  5300. @end table
  5301. @section dctdnoiz
  5302. Denoise frames using 2D DCT (frequency domain filtering).
  5303. This filter is not designed for real time.
  5304. The filter accepts the following options:
  5305. @table @option
  5306. @item sigma, s
  5307. Set the noise sigma constant.
  5308. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5309. coefficient (absolute value) below this threshold with be dropped.
  5310. If you need a more advanced filtering, see @option{expr}.
  5311. Default is @code{0}.
  5312. @item overlap
  5313. Set number overlapping pixels for each block. Since the filter can be slow, you
  5314. may want to reduce this value, at the cost of a less effective filter and the
  5315. risk of various artefacts.
  5316. If the overlapping value doesn't permit processing the whole input width or
  5317. height, a warning will be displayed and according borders won't be denoised.
  5318. Default value is @var{blocksize}-1, which is the best possible setting.
  5319. @item expr, e
  5320. Set the coefficient factor expression.
  5321. For each coefficient of a DCT block, this expression will be evaluated as a
  5322. multiplier value for the coefficient.
  5323. If this is option is set, the @option{sigma} option will be ignored.
  5324. The absolute value of the coefficient can be accessed through the @var{c}
  5325. variable.
  5326. @item n
  5327. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5328. @var{blocksize}, which is the width and height of the processed blocks.
  5329. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5330. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5331. on the speed processing. Also, a larger block size does not necessarily means a
  5332. better de-noising.
  5333. @end table
  5334. @subsection Examples
  5335. Apply a denoise with a @option{sigma} of @code{4.5}:
  5336. @example
  5337. dctdnoiz=4.5
  5338. @end example
  5339. The same operation can be achieved using the expression system:
  5340. @example
  5341. dctdnoiz=e='gte(c, 4.5*3)'
  5342. @end example
  5343. Violent denoise using a block size of @code{16x16}:
  5344. @example
  5345. dctdnoiz=15:n=4
  5346. @end example
  5347. @section deband
  5348. Remove banding artifacts from input video.
  5349. It works by replacing banded pixels with average value of referenced pixels.
  5350. The filter accepts the following options:
  5351. @table @option
  5352. @item 1thr
  5353. @item 2thr
  5354. @item 3thr
  5355. @item 4thr
  5356. Set banding detection threshold for each plane. Default is 0.02.
  5357. Valid range is 0.00003 to 0.5.
  5358. If difference between current pixel and reference pixel is less than threshold,
  5359. it will be considered as banded.
  5360. @item range, r
  5361. Banding detection range in pixels. Default is 16. If positive, random number
  5362. in range 0 to set value will be used. If negative, exact absolute value
  5363. will be used.
  5364. The range defines square of four pixels around current pixel.
  5365. @item direction, d
  5366. Set direction in radians from which four pixel will be compared. If positive,
  5367. random direction from 0 to set direction will be picked. If negative, exact of
  5368. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5369. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5370. column.
  5371. @item blur, b
  5372. If enabled, current pixel is compared with average value of all four
  5373. surrounding pixels. The default is enabled. If disabled current pixel is
  5374. compared with all four surrounding pixels. The pixel is considered banded
  5375. if only all four differences with surrounding pixels are less than threshold.
  5376. @item coupling, c
  5377. If enabled, current pixel is changed if and only if all pixel components are banded,
  5378. e.g. banding detection threshold is triggered for all color components.
  5379. The default is disabled.
  5380. @end table
  5381. @anchor{decimate}
  5382. @section decimate
  5383. Drop duplicated frames at regular intervals.
  5384. The filter accepts the following options:
  5385. @table @option
  5386. @item cycle
  5387. Set the number of frames from which one will be dropped. Setting this to
  5388. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5389. Default is @code{5}.
  5390. @item dupthresh
  5391. Set the threshold for duplicate detection. If the difference metric for a frame
  5392. is less than or equal to this value, then it is declared as duplicate. Default
  5393. is @code{1.1}
  5394. @item scthresh
  5395. Set scene change threshold. Default is @code{15}.
  5396. @item blockx
  5397. @item blocky
  5398. Set the size of the x and y-axis blocks used during metric calculations.
  5399. Larger blocks give better noise suppression, but also give worse detection of
  5400. small movements. Must be a power of two. Default is @code{32}.
  5401. @item ppsrc
  5402. Mark main input as a pre-processed input and activate clean source input
  5403. stream. This allows the input to be pre-processed with various filters to help
  5404. the metrics calculation while keeping the frame selection lossless. When set to
  5405. @code{1}, the first stream is for the pre-processed input, and the second
  5406. stream is the clean source from where the kept frames are chosen. Default is
  5407. @code{0}.
  5408. @item chroma
  5409. Set whether or not chroma is considered in the metric calculations. Default is
  5410. @code{1}.
  5411. @end table
  5412. @section deconvolve
  5413. Apply 2D deconvolution of video stream in frequency domain using second stream
  5414. as impulse.
  5415. The filter accepts the following options:
  5416. @table @option
  5417. @item planes
  5418. Set which planes to process.
  5419. @item impulse
  5420. Set which impulse video frames will be processed, can be @var{first}
  5421. or @var{all}. Default is @var{all}.
  5422. @item noise
  5423. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5424. and height are not same and not power of 2 or if stream prior to convolving
  5425. had noise.
  5426. @end table
  5427. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5428. @section deflate
  5429. Apply deflate effect to the video.
  5430. This filter replaces the pixel by the local(3x3) average by taking into account
  5431. only values lower than the pixel.
  5432. It accepts the following options:
  5433. @table @option
  5434. @item threshold0
  5435. @item threshold1
  5436. @item threshold2
  5437. @item threshold3
  5438. Limit the maximum change for each plane, default is 65535.
  5439. If 0, plane will remain unchanged.
  5440. @end table
  5441. @section deflicker
  5442. Remove temporal frame luminance variations.
  5443. It accepts the following options:
  5444. @table @option
  5445. @item size, s
  5446. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5447. @item mode, m
  5448. Set averaging mode to smooth temporal luminance variations.
  5449. Available values are:
  5450. @table @samp
  5451. @item am
  5452. Arithmetic mean
  5453. @item gm
  5454. Geometric mean
  5455. @item hm
  5456. Harmonic mean
  5457. @item qm
  5458. Quadratic mean
  5459. @item cm
  5460. Cubic mean
  5461. @item pm
  5462. Power mean
  5463. @item median
  5464. Median
  5465. @end table
  5466. @item bypass
  5467. Do not actually modify frame. Useful when one only wants metadata.
  5468. @end table
  5469. @section dejudder
  5470. Remove judder produced by partially interlaced telecined content.
  5471. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5472. source was partially telecined content then the output of @code{pullup,dejudder}
  5473. will have a variable frame rate. May change the recorded frame rate of the
  5474. container. Aside from that change, this filter will not affect constant frame
  5475. rate video.
  5476. The option available in this filter is:
  5477. @table @option
  5478. @item cycle
  5479. Specify the length of the window over which the judder repeats.
  5480. Accepts any integer greater than 1. Useful values are:
  5481. @table @samp
  5482. @item 4
  5483. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5484. @item 5
  5485. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5486. @item 20
  5487. If a mixture of the two.
  5488. @end table
  5489. The default is @samp{4}.
  5490. @end table
  5491. @section delogo
  5492. Suppress a TV station logo by a simple interpolation of the surrounding
  5493. pixels. Just set a rectangle covering the logo and watch it disappear
  5494. (and sometimes something even uglier appear - your mileage may vary).
  5495. It accepts the following parameters:
  5496. @table @option
  5497. @item x
  5498. @item y
  5499. Specify the top left corner coordinates of the logo. They must be
  5500. specified.
  5501. @item w
  5502. @item h
  5503. Specify the width and height of the logo to clear. They must be
  5504. specified.
  5505. @item band, t
  5506. Specify the thickness of the fuzzy edge of the rectangle (added to
  5507. @var{w} and @var{h}). The default value is 1. This option is
  5508. deprecated, setting higher values should no longer be necessary and
  5509. is not recommended.
  5510. @item show
  5511. When set to 1, a green rectangle is drawn on the screen to simplify
  5512. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5513. The default value is 0.
  5514. The rectangle is drawn on the outermost pixels which will be (partly)
  5515. replaced with interpolated values. The values of the next pixels
  5516. immediately outside this rectangle in each direction will be used to
  5517. compute the interpolated pixel values inside the rectangle.
  5518. @end table
  5519. @subsection Examples
  5520. @itemize
  5521. @item
  5522. Set a rectangle covering the area with top left corner coordinates 0,0
  5523. and size 100x77, and a band of size 10:
  5524. @example
  5525. delogo=x=0:y=0:w=100:h=77:band=10
  5526. @end example
  5527. @end itemize
  5528. @section deshake
  5529. Attempt to fix small changes in horizontal and/or vertical shift. This
  5530. filter helps remove camera shake from hand-holding a camera, bumping a
  5531. tripod, moving on a vehicle, etc.
  5532. The filter accepts the following options:
  5533. @table @option
  5534. @item x
  5535. @item y
  5536. @item w
  5537. @item h
  5538. Specify a rectangular area where to limit the search for motion
  5539. vectors.
  5540. If desired the search for motion vectors can be limited to a
  5541. rectangular area of the frame defined by its top left corner, width
  5542. and height. These parameters have the same meaning as the drawbox
  5543. filter which can be used to visualise the position of the bounding
  5544. box.
  5545. This is useful when simultaneous movement of subjects within the frame
  5546. might be confused for camera motion by the motion vector search.
  5547. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5548. then the full frame is used. This allows later options to be set
  5549. without specifying the bounding box for the motion vector search.
  5550. Default - search the whole frame.
  5551. @item rx
  5552. @item ry
  5553. Specify the maximum extent of movement in x and y directions in the
  5554. range 0-64 pixels. Default 16.
  5555. @item edge
  5556. Specify how to generate pixels to fill blanks at the edge of the
  5557. frame. Available values are:
  5558. @table @samp
  5559. @item blank, 0
  5560. Fill zeroes at blank locations
  5561. @item original, 1
  5562. Original image at blank locations
  5563. @item clamp, 2
  5564. Extruded edge value at blank locations
  5565. @item mirror, 3
  5566. Mirrored edge at blank locations
  5567. @end table
  5568. Default value is @samp{mirror}.
  5569. @item blocksize
  5570. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5571. default 8.
  5572. @item contrast
  5573. Specify the contrast threshold for blocks. Only blocks with more than
  5574. the specified contrast (difference between darkest and lightest
  5575. pixels) will be considered. Range 1-255, default 125.
  5576. @item search
  5577. Specify the search strategy. Available values are:
  5578. @table @samp
  5579. @item exhaustive, 0
  5580. Set exhaustive search
  5581. @item less, 1
  5582. Set less exhaustive search.
  5583. @end table
  5584. Default value is @samp{exhaustive}.
  5585. @item filename
  5586. If set then a detailed log of the motion search is written to the
  5587. specified file.
  5588. @end table
  5589. @section despill
  5590. Remove unwanted contamination of foreground colors, caused by reflected color of
  5591. greenscreen or bluescreen.
  5592. This filter accepts the following options:
  5593. @table @option
  5594. @item type
  5595. Set what type of despill to use.
  5596. @item mix
  5597. Set how spillmap will be generated.
  5598. @item expand
  5599. Set how much to get rid of still remaining spill.
  5600. @item red
  5601. Controls amount of red in spill area.
  5602. @item green
  5603. Controls amount of green in spill area.
  5604. Should be -1 for greenscreen.
  5605. @item blue
  5606. Controls amount of blue in spill area.
  5607. Should be -1 for bluescreen.
  5608. @item brightness
  5609. Controls brightness of spill area, preserving colors.
  5610. @item alpha
  5611. Modify alpha from generated spillmap.
  5612. @end table
  5613. @section detelecine
  5614. Apply an exact inverse of the telecine operation. It requires a predefined
  5615. pattern specified using the pattern option which must be the same as that passed
  5616. to the telecine filter.
  5617. This filter accepts the following options:
  5618. @table @option
  5619. @item first_field
  5620. @table @samp
  5621. @item top, t
  5622. top field first
  5623. @item bottom, b
  5624. bottom field first
  5625. The default value is @code{top}.
  5626. @end table
  5627. @item pattern
  5628. A string of numbers representing the pulldown pattern you wish to apply.
  5629. The default value is @code{23}.
  5630. @item start_frame
  5631. A number representing position of the first frame with respect to the telecine
  5632. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5633. @end table
  5634. @section dilation
  5635. Apply dilation effect to the video.
  5636. This filter replaces the pixel by the local(3x3) maximum.
  5637. It accepts the following options:
  5638. @table @option
  5639. @item threshold0
  5640. @item threshold1
  5641. @item threshold2
  5642. @item threshold3
  5643. Limit the maximum change for each plane, default is 65535.
  5644. If 0, plane will remain unchanged.
  5645. @item coordinates
  5646. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5647. pixels are used.
  5648. Flags to local 3x3 coordinates maps like this:
  5649. 1 2 3
  5650. 4 5
  5651. 6 7 8
  5652. @end table
  5653. @section displace
  5654. Displace pixels as indicated by second and third input stream.
  5655. It takes three input streams and outputs one stream, the first input is the
  5656. source, and second and third input are displacement maps.
  5657. The second input specifies how much to displace pixels along the
  5658. x-axis, while the third input specifies how much to displace pixels
  5659. along the y-axis.
  5660. If one of displacement map streams terminates, last frame from that
  5661. displacement map will be used.
  5662. Note that once generated, displacements maps can be reused over and over again.
  5663. A description of the accepted options follows.
  5664. @table @option
  5665. @item edge
  5666. Set displace behavior for pixels that are out of range.
  5667. Available values are:
  5668. @table @samp
  5669. @item blank
  5670. Missing pixels are replaced by black pixels.
  5671. @item smear
  5672. Adjacent pixels will spread out to replace missing pixels.
  5673. @item wrap
  5674. Out of range pixels are wrapped so they point to pixels of other side.
  5675. @item mirror
  5676. Out of range pixels will be replaced with mirrored pixels.
  5677. @end table
  5678. Default is @samp{smear}.
  5679. @end table
  5680. @subsection Examples
  5681. @itemize
  5682. @item
  5683. Add ripple effect to rgb input of video size hd720:
  5684. @example
  5685. 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
  5686. @end example
  5687. @item
  5688. Add wave effect to rgb input of video size hd720:
  5689. @example
  5690. 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
  5691. @end example
  5692. @end itemize
  5693. @section drawbox
  5694. Draw a colored box on the input image.
  5695. It accepts the following parameters:
  5696. @table @option
  5697. @item x
  5698. @item y
  5699. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5700. @item width, w
  5701. @item height, h
  5702. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5703. the input width and height. It defaults to 0.
  5704. @item color, c
  5705. Specify the color of the box to write. For the general syntax of this option,
  5706. check the "Color" section in the ffmpeg-utils manual. If the special
  5707. value @code{invert} is used, the box edge color is the same as the
  5708. video with inverted luma.
  5709. @item thickness, t
  5710. The expression which sets the thickness of the box edge.
  5711. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5712. See below for the list of accepted constants.
  5713. @item replace
  5714. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5715. will overwrite the video's color and alpha pixels.
  5716. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5717. @end table
  5718. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5719. following constants:
  5720. @table @option
  5721. @item dar
  5722. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5723. @item hsub
  5724. @item vsub
  5725. horizontal and vertical chroma subsample values. For example for the
  5726. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5727. @item in_h, ih
  5728. @item in_w, iw
  5729. The input width and height.
  5730. @item sar
  5731. The input sample aspect ratio.
  5732. @item x
  5733. @item y
  5734. The x and y offset coordinates where the box is drawn.
  5735. @item w
  5736. @item h
  5737. The width and height of the drawn box.
  5738. @item t
  5739. The thickness of the drawn box.
  5740. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5741. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5742. @end table
  5743. @subsection Examples
  5744. @itemize
  5745. @item
  5746. Draw a black box around the edge of the input image:
  5747. @example
  5748. drawbox
  5749. @end example
  5750. @item
  5751. Draw a box with color red and an opacity of 50%:
  5752. @example
  5753. drawbox=10:20:200:60:red@@0.5
  5754. @end example
  5755. The previous example can be specified as:
  5756. @example
  5757. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5758. @end example
  5759. @item
  5760. Fill the box with pink color:
  5761. @example
  5762. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5763. @end example
  5764. @item
  5765. Draw a 2-pixel red 2.40:1 mask:
  5766. @example
  5767. 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
  5768. @end example
  5769. @end itemize
  5770. @section drawgrid
  5771. Draw a grid on the input image.
  5772. It accepts the following parameters:
  5773. @table @option
  5774. @item x
  5775. @item y
  5776. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5777. @item width, w
  5778. @item height, h
  5779. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5780. input width and height, respectively, minus @code{thickness}, so image gets
  5781. framed. Default to 0.
  5782. @item color, c
  5783. Specify the color of the grid. For the general syntax of this option,
  5784. check the "Color" section in the ffmpeg-utils manual. If the special
  5785. value @code{invert} is used, the grid color is the same as the
  5786. video with inverted luma.
  5787. @item thickness, t
  5788. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5789. See below for the list of accepted constants.
  5790. @item replace
  5791. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5792. will overwrite the video's color and alpha pixels.
  5793. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5794. @end table
  5795. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5796. following constants:
  5797. @table @option
  5798. @item dar
  5799. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5800. @item hsub
  5801. @item vsub
  5802. horizontal and vertical chroma subsample values. For example for the
  5803. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5804. @item in_h, ih
  5805. @item in_w, iw
  5806. The input grid cell width and height.
  5807. @item sar
  5808. The input sample aspect ratio.
  5809. @item x
  5810. @item y
  5811. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5812. @item w
  5813. @item h
  5814. The width and height of the drawn cell.
  5815. @item t
  5816. The thickness of the drawn cell.
  5817. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5818. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5819. @end table
  5820. @subsection Examples
  5821. @itemize
  5822. @item
  5823. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5824. @example
  5825. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5826. @end example
  5827. @item
  5828. Draw a white 3x3 grid with an opacity of 50%:
  5829. @example
  5830. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5831. @end example
  5832. @end itemize
  5833. @anchor{drawtext}
  5834. @section drawtext
  5835. Draw a text string or text from a specified file on top of a video, using the
  5836. libfreetype library.
  5837. To enable compilation of this filter, you need to configure FFmpeg with
  5838. @code{--enable-libfreetype}.
  5839. To enable default font fallback and the @var{font} option you need to
  5840. configure FFmpeg with @code{--enable-libfontconfig}.
  5841. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5842. @code{--enable-libfribidi}.
  5843. @subsection Syntax
  5844. It accepts the following parameters:
  5845. @table @option
  5846. @item box
  5847. Used to draw a box around text using the background color.
  5848. The value must be either 1 (enable) or 0 (disable).
  5849. The default value of @var{box} is 0.
  5850. @item boxborderw
  5851. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5852. The default value of @var{boxborderw} is 0.
  5853. @item boxcolor
  5854. The color to be used for drawing box around text. For the syntax of this
  5855. option, check the "Color" section in the ffmpeg-utils manual.
  5856. The default value of @var{boxcolor} is "white".
  5857. @item line_spacing
  5858. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5859. The default value of @var{line_spacing} is 0.
  5860. @item borderw
  5861. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5862. The default value of @var{borderw} is 0.
  5863. @item bordercolor
  5864. Set the color to be used for drawing border around text. For the syntax of this
  5865. option, check the "Color" section in the ffmpeg-utils manual.
  5866. The default value of @var{bordercolor} is "black".
  5867. @item expansion
  5868. Select how the @var{text} is expanded. Can be either @code{none},
  5869. @code{strftime} (deprecated) or
  5870. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5871. below for details.
  5872. @item basetime
  5873. Set a start time for the count. Value is in microseconds. Only applied
  5874. in the deprecated strftime expansion mode. To emulate in normal expansion
  5875. mode use the @code{pts} function, supplying the start time (in seconds)
  5876. as the second argument.
  5877. @item fix_bounds
  5878. If true, check and fix text coords to avoid clipping.
  5879. @item fontcolor
  5880. The color to be used for drawing fonts. For the syntax of this option, check
  5881. the "Color" section in the ffmpeg-utils manual.
  5882. The default value of @var{fontcolor} is "black".
  5883. @item fontcolor_expr
  5884. String which is expanded the same way as @var{text} to obtain dynamic
  5885. @var{fontcolor} value. By default this option has empty value and is not
  5886. processed. When this option is set, it overrides @var{fontcolor} option.
  5887. @item font
  5888. The font family to be used for drawing text. By default Sans.
  5889. @item fontfile
  5890. The font file to be used for drawing text. The path must be included.
  5891. This parameter is mandatory if the fontconfig support is disabled.
  5892. @item alpha
  5893. Draw the text applying alpha blending. The value can
  5894. be a number between 0.0 and 1.0.
  5895. The expression accepts the same variables @var{x, y} as well.
  5896. The default value is 1.
  5897. Please see @var{fontcolor_expr}.
  5898. @item fontsize
  5899. The font size to be used for drawing text.
  5900. The default value of @var{fontsize} is 16.
  5901. @item text_shaping
  5902. If set to 1, attempt to shape the text (for example, reverse the order of
  5903. right-to-left text and join Arabic characters) before drawing it.
  5904. Otherwise, just draw the text exactly as given.
  5905. By default 1 (if supported).
  5906. @item ft_load_flags
  5907. The flags to be used for loading the fonts.
  5908. The flags map the corresponding flags supported by libfreetype, and are
  5909. a combination of the following values:
  5910. @table @var
  5911. @item default
  5912. @item no_scale
  5913. @item no_hinting
  5914. @item render
  5915. @item no_bitmap
  5916. @item vertical_layout
  5917. @item force_autohint
  5918. @item crop_bitmap
  5919. @item pedantic
  5920. @item ignore_global_advance_width
  5921. @item no_recurse
  5922. @item ignore_transform
  5923. @item monochrome
  5924. @item linear_design
  5925. @item no_autohint
  5926. @end table
  5927. Default value is "default".
  5928. For more information consult the documentation for the FT_LOAD_*
  5929. libfreetype flags.
  5930. @item shadowcolor
  5931. The color to be used for drawing a shadow behind the drawn text. For the
  5932. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5933. The default value of @var{shadowcolor} is "black".
  5934. @item shadowx
  5935. @item shadowy
  5936. The x and y offsets for the text shadow position with respect to the
  5937. position of the text. They can be either positive or negative
  5938. values. The default value for both is "0".
  5939. @item start_number
  5940. The starting frame number for the n/frame_num variable. The default value
  5941. is "0".
  5942. @item tabsize
  5943. The size in number of spaces to use for rendering the tab.
  5944. Default value is 4.
  5945. @item timecode
  5946. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5947. format. It can be used with or without text parameter. @var{timecode_rate}
  5948. option must be specified.
  5949. @item timecode_rate, rate, r
  5950. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5951. integer. Minimum value is "1".
  5952. Drop-frame timecode is supported for frame rates 30 & 60.
  5953. @item tc24hmax
  5954. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5955. Default is 0 (disabled).
  5956. @item text
  5957. The text string to be drawn. The text must be a sequence of UTF-8
  5958. encoded characters.
  5959. This parameter is mandatory if no file is specified with the parameter
  5960. @var{textfile}.
  5961. @item textfile
  5962. A text file containing text to be drawn. The text must be a sequence
  5963. of UTF-8 encoded characters.
  5964. This parameter is mandatory if no text string is specified with the
  5965. parameter @var{text}.
  5966. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5967. @item reload
  5968. If set to 1, the @var{textfile} will be reloaded before each frame.
  5969. Be sure to update it atomically, or it may be read partially, or even fail.
  5970. @item x
  5971. @item y
  5972. The expressions which specify the offsets where text will be drawn
  5973. within the video frame. They are relative to the top/left border of the
  5974. output image.
  5975. The default value of @var{x} and @var{y} is "0".
  5976. See below for the list of accepted constants and functions.
  5977. @end table
  5978. The parameters for @var{x} and @var{y} are expressions containing the
  5979. following constants and functions:
  5980. @table @option
  5981. @item dar
  5982. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5983. @item hsub
  5984. @item vsub
  5985. horizontal and vertical chroma subsample values. For example for the
  5986. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5987. @item line_h, lh
  5988. the height of each text line
  5989. @item main_h, h, H
  5990. the input height
  5991. @item main_w, w, W
  5992. the input width
  5993. @item max_glyph_a, ascent
  5994. the maximum distance from the baseline to the highest/upper grid
  5995. coordinate used to place a glyph outline point, for all the rendered
  5996. glyphs.
  5997. It is a positive value, due to the grid's orientation with the Y axis
  5998. upwards.
  5999. @item max_glyph_d, descent
  6000. the maximum distance from the baseline to the lowest grid coordinate
  6001. used to place a glyph outline point, for all the rendered glyphs.
  6002. This is a negative value, due to the grid's orientation, with the Y axis
  6003. upwards.
  6004. @item max_glyph_h
  6005. maximum glyph height, that is the maximum height for all the glyphs
  6006. contained in the rendered text, it is equivalent to @var{ascent} -
  6007. @var{descent}.
  6008. @item max_glyph_w
  6009. maximum glyph width, that is the maximum width for all the glyphs
  6010. contained in the rendered text
  6011. @item n
  6012. the number of input frame, starting from 0
  6013. @item rand(min, max)
  6014. return a random number included between @var{min} and @var{max}
  6015. @item sar
  6016. The input sample aspect ratio.
  6017. @item t
  6018. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6019. @item text_h, th
  6020. the height of the rendered text
  6021. @item text_w, tw
  6022. the width of the rendered text
  6023. @item x
  6024. @item y
  6025. the x and y offset coordinates where the text is drawn.
  6026. These parameters allow the @var{x} and @var{y} expressions to refer
  6027. each other, so you can for example specify @code{y=x/dar}.
  6028. @end table
  6029. @anchor{drawtext_expansion}
  6030. @subsection Text expansion
  6031. If @option{expansion} is set to @code{strftime},
  6032. the filter recognizes strftime() sequences in the provided text and
  6033. expands them accordingly. Check the documentation of strftime(). This
  6034. feature is deprecated.
  6035. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6036. If @option{expansion} is set to @code{normal} (which is the default),
  6037. the following expansion mechanism is used.
  6038. The backslash character @samp{\}, followed by any character, always expands to
  6039. the second character.
  6040. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6041. braces is a function name, possibly followed by arguments separated by ':'.
  6042. If the arguments contain special characters or delimiters (':' or '@}'),
  6043. they should be escaped.
  6044. Note that they probably must also be escaped as the value for the
  6045. @option{text} option in the filter argument string and as the filter
  6046. argument in the filtergraph description, and possibly also for the shell,
  6047. that makes up to four levels of escaping; using a text file avoids these
  6048. problems.
  6049. The following functions are available:
  6050. @table @command
  6051. @item expr, e
  6052. The expression evaluation result.
  6053. It must take one argument specifying the expression to be evaluated,
  6054. which accepts the same constants and functions as the @var{x} and
  6055. @var{y} values. Note that not all constants should be used, for
  6056. example the text size is not known when evaluating the expression, so
  6057. the constants @var{text_w} and @var{text_h} will have an undefined
  6058. value.
  6059. @item expr_int_format, eif
  6060. Evaluate the expression's value and output as formatted integer.
  6061. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6062. The second argument specifies the output format. Allowed values are @samp{x},
  6063. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6064. @code{printf} function.
  6065. The third parameter is optional and sets the number of positions taken by the output.
  6066. It can be used to add padding with zeros from the left.
  6067. @item gmtime
  6068. The time at which the filter is running, expressed in UTC.
  6069. It can accept an argument: a strftime() format string.
  6070. @item localtime
  6071. The time at which the filter is running, expressed in the local time zone.
  6072. It can accept an argument: a strftime() format string.
  6073. @item metadata
  6074. Frame metadata. Takes one or two arguments.
  6075. The first argument is mandatory and specifies the metadata key.
  6076. The second argument is optional and specifies a default value, used when the
  6077. metadata key is not found or empty.
  6078. @item n, frame_num
  6079. The frame number, starting from 0.
  6080. @item pict_type
  6081. A 1 character description of the current picture type.
  6082. @item pts
  6083. The timestamp of the current frame.
  6084. It can take up to three arguments.
  6085. The first argument is the format of the timestamp; it defaults to @code{flt}
  6086. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6087. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6088. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6089. @code{localtime} stands for the timestamp of the frame formatted as
  6090. local time zone time.
  6091. The second argument is an offset added to the timestamp.
  6092. If the format is set to @code{localtime} or @code{gmtime},
  6093. a third argument may be supplied: a strftime() format string.
  6094. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6095. @end table
  6096. @subsection Examples
  6097. @itemize
  6098. @item
  6099. Draw "Test Text" with font FreeSerif, using the default values for the
  6100. optional parameters.
  6101. @example
  6102. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6103. @end example
  6104. @item
  6105. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6106. and y=50 (counting from the top-left corner of the screen), text is
  6107. yellow with a red box around it. Both the text and the box have an
  6108. opacity of 20%.
  6109. @example
  6110. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6111. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6112. @end example
  6113. Note that the double quotes are not necessary if spaces are not used
  6114. within the parameter list.
  6115. @item
  6116. Show the text at the center of the video frame:
  6117. @example
  6118. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6119. @end example
  6120. @item
  6121. Show the text at a random position, switching to a new position every 30 seconds:
  6122. @example
  6123. 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)"
  6124. @end example
  6125. @item
  6126. Show a text line sliding from right to left in the last row of the video
  6127. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6128. with no newlines.
  6129. @example
  6130. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6131. @end example
  6132. @item
  6133. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6134. @example
  6135. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6136. @end example
  6137. @item
  6138. Draw a single green letter "g", at the center of the input video.
  6139. The glyph baseline is placed at half screen height.
  6140. @example
  6141. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6142. @end example
  6143. @item
  6144. Show text for 1 second every 3 seconds:
  6145. @example
  6146. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6147. @end example
  6148. @item
  6149. Use fontconfig to set the font. Note that the colons need to be escaped.
  6150. @example
  6151. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6152. @end example
  6153. @item
  6154. Print the date of a real-time encoding (see strftime(3)):
  6155. @example
  6156. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6157. @end example
  6158. @item
  6159. Show text fading in and out (appearing/disappearing):
  6160. @example
  6161. #!/bin/sh
  6162. DS=1.0 # display start
  6163. DE=10.0 # display end
  6164. FID=1.5 # fade in duration
  6165. FOD=5 # fade out duration
  6166. 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 @}"
  6167. @end example
  6168. @item
  6169. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6170. and the @option{fontsize} value are included in the @option{y} offset.
  6171. @example
  6172. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6173. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6174. @end example
  6175. @end itemize
  6176. For more information about libfreetype, check:
  6177. @url{http://www.freetype.org/}.
  6178. For more information about fontconfig, check:
  6179. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6180. For more information about libfribidi, check:
  6181. @url{http://fribidi.org/}.
  6182. @section edgedetect
  6183. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6184. The filter accepts the following options:
  6185. @table @option
  6186. @item low
  6187. @item high
  6188. Set low and high threshold values used by the Canny thresholding
  6189. algorithm.
  6190. The high threshold selects the "strong" edge pixels, which are then
  6191. connected through 8-connectivity with the "weak" edge pixels selected
  6192. by the low threshold.
  6193. @var{low} and @var{high} threshold values must be chosen in the range
  6194. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6195. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6196. is @code{50/255}.
  6197. @item mode
  6198. Define the drawing mode.
  6199. @table @samp
  6200. @item wires
  6201. Draw white/gray wires on black background.
  6202. @item colormix
  6203. Mix the colors to create a paint/cartoon effect.
  6204. @end table
  6205. Default value is @var{wires}.
  6206. @end table
  6207. @subsection Examples
  6208. @itemize
  6209. @item
  6210. Standard edge detection with custom values for the hysteresis thresholding:
  6211. @example
  6212. edgedetect=low=0.1:high=0.4
  6213. @end example
  6214. @item
  6215. Painting effect without thresholding:
  6216. @example
  6217. edgedetect=mode=colormix:high=0
  6218. @end example
  6219. @end itemize
  6220. @section eq
  6221. Set brightness, contrast, saturation and approximate gamma adjustment.
  6222. The filter accepts the following options:
  6223. @table @option
  6224. @item contrast
  6225. Set the contrast expression. The value must be a float value in range
  6226. @code{-2.0} to @code{2.0}. The default value is "1".
  6227. @item brightness
  6228. Set the brightness expression. The value must be a float value in
  6229. range @code{-1.0} to @code{1.0}. The default value is "0".
  6230. @item saturation
  6231. Set the saturation expression. The value must be a float in
  6232. range @code{0.0} to @code{3.0}. The default value is "1".
  6233. @item gamma
  6234. Set the gamma expression. The value must be a float in range
  6235. @code{0.1} to @code{10.0}. The default value is "1".
  6236. @item gamma_r
  6237. Set the gamma expression for red. The value must be a float in
  6238. range @code{0.1} to @code{10.0}. The default value is "1".
  6239. @item gamma_g
  6240. Set the gamma expression for green. The value must be a float in range
  6241. @code{0.1} to @code{10.0}. The default value is "1".
  6242. @item gamma_b
  6243. Set the gamma expression for blue. The value must be a float in range
  6244. @code{0.1} to @code{10.0}. The default value is "1".
  6245. @item gamma_weight
  6246. Set the gamma weight expression. It can be used to reduce the effect
  6247. of a high gamma value on bright image areas, e.g. keep them from
  6248. getting overamplified and just plain white. The value must be a float
  6249. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6250. gamma correction all the way down while @code{1.0} leaves it at its
  6251. full strength. Default is "1".
  6252. @item eval
  6253. Set when the expressions for brightness, contrast, saturation and
  6254. gamma expressions are evaluated.
  6255. It accepts the following values:
  6256. @table @samp
  6257. @item init
  6258. only evaluate expressions once during the filter initialization or
  6259. when a command is processed
  6260. @item frame
  6261. evaluate expressions for each incoming frame
  6262. @end table
  6263. Default value is @samp{init}.
  6264. @end table
  6265. The expressions accept the following parameters:
  6266. @table @option
  6267. @item n
  6268. frame count of the input frame starting from 0
  6269. @item pos
  6270. byte position of the corresponding packet in the input file, NAN if
  6271. unspecified
  6272. @item r
  6273. frame rate of the input video, NAN if the input frame rate is unknown
  6274. @item t
  6275. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6276. @end table
  6277. @subsection Commands
  6278. The filter supports the following commands:
  6279. @table @option
  6280. @item contrast
  6281. Set the contrast expression.
  6282. @item brightness
  6283. Set the brightness expression.
  6284. @item saturation
  6285. Set the saturation expression.
  6286. @item gamma
  6287. Set the gamma expression.
  6288. @item gamma_r
  6289. Set the gamma_r expression.
  6290. @item gamma_g
  6291. Set gamma_g expression.
  6292. @item gamma_b
  6293. Set gamma_b expression.
  6294. @item gamma_weight
  6295. Set gamma_weight expression.
  6296. The command accepts the same syntax of the corresponding option.
  6297. If the specified expression is not valid, it is kept at its current
  6298. value.
  6299. @end table
  6300. @section erosion
  6301. Apply erosion effect to the video.
  6302. This filter replaces the pixel by the local(3x3) minimum.
  6303. It accepts the following options:
  6304. @table @option
  6305. @item threshold0
  6306. @item threshold1
  6307. @item threshold2
  6308. @item threshold3
  6309. Limit the maximum change for each plane, default is 65535.
  6310. If 0, plane will remain unchanged.
  6311. @item coordinates
  6312. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6313. pixels are used.
  6314. Flags to local 3x3 coordinates maps like this:
  6315. 1 2 3
  6316. 4 5
  6317. 6 7 8
  6318. @end table
  6319. @section extractplanes
  6320. Extract color channel components from input video stream into
  6321. separate grayscale video streams.
  6322. The filter accepts the following option:
  6323. @table @option
  6324. @item planes
  6325. Set plane(s) to extract.
  6326. Available values for planes are:
  6327. @table @samp
  6328. @item y
  6329. @item u
  6330. @item v
  6331. @item a
  6332. @item r
  6333. @item g
  6334. @item b
  6335. @end table
  6336. Choosing planes not available in the input will result in an error.
  6337. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6338. with @code{y}, @code{u}, @code{v} planes at same time.
  6339. @end table
  6340. @subsection Examples
  6341. @itemize
  6342. @item
  6343. Extract luma, u and v color channel component from input video frame
  6344. into 3 grayscale outputs:
  6345. @example
  6346. 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
  6347. @end example
  6348. @end itemize
  6349. @section elbg
  6350. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6351. For each input image, the filter will compute the optimal mapping from
  6352. the input to the output given the codebook length, that is the number
  6353. of distinct output colors.
  6354. This filter accepts the following options.
  6355. @table @option
  6356. @item codebook_length, l
  6357. Set codebook length. The value must be a positive integer, and
  6358. represents the number of distinct output colors. Default value is 256.
  6359. @item nb_steps, n
  6360. Set the maximum number of iterations to apply for computing the optimal
  6361. mapping. The higher the value the better the result and the higher the
  6362. computation time. Default value is 1.
  6363. @item seed, s
  6364. Set a random seed, must be an integer included between 0 and
  6365. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6366. will try to use a good random seed on a best effort basis.
  6367. @item pal8
  6368. Set pal8 output pixel format. This option does not work with codebook
  6369. length greater than 256.
  6370. @end table
  6371. @section entropy
  6372. Measure graylevel entropy in histogram of color channels of video frames.
  6373. It accepts the following parameters:
  6374. @table @option
  6375. @item mode
  6376. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6377. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6378. between neighbour histogram values.
  6379. @end table
  6380. @section fade
  6381. Apply a fade-in/out effect to the input video.
  6382. It accepts the following parameters:
  6383. @table @option
  6384. @item type, t
  6385. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6386. effect.
  6387. Default is @code{in}.
  6388. @item start_frame, s
  6389. Specify the number of the frame to start applying the fade
  6390. effect at. Default is 0.
  6391. @item nb_frames, n
  6392. The number of frames that the fade effect lasts. At the end of the
  6393. fade-in effect, the output video will have the same intensity as the input video.
  6394. At the end of the fade-out transition, the output video will be filled with the
  6395. selected @option{color}.
  6396. Default is 25.
  6397. @item alpha
  6398. If set to 1, fade only alpha channel, if one exists on the input.
  6399. Default value is 0.
  6400. @item start_time, st
  6401. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6402. effect. If both start_frame and start_time are specified, the fade will start at
  6403. whichever comes last. Default is 0.
  6404. @item duration, d
  6405. The number of seconds for which the fade effect has to last. At the end of the
  6406. fade-in effect the output video will have the same intensity as the input video,
  6407. at the end of the fade-out transition the output video will be filled with the
  6408. selected @option{color}.
  6409. If both duration and nb_frames are specified, duration is used. Default is 0
  6410. (nb_frames is used by default).
  6411. @item color, c
  6412. Specify the color of the fade. Default is "black".
  6413. @end table
  6414. @subsection Examples
  6415. @itemize
  6416. @item
  6417. Fade in the first 30 frames of video:
  6418. @example
  6419. fade=in:0:30
  6420. @end example
  6421. The command above is equivalent to:
  6422. @example
  6423. fade=t=in:s=0:n=30
  6424. @end example
  6425. @item
  6426. Fade out the last 45 frames of a 200-frame video:
  6427. @example
  6428. fade=out:155:45
  6429. fade=type=out:start_frame=155:nb_frames=45
  6430. @end example
  6431. @item
  6432. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6433. @example
  6434. fade=in:0:25, fade=out:975:25
  6435. @end example
  6436. @item
  6437. Make the first 5 frames yellow, then fade in from frame 5-24:
  6438. @example
  6439. fade=in:5:20:color=yellow
  6440. @end example
  6441. @item
  6442. Fade in alpha over first 25 frames of video:
  6443. @example
  6444. fade=in:0:25:alpha=1
  6445. @end example
  6446. @item
  6447. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6448. @example
  6449. fade=t=in:st=5.5:d=0.5
  6450. @end example
  6451. @end itemize
  6452. @section fftfilt
  6453. Apply arbitrary expressions to samples in frequency domain
  6454. @table @option
  6455. @item dc_Y
  6456. Adjust the dc value (gain) of the luma plane of the image. The filter
  6457. accepts an integer value in range @code{0} to @code{1000}. The default
  6458. value is set to @code{0}.
  6459. @item dc_U
  6460. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6461. filter accepts an integer value in range @code{0} to @code{1000}. The
  6462. default value is set to @code{0}.
  6463. @item dc_V
  6464. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6465. filter accepts an integer value in range @code{0} to @code{1000}. The
  6466. default value is set to @code{0}.
  6467. @item weight_Y
  6468. Set the frequency domain weight expression for the luma plane.
  6469. @item weight_U
  6470. Set the frequency domain weight expression for the 1st chroma plane.
  6471. @item weight_V
  6472. Set the frequency domain weight expression for the 2nd chroma plane.
  6473. @item eval
  6474. Set when the expressions are evaluated.
  6475. It accepts the following values:
  6476. @table @samp
  6477. @item init
  6478. Only evaluate expressions once during the filter initialization.
  6479. @item frame
  6480. Evaluate expressions for each incoming frame.
  6481. @end table
  6482. Default value is @samp{init}.
  6483. The filter accepts the following variables:
  6484. @item X
  6485. @item Y
  6486. The coordinates of the current sample.
  6487. @item W
  6488. @item H
  6489. The width and height of the image.
  6490. @item N
  6491. The number of input frame, starting from 0.
  6492. @end table
  6493. @subsection Examples
  6494. @itemize
  6495. @item
  6496. High-pass:
  6497. @example
  6498. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6499. @end example
  6500. @item
  6501. Low-pass:
  6502. @example
  6503. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6504. @end example
  6505. @item
  6506. Sharpen:
  6507. @example
  6508. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6509. @end example
  6510. @item
  6511. Blur:
  6512. @example
  6513. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6514. @end example
  6515. @end itemize
  6516. @section field
  6517. Extract a single field from an interlaced image using stride
  6518. arithmetic to avoid wasting CPU time. The output frames are marked as
  6519. non-interlaced.
  6520. The filter accepts the following options:
  6521. @table @option
  6522. @item type
  6523. Specify whether to extract the top (if the value is @code{0} or
  6524. @code{top}) or the bottom field (if the value is @code{1} or
  6525. @code{bottom}).
  6526. @end table
  6527. @section fieldhint
  6528. Create new frames by copying the top and bottom fields from surrounding frames
  6529. supplied as numbers by the hint file.
  6530. @table @option
  6531. @item hint
  6532. Set file containing hints: absolute/relative frame numbers.
  6533. There must be one line for each frame in a clip. Each line must contain two
  6534. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6535. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6536. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6537. for @code{relative} mode. First number tells from which frame to pick up top
  6538. field and second number tells from which frame to pick up bottom field.
  6539. If optionally followed by @code{+} output frame will be marked as interlaced,
  6540. else if followed by @code{-} output frame will be marked as progressive, else
  6541. it will be marked same as input frame.
  6542. If line starts with @code{#} or @code{;} that line is skipped.
  6543. @item mode
  6544. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6545. @end table
  6546. Example of first several lines of @code{hint} file for @code{relative} mode:
  6547. @example
  6548. 0,0 - # first frame
  6549. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6550. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6551. 1,0 -
  6552. 0,0 -
  6553. 0,0 -
  6554. 1,0 -
  6555. 1,0 -
  6556. 1,0 -
  6557. 0,0 -
  6558. 0,0 -
  6559. 1,0 -
  6560. 1,0 -
  6561. 1,0 -
  6562. 0,0 -
  6563. @end example
  6564. @section fieldmatch
  6565. Field matching filter for inverse telecine. It is meant to reconstruct the
  6566. progressive frames from a telecined stream. The filter does not drop duplicated
  6567. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6568. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6569. The separation of the field matching and the decimation is notably motivated by
  6570. the possibility of inserting a de-interlacing filter fallback between the two.
  6571. If the source has mixed telecined and real interlaced content,
  6572. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6573. But these remaining combed frames will be marked as interlaced, and thus can be
  6574. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6575. In addition to the various configuration options, @code{fieldmatch} can take an
  6576. optional second stream, activated through the @option{ppsrc} option. If
  6577. enabled, the frames reconstruction will be based on the fields and frames from
  6578. this second stream. This allows the first input to be pre-processed in order to
  6579. help the various algorithms of the filter, while keeping the output lossless
  6580. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6581. or brightness/contrast adjustments can help.
  6582. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6583. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6584. which @code{fieldmatch} is based on. While the semantic and usage are very
  6585. close, some behaviour and options names can differ.
  6586. The @ref{decimate} filter currently only works for constant frame rate input.
  6587. If your input has mixed telecined (30fps) and progressive content with a lower
  6588. framerate like 24fps use the following filterchain to produce the necessary cfr
  6589. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6590. The filter accepts the following options:
  6591. @table @option
  6592. @item order
  6593. Specify the assumed field order of the input stream. Available values are:
  6594. @table @samp
  6595. @item auto
  6596. Auto detect parity (use FFmpeg's internal parity value).
  6597. @item bff
  6598. Assume bottom field first.
  6599. @item tff
  6600. Assume top field first.
  6601. @end table
  6602. Note that it is sometimes recommended not to trust the parity announced by the
  6603. stream.
  6604. Default value is @var{auto}.
  6605. @item mode
  6606. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6607. sense that it won't risk creating jerkiness due to duplicate frames when
  6608. possible, but if there are bad edits or blended fields it will end up
  6609. outputting combed frames when a good match might actually exist. On the other
  6610. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6611. but will almost always find a good frame if there is one. The other values are
  6612. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6613. jerkiness and creating duplicate frames versus finding good matches in sections
  6614. with bad edits, orphaned fields, blended fields, etc.
  6615. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6616. Available values are:
  6617. @table @samp
  6618. @item pc
  6619. 2-way matching (p/c)
  6620. @item pc_n
  6621. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6622. @item pc_u
  6623. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6624. @item pc_n_ub
  6625. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6626. still combed (p/c + n + u/b)
  6627. @item pcn
  6628. 3-way matching (p/c/n)
  6629. @item pcn_ub
  6630. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6631. detected as combed (p/c/n + u/b)
  6632. @end table
  6633. The parenthesis at the end indicate the matches that would be used for that
  6634. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6635. @var{top}).
  6636. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6637. the slowest.
  6638. Default value is @var{pc_n}.
  6639. @item ppsrc
  6640. Mark the main input stream as a pre-processed input, and enable the secondary
  6641. input stream as the clean source to pick the fields from. See the filter
  6642. introduction for more details. It is similar to the @option{clip2} feature from
  6643. VFM/TFM.
  6644. Default value is @code{0} (disabled).
  6645. @item field
  6646. Set the field to match from. It is recommended to set this to the same value as
  6647. @option{order} unless you experience matching failures with that setting. In
  6648. certain circumstances changing the field that is used to match from can have a
  6649. large impact on matching performance. Available values are:
  6650. @table @samp
  6651. @item auto
  6652. Automatic (same value as @option{order}).
  6653. @item bottom
  6654. Match from the bottom field.
  6655. @item top
  6656. Match from the top field.
  6657. @end table
  6658. Default value is @var{auto}.
  6659. @item mchroma
  6660. Set whether or not chroma is included during the match comparisons. In most
  6661. cases it is recommended to leave this enabled. You should set this to @code{0}
  6662. only if your clip has bad chroma problems such as heavy rainbowing or other
  6663. artifacts. Setting this to @code{0} could also be used to speed things up at
  6664. the cost of some accuracy.
  6665. Default value is @code{1}.
  6666. @item y0
  6667. @item y1
  6668. These define an exclusion band which excludes the lines between @option{y0} and
  6669. @option{y1} from being included in the field matching decision. An exclusion
  6670. band can be used to ignore subtitles, a logo, or other things that may
  6671. interfere with the matching. @option{y0} sets the starting scan line and
  6672. @option{y1} sets the ending line; all lines in between @option{y0} and
  6673. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6674. @option{y0} and @option{y1} to the same value will disable the feature.
  6675. @option{y0} and @option{y1} defaults to @code{0}.
  6676. @item scthresh
  6677. Set the scene change detection threshold as a percentage of maximum change on
  6678. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6679. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6680. @option{scthresh} is @code{[0.0, 100.0]}.
  6681. Default value is @code{12.0}.
  6682. @item combmatch
  6683. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6684. account the combed scores of matches when deciding what match to use as the
  6685. final match. Available values are:
  6686. @table @samp
  6687. @item none
  6688. No final matching based on combed scores.
  6689. @item sc
  6690. Combed scores are only used when a scene change is detected.
  6691. @item full
  6692. Use combed scores all the time.
  6693. @end table
  6694. Default is @var{sc}.
  6695. @item combdbg
  6696. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6697. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6698. Available values are:
  6699. @table @samp
  6700. @item none
  6701. No forced calculation.
  6702. @item pcn
  6703. Force p/c/n calculations.
  6704. @item pcnub
  6705. Force p/c/n/u/b calculations.
  6706. @end table
  6707. Default value is @var{none}.
  6708. @item cthresh
  6709. This is the area combing threshold used for combed frame detection. This
  6710. essentially controls how "strong" or "visible" combing must be to be detected.
  6711. Larger values mean combing must be more visible and smaller values mean combing
  6712. can be less visible or strong and still be detected. Valid settings are from
  6713. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6714. be detected as combed). This is basically a pixel difference value. A good
  6715. range is @code{[8, 12]}.
  6716. Default value is @code{9}.
  6717. @item chroma
  6718. Sets whether or not chroma is considered in the combed frame decision. Only
  6719. disable this if your source has chroma problems (rainbowing, etc.) that are
  6720. causing problems for the combed frame detection with chroma enabled. Actually,
  6721. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6722. where there is chroma only combing in the source.
  6723. Default value is @code{0}.
  6724. @item blockx
  6725. @item blocky
  6726. Respectively set the x-axis and y-axis size of the window used during combed
  6727. frame detection. This has to do with the size of the area in which
  6728. @option{combpel} pixels are required to be detected as combed for a frame to be
  6729. declared combed. See the @option{combpel} parameter description for more info.
  6730. Possible values are any number that is a power of 2 starting at 4 and going up
  6731. to 512.
  6732. Default value is @code{16}.
  6733. @item combpel
  6734. The number of combed pixels inside any of the @option{blocky} by
  6735. @option{blockx} size blocks on the frame for the frame to be detected as
  6736. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6737. setting controls "how much" combing there must be in any localized area (a
  6738. window defined by the @option{blockx} and @option{blocky} settings) on the
  6739. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6740. which point no frames will ever be detected as combed). This setting is known
  6741. as @option{MI} in TFM/VFM vocabulary.
  6742. Default value is @code{80}.
  6743. @end table
  6744. @anchor{p/c/n/u/b meaning}
  6745. @subsection p/c/n/u/b meaning
  6746. @subsubsection p/c/n
  6747. We assume the following telecined stream:
  6748. @example
  6749. Top fields: 1 2 2 3 4
  6750. Bottom fields: 1 2 3 4 4
  6751. @end example
  6752. The numbers correspond to the progressive frame the fields relate to. Here, the
  6753. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6754. When @code{fieldmatch} is configured to run a matching from bottom
  6755. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6756. @example
  6757. Input stream:
  6758. T 1 2 2 3 4
  6759. B 1 2 3 4 4 <-- matching reference
  6760. Matches: c c n n c
  6761. Output stream:
  6762. T 1 2 3 4 4
  6763. B 1 2 3 4 4
  6764. @end example
  6765. As a result of the field matching, we can see that some frames get duplicated.
  6766. To perform a complete inverse telecine, you need to rely on a decimation filter
  6767. after this operation. See for instance the @ref{decimate} filter.
  6768. The same operation now matching from top fields (@option{field}=@var{top})
  6769. looks like this:
  6770. @example
  6771. Input stream:
  6772. T 1 2 2 3 4 <-- matching reference
  6773. B 1 2 3 4 4
  6774. Matches: c c p p c
  6775. Output stream:
  6776. T 1 2 2 3 4
  6777. B 1 2 2 3 4
  6778. @end example
  6779. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6780. basically, they refer to the frame and field of the opposite parity:
  6781. @itemize
  6782. @item @var{p} matches the field of the opposite parity in the previous frame
  6783. @item @var{c} matches the field of the opposite parity in the current frame
  6784. @item @var{n} matches the field of the opposite parity in the next frame
  6785. @end itemize
  6786. @subsubsection u/b
  6787. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6788. from the opposite parity flag. In the following examples, we assume that we are
  6789. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6790. 'x' is placed above and below each matched fields.
  6791. With bottom matching (@option{field}=@var{bottom}):
  6792. @example
  6793. Match: c p n b u
  6794. x x x x x
  6795. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6796. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6797. x x x x x
  6798. Output frames:
  6799. 2 1 2 2 2
  6800. 2 2 2 1 3
  6801. @end example
  6802. With top matching (@option{field}=@var{top}):
  6803. @example
  6804. Match: c p n b u
  6805. x x x x x
  6806. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6807. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6808. x x x x x
  6809. Output frames:
  6810. 2 2 2 1 2
  6811. 2 1 3 2 2
  6812. @end example
  6813. @subsection Examples
  6814. Simple IVTC of a top field first telecined stream:
  6815. @example
  6816. fieldmatch=order=tff:combmatch=none, decimate
  6817. @end example
  6818. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6819. @example
  6820. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6821. @end example
  6822. @section fieldorder
  6823. Transform the field order of the input video.
  6824. It accepts the following parameters:
  6825. @table @option
  6826. @item order
  6827. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6828. for bottom field first.
  6829. @end table
  6830. The default value is @samp{tff}.
  6831. The transformation is done by shifting the picture content up or down
  6832. by one line, and filling the remaining line with appropriate picture content.
  6833. This method is consistent with most broadcast field order converters.
  6834. If the input video is not flagged as being interlaced, or it is already
  6835. flagged as being of the required output field order, then this filter does
  6836. not alter the incoming video.
  6837. It is very useful when converting to or from PAL DV material,
  6838. which is bottom field first.
  6839. For example:
  6840. @example
  6841. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6842. @end example
  6843. @section fifo, afifo
  6844. Buffer input images and send them when they are requested.
  6845. It is mainly useful when auto-inserted by the libavfilter
  6846. framework.
  6847. It does not take parameters.
  6848. @section fillborders
  6849. Fill borders of the input video, without changing video stream dimensions.
  6850. Sometimes video can have garbage at the four edges and you may not want to
  6851. crop video input to keep size multiple of some number.
  6852. This filter accepts the following options:
  6853. @table @option
  6854. @item left
  6855. Number of pixels to fill from left border.
  6856. @item right
  6857. Number of pixels to fill from right border.
  6858. @item top
  6859. Number of pixels to fill from top border.
  6860. @item bottom
  6861. Number of pixels to fill from bottom border.
  6862. @item mode
  6863. Set fill mode.
  6864. It accepts the following values:
  6865. @table @samp
  6866. @item smear
  6867. fill pixels using outermost pixels
  6868. @item mirror
  6869. fill pixels using mirroring
  6870. @item fixed
  6871. fill pixels with constant value
  6872. @end table
  6873. Default is @var{smear}.
  6874. @item color
  6875. Set color for pixels in fixed mode. Default is @var{black}.
  6876. @end table
  6877. @section find_rect
  6878. Find a rectangular object
  6879. It accepts the following options:
  6880. @table @option
  6881. @item object
  6882. Filepath of the object image, needs to be in gray8.
  6883. @item threshold
  6884. Detection threshold, default is 0.5.
  6885. @item mipmaps
  6886. Number of mipmaps, default is 3.
  6887. @item xmin, ymin, xmax, ymax
  6888. Specifies the rectangle in which to search.
  6889. @end table
  6890. @subsection Examples
  6891. @itemize
  6892. @item
  6893. Generate a representative palette of a given video using @command{ffmpeg}:
  6894. @example
  6895. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6896. @end example
  6897. @end itemize
  6898. @section cover_rect
  6899. Cover a rectangular object
  6900. It accepts the following options:
  6901. @table @option
  6902. @item cover
  6903. Filepath of the optional cover image, needs to be in yuv420.
  6904. @item mode
  6905. Set covering mode.
  6906. It accepts the following values:
  6907. @table @samp
  6908. @item cover
  6909. cover it by the supplied image
  6910. @item blur
  6911. cover it by interpolating the surrounding pixels
  6912. @end table
  6913. Default value is @var{blur}.
  6914. @end table
  6915. @subsection Examples
  6916. @itemize
  6917. @item
  6918. Generate a representative palette of a given video using @command{ffmpeg}:
  6919. @example
  6920. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6921. @end example
  6922. @end itemize
  6923. @section floodfill
  6924. Flood area with values of same pixel components with another values.
  6925. It accepts the following options:
  6926. @table @option
  6927. @item x
  6928. Set pixel x coordinate.
  6929. @item y
  6930. Set pixel y coordinate.
  6931. @item s0
  6932. Set source #0 component value.
  6933. @item s1
  6934. Set source #1 component value.
  6935. @item s2
  6936. Set source #2 component value.
  6937. @item s3
  6938. Set source #3 component value.
  6939. @item d0
  6940. Set destination #0 component value.
  6941. @item d1
  6942. Set destination #1 component value.
  6943. @item d2
  6944. Set destination #2 component value.
  6945. @item d3
  6946. Set destination #3 component value.
  6947. @end table
  6948. @anchor{format}
  6949. @section format
  6950. Convert the input video to one of the specified pixel formats.
  6951. Libavfilter will try to pick one that is suitable as input to
  6952. the next filter.
  6953. It accepts the following parameters:
  6954. @table @option
  6955. @item pix_fmts
  6956. A '|'-separated list of pixel format names, such as
  6957. "pix_fmts=yuv420p|monow|rgb24".
  6958. @end table
  6959. @subsection Examples
  6960. @itemize
  6961. @item
  6962. Convert the input video to the @var{yuv420p} format
  6963. @example
  6964. format=pix_fmts=yuv420p
  6965. @end example
  6966. Convert the input video to any of the formats in the list
  6967. @example
  6968. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6969. @end example
  6970. @end itemize
  6971. @anchor{fps}
  6972. @section fps
  6973. Convert the video to specified constant frame rate by duplicating or dropping
  6974. frames as necessary.
  6975. It accepts the following parameters:
  6976. @table @option
  6977. @item fps
  6978. The desired output frame rate. The default is @code{25}.
  6979. @item start_time
  6980. Assume the first PTS should be the given value, in seconds. This allows for
  6981. padding/trimming at the start of stream. By default, no assumption is made
  6982. about the first frame's expected PTS, so no padding or trimming is done.
  6983. For example, this could be set to 0 to pad the beginning with duplicates of
  6984. the first frame if a video stream starts after the audio stream or to trim any
  6985. frames with a negative PTS.
  6986. @item round
  6987. Timestamp (PTS) rounding method.
  6988. Possible values are:
  6989. @table @option
  6990. @item zero
  6991. round towards 0
  6992. @item inf
  6993. round away from 0
  6994. @item down
  6995. round towards -infinity
  6996. @item up
  6997. round towards +infinity
  6998. @item near
  6999. round to nearest
  7000. @end table
  7001. The default is @code{near}.
  7002. @item eof_action
  7003. Action performed when reading the last frame.
  7004. Possible values are:
  7005. @table @option
  7006. @item round
  7007. Use same timestamp rounding method as used for other frames.
  7008. @item pass
  7009. Pass through last frame if input duration has not been reached yet.
  7010. @end table
  7011. The default is @code{round}.
  7012. @end table
  7013. Alternatively, the options can be specified as a flat string:
  7014. @var{fps}[:@var{start_time}[:@var{round}]].
  7015. See also the @ref{setpts} filter.
  7016. @subsection Examples
  7017. @itemize
  7018. @item
  7019. A typical usage in order to set the fps to 25:
  7020. @example
  7021. fps=fps=25
  7022. @end example
  7023. @item
  7024. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7025. @example
  7026. fps=fps=film:round=near
  7027. @end example
  7028. @end itemize
  7029. @section framepack
  7030. Pack two different video streams into a stereoscopic video, setting proper
  7031. metadata on supported codecs. The two views should have the same size and
  7032. framerate and processing will stop when the shorter video ends. Please note
  7033. that you may conveniently adjust view properties with the @ref{scale} and
  7034. @ref{fps} filters.
  7035. It accepts the following parameters:
  7036. @table @option
  7037. @item format
  7038. The desired packing format. Supported values are:
  7039. @table @option
  7040. @item sbs
  7041. The views are next to each other (default).
  7042. @item tab
  7043. The views are on top of each other.
  7044. @item lines
  7045. The views are packed by line.
  7046. @item columns
  7047. The views are packed by column.
  7048. @item frameseq
  7049. The views are temporally interleaved.
  7050. @end table
  7051. @end table
  7052. Some examples:
  7053. @example
  7054. # Convert left and right views into a frame-sequential video
  7055. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7056. # Convert views into a side-by-side video with the same output resolution as the input
  7057. 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
  7058. @end example
  7059. @section framerate
  7060. Change the frame rate by interpolating new video output frames from the source
  7061. frames.
  7062. This filter is not designed to function correctly with interlaced media. If
  7063. you wish to change the frame rate of interlaced media then you are required
  7064. to deinterlace before this filter and re-interlace after this filter.
  7065. A description of the accepted options follows.
  7066. @table @option
  7067. @item fps
  7068. Specify the output frames per second. This option can also be specified
  7069. as a value alone. The default is @code{50}.
  7070. @item interp_start
  7071. Specify the start of a range where the output frame will be created as a
  7072. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7073. the default is @code{15}.
  7074. @item interp_end
  7075. Specify the end of a range where the output frame will be created as a
  7076. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7077. the default is @code{240}.
  7078. @item scene
  7079. Specify the level at which a scene change is detected as a value between
  7080. 0 and 100 to indicate a new scene; a low value reflects a low
  7081. probability for the current frame to introduce a new scene, while a higher
  7082. value means the current frame is more likely to be one.
  7083. The default is @code{8.2}.
  7084. @item flags
  7085. Specify flags influencing the filter process.
  7086. Available value for @var{flags} is:
  7087. @table @option
  7088. @item scene_change_detect, scd
  7089. Enable scene change detection using the value of the option @var{scene}.
  7090. This flag is enabled by default.
  7091. @end table
  7092. @end table
  7093. @section framestep
  7094. Select one frame every N-th frame.
  7095. This filter accepts the following option:
  7096. @table @option
  7097. @item step
  7098. Select frame after every @code{step} frames.
  7099. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7100. @end table
  7101. @anchor{frei0r}
  7102. @section frei0r
  7103. Apply a frei0r effect to the input video.
  7104. To enable the compilation of this filter, you need to install the frei0r
  7105. header and configure FFmpeg with @code{--enable-frei0r}.
  7106. It accepts the following parameters:
  7107. @table @option
  7108. @item filter_name
  7109. The name of the frei0r effect to load. If the environment variable
  7110. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7111. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7112. Otherwise, the standard frei0r paths are searched, in this order:
  7113. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7114. @file{/usr/lib/frei0r-1/}.
  7115. @item filter_params
  7116. A '|'-separated list of parameters to pass to the frei0r effect.
  7117. @end table
  7118. A frei0r effect parameter can be a boolean (its value is either
  7119. "y" or "n"), a double, a color (specified as
  7120. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7121. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  7122. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  7123. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7124. The number and types of parameters depend on the loaded effect. If an
  7125. effect parameter is not specified, the default value is set.
  7126. @subsection Examples
  7127. @itemize
  7128. @item
  7129. Apply the distort0r effect, setting the first two double parameters:
  7130. @example
  7131. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7132. @end example
  7133. @item
  7134. Apply the colordistance effect, taking a color as the first parameter:
  7135. @example
  7136. frei0r=colordistance:0.2/0.3/0.4
  7137. frei0r=colordistance:violet
  7138. frei0r=colordistance:0x112233
  7139. @end example
  7140. @item
  7141. Apply the perspective effect, specifying the top left and top right image
  7142. positions:
  7143. @example
  7144. frei0r=perspective:0.2/0.2|0.8/0.2
  7145. @end example
  7146. @end itemize
  7147. For more information, see
  7148. @url{http://frei0r.dyne.org}
  7149. @section fspp
  7150. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7151. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7152. processing filter, one of them is performed once per block, not per pixel.
  7153. This allows for much higher speed.
  7154. The filter accepts the following options:
  7155. @table @option
  7156. @item quality
  7157. Set quality. This option defines the number of levels for averaging. It accepts
  7158. an integer in the range 4-5. Default value is @code{4}.
  7159. @item qp
  7160. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7161. If not set, the filter will use the QP from the video stream (if available).
  7162. @item strength
  7163. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7164. more details but also more artifacts, while higher values make the image smoother
  7165. but also blurrier. Default value is @code{0} − PSNR optimal.
  7166. @item use_bframe_qp
  7167. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7168. option may cause flicker since the B-Frames have often larger QP. Default is
  7169. @code{0} (not enabled).
  7170. @end table
  7171. @section gblur
  7172. Apply Gaussian blur filter.
  7173. The filter accepts the following options:
  7174. @table @option
  7175. @item sigma
  7176. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7177. @item steps
  7178. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7179. @item planes
  7180. Set which planes to filter. By default all planes are filtered.
  7181. @item sigmaV
  7182. Set vertical sigma, if negative it will be same as @code{sigma}.
  7183. Default is @code{-1}.
  7184. @end table
  7185. @section geq
  7186. The filter accepts the following options:
  7187. @table @option
  7188. @item lum_expr, lum
  7189. Set the luminance expression.
  7190. @item cb_expr, cb
  7191. Set the chrominance blue expression.
  7192. @item cr_expr, cr
  7193. Set the chrominance red expression.
  7194. @item alpha_expr, a
  7195. Set the alpha expression.
  7196. @item red_expr, r
  7197. Set the red expression.
  7198. @item green_expr, g
  7199. Set the green expression.
  7200. @item blue_expr, b
  7201. Set the blue expression.
  7202. @end table
  7203. The colorspace is selected according to the specified options. If one
  7204. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7205. options is specified, the filter will automatically select a YCbCr
  7206. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7207. @option{blue_expr} options is specified, it will select an RGB
  7208. colorspace.
  7209. If one of the chrominance expression is not defined, it falls back on the other
  7210. one. If no alpha expression is specified it will evaluate to opaque value.
  7211. If none of chrominance expressions are specified, they will evaluate
  7212. to the luminance expression.
  7213. The expressions can use the following variables and functions:
  7214. @table @option
  7215. @item N
  7216. The sequential number of the filtered frame, starting from @code{0}.
  7217. @item X
  7218. @item Y
  7219. The coordinates of the current sample.
  7220. @item W
  7221. @item H
  7222. The width and height of the image.
  7223. @item SW
  7224. @item SH
  7225. Width and height scale depending on the currently filtered plane. It is the
  7226. ratio between the corresponding luma plane number of pixels and the current
  7227. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7228. @code{0.5,0.5} for chroma planes.
  7229. @item T
  7230. Time of the current frame, expressed in seconds.
  7231. @item p(x, y)
  7232. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7233. plane.
  7234. @item lum(x, y)
  7235. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7236. plane.
  7237. @item cb(x, y)
  7238. Return the value of the pixel at location (@var{x},@var{y}) of the
  7239. blue-difference chroma plane. Return 0 if there is no such plane.
  7240. @item cr(x, y)
  7241. Return the value of the pixel at location (@var{x},@var{y}) of the
  7242. red-difference chroma plane. Return 0 if there is no such plane.
  7243. @item r(x, y)
  7244. @item g(x, y)
  7245. @item b(x, y)
  7246. Return the value of the pixel at location (@var{x},@var{y}) of the
  7247. red/green/blue component. Return 0 if there is no such component.
  7248. @item alpha(x, y)
  7249. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7250. plane. Return 0 if there is no such plane.
  7251. @end table
  7252. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7253. automatically clipped to the closer edge.
  7254. @subsection Examples
  7255. @itemize
  7256. @item
  7257. Flip the image horizontally:
  7258. @example
  7259. geq=p(W-X\,Y)
  7260. @end example
  7261. @item
  7262. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7263. wavelength of 100 pixels:
  7264. @example
  7265. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7266. @end example
  7267. @item
  7268. Generate a fancy enigmatic moving light:
  7269. @example
  7270. 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
  7271. @end example
  7272. @item
  7273. Generate a quick emboss effect:
  7274. @example
  7275. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7276. @end example
  7277. @item
  7278. Modify RGB components depending on pixel position:
  7279. @example
  7280. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7281. @end example
  7282. @item
  7283. Create a radial gradient that is the same size as the input (also see
  7284. the @ref{vignette} filter):
  7285. @example
  7286. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7287. @end example
  7288. @end itemize
  7289. @section gradfun
  7290. Fix the banding artifacts that are sometimes introduced into nearly flat
  7291. regions by truncation to 8-bit color depth.
  7292. Interpolate the gradients that should go where the bands are, and
  7293. dither them.
  7294. It is designed for playback only. Do not use it prior to
  7295. lossy compression, because compression tends to lose the dither and
  7296. bring back the bands.
  7297. It accepts the following parameters:
  7298. @table @option
  7299. @item strength
  7300. The maximum amount by which the filter will change any one pixel. This is also
  7301. the threshold for detecting nearly flat regions. Acceptable values range from
  7302. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7303. valid range.
  7304. @item radius
  7305. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7306. gradients, but also prevents the filter from modifying the pixels near detailed
  7307. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7308. values will be clipped to the valid range.
  7309. @end table
  7310. Alternatively, the options can be specified as a flat string:
  7311. @var{strength}[:@var{radius}]
  7312. @subsection Examples
  7313. @itemize
  7314. @item
  7315. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7316. @example
  7317. gradfun=3.5:8
  7318. @end example
  7319. @item
  7320. Specify radius, omitting the strength (which will fall-back to the default
  7321. value):
  7322. @example
  7323. gradfun=radius=8
  7324. @end example
  7325. @end itemize
  7326. @anchor{haldclut}
  7327. @section haldclut
  7328. Apply a Hald CLUT to a video stream.
  7329. First input is the video stream to process, and second one is the Hald CLUT.
  7330. The Hald CLUT input can be a simple picture or a complete video stream.
  7331. The filter accepts the following options:
  7332. @table @option
  7333. @item shortest
  7334. Force termination when the shortest input terminates. Default is @code{0}.
  7335. @item repeatlast
  7336. Continue applying the last CLUT after the end of the stream. A value of
  7337. @code{0} disable the filter after the last frame of the CLUT is reached.
  7338. Default is @code{1}.
  7339. @end table
  7340. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7341. filters share the same internals).
  7342. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7343. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7344. @subsection Workflow examples
  7345. @subsubsection Hald CLUT video stream
  7346. Generate an identity Hald CLUT stream altered with various effects:
  7347. @example
  7348. 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
  7349. @end example
  7350. Note: make sure you use a lossless codec.
  7351. Then use it with @code{haldclut} to apply it on some random stream:
  7352. @example
  7353. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7354. @end example
  7355. The Hald CLUT will be applied to the 10 first seconds (duration of
  7356. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7357. to the remaining frames of the @code{mandelbrot} stream.
  7358. @subsubsection Hald CLUT with preview
  7359. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7360. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7361. biggest possible square starting at the top left of the picture. The remaining
  7362. padding pixels (bottom or right) will be ignored. This area can be used to add
  7363. a preview of the Hald CLUT.
  7364. Typically, the following generated Hald CLUT will be supported by the
  7365. @code{haldclut} filter:
  7366. @example
  7367. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7368. pad=iw+320 [padded_clut];
  7369. smptebars=s=320x256, split [a][b];
  7370. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7371. [main][b] overlay=W-320" -frames:v 1 clut.png
  7372. @end example
  7373. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7374. bars are displayed on the right-top, and below the same color bars processed by
  7375. the color changes.
  7376. Then, the effect of this Hald CLUT can be visualized with:
  7377. @example
  7378. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7379. @end example
  7380. @section hflip
  7381. Flip the input video horizontally.
  7382. For example, to horizontally flip the input video with @command{ffmpeg}:
  7383. @example
  7384. ffmpeg -i in.avi -vf "hflip" out.avi
  7385. @end example
  7386. @section histeq
  7387. This filter applies a global color histogram equalization on a
  7388. per-frame basis.
  7389. It can be used to correct video that has a compressed range of pixel
  7390. intensities. The filter redistributes the pixel intensities to
  7391. equalize their distribution across the intensity range. It may be
  7392. viewed as an "automatically adjusting contrast filter". This filter is
  7393. useful only for correcting degraded or poorly captured source
  7394. video.
  7395. The filter accepts the following options:
  7396. @table @option
  7397. @item strength
  7398. Determine the amount of equalization to be applied. As the strength
  7399. is reduced, the distribution of pixel intensities more-and-more
  7400. approaches that of the input frame. The value must be a float number
  7401. in the range [0,1] and defaults to 0.200.
  7402. @item intensity
  7403. Set the maximum intensity that can generated and scale the output
  7404. values appropriately. The strength should be set as desired and then
  7405. the intensity can be limited if needed to avoid washing-out. The value
  7406. must be a float number in the range [0,1] and defaults to 0.210.
  7407. @item antibanding
  7408. Set the antibanding level. If enabled the filter will randomly vary
  7409. the luminance of output pixels by a small amount to avoid banding of
  7410. the histogram. Possible values are @code{none}, @code{weak} or
  7411. @code{strong}. It defaults to @code{none}.
  7412. @end table
  7413. @section histogram
  7414. Compute and draw a color distribution histogram for the input video.
  7415. The computed histogram is a representation of the color component
  7416. distribution in an image.
  7417. Standard histogram displays the color components distribution in an image.
  7418. Displays color graph for each color component. Shows distribution of
  7419. the Y, U, V, A or R, G, B components, depending on input format, in the
  7420. current frame. Below each graph a color component scale meter is shown.
  7421. The filter accepts the following options:
  7422. @table @option
  7423. @item level_height
  7424. Set height of level. Default value is @code{200}.
  7425. Allowed range is [50, 2048].
  7426. @item scale_height
  7427. Set height of color scale. Default value is @code{12}.
  7428. Allowed range is [0, 40].
  7429. @item display_mode
  7430. Set display mode.
  7431. It accepts the following values:
  7432. @table @samp
  7433. @item stack
  7434. Per color component graphs are placed below each other.
  7435. @item parade
  7436. Per color component graphs are placed side by side.
  7437. @item overlay
  7438. Presents information identical to that in the @code{parade}, except
  7439. that the graphs representing color components are superimposed directly
  7440. over one another.
  7441. @end table
  7442. Default is @code{stack}.
  7443. @item levels_mode
  7444. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7445. Default is @code{linear}.
  7446. @item components
  7447. Set what color components to display.
  7448. Default is @code{7}.
  7449. @item fgopacity
  7450. Set foreground opacity. Default is @code{0.7}.
  7451. @item bgopacity
  7452. Set background opacity. Default is @code{0.5}.
  7453. @end table
  7454. @subsection Examples
  7455. @itemize
  7456. @item
  7457. Calculate and draw histogram:
  7458. @example
  7459. ffplay -i input -vf histogram
  7460. @end example
  7461. @end itemize
  7462. @anchor{hqdn3d}
  7463. @section hqdn3d
  7464. This is a high precision/quality 3d denoise filter. It aims to reduce
  7465. image noise, producing smooth images and making still images really
  7466. still. It should enhance compressibility.
  7467. It accepts the following optional parameters:
  7468. @table @option
  7469. @item luma_spatial
  7470. A non-negative floating point number which specifies spatial luma strength.
  7471. It defaults to 4.0.
  7472. @item chroma_spatial
  7473. A non-negative floating point number which specifies spatial chroma strength.
  7474. It defaults to 3.0*@var{luma_spatial}/4.0.
  7475. @item luma_tmp
  7476. A floating point number which specifies luma temporal strength. It defaults to
  7477. 6.0*@var{luma_spatial}/4.0.
  7478. @item chroma_tmp
  7479. A floating point number which specifies chroma temporal strength. It defaults to
  7480. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7481. @end table
  7482. @section hwdownload
  7483. Download hardware frames to system memory.
  7484. The input must be in hardware frames, and the output a non-hardware format.
  7485. Not all formats will be supported on the output - it may be necessary to insert
  7486. an additional @option{format} filter immediately following in the graph to get
  7487. the output in a supported format.
  7488. @section hwmap
  7489. Map hardware frames to system memory or to another device.
  7490. This filter has several different modes of operation; which one is used depends
  7491. on the input and output formats:
  7492. @itemize
  7493. @item
  7494. Hardware frame input, normal frame output
  7495. Map the input frames to system memory and pass them to the output. If the
  7496. original hardware frame is later required (for example, after overlaying
  7497. something else on part of it), the @option{hwmap} filter can be used again
  7498. in the next mode to retrieve it.
  7499. @item
  7500. Normal frame input, hardware frame output
  7501. If the input is actually a software-mapped hardware frame, then unmap it -
  7502. that is, return the original hardware frame.
  7503. Otherwise, a device must be provided. Create new hardware surfaces on that
  7504. device for the output, then map them back to the software format at the input
  7505. and give those frames to the preceding filter. This will then act like the
  7506. @option{hwupload} filter, but may be able to avoid an additional copy when
  7507. the input is already in a compatible format.
  7508. @item
  7509. Hardware frame input and output
  7510. A device must be supplied for the output, either directly or with the
  7511. @option{derive_device} option. The input and output devices must be of
  7512. different types and compatible - the exact meaning of this is
  7513. system-dependent, but typically it means that they must refer to the same
  7514. underlying hardware context (for example, refer to the same graphics card).
  7515. If the input frames were originally created on the output device, then unmap
  7516. to retrieve the original frames.
  7517. Otherwise, map the frames to the output device - create new hardware frames
  7518. on the output corresponding to the frames on the input.
  7519. @end itemize
  7520. The following additional parameters are accepted:
  7521. @table @option
  7522. @item mode
  7523. Set the frame mapping mode. Some combination of:
  7524. @table @var
  7525. @item read
  7526. The mapped frame should be readable.
  7527. @item write
  7528. The mapped frame should be writeable.
  7529. @item overwrite
  7530. The mapping will always overwrite the entire frame.
  7531. This may improve performance in some cases, as the original contents of the
  7532. frame need not be loaded.
  7533. @item direct
  7534. The mapping must not involve any copying.
  7535. Indirect mappings to copies of frames are created in some cases where either
  7536. direct mapping is not possible or it would have unexpected properties.
  7537. Setting this flag ensures that the mapping is direct and will fail if that is
  7538. not possible.
  7539. @end table
  7540. Defaults to @var{read+write} if not specified.
  7541. @item derive_device @var{type}
  7542. Rather than using the device supplied at initialisation, instead derive a new
  7543. device of type @var{type} from the device the input frames exist on.
  7544. @item reverse
  7545. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7546. and map them back to the source. This may be necessary in some cases where
  7547. a mapping in one direction is required but only the opposite direction is
  7548. supported by the devices being used.
  7549. This option is dangerous - it may break the preceding filter in undefined
  7550. ways if there are any additional constraints on that filter's output.
  7551. Do not use it without fully understanding the implications of its use.
  7552. @end table
  7553. @section hwupload
  7554. Upload system memory frames to hardware surfaces.
  7555. The device to upload to must be supplied when the filter is initialised. If
  7556. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7557. option.
  7558. @anchor{hwupload_cuda}
  7559. @section hwupload_cuda
  7560. Upload system memory frames to a CUDA device.
  7561. It accepts the following optional parameters:
  7562. @table @option
  7563. @item device
  7564. The number of the CUDA device to use
  7565. @end table
  7566. @section hqx
  7567. Apply a high-quality magnification filter designed for pixel art. This filter
  7568. was originally created by Maxim Stepin.
  7569. It accepts the following option:
  7570. @table @option
  7571. @item n
  7572. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7573. @code{hq3x} and @code{4} for @code{hq4x}.
  7574. Default is @code{3}.
  7575. @end table
  7576. @section hstack
  7577. Stack input videos horizontally.
  7578. All streams must be of same pixel format and of same height.
  7579. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7580. to create same output.
  7581. The filter accept the following option:
  7582. @table @option
  7583. @item inputs
  7584. Set number of input streams. Default is 2.
  7585. @item shortest
  7586. If set to 1, force the output to terminate when the shortest input
  7587. terminates. Default value is 0.
  7588. @end table
  7589. @section hue
  7590. Modify the hue and/or the saturation of the input.
  7591. It accepts the following parameters:
  7592. @table @option
  7593. @item h
  7594. Specify the hue angle as a number of degrees. It accepts an expression,
  7595. and defaults to "0".
  7596. @item s
  7597. Specify the saturation in the [-10,10] range. It accepts an expression and
  7598. defaults to "1".
  7599. @item H
  7600. Specify the hue angle as a number of radians. It accepts an
  7601. expression, and defaults to "0".
  7602. @item b
  7603. Specify the brightness in the [-10,10] range. It accepts an expression and
  7604. defaults to "0".
  7605. @end table
  7606. @option{h} and @option{H} are mutually exclusive, and can't be
  7607. specified at the same time.
  7608. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7609. expressions containing the following constants:
  7610. @table @option
  7611. @item n
  7612. frame count of the input frame starting from 0
  7613. @item pts
  7614. presentation timestamp of the input frame expressed in time base units
  7615. @item r
  7616. frame rate of the input video, NAN if the input frame rate is unknown
  7617. @item t
  7618. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7619. @item tb
  7620. time base of the input video
  7621. @end table
  7622. @subsection Examples
  7623. @itemize
  7624. @item
  7625. Set the hue to 90 degrees and the saturation to 1.0:
  7626. @example
  7627. hue=h=90:s=1
  7628. @end example
  7629. @item
  7630. Same command but expressing the hue in radians:
  7631. @example
  7632. hue=H=PI/2:s=1
  7633. @end example
  7634. @item
  7635. Rotate hue and make the saturation swing between 0
  7636. and 2 over a period of 1 second:
  7637. @example
  7638. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7639. @end example
  7640. @item
  7641. Apply a 3 seconds saturation fade-in effect starting at 0:
  7642. @example
  7643. hue="s=min(t/3\,1)"
  7644. @end example
  7645. The general fade-in expression can be written as:
  7646. @example
  7647. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7648. @end example
  7649. @item
  7650. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7651. @example
  7652. hue="s=max(0\, min(1\, (8-t)/3))"
  7653. @end example
  7654. The general fade-out expression can be written as:
  7655. @example
  7656. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7657. @end example
  7658. @end itemize
  7659. @subsection Commands
  7660. This filter supports the following commands:
  7661. @table @option
  7662. @item b
  7663. @item s
  7664. @item h
  7665. @item H
  7666. Modify the hue and/or the saturation and/or brightness of the input video.
  7667. The command accepts the same syntax of the corresponding option.
  7668. If the specified expression is not valid, it is kept at its current
  7669. value.
  7670. @end table
  7671. @section hysteresis
  7672. Grow first stream into second stream by connecting components.
  7673. This makes it possible to build more robust edge masks.
  7674. This filter accepts the following options:
  7675. @table @option
  7676. @item planes
  7677. Set which planes will be processed as bitmap, unprocessed planes will be
  7678. copied from first stream.
  7679. By default value 0xf, all planes will be processed.
  7680. @item threshold
  7681. Set threshold which is used in filtering. If pixel component value is higher than
  7682. this value filter algorithm for connecting components is activated.
  7683. By default value is 0.
  7684. @end table
  7685. @section idet
  7686. Detect video interlacing type.
  7687. This filter tries to detect if the input frames are interlaced, progressive,
  7688. top or bottom field first. It will also try to detect fields that are
  7689. repeated between adjacent frames (a sign of telecine).
  7690. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7691. Multiple frame detection incorporates the classification history of previous frames.
  7692. The filter will log these metadata values:
  7693. @table @option
  7694. @item single.current_frame
  7695. Detected type of current frame using single-frame detection. One of:
  7696. ``tff'' (top field first), ``bff'' (bottom field first),
  7697. ``progressive'', or ``undetermined''
  7698. @item single.tff
  7699. Cumulative number of frames detected as top field first using single-frame detection.
  7700. @item multiple.tff
  7701. Cumulative number of frames detected as top field first using multiple-frame detection.
  7702. @item single.bff
  7703. Cumulative number of frames detected as bottom field first using single-frame detection.
  7704. @item multiple.current_frame
  7705. Detected type of current frame using multiple-frame detection. One of:
  7706. ``tff'' (top field first), ``bff'' (bottom field first),
  7707. ``progressive'', or ``undetermined''
  7708. @item multiple.bff
  7709. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7710. @item single.progressive
  7711. Cumulative number of frames detected as progressive using single-frame detection.
  7712. @item multiple.progressive
  7713. Cumulative number of frames detected as progressive using multiple-frame detection.
  7714. @item single.undetermined
  7715. Cumulative number of frames that could not be classified using single-frame detection.
  7716. @item multiple.undetermined
  7717. Cumulative number of frames that could not be classified using multiple-frame detection.
  7718. @item repeated.current_frame
  7719. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7720. @item repeated.neither
  7721. Cumulative number of frames with no repeated field.
  7722. @item repeated.top
  7723. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7724. @item repeated.bottom
  7725. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7726. @end table
  7727. The filter accepts the following options:
  7728. @table @option
  7729. @item intl_thres
  7730. Set interlacing threshold.
  7731. @item prog_thres
  7732. Set progressive threshold.
  7733. @item rep_thres
  7734. Threshold for repeated field detection.
  7735. @item half_life
  7736. Number of frames after which a given frame's contribution to the
  7737. statistics is halved (i.e., it contributes only 0.5 to its
  7738. classification). The default of 0 means that all frames seen are given
  7739. full weight of 1.0 forever.
  7740. @item analyze_interlaced_flag
  7741. When this is not 0 then idet will use the specified number of frames to determine
  7742. if the interlaced flag is accurate, it will not count undetermined frames.
  7743. If the flag is found to be accurate it will be used without any further
  7744. computations, if it is found to be inaccurate it will be cleared without any
  7745. further computations. This allows inserting the idet filter as a low computational
  7746. method to clean up the interlaced flag
  7747. @end table
  7748. @section il
  7749. Deinterleave or interleave fields.
  7750. This filter allows one to process interlaced images fields without
  7751. deinterlacing them. Deinterleaving splits the input frame into 2
  7752. fields (so called half pictures). Odd lines are moved to the top
  7753. half of the output image, even lines to the bottom half.
  7754. You can process (filter) them independently and then re-interleave them.
  7755. The filter accepts the following options:
  7756. @table @option
  7757. @item luma_mode, l
  7758. @item chroma_mode, c
  7759. @item alpha_mode, a
  7760. Available values for @var{luma_mode}, @var{chroma_mode} and
  7761. @var{alpha_mode} are:
  7762. @table @samp
  7763. @item none
  7764. Do nothing.
  7765. @item deinterleave, d
  7766. Deinterleave fields, placing one above the other.
  7767. @item interleave, i
  7768. Interleave fields. Reverse the effect of deinterleaving.
  7769. @end table
  7770. Default value is @code{none}.
  7771. @item luma_swap, ls
  7772. @item chroma_swap, cs
  7773. @item alpha_swap, as
  7774. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7775. @end table
  7776. @section inflate
  7777. Apply inflate effect to the video.
  7778. This filter replaces the pixel by the local(3x3) average by taking into account
  7779. only values higher than the pixel.
  7780. It accepts the following options:
  7781. @table @option
  7782. @item threshold0
  7783. @item threshold1
  7784. @item threshold2
  7785. @item threshold3
  7786. Limit the maximum change for each plane, default is 65535.
  7787. If 0, plane will remain unchanged.
  7788. @end table
  7789. @section interlace
  7790. Simple interlacing filter from progressive contents. This interleaves upper (or
  7791. lower) lines from odd frames with lower (or upper) lines from even frames,
  7792. halving the frame rate and preserving image height.
  7793. @example
  7794. Original Original New Frame
  7795. Frame 'j' Frame 'j+1' (tff)
  7796. ========== =========== ==================
  7797. Line 0 --------------------> Frame 'j' Line 0
  7798. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7799. Line 2 ---------------------> Frame 'j' Line 2
  7800. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7801. ... ... ...
  7802. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7803. @end example
  7804. It accepts the following optional parameters:
  7805. @table @option
  7806. @item scan
  7807. This determines whether the interlaced frame is taken from the even
  7808. (tff - default) or odd (bff) lines of the progressive frame.
  7809. @item lowpass
  7810. Vertical lowpass filter to avoid twitter interlacing and
  7811. reduce moire patterns.
  7812. @table @samp
  7813. @item 0, off
  7814. Disable vertical lowpass filter
  7815. @item 1, linear
  7816. Enable linear filter (default)
  7817. @item 2, complex
  7818. Enable complex filter. This will slightly less reduce twitter and moire
  7819. but better retain detail and subjective sharpness impression.
  7820. @end table
  7821. @end table
  7822. @section kerndeint
  7823. Deinterlace input video by applying Donald Graft's adaptive kernel
  7824. deinterling. Work on interlaced parts of a video to produce
  7825. progressive frames.
  7826. The description of the accepted parameters follows.
  7827. @table @option
  7828. @item thresh
  7829. Set the threshold which affects the filter's tolerance when
  7830. determining if a pixel line must be processed. It must be an integer
  7831. in the range [0,255] and defaults to 10. A value of 0 will result in
  7832. applying the process on every pixels.
  7833. @item map
  7834. Paint pixels exceeding the threshold value to white if set to 1.
  7835. Default is 0.
  7836. @item order
  7837. Set the fields order. Swap fields if set to 1, leave fields alone if
  7838. 0. Default is 0.
  7839. @item sharp
  7840. Enable additional sharpening if set to 1. Default is 0.
  7841. @item twoway
  7842. Enable twoway sharpening if set to 1. Default is 0.
  7843. @end table
  7844. @subsection Examples
  7845. @itemize
  7846. @item
  7847. Apply default values:
  7848. @example
  7849. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7850. @end example
  7851. @item
  7852. Enable additional sharpening:
  7853. @example
  7854. kerndeint=sharp=1
  7855. @end example
  7856. @item
  7857. Paint processed pixels in white:
  7858. @example
  7859. kerndeint=map=1
  7860. @end example
  7861. @end itemize
  7862. @section lenscorrection
  7863. Correct radial lens distortion
  7864. This filter can be used to correct for radial distortion as can result from the use
  7865. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7866. one can use tools available for example as part of opencv or simply trial-and-error.
  7867. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7868. and extract the k1 and k2 coefficients from the resulting matrix.
  7869. Note that effectively the same filter is available in the open-source tools Krita and
  7870. Digikam from the KDE project.
  7871. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7872. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7873. brightness distribution, so you may want to use both filters together in certain
  7874. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7875. be applied before or after lens correction.
  7876. @subsection Options
  7877. The filter accepts the following options:
  7878. @table @option
  7879. @item cx
  7880. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7881. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7882. width.
  7883. @item cy
  7884. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7885. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7886. height.
  7887. @item k1
  7888. Coefficient of the quadratic correction term. 0.5 means no correction.
  7889. @item k2
  7890. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7891. @end table
  7892. The formula that generates the correction is:
  7893. @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)
  7894. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7895. distances from the focal point in the source and target images, respectively.
  7896. @section libvmaf
  7897. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7898. score between two input videos.
  7899. The obtained VMAF score is printed through the logging system.
  7900. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7901. After installing the library it can be enabled using:
  7902. @code{./configure --enable-libvmaf}.
  7903. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7904. The filter has following options:
  7905. @table @option
  7906. @item model_path
  7907. Set the model path which is to be used for SVM.
  7908. Default value: @code{"vmaf_v0.6.1.pkl"}
  7909. @item log_path
  7910. Set the file path to be used to store logs.
  7911. @item log_fmt
  7912. Set the format of the log file (xml or json).
  7913. @item enable_transform
  7914. Enables transform for computing vmaf.
  7915. @item phone_model
  7916. Invokes the phone model which will generate VMAF scores higher than in the
  7917. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7918. @item psnr
  7919. Enables computing psnr along with vmaf.
  7920. @item ssim
  7921. Enables computing ssim along with vmaf.
  7922. @item ms_ssim
  7923. Enables computing ms_ssim along with vmaf.
  7924. @item pool
  7925. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7926. @end table
  7927. This filter also supports the @ref{framesync} options.
  7928. On the below examples the input file @file{main.mpg} being processed is
  7929. compared with the reference file @file{ref.mpg}.
  7930. @example
  7931. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7932. @end example
  7933. Example with options:
  7934. @example
  7935. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7936. @end example
  7937. @section limiter
  7938. Limits the pixel components values to the specified range [min, max].
  7939. The filter accepts the following options:
  7940. @table @option
  7941. @item min
  7942. Lower bound. Defaults to the lowest allowed value for the input.
  7943. @item max
  7944. Upper bound. Defaults to the highest allowed value for the input.
  7945. @item planes
  7946. Specify which planes will be processed. Defaults to all available.
  7947. @end table
  7948. @section loop
  7949. Loop video frames.
  7950. The filter accepts the following options:
  7951. @table @option
  7952. @item loop
  7953. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7954. Default is 0.
  7955. @item size
  7956. Set maximal size in number of frames. Default is 0.
  7957. @item start
  7958. Set first frame of loop. Default is 0.
  7959. @end table
  7960. @anchor{lut3d}
  7961. @section lut3d
  7962. Apply a 3D LUT to an input video.
  7963. The filter accepts the following options:
  7964. @table @option
  7965. @item file
  7966. Set the 3D LUT file name.
  7967. Currently supported formats:
  7968. @table @samp
  7969. @item 3dl
  7970. AfterEffects
  7971. @item cube
  7972. Iridas
  7973. @item dat
  7974. DaVinci
  7975. @item m3d
  7976. Pandora
  7977. @end table
  7978. @item interp
  7979. Select interpolation mode.
  7980. Available values are:
  7981. @table @samp
  7982. @item nearest
  7983. Use values from the nearest defined point.
  7984. @item trilinear
  7985. Interpolate values using the 8 points defining a cube.
  7986. @item tetrahedral
  7987. Interpolate values using a tetrahedron.
  7988. @end table
  7989. @end table
  7990. This filter also supports the @ref{framesync} options.
  7991. @section lumakey
  7992. Turn certain luma values into transparency.
  7993. The filter accepts the following options:
  7994. @table @option
  7995. @item threshold
  7996. Set the luma which will be used as base for transparency.
  7997. Default value is @code{0}.
  7998. @item tolerance
  7999. Set the range of luma values to be keyed out.
  8000. Default value is @code{0}.
  8001. @item softness
  8002. Set the range of softness. Default value is @code{0}.
  8003. Use this to control gradual transition from zero to full transparency.
  8004. @end table
  8005. @section lut, lutrgb, lutyuv
  8006. Compute a look-up table for binding each pixel component input value
  8007. to an output value, and apply it to the input video.
  8008. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8009. to an RGB input video.
  8010. These filters accept the following parameters:
  8011. @table @option
  8012. @item c0
  8013. set first pixel component expression
  8014. @item c1
  8015. set second pixel component expression
  8016. @item c2
  8017. set third pixel component expression
  8018. @item c3
  8019. set fourth pixel component expression, corresponds to the alpha component
  8020. @item r
  8021. set red component expression
  8022. @item g
  8023. set green component expression
  8024. @item b
  8025. set blue component expression
  8026. @item a
  8027. alpha component expression
  8028. @item y
  8029. set Y/luminance component expression
  8030. @item u
  8031. set U/Cb component expression
  8032. @item v
  8033. set V/Cr component expression
  8034. @end table
  8035. Each of them specifies the expression to use for computing the lookup table for
  8036. the corresponding pixel component values.
  8037. The exact component associated to each of the @var{c*} options depends on the
  8038. format in input.
  8039. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8040. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8041. The expressions can contain the following constants and functions:
  8042. @table @option
  8043. @item w
  8044. @item h
  8045. The input width and height.
  8046. @item val
  8047. The input value for the pixel component.
  8048. @item clipval
  8049. The input value, clipped to the @var{minval}-@var{maxval} range.
  8050. @item maxval
  8051. The maximum value for the pixel component.
  8052. @item minval
  8053. The minimum value for the pixel component.
  8054. @item negval
  8055. The negated value for the pixel component value, clipped to the
  8056. @var{minval}-@var{maxval} range; it corresponds to the expression
  8057. "maxval-clipval+minval".
  8058. @item clip(val)
  8059. The computed value in @var{val}, clipped to the
  8060. @var{minval}-@var{maxval} range.
  8061. @item gammaval(gamma)
  8062. The computed gamma correction value of the pixel component value,
  8063. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8064. expression
  8065. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8066. @end table
  8067. All expressions default to "val".
  8068. @subsection Examples
  8069. @itemize
  8070. @item
  8071. Negate input video:
  8072. @example
  8073. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8074. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8075. @end example
  8076. The above is the same as:
  8077. @example
  8078. lutrgb="r=negval:g=negval:b=negval"
  8079. lutyuv="y=negval:u=negval:v=negval"
  8080. @end example
  8081. @item
  8082. Negate luminance:
  8083. @example
  8084. lutyuv=y=negval
  8085. @end example
  8086. @item
  8087. Remove chroma components, turning the video into a graytone image:
  8088. @example
  8089. lutyuv="u=128:v=128"
  8090. @end example
  8091. @item
  8092. Apply a luma burning effect:
  8093. @example
  8094. lutyuv="y=2*val"
  8095. @end example
  8096. @item
  8097. Remove green and blue components:
  8098. @example
  8099. lutrgb="g=0:b=0"
  8100. @end example
  8101. @item
  8102. Set a constant alpha channel value on input:
  8103. @example
  8104. format=rgba,lutrgb=a="maxval-minval/2"
  8105. @end example
  8106. @item
  8107. Correct luminance gamma by a factor of 0.5:
  8108. @example
  8109. lutyuv=y=gammaval(0.5)
  8110. @end example
  8111. @item
  8112. Discard least significant bits of luma:
  8113. @example
  8114. lutyuv=y='bitand(val, 128+64+32)'
  8115. @end example
  8116. @item
  8117. Technicolor like effect:
  8118. @example
  8119. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8120. @end example
  8121. @end itemize
  8122. @section lut2, tlut2
  8123. The @code{lut2} filter takes two input streams and outputs one
  8124. stream.
  8125. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8126. from one single stream.
  8127. This filter accepts the following parameters:
  8128. @table @option
  8129. @item c0
  8130. set first pixel component expression
  8131. @item c1
  8132. set second pixel component expression
  8133. @item c2
  8134. set third pixel component expression
  8135. @item c3
  8136. set fourth pixel component expression, corresponds to the alpha component
  8137. @end table
  8138. Each of them specifies the expression to use for computing the lookup table for
  8139. the corresponding pixel component values.
  8140. The exact component associated to each of the @var{c*} options depends on the
  8141. format in inputs.
  8142. The expressions can contain the following constants:
  8143. @table @option
  8144. @item w
  8145. @item h
  8146. The input width and height.
  8147. @item x
  8148. The first input value for the pixel component.
  8149. @item y
  8150. The second input value for the pixel component.
  8151. @item bdx
  8152. The first input video bit depth.
  8153. @item bdy
  8154. The second input video bit depth.
  8155. @end table
  8156. All expressions default to "x".
  8157. @subsection Examples
  8158. @itemize
  8159. @item
  8160. Highlight differences between two RGB video streams:
  8161. @example
  8162. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  8163. @end example
  8164. @item
  8165. Highlight differences between two YUV video streams:
  8166. @example
  8167. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  8168. @end example
  8169. @item
  8170. Show max difference between two video streams:
  8171. @example
  8172. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  8173. @end example
  8174. @end itemize
  8175. @section maskedclamp
  8176. Clamp the first input stream with the second input and third input stream.
  8177. Returns the value of first stream to be between second input
  8178. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8179. This filter accepts the following options:
  8180. @table @option
  8181. @item undershoot
  8182. Default value is @code{0}.
  8183. @item overshoot
  8184. Default value is @code{0}.
  8185. @item planes
  8186. Set which planes will be processed as bitmap, unprocessed planes will be
  8187. copied from first stream.
  8188. By default value 0xf, all planes will be processed.
  8189. @end table
  8190. @section maskedmerge
  8191. Merge the first input stream with the second input stream using per pixel
  8192. weights in the third input stream.
  8193. A value of 0 in the third stream pixel component means that pixel component
  8194. from first stream is returned unchanged, while maximum value (eg. 255 for
  8195. 8-bit videos) means that pixel component from second stream is returned
  8196. unchanged. Intermediate values define the amount of merging between both
  8197. input stream's pixel components.
  8198. This filter accepts the following options:
  8199. @table @option
  8200. @item planes
  8201. Set which planes will be processed as bitmap, unprocessed planes will be
  8202. copied from first stream.
  8203. By default value 0xf, all planes will be processed.
  8204. @end table
  8205. @section mcdeint
  8206. Apply motion-compensation deinterlacing.
  8207. It needs one field per frame as input and must thus be used together
  8208. with yadif=1/3 or equivalent.
  8209. This filter accepts the following options:
  8210. @table @option
  8211. @item mode
  8212. Set the deinterlacing mode.
  8213. It accepts one of the following values:
  8214. @table @samp
  8215. @item fast
  8216. @item medium
  8217. @item slow
  8218. use iterative motion estimation
  8219. @item extra_slow
  8220. like @samp{slow}, but use multiple reference frames.
  8221. @end table
  8222. Default value is @samp{fast}.
  8223. @item parity
  8224. Set the picture field parity assumed for the input video. It must be
  8225. one of the following values:
  8226. @table @samp
  8227. @item 0, tff
  8228. assume top field first
  8229. @item 1, bff
  8230. assume bottom field first
  8231. @end table
  8232. Default value is @samp{bff}.
  8233. @item qp
  8234. Set per-block quantization parameter (QP) used by the internal
  8235. encoder.
  8236. Higher values should result in a smoother motion vector field but less
  8237. optimal individual vectors. Default value is 1.
  8238. @end table
  8239. @section mergeplanes
  8240. Merge color channel components from several video streams.
  8241. The filter accepts up to 4 input streams, and merge selected input
  8242. planes to the output video.
  8243. This filter accepts the following options:
  8244. @table @option
  8245. @item mapping
  8246. Set input to output plane mapping. Default is @code{0}.
  8247. The mappings is specified as a bitmap. It should be specified as a
  8248. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8249. mapping for the first plane of the output stream. 'A' sets the number of
  8250. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8251. corresponding input to use (from 0 to 3). The rest of the mappings is
  8252. similar, 'Bb' describes the mapping for the output stream second
  8253. plane, 'Cc' describes the mapping for the output stream third plane and
  8254. 'Dd' describes the mapping for the output stream fourth plane.
  8255. @item format
  8256. Set output pixel format. Default is @code{yuva444p}.
  8257. @end table
  8258. @subsection Examples
  8259. @itemize
  8260. @item
  8261. Merge three gray video streams of same width and height into single video stream:
  8262. @example
  8263. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8264. @end example
  8265. @item
  8266. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8267. @example
  8268. [a0][a1]mergeplanes=0x00010210:yuva444p
  8269. @end example
  8270. @item
  8271. Swap Y and A plane in yuva444p stream:
  8272. @example
  8273. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8274. @end example
  8275. @item
  8276. Swap U and V plane in yuv420p stream:
  8277. @example
  8278. format=yuv420p,mergeplanes=0x000201:yuv420p
  8279. @end example
  8280. @item
  8281. Cast a rgb24 clip to yuv444p:
  8282. @example
  8283. format=rgb24,mergeplanes=0x000102:yuv444p
  8284. @end example
  8285. @end itemize
  8286. @section mestimate
  8287. Estimate and export motion vectors using block matching algorithms.
  8288. Motion vectors are stored in frame side data to be used by other filters.
  8289. This filter accepts the following options:
  8290. @table @option
  8291. @item method
  8292. Specify the motion estimation method. Accepts one of the following values:
  8293. @table @samp
  8294. @item esa
  8295. Exhaustive search algorithm.
  8296. @item tss
  8297. Three step search algorithm.
  8298. @item tdls
  8299. Two dimensional logarithmic search algorithm.
  8300. @item ntss
  8301. New three step search algorithm.
  8302. @item fss
  8303. Four step search algorithm.
  8304. @item ds
  8305. Diamond search algorithm.
  8306. @item hexbs
  8307. Hexagon-based search algorithm.
  8308. @item epzs
  8309. Enhanced predictive zonal search algorithm.
  8310. @item umh
  8311. Uneven multi-hexagon search algorithm.
  8312. @end table
  8313. Default value is @samp{esa}.
  8314. @item mb_size
  8315. Macroblock size. Default @code{16}.
  8316. @item search_param
  8317. Search parameter. Default @code{7}.
  8318. @end table
  8319. @section midequalizer
  8320. Apply Midway Image Equalization effect using two video streams.
  8321. Midway Image Equalization adjusts a pair of images to have the same
  8322. histogram, while maintaining their dynamics as much as possible. It's
  8323. useful for e.g. matching exposures from a pair of stereo cameras.
  8324. This filter has two inputs and one output, which must be of same pixel format, but
  8325. may be of different sizes. The output of filter is first input adjusted with
  8326. midway histogram of both inputs.
  8327. This filter accepts the following option:
  8328. @table @option
  8329. @item planes
  8330. Set which planes to process. Default is @code{15}, which is all available planes.
  8331. @end table
  8332. @section minterpolate
  8333. Convert the video to specified frame rate using motion interpolation.
  8334. This filter accepts the following options:
  8335. @table @option
  8336. @item fps
  8337. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  8338. @item mi_mode
  8339. Motion interpolation mode. Following values are accepted:
  8340. @table @samp
  8341. @item dup
  8342. Duplicate previous or next frame for interpolating new ones.
  8343. @item blend
  8344. Blend source frames. Interpolated frame is mean of previous and next frames.
  8345. @item mci
  8346. Motion compensated interpolation. Following options are effective when this mode is selected:
  8347. @table @samp
  8348. @item mc_mode
  8349. Motion compensation mode. Following values are accepted:
  8350. @table @samp
  8351. @item obmc
  8352. Overlapped block motion compensation.
  8353. @item aobmc
  8354. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8355. @end table
  8356. Default mode is @samp{obmc}.
  8357. @item me_mode
  8358. Motion estimation mode. Following values are accepted:
  8359. @table @samp
  8360. @item bidir
  8361. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8362. @item bilat
  8363. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8364. @end table
  8365. Default mode is @samp{bilat}.
  8366. @item me
  8367. The algorithm to be used for motion estimation. Following values are accepted:
  8368. @table @samp
  8369. @item esa
  8370. Exhaustive search algorithm.
  8371. @item tss
  8372. Three step search algorithm.
  8373. @item tdls
  8374. Two dimensional logarithmic search algorithm.
  8375. @item ntss
  8376. New three step search algorithm.
  8377. @item fss
  8378. Four step search algorithm.
  8379. @item ds
  8380. Diamond search algorithm.
  8381. @item hexbs
  8382. Hexagon-based search algorithm.
  8383. @item epzs
  8384. Enhanced predictive zonal search algorithm.
  8385. @item umh
  8386. Uneven multi-hexagon search algorithm.
  8387. @end table
  8388. Default algorithm is @samp{epzs}.
  8389. @item mb_size
  8390. Macroblock size. Default @code{16}.
  8391. @item search_param
  8392. Motion estimation search parameter. Default @code{32}.
  8393. @item vsbmc
  8394. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  8395. @end table
  8396. @end table
  8397. @item scd
  8398. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  8399. @table @samp
  8400. @item none
  8401. Disable scene change detection.
  8402. @item fdiff
  8403. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8404. @end table
  8405. Default method is @samp{fdiff}.
  8406. @item scd_threshold
  8407. Scene change detection threshold. Default is @code{5.0}.
  8408. @end table
  8409. @section mix
  8410. Mix several video input streams into one video stream.
  8411. A description of the accepted options follows.
  8412. @table @option
  8413. @item nb_inputs
  8414. The number of inputs. If unspecified, it defaults to 2.
  8415. @item weights
  8416. Specify weight of each input video stream as sequence.
  8417. Each weight is separated by space.
  8418. @item duration
  8419. Specify how end of stream is determined.
  8420. @table @samp
  8421. @item longest
  8422. The duration of the longest input. (default)
  8423. @item shortest
  8424. The duration of the shortest input.
  8425. @item first
  8426. The duration of the first input.
  8427. @end table
  8428. @end table
  8429. @section mpdecimate
  8430. Drop frames that do not differ greatly from the previous frame in
  8431. order to reduce frame rate.
  8432. The main use of this filter is for very-low-bitrate encoding
  8433. (e.g. streaming over dialup modem), but it could in theory be used for
  8434. fixing movies that were inverse-telecined incorrectly.
  8435. A description of the accepted options follows.
  8436. @table @option
  8437. @item max
  8438. Set the maximum number of consecutive frames which can be dropped (if
  8439. positive), or the minimum interval between dropped frames (if
  8440. negative). If the value is 0, the frame is dropped disregarding the
  8441. number of previous sequentially dropped frames.
  8442. Default value is 0.
  8443. @item hi
  8444. @item lo
  8445. @item frac
  8446. Set the dropping threshold values.
  8447. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8448. represent actual pixel value differences, so a threshold of 64
  8449. corresponds to 1 unit of difference for each pixel, or the same spread
  8450. out differently over the block.
  8451. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8452. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8453. meaning the whole image) differ by more than a threshold of @option{lo}.
  8454. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8455. 64*5, and default value for @option{frac} is 0.33.
  8456. @end table
  8457. @section negate
  8458. Negate input video.
  8459. It accepts an integer in input; if non-zero it negates the
  8460. alpha component (if available). The default value in input is 0.
  8461. @section nlmeans
  8462. Denoise frames using Non-Local Means algorithm.
  8463. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8464. context similarity is defined by comparing their surrounding patches of size
  8465. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8466. around the pixel.
  8467. Note that the research area defines centers for patches, which means some
  8468. patches will be made of pixels outside that research area.
  8469. The filter accepts the following options.
  8470. @table @option
  8471. @item s
  8472. Set denoising strength.
  8473. @item p
  8474. Set patch size.
  8475. @item pc
  8476. Same as @option{p} but for chroma planes.
  8477. The default value is @var{0} and means automatic.
  8478. @item r
  8479. Set research size.
  8480. @item rc
  8481. Same as @option{r} but for chroma planes.
  8482. The default value is @var{0} and means automatic.
  8483. @end table
  8484. @section nnedi
  8485. Deinterlace video using neural network edge directed interpolation.
  8486. This filter accepts the following options:
  8487. @table @option
  8488. @item weights
  8489. Mandatory option, without binary file filter can not work.
  8490. Currently file can be found here:
  8491. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8492. @item deint
  8493. Set which frames to deinterlace, by default it is @code{all}.
  8494. Can be @code{all} or @code{interlaced}.
  8495. @item field
  8496. Set mode of operation.
  8497. Can be one of the following:
  8498. @table @samp
  8499. @item af
  8500. Use frame flags, both fields.
  8501. @item a
  8502. Use frame flags, single field.
  8503. @item t
  8504. Use top field only.
  8505. @item b
  8506. Use bottom field only.
  8507. @item tf
  8508. Use both fields, top first.
  8509. @item bf
  8510. Use both fields, bottom first.
  8511. @end table
  8512. @item planes
  8513. Set which planes to process, by default filter process all frames.
  8514. @item nsize
  8515. Set size of local neighborhood around each pixel, used by the predictor neural
  8516. network.
  8517. Can be one of the following:
  8518. @table @samp
  8519. @item s8x6
  8520. @item s16x6
  8521. @item s32x6
  8522. @item s48x6
  8523. @item s8x4
  8524. @item s16x4
  8525. @item s32x4
  8526. @end table
  8527. @item nns
  8528. Set the number of neurons in predictor neural network.
  8529. Can be one of the following:
  8530. @table @samp
  8531. @item n16
  8532. @item n32
  8533. @item n64
  8534. @item n128
  8535. @item n256
  8536. @end table
  8537. @item qual
  8538. Controls the number of different neural network predictions that are blended
  8539. together to compute the final output value. Can be @code{fast}, default or
  8540. @code{slow}.
  8541. @item etype
  8542. Set which set of weights to use in the predictor.
  8543. Can be one of the following:
  8544. @table @samp
  8545. @item a
  8546. weights trained to minimize absolute error
  8547. @item s
  8548. weights trained to minimize squared error
  8549. @end table
  8550. @item pscrn
  8551. Controls whether or not the prescreener neural network is used to decide
  8552. which pixels should be processed by the predictor neural network and which
  8553. can be handled by simple cubic interpolation.
  8554. The prescreener is trained to know whether cubic interpolation will be
  8555. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8556. The computational complexity of the prescreener nn is much less than that of
  8557. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8558. using the prescreener generally results in much faster processing.
  8559. The prescreener is pretty accurate, so the difference between using it and not
  8560. using it is almost always unnoticeable.
  8561. Can be one of the following:
  8562. @table @samp
  8563. @item none
  8564. @item original
  8565. @item new
  8566. @end table
  8567. Default is @code{new}.
  8568. @item fapprox
  8569. Set various debugging flags.
  8570. @end table
  8571. @section noformat
  8572. Force libavfilter not to use any of the specified pixel formats for the
  8573. input to the next filter.
  8574. It accepts the following parameters:
  8575. @table @option
  8576. @item pix_fmts
  8577. A '|'-separated list of pixel format names, such as
  8578. pix_fmts=yuv420p|monow|rgb24".
  8579. @end table
  8580. @subsection Examples
  8581. @itemize
  8582. @item
  8583. Force libavfilter to use a format different from @var{yuv420p} for the
  8584. input to the vflip filter:
  8585. @example
  8586. noformat=pix_fmts=yuv420p,vflip
  8587. @end example
  8588. @item
  8589. Convert the input video to any of the formats not contained in the list:
  8590. @example
  8591. noformat=yuv420p|yuv444p|yuv410p
  8592. @end example
  8593. @end itemize
  8594. @section noise
  8595. Add noise on video input frame.
  8596. The filter accepts the following options:
  8597. @table @option
  8598. @item all_seed
  8599. @item c0_seed
  8600. @item c1_seed
  8601. @item c2_seed
  8602. @item c3_seed
  8603. Set noise seed for specific pixel component or all pixel components in case
  8604. of @var{all_seed}. Default value is @code{123457}.
  8605. @item all_strength, alls
  8606. @item c0_strength, c0s
  8607. @item c1_strength, c1s
  8608. @item c2_strength, c2s
  8609. @item c3_strength, c3s
  8610. Set noise strength for specific pixel component or all pixel components in case
  8611. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8612. @item all_flags, allf
  8613. @item c0_flags, c0f
  8614. @item c1_flags, c1f
  8615. @item c2_flags, c2f
  8616. @item c3_flags, c3f
  8617. Set pixel component flags or set flags for all components if @var{all_flags}.
  8618. Available values for component flags are:
  8619. @table @samp
  8620. @item a
  8621. averaged temporal noise (smoother)
  8622. @item p
  8623. mix random noise with a (semi)regular pattern
  8624. @item t
  8625. temporal noise (noise pattern changes between frames)
  8626. @item u
  8627. uniform noise (gaussian otherwise)
  8628. @end table
  8629. @end table
  8630. @subsection Examples
  8631. Add temporal and uniform noise to input video:
  8632. @example
  8633. noise=alls=20:allf=t+u
  8634. @end example
  8635. @section normalize
  8636. Normalize RGB video (aka histogram stretching, contrast stretching).
  8637. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8638. For each channel of each frame, the filter computes the input range and maps
  8639. it linearly to the user-specified output range. The output range defaults
  8640. to the full dynamic range from pure black to pure white.
  8641. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8642. changes in brightness) caused when small dark or bright objects enter or leave
  8643. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8644. video camera, and, like a video camera, it may cause a period of over- or
  8645. under-exposure of the video.
  8646. The R,G,B channels can be normalized independently, which may cause some
  8647. color shifting, or linked together as a single channel, which prevents
  8648. color shifting. Linked normalization preserves hue. Independent normalization
  8649. does not, so it can be used to remove some color casts. Independent and linked
  8650. normalization can be combined in any ratio.
  8651. The normalize filter accepts the following options:
  8652. @table @option
  8653. @item blackpt
  8654. @item whitept
  8655. Colors which define the output range. The minimum input value is mapped to
  8656. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8657. The defaults are black and white respectively. Specifying white for
  8658. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8659. normalized video. Shades of grey can be used to reduce the dynamic range
  8660. (contrast). Specifying saturated colors here can create some interesting
  8661. effects.
  8662. @item smoothing
  8663. The number of previous frames to use for temporal smoothing. The input range
  8664. of each channel is smoothed using a rolling average over the current frame
  8665. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8666. smoothing).
  8667. @item independence
  8668. Controls the ratio of independent (color shifting) channel normalization to
  8669. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8670. independent. Defaults to 1.0 (fully independent).
  8671. @item strength
  8672. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8673. expensive no-op. Defaults to 1.0 (full strength).
  8674. @end table
  8675. @subsection Examples
  8676. Stretch video contrast to use the full dynamic range, with no temporal
  8677. smoothing; may flicker depending on the source content:
  8678. @example
  8679. normalize=blackpt=black:whitept=white:smoothing=0
  8680. @end example
  8681. As above, but with 50 frames of temporal smoothing; flicker should be
  8682. reduced, depending on the source content:
  8683. @example
  8684. normalize=blackpt=black:whitept=white:smoothing=50
  8685. @end example
  8686. As above, but with hue-preserving linked channel normalization:
  8687. @example
  8688. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8689. @end example
  8690. As above, but with half strength:
  8691. @example
  8692. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8693. @end example
  8694. Map the darkest input color to red, the brightest input color to cyan:
  8695. @example
  8696. normalize=blackpt=red:whitept=cyan
  8697. @end example
  8698. @section null
  8699. Pass the video source unchanged to the output.
  8700. @section ocr
  8701. Optical Character Recognition
  8702. This filter uses Tesseract for optical character recognition.
  8703. It accepts the following options:
  8704. @table @option
  8705. @item datapath
  8706. Set datapath to tesseract data. Default is to use whatever was
  8707. set at installation.
  8708. @item language
  8709. Set language, default is "eng".
  8710. @item whitelist
  8711. Set character whitelist.
  8712. @item blacklist
  8713. Set character blacklist.
  8714. @end table
  8715. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8716. @section ocv
  8717. Apply a video transform using libopencv.
  8718. To enable this filter, install the libopencv library and headers and
  8719. configure FFmpeg with @code{--enable-libopencv}.
  8720. It accepts the following parameters:
  8721. @table @option
  8722. @item filter_name
  8723. The name of the libopencv filter to apply.
  8724. @item filter_params
  8725. The parameters to pass to the libopencv filter. If not specified, the default
  8726. values are assumed.
  8727. @end table
  8728. Refer to the official libopencv documentation for more precise
  8729. information:
  8730. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8731. Several libopencv filters are supported; see the following subsections.
  8732. @anchor{dilate}
  8733. @subsection dilate
  8734. Dilate an image by using a specific structuring element.
  8735. It corresponds to the libopencv function @code{cvDilate}.
  8736. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8737. @var{struct_el} represents a structuring element, and has the syntax:
  8738. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8739. @var{cols} and @var{rows} represent the number of columns and rows of
  8740. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8741. point, and @var{shape} the shape for the structuring element. @var{shape}
  8742. must be "rect", "cross", "ellipse", or "custom".
  8743. If the value for @var{shape} is "custom", it must be followed by a
  8744. string of the form "=@var{filename}". The file with name
  8745. @var{filename} is assumed to represent a binary image, with each
  8746. printable character corresponding to a bright pixel. When a custom
  8747. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8748. or columns and rows of the read file are assumed instead.
  8749. The default value for @var{struct_el} is "3x3+0x0/rect".
  8750. @var{nb_iterations} specifies the number of times the transform is
  8751. applied to the image, and defaults to 1.
  8752. Some examples:
  8753. @example
  8754. # Use the default values
  8755. ocv=dilate
  8756. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8757. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8758. # Read the shape from the file diamond.shape, iterating two times.
  8759. # The file diamond.shape may contain a pattern of characters like this
  8760. # *
  8761. # ***
  8762. # *****
  8763. # ***
  8764. # *
  8765. # The specified columns and rows are ignored
  8766. # but the anchor point coordinates are not
  8767. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8768. @end example
  8769. @subsection erode
  8770. Erode an image by using a specific structuring element.
  8771. It corresponds to the libopencv function @code{cvErode}.
  8772. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8773. with the same syntax and semantics as the @ref{dilate} filter.
  8774. @subsection smooth
  8775. Smooth the input video.
  8776. The filter takes the following parameters:
  8777. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8778. @var{type} is the type of smooth filter to apply, and must be one of
  8779. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8780. or "bilateral". The default value is "gaussian".
  8781. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8782. depend on the smooth type. @var{param1} and
  8783. @var{param2} accept integer positive values or 0. @var{param3} and
  8784. @var{param4} accept floating point values.
  8785. The default value for @var{param1} is 3. The default value for the
  8786. other parameters is 0.
  8787. These parameters correspond to the parameters assigned to the
  8788. libopencv function @code{cvSmooth}.
  8789. @section oscilloscope
  8790. 2D Video Oscilloscope.
  8791. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8792. It accepts the following parameters:
  8793. @table @option
  8794. @item x
  8795. Set scope center x position.
  8796. @item y
  8797. Set scope center y position.
  8798. @item s
  8799. Set scope size, relative to frame diagonal.
  8800. @item t
  8801. Set scope tilt/rotation.
  8802. @item o
  8803. Set trace opacity.
  8804. @item tx
  8805. Set trace center x position.
  8806. @item ty
  8807. Set trace center y position.
  8808. @item tw
  8809. Set trace width, relative to width of frame.
  8810. @item th
  8811. Set trace height, relative to height of frame.
  8812. @item c
  8813. Set which components to trace. By default it traces first three components.
  8814. @item g
  8815. Draw trace grid. By default is enabled.
  8816. @item st
  8817. Draw some statistics. By default is enabled.
  8818. @item sc
  8819. Draw scope. By default is enabled.
  8820. @end table
  8821. @subsection Examples
  8822. @itemize
  8823. @item
  8824. Inspect full first row of video frame.
  8825. @example
  8826. oscilloscope=x=0.5:y=0:s=1
  8827. @end example
  8828. @item
  8829. Inspect full last row of video frame.
  8830. @example
  8831. oscilloscope=x=0.5:y=1:s=1
  8832. @end example
  8833. @item
  8834. Inspect full 5th line of video frame of height 1080.
  8835. @example
  8836. oscilloscope=x=0.5:y=5/1080:s=1
  8837. @end example
  8838. @item
  8839. Inspect full last column of video frame.
  8840. @example
  8841. oscilloscope=x=1:y=0.5:s=1:t=1
  8842. @end example
  8843. @end itemize
  8844. @anchor{overlay}
  8845. @section overlay
  8846. Overlay one video on top of another.
  8847. It takes two inputs and has one output. The first input is the "main"
  8848. video on which the second input is overlaid.
  8849. It accepts the following parameters:
  8850. A description of the accepted options follows.
  8851. @table @option
  8852. @item x
  8853. @item y
  8854. Set the expression for the x and y coordinates of the overlaid video
  8855. on the main video. Default value is "0" for both expressions. In case
  8856. the expression is invalid, it is set to a huge value (meaning that the
  8857. overlay will not be displayed within the output visible area).
  8858. @item eof_action
  8859. See @ref{framesync}.
  8860. @item eval
  8861. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8862. It accepts the following values:
  8863. @table @samp
  8864. @item init
  8865. only evaluate expressions once during the filter initialization or
  8866. when a command is processed
  8867. @item frame
  8868. evaluate expressions for each incoming frame
  8869. @end table
  8870. Default value is @samp{frame}.
  8871. @item shortest
  8872. See @ref{framesync}.
  8873. @item format
  8874. Set the format for the output video.
  8875. It accepts the following values:
  8876. @table @samp
  8877. @item yuv420
  8878. force YUV420 output
  8879. @item yuv422
  8880. force YUV422 output
  8881. @item yuv444
  8882. force YUV444 output
  8883. @item rgb
  8884. force packed RGB output
  8885. @item gbrp
  8886. force planar RGB output
  8887. @item auto
  8888. automatically pick format
  8889. @end table
  8890. Default value is @samp{yuv420}.
  8891. @item repeatlast
  8892. See @ref{framesync}.
  8893. @item alpha
  8894. Set format of alpha of the overlaid video, it can be @var{straight} or
  8895. @var{premultiplied}. Default is @var{straight}.
  8896. @end table
  8897. The @option{x}, and @option{y} expressions can contain the following
  8898. parameters.
  8899. @table @option
  8900. @item main_w, W
  8901. @item main_h, H
  8902. The main input width and height.
  8903. @item overlay_w, w
  8904. @item overlay_h, h
  8905. The overlay input width and height.
  8906. @item x
  8907. @item y
  8908. The computed values for @var{x} and @var{y}. They are evaluated for
  8909. each new frame.
  8910. @item hsub
  8911. @item vsub
  8912. horizontal and vertical chroma subsample values of the output
  8913. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8914. @var{vsub} is 1.
  8915. @item n
  8916. the number of input frame, starting from 0
  8917. @item pos
  8918. the position in the file of the input frame, NAN if unknown
  8919. @item t
  8920. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8921. @end table
  8922. This filter also supports the @ref{framesync} options.
  8923. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8924. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8925. when @option{eval} is set to @samp{init}.
  8926. Be aware that frames are taken from each input video in timestamp
  8927. order, hence, if their initial timestamps differ, it is a good idea
  8928. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8929. have them begin in the same zero timestamp, as the example for
  8930. the @var{movie} filter does.
  8931. You can chain together more overlays but you should test the
  8932. efficiency of such approach.
  8933. @subsection Commands
  8934. This filter supports the following commands:
  8935. @table @option
  8936. @item x
  8937. @item y
  8938. Modify the x and y of the overlay input.
  8939. The command accepts the same syntax of the corresponding option.
  8940. If the specified expression is not valid, it is kept at its current
  8941. value.
  8942. @end table
  8943. @subsection Examples
  8944. @itemize
  8945. @item
  8946. Draw the overlay at 10 pixels from the bottom right corner of the main
  8947. video:
  8948. @example
  8949. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8950. @end example
  8951. Using named options the example above becomes:
  8952. @example
  8953. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8954. @end example
  8955. @item
  8956. Insert a transparent PNG logo in the bottom left corner of the input,
  8957. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8958. @example
  8959. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8960. @end example
  8961. @item
  8962. Insert 2 different transparent PNG logos (second logo on bottom
  8963. right corner) using the @command{ffmpeg} tool:
  8964. @example
  8965. 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
  8966. @end example
  8967. @item
  8968. Add a transparent color layer on top of the main video; @code{WxH}
  8969. must specify the size of the main input to the overlay filter:
  8970. @example
  8971. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8972. @end example
  8973. @item
  8974. Play an original video and a filtered version (here with the deshake
  8975. filter) side by side using the @command{ffplay} tool:
  8976. @example
  8977. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8978. @end example
  8979. The above command is the same as:
  8980. @example
  8981. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8982. @end example
  8983. @item
  8984. Make a sliding overlay appearing from the left to the right top part of the
  8985. screen starting since time 2:
  8986. @example
  8987. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8988. @end example
  8989. @item
  8990. Compose output by putting two input videos side to side:
  8991. @example
  8992. ffmpeg -i left.avi -i right.avi -filter_complex "
  8993. nullsrc=size=200x100 [background];
  8994. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8995. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8996. [background][left] overlay=shortest=1 [background+left];
  8997. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8998. "
  8999. @end example
  9000. @item
  9001. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9002. @example
  9003. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9004. -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]'
  9005. masked.avi
  9006. @end example
  9007. @item
  9008. Chain several overlays in cascade:
  9009. @example
  9010. nullsrc=s=200x200 [bg];
  9011. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9012. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9013. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9014. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9015. [in3] null, [mid2] overlay=100:100 [out0]
  9016. @end example
  9017. @end itemize
  9018. @section owdenoise
  9019. Apply Overcomplete Wavelet denoiser.
  9020. The filter accepts the following options:
  9021. @table @option
  9022. @item depth
  9023. Set depth.
  9024. Larger depth values will denoise lower frequency components more, but
  9025. slow down filtering.
  9026. Must be an int in the range 8-16, default is @code{8}.
  9027. @item luma_strength, ls
  9028. Set luma strength.
  9029. Must be a double value in the range 0-1000, default is @code{1.0}.
  9030. @item chroma_strength, cs
  9031. Set chroma strength.
  9032. Must be a double value in the range 0-1000, default is @code{1.0}.
  9033. @end table
  9034. @anchor{pad}
  9035. @section pad
  9036. Add paddings to the input image, and place the original input at the
  9037. provided @var{x}, @var{y} coordinates.
  9038. It accepts the following parameters:
  9039. @table @option
  9040. @item width, w
  9041. @item height, h
  9042. Specify an expression for the size of the output image with the
  9043. paddings added. If the value for @var{width} or @var{height} is 0, the
  9044. corresponding input size is used for the output.
  9045. The @var{width} expression can reference the value set by the
  9046. @var{height} expression, and vice versa.
  9047. The default value of @var{width} and @var{height} is 0.
  9048. @item x
  9049. @item y
  9050. Specify the offsets to place the input image at within the padded area,
  9051. with respect to the top/left border of the output image.
  9052. The @var{x} expression can reference the value set by the @var{y}
  9053. expression, and vice versa.
  9054. The default value of @var{x} and @var{y} is 0.
  9055. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9056. so the input image is centered on the padded area.
  9057. @item color
  9058. Specify the color of the padded area. For the syntax of this option,
  9059. check the "Color" section in the ffmpeg-utils manual.
  9060. The default value of @var{color} is "black".
  9061. @item eval
  9062. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9063. It accepts the following values:
  9064. @table @samp
  9065. @item init
  9066. Only evaluate expressions once during the filter initialization or when
  9067. a command is processed.
  9068. @item frame
  9069. Evaluate expressions for each incoming frame.
  9070. @end table
  9071. Default value is @samp{init}.
  9072. @item aspect
  9073. Pad to aspect instead to a resolution.
  9074. @end table
  9075. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9076. options are expressions containing the following constants:
  9077. @table @option
  9078. @item in_w
  9079. @item in_h
  9080. The input video width and height.
  9081. @item iw
  9082. @item ih
  9083. These are the same as @var{in_w} and @var{in_h}.
  9084. @item out_w
  9085. @item out_h
  9086. The output width and height (the size of the padded area), as
  9087. specified by the @var{width} and @var{height} expressions.
  9088. @item ow
  9089. @item oh
  9090. These are the same as @var{out_w} and @var{out_h}.
  9091. @item x
  9092. @item y
  9093. The x and y offsets as specified by the @var{x} and @var{y}
  9094. expressions, or NAN if not yet specified.
  9095. @item a
  9096. same as @var{iw} / @var{ih}
  9097. @item sar
  9098. input sample aspect ratio
  9099. @item dar
  9100. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9101. @item hsub
  9102. @item vsub
  9103. The horizontal and vertical chroma subsample values. For example for the
  9104. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9105. @end table
  9106. @subsection Examples
  9107. @itemize
  9108. @item
  9109. Add paddings with the color "violet" to the input video. The output video
  9110. size is 640x480, and the top-left corner of the input video is placed at
  9111. column 0, row 40
  9112. @example
  9113. pad=640:480:0:40:violet
  9114. @end example
  9115. The example above is equivalent to the following command:
  9116. @example
  9117. pad=width=640:height=480:x=0:y=40:color=violet
  9118. @end example
  9119. @item
  9120. Pad the input to get an output with dimensions increased by 3/2,
  9121. and put the input video at the center of the padded area:
  9122. @example
  9123. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9124. @end example
  9125. @item
  9126. Pad the input to get a squared output with size equal to the maximum
  9127. value between the input width and height, and put the input video at
  9128. the center of the padded area:
  9129. @example
  9130. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9131. @end example
  9132. @item
  9133. Pad the input to get a final w/h ratio of 16:9:
  9134. @example
  9135. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9136. @end example
  9137. @item
  9138. In case of anamorphic video, in order to set the output display aspect
  9139. correctly, it is necessary to use @var{sar} in the expression,
  9140. according to the relation:
  9141. @example
  9142. (ih * X / ih) * sar = output_dar
  9143. X = output_dar / sar
  9144. @end example
  9145. Thus the previous example needs to be modified to:
  9146. @example
  9147. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9148. @end example
  9149. @item
  9150. Double the output size and put the input video in the bottom-right
  9151. corner of the output padded area:
  9152. @example
  9153. pad="2*iw:2*ih:ow-iw:oh-ih"
  9154. @end example
  9155. @end itemize
  9156. @anchor{palettegen}
  9157. @section palettegen
  9158. Generate one palette for a whole video stream.
  9159. It accepts the following options:
  9160. @table @option
  9161. @item max_colors
  9162. Set the maximum number of colors to quantize in the palette.
  9163. Note: the palette will still contain 256 colors; the unused palette entries
  9164. will be black.
  9165. @item reserve_transparent
  9166. Create a palette of 255 colors maximum and reserve the last one for
  9167. transparency. Reserving the transparency color is useful for GIF optimization.
  9168. If not set, the maximum of colors in the palette will be 256. You probably want
  9169. to disable this option for a standalone image.
  9170. Set by default.
  9171. @item transparency_color
  9172. Set the color that will be used as background for transparency.
  9173. @item stats_mode
  9174. Set statistics mode.
  9175. It accepts the following values:
  9176. @table @samp
  9177. @item full
  9178. Compute full frame histograms.
  9179. @item diff
  9180. Compute histograms only for the part that differs from previous frame. This
  9181. might be relevant to give more importance to the moving part of your input if
  9182. the background is static.
  9183. @item single
  9184. Compute new histogram for each frame.
  9185. @end table
  9186. Default value is @var{full}.
  9187. @end table
  9188. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9189. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9190. color quantization of the palette. This information is also visible at
  9191. @var{info} logging level.
  9192. @subsection Examples
  9193. @itemize
  9194. @item
  9195. Generate a representative palette of a given video using @command{ffmpeg}:
  9196. @example
  9197. ffmpeg -i input.mkv -vf palettegen palette.png
  9198. @end example
  9199. @end itemize
  9200. @section paletteuse
  9201. Use a palette to downsample an input video stream.
  9202. The filter takes two inputs: one video stream and a palette. The palette must
  9203. be a 256 pixels image.
  9204. It accepts the following options:
  9205. @table @option
  9206. @item dither
  9207. Select dithering mode. Available algorithms are:
  9208. @table @samp
  9209. @item bayer
  9210. Ordered 8x8 bayer dithering (deterministic)
  9211. @item heckbert
  9212. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9213. Note: this dithering is sometimes considered "wrong" and is included as a
  9214. reference.
  9215. @item floyd_steinberg
  9216. Floyd and Steingberg dithering (error diffusion)
  9217. @item sierra2
  9218. Frankie Sierra dithering v2 (error diffusion)
  9219. @item sierra2_4a
  9220. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9221. @end table
  9222. Default is @var{sierra2_4a}.
  9223. @item bayer_scale
  9224. When @var{bayer} dithering is selected, this option defines the scale of the
  9225. pattern (how much the crosshatch pattern is visible). A low value means more
  9226. visible pattern for less banding, and higher value means less visible pattern
  9227. at the cost of more banding.
  9228. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9229. @item diff_mode
  9230. If set, define the zone to process
  9231. @table @samp
  9232. @item rectangle
  9233. Only the changing rectangle will be reprocessed. This is similar to GIF
  9234. cropping/offsetting compression mechanism. This option can be useful for speed
  9235. if only a part of the image is changing, and has use cases such as limiting the
  9236. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9237. moving scene (it leads to more deterministic output if the scene doesn't change
  9238. much, and as a result less moving noise and better GIF compression).
  9239. @end table
  9240. Default is @var{none}.
  9241. @item new
  9242. Take new palette for each output frame.
  9243. @item alpha_threshold
  9244. Sets the alpha threshold for transparency. Alpha values above this threshold
  9245. will be treated as completely opaque, and values below this threshold will be
  9246. treated as completely transparent.
  9247. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9248. @end table
  9249. @subsection Examples
  9250. @itemize
  9251. @item
  9252. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9253. using @command{ffmpeg}:
  9254. @example
  9255. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9256. @end example
  9257. @end itemize
  9258. @section perspective
  9259. Correct perspective of video not recorded perpendicular to the screen.
  9260. A description of the accepted parameters follows.
  9261. @table @option
  9262. @item x0
  9263. @item y0
  9264. @item x1
  9265. @item y1
  9266. @item x2
  9267. @item y2
  9268. @item x3
  9269. @item y3
  9270. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9271. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9272. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9273. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9274. then the corners of the source will be sent to the specified coordinates.
  9275. The expressions can use the following variables:
  9276. @table @option
  9277. @item W
  9278. @item H
  9279. the width and height of video frame.
  9280. @item in
  9281. Input frame count.
  9282. @item on
  9283. Output frame count.
  9284. @end table
  9285. @item interpolation
  9286. Set interpolation for perspective correction.
  9287. It accepts the following values:
  9288. @table @samp
  9289. @item linear
  9290. @item cubic
  9291. @end table
  9292. Default value is @samp{linear}.
  9293. @item sense
  9294. Set interpretation of coordinate options.
  9295. It accepts the following values:
  9296. @table @samp
  9297. @item 0, source
  9298. Send point in the source specified by the given coordinates to
  9299. the corners of the destination.
  9300. @item 1, destination
  9301. Send the corners of the source to the point in the destination specified
  9302. by the given coordinates.
  9303. Default value is @samp{source}.
  9304. @end table
  9305. @item eval
  9306. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9307. It accepts the following values:
  9308. @table @samp
  9309. @item init
  9310. only evaluate expressions once during the filter initialization or
  9311. when a command is processed
  9312. @item frame
  9313. evaluate expressions for each incoming frame
  9314. @end table
  9315. Default value is @samp{init}.
  9316. @end table
  9317. @section phase
  9318. Delay interlaced video by one field time so that the field order changes.
  9319. The intended use is to fix PAL movies that have been captured with the
  9320. opposite field order to the film-to-video transfer.
  9321. A description of the accepted parameters follows.
  9322. @table @option
  9323. @item mode
  9324. Set phase mode.
  9325. It accepts the following values:
  9326. @table @samp
  9327. @item t
  9328. Capture field order top-first, transfer bottom-first.
  9329. Filter will delay the bottom field.
  9330. @item b
  9331. Capture field order bottom-first, transfer top-first.
  9332. Filter will delay the top field.
  9333. @item p
  9334. Capture and transfer with the same field order. This mode only exists
  9335. for the documentation of the other options to refer to, but if you
  9336. actually select it, the filter will faithfully do nothing.
  9337. @item a
  9338. Capture field order determined automatically by field flags, transfer
  9339. opposite.
  9340. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9341. basis using field flags. If no field information is available,
  9342. then this works just like @samp{u}.
  9343. @item u
  9344. Capture unknown or varying, transfer opposite.
  9345. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9346. analyzing the images and selecting the alternative that produces best
  9347. match between the fields.
  9348. @item T
  9349. Capture top-first, transfer unknown or varying.
  9350. Filter selects among @samp{t} and @samp{p} using image analysis.
  9351. @item B
  9352. Capture bottom-first, transfer unknown or varying.
  9353. Filter selects among @samp{b} and @samp{p} using image analysis.
  9354. @item A
  9355. Capture determined by field flags, transfer unknown or varying.
  9356. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9357. image analysis. If no field information is available, then this works just
  9358. like @samp{U}. This is the default mode.
  9359. @item U
  9360. Both capture and transfer unknown or varying.
  9361. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9362. @end table
  9363. @end table
  9364. @section pixdesctest
  9365. Pixel format descriptor test filter, mainly useful for internal
  9366. testing. The output video should be equal to the input video.
  9367. For example:
  9368. @example
  9369. format=monow, pixdesctest
  9370. @end example
  9371. can be used to test the monowhite pixel format descriptor definition.
  9372. @section pixscope
  9373. Display sample values of color channels. Mainly useful for checking color
  9374. and levels. Minimum supported resolution is 640x480.
  9375. The filters accept the following options:
  9376. @table @option
  9377. @item x
  9378. Set scope X position, relative offset on X axis.
  9379. @item y
  9380. Set scope Y position, relative offset on Y axis.
  9381. @item w
  9382. Set scope width.
  9383. @item h
  9384. Set scope height.
  9385. @item o
  9386. Set window opacity. This window also holds statistics about pixel area.
  9387. @item wx
  9388. Set window X position, relative offset on X axis.
  9389. @item wy
  9390. Set window Y position, relative offset on Y axis.
  9391. @end table
  9392. @section pp
  9393. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9394. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9395. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9396. Each subfilter and some options have a short and a long name that can be used
  9397. interchangeably, i.e. dr/dering are the same.
  9398. The filters accept the following options:
  9399. @table @option
  9400. @item subfilters
  9401. Set postprocessing subfilters string.
  9402. @end table
  9403. All subfilters share common options to determine their scope:
  9404. @table @option
  9405. @item a/autoq
  9406. Honor the quality commands for this subfilter.
  9407. @item c/chrom
  9408. Do chrominance filtering, too (default).
  9409. @item y/nochrom
  9410. Do luminance filtering only (no chrominance).
  9411. @item n/noluma
  9412. Do chrominance filtering only (no luminance).
  9413. @end table
  9414. These options can be appended after the subfilter name, separated by a '|'.
  9415. Available subfilters are:
  9416. @table @option
  9417. @item hb/hdeblock[|difference[|flatness]]
  9418. Horizontal deblocking filter
  9419. @table @option
  9420. @item difference
  9421. Difference factor where higher values mean more deblocking (default: @code{32}).
  9422. @item flatness
  9423. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9424. @end table
  9425. @item vb/vdeblock[|difference[|flatness]]
  9426. Vertical deblocking filter
  9427. @table @option
  9428. @item difference
  9429. Difference factor where higher values mean more deblocking (default: @code{32}).
  9430. @item flatness
  9431. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9432. @end table
  9433. @item ha/hadeblock[|difference[|flatness]]
  9434. Accurate horizontal deblocking filter
  9435. @table @option
  9436. @item difference
  9437. Difference factor where higher values mean more deblocking (default: @code{32}).
  9438. @item flatness
  9439. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9440. @end table
  9441. @item va/vadeblock[|difference[|flatness]]
  9442. Accurate vertical deblocking filter
  9443. @table @option
  9444. @item difference
  9445. Difference factor where higher values mean more deblocking (default: @code{32}).
  9446. @item flatness
  9447. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9448. @end table
  9449. @end table
  9450. The horizontal and vertical deblocking filters share the difference and
  9451. flatness values so you cannot set different horizontal and vertical
  9452. thresholds.
  9453. @table @option
  9454. @item h1/x1hdeblock
  9455. Experimental horizontal deblocking filter
  9456. @item v1/x1vdeblock
  9457. Experimental vertical deblocking filter
  9458. @item dr/dering
  9459. Deringing filter
  9460. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9461. @table @option
  9462. @item threshold1
  9463. larger -> stronger filtering
  9464. @item threshold2
  9465. larger -> stronger filtering
  9466. @item threshold3
  9467. larger -> stronger filtering
  9468. @end table
  9469. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9470. @table @option
  9471. @item f/fullyrange
  9472. Stretch luminance to @code{0-255}.
  9473. @end table
  9474. @item lb/linblenddeint
  9475. Linear blend deinterlacing filter that deinterlaces the given block by
  9476. filtering all lines with a @code{(1 2 1)} filter.
  9477. @item li/linipoldeint
  9478. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9479. linearly interpolating every second line.
  9480. @item ci/cubicipoldeint
  9481. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9482. cubically interpolating every second line.
  9483. @item md/mediandeint
  9484. Median deinterlacing filter that deinterlaces the given block by applying a
  9485. median filter to every second line.
  9486. @item fd/ffmpegdeint
  9487. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9488. second line with a @code{(-1 4 2 4 -1)} filter.
  9489. @item l5/lowpass5
  9490. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9491. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9492. @item fq/forceQuant[|quantizer]
  9493. Overrides the quantizer table from the input with the constant quantizer you
  9494. specify.
  9495. @table @option
  9496. @item quantizer
  9497. Quantizer to use
  9498. @end table
  9499. @item de/default
  9500. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9501. @item fa/fast
  9502. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9503. @item ac
  9504. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9505. @end table
  9506. @subsection Examples
  9507. @itemize
  9508. @item
  9509. Apply horizontal and vertical deblocking, deringing and automatic
  9510. brightness/contrast:
  9511. @example
  9512. pp=hb/vb/dr/al
  9513. @end example
  9514. @item
  9515. Apply default filters without brightness/contrast correction:
  9516. @example
  9517. pp=de/-al
  9518. @end example
  9519. @item
  9520. Apply default filters and temporal denoiser:
  9521. @example
  9522. pp=default/tmpnoise|1|2|3
  9523. @end example
  9524. @item
  9525. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9526. automatically depending on available CPU time:
  9527. @example
  9528. pp=hb|y/vb|a
  9529. @end example
  9530. @end itemize
  9531. @section pp7
  9532. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9533. similar to spp = 6 with 7 point DCT, where only the center sample is
  9534. used after IDCT.
  9535. The filter accepts the following options:
  9536. @table @option
  9537. @item qp
  9538. Force a constant quantization parameter. It accepts an integer in range
  9539. 0 to 63. If not set, the filter will use the QP from the video stream
  9540. (if available).
  9541. @item mode
  9542. Set thresholding mode. Available modes are:
  9543. @table @samp
  9544. @item hard
  9545. Set hard thresholding.
  9546. @item soft
  9547. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9548. @item medium
  9549. Set medium thresholding (good results, default).
  9550. @end table
  9551. @end table
  9552. @section premultiply
  9553. Apply alpha premultiply effect to input video stream using first plane
  9554. of second stream as alpha.
  9555. Both streams must have same dimensions and same pixel format.
  9556. The filter accepts the following option:
  9557. @table @option
  9558. @item planes
  9559. Set which planes will be processed, unprocessed planes will be copied.
  9560. By default value 0xf, all planes will be processed.
  9561. @item inplace
  9562. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9563. @end table
  9564. @section prewitt
  9565. Apply prewitt operator to input video stream.
  9566. The filter accepts the following option:
  9567. @table @option
  9568. @item planes
  9569. Set which planes will be processed, unprocessed planes will be copied.
  9570. By default value 0xf, all planes will be processed.
  9571. @item scale
  9572. Set value which will be multiplied with filtered result.
  9573. @item delta
  9574. Set value which will be added to filtered result.
  9575. @end table
  9576. @section pseudocolor
  9577. Alter frame colors in video with pseudocolors.
  9578. This filter accept the following options:
  9579. @table @option
  9580. @item c0
  9581. set pixel first component expression
  9582. @item c1
  9583. set pixel second component expression
  9584. @item c2
  9585. set pixel third component expression
  9586. @item c3
  9587. set pixel fourth component expression, corresponds to the alpha component
  9588. @item i
  9589. set component to use as base for altering colors
  9590. @end table
  9591. Each of them specifies the expression to use for computing the lookup table for
  9592. the corresponding pixel component values.
  9593. The expressions can contain the following constants and functions:
  9594. @table @option
  9595. @item w
  9596. @item h
  9597. The input width and height.
  9598. @item val
  9599. The input value for the pixel component.
  9600. @item ymin, umin, vmin, amin
  9601. The minimum allowed component value.
  9602. @item ymax, umax, vmax, amax
  9603. The maximum allowed component value.
  9604. @end table
  9605. All expressions default to "val".
  9606. @subsection Examples
  9607. @itemize
  9608. @item
  9609. Change too high luma values to gradient:
  9610. @example
  9611. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  9612. @end example
  9613. @end itemize
  9614. @section psnr
  9615. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9616. Ratio) between two input videos.
  9617. This filter takes in input two input videos, the first input is
  9618. considered the "main" source and is passed unchanged to the
  9619. output. The second input is used as a "reference" video for computing
  9620. the PSNR.
  9621. Both video inputs must have the same resolution and pixel format for
  9622. this filter to work correctly. Also it assumes that both inputs
  9623. have the same number of frames, which are compared one by one.
  9624. The obtained average PSNR is printed through the logging system.
  9625. The filter stores the accumulated MSE (mean squared error) of each
  9626. frame, and at the end of the processing it is averaged across all frames
  9627. equally, and the following formula is applied to obtain the PSNR:
  9628. @example
  9629. PSNR = 10*log10(MAX^2/MSE)
  9630. @end example
  9631. Where MAX is the average of the maximum values of each component of the
  9632. image.
  9633. The description of the accepted parameters follows.
  9634. @table @option
  9635. @item stats_file, f
  9636. If specified the filter will use the named file to save the PSNR of
  9637. each individual frame. When filename equals "-" the data is sent to
  9638. standard output.
  9639. @item stats_version
  9640. Specifies which version of the stats file format to use. Details of
  9641. each format are written below.
  9642. Default value is 1.
  9643. @item stats_add_max
  9644. Determines whether the max value is output to the stats log.
  9645. Default value is 0.
  9646. Requires stats_version >= 2. If this is set and stats_version < 2,
  9647. the filter will return an error.
  9648. @end table
  9649. This filter also supports the @ref{framesync} options.
  9650. The file printed if @var{stats_file} is selected, contains a sequence of
  9651. key/value pairs of the form @var{key}:@var{value} for each compared
  9652. couple of frames.
  9653. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9654. the list of per-frame-pair stats, with key value pairs following the frame
  9655. format with the following parameters:
  9656. @table @option
  9657. @item psnr_log_version
  9658. The version of the log file format. Will match @var{stats_version}.
  9659. @item fields
  9660. A comma separated list of the per-frame-pair parameters included in
  9661. the log.
  9662. @end table
  9663. A description of each shown per-frame-pair parameter follows:
  9664. @table @option
  9665. @item n
  9666. sequential number of the input frame, starting from 1
  9667. @item mse_avg
  9668. Mean Square Error pixel-by-pixel average difference of the compared
  9669. frames, averaged over all the image components.
  9670. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9671. Mean Square Error pixel-by-pixel average difference of the compared
  9672. frames for the component specified by the suffix.
  9673. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9674. Peak Signal to Noise ratio of the compared frames for the component
  9675. specified by the suffix.
  9676. @item max_avg, max_y, max_u, max_v
  9677. Maximum allowed value for each channel, and average over all
  9678. channels.
  9679. @end table
  9680. For example:
  9681. @example
  9682. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9683. [main][ref] psnr="stats_file=stats.log" [out]
  9684. @end example
  9685. On this example the input file being processed is compared with the
  9686. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9687. is stored in @file{stats.log}.
  9688. @anchor{pullup}
  9689. @section pullup
  9690. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9691. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9692. content.
  9693. The pullup filter is designed to take advantage of future context in making
  9694. its decisions. This filter is stateless in the sense that it does not lock
  9695. onto a pattern to follow, but it instead looks forward to the following
  9696. fields in order to identify matches and rebuild progressive frames.
  9697. To produce content with an even framerate, insert the fps filter after
  9698. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9699. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9700. The filter accepts the following options:
  9701. @table @option
  9702. @item jl
  9703. @item jr
  9704. @item jt
  9705. @item jb
  9706. These options set the amount of "junk" to ignore at the left, right, top, and
  9707. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9708. while top and bottom are in units of 2 lines.
  9709. The default is 8 pixels on each side.
  9710. @item sb
  9711. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9712. filter generating an occasional mismatched frame, but it may also cause an
  9713. excessive number of frames to be dropped during high motion sequences.
  9714. Conversely, setting it to -1 will make filter match fields more easily.
  9715. This may help processing of video where there is slight blurring between
  9716. the fields, but may also cause there to be interlaced frames in the output.
  9717. Default value is @code{0}.
  9718. @item mp
  9719. Set the metric plane to use. It accepts the following values:
  9720. @table @samp
  9721. @item l
  9722. Use luma plane.
  9723. @item u
  9724. Use chroma blue plane.
  9725. @item v
  9726. Use chroma red plane.
  9727. @end table
  9728. This option may be set to use chroma plane instead of the default luma plane
  9729. for doing filter's computations. This may improve accuracy on very clean
  9730. source material, but more likely will decrease accuracy, especially if there
  9731. is chroma noise (rainbow effect) or any grayscale video.
  9732. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9733. load and make pullup usable in realtime on slow machines.
  9734. @end table
  9735. For best results (without duplicated frames in the output file) it is
  9736. necessary to change the output frame rate. For example, to inverse
  9737. telecine NTSC input:
  9738. @example
  9739. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9740. @end example
  9741. @section qp
  9742. Change video quantization parameters (QP).
  9743. The filter accepts the following option:
  9744. @table @option
  9745. @item qp
  9746. Set expression for quantization parameter.
  9747. @end table
  9748. The expression is evaluated through the eval API and can contain, among others,
  9749. the following constants:
  9750. @table @var
  9751. @item known
  9752. 1 if index is not 129, 0 otherwise.
  9753. @item qp
  9754. Sequential index starting from -129 to 128.
  9755. @end table
  9756. @subsection Examples
  9757. @itemize
  9758. @item
  9759. Some equation like:
  9760. @example
  9761. qp=2+2*sin(PI*qp)
  9762. @end example
  9763. @end itemize
  9764. @section random
  9765. Flush video frames from internal cache of frames into a random order.
  9766. No frame is discarded.
  9767. Inspired by @ref{frei0r} nervous filter.
  9768. @table @option
  9769. @item frames
  9770. Set size in number of frames of internal cache, in range from @code{2} to
  9771. @code{512}. Default is @code{30}.
  9772. @item seed
  9773. Set seed for random number generator, must be an integer included between
  9774. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9775. less than @code{0}, the filter will try to use a good random seed on a
  9776. best effort basis.
  9777. @end table
  9778. @section readeia608
  9779. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9780. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9781. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9782. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9783. @table @option
  9784. @item lavfi.readeia608.X.cc
  9785. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9786. @item lavfi.readeia608.X.line
  9787. The number of the line on which the EIA-608 data was identified and read.
  9788. @end table
  9789. This filter accepts the following options:
  9790. @table @option
  9791. @item scan_min
  9792. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9793. @item scan_max
  9794. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9795. @item mac
  9796. Set minimal acceptable amplitude change for sync codes detection.
  9797. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9798. @item spw
  9799. Set the ratio of width reserved for sync code detection.
  9800. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9801. @item mhd
  9802. Set the max peaks height difference for sync code detection.
  9803. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9804. @item mpd
  9805. Set max peaks period difference for sync code detection.
  9806. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9807. @item msd
  9808. Set the first two max start code bits differences.
  9809. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9810. @item bhd
  9811. Set the minimum ratio of bits height compared to 3rd start code bit.
  9812. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9813. @item th_w
  9814. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9815. @item th_b
  9816. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9817. @item chp
  9818. Enable checking the parity bit. In the event of a parity error, the filter will output
  9819. @code{0x00} for that character. Default is false.
  9820. @end table
  9821. @subsection Examples
  9822. @itemize
  9823. @item
  9824. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9825. @example
  9826. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  9827. @end example
  9828. @end itemize
  9829. @section readvitc
  9830. Read vertical interval timecode (VITC) information from the top lines of a
  9831. video frame.
  9832. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9833. timecode value, if a valid timecode has been detected. Further metadata key
  9834. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9835. timecode data has been found or not.
  9836. This filter accepts the following options:
  9837. @table @option
  9838. @item scan_max
  9839. Set the maximum number of lines to scan for VITC data. If the value is set to
  9840. @code{-1} the full video frame is scanned. Default is @code{45}.
  9841. @item thr_b
  9842. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9843. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9844. @item thr_w
  9845. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9846. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9847. @end table
  9848. @subsection Examples
  9849. @itemize
  9850. @item
  9851. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9852. draw @code{--:--:--:--} as a placeholder:
  9853. @example
  9854. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9855. @end example
  9856. @end itemize
  9857. @section remap
  9858. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9859. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9860. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9861. value for pixel will be used for destination pixel.
  9862. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9863. will have Xmap/Ymap video stream dimensions.
  9864. Xmap and Ymap input video streams are 16bit depth, single channel.
  9865. @section removegrain
  9866. The removegrain filter is a spatial denoiser for progressive video.
  9867. @table @option
  9868. @item m0
  9869. Set mode for the first plane.
  9870. @item m1
  9871. Set mode for the second plane.
  9872. @item m2
  9873. Set mode for the third plane.
  9874. @item m3
  9875. Set mode for the fourth plane.
  9876. @end table
  9877. Range of mode is from 0 to 24. Description of each mode follows:
  9878. @table @var
  9879. @item 0
  9880. Leave input plane unchanged. Default.
  9881. @item 1
  9882. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9883. @item 2
  9884. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9885. @item 3
  9886. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9887. @item 4
  9888. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9889. This is equivalent to a median filter.
  9890. @item 5
  9891. Line-sensitive clipping giving the minimal change.
  9892. @item 6
  9893. Line-sensitive clipping, intermediate.
  9894. @item 7
  9895. Line-sensitive clipping, intermediate.
  9896. @item 8
  9897. Line-sensitive clipping, intermediate.
  9898. @item 9
  9899. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9900. @item 10
  9901. Replaces the target pixel with the closest neighbour.
  9902. @item 11
  9903. [1 2 1] horizontal and vertical kernel blur.
  9904. @item 12
  9905. Same as mode 11.
  9906. @item 13
  9907. Bob mode, interpolates top field from the line where the neighbours
  9908. pixels are the closest.
  9909. @item 14
  9910. Bob mode, interpolates bottom field from the line where the neighbours
  9911. pixels are the closest.
  9912. @item 15
  9913. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9914. interpolation formula.
  9915. @item 16
  9916. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9917. interpolation formula.
  9918. @item 17
  9919. Clips the pixel with the minimum and maximum of respectively the maximum and
  9920. minimum of each pair of opposite neighbour pixels.
  9921. @item 18
  9922. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9923. the current pixel is minimal.
  9924. @item 19
  9925. Replaces the pixel with the average of its 8 neighbours.
  9926. @item 20
  9927. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9928. @item 21
  9929. Clips pixels using the averages of opposite neighbour.
  9930. @item 22
  9931. Same as mode 21 but simpler and faster.
  9932. @item 23
  9933. Small edge and halo removal, but reputed useless.
  9934. @item 24
  9935. Similar as 23.
  9936. @end table
  9937. @section removelogo
  9938. Suppress a TV station logo, using an image file to determine which
  9939. pixels comprise the logo. It works by filling in the pixels that
  9940. comprise the logo with neighboring pixels.
  9941. The filter accepts the following options:
  9942. @table @option
  9943. @item filename, f
  9944. Set the filter bitmap file, which can be any image format supported by
  9945. libavformat. The width and height of the image file must match those of the
  9946. video stream being processed.
  9947. @end table
  9948. Pixels in the provided bitmap image with a value of zero are not
  9949. considered part of the logo, non-zero pixels are considered part of
  9950. the logo. If you use white (255) for the logo and black (0) for the
  9951. rest, you will be safe. For making the filter bitmap, it is
  9952. recommended to take a screen capture of a black frame with the logo
  9953. visible, and then using a threshold filter followed by the erode
  9954. filter once or twice.
  9955. If needed, little splotches can be fixed manually. Remember that if
  9956. logo pixels are not covered, the filter quality will be much
  9957. reduced. Marking too many pixels as part of the logo does not hurt as
  9958. much, but it will increase the amount of blurring needed to cover over
  9959. the image and will destroy more information than necessary, and extra
  9960. pixels will slow things down on a large logo.
  9961. @section repeatfields
  9962. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9963. fields based on its value.
  9964. @section reverse
  9965. Reverse a video clip.
  9966. Warning: This filter requires memory to buffer the entire clip, so trimming
  9967. is suggested.
  9968. @subsection Examples
  9969. @itemize
  9970. @item
  9971. Take the first 5 seconds of a clip, and reverse it.
  9972. @example
  9973. trim=end=5,reverse
  9974. @end example
  9975. @end itemize
  9976. @section roberts
  9977. Apply roberts cross operator to input video stream.
  9978. The filter accepts the following option:
  9979. @table @option
  9980. @item planes
  9981. Set which planes will be processed, unprocessed planes will be copied.
  9982. By default value 0xf, all planes will be processed.
  9983. @item scale
  9984. Set value which will be multiplied with filtered result.
  9985. @item delta
  9986. Set value which will be added to filtered result.
  9987. @end table
  9988. @section rotate
  9989. Rotate video by an arbitrary angle expressed in radians.
  9990. The filter accepts the following options:
  9991. A description of the optional parameters follows.
  9992. @table @option
  9993. @item angle, a
  9994. Set an expression for the angle by which to rotate the input video
  9995. clockwise, expressed as a number of radians. A negative value will
  9996. result in a counter-clockwise rotation. By default it is set to "0".
  9997. This expression is evaluated for each frame.
  9998. @item out_w, ow
  9999. Set the output width expression, default value is "iw".
  10000. This expression is evaluated just once during configuration.
  10001. @item out_h, oh
  10002. Set the output height expression, default value is "ih".
  10003. This expression is evaluated just once during configuration.
  10004. @item bilinear
  10005. Enable bilinear interpolation if set to 1, a value of 0 disables
  10006. it. Default value is 1.
  10007. @item fillcolor, c
  10008. Set the color used to fill the output area not covered by the rotated
  10009. image. For the general syntax of this option, check the "Color" section in the
  10010. ffmpeg-utils manual. If the special value "none" is selected then no
  10011. background is printed (useful for example if the background is never shown).
  10012. Default value is "black".
  10013. @end table
  10014. The expressions for the angle and the output size can contain the
  10015. following constants and functions:
  10016. @table @option
  10017. @item n
  10018. sequential number of the input frame, starting from 0. It is always NAN
  10019. before the first frame is filtered.
  10020. @item t
  10021. time in seconds of the input frame, it is set to 0 when the filter is
  10022. configured. It is always NAN before the first frame is filtered.
  10023. @item hsub
  10024. @item vsub
  10025. horizontal and vertical chroma subsample values. For example for the
  10026. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10027. @item in_w, iw
  10028. @item in_h, ih
  10029. the input video width and height
  10030. @item out_w, ow
  10031. @item out_h, oh
  10032. the output width and height, that is the size of the padded area as
  10033. specified by the @var{width} and @var{height} expressions
  10034. @item rotw(a)
  10035. @item roth(a)
  10036. the minimal width/height required for completely containing the input
  10037. video rotated by @var{a} radians.
  10038. These are only available when computing the @option{out_w} and
  10039. @option{out_h} expressions.
  10040. @end table
  10041. @subsection Examples
  10042. @itemize
  10043. @item
  10044. Rotate the input by PI/6 radians clockwise:
  10045. @example
  10046. rotate=PI/6
  10047. @end example
  10048. @item
  10049. Rotate the input by PI/6 radians counter-clockwise:
  10050. @example
  10051. rotate=-PI/6
  10052. @end example
  10053. @item
  10054. Rotate the input by 45 degrees clockwise:
  10055. @example
  10056. rotate=45*PI/180
  10057. @end example
  10058. @item
  10059. Apply a constant rotation with period T, starting from an angle of PI/3:
  10060. @example
  10061. rotate=PI/3+2*PI*t/T
  10062. @end example
  10063. @item
  10064. Make the input video rotation oscillating with a period of T
  10065. seconds and an amplitude of A radians:
  10066. @example
  10067. rotate=A*sin(2*PI/T*t)
  10068. @end example
  10069. @item
  10070. Rotate the video, output size is chosen so that the whole rotating
  10071. input video is always completely contained in the output:
  10072. @example
  10073. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10074. @end example
  10075. @item
  10076. Rotate the video, reduce the output size so that no background is ever
  10077. shown:
  10078. @example
  10079. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10080. @end example
  10081. @end itemize
  10082. @subsection Commands
  10083. The filter supports the following commands:
  10084. @table @option
  10085. @item a, angle
  10086. Set the angle expression.
  10087. The command accepts the same syntax of the corresponding option.
  10088. If the specified expression is not valid, it is kept at its current
  10089. value.
  10090. @end table
  10091. @section sab
  10092. Apply Shape Adaptive Blur.
  10093. The filter accepts the following options:
  10094. @table @option
  10095. @item luma_radius, lr
  10096. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10097. value is 1.0. A greater value will result in a more blurred image, and
  10098. in slower processing.
  10099. @item luma_pre_filter_radius, lpfr
  10100. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10101. value is 1.0.
  10102. @item luma_strength, ls
  10103. Set luma maximum difference between pixels to still be considered, must
  10104. be a value in the 0.1-100.0 range, default value is 1.0.
  10105. @item chroma_radius, cr
  10106. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10107. greater value will result in a more blurred image, and in slower
  10108. processing.
  10109. @item chroma_pre_filter_radius, cpfr
  10110. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10111. @item chroma_strength, cs
  10112. Set chroma maximum difference between pixels to still be considered,
  10113. must be a value in the -0.9-100.0 range.
  10114. @end table
  10115. Each chroma option value, if not explicitly specified, is set to the
  10116. corresponding luma option value.
  10117. @anchor{scale}
  10118. @section scale
  10119. Scale (resize) the input video, using the libswscale library.
  10120. The scale filter forces the output display aspect ratio to be the same
  10121. of the input, by changing the output sample aspect ratio.
  10122. If the input image format is different from the format requested by
  10123. the next filter, the scale filter will convert the input to the
  10124. requested format.
  10125. @subsection Options
  10126. The filter accepts the following options, or any of the options
  10127. supported by the libswscale scaler.
  10128. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10129. the complete list of scaler options.
  10130. @table @option
  10131. @item width, w
  10132. @item height, h
  10133. Set the output video dimension expression. Default value is the input
  10134. dimension.
  10135. If the @var{width} or @var{w} value is 0, the input width is used for
  10136. the output. If the @var{height} or @var{h} value is 0, the input height
  10137. is used for the output.
  10138. If one and only one of the values is -n with n >= 1, the scale filter
  10139. will use a value that maintains the aspect ratio of the input image,
  10140. calculated from the other specified dimension. After that it will,
  10141. however, make sure that the calculated dimension is divisible by n and
  10142. adjust the value if necessary.
  10143. If both values are -n with n >= 1, the behavior will be identical to
  10144. both values being set to 0 as previously detailed.
  10145. See below for the list of accepted constants for use in the dimension
  10146. expression.
  10147. @item eval
  10148. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10149. @table @samp
  10150. @item init
  10151. Only evaluate expressions once during the filter initialization or when a command is processed.
  10152. @item frame
  10153. Evaluate expressions for each incoming frame.
  10154. @end table
  10155. Default value is @samp{init}.
  10156. @item interl
  10157. Set the interlacing mode. It accepts the following values:
  10158. @table @samp
  10159. @item 1
  10160. Force interlaced aware scaling.
  10161. @item 0
  10162. Do not apply interlaced scaling.
  10163. @item -1
  10164. Select interlaced aware scaling depending on whether the source frames
  10165. are flagged as interlaced or not.
  10166. @end table
  10167. Default value is @samp{0}.
  10168. @item flags
  10169. Set libswscale scaling flags. See
  10170. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10171. complete list of values. If not explicitly specified the filter applies
  10172. the default flags.
  10173. @item param0, param1
  10174. Set libswscale input parameters for scaling algorithms that need them. See
  10175. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10176. complete documentation. If not explicitly specified the filter applies
  10177. empty parameters.
  10178. @item size, s
  10179. Set the video size. For the syntax of this option, check the
  10180. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10181. @item in_color_matrix
  10182. @item out_color_matrix
  10183. Set in/output YCbCr color space type.
  10184. This allows the autodetected value to be overridden as well as allows forcing
  10185. a specific value used for the output and encoder.
  10186. If not specified, the color space type depends on the pixel format.
  10187. Possible values:
  10188. @table @samp
  10189. @item auto
  10190. Choose automatically.
  10191. @item bt709
  10192. Format conforming to International Telecommunication Union (ITU)
  10193. Recommendation BT.709.
  10194. @item fcc
  10195. Set color space conforming to the United States Federal Communications
  10196. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10197. @item bt601
  10198. Set color space conforming to:
  10199. @itemize
  10200. @item
  10201. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10202. @item
  10203. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10204. @item
  10205. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10206. @end itemize
  10207. @item smpte240m
  10208. Set color space conforming to SMPTE ST 240:1999.
  10209. @end table
  10210. @item in_range
  10211. @item out_range
  10212. Set in/output YCbCr sample range.
  10213. This allows the autodetected value to be overridden as well as allows forcing
  10214. a specific value used for the output and encoder. If not specified, the
  10215. range depends on the pixel format. Possible values:
  10216. @table @samp
  10217. @item auto/unknown
  10218. Choose automatically.
  10219. @item jpeg/full/pc
  10220. Set full range (0-255 in case of 8-bit luma).
  10221. @item mpeg/limited/tv
  10222. Set "MPEG" range (16-235 in case of 8-bit luma).
  10223. @end table
  10224. @item force_original_aspect_ratio
  10225. Enable decreasing or increasing output video width or height if necessary to
  10226. keep the original aspect ratio. Possible values:
  10227. @table @samp
  10228. @item disable
  10229. Scale the video as specified and disable this feature.
  10230. @item decrease
  10231. The output video dimensions will automatically be decreased if needed.
  10232. @item increase
  10233. The output video dimensions will automatically be increased if needed.
  10234. @end table
  10235. One useful instance of this option is that when you know a specific device's
  10236. maximum allowed resolution, you can use this to limit the output video to
  10237. that, while retaining the aspect ratio. For example, device A allows
  10238. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10239. decrease) and specifying 1280x720 to the command line makes the output
  10240. 1280x533.
  10241. Please note that this is a different thing than specifying -1 for @option{w}
  10242. or @option{h}, you still need to specify the output resolution for this option
  10243. to work.
  10244. @end table
  10245. The values of the @option{w} and @option{h} options are expressions
  10246. containing the following constants:
  10247. @table @var
  10248. @item in_w
  10249. @item in_h
  10250. The input width and height
  10251. @item iw
  10252. @item ih
  10253. These are the same as @var{in_w} and @var{in_h}.
  10254. @item out_w
  10255. @item out_h
  10256. The output (scaled) width and height
  10257. @item ow
  10258. @item oh
  10259. These are the same as @var{out_w} and @var{out_h}
  10260. @item a
  10261. The same as @var{iw} / @var{ih}
  10262. @item sar
  10263. input sample aspect ratio
  10264. @item dar
  10265. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10266. @item hsub
  10267. @item vsub
  10268. horizontal and vertical input chroma subsample values. For example for the
  10269. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10270. @item ohsub
  10271. @item ovsub
  10272. horizontal and vertical output chroma subsample values. For example for the
  10273. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10274. @end table
  10275. @subsection Examples
  10276. @itemize
  10277. @item
  10278. Scale the input video to a size of 200x100
  10279. @example
  10280. scale=w=200:h=100
  10281. @end example
  10282. This is equivalent to:
  10283. @example
  10284. scale=200:100
  10285. @end example
  10286. or:
  10287. @example
  10288. scale=200x100
  10289. @end example
  10290. @item
  10291. Specify a size abbreviation for the output size:
  10292. @example
  10293. scale=qcif
  10294. @end example
  10295. which can also be written as:
  10296. @example
  10297. scale=size=qcif
  10298. @end example
  10299. @item
  10300. Scale the input to 2x:
  10301. @example
  10302. scale=w=2*iw:h=2*ih
  10303. @end example
  10304. @item
  10305. The above is the same as:
  10306. @example
  10307. scale=2*in_w:2*in_h
  10308. @end example
  10309. @item
  10310. Scale the input to 2x with forced interlaced scaling:
  10311. @example
  10312. scale=2*iw:2*ih:interl=1
  10313. @end example
  10314. @item
  10315. Scale the input to half size:
  10316. @example
  10317. scale=w=iw/2:h=ih/2
  10318. @end example
  10319. @item
  10320. Increase the width, and set the height to the same size:
  10321. @example
  10322. scale=3/2*iw:ow
  10323. @end example
  10324. @item
  10325. Seek Greek harmony:
  10326. @example
  10327. scale=iw:1/PHI*iw
  10328. scale=ih*PHI:ih
  10329. @end example
  10330. @item
  10331. Increase the height, and set the width to 3/2 of the height:
  10332. @example
  10333. scale=w=3/2*oh:h=3/5*ih
  10334. @end example
  10335. @item
  10336. Increase the size, making the size a multiple of the chroma
  10337. subsample values:
  10338. @example
  10339. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10340. @end example
  10341. @item
  10342. Increase the width to a maximum of 500 pixels,
  10343. keeping the same aspect ratio as the input:
  10344. @example
  10345. scale=w='min(500\, iw*3/2):h=-1'
  10346. @end example
  10347. @end itemize
  10348. @subsection Commands
  10349. This filter supports the following commands:
  10350. @table @option
  10351. @item width, w
  10352. @item height, h
  10353. Set the output video dimension expression.
  10354. The command accepts the same syntax of the corresponding option.
  10355. If the specified expression is not valid, it is kept at its current
  10356. value.
  10357. @end table
  10358. @section scale_npp
  10359. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10360. format conversion on CUDA video frames. Setting the output width and height
  10361. works in the same way as for the @var{scale} filter.
  10362. The following additional options are accepted:
  10363. @table @option
  10364. @item format
  10365. The pixel format of the output CUDA frames. If set to the string "same" (the
  10366. default), the input format will be kept. Note that automatic format negotiation
  10367. and conversion is not yet supported for hardware frames
  10368. @item interp_algo
  10369. The interpolation algorithm used for resizing. One of the following:
  10370. @table @option
  10371. @item nn
  10372. Nearest neighbour.
  10373. @item linear
  10374. @item cubic
  10375. @item cubic2p_bspline
  10376. 2-parameter cubic (B=1, C=0)
  10377. @item cubic2p_catmullrom
  10378. 2-parameter cubic (B=0, C=1/2)
  10379. @item cubic2p_b05c03
  10380. 2-parameter cubic (B=1/2, C=3/10)
  10381. @item super
  10382. Supersampling
  10383. @item lanczos
  10384. @end table
  10385. @end table
  10386. @section scale2ref
  10387. Scale (resize) the input video, based on a reference video.
  10388. See the scale filter for available options, scale2ref supports the same but
  10389. uses the reference video instead of the main input as basis. scale2ref also
  10390. supports the following additional constants for the @option{w} and
  10391. @option{h} options:
  10392. @table @var
  10393. @item main_w
  10394. @item main_h
  10395. The main input video's width and height
  10396. @item main_a
  10397. The same as @var{main_w} / @var{main_h}
  10398. @item main_sar
  10399. The main input video's sample aspect ratio
  10400. @item main_dar, mdar
  10401. The main input video's display aspect ratio. Calculated from
  10402. @code{(main_w / main_h) * main_sar}.
  10403. @item main_hsub
  10404. @item main_vsub
  10405. The main input video's horizontal and vertical chroma subsample values.
  10406. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10407. is 1.
  10408. @end table
  10409. @subsection Examples
  10410. @itemize
  10411. @item
  10412. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10413. @example
  10414. 'scale2ref[b][a];[a][b]overlay'
  10415. @end example
  10416. @end itemize
  10417. @anchor{selectivecolor}
  10418. @section selectivecolor
  10419. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10420. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10421. by the "purity" of the color (that is, how saturated it already is).
  10422. This filter is similar to the Adobe Photoshop Selective Color tool.
  10423. The filter accepts the following options:
  10424. @table @option
  10425. @item correction_method
  10426. Select color correction method.
  10427. Available values are:
  10428. @table @samp
  10429. @item absolute
  10430. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10431. component value).
  10432. @item relative
  10433. Specified adjustments are relative to the original component value.
  10434. @end table
  10435. Default is @code{absolute}.
  10436. @item reds
  10437. Adjustments for red pixels (pixels where the red component is the maximum)
  10438. @item yellows
  10439. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10440. @item greens
  10441. Adjustments for green pixels (pixels where the green component is the maximum)
  10442. @item cyans
  10443. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10444. @item blues
  10445. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10446. @item magentas
  10447. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10448. @item whites
  10449. Adjustments for white pixels (pixels where all components are greater than 128)
  10450. @item neutrals
  10451. Adjustments for all pixels except pure black and pure white
  10452. @item blacks
  10453. Adjustments for black pixels (pixels where all components are lesser than 128)
  10454. @item psfile
  10455. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10456. @end table
  10457. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10458. 4 space separated floating point adjustment values in the [-1,1] range,
  10459. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10460. pixels of its range.
  10461. @subsection Examples
  10462. @itemize
  10463. @item
  10464. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10465. increase magenta by 27% in blue areas:
  10466. @example
  10467. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10468. @end example
  10469. @item
  10470. Use a Photoshop selective color preset:
  10471. @example
  10472. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10473. @end example
  10474. @end itemize
  10475. @anchor{separatefields}
  10476. @section separatefields
  10477. The @code{separatefields} takes a frame-based video input and splits
  10478. each frame into its components fields, producing a new half height clip
  10479. with twice the frame rate and twice the frame count.
  10480. This filter use field-dominance information in frame to decide which
  10481. of each pair of fields to place first in the output.
  10482. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10483. @section setdar, setsar
  10484. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10485. output video.
  10486. This is done by changing the specified Sample (aka Pixel) Aspect
  10487. Ratio, according to the following equation:
  10488. @example
  10489. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10490. @end example
  10491. Keep in mind that the @code{setdar} filter does not modify the pixel
  10492. dimensions of the video frame. Also, the display aspect ratio set by
  10493. this filter may be changed by later filters in the filterchain,
  10494. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10495. applied.
  10496. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10497. the filter output video.
  10498. Note that as a consequence of the application of this filter, the
  10499. output display aspect ratio will change according to the equation
  10500. above.
  10501. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10502. filter may be changed by later filters in the filterchain, e.g. if
  10503. another "setsar" or a "setdar" filter is applied.
  10504. It accepts the following parameters:
  10505. @table @option
  10506. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10507. Set the aspect ratio used by the filter.
  10508. The parameter can be a floating point number string, an expression, or
  10509. a string of the form @var{num}:@var{den}, where @var{num} and
  10510. @var{den} are the numerator and denominator of the aspect ratio. If
  10511. the parameter is not specified, it is assumed the value "0".
  10512. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10513. should be escaped.
  10514. @item max
  10515. Set the maximum integer value to use for expressing numerator and
  10516. denominator when reducing the expressed aspect ratio to a rational.
  10517. Default value is @code{100}.
  10518. @end table
  10519. The parameter @var{sar} is an expression containing
  10520. the following constants:
  10521. @table @option
  10522. @item E, PI, PHI
  10523. These are approximated values for the mathematical constants e
  10524. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10525. @item w, h
  10526. The input width and height.
  10527. @item a
  10528. These are the same as @var{w} / @var{h}.
  10529. @item sar
  10530. The input sample aspect ratio.
  10531. @item dar
  10532. The input display aspect ratio. It is the same as
  10533. (@var{w} / @var{h}) * @var{sar}.
  10534. @item hsub, vsub
  10535. Horizontal and vertical chroma subsample values. For example, for the
  10536. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10537. @end table
  10538. @subsection Examples
  10539. @itemize
  10540. @item
  10541. To change the display aspect ratio to 16:9, specify one of the following:
  10542. @example
  10543. setdar=dar=1.77777
  10544. setdar=dar=16/9
  10545. @end example
  10546. @item
  10547. To change the sample aspect ratio to 10:11, specify:
  10548. @example
  10549. setsar=sar=10/11
  10550. @end example
  10551. @item
  10552. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10553. 1000 in the aspect ratio reduction, use the command:
  10554. @example
  10555. setdar=ratio=16/9:max=1000
  10556. @end example
  10557. @end itemize
  10558. @anchor{setfield}
  10559. @section setfield
  10560. Force field for the output video frame.
  10561. The @code{setfield} filter marks the interlace type field for the
  10562. output frames. It does not change the input frame, but only sets the
  10563. corresponding property, which affects how the frame is treated by
  10564. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10565. The filter accepts the following options:
  10566. @table @option
  10567. @item mode
  10568. Available values are:
  10569. @table @samp
  10570. @item auto
  10571. Keep the same field property.
  10572. @item bff
  10573. Mark the frame as bottom-field-first.
  10574. @item tff
  10575. Mark the frame as top-field-first.
  10576. @item prog
  10577. Mark the frame as progressive.
  10578. @end table
  10579. @end table
  10580. @section showinfo
  10581. Show a line containing various information for each input video frame.
  10582. The input video is not modified.
  10583. The shown line contains a sequence of key/value pairs of the form
  10584. @var{key}:@var{value}.
  10585. The following values are shown in the output:
  10586. @table @option
  10587. @item n
  10588. The (sequential) number of the input frame, starting from 0.
  10589. @item pts
  10590. The Presentation TimeStamp of the input frame, expressed as a number of
  10591. time base units. The time base unit depends on the filter input pad.
  10592. @item pts_time
  10593. The Presentation TimeStamp of the input frame, expressed as a number of
  10594. seconds.
  10595. @item pos
  10596. The position of the frame in the input stream, or -1 if this information is
  10597. unavailable and/or meaningless (for example in case of synthetic video).
  10598. @item fmt
  10599. The pixel format name.
  10600. @item sar
  10601. The sample aspect ratio of the input frame, expressed in the form
  10602. @var{num}/@var{den}.
  10603. @item s
  10604. The size of the input frame. For the syntax of this option, check the
  10605. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10606. @item i
  10607. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10608. for bottom field first).
  10609. @item iskey
  10610. This is 1 if the frame is a key frame, 0 otherwise.
  10611. @item type
  10612. The picture type of the input frame ("I" for an I-frame, "P" for a
  10613. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10614. Also refer to the documentation of the @code{AVPictureType} enum and of
  10615. the @code{av_get_picture_type_char} function defined in
  10616. @file{libavutil/avutil.h}.
  10617. @item checksum
  10618. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10619. @item plane_checksum
  10620. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10621. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10622. @end table
  10623. @section showpalette
  10624. Displays the 256 colors palette of each frame. This filter is only relevant for
  10625. @var{pal8} pixel format frames.
  10626. It accepts the following option:
  10627. @table @option
  10628. @item s
  10629. Set the size of the box used to represent one palette color entry. Default is
  10630. @code{30} (for a @code{30x30} pixel box).
  10631. @end table
  10632. @section shuffleframes
  10633. Reorder and/or duplicate and/or drop video frames.
  10634. It accepts the following parameters:
  10635. @table @option
  10636. @item mapping
  10637. Set the destination indexes of input frames.
  10638. This is space or '|' separated list of indexes that maps input frames to output
  10639. frames. Number of indexes also sets maximal value that each index may have.
  10640. '-1' index have special meaning and that is to drop frame.
  10641. @end table
  10642. The first frame has the index 0. The default is to keep the input unchanged.
  10643. @subsection Examples
  10644. @itemize
  10645. @item
  10646. Swap second and third frame of every three frames of the input:
  10647. @example
  10648. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10649. @end example
  10650. @item
  10651. Swap 10th and 1st frame of every ten frames of the input:
  10652. @example
  10653. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10654. @end example
  10655. @end itemize
  10656. @section shuffleplanes
  10657. Reorder and/or duplicate video planes.
  10658. It accepts the following parameters:
  10659. @table @option
  10660. @item map0
  10661. The index of the input plane to be used as the first output plane.
  10662. @item map1
  10663. The index of the input plane to be used as the second output plane.
  10664. @item map2
  10665. The index of the input plane to be used as the third output plane.
  10666. @item map3
  10667. The index of the input plane to be used as the fourth output plane.
  10668. @end table
  10669. The first plane has the index 0. The default is to keep the input unchanged.
  10670. @subsection Examples
  10671. @itemize
  10672. @item
  10673. Swap the second and third planes of the input:
  10674. @example
  10675. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10676. @end example
  10677. @end itemize
  10678. @anchor{signalstats}
  10679. @section signalstats
  10680. Evaluate various visual metrics that assist in determining issues associated
  10681. with the digitization of analog video media.
  10682. By default the filter will log these metadata values:
  10683. @table @option
  10684. @item YMIN
  10685. Display the minimal Y value contained within the input frame. Expressed in
  10686. range of [0-255].
  10687. @item YLOW
  10688. Display the Y value at the 10% percentile within the input frame. Expressed in
  10689. range of [0-255].
  10690. @item YAVG
  10691. Display the average Y value within the input frame. Expressed in range of
  10692. [0-255].
  10693. @item YHIGH
  10694. Display the Y value at the 90% percentile within the input frame. Expressed in
  10695. range of [0-255].
  10696. @item YMAX
  10697. Display the maximum Y value contained within the input frame. Expressed in
  10698. range of [0-255].
  10699. @item UMIN
  10700. Display the minimal U value contained within the input frame. Expressed in
  10701. range of [0-255].
  10702. @item ULOW
  10703. Display the U value at the 10% percentile within the input frame. Expressed in
  10704. range of [0-255].
  10705. @item UAVG
  10706. Display the average U value within the input frame. Expressed in range of
  10707. [0-255].
  10708. @item UHIGH
  10709. Display the U value at the 90% percentile within the input frame. Expressed in
  10710. range of [0-255].
  10711. @item UMAX
  10712. Display the maximum U value contained within the input frame. Expressed in
  10713. range of [0-255].
  10714. @item VMIN
  10715. Display the minimal V value contained within the input frame. Expressed in
  10716. range of [0-255].
  10717. @item VLOW
  10718. Display the V value at the 10% percentile within the input frame. Expressed in
  10719. range of [0-255].
  10720. @item VAVG
  10721. Display the average V value within the input frame. Expressed in range of
  10722. [0-255].
  10723. @item VHIGH
  10724. Display the V value at the 90% percentile within the input frame. Expressed in
  10725. range of [0-255].
  10726. @item VMAX
  10727. Display the maximum V value contained within the input frame. Expressed in
  10728. range of [0-255].
  10729. @item SATMIN
  10730. Display the minimal saturation value contained within the input frame.
  10731. Expressed in range of [0-~181.02].
  10732. @item SATLOW
  10733. Display the saturation value at the 10% percentile within the input frame.
  10734. Expressed in range of [0-~181.02].
  10735. @item SATAVG
  10736. Display the average saturation value within the input frame. Expressed in range
  10737. of [0-~181.02].
  10738. @item SATHIGH
  10739. Display the saturation value at the 90% percentile within the input frame.
  10740. Expressed in range of [0-~181.02].
  10741. @item SATMAX
  10742. Display the maximum saturation value contained within the input frame.
  10743. Expressed in range of [0-~181.02].
  10744. @item HUEMED
  10745. Display the median value for hue within the input frame. Expressed in range of
  10746. [0-360].
  10747. @item HUEAVG
  10748. Display the average value for hue within the input frame. Expressed in range of
  10749. [0-360].
  10750. @item YDIF
  10751. Display the average of sample value difference between all values of the Y
  10752. plane in the current frame and corresponding values of the previous input frame.
  10753. Expressed in range of [0-255].
  10754. @item UDIF
  10755. Display the average of sample value difference between all values of the U
  10756. plane in the current frame and corresponding values of the previous input frame.
  10757. Expressed in range of [0-255].
  10758. @item VDIF
  10759. Display the average of sample value difference between all values of the V
  10760. plane in the current frame and corresponding values of the previous input frame.
  10761. Expressed in range of [0-255].
  10762. @item YBITDEPTH
  10763. Display bit depth of Y plane in current frame.
  10764. Expressed in range of [0-16].
  10765. @item UBITDEPTH
  10766. Display bit depth of U plane in current frame.
  10767. Expressed in range of [0-16].
  10768. @item VBITDEPTH
  10769. Display bit depth of V plane in current frame.
  10770. Expressed in range of [0-16].
  10771. @end table
  10772. The filter accepts the following options:
  10773. @table @option
  10774. @item stat
  10775. @item out
  10776. @option{stat} specify an additional form of image analysis.
  10777. @option{out} output video with the specified type of pixel highlighted.
  10778. Both options accept the following values:
  10779. @table @samp
  10780. @item tout
  10781. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10782. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10783. include the results of video dropouts, head clogs, or tape tracking issues.
  10784. @item vrep
  10785. Identify @var{vertical line repetition}. Vertical line repetition includes
  10786. similar rows of pixels within a frame. In born-digital video vertical line
  10787. repetition is common, but this pattern is uncommon in video digitized from an
  10788. analog source. When it occurs in video that results from the digitization of an
  10789. analog source it can indicate concealment from a dropout compensator.
  10790. @item brng
  10791. Identify pixels that fall outside of legal broadcast range.
  10792. @end table
  10793. @item color, c
  10794. Set the highlight color for the @option{out} option. The default color is
  10795. yellow.
  10796. @end table
  10797. @subsection Examples
  10798. @itemize
  10799. @item
  10800. Output data of various video metrics:
  10801. @example
  10802. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10803. @end example
  10804. @item
  10805. Output specific data about the minimum and maximum values of the Y plane per frame:
  10806. @example
  10807. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10808. @end example
  10809. @item
  10810. Playback video while highlighting pixels that are outside of broadcast range in red.
  10811. @example
  10812. ffplay example.mov -vf signalstats="out=brng:color=red"
  10813. @end example
  10814. @item
  10815. Playback video with signalstats metadata drawn over the frame.
  10816. @example
  10817. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10818. @end example
  10819. The contents of signalstat_drawtext.txt used in the command are:
  10820. @example
  10821. time %@{pts:hms@}
  10822. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10823. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10824. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10825. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10826. @end example
  10827. @end itemize
  10828. @anchor{signature}
  10829. @section signature
  10830. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10831. input. In this case the matching between the inputs can be calculated additionally.
  10832. The filter always passes through the first input. The signature of each stream can
  10833. be written into a file.
  10834. It accepts the following options:
  10835. @table @option
  10836. @item detectmode
  10837. Enable or disable the matching process.
  10838. Available values are:
  10839. @table @samp
  10840. @item off
  10841. Disable the calculation of a matching (default).
  10842. @item full
  10843. Calculate the matching for the whole video and output whether the whole video
  10844. matches or only parts.
  10845. @item fast
  10846. Calculate only until a matching is found or the video ends. Should be faster in
  10847. some cases.
  10848. @end table
  10849. @item nb_inputs
  10850. Set the number of inputs. The option value must be a non negative integer.
  10851. Default value is 1.
  10852. @item filename
  10853. Set the path to which the output is written. If there is more than one input,
  10854. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10855. integer), that will be replaced with the input number. If no filename is
  10856. specified, no output will be written. This is the default.
  10857. @item format
  10858. Choose the output format.
  10859. Available values are:
  10860. @table @samp
  10861. @item binary
  10862. Use the specified binary representation (default).
  10863. @item xml
  10864. Use the specified xml representation.
  10865. @end table
  10866. @item th_d
  10867. Set threshold to detect one word as similar. The option value must be an integer
  10868. greater than zero. The default value is 9000.
  10869. @item th_dc
  10870. Set threshold to detect all words as similar. The option value must be an integer
  10871. greater than zero. The default value is 60000.
  10872. @item th_xh
  10873. Set threshold to detect frames as similar. The option value must be an integer
  10874. greater than zero. The default value is 116.
  10875. @item th_di
  10876. Set the minimum length of a sequence in frames to recognize it as matching
  10877. sequence. The option value must be a non negative integer value.
  10878. The default value is 0.
  10879. @item th_it
  10880. Set the minimum relation, that matching frames to all frames must have.
  10881. The option value must be a double value between 0 and 1. The default value is 0.5.
  10882. @end table
  10883. @subsection Examples
  10884. @itemize
  10885. @item
  10886. To calculate the signature of an input video and store it in signature.bin:
  10887. @example
  10888. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10889. @end example
  10890. @item
  10891. To detect whether two videos match and store the signatures in XML format in
  10892. signature0.xml and signature1.xml:
  10893. @example
  10894. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  10895. @end example
  10896. @end itemize
  10897. @anchor{smartblur}
  10898. @section smartblur
  10899. Blur the input video without impacting the outlines.
  10900. It accepts the following options:
  10901. @table @option
  10902. @item luma_radius, lr
  10903. Set the luma radius. The option value must be a float number in
  10904. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10905. used to blur the image (slower if larger). Default value is 1.0.
  10906. @item luma_strength, ls
  10907. Set the luma strength. The option value must be a float number
  10908. in the range [-1.0,1.0] that configures the blurring. A value included
  10909. in [0.0,1.0] will blur the image whereas a value included in
  10910. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10911. @item luma_threshold, lt
  10912. Set the luma threshold used as a coefficient to determine
  10913. whether a pixel should be blurred or not. The option value must be an
  10914. integer in the range [-30,30]. A value of 0 will filter all the image,
  10915. a value included in [0,30] will filter flat areas and a value included
  10916. in [-30,0] will filter edges. Default value is 0.
  10917. @item chroma_radius, cr
  10918. Set the chroma radius. The option value must be a float number in
  10919. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10920. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10921. @item chroma_strength, cs
  10922. Set the chroma strength. The option value must be a float number
  10923. in the range [-1.0,1.0] that configures the blurring. A value included
  10924. in [0.0,1.0] will blur the image whereas a value included in
  10925. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10926. @item chroma_threshold, ct
  10927. Set the chroma threshold used as a coefficient to determine
  10928. whether a pixel should be blurred or not. The option value must be an
  10929. integer in the range [-30,30]. A value of 0 will filter all the image,
  10930. a value included in [0,30] will filter flat areas and a value included
  10931. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10932. @end table
  10933. If a chroma option is not explicitly set, the corresponding luma value
  10934. is set.
  10935. @section ssim
  10936. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10937. This filter takes in input two input videos, the first input is
  10938. considered the "main" source and is passed unchanged to the
  10939. output. The second input is used as a "reference" video for computing
  10940. the SSIM.
  10941. Both video inputs must have the same resolution and pixel format for
  10942. this filter to work correctly. Also it assumes that both inputs
  10943. have the same number of frames, which are compared one by one.
  10944. The filter stores the calculated SSIM of each frame.
  10945. The description of the accepted parameters follows.
  10946. @table @option
  10947. @item stats_file, f
  10948. If specified the filter will use the named file to save the SSIM of
  10949. each individual frame. When filename equals "-" the data is sent to
  10950. standard output.
  10951. @end table
  10952. The file printed if @var{stats_file} is selected, contains a sequence of
  10953. key/value pairs of the form @var{key}:@var{value} for each compared
  10954. couple of frames.
  10955. A description of each shown parameter follows:
  10956. @table @option
  10957. @item n
  10958. sequential number of the input frame, starting from 1
  10959. @item Y, U, V, R, G, B
  10960. SSIM of the compared frames for the component specified by the suffix.
  10961. @item All
  10962. SSIM of the compared frames for the whole frame.
  10963. @item dB
  10964. Same as above but in dB representation.
  10965. @end table
  10966. This filter also supports the @ref{framesync} options.
  10967. For example:
  10968. @example
  10969. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10970. [main][ref] ssim="stats_file=stats.log" [out]
  10971. @end example
  10972. On this example the input file being processed is compared with the
  10973. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10974. is stored in @file{stats.log}.
  10975. Another example with both psnr and ssim at same time:
  10976. @example
  10977. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10978. @end example
  10979. @section stereo3d
  10980. Convert between different stereoscopic image formats.
  10981. The filters accept the following options:
  10982. @table @option
  10983. @item in
  10984. Set stereoscopic image format of input.
  10985. Available values for input image formats are:
  10986. @table @samp
  10987. @item sbsl
  10988. side by side parallel (left eye left, right eye right)
  10989. @item sbsr
  10990. side by side crosseye (right eye left, left eye right)
  10991. @item sbs2l
  10992. side by side parallel with half width resolution
  10993. (left eye left, right eye right)
  10994. @item sbs2r
  10995. side by side crosseye with half width resolution
  10996. (right eye left, left eye right)
  10997. @item abl
  10998. above-below (left eye above, right eye below)
  10999. @item abr
  11000. above-below (right eye above, left eye below)
  11001. @item ab2l
  11002. above-below with half height resolution
  11003. (left eye above, right eye below)
  11004. @item ab2r
  11005. above-below with half height resolution
  11006. (right eye above, left eye below)
  11007. @item al
  11008. alternating frames (left eye first, right eye second)
  11009. @item ar
  11010. alternating frames (right eye first, left eye second)
  11011. @item irl
  11012. interleaved rows (left eye has top row, right eye starts on next row)
  11013. @item irr
  11014. interleaved rows (right eye has top row, left eye starts on next row)
  11015. @item icl
  11016. interleaved columns, left eye first
  11017. @item icr
  11018. interleaved columns, right eye first
  11019. Default value is @samp{sbsl}.
  11020. @end table
  11021. @item out
  11022. Set stereoscopic image format of output.
  11023. @table @samp
  11024. @item sbsl
  11025. side by side parallel (left eye left, right eye right)
  11026. @item sbsr
  11027. side by side crosseye (right eye left, left eye right)
  11028. @item sbs2l
  11029. side by side parallel with half width resolution
  11030. (left eye left, right eye right)
  11031. @item sbs2r
  11032. side by side crosseye with half width resolution
  11033. (right eye left, left eye right)
  11034. @item abl
  11035. above-below (left eye above, right eye below)
  11036. @item abr
  11037. above-below (right eye above, left eye below)
  11038. @item ab2l
  11039. above-below with half height resolution
  11040. (left eye above, right eye below)
  11041. @item ab2r
  11042. above-below with half height resolution
  11043. (right eye above, left eye below)
  11044. @item al
  11045. alternating frames (left eye first, right eye second)
  11046. @item ar
  11047. alternating frames (right eye first, left eye second)
  11048. @item irl
  11049. interleaved rows (left eye has top row, right eye starts on next row)
  11050. @item irr
  11051. interleaved rows (right eye has top row, left eye starts on next row)
  11052. @item arbg
  11053. anaglyph red/blue gray
  11054. (red filter on left eye, blue filter on right eye)
  11055. @item argg
  11056. anaglyph red/green gray
  11057. (red filter on left eye, green filter on right eye)
  11058. @item arcg
  11059. anaglyph red/cyan gray
  11060. (red filter on left eye, cyan filter on right eye)
  11061. @item arch
  11062. anaglyph red/cyan half colored
  11063. (red filter on left eye, cyan filter on right eye)
  11064. @item arcc
  11065. anaglyph red/cyan color
  11066. (red filter on left eye, cyan filter on right eye)
  11067. @item arcd
  11068. anaglyph red/cyan color optimized with the least squares projection of dubois
  11069. (red filter on left eye, cyan filter on right eye)
  11070. @item agmg
  11071. anaglyph green/magenta gray
  11072. (green filter on left eye, magenta filter on right eye)
  11073. @item agmh
  11074. anaglyph green/magenta half colored
  11075. (green filter on left eye, magenta filter on right eye)
  11076. @item agmc
  11077. anaglyph green/magenta colored
  11078. (green filter on left eye, magenta filter on right eye)
  11079. @item agmd
  11080. anaglyph green/magenta color optimized with the least squares projection of dubois
  11081. (green filter on left eye, magenta filter on right eye)
  11082. @item aybg
  11083. anaglyph yellow/blue gray
  11084. (yellow filter on left eye, blue filter on right eye)
  11085. @item aybh
  11086. anaglyph yellow/blue half colored
  11087. (yellow filter on left eye, blue filter on right eye)
  11088. @item aybc
  11089. anaglyph yellow/blue colored
  11090. (yellow filter on left eye, blue filter on right eye)
  11091. @item aybd
  11092. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11093. (yellow filter on left eye, blue filter on right eye)
  11094. @item ml
  11095. mono output (left eye only)
  11096. @item mr
  11097. mono output (right eye only)
  11098. @item chl
  11099. checkerboard, left eye first
  11100. @item chr
  11101. checkerboard, right eye first
  11102. @item icl
  11103. interleaved columns, left eye first
  11104. @item icr
  11105. interleaved columns, right eye first
  11106. @item hdmi
  11107. HDMI frame pack
  11108. @end table
  11109. Default value is @samp{arcd}.
  11110. @end table
  11111. @subsection Examples
  11112. @itemize
  11113. @item
  11114. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11115. @example
  11116. stereo3d=sbsl:aybd
  11117. @end example
  11118. @item
  11119. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11120. @example
  11121. stereo3d=abl:sbsr
  11122. @end example
  11123. @end itemize
  11124. @section streamselect, astreamselect
  11125. Select video or audio streams.
  11126. The filter accepts the following options:
  11127. @table @option
  11128. @item inputs
  11129. Set number of inputs. Default is 2.
  11130. @item map
  11131. Set input indexes to remap to outputs.
  11132. @end table
  11133. @subsection Commands
  11134. The @code{streamselect} and @code{astreamselect} filter supports the following
  11135. commands:
  11136. @table @option
  11137. @item map
  11138. Set input indexes to remap to outputs.
  11139. @end table
  11140. @subsection Examples
  11141. @itemize
  11142. @item
  11143. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11144. @example
  11145. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11146. @end example
  11147. @item
  11148. Same as above, but for audio:
  11149. @example
  11150. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11151. @end example
  11152. @end itemize
  11153. @section sobel
  11154. Apply sobel operator to input video stream.
  11155. The filter accepts the following option:
  11156. @table @option
  11157. @item planes
  11158. Set which planes will be processed, unprocessed planes will be copied.
  11159. By default value 0xf, all planes will be processed.
  11160. @item scale
  11161. Set value which will be multiplied with filtered result.
  11162. @item delta
  11163. Set value which will be added to filtered result.
  11164. @end table
  11165. @anchor{spp}
  11166. @section spp
  11167. Apply a simple postprocessing filter that compresses and decompresses the image
  11168. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11169. and average the results.
  11170. The filter accepts the following options:
  11171. @table @option
  11172. @item quality
  11173. Set quality. This option defines the number of levels for averaging. It accepts
  11174. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11175. effect. A value of @code{6} means the higher quality. For each increment of
  11176. that value the speed drops by a factor of approximately 2. Default value is
  11177. @code{3}.
  11178. @item qp
  11179. Force a constant quantization parameter. If not set, the filter will use the QP
  11180. from the video stream (if available).
  11181. @item mode
  11182. Set thresholding mode. Available modes are:
  11183. @table @samp
  11184. @item hard
  11185. Set hard thresholding (default).
  11186. @item soft
  11187. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11188. @end table
  11189. @item use_bframe_qp
  11190. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11191. option may cause flicker since the B-Frames have often larger QP. Default is
  11192. @code{0} (not enabled).
  11193. @end table
  11194. @anchor{subtitles}
  11195. @section subtitles
  11196. Draw subtitles on top of input video using the libass library.
  11197. To enable compilation of this filter you need to configure FFmpeg with
  11198. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11199. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11200. Alpha) subtitles format.
  11201. The filter accepts the following options:
  11202. @table @option
  11203. @item filename, f
  11204. Set the filename of the subtitle file to read. It must be specified.
  11205. @item original_size
  11206. Specify the size of the original video, the video for which the ASS file
  11207. was composed. For the syntax of this option, check the
  11208. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11209. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11210. correctly scale the fonts if the aspect ratio has been changed.
  11211. @item fontsdir
  11212. Set a directory path containing fonts that can be used by the filter.
  11213. These fonts will be used in addition to whatever the font provider uses.
  11214. @item alpha
  11215. Process alpha channel, by default alpha channel is untouched.
  11216. @item charenc
  11217. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11218. useful if not UTF-8.
  11219. @item stream_index, si
  11220. Set subtitles stream index. @code{subtitles} filter only.
  11221. @item force_style
  11222. Override default style or script info parameters of the subtitles. It accepts a
  11223. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11224. @end table
  11225. If the first key is not specified, it is assumed that the first value
  11226. specifies the @option{filename}.
  11227. For example, to render the file @file{sub.srt} on top of the input
  11228. video, use the command:
  11229. @example
  11230. subtitles=sub.srt
  11231. @end example
  11232. which is equivalent to:
  11233. @example
  11234. subtitles=filename=sub.srt
  11235. @end example
  11236. To render the default subtitles stream from file @file{video.mkv}, use:
  11237. @example
  11238. subtitles=video.mkv
  11239. @end example
  11240. To render the second subtitles stream from that file, use:
  11241. @example
  11242. subtitles=video.mkv:si=1
  11243. @end example
  11244. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11245. @code{DejaVu Serif}, use:
  11246. @example
  11247. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11248. @end example
  11249. @section super2xsai
  11250. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11251. Interpolate) pixel art scaling algorithm.
  11252. Useful for enlarging pixel art images without reducing sharpness.
  11253. @section swaprect
  11254. Swap two rectangular objects in video.
  11255. This filter accepts the following options:
  11256. @table @option
  11257. @item w
  11258. Set object width.
  11259. @item h
  11260. Set object height.
  11261. @item x1
  11262. Set 1st rect x coordinate.
  11263. @item y1
  11264. Set 1st rect y coordinate.
  11265. @item x2
  11266. Set 2nd rect x coordinate.
  11267. @item y2
  11268. Set 2nd rect y coordinate.
  11269. All expressions are evaluated once for each frame.
  11270. @end table
  11271. The all options are expressions containing the following constants:
  11272. @table @option
  11273. @item w
  11274. @item h
  11275. The input width and height.
  11276. @item a
  11277. same as @var{w} / @var{h}
  11278. @item sar
  11279. input sample aspect ratio
  11280. @item dar
  11281. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11282. @item n
  11283. The number of the input frame, starting from 0.
  11284. @item t
  11285. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11286. @item pos
  11287. the position in the file of the input frame, NAN if unknown
  11288. @end table
  11289. @section swapuv
  11290. Swap U & V plane.
  11291. @section telecine
  11292. Apply telecine process to the video.
  11293. This filter accepts the following options:
  11294. @table @option
  11295. @item first_field
  11296. @table @samp
  11297. @item top, t
  11298. top field first
  11299. @item bottom, b
  11300. bottom field first
  11301. The default value is @code{top}.
  11302. @end table
  11303. @item pattern
  11304. A string of numbers representing the pulldown pattern you wish to apply.
  11305. The default value is @code{23}.
  11306. @end table
  11307. @example
  11308. Some typical patterns:
  11309. NTSC output (30i):
  11310. 27.5p: 32222
  11311. 24p: 23 (classic)
  11312. 24p: 2332 (preferred)
  11313. 20p: 33
  11314. 18p: 334
  11315. 16p: 3444
  11316. PAL output (25i):
  11317. 27.5p: 12222
  11318. 24p: 222222222223 ("Euro pulldown")
  11319. 16.67p: 33
  11320. 16p: 33333334
  11321. @end example
  11322. @section threshold
  11323. Apply threshold effect to video stream.
  11324. This filter needs four video streams to perform thresholding.
  11325. First stream is stream we are filtering.
  11326. Second stream is holding threshold values, third stream is holding min values,
  11327. and last, fourth stream is holding max values.
  11328. The filter accepts the following option:
  11329. @table @option
  11330. @item planes
  11331. Set which planes will be processed, unprocessed planes will be copied.
  11332. By default value 0xf, all planes will be processed.
  11333. @end table
  11334. For example if first stream pixel's component value is less then threshold value
  11335. of pixel component from 2nd threshold stream, third stream value will picked,
  11336. otherwise fourth stream pixel component value will be picked.
  11337. Using color source filter one can perform various types of thresholding:
  11338. @subsection Examples
  11339. @itemize
  11340. @item
  11341. Binary threshold, using gray color as threshold:
  11342. @example
  11343. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11344. @end example
  11345. @item
  11346. Inverted binary threshold, using gray color as threshold:
  11347. @example
  11348. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11349. @end example
  11350. @item
  11351. Truncate binary threshold, using gray color as threshold:
  11352. @example
  11353. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11354. @end example
  11355. @item
  11356. Threshold to zero, using gray color as threshold:
  11357. @example
  11358. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11359. @end example
  11360. @item
  11361. Inverted threshold to zero, using gray color as threshold:
  11362. @example
  11363. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11364. @end example
  11365. @end itemize
  11366. @section thumbnail
  11367. Select the most representative frame in a given sequence of consecutive frames.
  11368. The filter accepts the following options:
  11369. @table @option
  11370. @item n
  11371. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11372. will pick one of them, and then handle the next batch of @var{n} frames until
  11373. the end. Default is @code{100}.
  11374. @end table
  11375. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11376. value will result in a higher memory usage, so a high value is not recommended.
  11377. @subsection Examples
  11378. @itemize
  11379. @item
  11380. Extract one picture each 50 frames:
  11381. @example
  11382. thumbnail=50
  11383. @end example
  11384. @item
  11385. Complete example of a thumbnail creation with @command{ffmpeg}:
  11386. @example
  11387. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11388. @end example
  11389. @end itemize
  11390. @section tile
  11391. Tile several successive frames together.
  11392. The filter accepts the following options:
  11393. @table @option
  11394. @item layout
  11395. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11396. this option, check the
  11397. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11398. @item nb_frames
  11399. Set the maximum number of frames to render in the given area. It must be less
  11400. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11401. the area will be used.
  11402. @item margin
  11403. Set the outer border margin in pixels.
  11404. @item padding
  11405. Set the inner border thickness (i.e. the number of pixels between frames). For
  11406. more advanced padding options (such as having different values for the edges),
  11407. refer to the pad video filter.
  11408. @item color
  11409. Specify the color of the unused area. For the syntax of this option, check the
  11410. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11411. is "black".
  11412. @item overlap
  11413. Set the number of frames to overlap when tiling several successive frames together.
  11414. The value must be between @code{0} and @var{nb_frames - 1}.
  11415. @item init_padding
  11416. Set the number of frames to initially be empty before displaying first output frame.
  11417. This controls how soon will one get first output frame.
  11418. The value must be between @code{0} and @var{nb_frames - 1}.
  11419. @end table
  11420. @subsection Examples
  11421. @itemize
  11422. @item
  11423. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11424. @example
  11425. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11426. @end example
  11427. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11428. duplicating each output frame to accommodate the originally detected frame
  11429. rate.
  11430. @item
  11431. Display @code{5} pictures in an area of @code{3x2} frames,
  11432. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11433. mixed flat and named options:
  11434. @example
  11435. tile=3x2:nb_frames=5:padding=7:margin=2
  11436. @end example
  11437. @end itemize
  11438. @section tinterlace
  11439. Perform various types of temporal field interlacing.
  11440. Frames are counted starting from 1, so the first input frame is
  11441. considered odd.
  11442. The filter accepts the following options:
  11443. @table @option
  11444. @item mode
  11445. Specify the mode of the interlacing. This option can also be specified
  11446. as a value alone. See below for a list of values for this option.
  11447. Available values are:
  11448. @table @samp
  11449. @item merge, 0
  11450. Move odd frames into the upper field, even into the lower field,
  11451. generating a double height frame at half frame rate.
  11452. @example
  11453. ------> time
  11454. Input:
  11455. Frame 1 Frame 2 Frame 3 Frame 4
  11456. 11111 22222 33333 44444
  11457. 11111 22222 33333 44444
  11458. 11111 22222 33333 44444
  11459. 11111 22222 33333 44444
  11460. Output:
  11461. 11111 33333
  11462. 22222 44444
  11463. 11111 33333
  11464. 22222 44444
  11465. 11111 33333
  11466. 22222 44444
  11467. 11111 33333
  11468. 22222 44444
  11469. @end example
  11470. @item drop_even, 1
  11471. Only output odd frames, even frames are dropped, generating a frame with
  11472. unchanged height at half frame rate.
  11473. @example
  11474. ------> time
  11475. Input:
  11476. Frame 1 Frame 2 Frame 3 Frame 4
  11477. 11111 22222 33333 44444
  11478. 11111 22222 33333 44444
  11479. 11111 22222 33333 44444
  11480. 11111 22222 33333 44444
  11481. Output:
  11482. 11111 33333
  11483. 11111 33333
  11484. 11111 33333
  11485. 11111 33333
  11486. @end example
  11487. @item drop_odd, 2
  11488. Only output even frames, odd frames are dropped, generating a frame with
  11489. unchanged height at half frame rate.
  11490. @example
  11491. ------> time
  11492. Input:
  11493. Frame 1 Frame 2 Frame 3 Frame 4
  11494. 11111 22222 33333 44444
  11495. 11111 22222 33333 44444
  11496. 11111 22222 33333 44444
  11497. 11111 22222 33333 44444
  11498. Output:
  11499. 22222 44444
  11500. 22222 44444
  11501. 22222 44444
  11502. 22222 44444
  11503. @end example
  11504. @item pad, 3
  11505. Expand each frame to full height, but pad alternate lines with black,
  11506. generating a frame with double height at the same input frame rate.
  11507. @example
  11508. ------> time
  11509. Input:
  11510. Frame 1 Frame 2 Frame 3 Frame 4
  11511. 11111 22222 33333 44444
  11512. 11111 22222 33333 44444
  11513. 11111 22222 33333 44444
  11514. 11111 22222 33333 44444
  11515. Output:
  11516. 11111 ..... 33333 .....
  11517. ..... 22222 ..... 44444
  11518. 11111 ..... 33333 .....
  11519. ..... 22222 ..... 44444
  11520. 11111 ..... 33333 .....
  11521. ..... 22222 ..... 44444
  11522. 11111 ..... 33333 .....
  11523. ..... 22222 ..... 44444
  11524. @end example
  11525. @item interleave_top, 4
  11526. Interleave the upper field from odd frames with the lower field from
  11527. even frames, generating a frame with unchanged height at half frame rate.
  11528. @example
  11529. ------> time
  11530. Input:
  11531. Frame 1 Frame 2 Frame 3 Frame 4
  11532. 11111<- 22222 33333<- 44444
  11533. 11111 22222<- 33333 44444<-
  11534. 11111<- 22222 33333<- 44444
  11535. 11111 22222<- 33333 44444<-
  11536. Output:
  11537. 11111 33333
  11538. 22222 44444
  11539. 11111 33333
  11540. 22222 44444
  11541. @end example
  11542. @item interleave_bottom, 5
  11543. Interleave the lower field from odd frames with the upper field from
  11544. even frames, generating a frame with unchanged height at half frame rate.
  11545. @example
  11546. ------> time
  11547. Input:
  11548. Frame 1 Frame 2 Frame 3 Frame 4
  11549. 11111 22222<- 33333 44444<-
  11550. 11111<- 22222 33333<- 44444
  11551. 11111 22222<- 33333 44444<-
  11552. 11111<- 22222 33333<- 44444
  11553. Output:
  11554. 22222 44444
  11555. 11111 33333
  11556. 22222 44444
  11557. 11111 33333
  11558. @end example
  11559. @item interlacex2, 6
  11560. Double frame rate with unchanged height. Frames are inserted each
  11561. containing the second temporal field from the previous input frame and
  11562. the first temporal field from the next input frame. This mode relies on
  11563. the top_field_first flag. Useful for interlaced video displays with no
  11564. field synchronisation.
  11565. @example
  11566. ------> time
  11567. Input:
  11568. Frame 1 Frame 2 Frame 3 Frame 4
  11569. 11111 22222 33333 44444
  11570. 11111 22222 33333 44444
  11571. 11111 22222 33333 44444
  11572. 11111 22222 33333 44444
  11573. Output:
  11574. 11111 22222 22222 33333 33333 44444 44444
  11575. 11111 11111 22222 22222 33333 33333 44444
  11576. 11111 22222 22222 33333 33333 44444 44444
  11577. 11111 11111 22222 22222 33333 33333 44444
  11578. @end example
  11579. @item mergex2, 7
  11580. Move odd frames into the upper field, even into the lower field,
  11581. generating a double height frame at same frame rate.
  11582. @example
  11583. ------> time
  11584. Input:
  11585. Frame 1 Frame 2 Frame 3 Frame 4
  11586. 11111 22222 33333 44444
  11587. 11111 22222 33333 44444
  11588. 11111 22222 33333 44444
  11589. 11111 22222 33333 44444
  11590. Output:
  11591. 11111 33333 33333 55555
  11592. 22222 22222 44444 44444
  11593. 11111 33333 33333 55555
  11594. 22222 22222 44444 44444
  11595. 11111 33333 33333 55555
  11596. 22222 22222 44444 44444
  11597. 11111 33333 33333 55555
  11598. 22222 22222 44444 44444
  11599. @end example
  11600. @end table
  11601. Numeric values are deprecated but are accepted for backward
  11602. compatibility reasons.
  11603. Default mode is @code{merge}.
  11604. @item flags
  11605. Specify flags influencing the filter process.
  11606. Available value for @var{flags} is:
  11607. @table @option
  11608. @item low_pass_filter, vlfp
  11609. Enable linear vertical low-pass filtering in the filter.
  11610. Vertical low-pass filtering is required when creating an interlaced
  11611. destination from a progressive source which contains high-frequency
  11612. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11613. patterning.
  11614. @item complex_filter, cvlfp
  11615. Enable complex vertical low-pass filtering.
  11616. This will slightly less reduce interlace 'twitter' and Moire
  11617. patterning but better retain detail and subjective sharpness impression.
  11618. @end table
  11619. Vertical low-pass filtering can only be enabled for @option{mode}
  11620. @var{interleave_top} and @var{interleave_bottom}.
  11621. @end table
  11622. @section tonemap
  11623. Tone map colors from different dynamic ranges.
  11624. This filter expects data in single precision floating point, as it needs to
  11625. operate on (and can output) out-of-range values. Another filter, such as
  11626. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11627. The tonemapping algorithms implemented only work on linear light, so input
  11628. data should be linearized beforehand (and possibly correctly tagged).
  11629. @example
  11630. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11631. @end example
  11632. @subsection Options
  11633. The filter accepts the following options.
  11634. @table @option
  11635. @item tonemap
  11636. Set the tone map algorithm to use.
  11637. Possible values are:
  11638. @table @var
  11639. @item none
  11640. Do not apply any tone map, only desaturate overbright pixels.
  11641. @item clip
  11642. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11643. in-range values, while distorting out-of-range values.
  11644. @item linear
  11645. Stretch the entire reference gamut to a linear multiple of the display.
  11646. @item gamma
  11647. Fit a logarithmic transfer between the tone curves.
  11648. @item reinhard
  11649. Preserve overall image brightness with a simple curve, using nonlinear
  11650. contrast, which results in flattening details and degrading color accuracy.
  11651. @item hable
  11652. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11653. of slightly darkening everything. Use it when detail preservation is more
  11654. important than color and brightness accuracy.
  11655. @item mobius
  11656. Smoothly map out-of-range values, while retaining contrast and colors for
  11657. in-range material as much as possible. Use it when color accuracy is more
  11658. important than detail preservation.
  11659. @end table
  11660. Default is none.
  11661. @item param
  11662. Tune the tone mapping algorithm.
  11663. This affects the following algorithms:
  11664. @table @var
  11665. @item none
  11666. Ignored.
  11667. @item linear
  11668. Specifies the scale factor to use while stretching.
  11669. Default to 1.0.
  11670. @item gamma
  11671. Specifies the exponent of the function.
  11672. Default to 1.8.
  11673. @item clip
  11674. Specify an extra linear coefficient to multiply into the signal before clipping.
  11675. Default to 1.0.
  11676. @item reinhard
  11677. Specify the local contrast coefficient at the display peak.
  11678. Default to 0.5, which means that in-gamut values will be about half as bright
  11679. as when clipping.
  11680. @item hable
  11681. Ignored.
  11682. @item mobius
  11683. Specify the transition point from linear to mobius transform. Every value
  11684. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11685. more accurate the result will be, at the cost of losing bright details.
  11686. Default to 0.3, which due to the steep initial slope still preserves in-range
  11687. colors fairly accurately.
  11688. @end table
  11689. @item desat
  11690. Apply desaturation for highlights that exceed this level of brightness. The
  11691. higher the parameter, the more color information will be preserved. This
  11692. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11693. (smoothly) turning into white instead. This makes images feel more natural,
  11694. at the cost of reducing information about out-of-range colors.
  11695. The default of 2.0 is somewhat conservative and will mostly just apply to
  11696. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11697. This option works only if the input frame has a supported color tag.
  11698. @item peak
  11699. Override signal/nominal/reference peak with this value. Useful when the
  11700. embedded peak information in display metadata is not reliable or when tone
  11701. mapping from a lower range to a higher range.
  11702. @end table
  11703. @section transpose
  11704. Transpose rows with columns in the input video and optionally flip it.
  11705. It accepts the following parameters:
  11706. @table @option
  11707. @item dir
  11708. Specify the transposition direction.
  11709. Can assume the following values:
  11710. @table @samp
  11711. @item 0, 4, cclock_flip
  11712. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11713. @example
  11714. L.R L.l
  11715. . . -> . .
  11716. l.r R.r
  11717. @end example
  11718. @item 1, 5, clock
  11719. Rotate by 90 degrees clockwise, that is:
  11720. @example
  11721. L.R l.L
  11722. . . -> . .
  11723. l.r r.R
  11724. @end example
  11725. @item 2, 6, cclock
  11726. Rotate by 90 degrees counterclockwise, that is:
  11727. @example
  11728. L.R R.r
  11729. . . -> . .
  11730. l.r L.l
  11731. @end example
  11732. @item 3, 7, clock_flip
  11733. Rotate by 90 degrees clockwise and vertically flip, that is:
  11734. @example
  11735. L.R r.R
  11736. . . -> . .
  11737. l.r l.L
  11738. @end example
  11739. @end table
  11740. For values between 4-7, the transposition is only done if the input
  11741. video geometry is portrait and not landscape. These values are
  11742. deprecated, the @code{passthrough} option should be used instead.
  11743. Numerical values are deprecated, and should be dropped in favor of
  11744. symbolic constants.
  11745. @item passthrough
  11746. Do not apply the transposition if the input geometry matches the one
  11747. specified by the specified value. It accepts the following values:
  11748. @table @samp
  11749. @item none
  11750. Always apply transposition.
  11751. @item portrait
  11752. Preserve portrait geometry (when @var{height} >= @var{width}).
  11753. @item landscape
  11754. Preserve landscape geometry (when @var{width} >= @var{height}).
  11755. @end table
  11756. Default value is @code{none}.
  11757. @end table
  11758. For example to rotate by 90 degrees clockwise and preserve portrait
  11759. layout:
  11760. @example
  11761. transpose=dir=1:passthrough=portrait
  11762. @end example
  11763. The command above can also be specified as:
  11764. @example
  11765. transpose=1:portrait
  11766. @end example
  11767. @section trim
  11768. Trim the input so that the output contains one continuous subpart of the input.
  11769. It accepts the following parameters:
  11770. @table @option
  11771. @item start
  11772. Specify the time of the start of the kept section, i.e. the frame with the
  11773. timestamp @var{start} will be the first frame in the output.
  11774. @item end
  11775. Specify the time of the first frame that will be dropped, i.e. the frame
  11776. immediately preceding the one with the timestamp @var{end} will be the last
  11777. frame in the output.
  11778. @item start_pts
  11779. This is the same as @var{start}, except this option sets the start timestamp
  11780. in timebase units instead of seconds.
  11781. @item end_pts
  11782. This is the same as @var{end}, except this option sets the end timestamp
  11783. in timebase units instead of seconds.
  11784. @item duration
  11785. The maximum duration of the output in seconds.
  11786. @item start_frame
  11787. The number of the first frame that should be passed to the output.
  11788. @item end_frame
  11789. The number of the first frame that should be dropped.
  11790. @end table
  11791. @option{start}, @option{end}, and @option{duration} are expressed as time
  11792. duration specifications; see
  11793. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11794. for the accepted syntax.
  11795. Note that the first two sets of the start/end options and the @option{duration}
  11796. option look at the frame timestamp, while the _frame variants simply count the
  11797. frames that pass through the filter. Also note that this filter does not modify
  11798. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11799. setpts filter after the trim filter.
  11800. If multiple start or end options are set, this filter tries to be greedy and
  11801. keep all the frames that match at least one of the specified constraints. To keep
  11802. only the part that matches all the constraints at once, chain multiple trim
  11803. filters.
  11804. The defaults are such that all the input is kept. So it is possible to set e.g.
  11805. just the end values to keep everything before the specified time.
  11806. Examples:
  11807. @itemize
  11808. @item
  11809. Drop everything except the second minute of input:
  11810. @example
  11811. ffmpeg -i INPUT -vf trim=60:120
  11812. @end example
  11813. @item
  11814. Keep only the first second:
  11815. @example
  11816. ffmpeg -i INPUT -vf trim=duration=1
  11817. @end example
  11818. @end itemize
  11819. @section unpremultiply
  11820. Apply alpha unpremultiply effect to input video stream using first plane
  11821. of second stream as alpha.
  11822. Both streams must have same dimensions and same pixel format.
  11823. The filter accepts the following option:
  11824. @table @option
  11825. @item planes
  11826. Set which planes will be processed, unprocessed planes will be copied.
  11827. By default value 0xf, all planes will be processed.
  11828. If the format has 1 or 2 components, then luma is bit 0.
  11829. If the format has 3 or 4 components:
  11830. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11831. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11832. If present, the alpha channel is always the last bit.
  11833. @item inplace
  11834. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11835. @end table
  11836. @anchor{unsharp}
  11837. @section unsharp
  11838. Sharpen or blur the input video.
  11839. It accepts the following parameters:
  11840. @table @option
  11841. @item luma_msize_x, lx
  11842. Set the luma matrix horizontal size. It must be an odd integer between
  11843. 3 and 23. The default value is 5.
  11844. @item luma_msize_y, ly
  11845. Set the luma matrix vertical size. It must be an odd integer between 3
  11846. and 23. The default value is 5.
  11847. @item luma_amount, la
  11848. Set the luma effect strength. It must be a floating point number, reasonable
  11849. values lay between -1.5 and 1.5.
  11850. Negative values will blur the input video, while positive values will
  11851. sharpen it, a value of zero will disable the effect.
  11852. Default value is 1.0.
  11853. @item chroma_msize_x, cx
  11854. Set the chroma matrix horizontal size. It must be an odd integer
  11855. between 3 and 23. The default value is 5.
  11856. @item chroma_msize_y, cy
  11857. Set the chroma matrix vertical size. It must be an odd integer
  11858. between 3 and 23. The default value is 5.
  11859. @item chroma_amount, ca
  11860. Set the chroma effect strength. It must be a floating point number, reasonable
  11861. values lay between -1.5 and 1.5.
  11862. Negative values will blur the input video, while positive values will
  11863. sharpen it, a value of zero will disable the effect.
  11864. Default value is 0.0.
  11865. @end table
  11866. All parameters are optional and default to the equivalent of the
  11867. string '5:5:1.0:5:5:0.0'.
  11868. @subsection Examples
  11869. @itemize
  11870. @item
  11871. Apply strong luma sharpen effect:
  11872. @example
  11873. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11874. @end example
  11875. @item
  11876. Apply a strong blur of both luma and chroma parameters:
  11877. @example
  11878. unsharp=7:7:-2:7:7:-2
  11879. @end example
  11880. @end itemize
  11881. @section uspp
  11882. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11883. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11884. shifts and average the results.
  11885. The way this differs from the behavior of spp is that uspp actually encodes &
  11886. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11887. DCT similar to MJPEG.
  11888. The filter accepts the following options:
  11889. @table @option
  11890. @item quality
  11891. Set quality. This option defines the number of levels for averaging. It accepts
  11892. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11893. effect. A value of @code{8} means the higher quality. For each increment of
  11894. that value the speed drops by a factor of approximately 2. Default value is
  11895. @code{3}.
  11896. @item qp
  11897. Force a constant quantization parameter. If not set, the filter will use the QP
  11898. from the video stream (if available).
  11899. @end table
  11900. @section vaguedenoiser
  11901. Apply a wavelet based denoiser.
  11902. It transforms each frame from the video input into the wavelet domain,
  11903. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11904. the obtained coefficients. It does an inverse wavelet transform after.
  11905. Due to wavelet properties, it should give a nice smoothed result, and
  11906. reduced noise, without blurring picture features.
  11907. This filter accepts the following options:
  11908. @table @option
  11909. @item threshold
  11910. The filtering strength. The higher, the more filtered the video will be.
  11911. Hard thresholding can use a higher threshold than soft thresholding
  11912. before the video looks overfiltered. Default value is 2.
  11913. @item method
  11914. The filtering method the filter will use.
  11915. It accepts the following values:
  11916. @table @samp
  11917. @item hard
  11918. All values under the threshold will be zeroed.
  11919. @item soft
  11920. All values under the threshold will be zeroed. All values above will be
  11921. reduced by the threshold.
  11922. @item garrote
  11923. Scales or nullifies coefficients - intermediary between (more) soft and
  11924. (less) hard thresholding.
  11925. @end table
  11926. Default is garrote.
  11927. @item nsteps
  11928. Number of times, the wavelet will decompose the picture. Picture can't
  11929. be decomposed beyond a particular point (typically, 8 for a 640x480
  11930. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11931. @item percent
  11932. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11933. @item planes
  11934. A list of the planes to process. By default all planes are processed.
  11935. @end table
  11936. @section vectorscope
  11937. Display 2 color component values in the two dimensional graph (which is called
  11938. a vectorscope).
  11939. This filter accepts the following options:
  11940. @table @option
  11941. @item mode, m
  11942. Set vectorscope mode.
  11943. It accepts the following values:
  11944. @table @samp
  11945. @item gray
  11946. Gray values are displayed on graph, higher brightness means more pixels have
  11947. same component color value on location in graph. This is the default mode.
  11948. @item color
  11949. Gray values are displayed on graph. Surrounding pixels values which are not
  11950. present in video frame are drawn in gradient of 2 color components which are
  11951. set by option @code{x} and @code{y}. The 3rd color component is static.
  11952. @item color2
  11953. Actual color components values present in video frame are displayed on graph.
  11954. @item color3
  11955. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11956. on graph increases value of another color component, which is luminance by
  11957. default values of @code{x} and @code{y}.
  11958. @item color4
  11959. Actual colors present in video frame are displayed on graph. If two different
  11960. colors map to same position on graph then color with higher value of component
  11961. not present in graph is picked.
  11962. @item color5
  11963. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11964. component picked from radial gradient.
  11965. @end table
  11966. @item x
  11967. Set which color component will be represented on X-axis. Default is @code{1}.
  11968. @item y
  11969. Set which color component will be represented on Y-axis. Default is @code{2}.
  11970. @item intensity, i
  11971. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11972. of color component which represents frequency of (X, Y) location in graph.
  11973. @item envelope, e
  11974. @table @samp
  11975. @item none
  11976. No envelope, this is default.
  11977. @item instant
  11978. Instant envelope, even darkest single pixel will be clearly highlighted.
  11979. @item peak
  11980. Hold maximum and minimum values presented in graph over time. This way you
  11981. can still spot out of range values without constantly looking at vectorscope.
  11982. @item peak+instant
  11983. Peak and instant envelope combined together.
  11984. @end table
  11985. @item graticule, g
  11986. Set what kind of graticule to draw.
  11987. @table @samp
  11988. @item none
  11989. @item green
  11990. @item color
  11991. @end table
  11992. @item opacity, o
  11993. Set graticule opacity.
  11994. @item flags, f
  11995. Set graticule flags.
  11996. @table @samp
  11997. @item white
  11998. Draw graticule for white point.
  11999. @item black
  12000. Draw graticule for black point.
  12001. @item name
  12002. Draw color points short names.
  12003. @end table
  12004. @item bgopacity, b
  12005. Set background opacity.
  12006. @item lthreshold, l
  12007. Set low threshold for color component not represented on X or Y axis.
  12008. Values lower than this value will be ignored. Default is 0.
  12009. Note this value is multiplied with actual max possible value one pixel component
  12010. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12011. is 0.1 * 255 = 25.
  12012. @item hthreshold, h
  12013. Set high threshold for color component not represented on X or Y axis.
  12014. Values higher than this value will be ignored. Default is 1.
  12015. Note this value is multiplied with actual max possible value one pixel component
  12016. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12017. is 0.9 * 255 = 230.
  12018. @item colorspace, c
  12019. Set what kind of colorspace to use when drawing graticule.
  12020. @table @samp
  12021. @item auto
  12022. @item 601
  12023. @item 709
  12024. @end table
  12025. Default is auto.
  12026. @end table
  12027. @anchor{vidstabdetect}
  12028. @section vidstabdetect
  12029. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12030. @ref{vidstabtransform} for pass 2.
  12031. This filter generates a file with relative translation and rotation
  12032. transform information about subsequent frames, which is then used by
  12033. the @ref{vidstabtransform} filter.
  12034. To enable compilation of this filter you need to configure FFmpeg with
  12035. @code{--enable-libvidstab}.
  12036. This filter accepts the following options:
  12037. @table @option
  12038. @item result
  12039. Set the path to the file used to write the transforms information.
  12040. Default value is @file{transforms.trf}.
  12041. @item shakiness
  12042. Set how shaky the video is and how quick the camera is. It accepts an
  12043. integer in the range 1-10, a value of 1 means little shakiness, a
  12044. value of 10 means strong shakiness. Default value is 5.
  12045. @item accuracy
  12046. Set the accuracy of the detection process. It must be a value in the
  12047. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12048. accuracy. Default value is 15.
  12049. @item stepsize
  12050. Set stepsize of the search process. The region around minimum is
  12051. scanned with 1 pixel resolution. Default value is 6.
  12052. @item mincontrast
  12053. Set minimum contrast. Below this value a local measurement field is
  12054. discarded. Must be a floating point value in the range 0-1. Default
  12055. value is 0.3.
  12056. @item tripod
  12057. Set reference frame number for tripod mode.
  12058. If enabled, the motion of the frames is compared to a reference frame
  12059. in the filtered stream, identified by the specified number. The idea
  12060. is to compensate all movements in a more-or-less static scene and keep
  12061. the camera view absolutely still.
  12062. If set to 0, it is disabled. The frames are counted starting from 1.
  12063. @item show
  12064. Show fields and transforms in the resulting frames. It accepts an
  12065. integer in the range 0-2. Default value is 0, which disables any
  12066. visualization.
  12067. @end table
  12068. @subsection Examples
  12069. @itemize
  12070. @item
  12071. Use default values:
  12072. @example
  12073. vidstabdetect
  12074. @end example
  12075. @item
  12076. Analyze strongly shaky movie and put the results in file
  12077. @file{mytransforms.trf}:
  12078. @example
  12079. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12080. @end example
  12081. @item
  12082. Visualize the result of internal transformations in the resulting
  12083. video:
  12084. @example
  12085. vidstabdetect=show=1
  12086. @end example
  12087. @item
  12088. Analyze a video with medium shakiness using @command{ffmpeg}:
  12089. @example
  12090. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12091. @end example
  12092. @end itemize
  12093. @anchor{vidstabtransform}
  12094. @section vidstabtransform
  12095. Video stabilization/deshaking: pass 2 of 2,
  12096. see @ref{vidstabdetect} for pass 1.
  12097. Read a file with transform information for each frame and
  12098. apply/compensate them. Together with the @ref{vidstabdetect}
  12099. filter this can be used to deshake videos. See also
  12100. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12101. the @ref{unsharp} filter, see below.
  12102. To enable compilation of this filter you need to configure FFmpeg with
  12103. @code{--enable-libvidstab}.
  12104. @subsection Options
  12105. @table @option
  12106. @item input
  12107. Set path to the file used to read the transforms. Default value is
  12108. @file{transforms.trf}.
  12109. @item smoothing
  12110. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12111. camera movements. Default value is 10.
  12112. For example a number of 10 means that 21 frames are used (10 in the
  12113. past and 10 in the future) to smoothen the motion in the video. A
  12114. larger value leads to a smoother video, but limits the acceleration of
  12115. the camera (pan/tilt movements). 0 is a special case where a static
  12116. camera is simulated.
  12117. @item optalgo
  12118. Set the camera path optimization algorithm.
  12119. Accepted values are:
  12120. @table @samp
  12121. @item gauss
  12122. gaussian kernel low-pass filter on camera motion (default)
  12123. @item avg
  12124. averaging on transformations
  12125. @end table
  12126. @item maxshift
  12127. Set maximal number of pixels to translate frames. Default value is -1,
  12128. meaning no limit.
  12129. @item maxangle
  12130. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12131. value is -1, meaning no limit.
  12132. @item crop
  12133. Specify how to deal with borders that may be visible due to movement
  12134. compensation.
  12135. Available values are:
  12136. @table @samp
  12137. @item keep
  12138. keep image information from previous frame (default)
  12139. @item black
  12140. fill the border black
  12141. @end table
  12142. @item invert
  12143. Invert transforms if set to 1. Default value is 0.
  12144. @item relative
  12145. Consider transforms as relative to previous frame if set to 1,
  12146. absolute if set to 0. Default value is 0.
  12147. @item zoom
  12148. Set percentage to zoom. A positive value will result in a zoom-in
  12149. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12150. zoom).
  12151. @item optzoom
  12152. Set optimal zooming to avoid borders.
  12153. Accepted values are:
  12154. @table @samp
  12155. @item 0
  12156. disabled
  12157. @item 1
  12158. optimal static zoom value is determined (only very strong movements
  12159. will lead to visible borders) (default)
  12160. @item 2
  12161. optimal adaptive zoom value is determined (no borders will be
  12162. visible), see @option{zoomspeed}
  12163. @end table
  12164. Note that the value given at zoom is added to the one calculated here.
  12165. @item zoomspeed
  12166. Set percent to zoom maximally each frame (enabled when
  12167. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12168. 0.25.
  12169. @item interpol
  12170. Specify type of interpolation.
  12171. Available values are:
  12172. @table @samp
  12173. @item no
  12174. no interpolation
  12175. @item linear
  12176. linear only horizontal
  12177. @item bilinear
  12178. linear in both directions (default)
  12179. @item bicubic
  12180. cubic in both directions (slow)
  12181. @end table
  12182. @item tripod
  12183. Enable virtual tripod mode if set to 1, which is equivalent to
  12184. @code{relative=0:smoothing=0}. Default value is 0.
  12185. Use also @code{tripod} option of @ref{vidstabdetect}.
  12186. @item debug
  12187. Increase log verbosity if set to 1. Also the detected global motions
  12188. are written to the temporary file @file{global_motions.trf}. Default
  12189. value is 0.
  12190. @end table
  12191. @subsection Examples
  12192. @itemize
  12193. @item
  12194. Use @command{ffmpeg} for a typical stabilization with default values:
  12195. @example
  12196. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12197. @end example
  12198. Note the use of the @ref{unsharp} filter which is always recommended.
  12199. @item
  12200. Zoom in a bit more and load transform data from a given file:
  12201. @example
  12202. vidstabtransform=zoom=5:input="mytransforms.trf"
  12203. @end example
  12204. @item
  12205. Smoothen the video even more:
  12206. @example
  12207. vidstabtransform=smoothing=30
  12208. @end example
  12209. @end itemize
  12210. @section vflip
  12211. Flip the input video vertically.
  12212. For example, to vertically flip a video with @command{ffmpeg}:
  12213. @example
  12214. ffmpeg -i in.avi -vf "vflip" out.avi
  12215. @end example
  12216. @anchor{vignette}
  12217. @section vignette
  12218. Make or reverse a natural vignetting effect.
  12219. The filter accepts the following options:
  12220. @table @option
  12221. @item angle, a
  12222. Set lens angle expression as a number of radians.
  12223. The value is clipped in the @code{[0,PI/2]} range.
  12224. Default value: @code{"PI/5"}
  12225. @item x0
  12226. @item y0
  12227. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12228. by default.
  12229. @item mode
  12230. Set forward/backward mode.
  12231. Available modes are:
  12232. @table @samp
  12233. @item forward
  12234. The larger the distance from the central point, the darker the image becomes.
  12235. @item backward
  12236. The larger the distance from the central point, the brighter the image becomes.
  12237. This can be used to reverse a vignette effect, though there is no automatic
  12238. detection to extract the lens @option{angle} and other settings (yet). It can
  12239. also be used to create a burning effect.
  12240. @end table
  12241. Default value is @samp{forward}.
  12242. @item eval
  12243. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12244. It accepts the following values:
  12245. @table @samp
  12246. @item init
  12247. Evaluate expressions only once during the filter initialization.
  12248. @item frame
  12249. Evaluate expressions for each incoming frame. This is way slower than the
  12250. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12251. allows advanced dynamic expressions.
  12252. @end table
  12253. Default value is @samp{init}.
  12254. @item dither
  12255. Set dithering to reduce the circular banding effects. Default is @code{1}
  12256. (enabled).
  12257. @item aspect
  12258. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12259. Setting this value to the SAR of the input will make a rectangular vignetting
  12260. following the dimensions of the video.
  12261. Default is @code{1/1}.
  12262. @end table
  12263. @subsection Expressions
  12264. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12265. following parameters.
  12266. @table @option
  12267. @item w
  12268. @item h
  12269. input width and height
  12270. @item n
  12271. the number of input frame, starting from 0
  12272. @item pts
  12273. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12274. @var{TB} units, NAN if undefined
  12275. @item r
  12276. frame rate of the input video, NAN if the input frame rate is unknown
  12277. @item t
  12278. the PTS (Presentation TimeStamp) of the filtered video frame,
  12279. expressed in seconds, NAN if undefined
  12280. @item tb
  12281. time base of the input video
  12282. @end table
  12283. @subsection Examples
  12284. @itemize
  12285. @item
  12286. Apply simple strong vignetting effect:
  12287. @example
  12288. vignette=PI/4
  12289. @end example
  12290. @item
  12291. Make a flickering vignetting:
  12292. @example
  12293. vignette='PI/4+random(1)*PI/50':eval=frame
  12294. @end example
  12295. @end itemize
  12296. @section vmafmotion
  12297. Obtain the average vmaf motion score of a video.
  12298. It is one of the component filters of VMAF.
  12299. The obtained average motion score is printed through the logging system.
  12300. In the below example the input file @file{ref.mpg} is being processed and score
  12301. is computed.
  12302. @example
  12303. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12304. @end example
  12305. @section vstack
  12306. Stack input videos vertically.
  12307. All streams must be of same pixel format and of same width.
  12308. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12309. to create same output.
  12310. The filter accept the following option:
  12311. @table @option
  12312. @item inputs
  12313. Set number of input streams. Default is 2.
  12314. @item shortest
  12315. If set to 1, force the output to terminate when the shortest input
  12316. terminates. Default value is 0.
  12317. @end table
  12318. @section w3fdif
  12319. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12320. Deinterlacing Filter").
  12321. Based on the process described by Martin Weston for BBC R&D, and
  12322. implemented based on the de-interlace algorithm written by Jim
  12323. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12324. uses filter coefficients calculated by BBC R&D.
  12325. There are two sets of filter coefficients, so called "simple":
  12326. and "complex". Which set of filter coefficients is used can
  12327. be set by passing an optional parameter:
  12328. @table @option
  12329. @item filter
  12330. Set the interlacing filter coefficients. Accepts one of the following values:
  12331. @table @samp
  12332. @item simple
  12333. Simple filter coefficient set.
  12334. @item complex
  12335. More-complex filter coefficient set.
  12336. @end table
  12337. Default value is @samp{complex}.
  12338. @item deint
  12339. Specify which frames to deinterlace. Accept one of the following values:
  12340. @table @samp
  12341. @item all
  12342. Deinterlace all frames,
  12343. @item interlaced
  12344. Only deinterlace frames marked as interlaced.
  12345. @end table
  12346. Default value is @samp{all}.
  12347. @end table
  12348. @section waveform
  12349. Video waveform monitor.
  12350. The waveform monitor plots color component intensity. By default luminance
  12351. only. Each column of the waveform corresponds to a column of pixels in the
  12352. source video.
  12353. It accepts the following options:
  12354. @table @option
  12355. @item mode, m
  12356. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12357. In row mode, the graph on the left side represents color component value 0 and
  12358. the right side represents value = 255. In column mode, the top side represents
  12359. color component value = 0 and bottom side represents value = 255.
  12360. @item intensity, i
  12361. Set intensity. Smaller values are useful to find out how many values of the same
  12362. luminance are distributed across input rows/columns.
  12363. Default value is @code{0.04}. Allowed range is [0, 1].
  12364. @item mirror, r
  12365. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12366. In mirrored mode, higher values will be represented on the left
  12367. side for @code{row} mode and at the top for @code{column} mode. Default is
  12368. @code{1} (mirrored).
  12369. @item display, d
  12370. Set display mode.
  12371. It accepts the following values:
  12372. @table @samp
  12373. @item overlay
  12374. Presents information identical to that in the @code{parade}, except
  12375. that the graphs representing color components are superimposed directly
  12376. over one another.
  12377. This display mode makes it easier to spot relative differences or similarities
  12378. in overlapping areas of the color components that are supposed to be identical,
  12379. such as neutral whites, grays, or blacks.
  12380. @item stack
  12381. Display separate graph for the color components side by side in
  12382. @code{row} mode or one below the other in @code{column} mode.
  12383. @item parade
  12384. Display separate graph for the color components side by side in
  12385. @code{column} mode or one below the other in @code{row} mode.
  12386. Using this display mode makes it easy to spot color casts in the highlights
  12387. and shadows of an image, by comparing the contours of the top and the bottom
  12388. graphs of each waveform. Since whites, grays, and blacks are characterized
  12389. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12390. should display three waveforms of roughly equal width/height. If not, the
  12391. correction is easy to perform by making level adjustments the three waveforms.
  12392. @end table
  12393. Default is @code{stack}.
  12394. @item components, c
  12395. Set which color components to display. Default is 1, which means only luminance
  12396. or red color component if input is in RGB colorspace. If is set for example to
  12397. 7 it will display all 3 (if) available color components.
  12398. @item envelope, e
  12399. @table @samp
  12400. @item none
  12401. No envelope, this is default.
  12402. @item instant
  12403. Instant envelope, minimum and maximum values presented in graph will be easily
  12404. visible even with small @code{step} value.
  12405. @item peak
  12406. Hold minimum and maximum values presented in graph across time. This way you
  12407. can still spot out of range values without constantly looking at waveforms.
  12408. @item peak+instant
  12409. Peak and instant envelope combined together.
  12410. @end table
  12411. @item filter, f
  12412. @table @samp
  12413. @item lowpass
  12414. No filtering, this is default.
  12415. @item flat
  12416. Luma and chroma combined together.
  12417. @item aflat
  12418. Similar as above, but shows difference between blue and red chroma.
  12419. @item chroma
  12420. Displays only chroma.
  12421. @item color
  12422. Displays actual color value on waveform.
  12423. @item acolor
  12424. Similar as above, but with luma showing frequency of chroma values.
  12425. @end table
  12426. @item graticule, g
  12427. Set which graticule to display.
  12428. @table @samp
  12429. @item none
  12430. Do not display graticule.
  12431. @item green
  12432. Display green graticule showing legal broadcast ranges.
  12433. @end table
  12434. @item opacity, o
  12435. Set graticule opacity.
  12436. @item flags, fl
  12437. Set graticule flags.
  12438. @table @samp
  12439. @item numbers
  12440. Draw numbers above lines. By default enabled.
  12441. @item dots
  12442. Draw dots instead of lines.
  12443. @end table
  12444. @item scale, s
  12445. Set scale used for displaying graticule.
  12446. @table @samp
  12447. @item digital
  12448. @item millivolts
  12449. @item ire
  12450. @end table
  12451. Default is digital.
  12452. @item bgopacity, b
  12453. Set background opacity.
  12454. @end table
  12455. @section weave, doubleweave
  12456. The @code{weave} takes a field-based video input and join
  12457. each two sequential fields into single frame, producing a new double
  12458. height clip with half the frame rate and half the frame count.
  12459. The @code{doubleweave} works same as @code{weave} but without
  12460. halving frame rate and frame count.
  12461. It accepts the following option:
  12462. @table @option
  12463. @item first_field
  12464. Set first field. Available values are:
  12465. @table @samp
  12466. @item top, t
  12467. Set the frame as top-field-first.
  12468. @item bottom, b
  12469. Set the frame as bottom-field-first.
  12470. @end table
  12471. @end table
  12472. @subsection Examples
  12473. @itemize
  12474. @item
  12475. Interlace video using @ref{select} and @ref{separatefields} filter:
  12476. @example
  12477. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12478. @end example
  12479. @end itemize
  12480. @section xbr
  12481. Apply the xBR high-quality magnification filter which is designed for pixel
  12482. art. It follows a set of edge-detection rules, see
  12483. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12484. It accepts the following option:
  12485. @table @option
  12486. @item n
  12487. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12488. @code{3xBR} and @code{4} for @code{4xBR}.
  12489. Default is @code{3}.
  12490. @end table
  12491. @anchor{yadif}
  12492. @section yadif
  12493. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12494. filter").
  12495. It accepts the following parameters:
  12496. @table @option
  12497. @item mode
  12498. The interlacing mode to adopt. It accepts one of the following values:
  12499. @table @option
  12500. @item 0, send_frame
  12501. Output one frame for each frame.
  12502. @item 1, send_field
  12503. Output one frame for each field.
  12504. @item 2, send_frame_nospatial
  12505. Like @code{send_frame}, but it skips the spatial interlacing check.
  12506. @item 3, send_field_nospatial
  12507. Like @code{send_field}, but it skips the spatial interlacing check.
  12508. @end table
  12509. The default value is @code{send_frame}.
  12510. @item parity
  12511. The picture field parity assumed for the input interlaced video. It accepts one
  12512. of the following values:
  12513. @table @option
  12514. @item 0, tff
  12515. Assume the top field is first.
  12516. @item 1, bff
  12517. Assume the bottom field is first.
  12518. @item -1, auto
  12519. Enable automatic detection of field parity.
  12520. @end table
  12521. The default value is @code{auto}.
  12522. If the interlacing is unknown or the decoder does not export this information,
  12523. top field first will be assumed.
  12524. @item deint
  12525. Specify which frames to deinterlace. Accept one of the following
  12526. values:
  12527. @table @option
  12528. @item 0, all
  12529. Deinterlace all frames.
  12530. @item 1, interlaced
  12531. Only deinterlace frames marked as interlaced.
  12532. @end table
  12533. The default value is @code{all}.
  12534. @end table
  12535. @section zoompan
  12536. Apply Zoom & Pan effect.
  12537. This filter accepts the following options:
  12538. @table @option
  12539. @item zoom, z
  12540. Set the zoom expression. Default is 1.
  12541. @item x
  12542. @item y
  12543. Set the x and y expression. Default is 0.
  12544. @item d
  12545. Set the duration expression in number of frames.
  12546. This sets for how many number of frames effect will last for
  12547. single input image.
  12548. @item s
  12549. Set the output image size, default is 'hd720'.
  12550. @item fps
  12551. Set the output frame rate, default is '25'.
  12552. @end table
  12553. Each expression can contain the following constants:
  12554. @table @option
  12555. @item in_w, iw
  12556. Input width.
  12557. @item in_h, ih
  12558. Input height.
  12559. @item out_w, ow
  12560. Output width.
  12561. @item out_h, oh
  12562. Output height.
  12563. @item in
  12564. Input frame count.
  12565. @item on
  12566. Output frame count.
  12567. @item x
  12568. @item y
  12569. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12570. for current input frame.
  12571. @item px
  12572. @item py
  12573. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12574. not yet such frame (first input frame).
  12575. @item zoom
  12576. Last calculated zoom from 'z' expression for current input frame.
  12577. @item pzoom
  12578. Last calculated zoom of last output frame of previous input frame.
  12579. @item duration
  12580. Number of output frames for current input frame. Calculated from 'd' expression
  12581. for each input frame.
  12582. @item pduration
  12583. number of output frames created for previous input frame
  12584. @item a
  12585. Rational number: input width / input height
  12586. @item sar
  12587. sample aspect ratio
  12588. @item dar
  12589. display aspect ratio
  12590. @end table
  12591. @subsection Examples
  12592. @itemize
  12593. @item
  12594. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12595. @example
  12596. 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
  12597. @end example
  12598. @item
  12599. Zoom-in up to 1.5 and pan always at center of picture:
  12600. @example
  12601. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12602. @end example
  12603. @item
  12604. Same as above but without pausing:
  12605. @example
  12606. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12607. @end example
  12608. @end itemize
  12609. @anchor{zscale}
  12610. @section zscale
  12611. Scale (resize) the input video, using the z.lib library:
  12612. https://github.com/sekrit-twc/zimg.
  12613. The zscale filter forces the output display aspect ratio to be the same
  12614. as the input, by changing the output sample aspect ratio.
  12615. If the input image format is different from the format requested by
  12616. the next filter, the zscale filter will convert the input to the
  12617. requested format.
  12618. @subsection Options
  12619. The filter accepts the following options.
  12620. @table @option
  12621. @item width, w
  12622. @item height, h
  12623. Set the output video dimension expression. Default value is the input
  12624. dimension.
  12625. If the @var{width} or @var{w} value is 0, the input width is used for
  12626. the output. If the @var{height} or @var{h} value is 0, the input height
  12627. is used for the output.
  12628. If one and only one of the values is -n with n >= 1, the zscale filter
  12629. will use a value that maintains the aspect ratio of the input image,
  12630. calculated from the other specified dimension. After that it will,
  12631. however, make sure that the calculated dimension is divisible by n and
  12632. adjust the value if necessary.
  12633. If both values are -n with n >= 1, the behavior will be identical to
  12634. both values being set to 0 as previously detailed.
  12635. See below for the list of accepted constants for use in the dimension
  12636. expression.
  12637. @item size, s
  12638. Set the video size. For the syntax of this option, check the
  12639. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12640. @item dither, d
  12641. Set the dither type.
  12642. Possible values are:
  12643. @table @var
  12644. @item none
  12645. @item ordered
  12646. @item random
  12647. @item error_diffusion
  12648. @end table
  12649. Default is none.
  12650. @item filter, f
  12651. Set the resize filter type.
  12652. Possible values are:
  12653. @table @var
  12654. @item point
  12655. @item bilinear
  12656. @item bicubic
  12657. @item spline16
  12658. @item spline36
  12659. @item lanczos
  12660. @end table
  12661. Default is bilinear.
  12662. @item range, r
  12663. Set the color range.
  12664. Possible values are:
  12665. @table @var
  12666. @item input
  12667. @item limited
  12668. @item full
  12669. @end table
  12670. Default is same as input.
  12671. @item primaries, p
  12672. Set the color primaries.
  12673. Possible values are:
  12674. @table @var
  12675. @item input
  12676. @item 709
  12677. @item unspecified
  12678. @item 170m
  12679. @item 240m
  12680. @item 2020
  12681. @end table
  12682. Default is same as input.
  12683. @item transfer, t
  12684. Set the transfer characteristics.
  12685. Possible values are:
  12686. @table @var
  12687. @item input
  12688. @item 709
  12689. @item unspecified
  12690. @item 601
  12691. @item linear
  12692. @item 2020_10
  12693. @item 2020_12
  12694. @item smpte2084
  12695. @item iec61966-2-1
  12696. @item arib-std-b67
  12697. @end table
  12698. Default is same as input.
  12699. @item matrix, m
  12700. Set the colorspace matrix.
  12701. Possible value are:
  12702. @table @var
  12703. @item input
  12704. @item 709
  12705. @item unspecified
  12706. @item 470bg
  12707. @item 170m
  12708. @item 2020_ncl
  12709. @item 2020_cl
  12710. @end table
  12711. Default is same as input.
  12712. @item rangein, rin
  12713. Set the input color range.
  12714. Possible values are:
  12715. @table @var
  12716. @item input
  12717. @item limited
  12718. @item full
  12719. @end table
  12720. Default is same as input.
  12721. @item primariesin, pin
  12722. Set the input color primaries.
  12723. Possible values are:
  12724. @table @var
  12725. @item input
  12726. @item 709
  12727. @item unspecified
  12728. @item 170m
  12729. @item 240m
  12730. @item 2020
  12731. @end table
  12732. Default is same as input.
  12733. @item transferin, tin
  12734. Set the input transfer characteristics.
  12735. Possible values are:
  12736. @table @var
  12737. @item input
  12738. @item 709
  12739. @item unspecified
  12740. @item 601
  12741. @item linear
  12742. @item 2020_10
  12743. @item 2020_12
  12744. @end table
  12745. Default is same as input.
  12746. @item matrixin, min
  12747. Set the input colorspace matrix.
  12748. Possible value are:
  12749. @table @var
  12750. @item input
  12751. @item 709
  12752. @item unspecified
  12753. @item 470bg
  12754. @item 170m
  12755. @item 2020_ncl
  12756. @item 2020_cl
  12757. @end table
  12758. @item chromal, c
  12759. Set the output chroma location.
  12760. Possible values are:
  12761. @table @var
  12762. @item input
  12763. @item left
  12764. @item center
  12765. @item topleft
  12766. @item top
  12767. @item bottomleft
  12768. @item bottom
  12769. @end table
  12770. @item chromalin, cin
  12771. Set the input chroma location.
  12772. Possible values are:
  12773. @table @var
  12774. @item input
  12775. @item left
  12776. @item center
  12777. @item topleft
  12778. @item top
  12779. @item bottomleft
  12780. @item bottom
  12781. @end table
  12782. @item npl
  12783. Set the nominal peak luminance.
  12784. @end table
  12785. The values of the @option{w} and @option{h} options are expressions
  12786. containing the following constants:
  12787. @table @var
  12788. @item in_w
  12789. @item in_h
  12790. The input width and height
  12791. @item iw
  12792. @item ih
  12793. These are the same as @var{in_w} and @var{in_h}.
  12794. @item out_w
  12795. @item out_h
  12796. The output (scaled) width and height
  12797. @item ow
  12798. @item oh
  12799. These are the same as @var{out_w} and @var{out_h}
  12800. @item a
  12801. The same as @var{iw} / @var{ih}
  12802. @item sar
  12803. input sample aspect ratio
  12804. @item dar
  12805. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12806. @item hsub
  12807. @item vsub
  12808. horizontal and vertical input chroma subsample values. For example for the
  12809. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12810. @item ohsub
  12811. @item ovsub
  12812. horizontal and vertical output chroma subsample values. For example for the
  12813. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12814. @end table
  12815. @table @option
  12816. @end table
  12817. @c man end VIDEO FILTERS
  12818. @chapter Video Sources
  12819. @c man begin VIDEO SOURCES
  12820. Below is a description of the currently available video sources.
  12821. @section buffer
  12822. Buffer video frames, and make them available to the filter chain.
  12823. This source is mainly intended for a programmatic use, in particular
  12824. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12825. It accepts the following parameters:
  12826. @table @option
  12827. @item video_size
  12828. Specify the size (width and height) of the buffered video frames. For the
  12829. syntax of this option, check the
  12830. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12831. @item width
  12832. The input video width.
  12833. @item height
  12834. The input video height.
  12835. @item pix_fmt
  12836. A string representing the pixel format of the buffered video frames.
  12837. It may be a number corresponding to a pixel format, or a pixel format
  12838. name.
  12839. @item time_base
  12840. Specify the timebase assumed by the timestamps of the buffered frames.
  12841. @item frame_rate
  12842. Specify the frame rate expected for the video stream.
  12843. @item pixel_aspect, sar
  12844. The sample (pixel) aspect ratio of the input video.
  12845. @item sws_param
  12846. Specify the optional parameters to be used for the scale filter which
  12847. is automatically inserted when an input change is detected in the
  12848. input size or format.
  12849. @item hw_frames_ctx
  12850. When using a hardware pixel format, this should be a reference to an
  12851. AVHWFramesContext describing input frames.
  12852. @end table
  12853. For example:
  12854. @example
  12855. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12856. @end example
  12857. will instruct the source to accept video frames with size 320x240 and
  12858. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12859. square pixels (1:1 sample aspect ratio).
  12860. Since the pixel format with name "yuv410p" corresponds to the number 6
  12861. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12862. this example corresponds to:
  12863. @example
  12864. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12865. @end example
  12866. Alternatively, the options can be specified as a flat string, but this
  12867. syntax is deprecated:
  12868. @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}]
  12869. @section cellauto
  12870. Create a pattern generated by an elementary cellular automaton.
  12871. The initial state of the cellular automaton can be defined through the
  12872. @option{filename} and @option{pattern} options. If such options are
  12873. not specified an initial state is created randomly.
  12874. At each new frame a new row in the video is filled with the result of
  12875. the cellular automaton next generation. The behavior when the whole
  12876. frame is filled is defined by the @option{scroll} option.
  12877. This source accepts the following options:
  12878. @table @option
  12879. @item filename, f
  12880. Read the initial cellular automaton state, i.e. the starting row, from
  12881. the specified file.
  12882. In the file, each non-whitespace character is considered an alive
  12883. cell, a newline will terminate the row, and further characters in the
  12884. file will be ignored.
  12885. @item pattern, p
  12886. Read the initial cellular automaton state, i.e. the starting row, from
  12887. the specified string.
  12888. Each non-whitespace character in the string is considered an alive
  12889. cell, a newline will terminate the row, and further characters in the
  12890. string will be ignored.
  12891. @item rate, r
  12892. Set the video rate, that is the number of frames generated per second.
  12893. Default is 25.
  12894. @item random_fill_ratio, ratio
  12895. Set the random fill ratio for the initial cellular automaton row. It
  12896. is a floating point number value ranging from 0 to 1, defaults to
  12897. 1/PHI.
  12898. This option is ignored when a file or a pattern is specified.
  12899. @item random_seed, seed
  12900. Set the seed for filling randomly the initial row, must be an integer
  12901. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12902. set to -1, the filter will try to use a good random seed on a best
  12903. effort basis.
  12904. @item rule
  12905. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12906. Default value is 110.
  12907. @item size, s
  12908. Set the size of the output video. For the syntax of this option, check the
  12909. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12910. If @option{filename} or @option{pattern} is specified, the size is set
  12911. by default to the width of the specified initial state row, and the
  12912. height is set to @var{width} * PHI.
  12913. If @option{size} is set, it must contain the width of the specified
  12914. pattern string, and the specified pattern will be centered in the
  12915. larger row.
  12916. If a filename or a pattern string is not specified, the size value
  12917. defaults to "320x518" (used for a randomly generated initial state).
  12918. @item scroll
  12919. If set to 1, scroll the output upward when all the rows in the output
  12920. have been already filled. If set to 0, the new generated row will be
  12921. written over the top row just after the bottom row is filled.
  12922. Defaults to 1.
  12923. @item start_full, full
  12924. If set to 1, completely fill the output with generated rows before
  12925. outputting the first frame.
  12926. This is the default behavior, for disabling set the value to 0.
  12927. @item stitch
  12928. If set to 1, stitch the left and right row edges together.
  12929. This is the default behavior, for disabling set the value to 0.
  12930. @end table
  12931. @subsection Examples
  12932. @itemize
  12933. @item
  12934. Read the initial state from @file{pattern}, and specify an output of
  12935. size 200x400.
  12936. @example
  12937. cellauto=f=pattern:s=200x400
  12938. @end example
  12939. @item
  12940. Generate a random initial row with a width of 200 cells, with a fill
  12941. ratio of 2/3:
  12942. @example
  12943. cellauto=ratio=2/3:s=200x200
  12944. @end example
  12945. @item
  12946. Create a pattern generated by rule 18 starting by a single alive cell
  12947. centered on an initial row with width 100:
  12948. @example
  12949. cellauto=p=@@:s=100x400:full=0:rule=18
  12950. @end example
  12951. @item
  12952. Specify a more elaborated initial pattern:
  12953. @example
  12954. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12955. @end example
  12956. @end itemize
  12957. @anchor{coreimagesrc}
  12958. @section coreimagesrc
  12959. Video source generated on GPU using Apple's CoreImage API on OSX.
  12960. This video source is a specialized version of the @ref{coreimage} video filter.
  12961. Use a core image generator at the beginning of the applied filterchain to
  12962. generate the content.
  12963. The coreimagesrc video source accepts the following options:
  12964. @table @option
  12965. @item list_generators
  12966. List all available generators along with all their respective options as well as
  12967. possible minimum and maximum values along with the default values.
  12968. @example
  12969. list_generators=true
  12970. @end example
  12971. @item size, s
  12972. Specify the size of the sourced video. For the syntax of this option, check the
  12973. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12974. The default value is @code{320x240}.
  12975. @item rate, r
  12976. Specify the frame rate of the sourced video, as the number of frames
  12977. generated per second. It has to be a string in the format
  12978. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12979. number or a valid video frame rate abbreviation. The default value is
  12980. "25".
  12981. @item sar
  12982. Set the sample aspect ratio of the sourced video.
  12983. @item duration, d
  12984. Set the duration of the sourced video. See
  12985. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12986. for the accepted syntax.
  12987. If not specified, or the expressed duration is negative, the video is
  12988. supposed to be generated forever.
  12989. @end table
  12990. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12991. A complete filterchain can be used for further processing of the
  12992. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12993. and examples for details.
  12994. @subsection Examples
  12995. @itemize
  12996. @item
  12997. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12998. given as complete and escaped command-line for Apple's standard bash shell:
  12999. @example
  13000. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13001. @end example
  13002. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13003. need for a nullsrc video source.
  13004. @end itemize
  13005. @section mandelbrot
  13006. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13007. point specified with @var{start_x} and @var{start_y}.
  13008. This source accepts the following options:
  13009. @table @option
  13010. @item end_pts
  13011. Set the terminal pts value. Default value is 400.
  13012. @item end_scale
  13013. Set the terminal scale value.
  13014. Must be a floating point value. Default value is 0.3.
  13015. @item inner
  13016. Set the inner coloring mode, that is the algorithm used to draw the
  13017. Mandelbrot fractal internal region.
  13018. It shall assume one of the following values:
  13019. @table @option
  13020. @item black
  13021. Set black mode.
  13022. @item convergence
  13023. Show time until convergence.
  13024. @item mincol
  13025. Set color based on point closest to the origin of the iterations.
  13026. @item period
  13027. Set period mode.
  13028. @end table
  13029. Default value is @var{mincol}.
  13030. @item bailout
  13031. Set the bailout value. Default value is 10.0.
  13032. @item maxiter
  13033. Set the maximum of iterations performed by the rendering
  13034. algorithm. Default value is 7189.
  13035. @item outer
  13036. Set outer coloring mode.
  13037. It shall assume one of following values:
  13038. @table @option
  13039. @item iteration_count
  13040. Set iteration cound mode.
  13041. @item normalized_iteration_count
  13042. set normalized iteration count mode.
  13043. @end table
  13044. Default value is @var{normalized_iteration_count}.
  13045. @item rate, r
  13046. Set frame rate, expressed as number of frames per second. Default
  13047. value is "25".
  13048. @item size, s
  13049. Set frame size. For the syntax of this option, check the "Video
  13050. size" section in the ffmpeg-utils manual. Default value is "640x480".
  13051. @item start_scale
  13052. Set the initial scale value. Default value is 3.0.
  13053. @item start_x
  13054. Set the initial x position. Must be a floating point value between
  13055. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13056. @item start_y
  13057. Set the initial y position. Must be a floating point value between
  13058. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13059. @end table
  13060. @section mptestsrc
  13061. Generate various test patterns, as generated by the MPlayer test filter.
  13062. The size of the generated video is fixed, and is 256x256.
  13063. This source is useful in particular for testing encoding features.
  13064. This source accepts the following options:
  13065. @table @option
  13066. @item rate, r
  13067. Specify the frame rate of the sourced video, as the number of frames
  13068. generated per second. It has to be a string in the format
  13069. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13070. number or a valid video frame rate abbreviation. The default value is
  13071. "25".
  13072. @item duration, d
  13073. Set the duration of the sourced video. See
  13074. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13075. for the accepted syntax.
  13076. If not specified, or the expressed duration is negative, the video is
  13077. supposed to be generated forever.
  13078. @item test, t
  13079. Set the number or the name of the test to perform. Supported tests are:
  13080. @table @option
  13081. @item dc_luma
  13082. @item dc_chroma
  13083. @item freq_luma
  13084. @item freq_chroma
  13085. @item amp_luma
  13086. @item amp_chroma
  13087. @item cbp
  13088. @item mv
  13089. @item ring1
  13090. @item ring2
  13091. @item all
  13092. @end table
  13093. Default value is "all", which will cycle through the list of all tests.
  13094. @end table
  13095. Some examples:
  13096. @example
  13097. mptestsrc=t=dc_luma
  13098. @end example
  13099. will generate a "dc_luma" test pattern.
  13100. @section frei0r_src
  13101. Provide a frei0r source.
  13102. To enable compilation of this filter you need to install the frei0r
  13103. header and configure FFmpeg with @code{--enable-frei0r}.
  13104. This source accepts the following parameters:
  13105. @table @option
  13106. @item size
  13107. The size of the video to generate. For the syntax of this option, check the
  13108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13109. @item framerate
  13110. The framerate of the generated video. It may be a string of the form
  13111. @var{num}/@var{den} or a frame rate abbreviation.
  13112. @item filter_name
  13113. The name to the frei0r source to load. For more information regarding frei0r and
  13114. how to set the parameters, read the @ref{frei0r} section in the video filters
  13115. documentation.
  13116. @item filter_params
  13117. A '|'-separated list of parameters to pass to the frei0r source.
  13118. @end table
  13119. For example, to generate a frei0r partik0l source with size 200x200
  13120. and frame rate 10 which is overlaid on the overlay filter main input:
  13121. @example
  13122. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13123. @end example
  13124. @section life
  13125. Generate a life pattern.
  13126. This source is based on a generalization of John Conway's life game.
  13127. The sourced input represents a life grid, each pixel represents a cell
  13128. which can be in one of two possible states, alive or dead. Every cell
  13129. interacts with its eight neighbours, which are the cells that are
  13130. horizontally, vertically, or diagonally adjacent.
  13131. At each interaction the grid evolves according to the adopted rule,
  13132. which specifies the number of neighbor alive cells which will make a
  13133. cell stay alive or born. The @option{rule} option allows one to specify
  13134. the rule to adopt.
  13135. This source accepts the following options:
  13136. @table @option
  13137. @item filename, f
  13138. Set the file from which to read the initial grid state. In the file,
  13139. each non-whitespace character is considered an alive cell, and newline
  13140. is used to delimit the end of each row.
  13141. If this option is not specified, the initial grid is generated
  13142. randomly.
  13143. @item rate, r
  13144. Set the video rate, that is the number of frames generated per second.
  13145. Default is 25.
  13146. @item random_fill_ratio, ratio
  13147. Set the random fill ratio for the initial random grid. It is a
  13148. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13149. It is ignored when a file is specified.
  13150. @item random_seed, seed
  13151. Set the seed for filling the initial random grid, must be an integer
  13152. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13153. set to -1, the filter will try to use a good random seed on a best
  13154. effort basis.
  13155. @item rule
  13156. Set the life rule.
  13157. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13158. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13159. @var{NS} specifies the number of alive neighbor cells which make a
  13160. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13161. which make a dead cell to become alive (i.e. to "born").
  13162. "s" and "b" can be used in place of "S" and "B", respectively.
  13163. Alternatively a rule can be specified by an 18-bits integer. The 9
  13164. high order bits are used to encode the next cell state if it is alive
  13165. for each number of neighbor alive cells, the low order bits specify
  13166. the rule for "borning" new cells. Higher order bits encode for an
  13167. higher number of neighbor cells.
  13168. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13169. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13170. Default value is "S23/B3", which is the original Conway's game of life
  13171. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13172. cells, and will born a new cell if there are three alive cells around
  13173. a dead cell.
  13174. @item size, s
  13175. Set the size of the output video. For the syntax of this option, check the
  13176. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13177. If @option{filename} is specified, the size is set by default to the
  13178. same size of the input file. If @option{size} is set, it must contain
  13179. the size specified in the input file, and the initial grid defined in
  13180. that file is centered in the larger resulting area.
  13181. If a filename is not specified, the size value defaults to "320x240"
  13182. (used for a randomly generated initial grid).
  13183. @item stitch
  13184. If set to 1, stitch the left and right grid edges together, and the
  13185. top and bottom edges also. Defaults to 1.
  13186. @item mold
  13187. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13188. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13189. value from 0 to 255.
  13190. @item life_color
  13191. Set the color of living (or new born) cells.
  13192. @item death_color
  13193. Set the color of dead cells. If @option{mold} is set, this is the first color
  13194. used to represent a dead cell.
  13195. @item mold_color
  13196. Set mold color, for definitely dead and moldy cells.
  13197. For the syntax of these 3 color options, check the "Color" section in the
  13198. ffmpeg-utils manual.
  13199. @end table
  13200. @subsection Examples
  13201. @itemize
  13202. @item
  13203. Read a grid from @file{pattern}, and center it on a grid of size
  13204. 300x300 pixels:
  13205. @example
  13206. life=f=pattern:s=300x300
  13207. @end example
  13208. @item
  13209. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13210. @example
  13211. life=ratio=2/3:s=200x200
  13212. @end example
  13213. @item
  13214. Specify a custom rule for evolving a randomly generated grid:
  13215. @example
  13216. life=rule=S14/B34
  13217. @end example
  13218. @item
  13219. Full example with slow death effect (mold) using @command{ffplay}:
  13220. @example
  13221. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13222. @end example
  13223. @end itemize
  13224. @anchor{allrgb}
  13225. @anchor{allyuv}
  13226. @anchor{color}
  13227. @anchor{haldclutsrc}
  13228. @anchor{nullsrc}
  13229. @anchor{rgbtestsrc}
  13230. @anchor{smptebars}
  13231. @anchor{smptehdbars}
  13232. @anchor{testsrc}
  13233. @anchor{testsrc2}
  13234. @anchor{yuvtestsrc}
  13235. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13236. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13237. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13238. The @code{color} source provides an uniformly colored input.
  13239. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13240. @ref{haldclut} filter.
  13241. The @code{nullsrc} source returns unprocessed video frames. It is
  13242. mainly useful to be employed in analysis / debugging tools, or as the
  13243. source for filters which ignore the input data.
  13244. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13245. detecting RGB vs BGR issues. You should see a red, green and blue
  13246. stripe from top to bottom.
  13247. The @code{smptebars} source generates a color bars pattern, based on
  13248. the SMPTE Engineering Guideline EG 1-1990.
  13249. The @code{smptehdbars} source generates a color bars pattern, based on
  13250. the SMPTE RP 219-2002.
  13251. The @code{testsrc} source generates a test video pattern, showing a
  13252. color pattern, a scrolling gradient and a timestamp. This is mainly
  13253. intended for testing purposes.
  13254. The @code{testsrc2} source is similar to testsrc, but supports more
  13255. pixel formats instead of just @code{rgb24}. This allows using it as an
  13256. input for other tests without requiring a format conversion.
  13257. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13258. see a y, cb and cr stripe from top to bottom.
  13259. The sources accept the following parameters:
  13260. @table @option
  13261. @item level
  13262. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13263. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13264. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13265. coded on a @code{1/(N*N)} scale.
  13266. @item color, c
  13267. Specify the color of the source, only available in the @code{color}
  13268. source. For the syntax of this option, check the "Color" section in the
  13269. ffmpeg-utils manual.
  13270. @item size, s
  13271. Specify the size of the sourced video. For the syntax of this option, check the
  13272. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13273. The default value is @code{320x240}.
  13274. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13275. @code{haldclutsrc} filters.
  13276. @item rate, r
  13277. Specify the frame rate of the sourced video, as the number of frames
  13278. generated per second. It has to be a string in the format
  13279. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13280. number or a valid video frame rate abbreviation. The default value is
  13281. "25".
  13282. @item duration, d
  13283. Set the duration of the sourced video. See
  13284. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13285. for the accepted syntax.
  13286. If not specified, or the expressed duration is negative, the video is
  13287. supposed to be generated forever.
  13288. @item sar
  13289. Set the sample aspect ratio of the sourced video.
  13290. @item alpha
  13291. Specify the alpha (opacity) of the background, only available in the
  13292. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13293. 255 (fully opaque, the default).
  13294. @item decimals, n
  13295. Set the number of decimals to show in the timestamp, only available in the
  13296. @code{testsrc} source.
  13297. The displayed timestamp value will correspond to the original
  13298. timestamp value multiplied by the power of 10 of the specified
  13299. value. Default value is 0.
  13300. @end table
  13301. @subsection Examples
  13302. @itemize
  13303. @item
  13304. Generate a video with a duration of 5.3 seconds, with size
  13305. 176x144 and a frame rate of 10 frames per second:
  13306. @example
  13307. testsrc=duration=5.3:size=qcif:rate=10
  13308. @end example
  13309. @item
  13310. The following graph description will generate a red source
  13311. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13312. frames per second:
  13313. @example
  13314. color=c=red@@0.2:s=qcif:r=10
  13315. @end example
  13316. @item
  13317. If the input content is to be ignored, @code{nullsrc} can be used. The
  13318. following command generates noise in the luminance plane by employing
  13319. the @code{geq} filter:
  13320. @example
  13321. nullsrc=s=256x256, geq=random(1)*255:128:128
  13322. @end example
  13323. @end itemize
  13324. @subsection Commands
  13325. The @code{color} source supports the following commands:
  13326. @table @option
  13327. @item c, color
  13328. Set the color of the created image. Accepts the same syntax of the
  13329. corresponding @option{color} option.
  13330. @end table
  13331. @c man end VIDEO SOURCES
  13332. @chapter Video Sinks
  13333. @c man begin VIDEO SINKS
  13334. Below is a description of the currently available video sinks.
  13335. @section buffersink
  13336. Buffer video frames, and make them available to the end of the filter
  13337. graph.
  13338. This sink is mainly intended for programmatic use, in particular
  13339. through the interface defined in @file{libavfilter/buffersink.h}
  13340. or the options system.
  13341. It accepts a pointer to an AVBufferSinkContext structure, which
  13342. defines the incoming buffers' formats, to be passed as the opaque
  13343. parameter to @code{avfilter_init_filter} for initialization.
  13344. @section nullsink
  13345. Null video sink: do absolutely nothing with the input video. It is
  13346. mainly useful as a template and for use in analysis / debugging
  13347. tools.
  13348. @c man end VIDEO SINKS
  13349. @chapter Multimedia Filters
  13350. @c man begin MULTIMEDIA FILTERS
  13351. Below is a description of the currently available multimedia filters.
  13352. @section abitscope
  13353. Convert input audio to a video output, displaying the audio bit scope.
  13354. The filter accepts the following options:
  13355. @table @option
  13356. @item rate, r
  13357. Set frame rate, expressed as number of frames per second. Default
  13358. value is "25".
  13359. @item size, s
  13360. Specify the video size for the output. For the syntax of this option, check the
  13361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13362. Default value is @code{1024x256}.
  13363. @item colors
  13364. Specify list of colors separated by space or by '|' which will be used to
  13365. draw channels. Unrecognized or missing colors will be replaced
  13366. by white color.
  13367. @end table
  13368. @section ahistogram
  13369. Convert input audio to a video output, displaying the volume histogram.
  13370. The filter accepts the following options:
  13371. @table @option
  13372. @item dmode
  13373. Specify how histogram is calculated.
  13374. It accepts the following values:
  13375. @table @samp
  13376. @item single
  13377. Use single histogram for all channels.
  13378. @item separate
  13379. Use separate histogram for each channel.
  13380. @end table
  13381. Default is @code{single}.
  13382. @item rate, r
  13383. Set frame rate, expressed as number of frames per second. Default
  13384. value is "25".
  13385. @item size, s
  13386. Specify the video size for the output. For the syntax of this option, check the
  13387. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13388. Default value is @code{hd720}.
  13389. @item scale
  13390. Set display scale.
  13391. It accepts the following values:
  13392. @table @samp
  13393. @item log
  13394. logarithmic
  13395. @item sqrt
  13396. square root
  13397. @item cbrt
  13398. cubic root
  13399. @item lin
  13400. linear
  13401. @item rlog
  13402. reverse logarithmic
  13403. @end table
  13404. Default is @code{log}.
  13405. @item ascale
  13406. Set amplitude scale.
  13407. It accepts the following values:
  13408. @table @samp
  13409. @item log
  13410. logarithmic
  13411. @item lin
  13412. linear
  13413. @end table
  13414. Default is @code{log}.
  13415. @item acount
  13416. Set how much frames to accumulate in histogram.
  13417. Defauls is 1. Setting this to -1 accumulates all frames.
  13418. @item rheight
  13419. Set histogram ratio of window height.
  13420. @item slide
  13421. Set sonogram sliding.
  13422. It accepts the following values:
  13423. @table @samp
  13424. @item replace
  13425. replace old rows with new ones.
  13426. @item scroll
  13427. scroll from top to bottom.
  13428. @end table
  13429. Default is @code{replace}.
  13430. @end table
  13431. @section aphasemeter
  13432. Convert input audio to a video output, displaying the audio phase.
  13433. The filter accepts the following options:
  13434. @table @option
  13435. @item rate, r
  13436. Set the output frame rate. Default value is @code{25}.
  13437. @item size, s
  13438. Set the video size for the output. For the syntax of this option, check the
  13439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13440. Default value is @code{800x400}.
  13441. @item rc
  13442. @item gc
  13443. @item bc
  13444. Specify the red, green, blue contrast. Default values are @code{2},
  13445. @code{7} and @code{1}.
  13446. Allowed range is @code{[0, 255]}.
  13447. @item mpc
  13448. Set color which will be used for drawing median phase. If color is
  13449. @code{none} which is default, no median phase value will be drawn.
  13450. @item video
  13451. Enable video output. Default is enabled.
  13452. @end table
  13453. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13454. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13455. The @code{-1} means left and right channels are completely out of phase and
  13456. @code{1} means channels are in phase.
  13457. @section avectorscope
  13458. Convert input audio to a video output, representing the audio vector
  13459. scope.
  13460. The filter is used to measure the difference between channels of stereo
  13461. audio stream. A monoaural signal, consisting of identical left and right
  13462. signal, results in straight vertical line. Any stereo separation is visible
  13463. as a deviation from this line, creating a Lissajous figure.
  13464. If the straight (or deviation from it) but horizontal line appears this
  13465. indicates that the left and right channels are out of phase.
  13466. The filter accepts the following options:
  13467. @table @option
  13468. @item mode, m
  13469. Set the vectorscope mode.
  13470. Available values are:
  13471. @table @samp
  13472. @item lissajous
  13473. Lissajous rotated by 45 degrees.
  13474. @item lissajous_xy
  13475. Same as above but not rotated.
  13476. @item polar
  13477. Shape resembling half of circle.
  13478. @end table
  13479. Default value is @samp{lissajous}.
  13480. @item size, s
  13481. Set the video size for the output. For the syntax of this option, check the
  13482. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13483. Default value is @code{400x400}.
  13484. @item rate, r
  13485. Set the output frame rate. Default value is @code{25}.
  13486. @item rc
  13487. @item gc
  13488. @item bc
  13489. @item ac
  13490. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13491. @code{160}, @code{80} and @code{255}.
  13492. Allowed range is @code{[0, 255]}.
  13493. @item rf
  13494. @item gf
  13495. @item bf
  13496. @item af
  13497. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13498. @code{10}, @code{5} and @code{5}.
  13499. Allowed range is @code{[0, 255]}.
  13500. @item zoom
  13501. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13502. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13503. @item draw
  13504. Set the vectorscope drawing mode.
  13505. Available values are:
  13506. @table @samp
  13507. @item dot
  13508. Draw dot for each sample.
  13509. @item line
  13510. Draw line between previous and current sample.
  13511. @end table
  13512. Default value is @samp{dot}.
  13513. @item scale
  13514. Specify amplitude scale of audio samples.
  13515. Available values are:
  13516. @table @samp
  13517. @item lin
  13518. Linear.
  13519. @item sqrt
  13520. Square root.
  13521. @item cbrt
  13522. Cubic root.
  13523. @item log
  13524. Logarithmic.
  13525. @end table
  13526. @item swap
  13527. Swap left channel axis with right channel axis.
  13528. @item mirror
  13529. Mirror axis.
  13530. @table @samp
  13531. @item none
  13532. No mirror.
  13533. @item x
  13534. Mirror only x axis.
  13535. @item y
  13536. Mirror only y axis.
  13537. @item xy
  13538. Mirror both axis.
  13539. @end table
  13540. @end table
  13541. @subsection Examples
  13542. @itemize
  13543. @item
  13544. Complete example using @command{ffplay}:
  13545. @example
  13546. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13547. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13548. @end example
  13549. @end itemize
  13550. @section bench, abench
  13551. Benchmark part of a filtergraph.
  13552. The filter accepts the following options:
  13553. @table @option
  13554. @item action
  13555. Start or stop a timer.
  13556. Available values are:
  13557. @table @samp
  13558. @item start
  13559. Get the current time, set it as frame metadata (using the key
  13560. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13561. @item stop
  13562. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13563. the input frame metadata to get the time difference. Time difference, average,
  13564. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13565. @code{min}) are then printed. The timestamps are expressed in seconds.
  13566. @end table
  13567. @end table
  13568. @subsection Examples
  13569. @itemize
  13570. @item
  13571. Benchmark @ref{selectivecolor} filter:
  13572. @example
  13573. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13574. @end example
  13575. @end itemize
  13576. @section concat
  13577. Concatenate audio and video streams, joining them together one after the
  13578. other.
  13579. The filter works on segments of synchronized video and audio streams. All
  13580. segments must have the same number of streams of each type, and that will
  13581. also be the number of streams at output.
  13582. The filter accepts the following options:
  13583. @table @option
  13584. @item n
  13585. Set the number of segments. Default is 2.
  13586. @item v
  13587. Set the number of output video streams, that is also the number of video
  13588. streams in each segment. Default is 1.
  13589. @item a
  13590. Set the number of output audio streams, that is also the number of audio
  13591. streams in each segment. Default is 0.
  13592. @item unsafe
  13593. Activate unsafe mode: do not fail if segments have a different format.
  13594. @end table
  13595. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13596. @var{a} audio outputs.
  13597. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13598. segment, in the same order as the outputs, then the inputs for the second
  13599. segment, etc.
  13600. Related streams do not always have exactly the same duration, for various
  13601. reasons including codec frame size or sloppy authoring. For that reason,
  13602. related synchronized streams (e.g. a video and its audio track) should be
  13603. concatenated at once. The concat filter will use the duration of the longest
  13604. stream in each segment (except the last one), and if necessary pad shorter
  13605. audio streams with silence.
  13606. For this filter to work correctly, all segments must start at timestamp 0.
  13607. All corresponding streams must have the same parameters in all segments; the
  13608. filtering system will automatically select a common pixel format for video
  13609. streams, and a common sample format, sample rate and channel layout for
  13610. audio streams, but other settings, such as resolution, must be converted
  13611. explicitly by the user.
  13612. Different frame rates are acceptable but will result in variable frame rate
  13613. at output; be sure to configure the output file to handle it.
  13614. @subsection Examples
  13615. @itemize
  13616. @item
  13617. Concatenate an opening, an episode and an ending, all in bilingual version
  13618. (video in stream 0, audio in streams 1 and 2):
  13619. @example
  13620. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13621. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13622. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13623. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13624. @end example
  13625. @item
  13626. Concatenate two parts, handling audio and video separately, using the
  13627. (a)movie sources, and adjusting the resolution:
  13628. @example
  13629. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13630. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13631. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13632. @end example
  13633. Note that a desync will happen at the stitch if the audio and video streams
  13634. do not have exactly the same duration in the first file.
  13635. @end itemize
  13636. @section drawgraph, adrawgraph
  13637. Draw a graph using input video or audio metadata.
  13638. It accepts the following parameters:
  13639. @table @option
  13640. @item m1
  13641. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13642. @item fg1
  13643. Set 1st foreground color expression.
  13644. @item m2
  13645. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13646. @item fg2
  13647. Set 2nd foreground color expression.
  13648. @item m3
  13649. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13650. @item fg3
  13651. Set 3rd foreground color expression.
  13652. @item m4
  13653. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13654. @item fg4
  13655. Set 4th foreground color expression.
  13656. @item min
  13657. Set minimal value of metadata value.
  13658. @item max
  13659. Set maximal value of metadata value.
  13660. @item bg
  13661. Set graph background color. Default is white.
  13662. @item mode
  13663. Set graph mode.
  13664. Available values for mode is:
  13665. @table @samp
  13666. @item bar
  13667. @item dot
  13668. @item line
  13669. @end table
  13670. Default is @code{line}.
  13671. @item slide
  13672. Set slide mode.
  13673. Available values for slide is:
  13674. @table @samp
  13675. @item frame
  13676. Draw new frame when right border is reached.
  13677. @item replace
  13678. Replace old columns with new ones.
  13679. @item scroll
  13680. Scroll from right to left.
  13681. @item rscroll
  13682. Scroll from left to right.
  13683. @item picture
  13684. Draw single picture.
  13685. @end table
  13686. Default is @code{frame}.
  13687. @item size
  13688. Set size of graph video. For the syntax of this option, check the
  13689. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13690. The default value is @code{900x256}.
  13691. The foreground color expressions can use the following variables:
  13692. @table @option
  13693. @item MIN
  13694. Minimal value of metadata value.
  13695. @item MAX
  13696. Maximal value of metadata value.
  13697. @item VAL
  13698. Current metadata key value.
  13699. @end table
  13700. The color is defined as 0xAABBGGRR.
  13701. @end table
  13702. Example using metadata from @ref{signalstats} filter:
  13703. @example
  13704. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13705. @end example
  13706. Example using metadata from @ref{ebur128} filter:
  13707. @example
  13708. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13709. @end example
  13710. @anchor{ebur128}
  13711. @section ebur128
  13712. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13713. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13714. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13715. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13716. The filter also has a video output (see the @var{video} option) with a real
  13717. time graph to observe the loudness evolution. The graphic contains the logged
  13718. message mentioned above, so it is not printed anymore when this option is set,
  13719. unless the verbose logging is set. The main graphing area contains the
  13720. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13721. the momentary loudness (400 milliseconds).
  13722. More information about the Loudness Recommendation EBU R128 on
  13723. @url{http://tech.ebu.ch/loudness}.
  13724. The filter accepts the following options:
  13725. @table @option
  13726. @item video
  13727. Activate the video output. The audio stream is passed unchanged whether this
  13728. option is set or no. The video stream will be the first output stream if
  13729. activated. Default is @code{0}.
  13730. @item size
  13731. Set the video size. This option is for video only. For the syntax of this
  13732. option, check the
  13733. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13734. Default and minimum resolution is @code{640x480}.
  13735. @item meter
  13736. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13737. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13738. other integer value between this range is allowed.
  13739. @item metadata
  13740. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13741. into 100ms output frames, each of them containing various loudness information
  13742. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13743. Default is @code{0}.
  13744. @item framelog
  13745. Force the frame logging level.
  13746. Available values are:
  13747. @table @samp
  13748. @item info
  13749. information logging level
  13750. @item verbose
  13751. verbose logging level
  13752. @end table
  13753. By default, the logging level is set to @var{info}. If the @option{video} or
  13754. the @option{metadata} options are set, it switches to @var{verbose}.
  13755. @item peak
  13756. Set peak mode(s).
  13757. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13758. values are:
  13759. @table @samp
  13760. @item none
  13761. Disable any peak mode (default).
  13762. @item sample
  13763. Enable sample-peak mode.
  13764. Simple peak mode looking for the higher sample value. It logs a message
  13765. for sample-peak (identified by @code{SPK}).
  13766. @item true
  13767. Enable true-peak mode.
  13768. If enabled, the peak lookup is done on an over-sampled version of the input
  13769. stream for better peak accuracy. It logs a message for true-peak.
  13770. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13771. This mode requires a build with @code{libswresample}.
  13772. @end table
  13773. @item dualmono
  13774. Treat mono input files as "dual mono". If a mono file is intended for playback
  13775. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13776. If set to @code{true}, this option will compensate for this effect.
  13777. Multi-channel input files are not affected by this option.
  13778. @item panlaw
  13779. Set a specific pan law to be used for the measurement of dual mono files.
  13780. This parameter is optional, and has a default value of -3.01dB.
  13781. @end table
  13782. @subsection Examples
  13783. @itemize
  13784. @item
  13785. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13786. @example
  13787. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13788. @end example
  13789. @item
  13790. Run an analysis with @command{ffmpeg}:
  13791. @example
  13792. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13793. @end example
  13794. @end itemize
  13795. @section interleave, ainterleave
  13796. Temporally interleave frames from several inputs.
  13797. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13798. These filters read frames from several inputs and send the oldest
  13799. queued frame to the output.
  13800. Input streams must have well defined, monotonically increasing frame
  13801. timestamp values.
  13802. In order to submit one frame to output, these filters need to enqueue
  13803. at least one frame for each input, so they cannot work in case one
  13804. input is not yet terminated and will not receive incoming frames.
  13805. For example consider the case when one input is a @code{select} filter
  13806. which always drops input frames. The @code{interleave} filter will keep
  13807. reading from that input, but it will never be able to send new frames
  13808. to output until the input sends an end-of-stream signal.
  13809. Also, depending on inputs synchronization, the filters will drop
  13810. frames in case one input receives more frames than the other ones, and
  13811. the queue is already filled.
  13812. These filters accept the following options:
  13813. @table @option
  13814. @item nb_inputs, n
  13815. Set the number of different inputs, it is 2 by default.
  13816. @end table
  13817. @subsection Examples
  13818. @itemize
  13819. @item
  13820. Interleave frames belonging to different streams using @command{ffmpeg}:
  13821. @example
  13822. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13823. @end example
  13824. @item
  13825. Add flickering blur effect:
  13826. @example
  13827. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13828. @end example
  13829. @end itemize
  13830. @section metadata, ametadata
  13831. Manipulate frame metadata.
  13832. This filter accepts the following options:
  13833. @table @option
  13834. @item mode
  13835. Set mode of operation of the filter.
  13836. Can be one of the following:
  13837. @table @samp
  13838. @item select
  13839. If both @code{value} and @code{key} is set, select frames
  13840. which have such metadata. If only @code{key} is set, select
  13841. every frame that has such key in metadata.
  13842. @item add
  13843. Add new metadata @code{key} and @code{value}. If key is already available
  13844. do nothing.
  13845. @item modify
  13846. Modify value of already present key.
  13847. @item delete
  13848. If @code{value} is set, delete only keys that have such value.
  13849. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13850. the frame.
  13851. @item print
  13852. Print key and its value if metadata was found. If @code{key} is not set print all
  13853. metadata values available in frame.
  13854. @end table
  13855. @item key
  13856. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13857. @item value
  13858. Set metadata value which will be used. This option is mandatory for
  13859. @code{modify} and @code{add} mode.
  13860. @item function
  13861. Which function to use when comparing metadata value and @code{value}.
  13862. Can be one of following:
  13863. @table @samp
  13864. @item same_str
  13865. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13866. @item starts_with
  13867. Values are interpreted as strings, returns true if metadata value starts with
  13868. the @code{value} option string.
  13869. @item less
  13870. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13871. @item equal
  13872. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13873. @item greater
  13874. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13875. @item expr
  13876. Values are interpreted as floats, returns true if expression from option @code{expr}
  13877. evaluates to true.
  13878. @end table
  13879. @item expr
  13880. Set expression which is used when @code{function} is set to @code{expr}.
  13881. The expression is evaluated through the eval API and can contain the following
  13882. constants:
  13883. @table @option
  13884. @item VALUE1
  13885. Float representation of @code{value} from metadata key.
  13886. @item VALUE2
  13887. Float representation of @code{value} as supplied by user in @code{value} option.
  13888. @end table
  13889. @item file
  13890. If specified in @code{print} mode, output is written to the named file. Instead of
  13891. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13892. for standard output. If @code{file} option is not set, output is written to the log
  13893. with AV_LOG_INFO loglevel.
  13894. @end table
  13895. @subsection Examples
  13896. @itemize
  13897. @item
  13898. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13899. between 0 and 1.
  13900. @example
  13901. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13902. @end example
  13903. @item
  13904. Print silencedetect output to file @file{metadata.txt}.
  13905. @example
  13906. silencedetect,ametadata=mode=print:file=metadata.txt
  13907. @end example
  13908. @item
  13909. Direct all metadata to a pipe with file descriptor 4.
  13910. @example
  13911. metadata=mode=print:file='pipe\:4'
  13912. @end example
  13913. @end itemize
  13914. @section perms, aperms
  13915. Set read/write permissions for the output frames.
  13916. These filters are mainly aimed at developers to test direct path in the
  13917. following filter in the filtergraph.
  13918. The filters accept the following options:
  13919. @table @option
  13920. @item mode
  13921. Select the permissions mode.
  13922. It accepts the following values:
  13923. @table @samp
  13924. @item none
  13925. Do nothing. This is the default.
  13926. @item ro
  13927. Set all the output frames read-only.
  13928. @item rw
  13929. Set all the output frames directly writable.
  13930. @item toggle
  13931. Make the frame read-only if writable, and writable if read-only.
  13932. @item random
  13933. Set each output frame read-only or writable randomly.
  13934. @end table
  13935. @item seed
  13936. Set the seed for the @var{random} mode, must be an integer included between
  13937. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13938. @code{-1}, the filter will try to use a good random seed on a best effort
  13939. basis.
  13940. @end table
  13941. Note: in case of auto-inserted filter between the permission filter and the
  13942. following one, the permission might not be received as expected in that
  13943. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13944. perms/aperms filter can avoid this problem.
  13945. @section realtime, arealtime
  13946. Slow down filtering to match real time approximately.
  13947. These filters will pause the filtering for a variable amount of time to
  13948. match the output rate with the input timestamps.
  13949. They are similar to the @option{re} option to @code{ffmpeg}.
  13950. They accept the following options:
  13951. @table @option
  13952. @item limit
  13953. Time limit for the pauses. Any pause longer than that will be considered
  13954. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13955. @end table
  13956. @anchor{select}
  13957. @section select, aselect
  13958. Select frames to pass in output.
  13959. This filter accepts the following options:
  13960. @table @option
  13961. @item expr, e
  13962. Set expression, which is evaluated for each input frame.
  13963. If the expression is evaluated to zero, the frame is discarded.
  13964. If the evaluation result is negative or NaN, the frame is sent to the
  13965. first output; otherwise it is sent to the output with index
  13966. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13967. For example a value of @code{1.2} corresponds to the output with index
  13968. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13969. @item outputs, n
  13970. Set the number of outputs. The output to which to send the selected
  13971. frame is based on the result of the evaluation. Default value is 1.
  13972. @end table
  13973. The expression can contain the following constants:
  13974. @table @option
  13975. @item n
  13976. The (sequential) number of the filtered frame, starting from 0.
  13977. @item selected_n
  13978. The (sequential) number of the selected frame, starting from 0.
  13979. @item prev_selected_n
  13980. The sequential number of the last selected frame. It's NAN if undefined.
  13981. @item TB
  13982. The timebase of the input timestamps.
  13983. @item pts
  13984. The PTS (Presentation TimeStamp) of the filtered video frame,
  13985. expressed in @var{TB} units. It's NAN if undefined.
  13986. @item t
  13987. The PTS of the filtered video frame,
  13988. expressed in seconds. It's NAN if undefined.
  13989. @item prev_pts
  13990. The PTS of the previously filtered video frame. It's NAN if undefined.
  13991. @item prev_selected_pts
  13992. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13993. @item prev_selected_t
  13994. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13995. @item start_pts
  13996. The PTS of the first video frame in the video. It's NAN if undefined.
  13997. @item start_t
  13998. The time of the first video frame in the video. It's NAN if undefined.
  13999. @item pict_type @emph{(video only)}
  14000. The type of the filtered frame. It can assume one of the following
  14001. values:
  14002. @table @option
  14003. @item I
  14004. @item P
  14005. @item B
  14006. @item S
  14007. @item SI
  14008. @item SP
  14009. @item BI
  14010. @end table
  14011. @item interlace_type @emph{(video only)}
  14012. The frame interlace type. It can assume one of the following values:
  14013. @table @option
  14014. @item PROGRESSIVE
  14015. The frame is progressive (not interlaced).
  14016. @item TOPFIRST
  14017. The frame is top-field-first.
  14018. @item BOTTOMFIRST
  14019. The frame is bottom-field-first.
  14020. @end table
  14021. @item consumed_sample_n @emph{(audio only)}
  14022. the number of selected samples before the current frame
  14023. @item samples_n @emph{(audio only)}
  14024. the number of samples in the current frame
  14025. @item sample_rate @emph{(audio only)}
  14026. the input sample rate
  14027. @item key
  14028. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14029. @item pos
  14030. the position in the file of the filtered frame, -1 if the information
  14031. is not available (e.g. for synthetic video)
  14032. @item scene @emph{(video only)}
  14033. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14034. probability for the current frame to introduce a new scene, while a higher
  14035. value means the current frame is more likely to be one (see the example below)
  14036. @item concatdec_select
  14037. The concat demuxer can select only part of a concat input file by setting an
  14038. inpoint and an outpoint, but the output packets may not be entirely contained
  14039. in the selected interval. By using this variable, it is possible to skip frames
  14040. generated by the concat demuxer which are not exactly contained in the selected
  14041. interval.
  14042. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14043. and the @var{lavf.concat.duration} packet metadata values which are also
  14044. present in the decoded frames.
  14045. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14046. start_time and either the duration metadata is missing or the frame pts is less
  14047. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14048. missing.
  14049. That basically means that an input frame is selected if its pts is within the
  14050. interval set by the concat demuxer.
  14051. @end table
  14052. The default value of the select expression is "1".
  14053. @subsection Examples
  14054. @itemize
  14055. @item
  14056. Select all frames in input:
  14057. @example
  14058. select
  14059. @end example
  14060. The example above is the same as:
  14061. @example
  14062. select=1
  14063. @end example
  14064. @item
  14065. Skip all frames:
  14066. @example
  14067. select=0
  14068. @end example
  14069. @item
  14070. Select only I-frames:
  14071. @example
  14072. select='eq(pict_type\,I)'
  14073. @end example
  14074. @item
  14075. Select one frame every 100:
  14076. @example
  14077. select='not(mod(n\,100))'
  14078. @end example
  14079. @item
  14080. Select only frames contained in the 10-20 time interval:
  14081. @example
  14082. select=between(t\,10\,20)
  14083. @end example
  14084. @item
  14085. Select only I-frames contained in the 10-20 time interval:
  14086. @example
  14087. select=between(t\,10\,20)*eq(pict_type\,I)
  14088. @end example
  14089. @item
  14090. Select frames with a minimum distance of 10 seconds:
  14091. @example
  14092. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14093. @end example
  14094. @item
  14095. Use aselect to select only audio frames with samples number > 100:
  14096. @example
  14097. aselect='gt(samples_n\,100)'
  14098. @end example
  14099. @item
  14100. Create a mosaic of the first scenes:
  14101. @example
  14102. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14103. @end example
  14104. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14105. choice.
  14106. @item
  14107. Send even and odd frames to separate outputs, and compose them:
  14108. @example
  14109. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14110. @end example
  14111. @item
  14112. Select useful frames from an ffconcat file which is using inpoints and
  14113. outpoints but where the source files are not intra frame only.
  14114. @example
  14115. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14116. @end example
  14117. @end itemize
  14118. @section sendcmd, asendcmd
  14119. Send commands to filters in the filtergraph.
  14120. These filters read commands to be sent to other filters in the
  14121. filtergraph.
  14122. @code{sendcmd} must be inserted between two video filters,
  14123. @code{asendcmd} must be inserted between two audio filters, but apart
  14124. from that they act the same way.
  14125. The specification of commands can be provided in the filter arguments
  14126. with the @var{commands} option, or in a file specified by the
  14127. @var{filename} option.
  14128. These filters accept the following options:
  14129. @table @option
  14130. @item commands, c
  14131. Set the commands to be read and sent to the other filters.
  14132. @item filename, f
  14133. Set the filename of the commands to be read and sent to the other
  14134. filters.
  14135. @end table
  14136. @subsection Commands syntax
  14137. A commands description consists of a sequence of interval
  14138. specifications, comprising a list of commands to be executed when a
  14139. particular event related to that interval occurs. The occurring event
  14140. is typically the current frame time entering or leaving a given time
  14141. interval.
  14142. An interval is specified by the following syntax:
  14143. @example
  14144. @var{START}[-@var{END}] @var{COMMANDS};
  14145. @end example
  14146. The time interval is specified by the @var{START} and @var{END} times.
  14147. @var{END} is optional and defaults to the maximum time.
  14148. The current frame time is considered within the specified interval if
  14149. it is included in the interval [@var{START}, @var{END}), that is when
  14150. the time is greater or equal to @var{START} and is lesser than
  14151. @var{END}.
  14152. @var{COMMANDS} consists of a sequence of one or more command
  14153. specifications, separated by ",", relating to that interval. The
  14154. syntax of a command specification is given by:
  14155. @example
  14156. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14157. @end example
  14158. @var{FLAGS} is optional and specifies the type of events relating to
  14159. the time interval which enable sending the specified command, and must
  14160. be a non-null sequence of identifier flags separated by "+" or "|" and
  14161. enclosed between "[" and "]".
  14162. The following flags are recognized:
  14163. @table @option
  14164. @item enter
  14165. The command is sent when the current frame timestamp enters the
  14166. specified interval. In other words, the command is sent when the
  14167. previous frame timestamp was not in the given interval, and the
  14168. current is.
  14169. @item leave
  14170. The command is sent when the current frame timestamp leaves the
  14171. specified interval. In other words, the command is sent when the
  14172. previous frame timestamp was in the given interval, and the
  14173. current is not.
  14174. @end table
  14175. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14176. assumed.
  14177. @var{TARGET} specifies the target of the command, usually the name of
  14178. the filter class or a specific filter instance name.
  14179. @var{COMMAND} specifies the name of the command for the target filter.
  14180. @var{ARG} is optional and specifies the optional list of argument for
  14181. the given @var{COMMAND}.
  14182. Between one interval specification and another, whitespaces, or
  14183. sequences of characters starting with @code{#} until the end of line,
  14184. are ignored and can be used to annotate comments.
  14185. A simplified BNF description of the commands specification syntax
  14186. follows:
  14187. @example
  14188. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14189. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14190. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14191. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14192. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14193. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14194. @end example
  14195. @subsection Examples
  14196. @itemize
  14197. @item
  14198. Specify audio tempo change at second 4:
  14199. @example
  14200. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14201. @end example
  14202. @item
  14203. Target a specific filter instance:
  14204. @example
  14205. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14206. @end example
  14207. @item
  14208. Specify a list of drawtext and hue commands in a file.
  14209. @example
  14210. # show text in the interval 5-10
  14211. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14212. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14213. # desaturate the image in the interval 15-20
  14214. 15.0-20.0 [enter] hue s 0,
  14215. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14216. [leave] hue s 1,
  14217. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14218. # apply an exponential saturation fade-out effect, starting from time 25
  14219. 25 [enter] hue s exp(25-t)
  14220. @end example
  14221. A filtergraph allowing to read and process the above command list
  14222. stored in a file @file{test.cmd}, can be specified with:
  14223. @example
  14224. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14225. @end example
  14226. @end itemize
  14227. @anchor{setpts}
  14228. @section setpts, asetpts
  14229. Change the PTS (presentation timestamp) of the input frames.
  14230. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14231. This filter accepts the following options:
  14232. @table @option
  14233. @item expr
  14234. The expression which is evaluated for each frame to construct its timestamp.
  14235. @end table
  14236. The expression is evaluated through the eval API and can contain the following
  14237. constants:
  14238. @table @option
  14239. @item FRAME_RATE
  14240. frame rate, only defined for constant frame-rate video
  14241. @item PTS
  14242. The presentation timestamp in input
  14243. @item N
  14244. The count of the input frame for video or the number of consumed samples,
  14245. not including the current frame for audio, starting from 0.
  14246. @item NB_CONSUMED_SAMPLES
  14247. The number of consumed samples, not including the current frame (only
  14248. audio)
  14249. @item NB_SAMPLES, S
  14250. The number of samples in the current frame (only audio)
  14251. @item SAMPLE_RATE, SR
  14252. The audio sample rate.
  14253. @item STARTPTS
  14254. The PTS of the first frame.
  14255. @item STARTT
  14256. the time in seconds of the first frame
  14257. @item INTERLACED
  14258. State whether the current frame is interlaced.
  14259. @item T
  14260. the time in seconds of the current frame
  14261. @item POS
  14262. original position in the file of the frame, or undefined if undefined
  14263. for the current frame
  14264. @item PREV_INPTS
  14265. The previous input PTS.
  14266. @item PREV_INT
  14267. previous input time in seconds
  14268. @item PREV_OUTPTS
  14269. The previous output PTS.
  14270. @item PREV_OUTT
  14271. previous output time in seconds
  14272. @item RTCTIME
  14273. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14274. instead.
  14275. @item RTCSTART
  14276. The wallclock (RTC) time at the start of the movie in microseconds.
  14277. @item TB
  14278. The timebase of the input timestamps.
  14279. @end table
  14280. @subsection Examples
  14281. @itemize
  14282. @item
  14283. Start counting PTS from zero
  14284. @example
  14285. setpts=PTS-STARTPTS
  14286. @end example
  14287. @item
  14288. Apply fast motion effect:
  14289. @example
  14290. setpts=0.5*PTS
  14291. @end example
  14292. @item
  14293. Apply slow motion effect:
  14294. @example
  14295. setpts=2.0*PTS
  14296. @end example
  14297. @item
  14298. Set fixed rate of 25 frames per second:
  14299. @example
  14300. setpts=N/(25*TB)
  14301. @end example
  14302. @item
  14303. Set fixed rate 25 fps with some jitter:
  14304. @example
  14305. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14306. @end example
  14307. @item
  14308. Apply an offset of 10 seconds to the input PTS:
  14309. @example
  14310. setpts=PTS+10/TB
  14311. @end example
  14312. @item
  14313. Generate timestamps from a "live source" and rebase onto the current timebase:
  14314. @example
  14315. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14316. @end example
  14317. @item
  14318. Generate timestamps by counting samples:
  14319. @example
  14320. asetpts=N/SR/TB
  14321. @end example
  14322. @end itemize
  14323. @section setrange
  14324. Force color range for the output video frame.
  14325. The @code{setrange} filter marks the color range property for the
  14326. output frames. It does not change the input frame, but only sets the
  14327. corresponding property, which affects how the frame is treated by
  14328. following filters.
  14329. The filter accepts the following options:
  14330. @table @option
  14331. @item range
  14332. Available values are:
  14333. @table @samp
  14334. @item auto
  14335. Keep the same color range property.
  14336. @item unspecified, unknown
  14337. Set the color range as unspecified.
  14338. @item limited, tv, mpeg
  14339. Set the color range as limited.
  14340. @item full, pc, jpeg
  14341. Set the color range as full.
  14342. @end table
  14343. @end table
  14344. @section settb, asettb
  14345. Set the timebase to use for the output frames timestamps.
  14346. It is mainly useful for testing timebase configuration.
  14347. It accepts the following parameters:
  14348. @table @option
  14349. @item expr, tb
  14350. The expression which is evaluated into the output timebase.
  14351. @end table
  14352. The value for @option{tb} is an arithmetic expression representing a
  14353. rational. The expression can contain the constants "AVTB" (the default
  14354. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14355. audio only). Default value is "intb".
  14356. @subsection Examples
  14357. @itemize
  14358. @item
  14359. Set the timebase to 1/25:
  14360. @example
  14361. settb=expr=1/25
  14362. @end example
  14363. @item
  14364. Set the timebase to 1/10:
  14365. @example
  14366. settb=expr=0.1
  14367. @end example
  14368. @item
  14369. Set the timebase to 1001/1000:
  14370. @example
  14371. settb=1+0.001
  14372. @end example
  14373. @item
  14374. Set the timebase to 2*intb:
  14375. @example
  14376. settb=2*intb
  14377. @end example
  14378. @item
  14379. Set the default timebase value:
  14380. @example
  14381. settb=AVTB
  14382. @end example
  14383. @end itemize
  14384. @section showcqt
  14385. Convert input audio to a video output representing frequency spectrum
  14386. logarithmically using Brown-Puckette constant Q transform algorithm with
  14387. direct frequency domain coefficient calculation (but the transform itself
  14388. is not really constant Q, instead the Q factor is actually variable/clamped),
  14389. with musical tone scale, from E0 to D#10.
  14390. The filter accepts the following options:
  14391. @table @option
  14392. @item size, s
  14393. Specify the video size for the output. It must be even. For the syntax of this option,
  14394. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14395. Default value is @code{1920x1080}.
  14396. @item fps, rate, r
  14397. Set the output frame rate. Default value is @code{25}.
  14398. @item bar_h
  14399. Set the bargraph height. It must be even. Default value is @code{-1} which
  14400. computes the bargraph height automatically.
  14401. @item axis_h
  14402. Set the axis height. It must be even. Default value is @code{-1} which computes
  14403. the axis height automatically.
  14404. @item sono_h
  14405. Set the sonogram height. It must be even. Default value is @code{-1} which
  14406. computes the sonogram height automatically.
  14407. @item fullhd
  14408. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14409. instead. Default value is @code{1}.
  14410. @item sono_v, volume
  14411. Specify the sonogram volume expression. It can contain variables:
  14412. @table @option
  14413. @item bar_v
  14414. the @var{bar_v} evaluated expression
  14415. @item frequency, freq, f
  14416. the frequency where it is evaluated
  14417. @item timeclamp, tc
  14418. the value of @var{timeclamp} option
  14419. @end table
  14420. and functions:
  14421. @table @option
  14422. @item a_weighting(f)
  14423. A-weighting of equal loudness
  14424. @item b_weighting(f)
  14425. B-weighting of equal loudness
  14426. @item c_weighting(f)
  14427. C-weighting of equal loudness.
  14428. @end table
  14429. Default value is @code{16}.
  14430. @item bar_v, volume2
  14431. Specify the bargraph volume expression. It can contain variables:
  14432. @table @option
  14433. @item sono_v
  14434. the @var{sono_v} evaluated expression
  14435. @item frequency, freq, f
  14436. the frequency where it is evaluated
  14437. @item timeclamp, tc
  14438. the value of @var{timeclamp} option
  14439. @end table
  14440. and functions:
  14441. @table @option
  14442. @item a_weighting(f)
  14443. A-weighting of equal loudness
  14444. @item b_weighting(f)
  14445. B-weighting of equal loudness
  14446. @item c_weighting(f)
  14447. C-weighting of equal loudness.
  14448. @end table
  14449. Default value is @code{sono_v}.
  14450. @item sono_g, gamma
  14451. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14452. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14453. Acceptable range is @code{[1, 7]}.
  14454. @item bar_g, gamma2
  14455. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14456. @code{[1, 7]}.
  14457. @item bar_t
  14458. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14459. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14460. @item timeclamp, tc
  14461. Specify the transform timeclamp. At low frequency, there is trade-off between
  14462. accuracy in time domain and frequency domain. If timeclamp is lower,
  14463. event in time domain is represented more accurately (such as fast bass drum),
  14464. otherwise event in frequency domain is represented more accurately
  14465. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14466. @item attack
  14467. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14468. limits future samples by applying asymmetric windowing in time domain, useful
  14469. when low latency is required. Accepted range is @code{[0, 1]}.
  14470. @item basefreq
  14471. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14472. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14473. @item endfreq
  14474. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14475. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14476. @item coeffclamp
  14477. This option is deprecated and ignored.
  14478. @item tlength
  14479. Specify the transform length in time domain. Use this option to control accuracy
  14480. trade-off between time domain and frequency domain at every frequency sample.
  14481. It can contain variables:
  14482. @table @option
  14483. @item frequency, freq, f
  14484. the frequency where it is evaluated
  14485. @item timeclamp, tc
  14486. the value of @var{timeclamp} option.
  14487. @end table
  14488. Default value is @code{384*tc/(384+tc*f)}.
  14489. @item count
  14490. Specify the transform count for every video frame. Default value is @code{6}.
  14491. Acceptable range is @code{[1, 30]}.
  14492. @item fcount
  14493. Specify the transform count for every single pixel. Default value is @code{0},
  14494. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14495. @item fontfile
  14496. Specify font file for use with freetype to draw the axis. If not specified,
  14497. use embedded font. Note that drawing with font file or embedded font is not
  14498. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14499. option instead.
  14500. @item font
  14501. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14502. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14503. @item fontcolor
  14504. Specify font color expression. This is arithmetic expression that should return
  14505. integer value 0xRRGGBB. It can contain variables:
  14506. @table @option
  14507. @item frequency, freq, f
  14508. the frequency where it is evaluated
  14509. @item timeclamp, tc
  14510. the value of @var{timeclamp} option
  14511. @end table
  14512. and functions:
  14513. @table @option
  14514. @item midi(f)
  14515. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14516. @item r(x), g(x), b(x)
  14517. red, green, and blue value of intensity x.
  14518. @end table
  14519. Default value is @code{st(0, (midi(f)-59.5)/12);
  14520. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14521. r(1-ld(1)) + b(ld(1))}.
  14522. @item axisfile
  14523. Specify image file to draw the axis. This option override @var{fontfile} and
  14524. @var{fontcolor} option.
  14525. @item axis, text
  14526. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14527. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14528. Default value is @code{1}.
  14529. @item csp
  14530. Set colorspace. The accepted values are:
  14531. @table @samp
  14532. @item unspecified
  14533. Unspecified (default)
  14534. @item bt709
  14535. BT.709
  14536. @item fcc
  14537. FCC
  14538. @item bt470bg
  14539. BT.470BG or BT.601-6 625
  14540. @item smpte170m
  14541. SMPTE-170M or BT.601-6 525
  14542. @item smpte240m
  14543. SMPTE-240M
  14544. @item bt2020ncl
  14545. BT.2020 with non-constant luminance
  14546. @end table
  14547. @item cscheme
  14548. Set spectrogram color scheme. This is list of floating point values with format
  14549. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14550. The default is @code{1|0.5|0|0|0.5|1}.
  14551. @end table
  14552. @subsection Examples
  14553. @itemize
  14554. @item
  14555. Playing audio while showing the spectrum:
  14556. @example
  14557. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14558. @end example
  14559. @item
  14560. Same as above, but with frame rate 30 fps:
  14561. @example
  14562. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14563. @end example
  14564. @item
  14565. Playing at 1280x720:
  14566. @example
  14567. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14568. @end example
  14569. @item
  14570. Disable sonogram display:
  14571. @example
  14572. sono_h=0
  14573. @end example
  14574. @item
  14575. A1 and its harmonics: A1, A2, (near)E3, A3:
  14576. @example
  14577. 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),
  14578. asplit[a][out1]; [a] showcqt [out0]'
  14579. @end example
  14580. @item
  14581. Same as above, but with more accuracy in frequency domain:
  14582. @example
  14583. 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),
  14584. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14585. @end example
  14586. @item
  14587. Custom volume:
  14588. @example
  14589. bar_v=10:sono_v=bar_v*a_weighting(f)
  14590. @end example
  14591. @item
  14592. Custom gamma, now spectrum is linear to the amplitude.
  14593. @example
  14594. bar_g=2:sono_g=2
  14595. @end example
  14596. @item
  14597. Custom tlength equation:
  14598. @example
  14599. 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)))'
  14600. @end example
  14601. @item
  14602. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14603. @example
  14604. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14605. @end example
  14606. @item
  14607. Custom font using fontconfig:
  14608. @example
  14609. font='Courier New,Monospace,mono|bold'
  14610. @end example
  14611. @item
  14612. Custom frequency range with custom axis using image file:
  14613. @example
  14614. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14615. @end example
  14616. @end itemize
  14617. @section showfreqs
  14618. Convert input audio to video output representing the audio power spectrum.
  14619. Audio amplitude is on Y-axis while frequency is on X-axis.
  14620. The filter accepts the following options:
  14621. @table @option
  14622. @item size, s
  14623. Specify size of video. For the syntax of this option, check the
  14624. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14625. Default is @code{1024x512}.
  14626. @item mode
  14627. Set display mode.
  14628. This set how each frequency bin will be represented.
  14629. It accepts the following values:
  14630. @table @samp
  14631. @item line
  14632. @item bar
  14633. @item dot
  14634. @end table
  14635. Default is @code{bar}.
  14636. @item ascale
  14637. Set amplitude scale.
  14638. It accepts the following values:
  14639. @table @samp
  14640. @item lin
  14641. Linear scale.
  14642. @item sqrt
  14643. Square root scale.
  14644. @item cbrt
  14645. Cubic root scale.
  14646. @item log
  14647. Logarithmic scale.
  14648. @end table
  14649. Default is @code{log}.
  14650. @item fscale
  14651. Set frequency scale.
  14652. It accepts the following values:
  14653. @table @samp
  14654. @item lin
  14655. Linear scale.
  14656. @item log
  14657. Logarithmic scale.
  14658. @item rlog
  14659. Reverse logarithmic scale.
  14660. @end table
  14661. Default is @code{lin}.
  14662. @item win_size
  14663. Set window size.
  14664. It accepts the following values:
  14665. @table @samp
  14666. @item w16
  14667. @item w32
  14668. @item w64
  14669. @item w128
  14670. @item w256
  14671. @item w512
  14672. @item w1024
  14673. @item w2048
  14674. @item w4096
  14675. @item w8192
  14676. @item w16384
  14677. @item w32768
  14678. @item w65536
  14679. @end table
  14680. Default is @code{w2048}
  14681. @item win_func
  14682. Set windowing function.
  14683. It accepts the following values:
  14684. @table @samp
  14685. @item rect
  14686. @item bartlett
  14687. @item hanning
  14688. @item hamming
  14689. @item blackman
  14690. @item welch
  14691. @item flattop
  14692. @item bharris
  14693. @item bnuttall
  14694. @item bhann
  14695. @item sine
  14696. @item nuttall
  14697. @item lanczos
  14698. @item gauss
  14699. @item tukey
  14700. @item dolph
  14701. @item cauchy
  14702. @item parzen
  14703. @item poisson
  14704. @end table
  14705. Default is @code{hanning}.
  14706. @item overlap
  14707. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14708. which means optimal overlap for selected window function will be picked.
  14709. @item averaging
  14710. Set time averaging. Setting this to 0 will display current maximal peaks.
  14711. Default is @code{1}, which means time averaging is disabled.
  14712. @item colors
  14713. Specify list of colors separated by space or by '|' which will be used to
  14714. draw channel frequencies. Unrecognized or missing colors will be replaced
  14715. by white color.
  14716. @item cmode
  14717. Set channel display mode.
  14718. It accepts the following values:
  14719. @table @samp
  14720. @item combined
  14721. @item separate
  14722. @end table
  14723. Default is @code{combined}.
  14724. @item minamp
  14725. Set minimum amplitude used in @code{log} amplitude scaler.
  14726. @end table
  14727. @anchor{showspectrum}
  14728. @section showspectrum
  14729. Convert input audio to a video output, representing the audio frequency
  14730. spectrum.
  14731. The filter accepts the following options:
  14732. @table @option
  14733. @item size, s
  14734. Specify the video size for the output. For the syntax of this option, check the
  14735. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14736. Default value is @code{640x512}.
  14737. @item slide
  14738. Specify how the spectrum should slide along the window.
  14739. It accepts the following values:
  14740. @table @samp
  14741. @item replace
  14742. the samples start again on the left when they reach the right
  14743. @item scroll
  14744. the samples scroll from right to left
  14745. @item fullframe
  14746. frames are only produced when the samples reach the right
  14747. @item rscroll
  14748. the samples scroll from left to right
  14749. @end table
  14750. Default value is @code{replace}.
  14751. @item mode
  14752. Specify display mode.
  14753. It accepts the following values:
  14754. @table @samp
  14755. @item combined
  14756. all channels are displayed in the same row
  14757. @item separate
  14758. all channels are displayed in separate rows
  14759. @end table
  14760. Default value is @samp{combined}.
  14761. @item color
  14762. Specify display color mode.
  14763. It accepts the following values:
  14764. @table @samp
  14765. @item channel
  14766. each channel is displayed in a separate color
  14767. @item intensity
  14768. each channel is displayed using the same color scheme
  14769. @item rainbow
  14770. each channel is displayed using the rainbow color scheme
  14771. @item moreland
  14772. each channel is displayed using the moreland color scheme
  14773. @item nebulae
  14774. each channel is displayed using the nebulae color scheme
  14775. @item fire
  14776. each channel is displayed using the fire color scheme
  14777. @item fiery
  14778. each channel is displayed using the fiery color scheme
  14779. @item fruit
  14780. each channel is displayed using the fruit color scheme
  14781. @item cool
  14782. each channel is displayed using the cool color scheme
  14783. @end table
  14784. Default value is @samp{channel}.
  14785. @item scale
  14786. Specify scale used for calculating intensity color values.
  14787. It accepts the following values:
  14788. @table @samp
  14789. @item lin
  14790. linear
  14791. @item sqrt
  14792. square root, default
  14793. @item cbrt
  14794. cubic root
  14795. @item log
  14796. logarithmic
  14797. @item 4thrt
  14798. 4th root
  14799. @item 5thrt
  14800. 5th root
  14801. @end table
  14802. Default value is @samp{sqrt}.
  14803. @item saturation
  14804. Set saturation modifier for displayed colors. Negative values provide
  14805. alternative color scheme. @code{0} is no saturation at all.
  14806. Saturation must be in [-10.0, 10.0] range.
  14807. Default value is @code{1}.
  14808. @item win_func
  14809. Set window function.
  14810. It accepts the following values:
  14811. @table @samp
  14812. @item rect
  14813. @item bartlett
  14814. @item hann
  14815. @item hanning
  14816. @item hamming
  14817. @item blackman
  14818. @item welch
  14819. @item flattop
  14820. @item bharris
  14821. @item bnuttall
  14822. @item bhann
  14823. @item sine
  14824. @item nuttall
  14825. @item lanczos
  14826. @item gauss
  14827. @item tukey
  14828. @item dolph
  14829. @item cauchy
  14830. @item parzen
  14831. @item poisson
  14832. @end table
  14833. Default value is @code{hann}.
  14834. @item orientation
  14835. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14836. @code{horizontal}. Default is @code{vertical}.
  14837. @item overlap
  14838. Set ratio of overlap window. Default value is @code{0}.
  14839. When value is @code{1} overlap is set to recommended size for specific
  14840. window function currently used.
  14841. @item gain
  14842. Set scale gain for calculating intensity color values.
  14843. Default value is @code{1}.
  14844. @item data
  14845. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14846. @item rotation
  14847. Set color rotation, must be in [-1.0, 1.0] range.
  14848. Default value is @code{0}.
  14849. @end table
  14850. The usage is very similar to the showwaves filter; see the examples in that
  14851. section.
  14852. @subsection Examples
  14853. @itemize
  14854. @item
  14855. Large window with logarithmic color scaling:
  14856. @example
  14857. showspectrum=s=1280x480:scale=log
  14858. @end example
  14859. @item
  14860. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14861. @example
  14862. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14863. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14864. @end example
  14865. @end itemize
  14866. @section showspectrumpic
  14867. Convert input audio to a single video frame, representing the audio frequency
  14868. spectrum.
  14869. The filter accepts the following options:
  14870. @table @option
  14871. @item size, s
  14872. Specify the video size for the output. For the syntax of this option, check the
  14873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14874. Default value is @code{4096x2048}.
  14875. @item mode
  14876. Specify display mode.
  14877. It accepts the following values:
  14878. @table @samp
  14879. @item combined
  14880. all channels are displayed in the same row
  14881. @item separate
  14882. all channels are displayed in separate rows
  14883. @end table
  14884. Default value is @samp{combined}.
  14885. @item color
  14886. Specify display color mode.
  14887. It accepts the following values:
  14888. @table @samp
  14889. @item channel
  14890. each channel is displayed in a separate color
  14891. @item intensity
  14892. each channel is displayed using the same color scheme
  14893. @item rainbow
  14894. each channel is displayed using the rainbow color scheme
  14895. @item moreland
  14896. each channel is displayed using the moreland color scheme
  14897. @item nebulae
  14898. each channel is displayed using the nebulae color scheme
  14899. @item fire
  14900. each channel is displayed using the fire color scheme
  14901. @item fiery
  14902. each channel is displayed using the fiery color scheme
  14903. @item fruit
  14904. each channel is displayed using the fruit color scheme
  14905. @item cool
  14906. each channel is displayed using the cool color scheme
  14907. @end table
  14908. Default value is @samp{intensity}.
  14909. @item scale
  14910. Specify scale used for calculating intensity color values.
  14911. It accepts the following values:
  14912. @table @samp
  14913. @item lin
  14914. linear
  14915. @item sqrt
  14916. square root, default
  14917. @item cbrt
  14918. cubic root
  14919. @item log
  14920. logarithmic
  14921. @item 4thrt
  14922. 4th root
  14923. @item 5thrt
  14924. 5th root
  14925. @end table
  14926. Default value is @samp{log}.
  14927. @item saturation
  14928. Set saturation modifier for displayed colors. Negative values provide
  14929. alternative color scheme. @code{0} is no saturation at all.
  14930. Saturation must be in [-10.0, 10.0] range.
  14931. Default value is @code{1}.
  14932. @item win_func
  14933. Set window function.
  14934. It accepts the following values:
  14935. @table @samp
  14936. @item rect
  14937. @item bartlett
  14938. @item hann
  14939. @item hanning
  14940. @item hamming
  14941. @item blackman
  14942. @item welch
  14943. @item flattop
  14944. @item bharris
  14945. @item bnuttall
  14946. @item bhann
  14947. @item sine
  14948. @item nuttall
  14949. @item lanczos
  14950. @item gauss
  14951. @item tukey
  14952. @item dolph
  14953. @item cauchy
  14954. @item parzen
  14955. @item poisson
  14956. @end table
  14957. Default value is @code{hann}.
  14958. @item orientation
  14959. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14960. @code{horizontal}. Default is @code{vertical}.
  14961. @item gain
  14962. Set scale gain for calculating intensity color values.
  14963. Default value is @code{1}.
  14964. @item legend
  14965. Draw time and frequency axes and legends. Default is enabled.
  14966. @item rotation
  14967. Set color rotation, must be in [-1.0, 1.0] range.
  14968. Default value is @code{0}.
  14969. @end table
  14970. @subsection Examples
  14971. @itemize
  14972. @item
  14973. Extract an audio spectrogram of a whole audio track
  14974. in a 1024x1024 picture using @command{ffmpeg}:
  14975. @example
  14976. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14977. @end example
  14978. @end itemize
  14979. @section showvolume
  14980. Convert input audio volume to a video output.
  14981. The filter accepts the following options:
  14982. @table @option
  14983. @item rate, r
  14984. Set video rate.
  14985. @item b
  14986. Set border width, allowed range is [0, 5]. Default is 1.
  14987. @item w
  14988. Set channel width, allowed range is [80, 8192]. Default is 400.
  14989. @item h
  14990. Set channel height, allowed range is [1, 900]. Default is 20.
  14991. @item f
  14992. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14993. @item c
  14994. Set volume color expression.
  14995. The expression can use the following variables:
  14996. @table @option
  14997. @item VOLUME
  14998. Current max volume of channel in dB.
  14999. @item PEAK
  15000. Current peak.
  15001. @item CHANNEL
  15002. Current channel number, starting from 0.
  15003. @end table
  15004. @item t
  15005. If set, displays channel names. Default is enabled.
  15006. @item v
  15007. If set, displays volume values. Default is enabled.
  15008. @item o
  15009. Set orientation, can be @code{horizontal} or @code{vertical},
  15010. default is @code{horizontal}.
  15011. @item s
  15012. Set step size, allowed range s [0, 5]. Default is 0, which means
  15013. step is disabled.
  15014. @end table
  15015. @section showwaves
  15016. Convert input audio to a video output, representing the samples waves.
  15017. The filter accepts the following options:
  15018. @table @option
  15019. @item size, s
  15020. Specify the video size for the output. For the syntax of this option, check the
  15021. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15022. Default value is @code{600x240}.
  15023. @item mode
  15024. Set display mode.
  15025. Available values are:
  15026. @table @samp
  15027. @item point
  15028. Draw a point for each sample.
  15029. @item line
  15030. Draw a vertical line for each sample.
  15031. @item p2p
  15032. Draw a point for each sample and a line between them.
  15033. @item cline
  15034. Draw a centered vertical line for each sample.
  15035. @end table
  15036. Default value is @code{point}.
  15037. @item n
  15038. Set the number of samples which are printed on the same column. A
  15039. larger value will decrease the frame rate. Must be a positive
  15040. integer. This option can be set only if the value for @var{rate}
  15041. is not explicitly specified.
  15042. @item rate, r
  15043. Set the (approximate) output frame rate. This is done by setting the
  15044. option @var{n}. Default value is "25".
  15045. @item split_channels
  15046. Set if channels should be drawn separately or overlap. Default value is 0.
  15047. @item colors
  15048. Set colors separated by '|' which are going to be used for drawing of each channel.
  15049. @item scale
  15050. Set amplitude scale.
  15051. Available values are:
  15052. @table @samp
  15053. @item lin
  15054. Linear.
  15055. @item log
  15056. Logarithmic.
  15057. @item sqrt
  15058. Square root.
  15059. @item cbrt
  15060. Cubic root.
  15061. @end table
  15062. Default is linear.
  15063. @end table
  15064. @subsection Examples
  15065. @itemize
  15066. @item
  15067. Output the input file audio and the corresponding video representation
  15068. at the same time:
  15069. @example
  15070. amovie=a.mp3,asplit[out0],showwaves[out1]
  15071. @end example
  15072. @item
  15073. Create a synthetic signal and show it with showwaves, forcing a
  15074. frame rate of 30 frames per second:
  15075. @example
  15076. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15077. @end example
  15078. @end itemize
  15079. @section showwavespic
  15080. Convert input audio to a single video frame, representing the samples waves.
  15081. The filter accepts the following options:
  15082. @table @option
  15083. @item size, s
  15084. Specify the video size for the output. For the syntax of this option, check the
  15085. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15086. Default value is @code{600x240}.
  15087. @item split_channels
  15088. Set if channels should be drawn separately or overlap. Default value is 0.
  15089. @item colors
  15090. Set colors separated by '|' which are going to be used for drawing of each channel.
  15091. @item scale
  15092. Set amplitude scale.
  15093. Available values are:
  15094. @table @samp
  15095. @item lin
  15096. Linear.
  15097. @item log
  15098. Logarithmic.
  15099. @item sqrt
  15100. Square root.
  15101. @item cbrt
  15102. Cubic root.
  15103. @end table
  15104. Default is linear.
  15105. @end table
  15106. @subsection Examples
  15107. @itemize
  15108. @item
  15109. Extract a channel split representation of the wave form of a whole audio track
  15110. in a 1024x800 picture using @command{ffmpeg}:
  15111. @example
  15112. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15113. @end example
  15114. @end itemize
  15115. @section sidedata, asidedata
  15116. Delete frame side data, or select frames based on it.
  15117. This filter accepts the following options:
  15118. @table @option
  15119. @item mode
  15120. Set mode of operation of the filter.
  15121. Can be one of the following:
  15122. @table @samp
  15123. @item select
  15124. Select every frame with side data of @code{type}.
  15125. @item delete
  15126. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15127. data in the frame.
  15128. @end table
  15129. @item type
  15130. Set side data type used with all modes. Must be set for @code{select} mode. For
  15131. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15132. in @file{libavutil/frame.h}. For example, to choose
  15133. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15134. @end table
  15135. @section spectrumsynth
  15136. Sythesize audio from 2 input video spectrums, first input stream represents
  15137. magnitude across time and second represents phase across time.
  15138. The filter will transform from frequency domain as displayed in videos back
  15139. to time domain as presented in audio output.
  15140. This filter is primarily created for reversing processed @ref{showspectrum}
  15141. filter outputs, but can synthesize sound from other spectrograms too.
  15142. But in such case results are going to be poor if the phase data is not
  15143. available, because in such cases phase data need to be recreated, usually
  15144. its just recreated from random noise.
  15145. For best results use gray only output (@code{channel} color mode in
  15146. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15147. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15148. @code{data} option. Inputs videos should generally use @code{fullframe}
  15149. slide mode as that saves resources needed for decoding video.
  15150. The filter accepts the following options:
  15151. @table @option
  15152. @item sample_rate
  15153. Specify sample rate of output audio, the sample rate of audio from which
  15154. spectrum was generated may differ.
  15155. @item channels
  15156. Set number of channels represented in input video spectrums.
  15157. @item scale
  15158. Set scale which was used when generating magnitude input spectrum.
  15159. Can be @code{lin} or @code{log}. Default is @code{log}.
  15160. @item slide
  15161. Set slide which was used when generating inputs spectrums.
  15162. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15163. Default is @code{fullframe}.
  15164. @item win_func
  15165. Set window function used for resynthesis.
  15166. @item overlap
  15167. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15168. which means optimal overlap for selected window function will be picked.
  15169. @item orientation
  15170. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15171. Default is @code{vertical}.
  15172. @end table
  15173. @subsection Examples
  15174. @itemize
  15175. @item
  15176. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15177. then resynthesize videos back to audio with spectrumsynth:
  15178. @example
  15179. 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
  15180. 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
  15181. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15182. @end example
  15183. @end itemize
  15184. @section split, asplit
  15185. Split input into several identical outputs.
  15186. @code{asplit} works with audio input, @code{split} with video.
  15187. The filter accepts a single parameter which specifies the number of outputs. If
  15188. unspecified, it defaults to 2.
  15189. @subsection Examples
  15190. @itemize
  15191. @item
  15192. Create two separate outputs from the same input:
  15193. @example
  15194. [in] split [out0][out1]
  15195. @end example
  15196. @item
  15197. To create 3 or more outputs, you need to specify the number of
  15198. outputs, like in:
  15199. @example
  15200. [in] asplit=3 [out0][out1][out2]
  15201. @end example
  15202. @item
  15203. Create two separate outputs from the same input, one cropped and
  15204. one padded:
  15205. @example
  15206. [in] split [splitout1][splitout2];
  15207. [splitout1] crop=100:100:0:0 [cropout];
  15208. [splitout2] pad=200:200:100:100 [padout];
  15209. @end example
  15210. @item
  15211. Create 5 copies of the input audio with @command{ffmpeg}:
  15212. @example
  15213. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15214. @end example
  15215. @end itemize
  15216. @section zmq, azmq
  15217. Receive commands sent through a libzmq client, and forward them to
  15218. filters in the filtergraph.
  15219. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15220. must be inserted between two video filters, @code{azmq} between two
  15221. audio filters.
  15222. To enable these filters you need to install the libzmq library and
  15223. headers and configure FFmpeg with @code{--enable-libzmq}.
  15224. For more information about libzmq see:
  15225. @url{http://www.zeromq.org/}
  15226. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15227. receives messages sent through a network interface defined by the
  15228. @option{bind_address} option.
  15229. The received message must be in the form:
  15230. @example
  15231. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15232. @end example
  15233. @var{TARGET} specifies the target of the command, usually the name of
  15234. the filter class or a specific filter instance name.
  15235. @var{COMMAND} specifies the name of the command for the target filter.
  15236. @var{ARG} is optional and specifies the optional argument list for the
  15237. given @var{COMMAND}.
  15238. Upon reception, the message is processed and the corresponding command
  15239. is injected into the filtergraph. Depending on the result, the filter
  15240. will send a reply to the client, adopting the format:
  15241. @example
  15242. @var{ERROR_CODE} @var{ERROR_REASON}
  15243. @var{MESSAGE}
  15244. @end example
  15245. @var{MESSAGE} is optional.
  15246. @subsection Examples
  15247. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15248. be used to send commands processed by these filters.
  15249. Consider the following filtergraph generated by @command{ffplay}
  15250. @example
  15251. ffplay -dumpgraph 1 -f lavfi "
  15252. color=s=100x100:c=red [l];
  15253. color=s=100x100:c=blue [r];
  15254. nullsrc=s=200x100, zmq [bg];
  15255. [bg][l] overlay [bg+l];
  15256. [bg+l][r] overlay=x=100 "
  15257. @end example
  15258. To change the color of the left side of the video, the following
  15259. command can be used:
  15260. @example
  15261. echo Parsed_color_0 c yellow | tools/zmqsend
  15262. @end example
  15263. To change the right side:
  15264. @example
  15265. echo Parsed_color_1 c pink | tools/zmqsend
  15266. @end example
  15267. @c man end MULTIMEDIA FILTERS
  15268. @chapter Multimedia Sources
  15269. @c man begin MULTIMEDIA SOURCES
  15270. Below is a description of the currently available multimedia sources.
  15271. @section amovie
  15272. This is the same as @ref{movie} source, except it selects an audio
  15273. stream by default.
  15274. @anchor{movie}
  15275. @section movie
  15276. Read audio and/or video stream(s) from a movie container.
  15277. It accepts the following parameters:
  15278. @table @option
  15279. @item filename
  15280. The name of the resource to read (not necessarily a file; it can also be a
  15281. device or a stream accessed through some protocol).
  15282. @item format_name, f
  15283. Specifies the format assumed for the movie to read, and can be either
  15284. the name of a container or an input device. If not specified, the
  15285. format is guessed from @var{movie_name} or by probing.
  15286. @item seek_point, sp
  15287. Specifies the seek point in seconds. The frames will be output
  15288. starting from this seek point. The parameter is evaluated with
  15289. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15290. postfix. The default value is "0".
  15291. @item streams, s
  15292. Specifies the streams to read. Several streams can be specified,
  15293. separated by "+". The source will then have as many outputs, in the
  15294. same order. The syntax is explained in the ``Stream specifiers''
  15295. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15296. respectively the default (best suited) video and audio stream. Default
  15297. is "dv", or "da" if the filter is called as "amovie".
  15298. @item stream_index, si
  15299. Specifies the index of the video stream to read. If the value is -1,
  15300. the most suitable video stream will be automatically selected. The default
  15301. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15302. audio instead of video.
  15303. @item loop
  15304. Specifies how many times to read the stream in sequence.
  15305. If the value is 0, the stream will be looped infinitely.
  15306. Default value is "1".
  15307. Note that when the movie is looped the source timestamps are not
  15308. changed, so it will generate non monotonically increasing timestamps.
  15309. @item discontinuity
  15310. Specifies the time difference between frames above which the point is
  15311. considered a timestamp discontinuity which is removed by adjusting the later
  15312. timestamps.
  15313. @end table
  15314. It allows overlaying a second video on top of the main input of
  15315. a filtergraph, as shown in this graph:
  15316. @example
  15317. input -----------> deltapts0 --> overlay --> output
  15318. ^
  15319. |
  15320. movie --> scale--> deltapts1 -------+
  15321. @end example
  15322. @subsection Examples
  15323. @itemize
  15324. @item
  15325. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15326. on top of the input labelled "in":
  15327. @example
  15328. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15329. [in] setpts=PTS-STARTPTS [main];
  15330. [main][over] overlay=16:16 [out]
  15331. @end example
  15332. @item
  15333. Read from a video4linux2 device, and overlay it on top of the input
  15334. labelled "in":
  15335. @example
  15336. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15337. [in] setpts=PTS-STARTPTS [main];
  15338. [main][over] overlay=16:16 [out]
  15339. @end example
  15340. @item
  15341. Read the first video stream and the audio stream with id 0x81 from
  15342. dvd.vob; the video is connected to the pad named "video" and the audio is
  15343. connected to the pad named "audio":
  15344. @example
  15345. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15346. @end example
  15347. @end itemize
  15348. @subsection Commands
  15349. Both movie and amovie support the following commands:
  15350. @table @option
  15351. @item seek
  15352. Perform seek using "av_seek_frame".
  15353. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15354. @itemize
  15355. @item
  15356. @var{stream_index}: If stream_index is -1, a default
  15357. stream is selected, and @var{timestamp} is automatically converted
  15358. from AV_TIME_BASE units to the stream specific time_base.
  15359. @item
  15360. @var{timestamp}: Timestamp in AVStream.time_base units
  15361. or, if no stream is specified, in AV_TIME_BASE units.
  15362. @item
  15363. @var{flags}: Flags which select direction and seeking mode.
  15364. @end itemize
  15365. @item get_duration
  15366. Get movie duration in AV_TIME_BASE units.
  15367. @end table
  15368. @c man end MULTIMEDIA SOURCES