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.

21105 lines
561KB

  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. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adeclick
  434. Remove impulsive noise from input audio.
  435. Samples detected as impulsive noise are replaced by interpolated samples using
  436. autoregressive modelling.
  437. @table @option
  438. @item w
  439. Set window size, in milliseconds. Allowed range is from @code{10} to
  440. @code{100}. Default value is @code{55} milliseconds.
  441. This sets size of window which will be processed at once.
  442. @item o
  443. Set window overlap, in percentage of window size. Allowed range is from
  444. @code{50} to @code{95}. Default value is @code{75} percent.
  445. Setting this to a very high value increases impulsive noise removal but makes
  446. whole process much slower.
  447. @item a
  448. Set autoregression order, in percentage of window size. Allowed range is from
  449. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  450. controls quality of interpolated samples using neighbour good samples.
  451. @item t
  452. Set threshold value. Allowed range is from @code{1} to @code{100}.
  453. Default value is @code{2}.
  454. This controls the strength of impulsive noise which is going to be removed.
  455. The lower value, the more samples will be detected as impulsive noise.
  456. @item b
  457. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  458. @code{10}. Default value is @code{2}.
  459. If any two samples deteced as noise are spaced less than this value then any
  460. sample inbetween those two samples will be also detected as noise.
  461. @item m
  462. Set overlap method.
  463. It accepts the following values:
  464. @table @option
  465. @item a
  466. Select overlap-add method. Even not interpolated samples are slightly
  467. changed with this method.
  468. @item s
  469. Select overlap-save method. Not interpolated samples remain unchanged.
  470. @end table
  471. Default value is @code{a}.
  472. @end table
  473. @section adeclip
  474. Remove clipped samples from input audio.
  475. Samples detected as clipped are replaced by interpolated samples using
  476. autoregressive modelling.
  477. @table @option
  478. @item w
  479. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  480. Default value is @code{55} milliseconds.
  481. This sets size of window which will be processed at once.
  482. @item o
  483. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  484. to @code{95}. Default value is @code{75} percent.
  485. @item a
  486. Set autoregression order, in percentage of window size. Allowed range is from
  487. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  488. quality of interpolated samples using neighbour good samples.
  489. @item t
  490. Set threshold value. Allowed range is from @code{1} to @code{100}.
  491. Default value is @code{10}. Higher values make clip detection less aggressive.
  492. @item n
  493. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  494. Default value is @code{1000}. Higher values make clip detection less aggressive.
  495. @item m
  496. Set overlap method.
  497. It accepts the following values:
  498. @table @option
  499. @item a
  500. Select overlap-add method. Even not interpolated samples are slightly changed
  501. with this method.
  502. @item s
  503. Select overlap-save method. Not interpolated samples remain unchanged.
  504. @end table
  505. Default value is @code{a}.
  506. @end table
  507. @section adelay
  508. Delay one or more audio channels.
  509. Samples in delayed channel are filled with silence.
  510. The filter accepts the following option:
  511. @table @option
  512. @item delays
  513. Set list of delays in milliseconds for each channel separated by '|'.
  514. Unused delays will be silently ignored. If number of given delays is
  515. smaller than number of channels all remaining channels will not be delayed.
  516. If you want to delay exact number of samples, append 'S' to number.
  517. @end table
  518. @subsection Examples
  519. @itemize
  520. @item
  521. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  522. the second channel (and any other channels that may be present) unchanged.
  523. @example
  524. adelay=1500|0|500
  525. @end example
  526. @item
  527. Delay second channel by 500 samples, the third channel by 700 samples and leave
  528. the first channel (and any other channels that may be present) unchanged.
  529. @example
  530. adelay=0|500S|700S
  531. @end example
  532. @end itemize
  533. @section aderivative, aintegral
  534. Compute derivative/integral of audio stream.
  535. Applying both filters one after another produces original audio.
  536. @section aecho
  537. Apply echoing to the input audio.
  538. Echoes are reflected sound and can occur naturally amongst mountains
  539. (and sometimes large buildings) when talking or shouting; digital echo
  540. effects emulate this behaviour and are often used to help fill out the
  541. sound of a single instrument or vocal. The time difference between the
  542. original signal and the reflection is the @code{delay}, and the
  543. loudness of the reflected signal is the @code{decay}.
  544. Multiple echoes can have different delays and decays.
  545. A description of the accepted parameters follows.
  546. @table @option
  547. @item in_gain
  548. Set input gain of reflected signal. Default is @code{0.6}.
  549. @item out_gain
  550. Set output gain of reflected signal. Default is @code{0.3}.
  551. @item delays
  552. Set list of time intervals in milliseconds between original signal and reflections
  553. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  554. Default is @code{1000}.
  555. @item decays
  556. Set list of loudness of reflected signals separated by '|'.
  557. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  558. Default is @code{0.5}.
  559. @end table
  560. @subsection Examples
  561. @itemize
  562. @item
  563. Make it sound as if there are twice as many instruments as are actually playing:
  564. @example
  565. aecho=0.8:0.88:60:0.4
  566. @end example
  567. @item
  568. If delay is very short, then it sound like a (metallic) robot playing music:
  569. @example
  570. aecho=0.8:0.88:6:0.4
  571. @end example
  572. @item
  573. A longer delay will sound like an open air concert in the mountains:
  574. @example
  575. aecho=0.8:0.9:1000:0.3
  576. @end example
  577. @item
  578. Same as above but with one more mountain:
  579. @example
  580. aecho=0.8:0.9:1000|1800:0.3|0.25
  581. @end example
  582. @end itemize
  583. @section aemphasis
  584. Audio emphasis filter creates or restores material directly taken from LPs or
  585. emphased CDs with different filter curves. E.g. to store music on vinyl the
  586. signal has to be altered by a filter first to even out the disadvantages of
  587. this recording medium.
  588. Once the material is played back the inverse filter has to be applied to
  589. restore the distortion of the frequency response.
  590. The filter accepts the following options:
  591. @table @option
  592. @item level_in
  593. Set input gain.
  594. @item level_out
  595. Set output gain.
  596. @item mode
  597. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  598. use @code{production} mode. Default is @code{reproduction} mode.
  599. @item type
  600. Set filter type. Selects medium. Can be one of the following:
  601. @table @option
  602. @item col
  603. select Columbia.
  604. @item emi
  605. select EMI.
  606. @item bsi
  607. select BSI (78RPM).
  608. @item riaa
  609. select RIAA.
  610. @item cd
  611. select Compact Disc (CD).
  612. @item 50fm
  613. select 50µs (FM).
  614. @item 75fm
  615. select 75µs (FM).
  616. @item 50kf
  617. select 50µs (FM-KF).
  618. @item 75kf
  619. select 75µs (FM-KF).
  620. @end table
  621. @end table
  622. @section aeval
  623. Modify an audio signal according to the specified expressions.
  624. This filter accepts one or more expressions (one for each channel),
  625. which are evaluated and used to modify a corresponding audio signal.
  626. It accepts the following parameters:
  627. @table @option
  628. @item exprs
  629. Set the '|'-separated expressions list for each separate channel. If
  630. the number of input channels is greater than the number of
  631. expressions, the last specified expression is used for the remaining
  632. output channels.
  633. @item channel_layout, c
  634. Set output channel layout. If not specified, the channel layout is
  635. specified by the number of expressions. If set to @samp{same}, it will
  636. use by default the same input channel layout.
  637. @end table
  638. Each expression in @var{exprs} can contain the following constants and functions:
  639. @table @option
  640. @item ch
  641. channel number of the current expression
  642. @item n
  643. number of the evaluated sample, starting from 0
  644. @item s
  645. sample rate
  646. @item t
  647. time of the evaluated sample expressed in seconds
  648. @item nb_in_channels
  649. @item nb_out_channels
  650. input and output number of channels
  651. @item val(CH)
  652. the value of input channel with number @var{CH}
  653. @end table
  654. Note: this filter is slow. For faster processing you should use a
  655. dedicated filter.
  656. @subsection Examples
  657. @itemize
  658. @item
  659. Half volume:
  660. @example
  661. aeval=val(ch)/2:c=same
  662. @end example
  663. @item
  664. Invert phase of the second channel:
  665. @example
  666. aeval=val(0)|-val(1)
  667. @end example
  668. @end itemize
  669. @anchor{afade}
  670. @section afade
  671. Apply fade-in/out effect to input audio.
  672. A description of the accepted parameters follows.
  673. @table @option
  674. @item type, t
  675. Specify the effect type, can be either @code{in} for fade-in, or
  676. @code{out} for a fade-out effect. Default is @code{in}.
  677. @item start_sample, ss
  678. Specify the number of the start sample for starting to apply the fade
  679. effect. Default is 0.
  680. @item nb_samples, ns
  681. Specify the number of samples for which the fade effect has to last. At
  682. the end of the fade-in effect the output audio will have the same
  683. volume as the input audio, at the end of the fade-out transition
  684. the output audio will be silence. Default is 44100.
  685. @item start_time, st
  686. Specify the start time of the fade effect. Default is 0.
  687. The value must be specified as a time duration; see
  688. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  689. for the accepted syntax.
  690. If set this option is used instead of @var{start_sample}.
  691. @item duration, d
  692. Specify the duration of the fade effect. See
  693. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  694. for the accepted syntax.
  695. At the end of the fade-in effect the output audio will have the same
  696. volume as the input audio, at the end of the fade-out transition
  697. the output audio will be silence.
  698. By default the duration is determined by @var{nb_samples}.
  699. If set this option is used instead of @var{nb_samples}.
  700. @item curve
  701. Set curve for fade transition.
  702. It accepts the following values:
  703. @table @option
  704. @item tri
  705. select triangular, linear slope (default)
  706. @item qsin
  707. select quarter of sine wave
  708. @item hsin
  709. select half of sine wave
  710. @item esin
  711. select exponential sine wave
  712. @item log
  713. select logarithmic
  714. @item ipar
  715. select inverted parabola
  716. @item qua
  717. select quadratic
  718. @item cub
  719. select cubic
  720. @item squ
  721. select square root
  722. @item cbr
  723. select cubic root
  724. @item par
  725. select parabola
  726. @item exp
  727. select exponential
  728. @item iqsin
  729. select inverted quarter of sine wave
  730. @item ihsin
  731. select inverted half of sine wave
  732. @item dese
  733. select double-exponential seat
  734. @item desi
  735. select double-exponential sigmoid
  736. @end table
  737. @end table
  738. @subsection Examples
  739. @itemize
  740. @item
  741. Fade in first 15 seconds of audio:
  742. @example
  743. afade=t=in:ss=0:d=15
  744. @end example
  745. @item
  746. Fade out last 25 seconds of a 900 seconds audio:
  747. @example
  748. afade=t=out:st=875:d=25
  749. @end example
  750. @end itemize
  751. @section afftfilt
  752. Apply arbitrary expressions to samples in frequency domain.
  753. @table @option
  754. @item real
  755. Set frequency domain real expression for each separate channel separated
  756. by '|'. Default is "1".
  757. If the number of input channels is greater than the number of
  758. expressions, the last specified expression is used for the remaining
  759. output channels.
  760. @item imag
  761. Set frequency domain imaginary expression for each separate channel
  762. separated by '|'. If not set, @var{real} option is used.
  763. Each expression in @var{real} and @var{imag} can contain the following
  764. constants:
  765. @table @option
  766. @item sr
  767. sample rate
  768. @item b
  769. current frequency bin number
  770. @item nb
  771. number of available bins
  772. @item ch
  773. channel number of the current expression
  774. @item chs
  775. number of channels
  776. @item pts
  777. current frame pts
  778. @end table
  779. @item win_size
  780. Set window size.
  781. It accepts the following values:
  782. @table @samp
  783. @item w16
  784. @item w32
  785. @item w64
  786. @item w128
  787. @item w256
  788. @item w512
  789. @item w1024
  790. @item w2048
  791. @item w4096
  792. @item w8192
  793. @item w16384
  794. @item w32768
  795. @item w65536
  796. @end table
  797. Default is @code{w4096}
  798. @item win_func
  799. Set window function. Default is @code{hann}.
  800. @item overlap
  801. Set window overlap. If set to 1, the recommended overlap for selected
  802. window function will be picked. Default is @code{0.75}.
  803. @end table
  804. @subsection Examples
  805. @itemize
  806. @item
  807. Leave almost only low frequencies in audio:
  808. @example
  809. afftfilt="1-clip((b/nb)*b,0,1)"
  810. @end example
  811. @end itemize
  812. @anchor{afir}
  813. @section afir
  814. Apply an arbitrary Frequency Impulse Response filter.
  815. This filter is designed for applying long FIR filters,
  816. up to 30 seconds long.
  817. It can be used as component for digital crossover filters,
  818. room equalization, cross talk cancellation, wavefield synthesis,
  819. auralization, ambiophonics and ambisonics.
  820. This filter uses second stream as FIR coefficients.
  821. If second stream holds single channel, it will be used
  822. for all input channels in first stream, otherwise
  823. number of channels in second stream must be same as
  824. number of channels in first stream.
  825. It accepts the following parameters:
  826. @table @option
  827. @item dry
  828. Set dry gain. This sets input gain.
  829. @item wet
  830. Set wet gain. This sets final output gain.
  831. @item length
  832. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  833. @item again
  834. Enable applying gain measured from power of IR.
  835. @item maxir
  836. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  837. Allowed range is 0.1 to 60 seconds.
  838. @item response
  839. Show IR frequency reponse, magnitude and phase in additional video stream.
  840. By default it is disabled.
  841. @item channel
  842. Set for which IR channel to display frequency response. By default is first channel
  843. displayed. This option is used only when @var{response} is enabled.
  844. @item size
  845. Set video stream size. This option is used only when @var{response} is enabled.
  846. @end table
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  851. @example
  852. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  853. @end example
  854. @end itemize
  855. @anchor{aformat}
  856. @section aformat
  857. Set output format constraints for the input audio. The framework will
  858. negotiate the most appropriate format to minimize conversions.
  859. It accepts the following parameters:
  860. @table @option
  861. @item sample_fmts
  862. A '|'-separated list of requested sample formats.
  863. @item sample_rates
  864. A '|'-separated list of requested sample rates.
  865. @item channel_layouts
  866. A '|'-separated list of requested channel layouts.
  867. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  868. for the required syntax.
  869. @end table
  870. If a parameter is omitted, all values are allowed.
  871. Force the output to either unsigned 8-bit or signed 16-bit stereo
  872. @example
  873. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  874. @end example
  875. @section agate
  876. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  877. processing reduces disturbing noise between useful signals.
  878. Gating is done by detecting the volume below a chosen level @var{threshold}
  879. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  880. floor is set via @var{range}. Because an exact manipulation of the signal
  881. would cause distortion of the waveform the reduction can be levelled over
  882. time. This is done by setting @var{attack} and @var{release}.
  883. @var{attack} determines how long the signal has to fall below the threshold
  884. before any reduction will occur and @var{release} sets the time the signal
  885. has to rise above the threshold to reduce the reduction again.
  886. Shorter signals than the chosen attack time will be left untouched.
  887. @table @option
  888. @item level_in
  889. Set input level before filtering.
  890. Default is 1. Allowed range is from 0.015625 to 64.
  891. @item range
  892. Set the level of gain reduction when the signal is below the threshold.
  893. Default is 0.06125. Allowed range is from 0 to 1.
  894. @item threshold
  895. If a signal rises above this level the gain reduction is released.
  896. Default is 0.125. Allowed range is from 0 to 1.
  897. @item ratio
  898. Set a ratio by which the signal is reduced.
  899. Default is 2. Allowed range is from 1 to 9000.
  900. @item attack
  901. Amount of milliseconds the signal has to rise above the threshold before gain
  902. reduction stops.
  903. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  904. @item release
  905. Amount of milliseconds the signal has to fall below the threshold before the
  906. reduction is increased again. Default is 250 milliseconds.
  907. Allowed range is from 0.01 to 9000.
  908. @item makeup
  909. Set amount of amplification of signal after processing.
  910. Default is 1. Allowed range is from 1 to 64.
  911. @item knee
  912. Curve the sharp knee around the threshold to enter gain reduction more softly.
  913. Default is 2.828427125. Allowed range is from 1 to 8.
  914. @item detection
  915. Choose if exact signal should be taken for detection or an RMS like one.
  916. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  917. @item link
  918. Choose if the average level between all channels or the louder channel affects
  919. the reduction.
  920. Default is @code{average}. Can be @code{average} or @code{maximum}.
  921. @end table
  922. @section aiir
  923. Apply an arbitrary Infinite Impulse Response filter.
  924. It accepts the following parameters:
  925. @table @option
  926. @item z
  927. Set numerator/zeros coefficients.
  928. @item p
  929. Set denominator/poles coefficients.
  930. @item k
  931. Set channels gains.
  932. @item dry_gain
  933. Set input gain.
  934. @item wet_gain
  935. Set output gain.
  936. @item f
  937. Set coefficients format.
  938. @table @samp
  939. @item tf
  940. transfer function
  941. @item zp
  942. Z-plane zeros/poles, cartesian (default)
  943. @item pr
  944. Z-plane zeros/poles, polar radians
  945. @item pd
  946. Z-plane zeros/poles, polar degrees
  947. @end table
  948. @item r
  949. Set kind of processing.
  950. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  951. @item e
  952. Set filtering precision.
  953. @table @samp
  954. @item dbl
  955. double-precision floating-point (default)
  956. @item flt
  957. single-precision floating-point
  958. @item i32
  959. 32-bit integers
  960. @item i16
  961. 16-bit integers
  962. @end table
  963. @item response
  964. Show IR frequency reponse, magnitude and phase in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @end table
  972. Coefficients in @code{tf} format are separated by spaces and are in ascending
  973. order.
  974. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  975. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  976. imaginary unit.
  977. Different coefficients and gains can be provided for every channel, in such case
  978. use '|' to separate coefficients or gains. Last provided coefficients will be
  979. used for all remaining channels.
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  984. @example
  985. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  986. @end example
  987. @item
  988. Same as above but in @code{zp} format:
  989. @example
  990. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  991. @end example
  992. @end itemize
  993. @section alimiter
  994. The limiter prevents an input signal from rising over a desired threshold.
  995. This limiter uses lookahead technology to prevent your signal from distorting.
  996. It means that there is a small delay after the signal is processed. Keep in mind
  997. that the delay it produces is the attack time you set.
  998. The filter accepts the following options:
  999. @table @option
  1000. @item level_in
  1001. Set input gain. Default is 1.
  1002. @item level_out
  1003. Set output gain. Default is 1.
  1004. @item limit
  1005. Don't let signals above this level pass the limiter. Default is 1.
  1006. @item attack
  1007. The limiter will reach its attenuation level in this amount of time in
  1008. milliseconds. Default is 5 milliseconds.
  1009. @item release
  1010. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1011. Default is 50 milliseconds.
  1012. @item asc
  1013. When gain reduction is always needed ASC takes care of releasing to an
  1014. average reduction level rather than reaching a reduction of 0 in the release
  1015. time.
  1016. @item asc_level
  1017. Select how much the release time is affected by ASC, 0 means nearly no changes
  1018. in release time while 1 produces higher release times.
  1019. @item level
  1020. Auto level output signal. Default is enabled.
  1021. This normalizes audio back to 0dB if enabled.
  1022. @end table
  1023. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1024. with @ref{aresample} before applying this filter.
  1025. @section allpass
  1026. Apply a two-pole all-pass filter with central frequency (in Hz)
  1027. @var{frequency}, and filter-width @var{width}.
  1028. An all-pass filter changes the audio's frequency to phase relationship
  1029. without changing its frequency to amplitude relationship.
  1030. The filter accepts the following options:
  1031. @table @option
  1032. @item frequency, f
  1033. Set frequency in Hz.
  1034. @item width_type, t
  1035. Set method to specify band-width of filter.
  1036. @table @option
  1037. @item h
  1038. Hz
  1039. @item q
  1040. Q-Factor
  1041. @item o
  1042. octave
  1043. @item s
  1044. slope
  1045. @item k
  1046. kHz
  1047. @end table
  1048. @item width, w
  1049. Specify the band-width of a filter in width_type units.
  1050. @item channels, c
  1051. Specify which channels to filter, by default all available are filtered.
  1052. @end table
  1053. @subsection Commands
  1054. This filter supports the following commands:
  1055. @table @option
  1056. @item frequency, f
  1057. Change allpass frequency.
  1058. Syntax for the command is : "@var{frequency}"
  1059. @item width_type, t
  1060. Change allpass width_type.
  1061. Syntax for the command is : "@var{width_type}"
  1062. @item width, w
  1063. Change allpass width.
  1064. Syntax for the command is : "@var{width}"
  1065. @end table
  1066. @section aloop
  1067. Loop audio samples.
  1068. The filter accepts the following options:
  1069. @table @option
  1070. @item loop
  1071. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1072. Default is 0.
  1073. @item size
  1074. Set maximal number of samples. Default is 0.
  1075. @item start
  1076. Set first sample of loop. Default is 0.
  1077. @end table
  1078. @anchor{amerge}
  1079. @section amerge
  1080. Merge two or more audio streams into a single multi-channel stream.
  1081. The filter accepts the following options:
  1082. @table @option
  1083. @item inputs
  1084. Set the number of inputs. Default is 2.
  1085. @end table
  1086. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1087. the channel layout of the output will be set accordingly and the channels
  1088. will be reordered as necessary. If the channel layouts of the inputs are not
  1089. disjoint, the output will have all the channels of the first input then all
  1090. the channels of the second input, in that order, and the channel layout of
  1091. the output will be the default value corresponding to the total number of
  1092. channels.
  1093. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1094. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1095. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1096. first input, b1 is the first channel of the second input).
  1097. On the other hand, if both input are in stereo, the output channels will be
  1098. in the default order: a1, a2, b1, b2, and the channel layout will be
  1099. arbitrarily set to 4.0, which may or may not be the expected value.
  1100. All inputs must have the same sample rate, and format.
  1101. If inputs do not have the same duration, the output will stop with the
  1102. shortest.
  1103. @subsection Examples
  1104. @itemize
  1105. @item
  1106. Merge two mono files into a stereo stream:
  1107. @example
  1108. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1109. @end example
  1110. @item
  1111. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1112. @example
  1113. 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
  1114. @end example
  1115. @end itemize
  1116. @section amix
  1117. Mixes multiple audio inputs into a single output.
  1118. Note that this filter only supports float samples (the @var{amerge}
  1119. and @var{pan} audio filters support many formats). If the @var{amix}
  1120. input has integer samples then @ref{aresample} will be automatically
  1121. inserted to perform the conversion to float samples.
  1122. For example
  1123. @example
  1124. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1125. @end example
  1126. will mix 3 input audio streams to a single output with the same duration as the
  1127. first input and a dropout transition time of 3 seconds.
  1128. It accepts the following parameters:
  1129. @table @option
  1130. @item inputs
  1131. The number of inputs. If unspecified, it defaults to 2.
  1132. @item duration
  1133. How to determine the end-of-stream.
  1134. @table @option
  1135. @item longest
  1136. The duration of the longest input. (default)
  1137. @item shortest
  1138. The duration of the shortest input.
  1139. @item first
  1140. The duration of the first input.
  1141. @end table
  1142. @item dropout_transition
  1143. The transition time, in seconds, for volume renormalization when an input
  1144. stream ends. The default value is 2 seconds.
  1145. @item weights
  1146. Specify weight of each input audio stream as sequence.
  1147. Each weight is separated by space. By default all inputs have same weight.
  1148. @end table
  1149. @section anequalizer
  1150. High-order parametric multiband equalizer for each channel.
  1151. It accepts the following parameters:
  1152. @table @option
  1153. @item params
  1154. This option string is in format:
  1155. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1156. Each equalizer band is separated by '|'.
  1157. @table @option
  1158. @item chn
  1159. Set channel number to which equalization will be applied.
  1160. If input doesn't have that channel the entry is ignored.
  1161. @item f
  1162. Set central frequency for band.
  1163. If input doesn't have that frequency the entry is ignored.
  1164. @item w
  1165. Set band width in hertz.
  1166. @item g
  1167. Set band gain in dB.
  1168. @item t
  1169. Set filter type for band, optional, can be:
  1170. @table @samp
  1171. @item 0
  1172. Butterworth, this is default.
  1173. @item 1
  1174. Chebyshev type 1.
  1175. @item 2
  1176. Chebyshev type 2.
  1177. @end table
  1178. @end table
  1179. @item curves
  1180. With this option activated frequency response of anequalizer is displayed
  1181. in video stream.
  1182. @item size
  1183. Set video stream size. Only useful if curves option is activated.
  1184. @item mgain
  1185. Set max gain that will be displayed. Only useful if curves option is activated.
  1186. Setting this to a reasonable value makes it possible to display gain which is derived from
  1187. neighbour bands which are too close to each other and thus produce higher gain
  1188. when both are activated.
  1189. @item fscale
  1190. Set frequency scale used to draw frequency response in video output.
  1191. Can be linear or logarithmic. Default is logarithmic.
  1192. @item colors
  1193. Set color for each channel curve which is going to be displayed in video stream.
  1194. This is list of color names separated by space or by '|'.
  1195. Unrecognised or missing colors will be replaced by white color.
  1196. @end table
  1197. @subsection Examples
  1198. @itemize
  1199. @item
  1200. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1201. for first 2 channels using Chebyshev type 1 filter:
  1202. @example
  1203. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1204. @end example
  1205. @end itemize
  1206. @subsection Commands
  1207. This filter supports the following commands:
  1208. @table @option
  1209. @item change
  1210. Alter existing filter parameters.
  1211. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1212. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1213. error is returned.
  1214. @var{freq} set new frequency parameter.
  1215. @var{width} set new width parameter in herz.
  1216. @var{gain} set new gain parameter in dB.
  1217. Full filter invocation with asendcmd may look like this:
  1218. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1219. @end table
  1220. @section anull
  1221. Pass the audio source unchanged to the output.
  1222. @section apad
  1223. Pad the end of an audio stream with silence.
  1224. This can be used together with @command{ffmpeg} @option{-shortest} to
  1225. extend audio streams to the same length as the video stream.
  1226. A description of the accepted options follows.
  1227. @table @option
  1228. @item packet_size
  1229. Set silence packet size. Default value is 4096.
  1230. @item pad_len
  1231. Set the number of samples of silence to add to the end. After the
  1232. value is reached, the stream is terminated. This option is mutually
  1233. exclusive with @option{whole_len}.
  1234. @item whole_len
  1235. Set the minimum total number of samples in the output audio stream. If
  1236. the value is longer than the input audio length, silence is added to
  1237. the end, until the value is reached. This option is mutually exclusive
  1238. with @option{pad_len}.
  1239. @end table
  1240. If neither the @option{pad_len} nor the @option{whole_len} option is
  1241. set, the filter will add silence to the end of the input stream
  1242. indefinitely.
  1243. @subsection Examples
  1244. @itemize
  1245. @item
  1246. Add 1024 samples of silence to the end of the input:
  1247. @example
  1248. apad=pad_len=1024
  1249. @end example
  1250. @item
  1251. Make sure the audio output will contain at least 10000 samples, pad
  1252. the input with silence if required:
  1253. @example
  1254. apad=whole_len=10000
  1255. @end example
  1256. @item
  1257. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1258. video stream will always result the shortest and will be converted
  1259. until the end in the output file when using the @option{shortest}
  1260. option:
  1261. @example
  1262. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1263. @end example
  1264. @end itemize
  1265. @section aphaser
  1266. Add a phasing effect to the input audio.
  1267. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1268. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1269. A description of the accepted parameters follows.
  1270. @table @option
  1271. @item in_gain
  1272. Set input gain. Default is 0.4.
  1273. @item out_gain
  1274. Set output gain. Default is 0.74
  1275. @item delay
  1276. Set delay in milliseconds. Default is 3.0.
  1277. @item decay
  1278. Set decay. Default is 0.4.
  1279. @item speed
  1280. Set modulation speed in Hz. Default is 0.5.
  1281. @item type
  1282. Set modulation type. Default is triangular.
  1283. It accepts the following values:
  1284. @table @samp
  1285. @item triangular, t
  1286. @item sinusoidal, s
  1287. @end table
  1288. @end table
  1289. @section apulsator
  1290. Audio pulsator is something between an autopanner and a tremolo.
  1291. But it can produce funny stereo effects as well. Pulsator changes the volume
  1292. of the left and right channel based on a LFO (low frequency oscillator) with
  1293. different waveforms and shifted phases.
  1294. This filter have the ability to define an offset between left and right
  1295. channel. An offset of 0 means that both LFO shapes match each other.
  1296. The left and right channel are altered equally - a conventional tremolo.
  1297. An offset of 50% means that the shape of the right channel is exactly shifted
  1298. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1299. an autopanner. At 1 both curves match again. Every setting in between moves the
  1300. phase shift gapless between all stages and produces some "bypassing" sounds with
  1301. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1302. the 0.5) the faster the signal passes from the left to the right speaker.
  1303. The filter accepts the following options:
  1304. @table @option
  1305. @item level_in
  1306. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1307. @item level_out
  1308. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1309. @item mode
  1310. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1311. sawup or sawdown. Default is sine.
  1312. @item amount
  1313. Set modulation. Define how much of original signal is affected by the LFO.
  1314. @item offset_l
  1315. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1316. @item offset_r
  1317. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1318. @item width
  1319. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1320. @item timing
  1321. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1322. @item bpm
  1323. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1324. is set to bpm.
  1325. @item ms
  1326. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1327. is set to ms.
  1328. @item hz
  1329. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1330. if timing is set to hz.
  1331. @end table
  1332. @anchor{aresample}
  1333. @section aresample
  1334. Resample the input audio to the specified parameters, using the
  1335. libswresample library. If none are specified then the filter will
  1336. automatically convert between its input and output.
  1337. This filter is also able to stretch/squeeze the audio data to make it match
  1338. the timestamps or to inject silence / cut out audio to make it match the
  1339. timestamps, do a combination of both or do neither.
  1340. The filter accepts the syntax
  1341. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1342. expresses a sample rate and @var{resampler_options} is a list of
  1343. @var{key}=@var{value} pairs, separated by ":". See the
  1344. @ref{Resampler Options,,"Resampler Options" section in the
  1345. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1346. for the complete list of supported options.
  1347. @subsection Examples
  1348. @itemize
  1349. @item
  1350. Resample the input audio to 44100Hz:
  1351. @example
  1352. aresample=44100
  1353. @end example
  1354. @item
  1355. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1356. samples per second compensation:
  1357. @example
  1358. aresample=async=1000
  1359. @end example
  1360. @end itemize
  1361. @section areverse
  1362. Reverse an audio clip.
  1363. Warning: This filter requires memory to buffer the entire clip, so trimming
  1364. is suggested.
  1365. @subsection Examples
  1366. @itemize
  1367. @item
  1368. Take the first 5 seconds of a clip, and reverse it.
  1369. @example
  1370. atrim=end=5,areverse
  1371. @end example
  1372. @end itemize
  1373. @section asetnsamples
  1374. Set the number of samples per each output audio frame.
  1375. The last output packet may contain a different number of samples, as
  1376. the filter will flush all the remaining samples when the input audio
  1377. signals its end.
  1378. The filter accepts the following options:
  1379. @table @option
  1380. @item nb_out_samples, n
  1381. Set the number of frames per each output audio frame. The number is
  1382. intended as the number of samples @emph{per each channel}.
  1383. Default value is 1024.
  1384. @item pad, p
  1385. If set to 1, the filter will pad the last audio frame with zeroes, so
  1386. that the last frame will contain the same number of samples as the
  1387. previous ones. Default value is 1.
  1388. @end table
  1389. For example, to set the number of per-frame samples to 1234 and
  1390. disable padding for the last frame, use:
  1391. @example
  1392. asetnsamples=n=1234:p=0
  1393. @end example
  1394. @section asetrate
  1395. Set the sample rate without altering the PCM data.
  1396. This will result in a change of speed and pitch.
  1397. The filter accepts the following options:
  1398. @table @option
  1399. @item sample_rate, r
  1400. Set the output sample rate. Default is 44100 Hz.
  1401. @end table
  1402. @section ashowinfo
  1403. Show a line containing various information for each input audio frame.
  1404. The input audio is not modified.
  1405. The shown line contains a sequence of key/value pairs of the form
  1406. @var{key}:@var{value}.
  1407. The following values are shown in the output:
  1408. @table @option
  1409. @item n
  1410. The (sequential) number of the input frame, starting from 0.
  1411. @item pts
  1412. The presentation timestamp of the input frame, in time base units; the time base
  1413. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1414. @item pts_time
  1415. The presentation timestamp of the input frame in seconds.
  1416. @item pos
  1417. position of the frame in the input stream, -1 if this information in
  1418. unavailable and/or meaningless (for example in case of synthetic audio)
  1419. @item fmt
  1420. The sample format.
  1421. @item chlayout
  1422. The channel layout.
  1423. @item rate
  1424. The sample rate for the audio frame.
  1425. @item nb_samples
  1426. The number of samples (per channel) in the frame.
  1427. @item checksum
  1428. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1429. audio, the data is treated as if all the planes were concatenated.
  1430. @item plane_checksums
  1431. A list of Adler-32 checksums for each data plane.
  1432. @end table
  1433. @anchor{astats}
  1434. @section astats
  1435. Display time domain statistical information about the audio channels.
  1436. Statistics are calculated and displayed for each audio channel and,
  1437. where applicable, an overall figure is also given.
  1438. It accepts the following option:
  1439. @table @option
  1440. @item length
  1441. Short window length in seconds, used for peak and trough RMS measurement.
  1442. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1443. @item metadata
  1444. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1445. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1446. disabled.
  1447. Available keys for each channel are:
  1448. DC_offset
  1449. Min_level
  1450. Max_level
  1451. Min_difference
  1452. Max_difference
  1453. Mean_difference
  1454. RMS_difference
  1455. Peak_level
  1456. RMS_peak
  1457. RMS_trough
  1458. Crest_factor
  1459. Flat_factor
  1460. Peak_count
  1461. Bit_depth
  1462. Dynamic_range
  1463. and for Overall:
  1464. DC_offset
  1465. Min_level
  1466. Max_level
  1467. Min_difference
  1468. Max_difference
  1469. Mean_difference
  1470. RMS_difference
  1471. Peak_level
  1472. RMS_level
  1473. RMS_peak
  1474. RMS_trough
  1475. Flat_factor
  1476. Peak_count
  1477. Bit_depth
  1478. Number_of_samples
  1479. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1480. this @code{lavfi.astats.Overall.Peak_count}.
  1481. For description what each key means read below.
  1482. @item reset
  1483. Set number of frame after which stats are going to be recalculated.
  1484. Default is disabled.
  1485. @end table
  1486. A description of each shown parameter follows:
  1487. @table @option
  1488. @item DC offset
  1489. Mean amplitude displacement from zero.
  1490. @item Min level
  1491. Minimal sample level.
  1492. @item Max level
  1493. Maximal sample level.
  1494. @item Min difference
  1495. Minimal difference between two consecutive samples.
  1496. @item Max difference
  1497. Maximal difference between two consecutive samples.
  1498. @item Mean difference
  1499. Mean difference between two consecutive samples.
  1500. The average of each difference between two consecutive samples.
  1501. @item RMS difference
  1502. Root Mean Square difference between two consecutive samples.
  1503. @item Peak level dB
  1504. @item RMS level dB
  1505. Standard peak and RMS level measured in dBFS.
  1506. @item RMS peak dB
  1507. @item RMS trough dB
  1508. Peak and trough values for RMS level measured over a short window.
  1509. @item Crest factor
  1510. Standard ratio of peak to RMS level (note: not in dB).
  1511. @item Flat factor
  1512. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1513. (i.e. either @var{Min level} or @var{Max level}).
  1514. @item Peak count
  1515. Number of occasions (not the number of samples) that the signal attained either
  1516. @var{Min level} or @var{Max level}.
  1517. @item Bit depth
  1518. Overall bit depth of audio. Number of bits used for each sample.
  1519. @item Dynamic range
  1520. Measured dynamic range of audio in dB.
  1521. @end table
  1522. @section atempo
  1523. Adjust audio tempo.
  1524. The filter accepts exactly one parameter, the audio tempo. If not
  1525. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1526. be in the [0.5, 100.0] range.
  1527. Note that tempo greater than 2 will skip some samples rather than
  1528. blend them in. If for any reason this is a concern it is always
  1529. possible to daisy-chain several instances of atempo to achieve the
  1530. desired product tempo.
  1531. @subsection Examples
  1532. @itemize
  1533. @item
  1534. Slow down audio to 80% tempo:
  1535. @example
  1536. atempo=0.8
  1537. @end example
  1538. @item
  1539. To speed up audio to 300% tempo:
  1540. @example
  1541. atempo=3
  1542. @end example
  1543. @item
  1544. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1545. @example
  1546. atempo=sqrt(3),atempo=sqrt(3)
  1547. @end example
  1548. @end itemize
  1549. @section atrim
  1550. Trim the input so that the output contains one continuous subpart of the input.
  1551. It accepts the following parameters:
  1552. @table @option
  1553. @item start
  1554. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1555. sample with the timestamp @var{start} will be the first sample in the output.
  1556. @item end
  1557. Specify time of the first audio sample that will be dropped, i.e. the
  1558. audio sample immediately preceding the one with the timestamp @var{end} will be
  1559. the last sample in the output.
  1560. @item start_pts
  1561. Same as @var{start}, except this option sets the start timestamp in samples
  1562. instead of seconds.
  1563. @item end_pts
  1564. Same as @var{end}, except this option sets the end timestamp in samples instead
  1565. of seconds.
  1566. @item duration
  1567. The maximum duration of the output in seconds.
  1568. @item start_sample
  1569. The number of the first sample that should be output.
  1570. @item end_sample
  1571. The number of the first sample that should be dropped.
  1572. @end table
  1573. @option{start}, @option{end}, and @option{duration} are expressed as time
  1574. duration specifications; see
  1575. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1576. Note that the first two sets of the start/end options and the @option{duration}
  1577. option look at the frame timestamp, while the _sample options simply count the
  1578. samples that pass through the filter. So start/end_pts and start/end_sample will
  1579. give different results when the timestamps are wrong, inexact or do not start at
  1580. zero. Also note that this filter does not modify the timestamps. If you wish
  1581. to have the output timestamps start at zero, insert the asetpts filter after the
  1582. atrim filter.
  1583. If multiple start or end options are set, this filter tries to be greedy and
  1584. keep all samples that match at least one of the specified constraints. To keep
  1585. only the part that matches all the constraints at once, chain multiple atrim
  1586. filters.
  1587. The defaults are such that all the input is kept. So it is possible to set e.g.
  1588. just the end values to keep everything before the specified time.
  1589. Examples:
  1590. @itemize
  1591. @item
  1592. Drop everything except the second minute of input:
  1593. @example
  1594. ffmpeg -i INPUT -af atrim=60:120
  1595. @end example
  1596. @item
  1597. Keep only the first 1000 samples:
  1598. @example
  1599. ffmpeg -i INPUT -af atrim=end_sample=1000
  1600. @end example
  1601. @end itemize
  1602. @section bandpass
  1603. Apply a two-pole Butterworth band-pass filter with central
  1604. frequency @var{frequency}, and (3dB-point) band-width width.
  1605. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1606. instead of the default: constant 0dB peak gain.
  1607. The filter roll off at 6dB per octave (20dB per decade).
  1608. The filter accepts the following options:
  1609. @table @option
  1610. @item frequency, f
  1611. Set the filter's central frequency. Default is @code{3000}.
  1612. @item csg
  1613. Constant skirt gain if set to 1. Defaults to 0.
  1614. @item width_type, t
  1615. Set method to specify band-width of filter.
  1616. @table @option
  1617. @item h
  1618. Hz
  1619. @item q
  1620. Q-Factor
  1621. @item o
  1622. octave
  1623. @item s
  1624. slope
  1625. @item k
  1626. kHz
  1627. @end table
  1628. @item width, w
  1629. Specify the band-width of a filter in width_type units.
  1630. @item channels, c
  1631. Specify which channels to filter, by default all available are filtered.
  1632. @end table
  1633. @subsection Commands
  1634. This filter supports the following commands:
  1635. @table @option
  1636. @item frequency, f
  1637. Change bandpass frequency.
  1638. Syntax for the command is : "@var{frequency}"
  1639. @item width_type, t
  1640. Change bandpass width_type.
  1641. Syntax for the command is : "@var{width_type}"
  1642. @item width, w
  1643. Change bandpass width.
  1644. Syntax for the command is : "@var{width}"
  1645. @end table
  1646. @section bandreject
  1647. Apply a two-pole Butterworth band-reject filter with central
  1648. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1649. The filter roll off at 6dB per octave (20dB per decade).
  1650. The filter accepts the following options:
  1651. @table @option
  1652. @item frequency, f
  1653. Set the filter's central frequency. Default is @code{3000}.
  1654. @item width_type, t
  1655. Set method to specify band-width of filter.
  1656. @table @option
  1657. @item h
  1658. Hz
  1659. @item q
  1660. Q-Factor
  1661. @item o
  1662. octave
  1663. @item s
  1664. slope
  1665. @item k
  1666. kHz
  1667. @end table
  1668. @item width, w
  1669. Specify the band-width of a filter in width_type units.
  1670. @item channels, c
  1671. Specify which channels to filter, by default all available are filtered.
  1672. @end table
  1673. @subsection Commands
  1674. This filter supports the following commands:
  1675. @table @option
  1676. @item frequency, f
  1677. Change bandreject frequency.
  1678. Syntax for the command is : "@var{frequency}"
  1679. @item width_type, t
  1680. Change bandreject width_type.
  1681. Syntax for the command is : "@var{width_type}"
  1682. @item width, w
  1683. Change bandreject width.
  1684. Syntax for the command is : "@var{width}"
  1685. @end table
  1686. @section bass, lowshelf
  1687. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1688. shelving filter with a response similar to that of a standard
  1689. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1690. The filter accepts the following options:
  1691. @table @option
  1692. @item gain, g
  1693. Give the gain at 0 Hz. Its useful range is about -20
  1694. (for a large cut) to +20 (for a large boost).
  1695. Beware of clipping when using a positive gain.
  1696. @item frequency, f
  1697. Set the filter's central frequency and so can be used
  1698. to extend or reduce the frequency range to be boosted or cut.
  1699. The default value is @code{100} Hz.
  1700. @item width_type, t
  1701. Set method to specify band-width of filter.
  1702. @table @option
  1703. @item h
  1704. Hz
  1705. @item q
  1706. Q-Factor
  1707. @item o
  1708. octave
  1709. @item s
  1710. slope
  1711. @item k
  1712. kHz
  1713. @end table
  1714. @item width, w
  1715. Determine how steep is the filter's shelf transition.
  1716. @item channels, c
  1717. Specify which channels to filter, by default all available are filtered.
  1718. @end table
  1719. @subsection Commands
  1720. This filter supports the following commands:
  1721. @table @option
  1722. @item frequency, f
  1723. Change bass frequency.
  1724. Syntax for the command is : "@var{frequency}"
  1725. @item width_type, t
  1726. Change bass width_type.
  1727. Syntax for the command is : "@var{width_type}"
  1728. @item width, w
  1729. Change bass width.
  1730. Syntax for the command is : "@var{width}"
  1731. @item gain, g
  1732. Change bass gain.
  1733. Syntax for the command is : "@var{gain}"
  1734. @end table
  1735. @section biquad
  1736. Apply a biquad IIR filter with the given coefficients.
  1737. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1738. are the numerator and denominator coefficients respectively.
  1739. and @var{channels}, @var{c} specify which channels to filter, by default all
  1740. available are filtered.
  1741. @subsection Commands
  1742. This filter supports the following commands:
  1743. @table @option
  1744. @item a0
  1745. @item a1
  1746. @item a2
  1747. @item b0
  1748. @item b1
  1749. @item b2
  1750. Change biquad parameter.
  1751. Syntax for the command is : "@var{value}"
  1752. @end table
  1753. @section bs2b
  1754. Bauer stereo to binaural transformation, which improves headphone listening of
  1755. stereo audio records.
  1756. To enable compilation of this filter you need to configure FFmpeg with
  1757. @code{--enable-libbs2b}.
  1758. It accepts the following parameters:
  1759. @table @option
  1760. @item profile
  1761. Pre-defined crossfeed level.
  1762. @table @option
  1763. @item default
  1764. Default level (fcut=700, feed=50).
  1765. @item cmoy
  1766. Chu Moy circuit (fcut=700, feed=60).
  1767. @item jmeier
  1768. Jan Meier circuit (fcut=650, feed=95).
  1769. @end table
  1770. @item fcut
  1771. Cut frequency (in Hz).
  1772. @item feed
  1773. Feed level (in Hz).
  1774. @end table
  1775. @section channelmap
  1776. Remap input channels to new locations.
  1777. It accepts the following parameters:
  1778. @table @option
  1779. @item map
  1780. Map channels from input to output. The argument is a '|'-separated list of
  1781. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1782. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1783. channel (e.g. FL for front left) or its index in the input channel layout.
  1784. @var{out_channel} is the name of the output channel or its index in the output
  1785. channel layout. If @var{out_channel} is not given then it is implicitly an
  1786. index, starting with zero and increasing by one for each mapping.
  1787. @item channel_layout
  1788. The channel layout of the output stream.
  1789. @end table
  1790. If no mapping is present, the filter will implicitly map input channels to
  1791. output channels, preserving indices.
  1792. @subsection Examples
  1793. @itemize
  1794. @item
  1795. For example, assuming a 5.1+downmix input MOV file,
  1796. @example
  1797. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1798. @end example
  1799. will create an output WAV file tagged as stereo from the downmix channels of
  1800. the input.
  1801. @item
  1802. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1803. @example
  1804. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1805. @end example
  1806. @end itemize
  1807. @section channelsplit
  1808. Split each channel from an input audio stream into a separate output stream.
  1809. It accepts the following parameters:
  1810. @table @option
  1811. @item channel_layout
  1812. The channel layout of the input stream. The default is "stereo".
  1813. @item channels
  1814. A channel layout describing the channels to be extracted as separate output streams
  1815. or "all" to extract each input channel as a separate stream. The default is "all".
  1816. Choosing channels not present in channel layout in the input will result in an error.
  1817. @end table
  1818. @subsection Examples
  1819. @itemize
  1820. @item
  1821. For example, assuming a stereo input MP3 file,
  1822. @example
  1823. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1824. @end example
  1825. will create an output Matroska file with two audio streams, one containing only
  1826. the left channel and the other the right channel.
  1827. @item
  1828. Split a 5.1 WAV file into per-channel files:
  1829. @example
  1830. ffmpeg -i in.wav -filter_complex
  1831. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1832. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1833. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1834. side_right.wav
  1835. @end example
  1836. @item
  1837. Extract only LFE from a 5.1 WAV file:
  1838. @example
  1839. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1840. -map '[LFE]' lfe.wav
  1841. @end example
  1842. @end itemize
  1843. @section chorus
  1844. Add a chorus effect to the audio.
  1845. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1846. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1847. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1848. The modulation depth defines the range the modulated delay is played before or after
  1849. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1850. sound tuned around the original one, like in a chorus where some vocals are slightly
  1851. off key.
  1852. It accepts the following parameters:
  1853. @table @option
  1854. @item in_gain
  1855. Set input gain. Default is 0.4.
  1856. @item out_gain
  1857. Set output gain. Default is 0.4.
  1858. @item delays
  1859. Set delays. A typical delay is around 40ms to 60ms.
  1860. @item decays
  1861. Set decays.
  1862. @item speeds
  1863. Set speeds.
  1864. @item depths
  1865. Set depths.
  1866. @end table
  1867. @subsection Examples
  1868. @itemize
  1869. @item
  1870. A single delay:
  1871. @example
  1872. chorus=0.7:0.9:55:0.4:0.25:2
  1873. @end example
  1874. @item
  1875. Two delays:
  1876. @example
  1877. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1878. @end example
  1879. @item
  1880. Fuller sounding chorus with three delays:
  1881. @example
  1882. 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
  1883. @end example
  1884. @end itemize
  1885. @section compand
  1886. Compress or expand the audio's dynamic range.
  1887. It accepts the following parameters:
  1888. @table @option
  1889. @item attacks
  1890. @item decays
  1891. A list of times in seconds for each channel over which the instantaneous level
  1892. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1893. increase of volume and @var{decays} refers to decrease of volume. For most
  1894. situations, the attack time (response to the audio getting louder) should be
  1895. shorter than the decay time, because the human ear is more sensitive to sudden
  1896. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1897. a typical value for decay is 0.8 seconds.
  1898. If specified number of attacks & decays is lower than number of channels, the last
  1899. set attack/decay will be used for all remaining channels.
  1900. @item points
  1901. A list of points for the transfer function, specified in dB relative to the
  1902. maximum possible signal amplitude. Each key points list must be defined using
  1903. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1904. @code{x0/y0 x1/y1 x2/y2 ....}
  1905. The input values must be in strictly increasing order but the transfer function
  1906. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1907. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1908. function are @code{-70/-70|-60/-20|1/0}.
  1909. @item soft-knee
  1910. Set the curve radius in dB for all joints. It defaults to 0.01.
  1911. @item gain
  1912. Set the additional gain in dB to be applied at all points on the transfer
  1913. function. This allows for easy adjustment of the overall gain.
  1914. It defaults to 0.
  1915. @item volume
  1916. Set an initial volume, in dB, to be assumed for each channel when filtering
  1917. starts. This permits the user to supply a nominal level initially, so that, for
  1918. example, a very large gain is not applied to initial signal levels before the
  1919. companding has begun to operate. A typical value for audio which is initially
  1920. quiet is -90 dB. It defaults to 0.
  1921. @item delay
  1922. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1923. delayed before being fed to the volume adjuster. Specifying a delay
  1924. approximately equal to the attack/decay times allows the filter to effectively
  1925. operate in predictive rather than reactive mode. It defaults to 0.
  1926. @end table
  1927. @subsection Examples
  1928. @itemize
  1929. @item
  1930. Make music with both quiet and loud passages suitable for listening to in a
  1931. noisy environment:
  1932. @example
  1933. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1934. @end example
  1935. Another example for audio with whisper and explosion parts:
  1936. @example
  1937. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1938. @end example
  1939. @item
  1940. A noise gate for when the noise is at a lower level than the signal:
  1941. @example
  1942. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1943. @end example
  1944. @item
  1945. Here is another noise gate, this time for when the noise is at a higher level
  1946. than the signal (making it, in some ways, similar to squelch):
  1947. @example
  1948. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1949. @end example
  1950. @item
  1951. 2:1 compression starting at -6dB:
  1952. @example
  1953. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1954. @end example
  1955. @item
  1956. 2:1 compression starting at -9dB:
  1957. @example
  1958. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1959. @end example
  1960. @item
  1961. 2:1 compression starting at -12dB:
  1962. @example
  1963. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1964. @end example
  1965. @item
  1966. 2:1 compression starting at -18dB:
  1967. @example
  1968. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1969. @end example
  1970. @item
  1971. 3:1 compression starting at -15dB:
  1972. @example
  1973. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1974. @end example
  1975. @item
  1976. Compressor/Gate:
  1977. @example
  1978. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1979. @end example
  1980. @item
  1981. Expander:
  1982. @example
  1983. 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
  1984. @end example
  1985. @item
  1986. Hard limiter at -6dB:
  1987. @example
  1988. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1989. @end example
  1990. @item
  1991. Hard limiter at -12dB:
  1992. @example
  1993. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1994. @end example
  1995. @item
  1996. Hard noise gate at -35 dB:
  1997. @example
  1998. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1999. @end example
  2000. @item
  2001. Soft limiter:
  2002. @example
  2003. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2004. @end example
  2005. @end itemize
  2006. @section compensationdelay
  2007. Compensation Delay Line is a metric based delay to compensate differing
  2008. positions of microphones or speakers.
  2009. For example, you have recorded guitar with two microphones placed in
  2010. different location. Because the front of sound wave has fixed speed in
  2011. normal conditions, the phasing of microphones can vary and depends on
  2012. their location and interposition. The best sound mix can be achieved when
  2013. these microphones are in phase (synchronized). Note that distance of
  2014. ~30 cm between microphones makes one microphone to capture signal in
  2015. antiphase to another microphone. That makes the final mix sounding moody.
  2016. This filter helps to solve phasing problems by adding different delays
  2017. to each microphone track and make them synchronized.
  2018. The best result can be reached when you take one track as base and
  2019. synchronize other tracks one by one with it.
  2020. Remember that synchronization/delay tolerance depends on sample rate, too.
  2021. Higher sample rates will give more tolerance.
  2022. It accepts the following parameters:
  2023. @table @option
  2024. @item mm
  2025. Set millimeters distance. This is compensation distance for fine tuning.
  2026. Default is 0.
  2027. @item cm
  2028. Set cm distance. This is compensation distance for tightening distance setup.
  2029. Default is 0.
  2030. @item m
  2031. Set meters distance. This is compensation distance for hard distance setup.
  2032. Default is 0.
  2033. @item dry
  2034. Set dry amount. Amount of unprocessed (dry) signal.
  2035. Default is 0.
  2036. @item wet
  2037. Set wet amount. Amount of processed (wet) signal.
  2038. Default is 1.
  2039. @item temp
  2040. Set temperature degree in Celsius. This is the temperature of the environment.
  2041. Default is 20.
  2042. @end table
  2043. @section crossfeed
  2044. Apply headphone crossfeed filter.
  2045. Crossfeed is the process of blending the left and right channels of stereo
  2046. audio recording.
  2047. It is mainly used to reduce extreme stereo separation of low frequencies.
  2048. The intent is to produce more speaker like sound to the listener.
  2049. The filter accepts the following options:
  2050. @table @option
  2051. @item strength
  2052. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2053. This sets gain of low shelf filter for side part of stereo image.
  2054. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2055. @item range
  2056. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2057. This sets cut off frequency of low shelf filter. Default is cut off near
  2058. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2059. @item level_in
  2060. Set input gain. Default is 0.9.
  2061. @item level_out
  2062. Set output gain. Default is 1.
  2063. @end table
  2064. @section crystalizer
  2065. Simple algorithm to expand audio dynamic range.
  2066. The filter accepts the following options:
  2067. @table @option
  2068. @item i
  2069. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2070. (unchanged sound) to 10.0 (maximum effect).
  2071. @item c
  2072. Enable clipping. By default is enabled.
  2073. @end table
  2074. @section dcshift
  2075. Apply a DC shift to the audio.
  2076. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2077. in the recording chain) from the audio. The effect of a DC offset is reduced
  2078. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2079. a signal has a DC offset.
  2080. @table @option
  2081. @item shift
  2082. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2083. the audio.
  2084. @item limitergain
  2085. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2086. used to prevent clipping.
  2087. @end table
  2088. @section drmeter
  2089. Measure audio dynamic range.
  2090. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2091. is found in transition material. And anything less that 8 have very poor dynamics
  2092. and is very compressed.
  2093. The filter accepts the following options:
  2094. @table @option
  2095. @item length
  2096. Set window length in seconds used to split audio into segments of equal length.
  2097. Default is 3 seconds.
  2098. @end table
  2099. @section dynaudnorm
  2100. Dynamic Audio Normalizer.
  2101. This filter applies a certain amount of gain to the input audio in order
  2102. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2103. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2104. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2105. This allows for applying extra gain to the "quiet" sections of the audio
  2106. while avoiding distortions or clipping the "loud" sections. In other words:
  2107. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2108. sections, in the sense that the volume of each section is brought to the
  2109. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2110. this goal *without* applying "dynamic range compressing". It will retain 100%
  2111. of the dynamic range *within* each section of the audio file.
  2112. @table @option
  2113. @item f
  2114. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2115. Default is 500 milliseconds.
  2116. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2117. referred to as frames. This is required, because a peak magnitude has no
  2118. meaning for just a single sample value. Instead, we need to determine the
  2119. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2120. normalizer would simply use the peak magnitude of the complete file, the
  2121. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2122. frame. The length of a frame is specified in milliseconds. By default, the
  2123. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2124. been found to give good results with most files.
  2125. Note that the exact frame length, in number of samples, will be determined
  2126. automatically, based on the sampling rate of the individual input audio file.
  2127. @item g
  2128. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2129. number. Default is 31.
  2130. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2131. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2132. is specified in frames, centered around the current frame. For the sake of
  2133. simplicity, this must be an odd number. Consequently, the default value of 31
  2134. takes into account the current frame, as well as the 15 preceding frames and
  2135. the 15 subsequent frames. Using a larger window results in a stronger
  2136. smoothing effect and thus in less gain variation, i.e. slower gain
  2137. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2138. effect and thus in more gain variation, i.e. faster gain adaptation.
  2139. In other words, the more you increase this value, the more the Dynamic Audio
  2140. Normalizer will behave like a "traditional" normalization filter. On the
  2141. contrary, the more you decrease this value, the more the Dynamic Audio
  2142. Normalizer will behave like a dynamic range compressor.
  2143. @item p
  2144. Set the target peak value. This specifies the highest permissible magnitude
  2145. level for the normalized audio input. This filter will try to approach the
  2146. target peak magnitude as closely as possible, but at the same time it also
  2147. makes sure that the normalized signal will never exceed the peak magnitude.
  2148. A frame's maximum local gain factor is imposed directly by the target peak
  2149. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2150. It is not recommended to go above this value.
  2151. @item m
  2152. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2153. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2154. factor for each input frame, i.e. the maximum gain factor that does not
  2155. result in clipping or distortion. The maximum gain factor is determined by
  2156. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2157. additionally bounds the frame's maximum gain factor by a predetermined
  2158. (global) maximum gain factor. This is done in order to avoid excessive gain
  2159. factors in "silent" or almost silent frames. By default, the maximum gain
  2160. factor is 10.0, For most inputs the default value should be sufficient and
  2161. it usually is not recommended to increase this value. Though, for input
  2162. with an extremely low overall volume level, it may be necessary to allow even
  2163. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2164. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2165. Instead, a "sigmoid" threshold function will be applied. This way, the
  2166. gain factors will smoothly approach the threshold value, but never exceed that
  2167. value.
  2168. @item r
  2169. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2170. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2171. This means that the maximum local gain factor for each frame is defined
  2172. (only) by the frame's highest magnitude sample. This way, the samples can
  2173. be amplified as much as possible without exceeding the maximum signal
  2174. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2175. Normalizer can also take into account the frame's root mean square,
  2176. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2177. determine the power of a time-varying signal. It is therefore considered
  2178. that the RMS is a better approximation of the "perceived loudness" than
  2179. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2180. frames to a constant RMS value, a uniform "perceived loudness" can be
  2181. established. If a target RMS value has been specified, a frame's local gain
  2182. factor is defined as the factor that would result in exactly that RMS value.
  2183. Note, however, that the maximum local gain factor is still restricted by the
  2184. frame's highest magnitude sample, in order to prevent clipping.
  2185. @item n
  2186. Enable channels coupling. By default is enabled.
  2187. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2188. amount. This means the same gain factor will be applied to all channels, i.e.
  2189. the maximum possible gain factor is determined by the "loudest" channel.
  2190. However, in some recordings, it may happen that the volume of the different
  2191. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2192. In this case, this option can be used to disable the channel coupling. This way,
  2193. the gain factor will be determined independently for each channel, depending
  2194. only on the individual channel's highest magnitude sample. This allows for
  2195. harmonizing the volume of the different channels.
  2196. @item c
  2197. Enable DC bias correction. By default is disabled.
  2198. An audio signal (in the time domain) is a sequence of sample values.
  2199. In the Dynamic Audio Normalizer these sample values are represented in the
  2200. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2201. audio signal, or "waveform", should be centered around the zero point.
  2202. That means if we calculate the mean value of all samples in a file, or in a
  2203. single frame, then the result should be 0.0 or at least very close to that
  2204. value. If, however, there is a significant deviation of the mean value from
  2205. 0.0, in either positive or negative direction, this is referred to as a
  2206. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2207. Audio Normalizer provides optional DC bias correction.
  2208. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2209. the mean value, or "DC correction" offset, of each input frame and subtract
  2210. that value from all of the frame's sample values which ensures those samples
  2211. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2212. boundaries, the DC correction offset values will be interpolated smoothly
  2213. between neighbouring frames.
  2214. @item b
  2215. Enable alternative boundary mode. By default is disabled.
  2216. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2217. around each frame. This includes the preceding frames as well as the
  2218. subsequent frames. However, for the "boundary" frames, located at the very
  2219. beginning and at the very end of the audio file, not all neighbouring
  2220. frames are available. In particular, for the first few frames in the audio
  2221. file, the preceding frames are not known. And, similarly, for the last few
  2222. frames in the audio file, the subsequent frames are not known. Thus, the
  2223. question arises which gain factors should be assumed for the missing frames
  2224. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2225. to deal with this situation. The default boundary mode assumes a gain factor
  2226. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2227. "fade out" at the beginning and at the end of the input, respectively.
  2228. @item s
  2229. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2230. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2231. compression. This means that signal peaks will not be pruned and thus the
  2232. full dynamic range will be retained within each local neighbourhood. However,
  2233. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2234. normalization algorithm with a more "traditional" compression.
  2235. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2236. (thresholding) function. If (and only if) the compression feature is enabled,
  2237. all input frames will be processed by a soft knee thresholding function prior
  2238. to the actual normalization process. Put simply, the thresholding function is
  2239. going to prune all samples whose magnitude exceeds a certain threshold value.
  2240. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2241. value. Instead, the threshold value will be adjusted for each individual
  2242. frame.
  2243. In general, smaller parameters result in stronger compression, and vice versa.
  2244. Values below 3.0 are not recommended, because audible distortion may appear.
  2245. @end table
  2246. @section earwax
  2247. Make audio easier to listen to on headphones.
  2248. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2249. so that when listened to on headphones the stereo image is moved from
  2250. inside your head (standard for headphones) to outside and in front of
  2251. the listener (standard for speakers).
  2252. Ported from SoX.
  2253. @section equalizer
  2254. Apply a two-pole peaking equalisation (EQ) filter. With this
  2255. filter, the signal-level at and around a selected frequency can
  2256. be increased or decreased, whilst (unlike bandpass and bandreject
  2257. filters) that at all other frequencies is unchanged.
  2258. In order to produce complex equalisation curves, this filter can
  2259. be given several times, each with a different central frequency.
  2260. The filter accepts the following options:
  2261. @table @option
  2262. @item frequency, f
  2263. Set the filter's central frequency in Hz.
  2264. @item width_type, t
  2265. Set method to specify band-width of filter.
  2266. @table @option
  2267. @item h
  2268. Hz
  2269. @item q
  2270. Q-Factor
  2271. @item o
  2272. octave
  2273. @item s
  2274. slope
  2275. @item k
  2276. kHz
  2277. @end table
  2278. @item width, w
  2279. Specify the band-width of a filter in width_type units.
  2280. @item gain, g
  2281. Set the required gain or attenuation in dB.
  2282. Beware of clipping when using a positive gain.
  2283. @item channels, c
  2284. Specify which channels to filter, by default all available are filtered.
  2285. @end table
  2286. @subsection Examples
  2287. @itemize
  2288. @item
  2289. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2290. @example
  2291. equalizer=f=1000:t=h:width=200:g=-10
  2292. @end example
  2293. @item
  2294. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2295. @example
  2296. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2297. @end example
  2298. @end itemize
  2299. @subsection Commands
  2300. This filter supports the following commands:
  2301. @table @option
  2302. @item frequency, f
  2303. Change equalizer frequency.
  2304. Syntax for the command is : "@var{frequency}"
  2305. @item width_type, t
  2306. Change equalizer width_type.
  2307. Syntax for the command is : "@var{width_type}"
  2308. @item width, w
  2309. Change equalizer width.
  2310. Syntax for the command is : "@var{width}"
  2311. @item gain, g
  2312. Change equalizer gain.
  2313. Syntax for the command is : "@var{gain}"
  2314. @end table
  2315. @section extrastereo
  2316. Linearly increases the difference between left and right channels which
  2317. adds some sort of "live" effect to playback.
  2318. The filter accepts the following options:
  2319. @table @option
  2320. @item m
  2321. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2322. (average of both channels), with 1.0 sound will be unchanged, with
  2323. -1.0 left and right channels will be swapped.
  2324. @item c
  2325. Enable clipping. By default is enabled.
  2326. @end table
  2327. @section firequalizer
  2328. Apply FIR Equalization using arbitrary frequency response.
  2329. The filter accepts the following option:
  2330. @table @option
  2331. @item gain
  2332. Set gain curve equation (in dB). The expression can contain variables:
  2333. @table @option
  2334. @item f
  2335. the evaluated frequency
  2336. @item sr
  2337. sample rate
  2338. @item ch
  2339. channel number, set to 0 when multichannels evaluation is disabled
  2340. @item chid
  2341. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2342. multichannels evaluation is disabled
  2343. @item chs
  2344. number of channels
  2345. @item chlayout
  2346. channel_layout, see libavutil/channel_layout.h
  2347. @end table
  2348. and functions:
  2349. @table @option
  2350. @item gain_interpolate(f)
  2351. interpolate gain on frequency f based on gain_entry
  2352. @item cubic_interpolate(f)
  2353. same as gain_interpolate, but smoother
  2354. @end table
  2355. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2356. @item gain_entry
  2357. Set gain entry for gain_interpolate function. The expression can
  2358. contain functions:
  2359. @table @option
  2360. @item entry(f, g)
  2361. store gain entry at frequency f with value g
  2362. @end table
  2363. This option is also available as command.
  2364. @item delay
  2365. Set filter delay in seconds. Higher value means more accurate.
  2366. Default is @code{0.01}.
  2367. @item accuracy
  2368. Set filter accuracy in Hz. Lower value means more accurate.
  2369. Default is @code{5}.
  2370. @item wfunc
  2371. Set window function. Acceptable values are:
  2372. @table @option
  2373. @item rectangular
  2374. rectangular window, useful when gain curve is already smooth
  2375. @item hann
  2376. hann window (default)
  2377. @item hamming
  2378. hamming window
  2379. @item blackman
  2380. blackman window
  2381. @item nuttall3
  2382. 3-terms continuous 1st derivative nuttall window
  2383. @item mnuttall3
  2384. minimum 3-terms discontinuous nuttall window
  2385. @item nuttall
  2386. 4-terms continuous 1st derivative nuttall window
  2387. @item bnuttall
  2388. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2389. @item bharris
  2390. blackman-harris window
  2391. @item tukey
  2392. tukey window
  2393. @end table
  2394. @item fixed
  2395. If enabled, use fixed number of audio samples. This improves speed when
  2396. filtering with large delay. Default is disabled.
  2397. @item multi
  2398. Enable multichannels evaluation on gain. Default is disabled.
  2399. @item zero_phase
  2400. Enable zero phase mode by subtracting timestamp to compensate delay.
  2401. Default is disabled.
  2402. @item scale
  2403. Set scale used by gain. Acceptable values are:
  2404. @table @option
  2405. @item linlin
  2406. linear frequency, linear gain
  2407. @item linlog
  2408. linear frequency, logarithmic (in dB) gain (default)
  2409. @item loglin
  2410. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2411. @item loglog
  2412. logarithmic frequency, logarithmic gain
  2413. @end table
  2414. @item dumpfile
  2415. Set file for dumping, suitable for gnuplot.
  2416. @item dumpscale
  2417. Set scale for dumpfile. Acceptable values are same with scale option.
  2418. Default is linlog.
  2419. @item fft2
  2420. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2421. Default is disabled.
  2422. @item min_phase
  2423. Enable minimum phase impulse response. Default is disabled.
  2424. @end table
  2425. @subsection Examples
  2426. @itemize
  2427. @item
  2428. lowpass at 1000 Hz:
  2429. @example
  2430. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2431. @end example
  2432. @item
  2433. lowpass at 1000 Hz with gain_entry:
  2434. @example
  2435. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2436. @end example
  2437. @item
  2438. custom equalization:
  2439. @example
  2440. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2441. @end example
  2442. @item
  2443. higher delay with zero phase to compensate delay:
  2444. @example
  2445. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2446. @end example
  2447. @item
  2448. lowpass on left channel, highpass on right channel:
  2449. @example
  2450. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2451. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2452. @end example
  2453. @end itemize
  2454. @section flanger
  2455. Apply a flanging effect to the audio.
  2456. The filter accepts the following options:
  2457. @table @option
  2458. @item delay
  2459. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2460. @item depth
  2461. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2462. @item regen
  2463. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2464. Default value is 0.
  2465. @item width
  2466. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2467. Default value is 71.
  2468. @item speed
  2469. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2470. @item shape
  2471. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2472. Default value is @var{sinusoidal}.
  2473. @item phase
  2474. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2475. Default value is 25.
  2476. @item interp
  2477. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2478. Default is @var{linear}.
  2479. @end table
  2480. @section haas
  2481. Apply Haas effect to audio.
  2482. Note that this makes most sense to apply on mono signals.
  2483. With this filter applied to mono signals it give some directionality and
  2484. stretches its stereo image.
  2485. The filter accepts the following options:
  2486. @table @option
  2487. @item level_in
  2488. Set input level. By default is @var{1}, or 0dB
  2489. @item level_out
  2490. Set output level. By default is @var{1}, or 0dB.
  2491. @item side_gain
  2492. Set gain applied to side part of signal. By default is @var{1}.
  2493. @item middle_source
  2494. Set kind of middle source. Can be one of the following:
  2495. @table @samp
  2496. @item left
  2497. Pick left channel.
  2498. @item right
  2499. Pick right channel.
  2500. @item mid
  2501. Pick middle part signal of stereo image.
  2502. @item side
  2503. Pick side part signal of stereo image.
  2504. @end table
  2505. @item middle_phase
  2506. Change middle phase. By default is disabled.
  2507. @item left_delay
  2508. Set left channel delay. By default is @var{2.05} milliseconds.
  2509. @item left_balance
  2510. Set left channel balance. By default is @var{-1}.
  2511. @item left_gain
  2512. Set left channel gain. By default is @var{1}.
  2513. @item left_phase
  2514. Change left phase. By default is disabled.
  2515. @item right_delay
  2516. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2517. @item right_balance
  2518. Set right channel balance. By default is @var{1}.
  2519. @item right_gain
  2520. Set right channel gain. By default is @var{1}.
  2521. @item right_phase
  2522. Change right phase. By default is enabled.
  2523. @end table
  2524. @section hdcd
  2525. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2526. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2527. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2528. of HDCD, and detects the Transient Filter flag.
  2529. @example
  2530. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2531. @end example
  2532. When using the filter with wav, note the default encoding for wav is 16-bit,
  2533. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2534. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2535. @example
  2536. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2537. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2538. @end example
  2539. The filter accepts the following options:
  2540. @table @option
  2541. @item disable_autoconvert
  2542. Disable any automatic format conversion or resampling in the filter graph.
  2543. @item process_stereo
  2544. Process the stereo channels together. If target_gain does not match between
  2545. channels, consider it invalid and use the last valid target_gain.
  2546. @item cdt_ms
  2547. Set the code detect timer period in ms.
  2548. @item force_pe
  2549. Always extend peaks above -3dBFS even if PE isn't signaled.
  2550. @item analyze_mode
  2551. Replace audio with a solid tone and adjust the amplitude to signal some
  2552. specific aspect of the decoding process. The output file can be loaded in
  2553. an audio editor alongside the original to aid analysis.
  2554. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2555. Modes are:
  2556. @table @samp
  2557. @item 0, off
  2558. Disabled
  2559. @item 1, lle
  2560. Gain adjustment level at each sample
  2561. @item 2, pe
  2562. Samples where peak extend occurs
  2563. @item 3, cdt
  2564. Samples where the code detect timer is active
  2565. @item 4, tgm
  2566. Samples where the target gain does not match between channels
  2567. @end table
  2568. @end table
  2569. @section headphone
  2570. Apply head-related transfer functions (HRTFs) to create virtual
  2571. loudspeakers around the user for binaural listening via headphones.
  2572. The HRIRs are provided via additional streams, for each channel
  2573. one stereo input stream is needed.
  2574. The filter accepts the following options:
  2575. @table @option
  2576. @item map
  2577. Set mapping of input streams for convolution.
  2578. The argument is a '|'-separated list of channel names in order as they
  2579. are given as additional stream inputs for filter.
  2580. This also specify number of input streams. Number of input streams
  2581. must be not less than number of channels in first stream plus one.
  2582. @item gain
  2583. Set gain applied to audio. Value is in dB. Default is 0.
  2584. @item type
  2585. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2586. processing audio in time domain which is slow.
  2587. @var{freq} is processing audio in frequency domain which is fast.
  2588. Default is @var{freq}.
  2589. @item lfe
  2590. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2591. @item size
  2592. Set size of frame in number of samples which will be processed at once.
  2593. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2594. @item hrir
  2595. Set format of hrir stream.
  2596. Default value is @var{stereo}. Alternative value is @var{multich}.
  2597. If value is set to @var{stereo}, number of additional streams should
  2598. be greater or equal to number of input channels in first input stream.
  2599. Also each additional stream should have stereo number of channels.
  2600. If value is set to @var{multich}, number of additional streams should
  2601. be exactly one. Also number of input channels of additional stream
  2602. should be equal or greater than twice number of channels of first input
  2603. stream.
  2604. @end table
  2605. @subsection Examples
  2606. @itemize
  2607. @item
  2608. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2609. each amovie filter use stereo file with IR coefficients as input.
  2610. The files give coefficients for each position of virtual loudspeaker:
  2611. @example
  2612. 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"
  2613. output.wav
  2614. @end example
  2615. @item
  2616. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2617. but now in @var{multich} @var{hrir} format.
  2618. @example
  2619. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2620. output.wav
  2621. @end example
  2622. @end itemize
  2623. @section highpass
  2624. Apply a high-pass filter with 3dB point frequency.
  2625. The filter can be either single-pole, or double-pole (the default).
  2626. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item frequency, f
  2630. Set frequency in Hz. Default is 3000.
  2631. @item poles, p
  2632. Set number of poles. Default is 2.
  2633. @item width_type, t
  2634. Set method to specify band-width of filter.
  2635. @table @option
  2636. @item h
  2637. Hz
  2638. @item q
  2639. Q-Factor
  2640. @item o
  2641. octave
  2642. @item s
  2643. slope
  2644. @item k
  2645. kHz
  2646. @end table
  2647. @item width, w
  2648. Specify the band-width of a filter in width_type units.
  2649. Applies only to double-pole filter.
  2650. The default is 0.707q and gives a Butterworth response.
  2651. @item channels, c
  2652. Specify which channels to filter, by default all available are filtered.
  2653. @end table
  2654. @subsection Commands
  2655. This filter supports the following commands:
  2656. @table @option
  2657. @item frequency, f
  2658. Change highpass frequency.
  2659. Syntax for the command is : "@var{frequency}"
  2660. @item width_type, t
  2661. Change highpass width_type.
  2662. Syntax for the command is : "@var{width_type}"
  2663. @item width, w
  2664. Change highpass width.
  2665. Syntax for the command is : "@var{width}"
  2666. @end table
  2667. @section join
  2668. Join multiple input streams into one multi-channel stream.
  2669. It accepts the following parameters:
  2670. @table @option
  2671. @item inputs
  2672. The number of input streams. It defaults to 2.
  2673. @item channel_layout
  2674. The desired output channel layout. It defaults to stereo.
  2675. @item map
  2676. Map channels from inputs to output. The argument is a '|'-separated list of
  2677. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2678. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2679. can be either the name of the input channel (e.g. FL for front left) or its
  2680. index in the specified input stream. @var{out_channel} is the name of the output
  2681. channel.
  2682. @end table
  2683. The filter will attempt to guess the mappings when they are not specified
  2684. explicitly. It does so by first trying to find an unused matching input channel
  2685. and if that fails it picks the first unused input channel.
  2686. Join 3 inputs (with properly set channel layouts):
  2687. @example
  2688. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2689. @end example
  2690. Build a 5.1 output from 6 single-channel streams:
  2691. @example
  2692. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2693. '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'
  2694. out
  2695. @end example
  2696. @section ladspa
  2697. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2698. To enable compilation of this filter you need to configure FFmpeg with
  2699. @code{--enable-ladspa}.
  2700. @table @option
  2701. @item file, f
  2702. Specifies the name of LADSPA plugin library to load. If the environment
  2703. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2704. each one of the directories specified by the colon separated list in
  2705. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2706. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2707. @file{/usr/lib/ladspa/}.
  2708. @item plugin, p
  2709. Specifies the plugin within the library. Some libraries contain only
  2710. one plugin, but others contain many of them. If this is not set filter
  2711. will list all available plugins within the specified library.
  2712. @item controls, c
  2713. Set the '|' separated list of controls which are zero or more floating point
  2714. values that determine the behavior of the loaded plugin (for example delay,
  2715. threshold or gain).
  2716. Controls need to be defined using the following syntax:
  2717. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2718. @var{valuei} is the value set on the @var{i}-th control.
  2719. Alternatively they can be also defined using the following syntax:
  2720. @var{value0}|@var{value1}|@var{value2}|..., where
  2721. @var{valuei} is the value set on the @var{i}-th control.
  2722. If @option{controls} is set to @code{help}, all available controls and
  2723. their valid ranges are printed.
  2724. @item sample_rate, s
  2725. Specify the sample rate, default to 44100. Only used if plugin have
  2726. zero inputs.
  2727. @item nb_samples, n
  2728. Set the number of samples per channel per each output frame, default
  2729. is 1024. Only used if plugin have zero inputs.
  2730. @item duration, d
  2731. Set the minimum duration of the sourced audio. See
  2732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2733. for the accepted syntax.
  2734. Note that the resulting duration may be greater than the specified duration,
  2735. as the generated audio is always cut at the end of a complete frame.
  2736. If not specified, or the expressed duration is negative, the audio is
  2737. supposed to be generated forever.
  2738. Only used if plugin have zero inputs.
  2739. @end table
  2740. @subsection Examples
  2741. @itemize
  2742. @item
  2743. List all available plugins within amp (LADSPA example plugin) library:
  2744. @example
  2745. ladspa=file=amp
  2746. @end example
  2747. @item
  2748. List all available controls and their valid ranges for @code{vcf_notch}
  2749. plugin from @code{VCF} library:
  2750. @example
  2751. ladspa=f=vcf:p=vcf_notch:c=help
  2752. @end example
  2753. @item
  2754. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2755. plugin library:
  2756. @example
  2757. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2758. @end example
  2759. @item
  2760. Add reverberation to the audio using TAP-plugins
  2761. (Tom's Audio Processing plugins):
  2762. @example
  2763. ladspa=file=tap_reverb:tap_reverb
  2764. @end example
  2765. @item
  2766. Generate white noise, with 0.2 amplitude:
  2767. @example
  2768. ladspa=file=cmt:noise_source_white:c=c0=.2
  2769. @end example
  2770. @item
  2771. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2772. @code{C* Audio Plugin Suite} (CAPS) library:
  2773. @example
  2774. ladspa=file=caps:Click:c=c1=20'
  2775. @end example
  2776. @item
  2777. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2778. @example
  2779. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2780. @end example
  2781. @item
  2782. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2783. @code{SWH Plugins} collection:
  2784. @example
  2785. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2786. @end example
  2787. @item
  2788. Attenuate low frequencies using Multiband EQ from Steve Harris
  2789. @code{SWH Plugins} collection:
  2790. @example
  2791. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2792. @end example
  2793. @item
  2794. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2795. (CAPS) library:
  2796. @example
  2797. ladspa=caps:Narrower
  2798. @end example
  2799. @item
  2800. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2801. @example
  2802. ladspa=caps:White:.2
  2803. @end example
  2804. @item
  2805. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2806. @example
  2807. ladspa=caps:Fractal:c=c1=1
  2808. @end example
  2809. @item
  2810. Dynamic volume normalization using @code{VLevel} plugin:
  2811. @example
  2812. ladspa=vlevel-ladspa:vlevel_mono
  2813. @end example
  2814. @end itemize
  2815. @subsection Commands
  2816. This filter supports the following commands:
  2817. @table @option
  2818. @item cN
  2819. Modify the @var{N}-th control value.
  2820. If the specified value is not valid, it is ignored and prior one is kept.
  2821. @end table
  2822. @section loudnorm
  2823. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2824. Support for both single pass (livestreams, files) and double pass (files) modes.
  2825. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2826. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2827. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2828. The filter accepts the following options:
  2829. @table @option
  2830. @item I, i
  2831. Set integrated loudness target.
  2832. Range is -70.0 - -5.0. Default value is -24.0.
  2833. @item LRA, lra
  2834. Set loudness range target.
  2835. Range is 1.0 - 20.0. Default value is 7.0.
  2836. @item TP, tp
  2837. Set maximum true peak.
  2838. Range is -9.0 - +0.0. Default value is -2.0.
  2839. @item measured_I, measured_i
  2840. Measured IL of input file.
  2841. Range is -99.0 - +0.0.
  2842. @item measured_LRA, measured_lra
  2843. Measured LRA of input file.
  2844. Range is 0.0 - 99.0.
  2845. @item measured_TP, measured_tp
  2846. Measured true peak of input file.
  2847. Range is -99.0 - +99.0.
  2848. @item measured_thresh
  2849. Measured threshold of input file.
  2850. Range is -99.0 - +0.0.
  2851. @item offset
  2852. Set offset gain. Gain is applied before the true-peak limiter.
  2853. Range is -99.0 - +99.0. Default is +0.0.
  2854. @item linear
  2855. Normalize linearly if possible.
  2856. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2857. to be specified in order to use this mode.
  2858. Options are true or false. Default is true.
  2859. @item dual_mono
  2860. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2861. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2862. If set to @code{true}, this option will compensate for this effect.
  2863. Multi-channel input files are not affected by this option.
  2864. Options are true or false. Default is false.
  2865. @item print_format
  2866. Set print format for stats. Options are summary, json, or none.
  2867. Default value is none.
  2868. @end table
  2869. @section lowpass
  2870. Apply a low-pass filter with 3dB point frequency.
  2871. The filter can be either single-pole or double-pole (the default).
  2872. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2873. The filter accepts the following options:
  2874. @table @option
  2875. @item frequency, f
  2876. Set frequency in Hz. Default is 500.
  2877. @item poles, p
  2878. Set number of poles. Default is 2.
  2879. @item width_type, t
  2880. Set method to specify band-width of filter.
  2881. @table @option
  2882. @item h
  2883. Hz
  2884. @item q
  2885. Q-Factor
  2886. @item o
  2887. octave
  2888. @item s
  2889. slope
  2890. @item k
  2891. kHz
  2892. @end table
  2893. @item width, w
  2894. Specify the band-width of a filter in width_type units.
  2895. Applies only to double-pole filter.
  2896. The default is 0.707q and gives a Butterworth response.
  2897. @item channels, c
  2898. Specify which channels to filter, by default all available are filtered.
  2899. @end table
  2900. @subsection Examples
  2901. @itemize
  2902. @item
  2903. Lowpass only LFE channel, it LFE is not present it does nothing:
  2904. @example
  2905. lowpass=c=LFE
  2906. @end example
  2907. @end itemize
  2908. @subsection Commands
  2909. This filter supports the following commands:
  2910. @table @option
  2911. @item frequency, f
  2912. Change lowpass frequency.
  2913. Syntax for the command is : "@var{frequency}"
  2914. @item width_type, t
  2915. Change lowpass width_type.
  2916. Syntax for the command is : "@var{width_type}"
  2917. @item width, w
  2918. Change lowpass width.
  2919. Syntax for the command is : "@var{width}"
  2920. @end table
  2921. @section lv2
  2922. Load a LV2 (LADSPA Version 2) plugin.
  2923. To enable compilation of this filter you need to configure FFmpeg with
  2924. @code{--enable-lv2}.
  2925. @table @option
  2926. @item plugin, p
  2927. Specifies the plugin URI. You may need to escape ':'.
  2928. @item controls, c
  2929. Set the '|' separated list of controls which are zero or more floating point
  2930. values that determine the behavior of the loaded plugin (for example delay,
  2931. threshold or gain).
  2932. If @option{controls} is set to @code{help}, all available controls and
  2933. their valid ranges are printed.
  2934. @item sample_rate, s
  2935. Specify the sample rate, default to 44100. Only used if plugin have
  2936. zero inputs.
  2937. @item nb_samples, n
  2938. Set the number of samples per channel per each output frame, default
  2939. is 1024. Only used if plugin have zero inputs.
  2940. @item duration, d
  2941. Set the minimum duration of the sourced audio. See
  2942. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2943. for the accepted syntax.
  2944. Note that the resulting duration may be greater than the specified duration,
  2945. as the generated audio is always cut at the end of a complete frame.
  2946. If not specified, or the expressed duration is negative, the audio is
  2947. supposed to be generated forever.
  2948. Only used if plugin have zero inputs.
  2949. @end table
  2950. @subsection Examples
  2951. @itemize
  2952. @item
  2953. Apply bass enhancer plugin from Calf:
  2954. @example
  2955. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2956. @end example
  2957. @item
  2958. Apply vinyl plugin from Calf:
  2959. @example
  2960. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2961. @end example
  2962. @item
  2963. Apply bit crusher plugin from ArtyFX:
  2964. @example
  2965. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2966. @end example
  2967. @end itemize
  2968. @section mcompand
  2969. Multiband Compress or expand the audio's dynamic range.
  2970. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2971. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2972. response when absent compander action.
  2973. It accepts the following parameters:
  2974. @table @option
  2975. @item args
  2976. This option syntax is:
  2977. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2978. For explanation of each item refer to compand filter documentation.
  2979. @end table
  2980. @anchor{pan}
  2981. @section pan
  2982. Mix channels with specific gain levels. The filter accepts the output
  2983. channel layout followed by a set of channels definitions.
  2984. This filter is also designed to efficiently remap the channels of an audio
  2985. stream.
  2986. The filter accepts parameters of the form:
  2987. "@var{l}|@var{outdef}|@var{outdef}|..."
  2988. @table @option
  2989. @item l
  2990. output channel layout or number of channels
  2991. @item outdef
  2992. output channel specification, of the form:
  2993. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2994. @item out_name
  2995. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2996. number (c0, c1, etc.)
  2997. @item gain
  2998. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2999. @item in_name
  3000. input channel to use, see out_name for details; it is not possible to mix
  3001. named and numbered input channels
  3002. @end table
  3003. If the `=' in a channel specification is replaced by `<', then the gains for
  3004. that specification will be renormalized so that the total is 1, thus
  3005. avoiding clipping noise.
  3006. @subsection Mixing examples
  3007. For example, if you want to down-mix from stereo to mono, but with a bigger
  3008. factor for the left channel:
  3009. @example
  3010. pan=1c|c0=0.9*c0+0.1*c1
  3011. @end example
  3012. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3013. 7-channels surround:
  3014. @example
  3015. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3016. @end example
  3017. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3018. that should be preferred (see "-ac" option) unless you have very specific
  3019. needs.
  3020. @subsection Remapping examples
  3021. The channel remapping will be effective if, and only if:
  3022. @itemize
  3023. @item gain coefficients are zeroes or ones,
  3024. @item only one input per channel output,
  3025. @end itemize
  3026. If all these conditions are satisfied, the filter will notify the user ("Pure
  3027. channel mapping detected"), and use an optimized and lossless method to do the
  3028. remapping.
  3029. For example, if you have a 5.1 source and want a stereo audio stream by
  3030. dropping the extra channels:
  3031. @example
  3032. pan="stereo| c0=FL | c1=FR"
  3033. @end example
  3034. Given the same source, you can also switch front left and front right channels
  3035. and keep the input channel layout:
  3036. @example
  3037. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3038. @end example
  3039. If the input is a stereo audio stream, you can mute the front left channel (and
  3040. still keep the stereo channel layout) with:
  3041. @example
  3042. pan="stereo|c1=c1"
  3043. @end example
  3044. Still with a stereo audio stream input, you can copy the right channel in both
  3045. front left and right:
  3046. @example
  3047. pan="stereo| c0=FR | c1=FR"
  3048. @end example
  3049. @section replaygain
  3050. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3051. outputs it unchanged.
  3052. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3053. @section resample
  3054. Convert the audio sample format, sample rate and channel layout. It is
  3055. not meant to be used directly.
  3056. @section rubberband
  3057. Apply time-stretching and pitch-shifting with librubberband.
  3058. To enable compilation of this filter, you need to configure FFmpeg with
  3059. @code{--enable-librubberband}.
  3060. The filter accepts the following options:
  3061. @table @option
  3062. @item tempo
  3063. Set tempo scale factor.
  3064. @item pitch
  3065. Set pitch scale factor.
  3066. @item transients
  3067. Set transients detector.
  3068. Possible values are:
  3069. @table @var
  3070. @item crisp
  3071. @item mixed
  3072. @item smooth
  3073. @end table
  3074. @item detector
  3075. Set detector.
  3076. Possible values are:
  3077. @table @var
  3078. @item compound
  3079. @item percussive
  3080. @item soft
  3081. @end table
  3082. @item phase
  3083. Set phase.
  3084. Possible values are:
  3085. @table @var
  3086. @item laminar
  3087. @item independent
  3088. @end table
  3089. @item window
  3090. Set processing window size.
  3091. Possible values are:
  3092. @table @var
  3093. @item standard
  3094. @item short
  3095. @item long
  3096. @end table
  3097. @item smoothing
  3098. Set smoothing.
  3099. Possible values are:
  3100. @table @var
  3101. @item off
  3102. @item on
  3103. @end table
  3104. @item formant
  3105. Enable formant preservation when shift pitching.
  3106. Possible values are:
  3107. @table @var
  3108. @item shifted
  3109. @item preserved
  3110. @end table
  3111. @item pitchq
  3112. Set pitch quality.
  3113. Possible values are:
  3114. @table @var
  3115. @item quality
  3116. @item speed
  3117. @item consistency
  3118. @end table
  3119. @item channels
  3120. Set channels.
  3121. Possible values are:
  3122. @table @var
  3123. @item apart
  3124. @item together
  3125. @end table
  3126. @end table
  3127. @section sidechaincompress
  3128. This filter acts like normal compressor but has the ability to compress
  3129. detected signal using second input signal.
  3130. It needs two input streams and returns one output stream.
  3131. First input stream will be processed depending on second stream signal.
  3132. The filtered signal then can be filtered with other filters in later stages of
  3133. processing. See @ref{pan} and @ref{amerge} filter.
  3134. The filter accepts the following options:
  3135. @table @option
  3136. @item level_in
  3137. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3138. @item threshold
  3139. If a signal of second stream raises above this level it will affect the gain
  3140. reduction of first stream.
  3141. By default is 0.125. Range is between 0.00097563 and 1.
  3142. @item ratio
  3143. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3144. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3145. Default is 2. Range is between 1 and 20.
  3146. @item attack
  3147. Amount of milliseconds the signal has to rise above the threshold before gain
  3148. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3149. @item release
  3150. Amount of milliseconds the signal has to fall below the threshold before
  3151. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3152. @item makeup
  3153. Set the amount by how much signal will be amplified after processing.
  3154. Default is 1. Range is from 1 to 64.
  3155. @item knee
  3156. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3157. Default is 2.82843. Range is between 1 and 8.
  3158. @item link
  3159. Choose if the @code{average} level between all channels of side-chain stream
  3160. or the louder(@code{maximum}) channel of side-chain stream affects the
  3161. reduction. Default is @code{average}.
  3162. @item detection
  3163. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3164. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3165. @item level_sc
  3166. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3167. @item mix
  3168. How much to use compressed signal in output. Default is 1.
  3169. Range is between 0 and 1.
  3170. @end table
  3171. @subsection Examples
  3172. @itemize
  3173. @item
  3174. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3175. depending on the signal of 2nd input and later compressed signal to be
  3176. merged with 2nd input:
  3177. @example
  3178. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3179. @end example
  3180. @end itemize
  3181. @section sidechaingate
  3182. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3183. filter the detected signal before sending it to the gain reduction stage.
  3184. Normally a gate uses the full range signal to detect a level above the
  3185. threshold.
  3186. For example: If you cut all lower frequencies from your sidechain signal
  3187. the gate will decrease the volume of your track only if not enough highs
  3188. appear. With this technique you are able to reduce the resonation of a
  3189. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3190. guitar.
  3191. It needs two input streams and returns one output stream.
  3192. First input stream will be processed depending on second stream signal.
  3193. The filter accepts the following options:
  3194. @table @option
  3195. @item level_in
  3196. Set input level before filtering.
  3197. Default is 1. Allowed range is from 0.015625 to 64.
  3198. @item range
  3199. Set the level of gain reduction when the signal is below the threshold.
  3200. Default is 0.06125. Allowed range is from 0 to 1.
  3201. @item threshold
  3202. If a signal rises above this level the gain reduction is released.
  3203. Default is 0.125. Allowed range is from 0 to 1.
  3204. @item ratio
  3205. Set a ratio about which the signal is reduced.
  3206. Default is 2. Allowed range is from 1 to 9000.
  3207. @item attack
  3208. Amount of milliseconds the signal has to rise above the threshold before gain
  3209. reduction stops.
  3210. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3211. @item release
  3212. Amount of milliseconds the signal has to fall below the threshold before the
  3213. reduction is increased again. Default is 250 milliseconds.
  3214. Allowed range is from 0.01 to 9000.
  3215. @item makeup
  3216. Set amount of amplification of signal after processing.
  3217. Default is 1. Allowed range is from 1 to 64.
  3218. @item knee
  3219. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3220. Default is 2.828427125. Allowed range is from 1 to 8.
  3221. @item detection
  3222. Choose if exact signal should be taken for detection or an RMS like one.
  3223. Default is rms. Can be peak or rms.
  3224. @item link
  3225. Choose if the average level between all channels or the louder channel affects
  3226. the reduction.
  3227. Default is average. Can be average or maximum.
  3228. @item level_sc
  3229. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3230. @end table
  3231. @section silencedetect
  3232. Detect silence in an audio stream.
  3233. This filter logs a message when it detects that the input audio volume is less
  3234. or equal to a noise tolerance value for a duration greater or equal to the
  3235. minimum detected noise duration.
  3236. The printed times and duration are expressed in seconds.
  3237. The filter accepts the following options:
  3238. @table @option
  3239. @item duration, d
  3240. Set silence duration until notification (default is 2 seconds).
  3241. @item noise, n
  3242. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3243. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Detect 5 seconds of silence with -50dB noise tolerance:
  3249. @example
  3250. silencedetect=n=-50dB:d=5
  3251. @end example
  3252. @item
  3253. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3254. tolerance in @file{silence.mp3}:
  3255. @example
  3256. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3257. @end example
  3258. @end itemize
  3259. @section silenceremove
  3260. Remove silence from the beginning, middle or end of the audio.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item start_periods
  3264. This value is used to indicate if audio should be trimmed at beginning of
  3265. the audio. A value of zero indicates no silence should be trimmed from the
  3266. beginning. When specifying a non-zero value, it trims audio up until it
  3267. finds non-silence. Normally, when trimming silence from beginning of audio
  3268. the @var{start_periods} will be @code{1} but it can be increased to higher
  3269. values to trim all audio up to specific count of non-silence periods.
  3270. Default value is @code{0}.
  3271. @item start_duration
  3272. Specify the amount of time that non-silence must be detected before it stops
  3273. trimming audio. By increasing the duration, bursts of noises can be treated
  3274. as silence and trimmed off. Default value is @code{0}.
  3275. @item start_threshold
  3276. This indicates what sample value should be treated as silence. For digital
  3277. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3278. you may wish to increase the value to account for background noise.
  3279. Can be specified in dB (in case "dB" is appended to the specified value)
  3280. or amplitude ratio. Default value is @code{0}.
  3281. @item stop_periods
  3282. Set the count for trimming silence from the end of audio.
  3283. To remove silence from the middle of a file, specify a @var{stop_periods}
  3284. that is negative. This value is then treated as a positive value and is
  3285. used to indicate the effect should restart processing as specified by
  3286. @var{start_periods}, making it suitable for removing periods of silence
  3287. in the middle of the audio.
  3288. Default value is @code{0}.
  3289. @item stop_duration
  3290. Specify a duration of silence that must exist before audio is not copied any
  3291. more. By specifying a higher duration, silence that is wanted can be left in
  3292. the audio.
  3293. Default value is @code{0}.
  3294. @item stop_threshold
  3295. This is the same as @option{start_threshold} but for trimming silence from
  3296. the end of audio.
  3297. Can be specified in dB (in case "dB" is appended to the specified value)
  3298. or amplitude ratio. Default value is @code{0}.
  3299. @item leave_silence
  3300. This indicates that @var{stop_duration} length of audio should be left intact
  3301. at the beginning of each period of silence.
  3302. For example, if you want to remove long pauses between words but do not want
  3303. to remove the pauses completely. Default value is @code{0}.
  3304. @item detection
  3305. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3306. and works better with digital silence which is exactly 0.
  3307. Default value is @code{rms}.
  3308. @item window
  3309. Set ratio used to calculate size of window for detecting silence.
  3310. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3311. @end table
  3312. @subsection Examples
  3313. @itemize
  3314. @item
  3315. The following example shows how this filter can be used to start a recording
  3316. that does not contain the delay at the start which usually occurs between
  3317. pressing the record button and the start of the performance:
  3318. @example
  3319. silenceremove=1:5:0.02
  3320. @end example
  3321. @item
  3322. Trim all silence encountered from beginning to end where there is more than 1
  3323. second of silence in audio:
  3324. @example
  3325. silenceremove=0:0:0:-1:1:-90dB
  3326. @end example
  3327. @end itemize
  3328. @section sofalizer
  3329. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3330. loudspeakers around the user for binaural listening via headphones (audio
  3331. formats up to 9 channels supported).
  3332. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3333. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3334. Austrian Academy of Sciences.
  3335. To enable compilation of this filter you need to configure FFmpeg with
  3336. @code{--enable-libmysofa}.
  3337. The filter accepts the following options:
  3338. @table @option
  3339. @item sofa
  3340. Set the SOFA file used for rendering.
  3341. @item gain
  3342. Set gain applied to audio. Value is in dB. Default is 0.
  3343. @item rotation
  3344. Set rotation of virtual loudspeakers in deg. Default is 0.
  3345. @item elevation
  3346. Set elevation of virtual speakers in deg. Default is 0.
  3347. @item radius
  3348. Set distance in meters between loudspeakers and the listener with near-field
  3349. HRTFs. Default is 1.
  3350. @item type
  3351. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3352. processing audio in time domain which is slow.
  3353. @var{freq} is processing audio in frequency domain which is fast.
  3354. Default is @var{freq}.
  3355. @item speakers
  3356. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3357. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3358. Each virtual loudspeaker is described with short channel name following with
  3359. azimuth and elevation in degrees.
  3360. Each virtual loudspeaker description is separated by '|'.
  3361. For example to override front left and front right channel positions use:
  3362. 'speakers=FL 45 15|FR 345 15'.
  3363. Descriptions with unrecognised channel names are ignored.
  3364. @item lfegain
  3365. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Using ClubFritz6 sofa file:
  3371. @example
  3372. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3373. @end example
  3374. @item
  3375. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3376. @example
  3377. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3378. @end example
  3379. @item
  3380. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3381. and also with custom gain:
  3382. @example
  3383. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3384. @end example
  3385. @end itemize
  3386. @section stereotools
  3387. This filter has some handy utilities to manage stereo signals, for converting
  3388. M/S stereo recordings to L/R signal while having control over the parameters
  3389. or spreading the stereo image of master track.
  3390. The filter accepts the following options:
  3391. @table @option
  3392. @item level_in
  3393. Set input level before filtering for both channels. Defaults is 1.
  3394. Allowed range is from 0.015625 to 64.
  3395. @item level_out
  3396. Set output level after filtering for both channels. Defaults is 1.
  3397. Allowed range is from 0.015625 to 64.
  3398. @item balance_in
  3399. Set input balance between both channels. Default is 0.
  3400. Allowed range is from -1 to 1.
  3401. @item balance_out
  3402. Set output balance between both channels. Default is 0.
  3403. Allowed range is from -1 to 1.
  3404. @item softclip
  3405. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3406. clipping. Disabled by default.
  3407. @item mutel
  3408. Mute the left channel. Disabled by default.
  3409. @item muter
  3410. Mute the right channel. Disabled by default.
  3411. @item phasel
  3412. Change the phase of the left channel. Disabled by default.
  3413. @item phaser
  3414. Change the phase of the right channel. Disabled by default.
  3415. @item mode
  3416. Set stereo mode. Available values are:
  3417. @table @samp
  3418. @item lr>lr
  3419. Left/Right to Left/Right, this is default.
  3420. @item lr>ms
  3421. Left/Right to Mid/Side.
  3422. @item ms>lr
  3423. Mid/Side to Left/Right.
  3424. @item lr>ll
  3425. Left/Right to Left/Left.
  3426. @item lr>rr
  3427. Left/Right to Right/Right.
  3428. @item lr>l+r
  3429. Left/Right to Left + Right.
  3430. @item lr>rl
  3431. Left/Right to Right/Left.
  3432. @item ms>ll
  3433. Mid/Side to Left/Left.
  3434. @item ms>rr
  3435. Mid/Side to Right/Right.
  3436. @end table
  3437. @item slev
  3438. Set level of side signal. Default is 1.
  3439. Allowed range is from 0.015625 to 64.
  3440. @item sbal
  3441. Set balance of side signal. Default is 0.
  3442. Allowed range is from -1 to 1.
  3443. @item mlev
  3444. Set level of the middle signal. Default is 1.
  3445. Allowed range is from 0.015625 to 64.
  3446. @item mpan
  3447. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3448. @item base
  3449. Set stereo base between mono and inversed channels. Default is 0.
  3450. Allowed range is from -1 to 1.
  3451. @item delay
  3452. Set delay in milliseconds how much to delay left from right channel and
  3453. vice versa. Default is 0. Allowed range is from -20 to 20.
  3454. @item sclevel
  3455. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3456. @item phase
  3457. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3458. @item bmode_in, bmode_out
  3459. Set balance mode for balance_in/balance_out option.
  3460. Can be one of the following:
  3461. @table @samp
  3462. @item balance
  3463. Classic balance mode. Attenuate one channel at time.
  3464. Gain is raised up to 1.
  3465. @item amplitude
  3466. Similar as classic mode above but gain is raised up to 2.
  3467. @item power
  3468. Equal power distribution, from -6dB to +6dB range.
  3469. @end table
  3470. @end table
  3471. @subsection Examples
  3472. @itemize
  3473. @item
  3474. Apply karaoke like effect:
  3475. @example
  3476. stereotools=mlev=0.015625
  3477. @end example
  3478. @item
  3479. Convert M/S signal to L/R:
  3480. @example
  3481. "stereotools=mode=ms>lr"
  3482. @end example
  3483. @end itemize
  3484. @section stereowiden
  3485. This filter enhance the stereo effect by suppressing signal common to both
  3486. channels and by delaying the signal of left into right and vice versa,
  3487. thereby widening the stereo effect.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item delay
  3491. Time in milliseconds of the delay of left signal into right and vice versa.
  3492. Default is 20 milliseconds.
  3493. @item feedback
  3494. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3495. effect of left signal in right output and vice versa which gives widening
  3496. effect. Default is 0.3.
  3497. @item crossfeed
  3498. Cross feed of left into right with inverted phase. This helps in suppressing
  3499. the mono. If the value is 1 it will cancel all the signal common to both
  3500. channels. Default is 0.3.
  3501. @item drymix
  3502. Set level of input signal of original channel. Default is 0.8.
  3503. @end table
  3504. @section superequalizer
  3505. Apply 18 band equalizer.
  3506. The filter accepts the following options:
  3507. @table @option
  3508. @item 1b
  3509. Set 65Hz band gain.
  3510. @item 2b
  3511. Set 92Hz band gain.
  3512. @item 3b
  3513. Set 131Hz band gain.
  3514. @item 4b
  3515. Set 185Hz band gain.
  3516. @item 5b
  3517. Set 262Hz band gain.
  3518. @item 6b
  3519. Set 370Hz band gain.
  3520. @item 7b
  3521. Set 523Hz band gain.
  3522. @item 8b
  3523. Set 740Hz band gain.
  3524. @item 9b
  3525. Set 1047Hz band gain.
  3526. @item 10b
  3527. Set 1480Hz band gain.
  3528. @item 11b
  3529. Set 2093Hz band gain.
  3530. @item 12b
  3531. Set 2960Hz band gain.
  3532. @item 13b
  3533. Set 4186Hz band gain.
  3534. @item 14b
  3535. Set 5920Hz band gain.
  3536. @item 15b
  3537. Set 8372Hz band gain.
  3538. @item 16b
  3539. Set 11840Hz band gain.
  3540. @item 17b
  3541. Set 16744Hz band gain.
  3542. @item 18b
  3543. Set 20000Hz band gain.
  3544. @end table
  3545. @section surround
  3546. Apply audio surround upmix filter.
  3547. This filter allows to produce multichannel output from audio stream.
  3548. The filter accepts the following options:
  3549. @table @option
  3550. @item chl_out
  3551. Set output channel layout. By default, this is @var{5.1}.
  3552. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3553. for the required syntax.
  3554. @item chl_in
  3555. Set input channel layout. By default, this is @var{stereo}.
  3556. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3557. for the required syntax.
  3558. @item level_in
  3559. Set input volume level. By default, this is @var{1}.
  3560. @item level_out
  3561. Set output volume level. By default, this is @var{1}.
  3562. @item lfe
  3563. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3564. @item lfe_low
  3565. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3566. @item lfe_high
  3567. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3568. @item fc_in
  3569. Set front center input volume. By default, this is @var{1}.
  3570. @item fc_out
  3571. Set front center output volume. By default, this is @var{1}.
  3572. @item lfe_in
  3573. Set LFE input volume. By default, this is @var{1}.
  3574. @item lfe_out
  3575. Set LFE output volume. By default, this is @var{1}.
  3576. @end table
  3577. @section treble, highshelf
  3578. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3579. shelving filter with a response similar to that of a standard
  3580. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item gain, g
  3584. Give the gain at whichever is the lower of ~22 kHz and the
  3585. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3586. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3587. @item frequency, f
  3588. Set the filter's central frequency and so can be used
  3589. to extend or reduce the frequency range to be boosted or cut.
  3590. The default value is @code{3000} Hz.
  3591. @item width_type, t
  3592. Set method to specify band-width of filter.
  3593. @table @option
  3594. @item h
  3595. Hz
  3596. @item q
  3597. Q-Factor
  3598. @item o
  3599. octave
  3600. @item s
  3601. slope
  3602. @item k
  3603. kHz
  3604. @end table
  3605. @item width, w
  3606. Determine how steep is the filter's shelf transition.
  3607. @item channels, c
  3608. Specify which channels to filter, by default all available are filtered.
  3609. @end table
  3610. @subsection Commands
  3611. This filter supports the following commands:
  3612. @table @option
  3613. @item frequency, f
  3614. Change treble frequency.
  3615. Syntax for the command is : "@var{frequency}"
  3616. @item width_type, t
  3617. Change treble width_type.
  3618. Syntax for the command is : "@var{width_type}"
  3619. @item width, w
  3620. Change treble width.
  3621. Syntax for the command is : "@var{width}"
  3622. @item gain, g
  3623. Change treble gain.
  3624. Syntax for the command is : "@var{gain}"
  3625. @end table
  3626. @section tremolo
  3627. Sinusoidal amplitude modulation.
  3628. The filter accepts the following options:
  3629. @table @option
  3630. @item f
  3631. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3632. (20 Hz or lower) will result in a tremolo effect.
  3633. This filter may also be used as a ring modulator by specifying
  3634. a modulation frequency higher than 20 Hz.
  3635. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3636. @item d
  3637. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3638. Default value is 0.5.
  3639. @end table
  3640. @section vibrato
  3641. Sinusoidal phase modulation.
  3642. The filter accepts the following options:
  3643. @table @option
  3644. @item f
  3645. Modulation frequency in Hertz.
  3646. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3647. @item d
  3648. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3649. Default value is 0.5.
  3650. @end table
  3651. @section volume
  3652. Adjust the input audio volume.
  3653. It accepts the following parameters:
  3654. @table @option
  3655. @item volume
  3656. Set audio volume expression.
  3657. Output values are clipped to the maximum value.
  3658. The output audio volume is given by the relation:
  3659. @example
  3660. @var{output_volume} = @var{volume} * @var{input_volume}
  3661. @end example
  3662. The default value for @var{volume} is "1.0".
  3663. @item precision
  3664. This parameter represents the mathematical precision.
  3665. It determines which input sample formats will be allowed, which affects the
  3666. precision of the volume scaling.
  3667. @table @option
  3668. @item fixed
  3669. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3670. @item float
  3671. 32-bit floating-point; this limits input sample format to FLT. (default)
  3672. @item double
  3673. 64-bit floating-point; this limits input sample format to DBL.
  3674. @end table
  3675. @item replaygain
  3676. Choose the behaviour on encountering ReplayGain side data in input frames.
  3677. @table @option
  3678. @item drop
  3679. Remove ReplayGain side data, ignoring its contents (the default).
  3680. @item ignore
  3681. Ignore ReplayGain side data, but leave it in the frame.
  3682. @item track
  3683. Prefer the track gain, if present.
  3684. @item album
  3685. Prefer the album gain, if present.
  3686. @end table
  3687. @item replaygain_preamp
  3688. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3689. Default value for @var{replaygain_preamp} is 0.0.
  3690. @item eval
  3691. Set when the volume expression is evaluated.
  3692. It accepts the following values:
  3693. @table @samp
  3694. @item once
  3695. only evaluate expression once during the filter initialization, or
  3696. when the @samp{volume} command is sent
  3697. @item frame
  3698. evaluate expression for each incoming frame
  3699. @end table
  3700. Default value is @samp{once}.
  3701. @end table
  3702. The volume expression can contain the following parameters.
  3703. @table @option
  3704. @item n
  3705. frame number (starting at zero)
  3706. @item nb_channels
  3707. number of channels
  3708. @item nb_consumed_samples
  3709. number of samples consumed by the filter
  3710. @item nb_samples
  3711. number of samples in the current frame
  3712. @item pos
  3713. original frame position in the file
  3714. @item pts
  3715. frame PTS
  3716. @item sample_rate
  3717. sample rate
  3718. @item startpts
  3719. PTS at start of stream
  3720. @item startt
  3721. time at start of stream
  3722. @item t
  3723. frame time
  3724. @item tb
  3725. timestamp timebase
  3726. @item volume
  3727. last set volume value
  3728. @end table
  3729. Note that when @option{eval} is set to @samp{once} only the
  3730. @var{sample_rate} and @var{tb} variables are available, all other
  3731. variables will evaluate to NAN.
  3732. @subsection Commands
  3733. This filter supports the following commands:
  3734. @table @option
  3735. @item volume
  3736. Modify the volume expression.
  3737. The command accepts the same syntax of the corresponding option.
  3738. If the specified expression is not valid, it is kept at its current
  3739. value.
  3740. @item replaygain_noclip
  3741. Prevent clipping by limiting the gain applied.
  3742. Default value for @var{replaygain_noclip} is 1.
  3743. @end table
  3744. @subsection Examples
  3745. @itemize
  3746. @item
  3747. Halve the input audio volume:
  3748. @example
  3749. volume=volume=0.5
  3750. volume=volume=1/2
  3751. volume=volume=-6.0206dB
  3752. @end example
  3753. In all the above example the named key for @option{volume} can be
  3754. omitted, for example like in:
  3755. @example
  3756. volume=0.5
  3757. @end example
  3758. @item
  3759. Increase input audio power by 6 decibels using fixed-point precision:
  3760. @example
  3761. volume=volume=6dB:precision=fixed
  3762. @end example
  3763. @item
  3764. Fade volume after time 10 with an annihilation period of 5 seconds:
  3765. @example
  3766. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3767. @end example
  3768. @end itemize
  3769. @section volumedetect
  3770. Detect the volume of the input video.
  3771. The filter has no parameters. The input is not modified. Statistics about
  3772. the volume will be printed in the log when the input stream end is reached.
  3773. In particular it will show the mean volume (root mean square), maximum
  3774. volume (on a per-sample basis), and the beginning of a histogram of the
  3775. registered volume values (from the maximum value to a cumulated 1/1000 of
  3776. the samples).
  3777. All volumes are in decibels relative to the maximum PCM value.
  3778. @subsection Examples
  3779. Here is an excerpt of the output:
  3780. @example
  3781. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3782. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3783. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3784. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3785. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3786. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3787. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3788. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3789. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3790. @end example
  3791. It means that:
  3792. @itemize
  3793. @item
  3794. The mean square energy is approximately -27 dB, or 10^-2.7.
  3795. @item
  3796. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3797. @item
  3798. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3799. @end itemize
  3800. In other words, raising the volume by +4 dB does not cause any clipping,
  3801. raising it by +5 dB causes clipping for 6 samples, etc.
  3802. @c man end AUDIO FILTERS
  3803. @chapter Audio Sources
  3804. @c man begin AUDIO SOURCES
  3805. Below is a description of the currently available audio sources.
  3806. @section abuffer
  3807. Buffer audio frames, and make them available to the filter chain.
  3808. This source is mainly intended for a programmatic use, in particular
  3809. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3810. It accepts the following parameters:
  3811. @table @option
  3812. @item time_base
  3813. The timebase which will be used for timestamps of submitted frames. It must be
  3814. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3815. @item sample_rate
  3816. The sample rate of the incoming audio buffers.
  3817. @item sample_fmt
  3818. The sample format of the incoming audio buffers.
  3819. Either a sample format name or its corresponding integer representation from
  3820. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3821. @item channel_layout
  3822. The channel layout of the incoming audio buffers.
  3823. Either a channel layout name from channel_layout_map in
  3824. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3825. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3826. @item channels
  3827. The number of channels of the incoming audio buffers.
  3828. If both @var{channels} and @var{channel_layout} are specified, then they
  3829. must be consistent.
  3830. @end table
  3831. @subsection Examples
  3832. @example
  3833. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3834. @end example
  3835. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3836. Since the sample format with name "s16p" corresponds to the number
  3837. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3838. equivalent to:
  3839. @example
  3840. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3841. @end example
  3842. @section aevalsrc
  3843. Generate an audio signal specified by an expression.
  3844. This source accepts in input one or more expressions (one for each
  3845. channel), which are evaluated and used to generate a corresponding
  3846. audio signal.
  3847. This source accepts the following options:
  3848. @table @option
  3849. @item exprs
  3850. Set the '|'-separated expressions list for each separate channel. In case the
  3851. @option{channel_layout} option is not specified, the selected channel layout
  3852. depends on the number of provided expressions. Otherwise the last
  3853. specified expression is applied to the remaining output channels.
  3854. @item channel_layout, c
  3855. Set the channel layout. The number of channels in the specified layout
  3856. must be equal to the number of specified expressions.
  3857. @item duration, d
  3858. Set the minimum duration of the sourced audio. See
  3859. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3860. for the accepted syntax.
  3861. Note that the resulting duration may be greater than the specified
  3862. duration, as the generated audio is always cut at the end of a
  3863. complete frame.
  3864. If not specified, or the expressed duration is negative, the audio is
  3865. supposed to be generated forever.
  3866. @item nb_samples, n
  3867. Set the number of samples per channel per each output frame,
  3868. default to 1024.
  3869. @item sample_rate, s
  3870. Specify the sample rate, default to 44100.
  3871. @end table
  3872. Each expression in @var{exprs} can contain the following constants:
  3873. @table @option
  3874. @item n
  3875. number of the evaluated sample, starting from 0
  3876. @item t
  3877. time of the evaluated sample expressed in seconds, starting from 0
  3878. @item s
  3879. sample rate
  3880. @end table
  3881. @subsection Examples
  3882. @itemize
  3883. @item
  3884. Generate silence:
  3885. @example
  3886. aevalsrc=0
  3887. @end example
  3888. @item
  3889. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3890. 8000 Hz:
  3891. @example
  3892. aevalsrc="sin(440*2*PI*t):s=8000"
  3893. @end example
  3894. @item
  3895. Generate a two channels signal, specify the channel layout (Front
  3896. Center + Back Center) explicitly:
  3897. @example
  3898. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3899. @end example
  3900. @item
  3901. Generate white noise:
  3902. @example
  3903. aevalsrc="-2+random(0)"
  3904. @end example
  3905. @item
  3906. Generate an amplitude modulated signal:
  3907. @example
  3908. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3909. @end example
  3910. @item
  3911. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3912. @example
  3913. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3914. @end example
  3915. @end itemize
  3916. @section anullsrc
  3917. The null audio source, return unprocessed audio frames. It is mainly useful
  3918. as a template and to be employed in analysis / debugging tools, or as
  3919. the source for filters which ignore the input data (for example the sox
  3920. synth filter).
  3921. This source accepts the following options:
  3922. @table @option
  3923. @item channel_layout, cl
  3924. Specifies the channel layout, and can be either an integer or a string
  3925. representing a channel layout. The default value of @var{channel_layout}
  3926. is "stereo".
  3927. Check the channel_layout_map definition in
  3928. @file{libavutil/channel_layout.c} for the mapping between strings and
  3929. channel layout values.
  3930. @item sample_rate, r
  3931. Specifies the sample rate, and defaults to 44100.
  3932. @item nb_samples, n
  3933. Set the number of samples per requested frames.
  3934. @end table
  3935. @subsection Examples
  3936. @itemize
  3937. @item
  3938. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3939. @example
  3940. anullsrc=r=48000:cl=4
  3941. @end example
  3942. @item
  3943. Do the same operation with a more obvious syntax:
  3944. @example
  3945. anullsrc=r=48000:cl=mono
  3946. @end example
  3947. @end itemize
  3948. All the parameters need to be explicitly defined.
  3949. @section flite
  3950. Synthesize a voice utterance using the libflite library.
  3951. To enable compilation of this filter you need to configure FFmpeg with
  3952. @code{--enable-libflite}.
  3953. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3954. The filter accepts the following options:
  3955. @table @option
  3956. @item list_voices
  3957. If set to 1, list the names of the available voices and exit
  3958. immediately. Default value is 0.
  3959. @item nb_samples, n
  3960. Set the maximum number of samples per frame. Default value is 512.
  3961. @item textfile
  3962. Set the filename containing the text to speak.
  3963. @item text
  3964. Set the text to speak.
  3965. @item voice, v
  3966. Set the voice to use for the speech synthesis. Default value is
  3967. @code{kal}. See also the @var{list_voices} option.
  3968. @end table
  3969. @subsection Examples
  3970. @itemize
  3971. @item
  3972. Read from file @file{speech.txt}, and synthesize the text using the
  3973. standard flite voice:
  3974. @example
  3975. flite=textfile=speech.txt
  3976. @end example
  3977. @item
  3978. Read the specified text selecting the @code{slt} voice:
  3979. @example
  3980. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3981. @end example
  3982. @item
  3983. Input text to ffmpeg:
  3984. @example
  3985. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3986. @end example
  3987. @item
  3988. Make @file{ffplay} speak the specified text, using @code{flite} and
  3989. the @code{lavfi} device:
  3990. @example
  3991. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3992. @end example
  3993. @end itemize
  3994. For more information about libflite, check:
  3995. @url{http://www.festvox.org/flite/}
  3996. @section anoisesrc
  3997. Generate a noise audio signal.
  3998. The filter accepts the following options:
  3999. @table @option
  4000. @item sample_rate, r
  4001. Specify the sample rate. Default value is 48000 Hz.
  4002. @item amplitude, a
  4003. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4004. is 1.0.
  4005. @item duration, d
  4006. Specify the duration of the generated audio stream. Not specifying this option
  4007. results in noise with an infinite length.
  4008. @item color, colour, c
  4009. Specify the color of noise. Available noise colors are white, pink, brown,
  4010. blue and violet. Default color is white.
  4011. @item seed, s
  4012. Specify a value used to seed the PRNG.
  4013. @item nb_samples, n
  4014. Set the number of samples per each output frame, default is 1024.
  4015. @end table
  4016. @subsection Examples
  4017. @itemize
  4018. @item
  4019. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4020. @example
  4021. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4022. @end example
  4023. @end itemize
  4024. @section hilbert
  4025. Generate odd-tap Hilbert transform FIR coefficients.
  4026. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4027. the signal by 90 degrees.
  4028. This is used in many matrix coding schemes and for analytic signal generation.
  4029. The process is often written as a multiplication by i (or j), the imaginary unit.
  4030. The filter accepts the following options:
  4031. @table @option
  4032. @item sample_rate, s
  4033. Set sample rate, default is 44100.
  4034. @item taps, t
  4035. Set length of FIR filter, default is 22051.
  4036. @item nb_samples, n
  4037. Set number of samples per each frame.
  4038. @item win_func, w
  4039. Set window function to be used when generating FIR coefficients.
  4040. @end table
  4041. @section sine
  4042. Generate an audio signal made of a sine wave with amplitude 1/8.
  4043. The audio signal is bit-exact.
  4044. The filter accepts the following options:
  4045. @table @option
  4046. @item frequency, f
  4047. Set the carrier frequency. Default is 440 Hz.
  4048. @item beep_factor, b
  4049. Enable a periodic beep every second with frequency @var{beep_factor} times
  4050. the carrier frequency. Default is 0, meaning the beep is disabled.
  4051. @item sample_rate, r
  4052. Specify the sample rate, default is 44100.
  4053. @item duration, d
  4054. Specify the duration of the generated audio stream.
  4055. @item samples_per_frame
  4056. Set the number of samples per output frame.
  4057. The expression can contain the following constants:
  4058. @table @option
  4059. @item n
  4060. The (sequential) number of the output audio frame, starting from 0.
  4061. @item pts
  4062. The PTS (Presentation TimeStamp) of the output audio frame,
  4063. expressed in @var{TB} units.
  4064. @item t
  4065. The PTS of the output audio frame, expressed in seconds.
  4066. @item TB
  4067. The timebase of the output audio frames.
  4068. @end table
  4069. Default is @code{1024}.
  4070. @end table
  4071. @subsection Examples
  4072. @itemize
  4073. @item
  4074. Generate a simple 440 Hz sine wave:
  4075. @example
  4076. sine
  4077. @end example
  4078. @item
  4079. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4080. @example
  4081. sine=220:4:d=5
  4082. sine=f=220:b=4:d=5
  4083. sine=frequency=220:beep_factor=4:duration=5
  4084. @end example
  4085. @item
  4086. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4087. pattern:
  4088. @example
  4089. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4090. @end example
  4091. @end itemize
  4092. @c man end AUDIO SOURCES
  4093. @chapter Audio Sinks
  4094. @c man begin AUDIO SINKS
  4095. Below is a description of the currently available audio sinks.
  4096. @section abuffersink
  4097. Buffer audio frames, and make them available to the end of filter chain.
  4098. This sink is mainly intended for programmatic use, in particular
  4099. through the interface defined in @file{libavfilter/buffersink.h}
  4100. or the options system.
  4101. It accepts a pointer to an AVABufferSinkContext structure, which
  4102. defines the incoming buffers' formats, to be passed as the opaque
  4103. parameter to @code{avfilter_init_filter} for initialization.
  4104. @section anullsink
  4105. Null audio sink; do absolutely nothing with the input audio. It is
  4106. mainly useful as a template and for use in analysis / debugging
  4107. tools.
  4108. @c man end AUDIO SINKS
  4109. @chapter Video Filters
  4110. @c man begin VIDEO FILTERS
  4111. When you configure your FFmpeg build, you can disable any of the
  4112. existing filters using @code{--disable-filters}.
  4113. The configure output will show the video filters included in your
  4114. build.
  4115. Below is a description of the currently available video filters.
  4116. @section alphaextract
  4117. Extract the alpha component from the input as a grayscale video. This
  4118. is especially useful with the @var{alphamerge} filter.
  4119. @section alphamerge
  4120. Add or replace the alpha component of the primary input with the
  4121. grayscale value of a second input. This is intended for use with
  4122. @var{alphaextract} to allow the transmission or storage of frame
  4123. sequences that have alpha in a format that doesn't support an alpha
  4124. channel.
  4125. For example, to reconstruct full frames from a normal YUV-encoded video
  4126. and a separate video created with @var{alphaextract}, you might use:
  4127. @example
  4128. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4129. @end example
  4130. Since this filter is designed for reconstruction, it operates on frame
  4131. sequences without considering timestamps, and terminates when either
  4132. input reaches end of stream. This will cause problems if your encoding
  4133. pipeline drops frames. If you're trying to apply an image as an
  4134. overlay to a video stream, consider the @var{overlay} filter instead.
  4135. @section amplify
  4136. Amplify differences between current pixel and pixels of adjacent frames in
  4137. same pixel location.
  4138. This filter accepts the following options:
  4139. @table @option
  4140. @item radius
  4141. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4142. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4143. @item factor
  4144. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4145. @item threshold
  4146. Set threshold for difference amplification. Any differrence greater or equal to
  4147. this value will not alter source pixel. Default is 10.
  4148. Allowed range is from 0 to 65535.
  4149. @item low
  4150. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4151. This option controls maximum possible value that will decrease source pixel value.
  4152. @item high
  4153. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4154. This option controls maximum possible value that will increase source pixel value.
  4155. @item planes
  4156. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4157. @end table
  4158. @section ass
  4159. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4160. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4161. Substation Alpha) subtitles files.
  4162. This filter accepts the following option in addition to the common options from
  4163. the @ref{subtitles} filter:
  4164. @table @option
  4165. @item shaping
  4166. Set the shaping engine
  4167. Available values are:
  4168. @table @samp
  4169. @item auto
  4170. The default libass shaping engine, which is the best available.
  4171. @item simple
  4172. Fast, font-agnostic shaper that can do only substitutions
  4173. @item complex
  4174. Slower shaper using OpenType for substitutions and positioning
  4175. @end table
  4176. The default is @code{auto}.
  4177. @end table
  4178. @section atadenoise
  4179. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item 0a
  4183. Set threshold A for 1st plane. Default is 0.02.
  4184. Valid range is 0 to 0.3.
  4185. @item 0b
  4186. Set threshold B for 1st plane. Default is 0.04.
  4187. Valid range is 0 to 5.
  4188. @item 1a
  4189. Set threshold A for 2nd plane. Default is 0.02.
  4190. Valid range is 0 to 0.3.
  4191. @item 1b
  4192. Set threshold B for 2nd plane. Default is 0.04.
  4193. Valid range is 0 to 5.
  4194. @item 2a
  4195. Set threshold A for 3rd plane. Default is 0.02.
  4196. Valid range is 0 to 0.3.
  4197. @item 2b
  4198. Set threshold B for 3rd plane. Default is 0.04.
  4199. Valid range is 0 to 5.
  4200. Threshold A is designed to react on abrupt changes in the input signal and
  4201. threshold B is designed to react on continuous changes in the input signal.
  4202. @item s
  4203. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4204. number in range [5, 129].
  4205. @item p
  4206. Set what planes of frame filter will use for averaging. Default is all.
  4207. @end table
  4208. @section avgblur
  4209. Apply average blur filter.
  4210. The filter accepts the following options:
  4211. @table @option
  4212. @item sizeX
  4213. Set horizontal radius size.
  4214. @item planes
  4215. Set which planes to filter. By default all planes are filtered.
  4216. @item sizeY
  4217. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4218. Default is @code{0}.
  4219. @end table
  4220. @section bbox
  4221. Compute the bounding box for the non-black pixels in the input frame
  4222. luminance plane.
  4223. This filter computes the bounding box containing all the pixels with a
  4224. luminance value greater than the minimum allowed value.
  4225. The parameters describing the bounding box are printed on the filter
  4226. log.
  4227. The filter accepts the following option:
  4228. @table @option
  4229. @item min_val
  4230. Set the minimal luminance value. Default is @code{16}.
  4231. @end table
  4232. @section bitplanenoise
  4233. Show and measure bit plane noise.
  4234. The filter accepts the following options:
  4235. @table @option
  4236. @item bitplane
  4237. Set which plane to analyze. Default is @code{1}.
  4238. @item filter
  4239. Filter out noisy pixels from @code{bitplane} set above.
  4240. Default is disabled.
  4241. @end table
  4242. @section blackdetect
  4243. Detect video intervals that are (almost) completely black. Can be
  4244. useful to detect chapter transitions, commercials, or invalid
  4245. recordings. Output lines contains the time for the start, end and
  4246. duration of the detected black interval expressed in seconds.
  4247. In order to display the output lines, you need to set the loglevel at
  4248. least to the AV_LOG_INFO value.
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item black_min_duration, d
  4252. Set the minimum detected black duration expressed in seconds. It must
  4253. be a non-negative floating point number.
  4254. Default value is 2.0.
  4255. @item picture_black_ratio_th, pic_th
  4256. Set the threshold for considering a picture "black".
  4257. Express the minimum value for the ratio:
  4258. @example
  4259. @var{nb_black_pixels} / @var{nb_pixels}
  4260. @end example
  4261. for which a picture is considered black.
  4262. Default value is 0.98.
  4263. @item pixel_black_th, pix_th
  4264. Set the threshold for considering a pixel "black".
  4265. The threshold expresses the maximum pixel luminance value for which a
  4266. pixel is considered "black". The provided value is scaled according to
  4267. the following equation:
  4268. @example
  4269. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4270. @end example
  4271. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4272. the input video format, the range is [0-255] for YUV full-range
  4273. formats and [16-235] for YUV non full-range formats.
  4274. Default value is 0.10.
  4275. @end table
  4276. The following example sets the maximum pixel threshold to the minimum
  4277. value, and detects only black intervals of 2 or more seconds:
  4278. @example
  4279. blackdetect=d=2:pix_th=0.00
  4280. @end example
  4281. @section blackframe
  4282. Detect frames that are (almost) completely black. Can be useful to
  4283. detect chapter transitions or commercials. Output lines consist of
  4284. the frame number of the detected frame, the percentage of blackness,
  4285. the position in the file if known or -1 and the timestamp in seconds.
  4286. In order to display the output lines, you need to set the loglevel at
  4287. least to the AV_LOG_INFO value.
  4288. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4289. The value represents the percentage of pixels in the picture that
  4290. are below the threshold value.
  4291. It accepts the following parameters:
  4292. @table @option
  4293. @item amount
  4294. The percentage of the pixels that have to be below the threshold; it defaults to
  4295. @code{98}.
  4296. @item threshold, thresh
  4297. The threshold below which a pixel value is considered black; it defaults to
  4298. @code{32}.
  4299. @end table
  4300. @section blend, tblend
  4301. Blend two video frames into each other.
  4302. The @code{blend} filter takes two input streams and outputs one
  4303. stream, the first input is the "top" layer and second input is
  4304. "bottom" layer. By default, the output terminates when the longest input terminates.
  4305. The @code{tblend} (time blend) filter takes two consecutive frames
  4306. from one single stream, and outputs the result obtained by blending
  4307. the new frame on top of the old frame.
  4308. A description of the accepted options follows.
  4309. @table @option
  4310. @item c0_mode
  4311. @item c1_mode
  4312. @item c2_mode
  4313. @item c3_mode
  4314. @item all_mode
  4315. Set blend mode for specific pixel component or all pixel components in case
  4316. of @var{all_mode}. Default value is @code{normal}.
  4317. Available values for component modes are:
  4318. @table @samp
  4319. @item addition
  4320. @item grainmerge
  4321. @item and
  4322. @item average
  4323. @item burn
  4324. @item darken
  4325. @item difference
  4326. @item grainextract
  4327. @item divide
  4328. @item dodge
  4329. @item freeze
  4330. @item exclusion
  4331. @item extremity
  4332. @item glow
  4333. @item hardlight
  4334. @item hardmix
  4335. @item heat
  4336. @item lighten
  4337. @item linearlight
  4338. @item multiply
  4339. @item multiply128
  4340. @item negation
  4341. @item normal
  4342. @item or
  4343. @item overlay
  4344. @item phoenix
  4345. @item pinlight
  4346. @item reflect
  4347. @item screen
  4348. @item softlight
  4349. @item subtract
  4350. @item vividlight
  4351. @item xor
  4352. @end table
  4353. @item c0_opacity
  4354. @item c1_opacity
  4355. @item c2_opacity
  4356. @item c3_opacity
  4357. @item all_opacity
  4358. Set blend opacity for specific pixel component or all pixel components in case
  4359. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4360. @item c0_expr
  4361. @item c1_expr
  4362. @item c2_expr
  4363. @item c3_expr
  4364. @item all_expr
  4365. Set blend expression for specific pixel component or all pixel components in case
  4366. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4367. The expressions can use the following variables:
  4368. @table @option
  4369. @item N
  4370. The sequential number of the filtered frame, starting from @code{0}.
  4371. @item X
  4372. @item Y
  4373. the coordinates of the current sample
  4374. @item W
  4375. @item H
  4376. the width and height of currently filtered plane
  4377. @item SW
  4378. @item SH
  4379. Width and height scale for the plane being filtered. It is the
  4380. ratio between the dimensions of the current plane to the luma plane,
  4381. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4382. the luma plane and @code{0.5,0.5} for the chroma planes.
  4383. @item T
  4384. Time of the current frame, expressed in seconds.
  4385. @item TOP, A
  4386. Value of pixel component at current location for first video frame (top layer).
  4387. @item BOTTOM, B
  4388. Value of pixel component at current location for second video frame (bottom layer).
  4389. @end table
  4390. @end table
  4391. The @code{blend} filter also supports the @ref{framesync} options.
  4392. @subsection Examples
  4393. @itemize
  4394. @item
  4395. Apply transition from bottom layer to top layer in first 10 seconds:
  4396. @example
  4397. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4398. @end example
  4399. @item
  4400. Apply linear horizontal transition from top layer to bottom layer:
  4401. @example
  4402. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4403. @end example
  4404. @item
  4405. Apply 1x1 checkerboard effect:
  4406. @example
  4407. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4408. @end example
  4409. @item
  4410. Apply uncover left effect:
  4411. @example
  4412. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4413. @end example
  4414. @item
  4415. Apply uncover down effect:
  4416. @example
  4417. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4418. @end example
  4419. @item
  4420. Apply uncover up-left effect:
  4421. @example
  4422. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4423. @end example
  4424. @item
  4425. Split diagonally video and shows top and bottom layer on each side:
  4426. @example
  4427. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4428. @end example
  4429. @item
  4430. Display differences between the current and the previous frame:
  4431. @example
  4432. tblend=all_mode=grainextract
  4433. @end example
  4434. @end itemize
  4435. @section boxblur
  4436. Apply a boxblur algorithm to the input video.
  4437. It accepts the following parameters:
  4438. @table @option
  4439. @item luma_radius, lr
  4440. @item luma_power, lp
  4441. @item chroma_radius, cr
  4442. @item chroma_power, cp
  4443. @item alpha_radius, ar
  4444. @item alpha_power, ap
  4445. @end table
  4446. A description of the accepted options follows.
  4447. @table @option
  4448. @item luma_radius, lr
  4449. @item chroma_radius, cr
  4450. @item alpha_radius, ar
  4451. Set an expression for the box radius in pixels used for blurring the
  4452. corresponding input plane.
  4453. The radius value must be a non-negative number, and must not be
  4454. greater than the value of the expression @code{min(w,h)/2} for the
  4455. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4456. planes.
  4457. Default value for @option{luma_radius} is "2". If not specified,
  4458. @option{chroma_radius} and @option{alpha_radius} default to the
  4459. corresponding value set for @option{luma_radius}.
  4460. The expressions can contain the following constants:
  4461. @table @option
  4462. @item w
  4463. @item h
  4464. The input width and height in pixels.
  4465. @item cw
  4466. @item ch
  4467. The input chroma image width and height in pixels.
  4468. @item hsub
  4469. @item vsub
  4470. The horizontal and vertical chroma subsample values. For example, for the
  4471. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4472. @end table
  4473. @item luma_power, lp
  4474. @item chroma_power, cp
  4475. @item alpha_power, ap
  4476. Specify how many times the boxblur filter is applied to the
  4477. corresponding plane.
  4478. Default value for @option{luma_power} is 2. If not specified,
  4479. @option{chroma_power} and @option{alpha_power} default to the
  4480. corresponding value set for @option{luma_power}.
  4481. A value of 0 will disable the effect.
  4482. @end table
  4483. @subsection Examples
  4484. @itemize
  4485. @item
  4486. Apply a boxblur filter with the luma, chroma, and alpha radii
  4487. set to 2:
  4488. @example
  4489. boxblur=luma_radius=2:luma_power=1
  4490. boxblur=2:1
  4491. @end example
  4492. @item
  4493. Set the luma radius to 2, and alpha and chroma radius to 0:
  4494. @example
  4495. boxblur=2:1:cr=0:ar=0
  4496. @end example
  4497. @item
  4498. Set the luma and chroma radii to a fraction of the video dimension:
  4499. @example
  4500. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4501. @end example
  4502. @end itemize
  4503. @section bwdif
  4504. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4505. Deinterlacing Filter").
  4506. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4507. interpolation algorithms.
  4508. It accepts the following parameters:
  4509. @table @option
  4510. @item mode
  4511. The interlacing mode to adopt. It accepts one of the following values:
  4512. @table @option
  4513. @item 0, send_frame
  4514. Output one frame for each frame.
  4515. @item 1, send_field
  4516. Output one frame for each field.
  4517. @end table
  4518. The default value is @code{send_field}.
  4519. @item parity
  4520. The picture field parity assumed for the input interlaced video. It accepts one
  4521. of the following values:
  4522. @table @option
  4523. @item 0, tff
  4524. Assume the top field is first.
  4525. @item 1, bff
  4526. Assume the bottom field is first.
  4527. @item -1, auto
  4528. Enable automatic detection of field parity.
  4529. @end table
  4530. The default value is @code{auto}.
  4531. If the interlacing is unknown or the decoder does not export this information,
  4532. top field first will be assumed.
  4533. @item deint
  4534. Specify which frames to deinterlace. Accept one of the following
  4535. values:
  4536. @table @option
  4537. @item 0, all
  4538. Deinterlace all frames.
  4539. @item 1, interlaced
  4540. Only deinterlace frames marked as interlaced.
  4541. @end table
  4542. The default value is @code{all}.
  4543. @end table
  4544. @section chromakey
  4545. YUV colorspace color/chroma keying.
  4546. The filter accepts the following options:
  4547. @table @option
  4548. @item color
  4549. The color which will be replaced with transparency.
  4550. @item similarity
  4551. Similarity percentage with the key color.
  4552. 0.01 matches only the exact key color, while 1.0 matches everything.
  4553. @item blend
  4554. Blend percentage.
  4555. 0.0 makes pixels either fully transparent, or not transparent at all.
  4556. Higher values result in semi-transparent pixels, with a higher transparency
  4557. the more similar the pixels color is to the key color.
  4558. @item yuv
  4559. Signals that the color passed is already in YUV instead of RGB.
  4560. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4561. This can be used to pass exact YUV values as hexadecimal numbers.
  4562. @end table
  4563. @subsection Examples
  4564. @itemize
  4565. @item
  4566. Make every green pixel in the input image transparent:
  4567. @example
  4568. ffmpeg -i input.png -vf chromakey=green out.png
  4569. @end example
  4570. @item
  4571. Overlay a greenscreen-video on top of a static black background.
  4572. @example
  4573. 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
  4574. @end example
  4575. @end itemize
  4576. @section ciescope
  4577. Display CIE color diagram with pixels overlaid onto it.
  4578. The filter accepts the following options:
  4579. @table @option
  4580. @item system
  4581. Set color system.
  4582. @table @samp
  4583. @item ntsc, 470m
  4584. @item ebu, 470bg
  4585. @item smpte
  4586. @item 240m
  4587. @item apple
  4588. @item widergb
  4589. @item cie1931
  4590. @item rec709, hdtv
  4591. @item uhdtv, rec2020
  4592. @end table
  4593. @item cie
  4594. Set CIE system.
  4595. @table @samp
  4596. @item xyy
  4597. @item ucs
  4598. @item luv
  4599. @end table
  4600. @item gamuts
  4601. Set what gamuts to draw.
  4602. See @code{system} option for available values.
  4603. @item size, s
  4604. Set ciescope size, by default set to 512.
  4605. @item intensity, i
  4606. Set intensity used to map input pixel values to CIE diagram.
  4607. @item contrast
  4608. Set contrast used to draw tongue colors that are out of active color system gamut.
  4609. @item corrgamma
  4610. Correct gamma displayed on scope, by default enabled.
  4611. @item showwhite
  4612. Show white point on CIE diagram, by default disabled.
  4613. @item gamma
  4614. Set input gamma. Used only with XYZ input color space.
  4615. @end table
  4616. @section codecview
  4617. Visualize information exported by some codecs.
  4618. Some codecs can export information through frames using side-data or other
  4619. means. For example, some MPEG based codecs export motion vectors through the
  4620. @var{export_mvs} flag in the codec @option{flags2} option.
  4621. The filter accepts the following option:
  4622. @table @option
  4623. @item mv
  4624. Set motion vectors to visualize.
  4625. Available flags for @var{mv} are:
  4626. @table @samp
  4627. @item pf
  4628. forward predicted MVs of P-frames
  4629. @item bf
  4630. forward predicted MVs of B-frames
  4631. @item bb
  4632. backward predicted MVs of B-frames
  4633. @end table
  4634. @item qp
  4635. Display quantization parameters using the chroma planes.
  4636. @item mv_type, mvt
  4637. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4638. Available flags for @var{mv_type} are:
  4639. @table @samp
  4640. @item fp
  4641. forward predicted MVs
  4642. @item bp
  4643. backward predicted MVs
  4644. @end table
  4645. @item frame_type, ft
  4646. Set frame type to visualize motion vectors of.
  4647. Available flags for @var{frame_type} are:
  4648. @table @samp
  4649. @item if
  4650. intra-coded frames (I-frames)
  4651. @item pf
  4652. predicted frames (P-frames)
  4653. @item bf
  4654. bi-directionally predicted frames (B-frames)
  4655. @end table
  4656. @end table
  4657. @subsection Examples
  4658. @itemize
  4659. @item
  4660. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4661. @example
  4662. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4663. @end example
  4664. @item
  4665. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4666. @example
  4667. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4668. @end example
  4669. @end itemize
  4670. @section colorbalance
  4671. Modify intensity of primary colors (red, green and blue) of input frames.
  4672. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4673. regions for the red-cyan, green-magenta or blue-yellow balance.
  4674. A positive adjustment value shifts the balance towards the primary color, a negative
  4675. value towards the complementary color.
  4676. The filter accepts the following options:
  4677. @table @option
  4678. @item rs
  4679. @item gs
  4680. @item bs
  4681. Adjust red, green and blue shadows (darkest pixels).
  4682. @item rm
  4683. @item gm
  4684. @item bm
  4685. Adjust red, green and blue midtones (medium pixels).
  4686. @item rh
  4687. @item gh
  4688. @item bh
  4689. Adjust red, green and blue highlights (brightest pixels).
  4690. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4691. @end table
  4692. @subsection Examples
  4693. @itemize
  4694. @item
  4695. Add red color cast to shadows:
  4696. @example
  4697. colorbalance=rs=.3
  4698. @end example
  4699. @end itemize
  4700. @section colorkey
  4701. RGB colorspace color keying.
  4702. The filter accepts the following options:
  4703. @table @option
  4704. @item color
  4705. The color which will be replaced with transparency.
  4706. @item similarity
  4707. Similarity percentage with the key color.
  4708. 0.01 matches only the exact key color, while 1.0 matches everything.
  4709. @item blend
  4710. Blend percentage.
  4711. 0.0 makes pixels either fully transparent, or not transparent at all.
  4712. Higher values result in semi-transparent pixels, with a higher transparency
  4713. the more similar the pixels color is to the key color.
  4714. @end table
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Make every green pixel in the input image transparent:
  4719. @example
  4720. ffmpeg -i input.png -vf colorkey=green out.png
  4721. @end example
  4722. @item
  4723. Overlay a greenscreen-video on top of a static background image.
  4724. @example
  4725. 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
  4726. @end example
  4727. @end itemize
  4728. @section colorlevels
  4729. Adjust video input frames using levels.
  4730. The filter accepts the following options:
  4731. @table @option
  4732. @item rimin
  4733. @item gimin
  4734. @item bimin
  4735. @item aimin
  4736. Adjust red, green, blue and alpha input black point.
  4737. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4738. @item rimax
  4739. @item gimax
  4740. @item bimax
  4741. @item aimax
  4742. Adjust red, green, blue and alpha input white point.
  4743. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4744. Input levels are used to lighten highlights (bright tones), darken shadows
  4745. (dark tones), change the balance of bright and dark tones.
  4746. @item romin
  4747. @item gomin
  4748. @item bomin
  4749. @item aomin
  4750. Adjust red, green, blue and alpha output black point.
  4751. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4752. @item romax
  4753. @item gomax
  4754. @item bomax
  4755. @item aomax
  4756. Adjust red, green, blue and alpha output white point.
  4757. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4758. Output levels allows manual selection of a constrained output level range.
  4759. @end table
  4760. @subsection Examples
  4761. @itemize
  4762. @item
  4763. Make video output darker:
  4764. @example
  4765. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4766. @end example
  4767. @item
  4768. Increase contrast:
  4769. @example
  4770. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4771. @end example
  4772. @item
  4773. Make video output lighter:
  4774. @example
  4775. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4776. @end example
  4777. @item
  4778. Increase brightness:
  4779. @example
  4780. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4781. @end example
  4782. @end itemize
  4783. @section colorchannelmixer
  4784. Adjust video input frames by re-mixing color channels.
  4785. This filter modifies a color channel by adding the values associated to
  4786. the other channels of the same pixels. For example if the value to
  4787. modify is red, the output value will be:
  4788. @example
  4789. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4790. @end example
  4791. The filter accepts the following options:
  4792. @table @option
  4793. @item rr
  4794. @item rg
  4795. @item rb
  4796. @item ra
  4797. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4798. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4799. @item gr
  4800. @item gg
  4801. @item gb
  4802. @item ga
  4803. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4804. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4805. @item br
  4806. @item bg
  4807. @item bb
  4808. @item ba
  4809. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4810. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4811. @item ar
  4812. @item ag
  4813. @item ab
  4814. @item aa
  4815. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4816. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4817. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4818. @end table
  4819. @subsection Examples
  4820. @itemize
  4821. @item
  4822. Convert source to grayscale:
  4823. @example
  4824. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4825. @end example
  4826. @item
  4827. Simulate sepia tones:
  4828. @example
  4829. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4830. @end example
  4831. @end itemize
  4832. @section colormatrix
  4833. Convert color matrix.
  4834. The filter accepts the following options:
  4835. @table @option
  4836. @item src
  4837. @item dst
  4838. Specify the source and destination color matrix. Both values must be
  4839. specified.
  4840. The accepted values are:
  4841. @table @samp
  4842. @item bt709
  4843. BT.709
  4844. @item fcc
  4845. FCC
  4846. @item bt601
  4847. BT.601
  4848. @item bt470
  4849. BT.470
  4850. @item bt470bg
  4851. BT.470BG
  4852. @item smpte170m
  4853. SMPTE-170M
  4854. @item smpte240m
  4855. SMPTE-240M
  4856. @item bt2020
  4857. BT.2020
  4858. @end table
  4859. @end table
  4860. For example to convert from BT.601 to SMPTE-240M, use the command:
  4861. @example
  4862. colormatrix=bt601:smpte240m
  4863. @end example
  4864. @section colorspace
  4865. Convert colorspace, transfer characteristics or color primaries.
  4866. Input video needs to have an even size.
  4867. The filter accepts the following options:
  4868. @table @option
  4869. @anchor{all}
  4870. @item all
  4871. Specify all color properties at once.
  4872. The accepted values are:
  4873. @table @samp
  4874. @item bt470m
  4875. BT.470M
  4876. @item bt470bg
  4877. BT.470BG
  4878. @item bt601-6-525
  4879. BT.601-6 525
  4880. @item bt601-6-625
  4881. BT.601-6 625
  4882. @item bt709
  4883. BT.709
  4884. @item smpte170m
  4885. SMPTE-170M
  4886. @item smpte240m
  4887. SMPTE-240M
  4888. @item bt2020
  4889. BT.2020
  4890. @end table
  4891. @anchor{space}
  4892. @item space
  4893. Specify output colorspace.
  4894. The accepted values are:
  4895. @table @samp
  4896. @item bt709
  4897. BT.709
  4898. @item fcc
  4899. FCC
  4900. @item bt470bg
  4901. BT.470BG or BT.601-6 625
  4902. @item smpte170m
  4903. SMPTE-170M or BT.601-6 525
  4904. @item smpte240m
  4905. SMPTE-240M
  4906. @item ycgco
  4907. YCgCo
  4908. @item bt2020ncl
  4909. BT.2020 with non-constant luminance
  4910. @end table
  4911. @anchor{trc}
  4912. @item trc
  4913. Specify output transfer characteristics.
  4914. The accepted values are:
  4915. @table @samp
  4916. @item bt709
  4917. BT.709
  4918. @item bt470m
  4919. BT.470M
  4920. @item bt470bg
  4921. BT.470BG
  4922. @item gamma22
  4923. Constant gamma of 2.2
  4924. @item gamma28
  4925. Constant gamma of 2.8
  4926. @item smpte170m
  4927. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4928. @item smpte240m
  4929. SMPTE-240M
  4930. @item srgb
  4931. SRGB
  4932. @item iec61966-2-1
  4933. iec61966-2-1
  4934. @item iec61966-2-4
  4935. iec61966-2-4
  4936. @item xvycc
  4937. xvycc
  4938. @item bt2020-10
  4939. BT.2020 for 10-bits content
  4940. @item bt2020-12
  4941. BT.2020 for 12-bits content
  4942. @end table
  4943. @anchor{primaries}
  4944. @item primaries
  4945. Specify output color primaries.
  4946. The accepted values are:
  4947. @table @samp
  4948. @item bt709
  4949. BT.709
  4950. @item bt470m
  4951. BT.470M
  4952. @item bt470bg
  4953. BT.470BG or BT.601-6 625
  4954. @item smpte170m
  4955. SMPTE-170M or BT.601-6 525
  4956. @item smpte240m
  4957. SMPTE-240M
  4958. @item film
  4959. film
  4960. @item smpte431
  4961. SMPTE-431
  4962. @item smpte432
  4963. SMPTE-432
  4964. @item bt2020
  4965. BT.2020
  4966. @item jedec-p22
  4967. JEDEC P22 phosphors
  4968. @end table
  4969. @anchor{range}
  4970. @item range
  4971. Specify output color range.
  4972. The accepted values are:
  4973. @table @samp
  4974. @item tv
  4975. TV (restricted) range
  4976. @item mpeg
  4977. MPEG (restricted) range
  4978. @item pc
  4979. PC (full) range
  4980. @item jpeg
  4981. JPEG (full) range
  4982. @end table
  4983. @item format
  4984. Specify output color format.
  4985. The accepted values are:
  4986. @table @samp
  4987. @item yuv420p
  4988. YUV 4:2:0 planar 8-bits
  4989. @item yuv420p10
  4990. YUV 4:2:0 planar 10-bits
  4991. @item yuv420p12
  4992. YUV 4:2:0 planar 12-bits
  4993. @item yuv422p
  4994. YUV 4:2:2 planar 8-bits
  4995. @item yuv422p10
  4996. YUV 4:2:2 planar 10-bits
  4997. @item yuv422p12
  4998. YUV 4:2:2 planar 12-bits
  4999. @item yuv444p
  5000. YUV 4:4:4 planar 8-bits
  5001. @item yuv444p10
  5002. YUV 4:4:4 planar 10-bits
  5003. @item yuv444p12
  5004. YUV 4:4:4 planar 12-bits
  5005. @end table
  5006. @item fast
  5007. Do a fast conversion, which skips gamma/primary correction. This will take
  5008. significantly less CPU, but will be mathematically incorrect. To get output
  5009. compatible with that produced by the colormatrix filter, use fast=1.
  5010. @item dither
  5011. Specify dithering mode.
  5012. The accepted values are:
  5013. @table @samp
  5014. @item none
  5015. No dithering
  5016. @item fsb
  5017. Floyd-Steinberg dithering
  5018. @end table
  5019. @item wpadapt
  5020. Whitepoint adaptation mode.
  5021. The accepted values are:
  5022. @table @samp
  5023. @item bradford
  5024. Bradford whitepoint adaptation
  5025. @item vonkries
  5026. von Kries whitepoint adaptation
  5027. @item identity
  5028. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5029. @end table
  5030. @item iall
  5031. Override all input properties at once. Same accepted values as @ref{all}.
  5032. @item ispace
  5033. Override input colorspace. Same accepted values as @ref{space}.
  5034. @item iprimaries
  5035. Override input color primaries. Same accepted values as @ref{primaries}.
  5036. @item itrc
  5037. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5038. @item irange
  5039. Override input color range. Same accepted values as @ref{range}.
  5040. @end table
  5041. The filter converts the transfer characteristics, color space and color
  5042. primaries to the specified user values. The output value, if not specified,
  5043. is set to a default value based on the "all" property. If that property is
  5044. also not specified, the filter will log an error. The output color range and
  5045. format default to the same value as the input color range and format. The
  5046. input transfer characteristics, color space, color primaries and color range
  5047. should be set on the input data. If any of these are missing, the filter will
  5048. log an error and no conversion will take place.
  5049. For example to convert the input to SMPTE-240M, use the command:
  5050. @example
  5051. colorspace=smpte240m
  5052. @end example
  5053. @section convolution
  5054. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5055. The filter accepts the following options:
  5056. @table @option
  5057. @item 0m
  5058. @item 1m
  5059. @item 2m
  5060. @item 3m
  5061. Set matrix for each plane.
  5062. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5063. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5064. @item 0rdiv
  5065. @item 1rdiv
  5066. @item 2rdiv
  5067. @item 3rdiv
  5068. Set multiplier for calculated value for each plane.
  5069. If unset or 0, it will be sum of all matrix elements.
  5070. @item 0bias
  5071. @item 1bias
  5072. @item 2bias
  5073. @item 3bias
  5074. Set bias for each plane. This value is added to the result of the multiplication.
  5075. Useful for making the overall image brighter or darker. Default is 0.0.
  5076. @item 0mode
  5077. @item 1mode
  5078. @item 2mode
  5079. @item 3mode
  5080. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5081. Default is @var{square}.
  5082. @end table
  5083. @subsection Examples
  5084. @itemize
  5085. @item
  5086. Apply sharpen:
  5087. @example
  5088. 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"
  5089. @end example
  5090. @item
  5091. Apply blur:
  5092. @example
  5093. 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"
  5094. @end example
  5095. @item
  5096. Apply edge enhance:
  5097. @example
  5098. 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"
  5099. @end example
  5100. @item
  5101. Apply edge detect:
  5102. @example
  5103. 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"
  5104. @end example
  5105. @item
  5106. Apply laplacian edge detector which includes diagonals:
  5107. @example
  5108. 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"
  5109. @end example
  5110. @item
  5111. Apply emboss:
  5112. @example
  5113. 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"
  5114. @end example
  5115. @end itemize
  5116. @section convolve
  5117. Apply 2D convolution of video stream in frequency domain using second stream
  5118. as impulse.
  5119. The filter accepts the following options:
  5120. @table @option
  5121. @item planes
  5122. Set which planes to process.
  5123. @item impulse
  5124. Set which impulse video frames will be processed, can be @var{first}
  5125. or @var{all}. Default is @var{all}.
  5126. @end table
  5127. The @code{convolve} filter also supports the @ref{framesync} options.
  5128. @section copy
  5129. Copy the input video source unchanged to the output. This is mainly useful for
  5130. testing purposes.
  5131. @anchor{coreimage}
  5132. @section coreimage
  5133. Video filtering on GPU using Apple's CoreImage API on OSX.
  5134. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5135. processed by video hardware. However, software-based OpenGL implementations
  5136. exist which means there is no guarantee for hardware processing. It depends on
  5137. the respective OSX.
  5138. There are many filters and image generators provided by Apple that come with a
  5139. large variety of options. The filter has to be referenced by its name along
  5140. with its options.
  5141. The coreimage filter accepts the following options:
  5142. @table @option
  5143. @item list_filters
  5144. List all available filters and generators along with all their respective
  5145. options as well as possible minimum and maximum values along with the default
  5146. values.
  5147. @example
  5148. list_filters=true
  5149. @end example
  5150. @item filter
  5151. Specify all filters by their respective name and options.
  5152. Use @var{list_filters} to determine all valid filter names and options.
  5153. Numerical options are specified by a float value and are automatically clamped
  5154. to their respective value range. Vector and color options have to be specified
  5155. by a list of space separated float values. Character escaping has to be done.
  5156. A special option name @code{default} is available to use default options for a
  5157. filter.
  5158. It is required to specify either @code{default} or at least one of the filter options.
  5159. All omitted options are used with their default values.
  5160. The syntax of the filter string is as follows:
  5161. @example
  5162. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5163. @end example
  5164. @item output_rect
  5165. Specify a rectangle where the output of the filter chain is copied into the
  5166. input image. It is given by a list of space separated float values:
  5167. @example
  5168. output_rect=x\ y\ width\ height
  5169. @end example
  5170. If not given, the output rectangle equals the dimensions of the input image.
  5171. The output rectangle is automatically cropped at the borders of the input
  5172. image. Negative values are valid for each component.
  5173. @example
  5174. output_rect=25\ 25\ 100\ 100
  5175. @end example
  5176. @end table
  5177. Several filters can be chained for successive processing without GPU-HOST
  5178. transfers allowing for fast processing of complex filter chains.
  5179. Currently, only filters with zero (generators) or exactly one (filters) input
  5180. image and one output image are supported. Also, transition filters are not yet
  5181. usable as intended.
  5182. Some filters generate output images with additional padding depending on the
  5183. respective filter kernel. The padding is automatically removed to ensure the
  5184. filter output has the same size as the input image.
  5185. For image generators, the size of the output image is determined by the
  5186. previous output image of the filter chain or the input image of the whole
  5187. filterchain, respectively. The generators do not use the pixel information of
  5188. this image to generate their output. However, the generated output is
  5189. blended onto this image, resulting in partial or complete coverage of the
  5190. output image.
  5191. The @ref{coreimagesrc} video source can be used for generating input images
  5192. which are directly fed into the filter chain. By using it, providing input
  5193. images by another video source or an input video is not required.
  5194. @subsection Examples
  5195. @itemize
  5196. @item
  5197. List all filters available:
  5198. @example
  5199. coreimage=list_filters=true
  5200. @end example
  5201. @item
  5202. Use the CIBoxBlur filter with default options to blur an image:
  5203. @example
  5204. coreimage=filter=CIBoxBlur@@default
  5205. @end example
  5206. @item
  5207. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5208. its center at 100x100 and a radius of 50 pixels:
  5209. @example
  5210. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5211. @end example
  5212. @item
  5213. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5214. given as complete and escaped command-line for Apple's standard bash shell:
  5215. @example
  5216. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5217. @end example
  5218. @end itemize
  5219. @section crop
  5220. Crop the input video to given dimensions.
  5221. It accepts the following parameters:
  5222. @table @option
  5223. @item w, out_w
  5224. The width of the output video. It defaults to @code{iw}.
  5225. This expression is evaluated only once during the filter
  5226. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5227. @item h, out_h
  5228. The height of the output video. It defaults to @code{ih}.
  5229. This expression is evaluated only once during the filter
  5230. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5231. @item x
  5232. The horizontal position, in the input video, of the left edge of the output
  5233. video. It defaults to @code{(in_w-out_w)/2}.
  5234. This expression is evaluated per-frame.
  5235. @item y
  5236. The vertical position, in the input video, of the top edge of the output video.
  5237. It defaults to @code{(in_h-out_h)/2}.
  5238. This expression is evaluated per-frame.
  5239. @item keep_aspect
  5240. If set to 1 will force the output display aspect ratio
  5241. to be the same of the input, by changing the output sample aspect
  5242. ratio. It defaults to 0.
  5243. @item exact
  5244. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5245. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5246. It defaults to 0.
  5247. @end table
  5248. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5249. expressions containing the following constants:
  5250. @table @option
  5251. @item x
  5252. @item y
  5253. The computed values for @var{x} and @var{y}. They are evaluated for
  5254. each new frame.
  5255. @item in_w
  5256. @item in_h
  5257. The input width and height.
  5258. @item iw
  5259. @item ih
  5260. These are the same as @var{in_w} and @var{in_h}.
  5261. @item out_w
  5262. @item out_h
  5263. The output (cropped) width and height.
  5264. @item ow
  5265. @item oh
  5266. These are the same as @var{out_w} and @var{out_h}.
  5267. @item a
  5268. same as @var{iw} / @var{ih}
  5269. @item sar
  5270. input sample aspect ratio
  5271. @item dar
  5272. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5273. @item hsub
  5274. @item vsub
  5275. horizontal and vertical chroma subsample values. For example for the
  5276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5277. @item n
  5278. The number of the input frame, starting from 0.
  5279. @item pos
  5280. the position in the file of the input frame, NAN if unknown
  5281. @item t
  5282. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5283. @end table
  5284. The expression for @var{out_w} may depend on the value of @var{out_h},
  5285. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5286. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5287. evaluated after @var{out_w} and @var{out_h}.
  5288. The @var{x} and @var{y} parameters specify the expressions for the
  5289. position of the top-left corner of the output (non-cropped) area. They
  5290. are evaluated for each frame. If the evaluated value is not valid, it
  5291. is approximated to the nearest valid value.
  5292. The expression for @var{x} may depend on @var{y}, and the expression
  5293. for @var{y} may depend on @var{x}.
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Crop area with size 100x100 at position (12,34).
  5298. @example
  5299. crop=100:100:12:34
  5300. @end example
  5301. Using named options, the example above becomes:
  5302. @example
  5303. crop=w=100:h=100:x=12:y=34
  5304. @end example
  5305. @item
  5306. Crop the central input area with size 100x100:
  5307. @example
  5308. crop=100:100
  5309. @end example
  5310. @item
  5311. Crop the central input area with size 2/3 of the input video:
  5312. @example
  5313. crop=2/3*in_w:2/3*in_h
  5314. @end example
  5315. @item
  5316. Crop the input video central square:
  5317. @example
  5318. crop=out_w=in_h
  5319. crop=in_h
  5320. @end example
  5321. @item
  5322. Delimit the rectangle with the top-left corner placed at position
  5323. 100:100 and the right-bottom corner corresponding to the right-bottom
  5324. corner of the input image.
  5325. @example
  5326. crop=in_w-100:in_h-100:100:100
  5327. @end example
  5328. @item
  5329. Crop 10 pixels from the left and right borders, and 20 pixels from
  5330. the top and bottom borders
  5331. @example
  5332. crop=in_w-2*10:in_h-2*20
  5333. @end example
  5334. @item
  5335. Keep only the bottom right quarter of the input image:
  5336. @example
  5337. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5338. @end example
  5339. @item
  5340. Crop height for getting Greek harmony:
  5341. @example
  5342. crop=in_w:1/PHI*in_w
  5343. @end example
  5344. @item
  5345. Apply trembling effect:
  5346. @example
  5347. 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)
  5348. @end example
  5349. @item
  5350. Apply erratic camera effect depending on timestamp:
  5351. @example
  5352. 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)"
  5353. @end example
  5354. @item
  5355. Set x depending on the value of y:
  5356. @example
  5357. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5358. @end example
  5359. @end itemize
  5360. @subsection Commands
  5361. This filter supports the following commands:
  5362. @table @option
  5363. @item w, out_w
  5364. @item h, out_h
  5365. @item x
  5366. @item y
  5367. Set width/height of the output video and the horizontal/vertical position
  5368. in the input video.
  5369. The command accepts the same syntax of the corresponding option.
  5370. If the specified expression is not valid, it is kept at its current
  5371. value.
  5372. @end table
  5373. @section cropdetect
  5374. Auto-detect the crop size.
  5375. It calculates the necessary cropping parameters and prints the
  5376. recommended parameters via the logging system. The detected dimensions
  5377. correspond to the non-black area of the input video.
  5378. It accepts the following parameters:
  5379. @table @option
  5380. @item limit
  5381. Set higher black value threshold, which can be optionally specified
  5382. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5383. value greater to the set value is considered non-black. It defaults to 24.
  5384. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5385. on the bitdepth of the pixel format.
  5386. @item round
  5387. The value which the width/height should be divisible by. It defaults to
  5388. 16. The offset is automatically adjusted to center the video. Use 2 to
  5389. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5390. encoding to most video codecs.
  5391. @item reset_count, reset
  5392. Set the counter that determines after how many frames cropdetect will
  5393. reset the previously detected largest video area and start over to
  5394. detect the current optimal crop area. Default value is 0.
  5395. This can be useful when channel logos distort the video area. 0
  5396. indicates 'never reset', and returns the largest area encountered during
  5397. playback.
  5398. @end table
  5399. @anchor{curves}
  5400. @section curves
  5401. Apply color adjustments using curves.
  5402. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5403. component (red, green and blue) has its values defined by @var{N} key points
  5404. tied from each other using a smooth curve. The x-axis represents the pixel
  5405. values from the input frame, and the y-axis the new pixel values to be set for
  5406. the output frame.
  5407. By default, a component curve is defined by the two points @var{(0;0)} and
  5408. @var{(1;1)}. This creates a straight line where each original pixel value is
  5409. "adjusted" to its own value, which means no change to the image.
  5410. The filter allows you to redefine these two points and add some more. A new
  5411. curve (using a natural cubic spline interpolation) will be define to pass
  5412. smoothly through all these new coordinates. The new defined points needs to be
  5413. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5414. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5415. the vector spaces, the values will be clipped accordingly.
  5416. The filter accepts the following options:
  5417. @table @option
  5418. @item preset
  5419. Select one of the available color presets. This option can be used in addition
  5420. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5421. options takes priority on the preset values.
  5422. Available presets are:
  5423. @table @samp
  5424. @item none
  5425. @item color_negative
  5426. @item cross_process
  5427. @item darker
  5428. @item increase_contrast
  5429. @item lighter
  5430. @item linear_contrast
  5431. @item medium_contrast
  5432. @item negative
  5433. @item strong_contrast
  5434. @item vintage
  5435. @end table
  5436. Default is @code{none}.
  5437. @item master, m
  5438. Set the master key points. These points will define a second pass mapping. It
  5439. is sometimes called a "luminance" or "value" mapping. It can be used with
  5440. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5441. post-processing LUT.
  5442. @item red, r
  5443. Set the key points for the red component.
  5444. @item green, g
  5445. Set the key points for the green component.
  5446. @item blue, b
  5447. Set the key points for the blue component.
  5448. @item all
  5449. Set the key points for all components (not including master).
  5450. Can be used in addition to the other key points component
  5451. options. In this case, the unset component(s) will fallback on this
  5452. @option{all} setting.
  5453. @item psfile
  5454. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5455. @item plot
  5456. Save Gnuplot script of the curves in specified file.
  5457. @end table
  5458. To avoid some filtergraph syntax conflicts, each key points list need to be
  5459. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Increase slightly the middle level of blue:
  5464. @example
  5465. curves=blue='0/0 0.5/0.58 1/1'
  5466. @end example
  5467. @item
  5468. Vintage effect:
  5469. @example
  5470. 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'
  5471. @end example
  5472. Here we obtain the following coordinates for each components:
  5473. @table @var
  5474. @item red
  5475. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5476. @item green
  5477. @code{(0;0) (0.50;0.48) (1;1)}
  5478. @item blue
  5479. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5480. @end table
  5481. @item
  5482. The previous example can also be achieved with the associated built-in preset:
  5483. @example
  5484. curves=preset=vintage
  5485. @end example
  5486. @item
  5487. Or simply:
  5488. @example
  5489. curves=vintage
  5490. @end example
  5491. @item
  5492. Use a Photoshop preset and redefine the points of the green component:
  5493. @example
  5494. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5495. @end example
  5496. @item
  5497. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5498. and @command{gnuplot}:
  5499. @example
  5500. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5501. gnuplot -p /tmp/curves.plt
  5502. @end example
  5503. @end itemize
  5504. @section datascope
  5505. Video data analysis filter.
  5506. This filter shows hexadecimal pixel values of part of video.
  5507. The filter accepts the following options:
  5508. @table @option
  5509. @item size, s
  5510. Set output video size.
  5511. @item x
  5512. Set x offset from where to pick pixels.
  5513. @item y
  5514. Set y offset from where to pick pixels.
  5515. @item mode
  5516. Set scope mode, can be one of the following:
  5517. @table @samp
  5518. @item mono
  5519. Draw hexadecimal pixel values with white color on black background.
  5520. @item color
  5521. Draw hexadecimal pixel values with input video pixel color on black
  5522. background.
  5523. @item color2
  5524. Draw hexadecimal pixel values on color background picked from input video,
  5525. the text color is picked in such way so its always visible.
  5526. @end table
  5527. @item axis
  5528. Draw rows and columns numbers on left and top of video.
  5529. @item opacity
  5530. Set background opacity.
  5531. @end table
  5532. @section dctdnoiz
  5533. Denoise frames using 2D DCT (frequency domain filtering).
  5534. This filter is not designed for real time.
  5535. The filter accepts the following options:
  5536. @table @option
  5537. @item sigma, s
  5538. Set the noise sigma constant.
  5539. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5540. coefficient (absolute value) below this threshold with be dropped.
  5541. If you need a more advanced filtering, see @option{expr}.
  5542. Default is @code{0}.
  5543. @item overlap
  5544. Set number overlapping pixels for each block. Since the filter can be slow, you
  5545. may want to reduce this value, at the cost of a less effective filter and the
  5546. risk of various artefacts.
  5547. If the overlapping value doesn't permit processing the whole input width or
  5548. height, a warning will be displayed and according borders won't be denoised.
  5549. Default value is @var{blocksize}-1, which is the best possible setting.
  5550. @item expr, e
  5551. Set the coefficient factor expression.
  5552. For each coefficient of a DCT block, this expression will be evaluated as a
  5553. multiplier value for the coefficient.
  5554. If this is option is set, the @option{sigma} option will be ignored.
  5555. The absolute value of the coefficient can be accessed through the @var{c}
  5556. variable.
  5557. @item n
  5558. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5559. @var{blocksize}, which is the width and height of the processed blocks.
  5560. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5561. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5562. on the speed processing. Also, a larger block size does not necessarily means a
  5563. better de-noising.
  5564. @end table
  5565. @subsection Examples
  5566. Apply a denoise with a @option{sigma} of @code{4.5}:
  5567. @example
  5568. dctdnoiz=4.5
  5569. @end example
  5570. The same operation can be achieved using the expression system:
  5571. @example
  5572. dctdnoiz=e='gte(c, 4.5*3)'
  5573. @end example
  5574. Violent denoise using a block size of @code{16x16}:
  5575. @example
  5576. dctdnoiz=15:n=4
  5577. @end example
  5578. @section deband
  5579. Remove banding artifacts from input video.
  5580. It works by replacing banded pixels with average value of referenced pixels.
  5581. The filter accepts the following options:
  5582. @table @option
  5583. @item 1thr
  5584. @item 2thr
  5585. @item 3thr
  5586. @item 4thr
  5587. Set banding detection threshold for each plane. Default is 0.02.
  5588. Valid range is 0.00003 to 0.5.
  5589. If difference between current pixel and reference pixel is less than threshold,
  5590. it will be considered as banded.
  5591. @item range, r
  5592. Banding detection range in pixels. Default is 16. If positive, random number
  5593. in range 0 to set value will be used. If negative, exact absolute value
  5594. will be used.
  5595. The range defines square of four pixels around current pixel.
  5596. @item direction, d
  5597. Set direction in radians from which four pixel will be compared. If positive,
  5598. random direction from 0 to set direction will be picked. If negative, exact of
  5599. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5600. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5601. column.
  5602. @item blur, b
  5603. If enabled, current pixel is compared with average value of all four
  5604. surrounding pixels. The default is enabled. If disabled current pixel is
  5605. compared with all four surrounding pixels. The pixel is considered banded
  5606. if only all four differences with surrounding pixels are less than threshold.
  5607. @item coupling, c
  5608. If enabled, current pixel is changed if and only if all pixel components are banded,
  5609. e.g. banding detection threshold is triggered for all color components.
  5610. The default is disabled.
  5611. @end table
  5612. @section deblock
  5613. Remove blocking artifacts from input video.
  5614. The filter accepts the following options:
  5615. @table @option
  5616. @item filter
  5617. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5618. This controls what kind of deblocking is applied.
  5619. @item block
  5620. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5621. @item alpha
  5622. @item beta
  5623. @item gamma
  5624. @item delta
  5625. Set blocking detection thresholds. Allowed range is 0 to 1.
  5626. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5627. Using higher threshold gives more deblocking strength.
  5628. Setting @var{alpha} controls threshold detection at exact edge of block.
  5629. Remaining options controls threshold detection near the edge. Each one for
  5630. below/above or left/right. Setting any of those to @var{0} disables
  5631. deblocking.
  5632. @item planes
  5633. Set planes to filter. Default is to filter all available planes.
  5634. @end table
  5635. @subsection Examples
  5636. @itemize
  5637. @item
  5638. Deblock using weak filter and block size of 4 pixels.
  5639. @example
  5640. deblock=filter=weak:block=4
  5641. @end example
  5642. @item
  5643. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5644. deblocking more edges.
  5645. @example
  5646. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5647. @end example
  5648. @item
  5649. Similar as above, but filter only first plane.
  5650. @example
  5651. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5652. @end example
  5653. @item
  5654. Similar as above, but filter only second and third plane.
  5655. @example
  5656. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5657. @end example
  5658. @end itemize
  5659. @anchor{decimate}
  5660. @section decimate
  5661. Drop duplicated frames at regular intervals.
  5662. The filter accepts the following options:
  5663. @table @option
  5664. @item cycle
  5665. Set the number of frames from which one will be dropped. Setting this to
  5666. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5667. Default is @code{5}.
  5668. @item dupthresh
  5669. Set the threshold for duplicate detection. If the difference metric for a frame
  5670. is less than or equal to this value, then it is declared as duplicate. Default
  5671. is @code{1.1}
  5672. @item scthresh
  5673. Set scene change threshold. Default is @code{15}.
  5674. @item blockx
  5675. @item blocky
  5676. Set the size of the x and y-axis blocks used during metric calculations.
  5677. Larger blocks give better noise suppression, but also give worse detection of
  5678. small movements. Must be a power of two. Default is @code{32}.
  5679. @item ppsrc
  5680. Mark main input as a pre-processed input and activate clean source input
  5681. stream. This allows the input to be pre-processed with various filters to help
  5682. the metrics calculation while keeping the frame selection lossless. When set to
  5683. @code{1}, the first stream is for the pre-processed input, and the second
  5684. stream is the clean source from where the kept frames are chosen. Default is
  5685. @code{0}.
  5686. @item chroma
  5687. Set whether or not chroma is considered in the metric calculations. Default is
  5688. @code{1}.
  5689. @end table
  5690. @section deconvolve
  5691. Apply 2D deconvolution of video stream in frequency domain using second stream
  5692. as impulse.
  5693. The filter accepts the following options:
  5694. @table @option
  5695. @item planes
  5696. Set which planes to process.
  5697. @item impulse
  5698. Set which impulse video frames will be processed, can be @var{first}
  5699. or @var{all}. Default is @var{all}.
  5700. @item noise
  5701. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5702. and height are not same and not power of 2 or if stream prior to convolving
  5703. had noise.
  5704. @end table
  5705. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5706. @section deflate
  5707. Apply deflate effect to the video.
  5708. This filter replaces the pixel by the local(3x3) average by taking into account
  5709. only values lower than the pixel.
  5710. It accepts the following options:
  5711. @table @option
  5712. @item threshold0
  5713. @item threshold1
  5714. @item threshold2
  5715. @item threshold3
  5716. Limit the maximum change for each plane, default is 65535.
  5717. If 0, plane will remain unchanged.
  5718. @end table
  5719. @section deflicker
  5720. Remove temporal frame luminance variations.
  5721. It accepts the following options:
  5722. @table @option
  5723. @item size, s
  5724. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5725. @item mode, m
  5726. Set averaging mode to smooth temporal luminance variations.
  5727. Available values are:
  5728. @table @samp
  5729. @item am
  5730. Arithmetic mean
  5731. @item gm
  5732. Geometric mean
  5733. @item hm
  5734. Harmonic mean
  5735. @item qm
  5736. Quadratic mean
  5737. @item cm
  5738. Cubic mean
  5739. @item pm
  5740. Power mean
  5741. @item median
  5742. Median
  5743. @end table
  5744. @item bypass
  5745. Do not actually modify frame. Useful when one only wants metadata.
  5746. @end table
  5747. @section dejudder
  5748. Remove judder produced by partially interlaced telecined content.
  5749. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5750. source was partially telecined content then the output of @code{pullup,dejudder}
  5751. will have a variable frame rate. May change the recorded frame rate of the
  5752. container. Aside from that change, this filter will not affect constant frame
  5753. rate video.
  5754. The option available in this filter is:
  5755. @table @option
  5756. @item cycle
  5757. Specify the length of the window over which the judder repeats.
  5758. Accepts any integer greater than 1. Useful values are:
  5759. @table @samp
  5760. @item 4
  5761. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5762. @item 5
  5763. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5764. @item 20
  5765. If a mixture of the two.
  5766. @end table
  5767. The default is @samp{4}.
  5768. @end table
  5769. @section delogo
  5770. Suppress a TV station logo by a simple interpolation of the surrounding
  5771. pixels. Just set a rectangle covering the logo and watch it disappear
  5772. (and sometimes something even uglier appear - your mileage may vary).
  5773. It accepts the following parameters:
  5774. @table @option
  5775. @item x
  5776. @item y
  5777. Specify the top left corner coordinates of the logo. They must be
  5778. specified.
  5779. @item w
  5780. @item h
  5781. Specify the width and height of the logo to clear. They must be
  5782. specified.
  5783. @item band, t
  5784. Specify the thickness of the fuzzy edge of the rectangle (added to
  5785. @var{w} and @var{h}). The default value is 1. This option is
  5786. deprecated, setting higher values should no longer be necessary and
  5787. is not recommended.
  5788. @item show
  5789. When set to 1, a green rectangle is drawn on the screen to simplify
  5790. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5791. The default value is 0.
  5792. The rectangle is drawn on the outermost pixels which will be (partly)
  5793. replaced with interpolated values. The values of the next pixels
  5794. immediately outside this rectangle in each direction will be used to
  5795. compute the interpolated pixel values inside the rectangle.
  5796. @end table
  5797. @subsection Examples
  5798. @itemize
  5799. @item
  5800. Set a rectangle covering the area with top left corner coordinates 0,0
  5801. and size 100x77, and a band of size 10:
  5802. @example
  5803. delogo=x=0:y=0:w=100:h=77:band=10
  5804. @end example
  5805. @end itemize
  5806. @section deshake
  5807. Attempt to fix small changes in horizontal and/or vertical shift. This
  5808. filter helps remove camera shake from hand-holding a camera, bumping a
  5809. tripod, moving on a vehicle, etc.
  5810. The filter accepts the following options:
  5811. @table @option
  5812. @item x
  5813. @item y
  5814. @item w
  5815. @item h
  5816. Specify a rectangular area where to limit the search for motion
  5817. vectors.
  5818. If desired the search for motion vectors can be limited to a
  5819. rectangular area of the frame defined by its top left corner, width
  5820. and height. These parameters have the same meaning as the drawbox
  5821. filter which can be used to visualise the position of the bounding
  5822. box.
  5823. This is useful when simultaneous movement of subjects within the frame
  5824. might be confused for camera motion by the motion vector search.
  5825. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5826. then the full frame is used. This allows later options to be set
  5827. without specifying the bounding box for the motion vector search.
  5828. Default - search the whole frame.
  5829. @item rx
  5830. @item ry
  5831. Specify the maximum extent of movement in x and y directions in the
  5832. range 0-64 pixels. Default 16.
  5833. @item edge
  5834. Specify how to generate pixels to fill blanks at the edge of the
  5835. frame. Available values are:
  5836. @table @samp
  5837. @item blank, 0
  5838. Fill zeroes at blank locations
  5839. @item original, 1
  5840. Original image at blank locations
  5841. @item clamp, 2
  5842. Extruded edge value at blank locations
  5843. @item mirror, 3
  5844. Mirrored edge at blank locations
  5845. @end table
  5846. Default value is @samp{mirror}.
  5847. @item blocksize
  5848. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5849. default 8.
  5850. @item contrast
  5851. Specify the contrast threshold for blocks. Only blocks with more than
  5852. the specified contrast (difference between darkest and lightest
  5853. pixels) will be considered. Range 1-255, default 125.
  5854. @item search
  5855. Specify the search strategy. Available values are:
  5856. @table @samp
  5857. @item exhaustive, 0
  5858. Set exhaustive search
  5859. @item less, 1
  5860. Set less exhaustive search.
  5861. @end table
  5862. Default value is @samp{exhaustive}.
  5863. @item filename
  5864. If set then a detailed log of the motion search is written to the
  5865. specified file.
  5866. @end table
  5867. @section despill
  5868. Remove unwanted contamination of foreground colors, caused by reflected color of
  5869. greenscreen or bluescreen.
  5870. This filter accepts the following options:
  5871. @table @option
  5872. @item type
  5873. Set what type of despill to use.
  5874. @item mix
  5875. Set how spillmap will be generated.
  5876. @item expand
  5877. Set how much to get rid of still remaining spill.
  5878. @item red
  5879. Controls amount of red in spill area.
  5880. @item green
  5881. Controls amount of green in spill area.
  5882. Should be -1 for greenscreen.
  5883. @item blue
  5884. Controls amount of blue in spill area.
  5885. Should be -1 for bluescreen.
  5886. @item brightness
  5887. Controls brightness of spill area, preserving colors.
  5888. @item alpha
  5889. Modify alpha from generated spillmap.
  5890. @end table
  5891. @section detelecine
  5892. Apply an exact inverse of the telecine operation. It requires a predefined
  5893. pattern specified using the pattern option which must be the same as that passed
  5894. to the telecine filter.
  5895. This filter accepts the following options:
  5896. @table @option
  5897. @item first_field
  5898. @table @samp
  5899. @item top, t
  5900. top field first
  5901. @item bottom, b
  5902. bottom field first
  5903. The default value is @code{top}.
  5904. @end table
  5905. @item pattern
  5906. A string of numbers representing the pulldown pattern you wish to apply.
  5907. The default value is @code{23}.
  5908. @item start_frame
  5909. A number representing position of the first frame with respect to the telecine
  5910. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5911. @end table
  5912. @section dilation
  5913. Apply dilation effect to the video.
  5914. This filter replaces the pixel by the local(3x3) maximum.
  5915. It accepts the following options:
  5916. @table @option
  5917. @item threshold0
  5918. @item threshold1
  5919. @item threshold2
  5920. @item threshold3
  5921. Limit the maximum change for each plane, default is 65535.
  5922. If 0, plane will remain unchanged.
  5923. @item coordinates
  5924. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5925. pixels are used.
  5926. Flags to local 3x3 coordinates maps like this:
  5927. 1 2 3
  5928. 4 5
  5929. 6 7 8
  5930. @end table
  5931. @section displace
  5932. Displace pixels as indicated by second and third input stream.
  5933. It takes three input streams and outputs one stream, the first input is the
  5934. source, and second and third input are displacement maps.
  5935. The second input specifies how much to displace pixels along the
  5936. x-axis, while the third input specifies how much to displace pixels
  5937. along the y-axis.
  5938. If one of displacement map streams terminates, last frame from that
  5939. displacement map will be used.
  5940. Note that once generated, displacements maps can be reused over and over again.
  5941. A description of the accepted options follows.
  5942. @table @option
  5943. @item edge
  5944. Set displace behavior for pixels that are out of range.
  5945. Available values are:
  5946. @table @samp
  5947. @item blank
  5948. Missing pixels are replaced by black pixels.
  5949. @item smear
  5950. Adjacent pixels will spread out to replace missing pixels.
  5951. @item wrap
  5952. Out of range pixels are wrapped so they point to pixels of other side.
  5953. @item mirror
  5954. Out of range pixels will be replaced with mirrored pixels.
  5955. @end table
  5956. Default is @samp{smear}.
  5957. @end table
  5958. @subsection Examples
  5959. @itemize
  5960. @item
  5961. Add ripple effect to rgb input of video size hd720:
  5962. @example
  5963. 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
  5964. @end example
  5965. @item
  5966. Add wave effect to rgb input of video size hd720:
  5967. @example
  5968. 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
  5969. @end example
  5970. @end itemize
  5971. @section drawbox
  5972. Draw a colored box on the input image.
  5973. It accepts the following parameters:
  5974. @table @option
  5975. @item x
  5976. @item y
  5977. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5978. @item width, w
  5979. @item height, h
  5980. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5981. the input width and height. It defaults to 0.
  5982. @item color, c
  5983. Specify the color of the box to write. For the general syntax of this option,
  5984. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5985. value @code{invert} is used, the box edge color is the same as the
  5986. video with inverted luma.
  5987. @item thickness, t
  5988. The expression which sets the thickness of the box edge.
  5989. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5990. See below for the list of accepted constants.
  5991. @item replace
  5992. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5993. will overwrite the video's color and alpha pixels.
  5994. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5995. @end table
  5996. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5997. following constants:
  5998. @table @option
  5999. @item dar
  6000. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6001. @item hsub
  6002. @item vsub
  6003. horizontal and vertical chroma subsample values. For example for the
  6004. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6005. @item in_h, ih
  6006. @item in_w, iw
  6007. The input width and height.
  6008. @item sar
  6009. The input sample aspect ratio.
  6010. @item x
  6011. @item y
  6012. The x and y offset coordinates where the box is drawn.
  6013. @item w
  6014. @item h
  6015. The width and height of the drawn box.
  6016. @item t
  6017. The thickness of the drawn box.
  6018. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6019. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6020. @end table
  6021. @subsection Examples
  6022. @itemize
  6023. @item
  6024. Draw a black box around the edge of the input image:
  6025. @example
  6026. drawbox
  6027. @end example
  6028. @item
  6029. Draw a box with color red and an opacity of 50%:
  6030. @example
  6031. drawbox=10:20:200:60:red@@0.5
  6032. @end example
  6033. The previous example can be specified as:
  6034. @example
  6035. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6036. @end example
  6037. @item
  6038. Fill the box with pink color:
  6039. @example
  6040. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6041. @end example
  6042. @item
  6043. Draw a 2-pixel red 2.40:1 mask:
  6044. @example
  6045. 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
  6046. @end example
  6047. @end itemize
  6048. @section drawgrid
  6049. Draw a grid on the input image.
  6050. It accepts the following parameters:
  6051. @table @option
  6052. @item x
  6053. @item y
  6054. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6055. @item width, w
  6056. @item height, h
  6057. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6058. input width and height, respectively, minus @code{thickness}, so image gets
  6059. framed. Default to 0.
  6060. @item color, c
  6061. Specify the color of the grid. For the general syntax of this option,
  6062. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6063. value @code{invert} is used, the grid color is the same as the
  6064. video with inverted luma.
  6065. @item thickness, t
  6066. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6067. See below for the list of accepted constants.
  6068. @item replace
  6069. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6070. will overwrite the video's color and alpha pixels.
  6071. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6072. @end table
  6073. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6074. following constants:
  6075. @table @option
  6076. @item dar
  6077. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6078. @item hsub
  6079. @item vsub
  6080. horizontal and vertical chroma subsample values. For example for the
  6081. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6082. @item in_h, ih
  6083. @item in_w, iw
  6084. The input grid cell width and height.
  6085. @item sar
  6086. The input sample aspect ratio.
  6087. @item x
  6088. @item y
  6089. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6090. @item w
  6091. @item h
  6092. The width and height of the drawn cell.
  6093. @item t
  6094. The thickness of the drawn cell.
  6095. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6096. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6097. @end table
  6098. @subsection Examples
  6099. @itemize
  6100. @item
  6101. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6102. @example
  6103. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6104. @end example
  6105. @item
  6106. Draw a white 3x3 grid with an opacity of 50%:
  6107. @example
  6108. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6109. @end example
  6110. @end itemize
  6111. @anchor{drawtext}
  6112. @section drawtext
  6113. Draw a text string or text from a specified file on top of a video, using the
  6114. libfreetype library.
  6115. To enable compilation of this filter, you need to configure FFmpeg with
  6116. @code{--enable-libfreetype}.
  6117. To enable default font fallback and the @var{font} option you need to
  6118. configure FFmpeg with @code{--enable-libfontconfig}.
  6119. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6120. @code{--enable-libfribidi}.
  6121. @subsection Syntax
  6122. It accepts the following parameters:
  6123. @table @option
  6124. @item box
  6125. Used to draw a box around text using the background color.
  6126. The value must be either 1 (enable) or 0 (disable).
  6127. The default value of @var{box} is 0.
  6128. @item boxborderw
  6129. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6130. The default value of @var{boxborderw} is 0.
  6131. @item boxcolor
  6132. The color to be used for drawing box around text. For the syntax of this
  6133. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6134. The default value of @var{boxcolor} is "white".
  6135. @item line_spacing
  6136. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6137. The default value of @var{line_spacing} is 0.
  6138. @item borderw
  6139. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6140. The default value of @var{borderw} is 0.
  6141. @item bordercolor
  6142. Set the color to be used for drawing border around text. For the syntax of this
  6143. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6144. The default value of @var{bordercolor} is "black".
  6145. @item expansion
  6146. Select how the @var{text} is expanded. Can be either @code{none},
  6147. @code{strftime} (deprecated) or
  6148. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6149. below for details.
  6150. @item basetime
  6151. Set a start time for the count. Value is in microseconds. Only applied
  6152. in the deprecated strftime expansion mode. To emulate in normal expansion
  6153. mode use the @code{pts} function, supplying the start time (in seconds)
  6154. as the second argument.
  6155. @item fix_bounds
  6156. If true, check and fix text coords to avoid clipping.
  6157. @item fontcolor
  6158. The color to be used for drawing fonts. For the syntax of this option, check
  6159. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6160. The default value of @var{fontcolor} is "black".
  6161. @item fontcolor_expr
  6162. String which is expanded the same way as @var{text} to obtain dynamic
  6163. @var{fontcolor} value. By default this option has empty value and is not
  6164. processed. When this option is set, it overrides @var{fontcolor} option.
  6165. @item font
  6166. The font family to be used for drawing text. By default Sans.
  6167. @item fontfile
  6168. The font file to be used for drawing text. The path must be included.
  6169. This parameter is mandatory if the fontconfig support is disabled.
  6170. @item alpha
  6171. Draw the text applying alpha blending. The value can
  6172. be a number between 0.0 and 1.0.
  6173. The expression accepts the same variables @var{x, y} as well.
  6174. The default value is 1.
  6175. Please see @var{fontcolor_expr}.
  6176. @item fontsize
  6177. The font size to be used for drawing text.
  6178. The default value of @var{fontsize} is 16.
  6179. @item text_shaping
  6180. If set to 1, attempt to shape the text (for example, reverse the order of
  6181. right-to-left text and join Arabic characters) before drawing it.
  6182. Otherwise, just draw the text exactly as given.
  6183. By default 1 (if supported).
  6184. @item ft_load_flags
  6185. The flags to be used for loading the fonts.
  6186. The flags map the corresponding flags supported by libfreetype, and are
  6187. a combination of the following values:
  6188. @table @var
  6189. @item default
  6190. @item no_scale
  6191. @item no_hinting
  6192. @item render
  6193. @item no_bitmap
  6194. @item vertical_layout
  6195. @item force_autohint
  6196. @item crop_bitmap
  6197. @item pedantic
  6198. @item ignore_global_advance_width
  6199. @item no_recurse
  6200. @item ignore_transform
  6201. @item monochrome
  6202. @item linear_design
  6203. @item no_autohint
  6204. @end table
  6205. Default value is "default".
  6206. For more information consult the documentation for the FT_LOAD_*
  6207. libfreetype flags.
  6208. @item shadowcolor
  6209. The color to be used for drawing a shadow behind the drawn text. For the
  6210. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6211. ffmpeg-utils manual,ffmpeg-utils}.
  6212. The default value of @var{shadowcolor} is "black".
  6213. @item shadowx
  6214. @item shadowy
  6215. The x and y offsets for the text shadow position with respect to the
  6216. position of the text. They can be either positive or negative
  6217. values. The default value for both is "0".
  6218. @item start_number
  6219. The starting frame number for the n/frame_num variable. The default value
  6220. is "0".
  6221. @item tabsize
  6222. The size in number of spaces to use for rendering the tab.
  6223. Default value is 4.
  6224. @item timecode
  6225. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6226. format. It can be used with or without text parameter. @var{timecode_rate}
  6227. option must be specified.
  6228. @item timecode_rate, rate, r
  6229. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6230. integer. Minimum value is "1".
  6231. Drop-frame timecode is supported for frame rates 30 & 60.
  6232. @item tc24hmax
  6233. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6234. Default is 0 (disabled).
  6235. @item text
  6236. The text string to be drawn. The text must be a sequence of UTF-8
  6237. encoded characters.
  6238. This parameter is mandatory if no file is specified with the parameter
  6239. @var{textfile}.
  6240. @item textfile
  6241. A text file containing text to be drawn. The text must be a sequence
  6242. of UTF-8 encoded characters.
  6243. This parameter is mandatory if no text string is specified with the
  6244. parameter @var{text}.
  6245. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6246. @item reload
  6247. If set to 1, the @var{textfile} will be reloaded before each frame.
  6248. Be sure to update it atomically, or it may be read partially, or even fail.
  6249. @item x
  6250. @item y
  6251. The expressions which specify the offsets where text will be drawn
  6252. within the video frame. They are relative to the top/left border of the
  6253. output image.
  6254. The default value of @var{x} and @var{y} is "0".
  6255. See below for the list of accepted constants and functions.
  6256. @end table
  6257. The parameters for @var{x} and @var{y} are expressions containing the
  6258. following constants and functions:
  6259. @table @option
  6260. @item dar
  6261. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6262. @item hsub
  6263. @item vsub
  6264. horizontal and vertical chroma subsample values. For example for the
  6265. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6266. @item line_h, lh
  6267. the height of each text line
  6268. @item main_h, h, H
  6269. the input height
  6270. @item main_w, w, W
  6271. the input width
  6272. @item max_glyph_a, ascent
  6273. the maximum distance from the baseline to the highest/upper grid
  6274. coordinate used to place a glyph outline point, for all the rendered
  6275. glyphs.
  6276. It is a positive value, due to the grid's orientation with the Y axis
  6277. upwards.
  6278. @item max_glyph_d, descent
  6279. the maximum distance from the baseline to the lowest grid coordinate
  6280. used to place a glyph outline point, for all the rendered glyphs.
  6281. This is a negative value, due to the grid's orientation, with the Y axis
  6282. upwards.
  6283. @item max_glyph_h
  6284. maximum glyph height, that is the maximum height for all the glyphs
  6285. contained in the rendered text, it is equivalent to @var{ascent} -
  6286. @var{descent}.
  6287. @item max_glyph_w
  6288. maximum glyph width, that is the maximum width for all the glyphs
  6289. contained in the rendered text
  6290. @item n
  6291. the number of input frame, starting from 0
  6292. @item rand(min, max)
  6293. return a random number included between @var{min} and @var{max}
  6294. @item sar
  6295. The input sample aspect ratio.
  6296. @item t
  6297. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6298. @item text_h, th
  6299. the height of the rendered text
  6300. @item text_w, tw
  6301. the width of the rendered text
  6302. @item x
  6303. @item y
  6304. the x and y offset coordinates where the text is drawn.
  6305. These parameters allow the @var{x} and @var{y} expressions to refer
  6306. each other, so you can for example specify @code{y=x/dar}.
  6307. @end table
  6308. @anchor{drawtext_expansion}
  6309. @subsection Text expansion
  6310. If @option{expansion} is set to @code{strftime},
  6311. the filter recognizes strftime() sequences in the provided text and
  6312. expands them accordingly. Check the documentation of strftime(). This
  6313. feature is deprecated.
  6314. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6315. If @option{expansion} is set to @code{normal} (which is the default),
  6316. the following expansion mechanism is used.
  6317. The backslash character @samp{\}, followed by any character, always expands to
  6318. the second character.
  6319. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6320. braces is a function name, possibly followed by arguments separated by ':'.
  6321. If the arguments contain special characters or delimiters (':' or '@}'),
  6322. they should be escaped.
  6323. Note that they probably must also be escaped as the value for the
  6324. @option{text} option in the filter argument string and as the filter
  6325. argument in the filtergraph description, and possibly also for the shell,
  6326. that makes up to four levels of escaping; using a text file avoids these
  6327. problems.
  6328. The following functions are available:
  6329. @table @command
  6330. @item expr, e
  6331. The expression evaluation result.
  6332. It must take one argument specifying the expression to be evaluated,
  6333. which accepts the same constants and functions as the @var{x} and
  6334. @var{y} values. Note that not all constants should be used, for
  6335. example the text size is not known when evaluating the expression, so
  6336. the constants @var{text_w} and @var{text_h} will have an undefined
  6337. value.
  6338. @item expr_int_format, eif
  6339. Evaluate the expression's value and output as formatted integer.
  6340. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6341. The second argument specifies the output format. Allowed values are @samp{x},
  6342. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6343. @code{printf} function.
  6344. The third parameter is optional and sets the number of positions taken by the output.
  6345. It can be used to add padding with zeros from the left.
  6346. @item gmtime
  6347. The time at which the filter is running, expressed in UTC.
  6348. It can accept an argument: a strftime() format string.
  6349. @item localtime
  6350. The time at which the filter is running, expressed in the local time zone.
  6351. It can accept an argument: a strftime() format string.
  6352. @item metadata
  6353. Frame metadata. Takes one or two arguments.
  6354. The first argument is mandatory and specifies the metadata key.
  6355. The second argument is optional and specifies a default value, used when the
  6356. metadata key is not found or empty.
  6357. @item n, frame_num
  6358. The frame number, starting from 0.
  6359. @item pict_type
  6360. A 1 character description of the current picture type.
  6361. @item pts
  6362. The timestamp of the current frame.
  6363. It can take up to three arguments.
  6364. The first argument is the format of the timestamp; it defaults to @code{flt}
  6365. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6366. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6367. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6368. @code{localtime} stands for the timestamp of the frame formatted as
  6369. local time zone time.
  6370. The second argument is an offset added to the timestamp.
  6371. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6372. supplied to present the hour part of the formatted timestamp in 24h format
  6373. (00-23).
  6374. If the format is set to @code{localtime} or @code{gmtime},
  6375. a third argument may be supplied: a strftime() format string.
  6376. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6377. @end table
  6378. @subsection Examples
  6379. @itemize
  6380. @item
  6381. Draw "Test Text" with font FreeSerif, using the default values for the
  6382. optional parameters.
  6383. @example
  6384. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6385. @end example
  6386. @item
  6387. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6388. and y=50 (counting from the top-left corner of the screen), text is
  6389. yellow with a red box around it. Both the text and the box have an
  6390. opacity of 20%.
  6391. @example
  6392. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6393. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6394. @end example
  6395. Note that the double quotes are not necessary if spaces are not used
  6396. within the parameter list.
  6397. @item
  6398. Show the text at the center of the video frame:
  6399. @example
  6400. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6401. @end example
  6402. @item
  6403. Show the text at a random position, switching to a new position every 30 seconds:
  6404. @example
  6405. 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)"
  6406. @end example
  6407. @item
  6408. Show a text line sliding from right to left in the last row of the video
  6409. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6410. with no newlines.
  6411. @example
  6412. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6413. @end example
  6414. @item
  6415. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6416. @example
  6417. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6418. @end example
  6419. @item
  6420. Draw a single green letter "g", at the center of the input video.
  6421. The glyph baseline is placed at half screen height.
  6422. @example
  6423. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6424. @end example
  6425. @item
  6426. Show text for 1 second every 3 seconds:
  6427. @example
  6428. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6429. @end example
  6430. @item
  6431. Use fontconfig to set the font. Note that the colons need to be escaped.
  6432. @example
  6433. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6434. @end example
  6435. @item
  6436. Print the date of a real-time encoding (see strftime(3)):
  6437. @example
  6438. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6439. @end example
  6440. @item
  6441. Show text fading in and out (appearing/disappearing):
  6442. @example
  6443. #!/bin/sh
  6444. DS=1.0 # display start
  6445. DE=10.0 # display end
  6446. FID=1.5 # fade in duration
  6447. FOD=5 # fade out duration
  6448. 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 @}"
  6449. @end example
  6450. @item
  6451. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6452. and the @option{fontsize} value are included in the @option{y} offset.
  6453. @example
  6454. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6455. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6456. @end example
  6457. @end itemize
  6458. For more information about libfreetype, check:
  6459. @url{http://www.freetype.org/}.
  6460. For more information about fontconfig, check:
  6461. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6462. For more information about libfribidi, check:
  6463. @url{http://fribidi.org/}.
  6464. @section edgedetect
  6465. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6466. The filter accepts the following options:
  6467. @table @option
  6468. @item low
  6469. @item high
  6470. Set low and high threshold values used by the Canny thresholding
  6471. algorithm.
  6472. The high threshold selects the "strong" edge pixels, which are then
  6473. connected through 8-connectivity with the "weak" edge pixels selected
  6474. by the low threshold.
  6475. @var{low} and @var{high} threshold values must be chosen in the range
  6476. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6477. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6478. is @code{50/255}.
  6479. @item mode
  6480. Define the drawing mode.
  6481. @table @samp
  6482. @item wires
  6483. Draw white/gray wires on black background.
  6484. @item colormix
  6485. Mix the colors to create a paint/cartoon effect.
  6486. @item canny
  6487. Apply Canny edge detector on all selected planes.
  6488. @end table
  6489. Default value is @var{wires}.
  6490. @item planes
  6491. Select planes for filtering. By default all available planes are filtered.
  6492. @end table
  6493. @subsection Examples
  6494. @itemize
  6495. @item
  6496. Standard edge detection with custom values for the hysteresis thresholding:
  6497. @example
  6498. edgedetect=low=0.1:high=0.4
  6499. @end example
  6500. @item
  6501. Painting effect without thresholding:
  6502. @example
  6503. edgedetect=mode=colormix:high=0
  6504. @end example
  6505. @end itemize
  6506. @section eq
  6507. Set brightness, contrast, saturation and approximate gamma adjustment.
  6508. The filter accepts the following options:
  6509. @table @option
  6510. @item contrast
  6511. Set the contrast expression. The value must be a float value in range
  6512. @code{-2.0} to @code{2.0}. The default value is "1".
  6513. @item brightness
  6514. Set the brightness expression. The value must be a float value in
  6515. range @code{-1.0} to @code{1.0}. The default value is "0".
  6516. @item saturation
  6517. Set the saturation expression. The value must be a float in
  6518. range @code{0.0} to @code{3.0}. The default value is "1".
  6519. @item gamma
  6520. Set the gamma expression. The value must be a float in range
  6521. @code{0.1} to @code{10.0}. The default value is "1".
  6522. @item gamma_r
  6523. Set the gamma expression for red. The value must be a float in
  6524. range @code{0.1} to @code{10.0}. The default value is "1".
  6525. @item gamma_g
  6526. Set the gamma expression for green. The value must be a float in range
  6527. @code{0.1} to @code{10.0}. The default value is "1".
  6528. @item gamma_b
  6529. Set the gamma expression for blue. The value must be a float in range
  6530. @code{0.1} to @code{10.0}. The default value is "1".
  6531. @item gamma_weight
  6532. Set the gamma weight expression. It can be used to reduce the effect
  6533. of a high gamma value on bright image areas, e.g. keep them from
  6534. getting overamplified and just plain white. The value must be a float
  6535. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6536. gamma correction all the way down while @code{1.0} leaves it at its
  6537. full strength. Default is "1".
  6538. @item eval
  6539. Set when the expressions for brightness, contrast, saturation and
  6540. gamma expressions are evaluated.
  6541. It accepts the following values:
  6542. @table @samp
  6543. @item init
  6544. only evaluate expressions once during the filter initialization or
  6545. when a command is processed
  6546. @item frame
  6547. evaluate expressions for each incoming frame
  6548. @end table
  6549. Default value is @samp{init}.
  6550. @end table
  6551. The expressions accept the following parameters:
  6552. @table @option
  6553. @item n
  6554. frame count of the input frame starting from 0
  6555. @item pos
  6556. byte position of the corresponding packet in the input file, NAN if
  6557. unspecified
  6558. @item r
  6559. frame rate of the input video, NAN if the input frame rate is unknown
  6560. @item t
  6561. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6562. @end table
  6563. @subsection Commands
  6564. The filter supports the following commands:
  6565. @table @option
  6566. @item contrast
  6567. Set the contrast expression.
  6568. @item brightness
  6569. Set the brightness expression.
  6570. @item saturation
  6571. Set the saturation expression.
  6572. @item gamma
  6573. Set the gamma expression.
  6574. @item gamma_r
  6575. Set the gamma_r expression.
  6576. @item gamma_g
  6577. Set gamma_g expression.
  6578. @item gamma_b
  6579. Set gamma_b expression.
  6580. @item gamma_weight
  6581. Set gamma_weight expression.
  6582. The command accepts the same syntax of the corresponding option.
  6583. If the specified expression is not valid, it is kept at its current
  6584. value.
  6585. @end table
  6586. @section erosion
  6587. Apply erosion effect to the video.
  6588. This filter replaces the pixel by the local(3x3) minimum.
  6589. It accepts the following options:
  6590. @table @option
  6591. @item threshold0
  6592. @item threshold1
  6593. @item threshold2
  6594. @item threshold3
  6595. Limit the maximum change for each plane, default is 65535.
  6596. If 0, plane will remain unchanged.
  6597. @item coordinates
  6598. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6599. pixels are used.
  6600. Flags to local 3x3 coordinates maps like this:
  6601. 1 2 3
  6602. 4 5
  6603. 6 7 8
  6604. @end table
  6605. @section extractplanes
  6606. Extract color channel components from input video stream into
  6607. separate grayscale video streams.
  6608. The filter accepts the following option:
  6609. @table @option
  6610. @item planes
  6611. Set plane(s) to extract.
  6612. Available values for planes are:
  6613. @table @samp
  6614. @item y
  6615. @item u
  6616. @item v
  6617. @item a
  6618. @item r
  6619. @item g
  6620. @item b
  6621. @end table
  6622. Choosing planes not available in the input will result in an error.
  6623. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6624. with @code{y}, @code{u}, @code{v} planes at same time.
  6625. @end table
  6626. @subsection Examples
  6627. @itemize
  6628. @item
  6629. Extract luma, u and v color channel component from input video frame
  6630. into 3 grayscale outputs:
  6631. @example
  6632. 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
  6633. @end example
  6634. @end itemize
  6635. @section elbg
  6636. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6637. For each input image, the filter will compute the optimal mapping from
  6638. the input to the output given the codebook length, that is the number
  6639. of distinct output colors.
  6640. This filter accepts the following options.
  6641. @table @option
  6642. @item codebook_length, l
  6643. Set codebook length. The value must be a positive integer, and
  6644. represents the number of distinct output colors. Default value is 256.
  6645. @item nb_steps, n
  6646. Set the maximum number of iterations to apply for computing the optimal
  6647. mapping. The higher the value the better the result and the higher the
  6648. computation time. Default value is 1.
  6649. @item seed, s
  6650. Set a random seed, must be an integer included between 0 and
  6651. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6652. will try to use a good random seed on a best effort basis.
  6653. @item pal8
  6654. Set pal8 output pixel format. This option does not work with codebook
  6655. length greater than 256.
  6656. @end table
  6657. @section entropy
  6658. Measure graylevel entropy in histogram of color channels of video frames.
  6659. It accepts the following parameters:
  6660. @table @option
  6661. @item mode
  6662. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6663. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6664. between neighbour histogram values.
  6665. @end table
  6666. @section fade
  6667. Apply a fade-in/out effect to the input video.
  6668. It accepts the following parameters:
  6669. @table @option
  6670. @item type, t
  6671. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6672. effect.
  6673. Default is @code{in}.
  6674. @item start_frame, s
  6675. Specify the number of the frame to start applying the fade
  6676. effect at. Default is 0.
  6677. @item nb_frames, n
  6678. The number of frames that the fade effect lasts. At the end of the
  6679. fade-in effect, the output video will have the same intensity as the input video.
  6680. At the end of the fade-out transition, the output video will be filled with the
  6681. selected @option{color}.
  6682. Default is 25.
  6683. @item alpha
  6684. If set to 1, fade only alpha channel, if one exists on the input.
  6685. Default value is 0.
  6686. @item start_time, st
  6687. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6688. effect. If both start_frame and start_time are specified, the fade will start at
  6689. whichever comes last. Default is 0.
  6690. @item duration, d
  6691. The number of seconds for which the fade effect has to last. At the end of the
  6692. fade-in effect the output video will have the same intensity as the input video,
  6693. at the end of the fade-out transition the output video will be filled with the
  6694. selected @option{color}.
  6695. If both duration and nb_frames are specified, duration is used. Default is 0
  6696. (nb_frames is used by default).
  6697. @item color, c
  6698. Specify the color of the fade. Default is "black".
  6699. @end table
  6700. @subsection Examples
  6701. @itemize
  6702. @item
  6703. Fade in the first 30 frames of video:
  6704. @example
  6705. fade=in:0:30
  6706. @end example
  6707. The command above is equivalent to:
  6708. @example
  6709. fade=t=in:s=0:n=30
  6710. @end example
  6711. @item
  6712. Fade out the last 45 frames of a 200-frame video:
  6713. @example
  6714. fade=out:155:45
  6715. fade=type=out:start_frame=155:nb_frames=45
  6716. @end example
  6717. @item
  6718. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6719. @example
  6720. fade=in:0:25, fade=out:975:25
  6721. @end example
  6722. @item
  6723. Make the first 5 frames yellow, then fade in from frame 5-24:
  6724. @example
  6725. fade=in:5:20:color=yellow
  6726. @end example
  6727. @item
  6728. Fade in alpha over first 25 frames of video:
  6729. @example
  6730. fade=in:0:25:alpha=1
  6731. @end example
  6732. @item
  6733. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6734. @example
  6735. fade=t=in:st=5.5:d=0.5
  6736. @end example
  6737. @end itemize
  6738. @section fftfilt
  6739. Apply arbitrary expressions to samples in frequency domain
  6740. @table @option
  6741. @item dc_Y
  6742. Adjust the dc value (gain) of the luma plane of the image. The filter
  6743. accepts an integer value in range @code{0} to @code{1000}. The default
  6744. value is set to @code{0}.
  6745. @item dc_U
  6746. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6747. filter accepts an integer value in range @code{0} to @code{1000}. The
  6748. default value is set to @code{0}.
  6749. @item dc_V
  6750. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6751. filter accepts an integer value in range @code{0} to @code{1000}. The
  6752. default value is set to @code{0}.
  6753. @item weight_Y
  6754. Set the frequency domain weight expression for the luma plane.
  6755. @item weight_U
  6756. Set the frequency domain weight expression for the 1st chroma plane.
  6757. @item weight_V
  6758. Set the frequency domain weight expression for the 2nd chroma plane.
  6759. @item eval
  6760. Set when the expressions are evaluated.
  6761. It accepts the following values:
  6762. @table @samp
  6763. @item init
  6764. Only evaluate expressions once during the filter initialization.
  6765. @item frame
  6766. Evaluate expressions for each incoming frame.
  6767. @end table
  6768. Default value is @samp{init}.
  6769. The filter accepts the following variables:
  6770. @item X
  6771. @item Y
  6772. The coordinates of the current sample.
  6773. @item W
  6774. @item H
  6775. The width and height of the image.
  6776. @item N
  6777. The number of input frame, starting from 0.
  6778. @end table
  6779. @subsection Examples
  6780. @itemize
  6781. @item
  6782. High-pass:
  6783. @example
  6784. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6785. @end example
  6786. @item
  6787. Low-pass:
  6788. @example
  6789. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6790. @end example
  6791. @item
  6792. Sharpen:
  6793. @example
  6794. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6795. @end example
  6796. @item
  6797. Blur:
  6798. @example
  6799. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6800. @end example
  6801. @end itemize
  6802. @section fftdnoiz
  6803. Denoise frames using 3D FFT (frequency domain filtering).
  6804. The filter accepts the following options:
  6805. @table @option
  6806. @item sigma
  6807. Set the noise sigma constant. This sets denoising strength.
  6808. Default value is 1. Allowed range is from 0 to 30.
  6809. Using very high sigma with low overlap may give blocking artifacts.
  6810. @item amount
  6811. Set amount of denoising. By default all detected noise is reduced.
  6812. Default value is 1. Allowed range is from 0 to 1.
  6813. @item block
  6814. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6815. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6816. block size in pixels is 2^4 which is 16.
  6817. @item overlap
  6818. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6819. @item prev
  6820. Set number of previous frames to use for denoising. By default is set to 0.
  6821. @item next
  6822. Set number of next frames to to use for denoising. By default is set to 0.
  6823. @item planes
  6824. Set planes which will be filtered, by default are all available filtered
  6825. except alpha.
  6826. @end table
  6827. @section field
  6828. Extract a single field from an interlaced image using stride
  6829. arithmetic to avoid wasting CPU time. The output frames are marked as
  6830. non-interlaced.
  6831. The filter accepts the following options:
  6832. @table @option
  6833. @item type
  6834. Specify whether to extract the top (if the value is @code{0} or
  6835. @code{top}) or the bottom field (if the value is @code{1} or
  6836. @code{bottom}).
  6837. @end table
  6838. @section fieldhint
  6839. Create new frames by copying the top and bottom fields from surrounding frames
  6840. supplied as numbers by the hint file.
  6841. @table @option
  6842. @item hint
  6843. Set file containing hints: absolute/relative frame numbers.
  6844. There must be one line for each frame in a clip. Each line must contain two
  6845. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6846. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6847. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6848. for @code{relative} mode. First number tells from which frame to pick up top
  6849. field and second number tells from which frame to pick up bottom field.
  6850. If optionally followed by @code{+} output frame will be marked as interlaced,
  6851. else if followed by @code{-} output frame will be marked as progressive, else
  6852. it will be marked same as input frame.
  6853. If line starts with @code{#} or @code{;} that line is skipped.
  6854. @item mode
  6855. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6856. @end table
  6857. Example of first several lines of @code{hint} file for @code{relative} mode:
  6858. @example
  6859. 0,0 - # first frame
  6860. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6861. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6862. 1,0 -
  6863. 0,0 -
  6864. 0,0 -
  6865. 1,0 -
  6866. 1,0 -
  6867. 1,0 -
  6868. 0,0 -
  6869. 0,0 -
  6870. 1,0 -
  6871. 1,0 -
  6872. 1,0 -
  6873. 0,0 -
  6874. @end example
  6875. @section fieldmatch
  6876. Field matching filter for inverse telecine. It is meant to reconstruct the
  6877. progressive frames from a telecined stream. The filter does not drop duplicated
  6878. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6879. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6880. The separation of the field matching and the decimation is notably motivated by
  6881. the possibility of inserting a de-interlacing filter fallback between the two.
  6882. If the source has mixed telecined and real interlaced content,
  6883. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6884. But these remaining combed frames will be marked as interlaced, and thus can be
  6885. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6886. In addition to the various configuration options, @code{fieldmatch} can take an
  6887. optional second stream, activated through the @option{ppsrc} option. If
  6888. enabled, the frames reconstruction will be based on the fields and frames from
  6889. this second stream. This allows the first input to be pre-processed in order to
  6890. help the various algorithms of the filter, while keeping the output lossless
  6891. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6892. or brightness/contrast adjustments can help.
  6893. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6894. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6895. which @code{fieldmatch} is based on. While the semantic and usage are very
  6896. close, some behaviour and options names can differ.
  6897. The @ref{decimate} filter currently only works for constant frame rate input.
  6898. If your input has mixed telecined (30fps) and progressive content with a lower
  6899. framerate like 24fps use the following filterchain to produce the necessary cfr
  6900. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6901. The filter accepts the following options:
  6902. @table @option
  6903. @item order
  6904. Specify the assumed field order of the input stream. Available values are:
  6905. @table @samp
  6906. @item auto
  6907. Auto detect parity (use FFmpeg's internal parity value).
  6908. @item bff
  6909. Assume bottom field first.
  6910. @item tff
  6911. Assume top field first.
  6912. @end table
  6913. Note that it is sometimes recommended not to trust the parity announced by the
  6914. stream.
  6915. Default value is @var{auto}.
  6916. @item mode
  6917. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6918. sense that it won't risk creating jerkiness due to duplicate frames when
  6919. possible, but if there are bad edits or blended fields it will end up
  6920. outputting combed frames when a good match might actually exist. On the other
  6921. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6922. but will almost always find a good frame if there is one. The other values are
  6923. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6924. jerkiness and creating duplicate frames versus finding good matches in sections
  6925. with bad edits, orphaned fields, blended fields, etc.
  6926. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6927. Available values are:
  6928. @table @samp
  6929. @item pc
  6930. 2-way matching (p/c)
  6931. @item pc_n
  6932. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6933. @item pc_u
  6934. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6935. @item pc_n_ub
  6936. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6937. still combed (p/c + n + u/b)
  6938. @item pcn
  6939. 3-way matching (p/c/n)
  6940. @item pcn_ub
  6941. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6942. detected as combed (p/c/n + u/b)
  6943. @end table
  6944. The parenthesis at the end indicate the matches that would be used for that
  6945. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6946. @var{top}).
  6947. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6948. the slowest.
  6949. Default value is @var{pc_n}.
  6950. @item ppsrc
  6951. Mark the main input stream as a pre-processed input, and enable the secondary
  6952. input stream as the clean source to pick the fields from. See the filter
  6953. introduction for more details. It is similar to the @option{clip2} feature from
  6954. VFM/TFM.
  6955. Default value is @code{0} (disabled).
  6956. @item field
  6957. Set the field to match from. It is recommended to set this to the same value as
  6958. @option{order} unless you experience matching failures with that setting. In
  6959. certain circumstances changing the field that is used to match from can have a
  6960. large impact on matching performance. Available values are:
  6961. @table @samp
  6962. @item auto
  6963. Automatic (same value as @option{order}).
  6964. @item bottom
  6965. Match from the bottom field.
  6966. @item top
  6967. Match from the top field.
  6968. @end table
  6969. Default value is @var{auto}.
  6970. @item mchroma
  6971. Set whether or not chroma is included during the match comparisons. In most
  6972. cases it is recommended to leave this enabled. You should set this to @code{0}
  6973. only if your clip has bad chroma problems such as heavy rainbowing or other
  6974. artifacts. Setting this to @code{0} could also be used to speed things up at
  6975. the cost of some accuracy.
  6976. Default value is @code{1}.
  6977. @item y0
  6978. @item y1
  6979. These define an exclusion band which excludes the lines between @option{y0} and
  6980. @option{y1} from being included in the field matching decision. An exclusion
  6981. band can be used to ignore subtitles, a logo, or other things that may
  6982. interfere with the matching. @option{y0} sets the starting scan line and
  6983. @option{y1} sets the ending line; all lines in between @option{y0} and
  6984. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6985. @option{y0} and @option{y1} to the same value will disable the feature.
  6986. @option{y0} and @option{y1} defaults to @code{0}.
  6987. @item scthresh
  6988. Set the scene change detection threshold as a percentage of maximum change on
  6989. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6990. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6991. @option{scthresh} is @code{[0.0, 100.0]}.
  6992. Default value is @code{12.0}.
  6993. @item combmatch
  6994. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6995. account the combed scores of matches when deciding what match to use as the
  6996. final match. Available values are:
  6997. @table @samp
  6998. @item none
  6999. No final matching based on combed scores.
  7000. @item sc
  7001. Combed scores are only used when a scene change is detected.
  7002. @item full
  7003. Use combed scores all the time.
  7004. @end table
  7005. Default is @var{sc}.
  7006. @item combdbg
  7007. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7008. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7009. Available values are:
  7010. @table @samp
  7011. @item none
  7012. No forced calculation.
  7013. @item pcn
  7014. Force p/c/n calculations.
  7015. @item pcnub
  7016. Force p/c/n/u/b calculations.
  7017. @end table
  7018. Default value is @var{none}.
  7019. @item cthresh
  7020. This is the area combing threshold used for combed frame detection. This
  7021. essentially controls how "strong" or "visible" combing must be to be detected.
  7022. Larger values mean combing must be more visible and smaller values mean combing
  7023. can be less visible or strong and still be detected. Valid settings are from
  7024. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7025. be detected as combed). This is basically a pixel difference value. A good
  7026. range is @code{[8, 12]}.
  7027. Default value is @code{9}.
  7028. @item chroma
  7029. Sets whether or not chroma is considered in the combed frame decision. Only
  7030. disable this if your source has chroma problems (rainbowing, etc.) that are
  7031. causing problems for the combed frame detection with chroma enabled. Actually,
  7032. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7033. where there is chroma only combing in the source.
  7034. Default value is @code{0}.
  7035. @item blockx
  7036. @item blocky
  7037. Respectively set the x-axis and y-axis size of the window used during combed
  7038. frame detection. This has to do with the size of the area in which
  7039. @option{combpel} pixels are required to be detected as combed for a frame to be
  7040. declared combed. See the @option{combpel} parameter description for more info.
  7041. Possible values are any number that is a power of 2 starting at 4 and going up
  7042. to 512.
  7043. Default value is @code{16}.
  7044. @item combpel
  7045. The number of combed pixels inside any of the @option{blocky} by
  7046. @option{blockx} size blocks on the frame for the frame to be detected as
  7047. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7048. setting controls "how much" combing there must be in any localized area (a
  7049. window defined by the @option{blockx} and @option{blocky} settings) on the
  7050. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7051. which point no frames will ever be detected as combed). This setting is known
  7052. as @option{MI} in TFM/VFM vocabulary.
  7053. Default value is @code{80}.
  7054. @end table
  7055. @anchor{p/c/n/u/b meaning}
  7056. @subsection p/c/n/u/b meaning
  7057. @subsubsection p/c/n
  7058. We assume the following telecined stream:
  7059. @example
  7060. Top fields: 1 2 2 3 4
  7061. Bottom fields: 1 2 3 4 4
  7062. @end example
  7063. The numbers correspond to the progressive frame the fields relate to. Here, the
  7064. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7065. When @code{fieldmatch} is configured to run a matching from bottom
  7066. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7067. @example
  7068. Input stream:
  7069. T 1 2 2 3 4
  7070. B 1 2 3 4 4 <-- matching reference
  7071. Matches: c c n n c
  7072. Output stream:
  7073. T 1 2 3 4 4
  7074. B 1 2 3 4 4
  7075. @end example
  7076. As a result of the field matching, we can see that some frames get duplicated.
  7077. To perform a complete inverse telecine, you need to rely on a decimation filter
  7078. after this operation. See for instance the @ref{decimate} filter.
  7079. The same operation now matching from top fields (@option{field}=@var{top})
  7080. looks like this:
  7081. @example
  7082. Input stream:
  7083. T 1 2 2 3 4 <-- matching reference
  7084. B 1 2 3 4 4
  7085. Matches: c c p p c
  7086. Output stream:
  7087. T 1 2 2 3 4
  7088. B 1 2 2 3 4
  7089. @end example
  7090. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7091. basically, they refer to the frame and field of the opposite parity:
  7092. @itemize
  7093. @item @var{p} matches the field of the opposite parity in the previous frame
  7094. @item @var{c} matches the field of the opposite parity in the current frame
  7095. @item @var{n} matches the field of the opposite parity in the next frame
  7096. @end itemize
  7097. @subsubsection u/b
  7098. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7099. from the opposite parity flag. In the following examples, we assume that we are
  7100. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7101. 'x' is placed above and below each matched fields.
  7102. With bottom matching (@option{field}=@var{bottom}):
  7103. @example
  7104. Match: c p n b u
  7105. x x x x x
  7106. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7107. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7108. x x x x x
  7109. Output frames:
  7110. 2 1 2 2 2
  7111. 2 2 2 1 3
  7112. @end example
  7113. With top matching (@option{field}=@var{top}):
  7114. @example
  7115. Match: c p n b u
  7116. x x x x x
  7117. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7118. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7119. x x x x x
  7120. Output frames:
  7121. 2 2 2 1 2
  7122. 2 1 3 2 2
  7123. @end example
  7124. @subsection Examples
  7125. Simple IVTC of a top field first telecined stream:
  7126. @example
  7127. fieldmatch=order=tff:combmatch=none, decimate
  7128. @end example
  7129. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7130. @example
  7131. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7132. @end example
  7133. @section fieldorder
  7134. Transform the field order of the input video.
  7135. It accepts the following parameters:
  7136. @table @option
  7137. @item order
  7138. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7139. for bottom field first.
  7140. @end table
  7141. The default value is @samp{tff}.
  7142. The transformation is done by shifting the picture content up or down
  7143. by one line, and filling the remaining line with appropriate picture content.
  7144. This method is consistent with most broadcast field order converters.
  7145. If the input video is not flagged as being interlaced, or it is already
  7146. flagged as being of the required output field order, then this filter does
  7147. not alter the incoming video.
  7148. It is very useful when converting to or from PAL DV material,
  7149. which is bottom field first.
  7150. For example:
  7151. @example
  7152. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7153. @end example
  7154. @section fifo, afifo
  7155. Buffer input images and send them when they are requested.
  7156. It is mainly useful when auto-inserted by the libavfilter
  7157. framework.
  7158. It does not take parameters.
  7159. @section fillborders
  7160. Fill borders of the input video, without changing video stream dimensions.
  7161. Sometimes video can have garbage at the four edges and you may not want to
  7162. crop video input to keep size multiple of some number.
  7163. This filter accepts the following options:
  7164. @table @option
  7165. @item left
  7166. Number of pixels to fill from left border.
  7167. @item right
  7168. Number of pixels to fill from right border.
  7169. @item top
  7170. Number of pixels to fill from top border.
  7171. @item bottom
  7172. Number of pixels to fill from bottom border.
  7173. @item mode
  7174. Set fill mode.
  7175. It accepts the following values:
  7176. @table @samp
  7177. @item smear
  7178. fill pixels using outermost pixels
  7179. @item mirror
  7180. fill pixels using mirroring
  7181. @item fixed
  7182. fill pixels with constant value
  7183. @end table
  7184. Default is @var{smear}.
  7185. @item color
  7186. Set color for pixels in fixed mode. Default is @var{black}.
  7187. @end table
  7188. @section find_rect
  7189. Find a rectangular object
  7190. It accepts the following options:
  7191. @table @option
  7192. @item object
  7193. Filepath of the object image, needs to be in gray8.
  7194. @item threshold
  7195. Detection threshold, default is 0.5.
  7196. @item mipmaps
  7197. Number of mipmaps, default is 3.
  7198. @item xmin, ymin, xmax, ymax
  7199. Specifies the rectangle in which to search.
  7200. @end table
  7201. @subsection Examples
  7202. @itemize
  7203. @item
  7204. Generate a representative palette of a given video using @command{ffmpeg}:
  7205. @example
  7206. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7207. @end example
  7208. @end itemize
  7209. @section cover_rect
  7210. Cover a rectangular object
  7211. It accepts the following options:
  7212. @table @option
  7213. @item cover
  7214. Filepath of the optional cover image, needs to be in yuv420.
  7215. @item mode
  7216. Set covering mode.
  7217. It accepts the following values:
  7218. @table @samp
  7219. @item cover
  7220. cover it by the supplied image
  7221. @item blur
  7222. cover it by interpolating the surrounding pixels
  7223. @end table
  7224. Default value is @var{blur}.
  7225. @end table
  7226. @subsection Examples
  7227. @itemize
  7228. @item
  7229. Generate a representative palette of a given video using @command{ffmpeg}:
  7230. @example
  7231. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7232. @end example
  7233. @end itemize
  7234. @section floodfill
  7235. Flood area with values of same pixel components with another values.
  7236. It accepts the following options:
  7237. @table @option
  7238. @item x
  7239. Set pixel x coordinate.
  7240. @item y
  7241. Set pixel y coordinate.
  7242. @item s0
  7243. Set source #0 component value.
  7244. @item s1
  7245. Set source #1 component value.
  7246. @item s2
  7247. Set source #2 component value.
  7248. @item s3
  7249. Set source #3 component value.
  7250. @item d0
  7251. Set destination #0 component value.
  7252. @item d1
  7253. Set destination #1 component value.
  7254. @item d2
  7255. Set destination #2 component value.
  7256. @item d3
  7257. Set destination #3 component value.
  7258. @end table
  7259. @anchor{format}
  7260. @section format
  7261. Convert the input video to one of the specified pixel formats.
  7262. Libavfilter will try to pick one that is suitable as input to
  7263. the next filter.
  7264. It accepts the following parameters:
  7265. @table @option
  7266. @item pix_fmts
  7267. A '|'-separated list of pixel format names, such as
  7268. "pix_fmts=yuv420p|monow|rgb24".
  7269. @end table
  7270. @subsection Examples
  7271. @itemize
  7272. @item
  7273. Convert the input video to the @var{yuv420p} format
  7274. @example
  7275. format=pix_fmts=yuv420p
  7276. @end example
  7277. Convert the input video to any of the formats in the list
  7278. @example
  7279. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7280. @end example
  7281. @end itemize
  7282. @anchor{fps}
  7283. @section fps
  7284. Convert the video to specified constant frame rate by duplicating or dropping
  7285. frames as necessary.
  7286. It accepts the following parameters:
  7287. @table @option
  7288. @item fps
  7289. The desired output frame rate. The default is @code{25}.
  7290. @item start_time
  7291. Assume the first PTS should be the given value, in seconds. This allows for
  7292. padding/trimming at the start of stream. By default, no assumption is made
  7293. about the first frame's expected PTS, so no padding or trimming is done.
  7294. For example, this could be set to 0 to pad the beginning with duplicates of
  7295. the first frame if a video stream starts after the audio stream or to trim any
  7296. frames with a negative PTS.
  7297. @item round
  7298. Timestamp (PTS) rounding method.
  7299. Possible values are:
  7300. @table @option
  7301. @item zero
  7302. round towards 0
  7303. @item inf
  7304. round away from 0
  7305. @item down
  7306. round towards -infinity
  7307. @item up
  7308. round towards +infinity
  7309. @item near
  7310. round to nearest
  7311. @end table
  7312. The default is @code{near}.
  7313. @item eof_action
  7314. Action performed when reading the last frame.
  7315. Possible values are:
  7316. @table @option
  7317. @item round
  7318. Use same timestamp rounding method as used for other frames.
  7319. @item pass
  7320. Pass through last frame if input duration has not been reached yet.
  7321. @end table
  7322. The default is @code{round}.
  7323. @end table
  7324. Alternatively, the options can be specified as a flat string:
  7325. @var{fps}[:@var{start_time}[:@var{round}]].
  7326. See also the @ref{setpts} filter.
  7327. @subsection Examples
  7328. @itemize
  7329. @item
  7330. A typical usage in order to set the fps to 25:
  7331. @example
  7332. fps=fps=25
  7333. @end example
  7334. @item
  7335. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7336. @example
  7337. fps=fps=film:round=near
  7338. @end example
  7339. @end itemize
  7340. @section framepack
  7341. Pack two different video streams into a stereoscopic video, setting proper
  7342. metadata on supported codecs. The two views should have the same size and
  7343. framerate and processing will stop when the shorter video ends. Please note
  7344. that you may conveniently adjust view properties with the @ref{scale} and
  7345. @ref{fps} filters.
  7346. It accepts the following parameters:
  7347. @table @option
  7348. @item format
  7349. The desired packing format. Supported values are:
  7350. @table @option
  7351. @item sbs
  7352. The views are next to each other (default).
  7353. @item tab
  7354. The views are on top of each other.
  7355. @item lines
  7356. The views are packed by line.
  7357. @item columns
  7358. The views are packed by column.
  7359. @item frameseq
  7360. The views are temporally interleaved.
  7361. @end table
  7362. @end table
  7363. Some examples:
  7364. @example
  7365. # Convert left and right views into a frame-sequential video
  7366. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7367. # Convert views into a side-by-side video with the same output resolution as the input
  7368. 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
  7369. @end example
  7370. @section framerate
  7371. Change the frame rate by interpolating new video output frames from the source
  7372. frames.
  7373. This filter is not designed to function correctly with interlaced media. If
  7374. you wish to change the frame rate of interlaced media then you are required
  7375. to deinterlace before this filter and re-interlace after this filter.
  7376. A description of the accepted options follows.
  7377. @table @option
  7378. @item fps
  7379. Specify the output frames per second. This option can also be specified
  7380. as a value alone. The default is @code{50}.
  7381. @item interp_start
  7382. Specify the start of a range where the output frame will be created as a
  7383. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7384. the default is @code{15}.
  7385. @item interp_end
  7386. Specify the end of a range where the output frame will be created as a
  7387. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7388. the default is @code{240}.
  7389. @item scene
  7390. Specify the level at which a scene change is detected as a value between
  7391. 0 and 100 to indicate a new scene; a low value reflects a low
  7392. probability for the current frame to introduce a new scene, while a higher
  7393. value means the current frame is more likely to be one.
  7394. The default is @code{8.2}.
  7395. @item flags
  7396. Specify flags influencing the filter process.
  7397. Available value for @var{flags} is:
  7398. @table @option
  7399. @item scene_change_detect, scd
  7400. Enable scene change detection using the value of the option @var{scene}.
  7401. This flag is enabled by default.
  7402. @end table
  7403. @end table
  7404. @section framestep
  7405. Select one frame every N-th frame.
  7406. This filter accepts the following option:
  7407. @table @option
  7408. @item step
  7409. Select frame after every @code{step} frames.
  7410. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7411. @end table
  7412. @anchor{frei0r}
  7413. @section frei0r
  7414. Apply a frei0r effect to the input video.
  7415. To enable the compilation of this filter, you need to install the frei0r
  7416. header and configure FFmpeg with @code{--enable-frei0r}.
  7417. It accepts the following parameters:
  7418. @table @option
  7419. @item filter_name
  7420. The name of the frei0r effect to load. If the environment variable
  7421. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7422. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7423. Otherwise, the standard frei0r paths are searched, in this order:
  7424. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7425. @file{/usr/lib/frei0r-1/}.
  7426. @item filter_params
  7427. A '|'-separated list of parameters to pass to the frei0r effect.
  7428. @end table
  7429. A frei0r effect parameter can be a boolean (its value is either
  7430. "y" or "n"), a double, a color (specified as
  7431. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7432. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7433. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7434. a position (specified as @var{X}/@var{Y}, where
  7435. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7436. The number and types of parameters depend on the loaded effect. If an
  7437. effect parameter is not specified, the default value is set.
  7438. @subsection Examples
  7439. @itemize
  7440. @item
  7441. Apply the distort0r effect, setting the first two double parameters:
  7442. @example
  7443. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7444. @end example
  7445. @item
  7446. Apply the colordistance effect, taking a color as the first parameter:
  7447. @example
  7448. frei0r=colordistance:0.2/0.3/0.4
  7449. frei0r=colordistance:violet
  7450. frei0r=colordistance:0x112233
  7451. @end example
  7452. @item
  7453. Apply the perspective effect, specifying the top left and top right image
  7454. positions:
  7455. @example
  7456. frei0r=perspective:0.2/0.2|0.8/0.2
  7457. @end example
  7458. @end itemize
  7459. For more information, see
  7460. @url{http://frei0r.dyne.org}
  7461. @section fspp
  7462. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7463. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7464. processing filter, one of them is performed once per block, not per pixel.
  7465. This allows for much higher speed.
  7466. The filter accepts the following options:
  7467. @table @option
  7468. @item quality
  7469. Set quality. This option defines the number of levels for averaging. It accepts
  7470. an integer in the range 4-5. Default value is @code{4}.
  7471. @item qp
  7472. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7473. If not set, the filter will use the QP from the video stream (if available).
  7474. @item strength
  7475. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7476. more details but also more artifacts, while higher values make the image smoother
  7477. but also blurrier. Default value is @code{0} − PSNR optimal.
  7478. @item use_bframe_qp
  7479. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7480. option may cause flicker since the B-Frames have often larger QP. Default is
  7481. @code{0} (not enabled).
  7482. @end table
  7483. @section gblur
  7484. Apply Gaussian blur filter.
  7485. The filter accepts the following options:
  7486. @table @option
  7487. @item sigma
  7488. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7489. @item steps
  7490. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7491. @item planes
  7492. Set which planes to filter. By default all planes are filtered.
  7493. @item sigmaV
  7494. Set vertical sigma, if negative it will be same as @code{sigma}.
  7495. Default is @code{-1}.
  7496. @end table
  7497. @section geq
  7498. The filter accepts the following options:
  7499. @table @option
  7500. @item lum_expr, lum
  7501. Set the luminance expression.
  7502. @item cb_expr, cb
  7503. Set the chrominance blue expression.
  7504. @item cr_expr, cr
  7505. Set the chrominance red expression.
  7506. @item alpha_expr, a
  7507. Set the alpha expression.
  7508. @item red_expr, r
  7509. Set the red expression.
  7510. @item green_expr, g
  7511. Set the green expression.
  7512. @item blue_expr, b
  7513. Set the blue expression.
  7514. @end table
  7515. The colorspace is selected according to the specified options. If one
  7516. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7517. options is specified, the filter will automatically select a YCbCr
  7518. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7519. @option{blue_expr} options is specified, it will select an RGB
  7520. colorspace.
  7521. If one of the chrominance expression is not defined, it falls back on the other
  7522. one. If no alpha expression is specified it will evaluate to opaque value.
  7523. If none of chrominance expressions are specified, they will evaluate
  7524. to the luminance expression.
  7525. The expressions can use the following variables and functions:
  7526. @table @option
  7527. @item N
  7528. The sequential number of the filtered frame, starting from @code{0}.
  7529. @item X
  7530. @item Y
  7531. The coordinates of the current sample.
  7532. @item W
  7533. @item H
  7534. The width and height of the image.
  7535. @item SW
  7536. @item SH
  7537. Width and height scale depending on the currently filtered plane. It is the
  7538. ratio between the corresponding luma plane number of pixels and the current
  7539. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7540. @code{0.5,0.5} for chroma planes.
  7541. @item T
  7542. Time of the current frame, expressed in seconds.
  7543. @item p(x, y)
  7544. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7545. plane.
  7546. @item lum(x, y)
  7547. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7548. plane.
  7549. @item cb(x, y)
  7550. Return the value of the pixel at location (@var{x},@var{y}) of the
  7551. blue-difference chroma plane. Return 0 if there is no such plane.
  7552. @item cr(x, y)
  7553. Return the value of the pixel at location (@var{x},@var{y}) of the
  7554. red-difference chroma plane. Return 0 if there is no such plane.
  7555. @item r(x, y)
  7556. @item g(x, y)
  7557. @item b(x, y)
  7558. Return the value of the pixel at location (@var{x},@var{y}) of the
  7559. red/green/blue component. Return 0 if there is no such component.
  7560. @item alpha(x, y)
  7561. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7562. plane. Return 0 if there is no such plane.
  7563. @end table
  7564. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7565. automatically clipped to the closer edge.
  7566. @subsection Examples
  7567. @itemize
  7568. @item
  7569. Flip the image horizontally:
  7570. @example
  7571. geq=p(W-X\,Y)
  7572. @end example
  7573. @item
  7574. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7575. wavelength of 100 pixels:
  7576. @example
  7577. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7578. @end example
  7579. @item
  7580. Generate a fancy enigmatic moving light:
  7581. @example
  7582. 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
  7583. @end example
  7584. @item
  7585. Generate a quick emboss effect:
  7586. @example
  7587. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7588. @end example
  7589. @item
  7590. Modify RGB components depending on pixel position:
  7591. @example
  7592. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7593. @end example
  7594. @item
  7595. Create a radial gradient that is the same size as the input (also see
  7596. the @ref{vignette} filter):
  7597. @example
  7598. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7599. @end example
  7600. @end itemize
  7601. @section gradfun
  7602. Fix the banding artifacts that are sometimes introduced into nearly flat
  7603. regions by truncation to 8-bit color depth.
  7604. Interpolate the gradients that should go where the bands are, and
  7605. dither them.
  7606. It is designed for playback only. Do not use it prior to
  7607. lossy compression, because compression tends to lose the dither and
  7608. bring back the bands.
  7609. It accepts the following parameters:
  7610. @table @option
  7611. @item strength
  7612. The maximum amount by which the filter will change any one pixel. This is also
  7613. the threshold for detecting nearly flat regions. Acceptable values range from
  7614. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7615. valid range.
  7616. @item radius
  7617. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7618. gradients, but also prevents the filter from modifying the pixels near detailed
  7619. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7620. values will be clipped to the valid range.
  7621. @end table
  7622. Alternatively, the options can be specified as a flat string:
  7623. @var{strength}[:@var{radius}]
  7624. @subsection Examples
  7625. @itemize
  7626. @item
  7627. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7628. @example
  7629. gradfun=3.5:8
  7630. @end example
  7631. @item
  7632. Specify radius, omitting the strength (which will fall-back to the default
  7633. value):
  7634. @example
  7635. gradfun=radius=8
  7636. @end example
  7637. @end itemize
  7638. @section greyedge
  7639. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7640. and corrects the scene colors accordingly.
  7641. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7642. The filter accepts the following options:
  7643. @table @option
  7644. @item difford
  7645. The order of differentiation to be applied on the scene. Must be chosen in the range
  7646. [0,2] and default value is 1.
  7647. @item minknorm
  7648. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7649. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7650. max value instead of calculating Minkowski distance.
  7651. @item sigma
  7652. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7653. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7654. can't be euqal to 0 if @var{difford} is greater than 0.
  7655. @end table
  7656. @subsection Examples
  7657. @itemize
  7658. @item
  7659. Grey Edge:
  7660. @example
  7661. greyedge=difford=1:minknorm=5:sigma=2
  7662. @end example
  7663. @item
  7664. Max Edge:
  7665. @example
  7666. greyedge=difford=1:minknorm=0:sigma=2
  7667. @end example
  7668. @end itemize
  7669. @anchor{haldclut}
  7670. @section haldclut
  7671. Apply a Hald CLUT to a video stream.
  7672. First input is the video stream to process, and second one is the Hald CLUT.
  7673. The Hald CLUT input can be a simple picture or a complete video stream.
  7674. The filter accepts the following options:
  7675. @table @option
  7676. @item shortest
  7677. Force termination when the shortest input terminates. Default is @code{0}.
  7678. @item repeatlast
  7679. Continue applying the last CLUT after the end of the stream. A value of
  7680. @code{0} disable the filter after the last frame of the CLUT is reached.
  7681. Default is @code{1}.
  7682. @end table
  7683. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7684. filters share the same internals).
  7685. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7686. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7687. @subsection Workflow examples
  7688. @subsubsection Hald CLUT video stream
  7689. Generate an identity Hald CLUT stream altered with various effects:
  7690. @example
  7691. 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
  7692. @end example
  7693. Note: make sure you use a lossless codec.
  7694. Then use it with @code{haldclut} to apply it on some random stream:
  7695. @example
  7696. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7697. @end example
  7698. The Hald CLUT will be applied to the 10 first seconds (duration of
  7699. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7700. to the remaining frames of the @code{mandelbrot} stream.
  7701. @subsubsection Hald CLUT with preview
  7702. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7703. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7704. biggest possible square starting at the top left of the picture. The remaining
  7705. padding pixels (bottom or right) will be ignored. This area can be used to add
  7706. a preview of the Hald CLUT.
  7707. Typically, the following generated Hald CLUT will be supported by the
  7708. @code{haldclut} filter:
  7709. @example
  7710. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7711. pad=iw+320 [padded_clut];
  7712. smptebars=s=320x256, split [a][b];
  7713. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7714. [main][b] overlay=W-320" -frames:v 1 clut.png
  7715. @end example
  7716. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7717. bars are displayed on the right-top, and below the same color bars processed by
  7718. the color changes.
  7719. Then, the effect of this Hald CLUT can be visualized with:
  7720. @example
  7721. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7722. @end example
  7723. @section hflip
  7724. Flip the input video horizontally.
  7725. For example, to horizontally flip the input video with @command{ffmpeg}:
  7726. @example
  7727. ffmpeg -i in.avi -vf "hflip" out.avi
  7728. @end example
  7729. @section histeq
  7730. This filter applies a global color histogram equalization on a
  7731. per-frame basis.
  7732. It can be used to correct video that has a compressed range of pixel
  7733. intensities. The filter redistributes the pixel intensities to
  7734. equalize their distribution across the intensity range. It may be
  7735. viewed as an "automatically adjusting contrast filter". This filter is
  7736. useful only for correcting degraded or poorly captured source
  7737. video.
  7738. The filter accepts the following options:
  7739. @table @option
  7740. @item strength
  7741. Determine the amount of equalization to be applied. As the strength
  7742. is reduced, the distribution of pixel intensities more-and-more
  7743. approaches that of the input frame. The value must be a float number
  7744. in the range [0,1] and defaults to 0.200.
  7745. @item intensity
  7746. Set the maximum intensity that can generated and scale the output
  7747. values appropriately. The strength should be set as desired and then
  7748. the intensity can be limited if needed to avoid washing-out. The value
  7749. must be a float number in the range [0,1] and defaults to 0.210.
  7750. @item antibanding
  7751. Set the antibanding level. If enabled the filter will randomly vary
  7752. the luminance of output pixels by a small amount to avoid banding of
  7753. the histogram. Possible values are @code{none}, @code{weak} or
  7754. @code{strong}. It defaults to @code{none}.
  7755. @end table
  7756. @section histogram
  7757. Compute and draw a color distribution histogram for the input video.
  7758. The computed histogram is a representation of the color component
  7759. distribution in an image.
  7760. Standard histogram displays the color components distribution in an image.
  7761. Displays color graph for each color component. Shows distribution of
  7762. the Y, U, V, A or R, G, B components, depending on input format, in the
  7763. current frame. Below each graph a color component scale meter is shown.
  7764. The filter accepts the following options:
  7765. @table @option
  7766. @item level_height
  7767. Set height of level. Default value is @code{200}.
  7768. Allowed range is [50, 2048].
  7769. @item scale_height
  7770. Set height of color scale. Default value is @code{12}.
  7771. Allowed range is [0, 40].
  7772. @item display_mode
  7773. Set display mode.
  7774. It accepts the following values:
  7775. @table @samp
  7776. @item stack
  7777. Per color component graphs are placed below each other.
  7778. @item parade
  7779. Per color component graphs are placed side by side.
  7780. @item overlay
  7781. Presents information identical to that in the @code{parade}, except
  7782. that the graphs representing color components are superimposed directly
  7783. over one another.
  7784. @end table
  7785. Default is @code{stack}.
  7786. @item levels_mode
  7787. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7788. Default is @code{linear}.
  7789. @item components
  7790. Set what color components to display.
  7791. Default is @code{7}.
  7792. @item fgopacity
  7793. Set foreground opacity. Default is @code{0.7}.
  7794. @item bgopacity
  7795. Set background opacity. Default is @code{0.5}.
  7796. @end table
  7797. @subsection Examples
  7798. @itemize
  7799. @item
  7800. Calculate and draw histogram:
  7801. @example
  7802. ffplay -i input -vf histogram
  7803. @end example
  7804. @end itemize
  7805. @anchor{hqdn3d}
  7806. @section hqdn3d
  7807. This is a high precision/quality 3d denoise filter. It aims to reduce
  7808. image noise, producing smooth images and making still images really
  7809. still. It should enhance compressibility.
  7810. It accepts the following optional parameters:
  7811. @table @option
  7812. @item luma_spatial
  7813. A non-negative floating point number which specifies spatial luma strength.
  7814. It defaults to 4.0.
  7815. @item chroma_spatial
  7816. A non-negative floating point number which specifies spatial chroma strength.
  7817. It defaults to 3.0*@var{luma_spatial}/4.0.
  7818. @item luma_tmp
  7819. A floating point number which specifies luma temporal strength. It defaults to
  7820. 6.0*@var{luma_spatial}/4.0.
  7821. @item chroma_tmp
  7822. A floating point number which specifies chroma temporal strength. It defaults to
  7823. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7824. @end table
  7825. @section hwdownload
  7826. Download hardware frames to system memory.
  7827. The input must be in hardware frames, and the output a non-hardware format.
  7828. Not all formats will be supported on the output - it may be necessary to insert
  7829. an additional @option{format} filter immediately following in the graph to get
  7830. the output in a supported format.
  7831. @section hwmap
  7832. Map hardware frames to system memory or to another device.
  7833. This filter has several different modes of operation; which one is used depends
  7834. on the input and output formats:
  7835. @itemize
  7836. @item
  7837. Hardware frame input, normal frame output
  7838. Map the input frames to system memory and pass them to the output. If the
  7839. original hardware frame is later required (for example, after overlaying
  7840. something else on part of it), the @option{hwmap} filter can be used again
  7841. in the next mode to retrieve it.
  7842. @item
  7843. Normal frame input, hardware frame output
  7844. If the input is actually a software-mapped hardware frame, then unmap it -
  7845. that is, return the original hardware frame.
  7846. Otherwise, a device must be provided. Create new hardware surfaces on that
  7847. device for the output, then map them back to the software format at the input
  7848. and give those frames to the preceding filter. This will then act like the
  7849. @option{hwupload} filter, but may be able to avoid an additional copy when
  7850. the input is already in a compatible format.
  7851. @item
  7852. Hardware frame input and output
  7853. A device must be supplied for the output, either directly or with the
  7854. @option{derive_device} option. The input and output devices must be of
  7855. different types and compatible - the exact meaning of this is
  7856. system-dependent, but typically it means that they must refer to the same
  7857. underlying hardware context (for example, refer to the same graphics card).
  7858. If the input frames were originally created on the output device, then unmap
  7859. to retrieve the original frames.
  7860. Otherwise, map the frames to the output device - create new hardware frames
  7861. on the output corresponding to the frames on the input.
  7862. @end itemize
  7863. The following additional parameters are accepted:
  7864. @table @option
  7865. @item mode
  7866. Set the frame mapping mode. Some combination of:
  7867. @table @var
  7868. @item read
  7869. The mapped frame should be readable.
  7870. @item write
  7871. The mapped frame should be writeable.
  7872. @item overwrite
  7873. The mapping will always overwrite the entire frame.
  7874. This may improve performance in some cases, as the original contents of the
  7875. frame need not be loaded.
  7876. @item direct
  7877. The mapping must not involve any copying.
  7878. Indirect mappings to copies of frames are created in some cases where either
  7879. direct mapping is not possible or it would have unexpected properties.
  7880. Setting this flag ensures that the mapping is direct and will fail if that is
  7881. not possible.
  7882. @end table
  7883. Defaults to @var{read+write} if not specified.
  7884. @item derive_device @var{type}
  7885. Rather than using the device supplied at initialisation, instead derive a new
  7886. device of type @var{type} from the device the input frames exist on.
  7887. @item reverse
  7888. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7889. and map them back to the source. This may be necessary in some cases where
  7890. a mapping in one direction is required but only the opposite direction is
  7891. supported by the devices being used.
  7892. This option is dangerous - it may break the preceding filter in undefined
  7893. ways if there are any additional constraints on that filter's output.
  7894. Do not use it without fully understanding the implications of its use.
  7895. @end table
  7896. @section hwupload
  7897. Upload system memory frames to hardware surfaces.
  7898. The device to upload to must be supplied when the filter is initialised. If
  7899. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7900. option.
  7901. @anchor{hwupload_cuda}
  7902. @section hwupload_cuda
  7903. Upload system memory frames to a CUDA device.
  7904. It accepts the following optional parameters:
  7905. @table @option
  7906. @item device
  7907. The number of the CUDA device to use
  7908. @end table
  7909. @section hqx
  7910. Apply a high-quality magnification filter designed for pixel art. This filter
  7911. was originally created by Maxim Stepin.
  7912. It accepts the following option:
  7913. @table @option
  7914. @item n
  7915. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7916. @code{hq3x} and @code{4} for @code{hq4x}.
  7917. Default is @code{3}.
  7918. @end table
  7919. @section hstack
  7920. Stack input videos horizontally.
  7921. All streams must be of same pixel format and of same height.
  7922. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7923. to create same output.
  7924. The filter accept the following option:
  7925. @table @option
  7926. @item inputs
  7927. Set number of input streams. Default is 2.
  7928. @item shortest
  7929. If set to 1, force the output to terminate when the shortest input
  7930. terminates. Default value is 0.
  7931. @end table
  7932. @section hue
  7933. Modify the hue and/or the saturation of the input.
  7934. It accepts the following parameters:
  7935. @table @option
  7936. @item h
  7937. Specify the hue angle as a number of degrees. It accepts an expression,
  7938. and defaults to "0".
  7939. @item s
  7940. Specify the saturation in the [-10,10] range. It accepts an expression and
  7941. defaults to "1".
  7942. @item H
  7943. Specify the hue angle as a number of radians. It accepts an
  7944. expression, and defaults to "0".
  7945. @item b
  7946. Specify the brightness in the [-10,10] range. It accepts an expression and
  7947. defaults to "0".
  7948. @end table
  7949. @option{h} and @option{H} are mutually exclusive, and can't be
  7950. specified at the same time.
  7951. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7952. expressions containing the following constants:
  7953. @table @option
  7954. @item n
  7955. frame count of the input frame starting from 0
  7956. @item pts
  7957. presentation timestamp of the input frame expressed in time base units
  7958. @item r
  7959. frame rate of the input video, NAN if the input frame rate is unknown
  7960. @item t
  7961. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7962. @item tb
  7963. time base of the input video
  7964. @end table
  7965. @subsection Examples
  7966. @itemize
  7967. @item
  7968. Set the hue to 90 degrees and the saturation to 1.0:
  7969. @example
  7970. hue=h=90:s=1
  7971. @end example
  7972. @item
  7973. Same command but expressing the hue in radians:
  7974. @example
  7975. hue=H=PI/2:s=1
  7976. @end example
  7977. @item
  7978. Rotate hue and make the saturation swing between 0
  7979. and 2 over a period of 1 second:
  7980. @example
  7981. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7982. @end example
  7983. @item
  7984. Apply a 3 seconds saturation fade-in effect starting at 0:
  7985. @example
  7986. hue="s=min(t/3\,1)"
  7987. @end example
  7988. The general fade-in expression can be written as:
  7989. @example
  7990. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7991. @end example
  7992. @item
  7993. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7994. @example
  7995. hue="s=max(0\, min(1\, (8-t)/3))"
  7996. @end example
  7997. The general fade-out expression can be written as:
  7998. @example
  7999. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8000. @end example
  8001. @end itemize
  8002. @subsection Commands
  8003. This filter supports the following commands:
  8004. @table @option
  8005. @item b
  8006. @item s
  8007. @item h
  8008. @item H
  8009. Modify the hue and/or the saturation and/or brightness of the input video.
  8010. The command accepts the same syntax of the corresponding option.
  8011. If the specified expression is not valid, it is kept at its current
  8012. value.
  8013. @end table
  8014. @section hysteresis
  8015. Grow first stream into second stream by connecting components.
  8016. This makes it possible to build more robust edge masks.
  8017. This filter accepts the following options:
  8018. @table @option
  8019. @item planes
  8020. Set which planes will be processed as bitmap, unprocessed planes will be
  8021. copied from first stream.
  8022. By default value 0xf, all planes will be processed.
  8023. @item threshold
  8024. Set threshold which is used in filtering. If pixel component value is higher than
  8025. this value filter algorithm for connecting components is activated.
  8026. By default value is 0.
  8027. @end table
  8028. @section idet
  8029. Detect video interlacing type.
  8030. This filter tries to detect if the input frames are interlaced, progressive,
  8031. top or bottom field first. It will also try to detect fields that are
  8032. repeated between adjacent frames (a sign of telecine).
  8033. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8034. Multiple frame detection incorporates the classification history of previous frames.
  8035. The filter will log these metadata values:
  8036. @table @option
  8037. @item single.current_frame
  8038. Detected type of current frame using single-frame detection. One of:
  8039. ``tff'' (top field first), ``bff'' (bottom field first),
  8040. ``progressive'', or ``undetermined''
  8041. @item single.tff
  8042. Cumulative number of frames detected as top field first using single-frame detection.
  8043. @item multiple.tff
  8044. Cumulative number of frames detected as top field first using multiple-frame detection.
  8045. @item single.bff
  8046. Cumulative number of frames detected as bottom field first using single-frame detection.
  8047. @item multiple.current_frame
  8048. Detected type of current frame using multiple-frame detection. One of:
  8049. ``tff'' (top field first), ``bff'' (bottom field first),
  8050. ``progressive'', or ``undetermined''
  8051. @item multiple.bff
  8052. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8053. @item single.progressive
  8054. Cumulative number of frames detected as progressive using single-frame detection.
  8055. @item multiple.progressive
  8056. Cumulative number of frames detected as progressive using multiple-frame detection.
  8057. @item single.undetermined
  8058. Cumulative number of frames that could not be classified using single-frame detection.
  8059. @item multiple.undetermined
  8060. Cumulative number of frames that could not be classified using multiple-frame detection.
  8061. @item repeated.current_frame
  8062. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8063. @item repeated.neither
  8064. Cumulative number of frames with no repeated field.
  8065. @item repeated.top
  8066. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8067. @item repeated.bottom
  8068. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8069. @end table
  8070. The filter accepts the following options:
  8071. @table @option
  8072. @item intl_thres
  8073. Set interlacing threshold.
  8074. @item prog_thres
  8075. Set progressive threshold.
  8076. @item rep_thres
  8077. Threshold for repeated field detection.
  8078. @item half_life
  8079. Number of frames after which a given frame's contribution to the
  8080. statistics is halved (i.e., it contributes only 0.5 to its
  8081. classification). The default of 0 means that all frames seen are given
  8082. full weight of 1.0 forever.
  8083. @item analyze_interlaced_flag
  8084. When this is not 0 then idet will use the specified number of frames to determine
  8085. if the interlaced flag is accurate, it will not count undetermined frames.
  8086. If the flag is found to be accurate it will be used without any further
  8087. computations, if it is found to be inaccurate it will be cleared without any
  8088. further computations. This allows inserting the idet filter as a low computational
  8089. method to clean up the interlaced flag
  8090. @end table
  8091. @section il
  8092. Deinterleave or interleave fields.
  8093. This filter allows one to process interlaced images fields without
  8094. deinterlacing them. Deinterleaving splits the input frame into 2
  8095. fields (so called half pictures). Odd lines are moved to the top
  8096. half of the output image, even lines to the bottom half.
  8097. You can process (filter) them independently and then re-interleave them.
  8098. The filter accepts the following options:
  8099. @table @option
  8100. @item luma_mode, l
  8101. @item chroma_mode, c
  8102. @item alpha_mode, a
  8103. Available values for @var{luma_mode}, @var{chroma_mode} and
  8104. @var{alpha_mode} are:
  8105. @table @samp
  8106. @item none
  8107. Do nothing.
  8108. @item deinterleave, d
  8109. Deinterleave fields, placing one above the other.
  8110. @item interleave, i
  8111. Interleave fields. Reverse the effect of deinterleaving.
  8112. @end table
  8113. Default value is @code{none}.
  8114. @item luma_swap, ls
  8115. @item chroma_swap, cs
  8116. @item alpha_swap, as
  8117. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8118. @end table
  8119. @section inflate
  8120. Apply inflate effect to the video.
  8121. This filter replaces the pixel by the local(3x3) average by taking into account
  8122. only values higher than the pixel.
  8123. It accepts the following options:
  8124. @table @option
  8125. @item threshold0
  8126. @item threshold1
  8127. @item threshold2
  8128. @item threshold3
  8129. Limit the maximum change for each plane, default is 65535.
  8130. If 0, plane will remain unchanged.
  8131. @end table
  8132. @section interlace
  8133. Simple interlacing filter from progressive contents. This interleaves upper (or
  8134. lower) lines from odd frames with lower (or upper) lines from even frames,
  8135. halving the frame rate and preserving image height.
  8136. @example
  8137. Original Original New Frame
  8138. Frame 'j' Frame 'j+1' (tff)
  8139. ========== =========== ==================
  8140. Line 0 --------------------> Frame 'j' Line 0
  8141. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8142. Line 2 ---------------------> Frame 'j' Line 2
  8143. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8144. ... ... ...
  8145. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8146. @end example
  8147. It accepts the following optional parameters:
  8148. @table @option
  8149. @item scan
  8150. This determines whether the interlaced frame is taken from the even
  8151. (tff - default) or odd (bff) lines of the progressive frame.
  8152. @item lowpass
  8153. Vertical lowpass filter to avoid twitter interlacing and
  8154. reduce moire patterns.
  8155. @table @samp
  8156. @item 0, off
  8157. Disable vertical lowpass filter
  8158. @item 1, linear
  8159. Enable linear filter (default)
  8160. @item 2, complex
  8161. Enable complex filter. This will slightly less reduce twitter and moire
  8162. but better retain detail and subjective sharpness impression.
  8163. @end table
  8164. @end table
  8165. @section kerndeint
  8166. Deinterlace input video by applying Donald Graft's adaptive kernel
  8167. deinterling. Work on interlaced parts of a video to produce
  8168. progressive frames.
  8169. The description of the accepted parameters follows.
  8170. @table @option
  8171. @item thresh
  8172. Set the threshold which affects the filter's tolerance when
  8173. determining if a pixel line must be processed. It must be an integer
  8174. in the range [0,255] and defaults to 10. A value of 0 will result in
  8175. applying the process on every pixels.
  8176. @item map
  8177. Paint pixels exceeding the threshold value to white if set to 1.
  8178. Default is 0.
  8179. @item order
  8180. Set the fields order. Swap fields if set to 1, leave fields alone if
  8181. 0. Default is 0.
  8182. @item sharp
  8183. Enable additional sharpening if set to 1. Default is 0.
  8184. @item twoway
  8185. Enable twoway sharpening if set to 1. Default is 0.
  8186. @end table
  8187. @subsection Examples
  8188. @itemize
  8189. @item
  8190. Apply default values:
  8191. @example
  8192. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8193. @end example
  8194. @item
  8195. Enable additional sharpening:
  8196. @example
  8197. kerndeint=sharp=1
  8198. @end example
  8199. @item
  8200. Paint processed pixels in white:
  8201. @example
  8202. kerndeint=map=1
  8203. @end example
  8204. @end itemize
  8205. @section lenscorrection
  8206. Correct radial lens distortion
  8207. This filter can be used to correct for radial distortion as can result from the use
  8208. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8209. one can use tools available for example as part of opencv or simply trial-and-error.
  8210. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8211. and extract the k1 and k2 coefficients from the resulting matrix.
  8212. Note that effectively the same filter is available in the open-source tools Krita and
  8213. Digikam from the KDE project.
  8214. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8215. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8216. brightness distribution, so you may want to use both filters together in certain
  8217. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8218. be applied before or after lens correction.
  8219. @subsection Options
  8220. The filter accepts the following options:
  8221. @table @option
  8222. @item cx
  8223. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8224. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8225. width. Default is 0.5.
  8226. @item cy
  8227. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8228. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8229. height. Default is 0.5.
  8230. @item k1
  8231. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8232. no correction. Default is 0.
  8233. @item k2
  8234. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8235. 0 means no correction. Default is 0.
  8236. @end table
  8237. The formula that generates the correction is:
  8238. @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)
  8239. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8240. distances from the focal point in the source and target images, respectively.
  8241. @section lensfun
  8242. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8243. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8244. to apply the lens correction. The filter will load the lensfun database and
  8245. query it to find the corresponding camera and lens entries in the database. As
  8246. long as these entries can be found with the given options, the filter can
  8247. perform corrections on frames. Note that incomplete strings will result in the
  8248. filter choosing the best match with the given options, and the filter will
  8249. output the chosen camera and lens models (logged with level "info"). You must
  8250. provide the make, camera model, and lens model as they are required.
  8251. The filter accepts the following options:
  8252. @table @option
  8253. @item make
  8254. The make of the camera (for example, "Canon"). This option is required.
  8255. @item model
  8256. The model of the camera (for example, "Canon EOS 100D"). This option is
  8257. required.
  8258. @item lens_model
  8259. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8260. option is required.
  8261. @item mode
  8262. The type of correction to apply. The following values are valid options:
  8263. @table @samp
  8264. @item vignetting
  8265. Enables fixing lens vignetting.
  8266. @item geometry
  8267. Enables fixing lens geometry. This is the default.
  8268. @item subpixel
  8269. Enables fixing chromatic aberrations.
  8270. @item vig_geo
  8271. Enables fixing lens vignetting and lens geometry.
  8272. @item vig_subpixel
  8273. Enables fixing lens vignetting and chromatic aberrations.
  8274. @item distortion
  8275. Enables fixing both lens geometry and chromatic aberrations.
  8276. @item all
  8277. Enables all possible corrections.
  8278. @end table
  8279. @item focal_length
  8280. The focal length of the image/video (zoom; expected constant for video). For
  8281. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8282. range should be chosen when using that lens. Default 18.
  8283. @item aperture
  8284. The aperture of the image/video (expected constant for video). Note that
  8285. aperture is only used for vignetting correction. Default 3.5.
  8286. @item focus_distance
  8287. The focus distance of the image/video (expected constant for video). Note that
  8288. focus distance is only used for vignetting and only slightly affects the
  8289. vignetting correction process. If unknown, leave it at the default value (which
  8290. is 1000).
  8291. @item target_geometry
  8292. The target geometry of the output image/video. The following values are valid
  8293. options:
  8294. @table @samp
  8295. @item rectilinear (default)
  8296. @item fisheye
  8297. @item panoramic
  8298. @item equirectangular
  8299. @item fisheye_orthographic
  8300. @item fisheye_stereographic
  8301. @item fisheye_equisolid
  8302. @item fisheye_thoby
  8303. @end table
  8304. @item reverse
  8305. Apply the reverse of image correction (instead of correcting distortion, apply
  8306. it).
  8307. @item interpolation
  8308. The type of interpolation used when correcting distortion. The following values
  8309. are valid options:
  8310. @table @samp
  8311. @item nearest
  8312. @item linear (default)
  8313. @item lanczos
  8314. @end table
  8315. @end table
  8316. @subsection Examples
  8317. @itemize
  8318. @item
  8319. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8320. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8321. aperture of "8.0".
  8322. @example
  8323. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  8324. @end example
  8325. @item
  8326. Apply the same as before, but only for the first 5 seconds of video.
  8327. @example
  8328. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  8329. @end example
  8330. @end itemize
  8331. @section libvmaf
  8332. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8333. score between two input videos.
  8334. The obtained VMAF score is printed through the logging system.
  8335. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8336. After installing the library it can be enabled using:
  8337. @code{./configure --enable-libvmaf --enable-version3}.
  8338. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8339. The filter has following options:
  8340. @table @option
  8341. @item model_path
  8342. Set the model path which is to be used for SVM.
  8343. Default value: @code{"vmaf_v0.6.1.pkl"}
  8344. @item log_path
  8345. Set the file path to be used to store logs.
  8346. @item log_fmt
  8347. Set the format of the log file (xml or json).
  8348. @item enable_transform
  8349. Enables transform for computing vmaf.
  8350. @item phone_model
  8351. Invokes the phone model which will generate VMAF scores higher than in the
  8352. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8353. @item psnr
  8354. Enables computing psnr along with vmaf.
  8355. @item ssim
  8356. Enables computing ssim along with vmaf.
  8357. @item ms_ssim
  8358. Enables computing ms_ssim along with vmaf.
  8359. @item pool
  8360. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8361. @item n_threads
  8362. Set number of threads to be used when computing vmaf.
  8363. @item n_subsample
  8364. Set interval for frame subsampling used when computing vmaf.
  8365. @item enable_conf_interval
  8366. Enables confidence interval.
  8367. @end table
  8368. This filter also supports the @ref{framesync} options.
  8369. On the below examples the input file @file{main.mpg} being processed is
  8370. compared with the reference file @file{ref.mpg}.
  8371. @example
  8372. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8373. @end example
  8374. Example with options:
  8375. @example
  8376. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8377. @end example
  8378. @section limiter
  8379. Limits the pixel components values to the specified range [min, max].
  8380. The filter accepts the following options:
  8381. @table @option
  8382. @item min
  8383. Lower bound. Defaults to the lowest allowed value for the input.
  8384. @item max
  8385. Upper bound. Defaults to the highest allowed value for the input.
  8386. @item planes
  8387. Specify which planes will be processed. Defaults to all available.
  8388. @end table
  8389. @section loop
  8390. Loop video frames.
  8391. The filter accepts the following options:
  8392. @table @option
  8393. @item loop
  8394. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8395. Default is 0.
  8396. @item size
  8397. Set maximal size in number of frames. Default is 0.
  8398. @item start
  8399. Set first frame of loop. Default is 0.
  8400. @end table
  8401. @anchor{lut3d}
  8402. @section lut3d
  8403. Apply a 3D LUT to an input video.
  8404. The filter accepts the following options:
  8405. @table @option
  8406. @item file
  8407. Set the 3D LUT file name.
  8408. Currently supported formats:
  8409. @table @samp
  8410. @item 3dl
  8411. AfterEffects
  8412. @item cube
  8413. Iridas
  8414. @item dat
  8415. DaVinci
  8416. @item m3d
  8417. Pandora
  8418. @end table
  8419. @item interp
  8420. Select interpolation mode.
  8421. Available values are:
  8422. @table @samp
  8423. @item nearest
  8424. Use values from the nearest defined point.
  8425. @item trilinear
  8426. Interpolate values using the 8 points defining a cube.
  8427. @item tetrahedral
  8428. Interpolate values using a tetrahedron.
  8429. @end table
  8430. @end table
  8431. This filter also supports the @ref{framesync} options.
  8432. @section lumakey
  8433. Turn certain luma values into transparency.
  8434. The filter accepts the following options:
  8435. @table @option
  8436. @item threshold
  8437. Set the luma which will be used as base for transparency.
  8438. Default value is @code{0}.
  8439. @item tolerance
  8440. Set the range of luma values to be keyed out.
  8441. Default value is @code{0}.
  8442. @item softness
  8443. Set the range of softness. Default value is @code{0}.
  8444. Use this to control gradual transition from zero to full transparency.
  8445. @end table
  8446. @section lut, lutrgb, lutyuv
  8447. Compute a look-up table for binding each pixel component input value
  8448. to an output value, and apply it to the input video.
  8449. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8450. to an RGB input video.
  8451. These filters accept the following parameters:
  8452. @table @option
  8453. @item c0
  8454. set first pixel component expression
  8455. @item c1
  8456. set second pixel component expression
  8457. @item c2
  8458. set third pixel component expression
  8459. @item c3
  8460. set fourth pixel component expression, corresponds to the alpha component
  8461. @item r
  8462. set red component expression
  8463. @item g
  8464. set green component expression
  8465. @item b
  8466. set blue component expression
  8467. @item a
  8468. alpha component expression
  8469. @item y
  8470. set Y/luminance component expression
  8471. @item u
  8472. set U/Cb component expression
  8473. @item v
  8474. set V/Cr component expression
  8475. @end table
  8476. Each of them specifies the expression to use for computing the lookup table for
  8477. the corresponding pixel component values.
  8478. The exact component associated to each of the @var{c*} options depends on the
  8479. format in input.
  8480. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8481. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8482. The expressions can contain the following constants and functions:
  8483. @table @option
  8484. @item w
  8485. @item h
  8486. The input width and height.
  8487. @item val
  8488. The input value for the pixel component.
  8489. @item clipval
  8490. The input value, clipped to the @var{minval}-@var{maxval} range.
  8491. @item maxval
  8492. The maximum value for the pixel component.
  8493. @item minval
  8494. The minimum value for the pixel component.
  8495. @item negval
  8496. The negated value for the pixel component value, clipped to the
  8497. @var{minval}-@var{maxval} range; it corresponds to the expression
  8498. "maxval-clipval+minval".
  8499. @item clip(val)
  8500. The computed value in @var{val}, clipped to the
  8501. @var{minval}-@var{maxval} range.
  8502. @item gammaval(gamma)
  8503. The computed gamma correction value of the pixel component value,
  8504. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8505. expression
  8506. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8507. @end table
  8508. All expressions default to "val".
  8509. @subsection Examples
  8510. @itemize
  8511. @item
  8512. Negate input video:
  8513. @example
  8514. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8515. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8516. @end example
  8517. The above is the same as:
  8518. @example
  8519. lutrgb="r=negval:g=negval:b=negval"
  8520. lutyuv="y=negval:u=negval:v=negval"
  8521. @end example
  8522. @item
  8523. Negate luminance:
  8524. @example
  8525. lutyuv=y=negval
  8526. @end example
  8527. @item
  8528. Remove chroma components, turning the video into a graytone image:
  8529. @example
  8530. lutyuv="u=128:v=128"
  8531. @end example
  8532. @item
  8533. Apply a luma burning effect:
  8534. @example
  8535. lutyuv="y=2*val"
  8536. @end example
  8537. @item
  8538. Remove green and blue components:
  8539. @example
  8540. lutrgb="g=0:b=0"
  8541. @end example
  8542. @item
  8543. Set a constant alpha channel value on input:
  8544. @example
  8545. format=rgba,lutrgb=a="maxval-minval/2"
  8546. @end example
  8547. @item
  8548. Correct luminance gamma by a factor of 0.5:
  8549. @example
  8550. lutyuv=y=gammaval(0.5)
  8551. @end example
  8552. @item
  8553. Discard least significant bits of luma:
  8554. @example
  8555. lutyuv=y='bitand(val, 128+64+32)'
  8556. @end example
  8557. @item
  8558. Technicolor like effect:
  8559. @example
  8560. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8561. @end example
  8562. @end itemize
  8563. @section lut2, tlut2
  8564. The @code{lut2} filter takes two input streams and outputs one
  8565. stream.
  8566. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8567. from one single stream.
  8568. This filter accepts the following parameters:
  8569. @table @option
  8570. @item c0
  8571. set first pixel component expression
  8572. @item c1
  8573. set second pixel component expression
  8574. @item c2
  8575. set third pixel component expression
  8576. @item c3
  8577. set fourth pixel component expression, corresponds to the alpha component
  8578. @end table
  8579. Each of them specifies the expression to use for computing the lookup table for
  8580. the corresponding pixel component values.
  8581. The exact component associated to each of the @var{c*} options depends on the
  8582. format in inputs.
  8583. The expressions can contain the following constants:
  8584. @table @option
  8585. @item w
  8586. @item h
  8587. The input width and height.
  8588. @item x
  8589. The first input value for the pixel component.
  8590. @item y
  8591. The second input value for the pixel component.
  8592. @item bdx
  8593. The first input video bit depth.
  8594. @item bdy
  8595. The second input video bit depth.
  8596. @end table
  8597. All expressions default to "x".
  8598. @subsection Examples
  8599. @itemize
  8600. @item
  8601. Highlight differences between two RGB video streams:
  8602. @example
  8603. 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)'
  8604. @end example
  8605. @item
  8606. Highlight differences between two YUV video streams:
  8607. @example
  8608. 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)'
  8609. @end example
  8610. @item
  8611. Show max difference between two video streams:
  8612. @example
  8613. 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)))'
  8614. @end example
  8615. @end itemize
  8616. @section maskedclamp
  8617. Clamp the first input stream with the second input and third input stream.
  8618. Returns the value of first stream to be between second input
  8619. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8620. This filter accepts the following options:
  8621. @table @option
  8622. @item undershoot
  8623. Default value is @code{0}.
  8624. @item overshoot
  8625. Default value is @code{0}.
  8626. @item planes
  8627. Set which planes will be processed as bitmap, unprocessed planes will be
  8628. copied from first stream.
  8629. By default value 0xf, all planes will be processed.
  8630. @end table
  8631. @section maskedmerge
  8632. Merge the first input stream with the second input stream using per pixel
  8633. weights in the third input stream.
  8634. A value of 0 in the third stream pixel component means that pixel component
  8635. from first stream is returned unchanged, while maximum value (eg. 255 for
  8636. 8-bit videos) means that pixel component from second stream is returned
  8637. unchanged. Intermediate values define the amount of merging between both
  8638. input stream's pixel components.
  8639. This filter accepts the following options:
  8640. @table @option
  8641. @item planes
  8642. Set which planes will be processed as bitmap, unprocessed planes will be
  8643. copied from first stream.
  8644. By default value 0xf, all planes will be processed.
  8645. @end table
  8646. @section mcdeint
  8647. Apply motion-compensation deinterlacing.
  8648. It needs one field per frame as input and must thus be used together
  8649. with yadif=1/3 or equivalent.
  8650. This filter accepts the following options:
  8651. @table @option
  8652. @item mode
  8653. Set the deinterlacing mode.
  8654. It accepts one of the following values:
  8655. @table @samp
  8656. @item fast
  8657. @item medium
  8658. @item slow
  8659. use iterative motion estimation
  8660. @item extra_slow
  8661. like @samp{slow}, but use multiple reference frames.
  8662. @end table
  8663. Default value is @samp{fast}.
  8664. @item parity
  8665. Set the picture field parity assumed for the input video. It must be
  8666. one of the following values:
  8667. @table @samp
  8668. @item 0, tff
  8669. assume top field first
  8670. @item 1, bff
  8671. assume bottom field first
  8672. @end table
  8673. Default value is @samp{bff}.
  8674. @item qp
  8675. Set per-block quantization parameter (QP) used by the internal
  8676. encoder.
  8677. Higher values should result in a smoother motion vector field but less
  8678. optimal individual vectors. Default value is 1.
  8679. @end table
  8680. @section mergeplanes
  8681. Merge color channel components from several video streams.
  8682. The filter accepts up to 4 input streams, and merge selected input
  8683. planes to the output video.
  8684. This filter accepts the following options:
  8685. @table @option
  8686. @item mapping
  8687. Set input to output plane mapping. Default is @code{0}.
  8688. The mappings is specified as a bitmap. It should be specified as a
  8689. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8690. mapping for the first plane of the output stream. 'A' sets the number of
  8691. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8692. corresponding input to use (from 0 to 3). The rest of the mappings is
  8693. similar, 'Bb' describes the mapping for the output stream second
  8694. plane, 'Cc' describes the mapping for the output stream third plane and
  8695. 'Dd' describes the mapping for the output stream fourth plane.
  8696. @item format
  8697. Set output pixel format. Default is @code{yuva444p}.
  8698. @end table
  8699. @subsection Examples
  8700. @itemize
  8701. @item
  8702. Merge three gray video streams of same width and height into single video stream:
  8703. @example
  8704. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8705. @end example
  8706. @item
  8707. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8708. @example
  8709. [a0][a1]mergeplanes=0x00010210:yuva444p
  8710. @end example
  8711. @item
  8712. Swap Y and A plane in yuva444p stream:
  8713. @example
  8714. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8715. @end example
  8716. @item
  8717. Swap U and V plane in yuv420p stream:
  8718. @example
  8719. format=yuv420p,mergeplanes=0x000201:yuv420p
  8720. @end example
  8721. @item
  8722. Cast a rgb24 clip to yuv444p:
  8723. @example
  8724. format=rgb24,mergeplanes=0x000102:yuv444p
  8725. @end example
  8726. @end itemize
  8727. @section mestimate
  8728. Estimate and export motion vectors using block matching algorithms.
  8729. Motion vectors are stored in frame side data to be used by other filters.
  8730. This filter accepts the following options:
  8731. @table @option
  8732. @item method
  8733. Specify the motion estimation method. Accepts one of the following values:
  8734. @table @samp
  8735. @item esa
  8736. Exhaustive search algorithm.
  8737. @item tss
  8738. Three step search algorithm.
  8739. @item tdls
  8740. Two dimensional logarithmic search algorithm.
  8741. @item ntss
  8742. New three step search algorithm.
  8743. @item fss
  8744. Four step search algorithm.
  8745. @item ds
  8746. Diamond search algorithm.
  8747. @item hexbs
  8748. Hexagon-based search algorithm.
  8749. @item epzs
  8750. Enhanced predictive zonal search algorithm.
  8751. @item umh
  8752. Uneven multi-hexagon search algorithm.
  8753. @end table
  8754. Default value is @samp{esa}.
  8755. @item mb_size
  8756. Macroblock size. Default @code{16}.
  8757. @item search_param
  8758. Search parameter. Default @code{7}.
  8759. @end table
  8760. @section midequalizer
  8761. Apply Midway Image Equalization effect using two video streams.
  8762. Midway Image Equalization adjusts a pair of images to have the same
  8763. histogram, while maintaining their dynamics as much as possible. It's
  8764. useful for e.g. matching exposures from a pair of stereo cameras.
  8765. This filter has two inputs and one output, which must be of same pixel format, but
  8766. may be of different sizes. The output of filter is first input adjusted with
  8767. midway histogram of both inputs.
  8768. This filter accepts the following option:
  8769. @table @option
  8770. @item planes
  8771. Set which planes to process. Default is @code{15}, which is all available planes.
  8772. @end table
  8773. @section minterpolate
  8774. Convert the video to specified frame rate using motion interpolation.
  8775. This filter accepts the following options:
  8776. @table @option
  8777. @item fps
  8778. 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}.
  8779. @item mi_mode
  8780. Motion interpolation mode. Following values are accepted:
  8781. @table @samp
  8782. @item dup
  8783. Duplicate previous or next frame for interpolating new ones.
  8784. @item blend
  8785. Blend source frames. Interpolated frame is mean of previous and next frames.
  8786. @item mci
  8787. Motion compensated interpolation. Following options are effective when this mode is selected:
  8788. @table @samp
  8789. @item mc_mode
  8790. Motion compensation mode. Following values are accepted:
  8791. @table @samp
  8792. @item obmc
  8793. Overlapped block motion compensation.
  8794. @item aobmc
  8795. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8796. @end table
  8797. Default mode is @samp{obmc}.
  8798. @item me_mode
  8799. Motion estimation mode. Following values are accepted:
  8800. @table @samp
  8801. @item bidir
  8802. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8803. @item bilat
  8804. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8805. @end table
  8806. Default mode is @samp{bilat}.
  8807. @item me
  8808. The algorithm to be used for motion estimation. Following values are accepted:
  8809. @table @samp
  8810. @item esa
  8811. Exhaustive search algorithm.
  8812. @item tss
  8813. Three step search algorithm.
  8814. @item tdls
  8815. Two dimensional logarithmic search algorithm.
  8816. @item ntss
  8817. New three step search algorithm.
  8818. @item fss
  8819. Four step search algorithm.
  8820. @item ds
  8821. Diamond search algorithm.
  8822. @item hexbs
  8823. Hexagon-based search algorithm.
  8824. @item epzs
  8825. Enhanced predictive zonal search algorithm.
  8826. @item umh
  8827. Uneven multi-hexagon search algorithm.
  8828. @end table
  8829. Default algorithm is @samp{epzs}.
  8830. @item mb_size
  8831. Macroblock size. Default @code{16}.
  8832. @item search_param
  8833. Motion estimation search parameter. Default @code{32}.
  8834. @item vsbmc
  8835. 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).
  8836. @end table
  8837. @end table
  8838. @item scd
  8839. 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:
  8840. @table @samp
  8841. @item none
  8842. Disable scene change detection.
  8843. @item fdiff
  8844. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8845. @end table
  8846. Default method is @samp{fdiff}.
  8847. @item scd_threshold
  8848. Scene change detection threshold. Default is @code{5.0}.
  8849. @end table
  8850. @section mix
  8851. Mix several video input streams into one video stream.
  8852. A description of the accepted options follows.
  8853. @table @option
  8854. @item nb_inputs
  8855. The number of inputs. If unspecified, it defaults to 2.
  8856. @item weights
  8857. Specify weight of each input video stream as sequence.
  8858. Each weight is separated by space. If number of weights
  8859. is smaller than number of @var{frames} last specified
  8860. weight will be used for all remaining unset weights.
  8861. @item scale
  8862. Specify scale, if it is set it will be multiplied with sum
  8863. of each weight multiplied with pixel values to give final destination
  8864. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8865. @item duration
  8866. Specify how end of stream is determined.
  8867. @table @samp
  8868. @item longest
  8869. The duration of the longest input. (default)
  8870. @item shortest
  8871. The duration of the shortest input.
  8872. @item first
  8873. The duration of the first input.
  8874. @end table
  8875. @end table
  8876. @section mpdecimate
  8877. Drop frames that do not differ greatly from the previous frame in
  8878. order to reduce frame rate.
  8879. The main use of this filter is for very-low-bitrate encoding
  8880. (e.g. streaming over dialup modem), but it could in theory be used for
  8881. fixing movies that were inverse-telecined incorrectly.
  8882. A description of the accepted options follows.
  8883. @table @option
  8884. @item max
  8885. Set the maximum number of consecutive frames which can be dropped (if
  8886. positive), or the minimum interval between dropped frames (if
  8887. negative). If the value is 0, the frame is dropped disregarding the
  8888. number of previous sequentially dropped frames.
  8889. Default value is 0.
  8890. @item hi
  8891. @item lo
  8892. @item frac
  8893. Set the dropping threshold values.
  8894. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8895. represent actual pixel value differences, so a threshold of 64
  8896. corresponds to 1 unit of difference for each pixel, or the same spread
  8897. out differently over the block.
  8898. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8899. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8900. meaning the whole image) differ by more than a threshold of @option{lo}.
  8901. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8902. 64*5, and default value for @option{frac} is 0.33.
  8903. @end table
  8904. @section negate
  8905. Negate (invert) the input video.
  8906. It accepts the following option:
  8907. @table @option
  8908. @item negate_alpha
  8909. With value 1, it negates the alpha component, if present. Default value is 0.
  8910. @end table
  8911. @section nlmeans
  8912. Denoise frames using Non-Local Means algorithm.
  8913. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8914. context similarity is defined by comparing their surrounding patches of size
  8915. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8916. around the pixel.
  8917. Note that the research area defines centers for patches, which means some
  8918. patches will be made of pixels outside that research area.
  8919. The filter accepts the following options.
  8920. @table @option
  8921. @item s
  8922. Set denoising strength.
  8923. @item p
  8924. Set patch size.
  8925. @item pc
  8926. Same as @option{p} but for chroma planes.
  8927. The default value is @var{0} and means automatic.
  8928. @item r
  8929. Set research size.
  8930. @item rc
  8931. Same as @option{r} but for chroma planes.
  8932. The default value is @var{0} and means automatic.
  8933. @end table
  8934. @section nnedi
  8935. Deinterlace video using neural network edge directed interpolation.
  8936. This filter accepts the following options:
  8937. @table @option
  8938. @item weights
  8939. Mandatory option, without binary file filter can not work.
  8940. Currently file can be found here:
  8941. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8942. @item deint
  8943. Set which frames to deinterlace, by default it is @code{all}.
  8944. Can be @code{all} or @code{interlaced}.
  8945. @item field
  8946. Set mode of operation.
  8947. Can be one of the following:
  8948. @table @samp
  8949. @item af
  8950. Use frame flags, both fields.
  8951. @item a
  8952. Use frame flags, single field.
  8953. @item t
  8954. Use top field only.
  8955. @item b
  8956. Use bottom field only.
  8957. @item tf
  8958. Use both fields, top first.
  8959. @item bf
  8960. Use both fields, bottom first.
  8961. @end table
  8962. @item planes
  8963. Set which planes to process, by default filter process all frames.
  8964. @item nsize
  8965. Set size of local neighborhood around each pixel, used by the predictor neural
  8966. network.
  8967. Can be one of the following:
  8968. @table @samp
  8969. @item s8x6
  8970. @item s16x6
  8971. @item s32x6
  8972. @item s48x6
  8973. @item s8x4
  8974. @item s16x4
  8975. @item s32x4
  8976. @end table
  8977. @item nns
  8978. Set the number of neurons in predictor neural network.
  8979. Can be one of the following:
  8980. @table @samp
  8981. @item n16
  8982. @item n32
  8983. @item n64
  8984. @item n128
  8985. @item n256
  8986. @end table
  8987. @item qual
  8988. Controls the number of different neural network predictions that are blended
  8989. together to compute the final output value. Can be @code{fast}, default or
  8990. @code{slow}.
  8991. @item etype
  8992. Set which set of weights to use in the predictor.
  8993. Can be one of the following:
  8994. @table @samp
  8995. @item a
  8996. weights trained to minimize absolute error
  8997. @item s
  8998. weights trained to minimize squared error
  8999. @end table
  9000. @item pscrn
  9001. Controls whether or not the prescreener neural network is used to decide
  9002. which pixels should be processed by the predictor neural network and which
  9003. can be handled by simple cubic interpolation.
  9004. The prescreener is trained to know whether cubic interpolation will be
  9005. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9006. The computational complexity of the prescreener nn is much less than that of
  9007. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9008. using the prescreener generally results in much faster processing.
  9009. The prescreener is pretty accurate, so the difference between using it and not
  9010. using it is almost always unnoticeable.
  9011. Can be one of the following:
  9012. @table @samp
  9013. @item none
  9014. @item original
  9015. @item new
  9016. @end table
  9017. Default is @code{new}.
  9018. @item fapprox
  9019. Set various debugging flags.
  9020. @end table
  9021. @section noformat
  9022. Force libavfilter not to use any of the specified pixel formats for the
  9023. input to the next filter.
  9024. It accepts the following parameters:
  9025. @table @option
  9026. @item pix_fmts
  9027. A '|'-separated list of pixel format names, such as
  9028. pix_fmts=yuv420p|monow|rgb24".
  9029. @end table
  9030. @subsection Examples
  9031. @itemize
  9032. @item
  9033. Force libavfilter to use a format different from @var{yuv420p} for the
  9034. input to the vflip filter:
  9035. @example
  9036. noformat=pix_fmts=yuv420p,vflip
  9037. @end example
  9038. @item
  9039. Convert the input video to any of the formats not contained in the list:
  9040. @example
  9041. noformat=yuv420p|yuv444p|yuv410p
  9042. @end example
  9043. @end itemize
  9044. @section noise
  9045. Add noise on video input frame.
  9046. The filter accepts the following options:
  9047. @table @option
  9048. @item all_seed
  9049. @item c0_seed
  9050. @item c1_seed
  9051. @item c2_seed
  9052. @item c3_seed
  9053. Set noise seed for specific pixel component or all pixel components in case
  9054. of @var{all_seed}. Default value is @code{123457}.
  9055. @item all_strength, alls
  9056. @item c0_strength, c0s
  9057. @item c1_strength, c1s
  9058. @item c2_strength, c2s
  9059. @item c3_strength, c3s
  9060. Set noise strength for specific pixel component or all pixel components in case
  9061. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9062. @item all_flags, allf
  9063. @item c0_flags, c0f
  9064. @item c1_flags, c1f
  9065. @item c2_flags, c2f
  9066. @item c3_flags, c3f
  9067. Set pixel component flags or set flags for all components if @var{all_flags}.
  9068. Available values for component flags are:
  9069. @table @samp
  9070. @item a
  9071. averaged temporal noise (smoother)
  9072. @item p
  9073. mix random noise with a (semi)regular pattern
  9074. @item t
  9075. temporal noise (noise pattern changes between frames)
  9076. @item u
  9077. uniform noise (gaussian otherwise)
  9078. @end table
  9079. @end table
  9080. @subsection Examples
  9081. Add temporal and uniform noise to input video:
  9082. @example
  9083. noise=alls=20:allf=t+u
  9084. @end example
  9085. @section normalize
  9086. Normalize RGB video (aka histogram stretching, contrast stretching).
  9087. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9088. For each channel of each frame, the filter computes the input range and maps
  9089. it linearly to the user-specified output range. The output range defaults
  9090. to the full dynamic range from pure black to pure white.
  9091. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9092. changes in brightness) caused when small dark or bright objects enter or leave
  9093. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9094. video camera, and, like a video camera, it may cause a period of over- or
  9095. under-exposure of the video.
  9096. The R,G,B channels can be normalized independently, which may cause some
  9097. color shifting, or linked together as a single channel, which prevents
  9098. color shifting. Linked normalization preserves hue. Independent normalization
  9099. does not, so it can be used to remove some color casts. Independent and linked
  9100. normalization can be combined in any ratio.
  9101. The normalize filter accepts the following options:
  9102. @table @option
  9103. @item blackpt
  9104. @item whitept
  9105. Colors which define the output range. The minimum input value is mapped to
  9106. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9107. The defaults are black and white respectively. Specifying white for
  9108. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9109. normalized video. Shades of grey can be used to reduce the dynamic range
  9110. (contrast). Specifying saturated colors here can create some interesting
  9111. effects.
  9112. @item smoothing
  9113. The number of previous frames to use for temporal smoothing. The input range
  9114. of each channel is smoothed using a rolling average over the current frame
  9115. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9116. smoothing).
  9117. @item independence
  9118. Controls the ratio of independent (color shifting) channel normalization to
  9119. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9120. independent. Defaults to 1.0 (fully independent).
  9121. @item strength
  9122. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9123. expensive no-op. Defaults to 1.0 (full strength).
  9124. @end table
  9125. @subsection Examples
  9126. Stretch video contrast to use the full dynamic range, with no temporal
  9127. smoothing; may flicker depending on the source content:
  9128. @example
  9129. normalize=blackpt=black:whitept=white:smoothing=0
  9130. @end example
  9131. As above, but with 50 frames of temporal smoothing; flicker should be
  9132. reduced, depending on the source content:
  9133. @example
  9134. normalize=blackpt=black:whitept=white:smoothing=50
  9135. @end example
  9136. As above, but with hue-preserving linked channel normalization:
  9137. @example
  9138. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9139. @end example
  9140. As above, but with half strength:
  9141. @example
  9142. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9143. @end example
  9144. Map the darkest input color to red, the brightest input color to cyan:
  9145. @example
  9146. normalize=blackpt=red:whitept=cyan
  9147. @end example
  9148. @section null
  9149. Pass the video source unchanged to the output.
  9150. @section ocr
  9151. Optical Character Recognition
  9152. This filter uses Tesseract for optical character recognition. To enable
  9153. compilation of this filter, you need to configure FFmpeg with
  9154. @code{--enable-libtesseract}.
  9155. It accepts the following options:
  9156. @table @option
  9157. @item datapath
  9158. Set datapath to tesseract data. Default is to use whatever was
  9159. set at installation.
  9160. @item language
  9161. Set language, default is "eng".
  9162. @item whitelist
  9163. Set character whitelist.
  9164. @item blacklist
  9165. Set character blacklist.
  9166. @end table
  9167. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9168. @section ocv
  9169. Apply a video transform using libopencv.
  9170. To enable this filter, install the libopencv library and headers and
  9171. configure FFmpeg with @code{--enable-libopencv}.
  9172. It accepts the following parameters:
  9173. @table @option
  9174. @item filter_name
  9175. The name of the libopencv filter to apply.
  9176. @item filter_params
  9177. The parameters to pass to the libopencv filter. If not specified, the default
  9178. values are assumed.
  9179. @end table
  9180. Refer to the official libopencv documentation for more precise
  9181. information:
  9182. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9183. Several libopencv filters are supported; see the following subsections.
  9184. @anchor{dilate}
  9185. @subsection dilate
  9186. Dilate an image by using a specific structuring element.
  9187. It corresponds to the libopencv function @code{cvDilate}.
  9188. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9189. @var{struct_el} represents a structuring element, and has the syntax:
  9190. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9191. @var{cols} and @var{rows} represent the number of columns and rows of
  9192. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9193. point, and @var{shape} the shape for the structuring element. @var{shape}
  9194. must be "rect", "cross", "ellipse", or "custom".
  9195. If the value for @var{shape} is "custom", it must be followed by a
  9196. string of the form "=@var{filename}". The file with name
  9197. @var{filename} is assumed to represent a binary image, with each
  9198. printable character corresponding to a bright pixel. When a custom
  9199. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9200. or columns and rows of the read file are assumed instead.
  9201. The default value for @var{struct_el} is "3x3+0x0/rect".
  9202. @var{nb_iterations} specifies the number of times the transform is
  9203. applied to the image, and defaults to 1.
  9204. Some examples:
  9205. @example
  9206. # Use the default values
  9207. ocv=dilate
  9208. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9209. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9210. # Read the shape from the file diamond.shape, iterating two times.
  9211. # The file diamond.shape may contain a pattern of characters like this
  9212. # *
  9213. # ***
  9214. # *****
  9215. # ***
  9216. # *
  9217. # The specified columns and rows are ignored
  9218. # but the anchor point coordinates are not
  9219. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9220. @end example
  9221. @subsection erode
  9222. Erode an image by using a specific structuring element.
  9223. It corresponds to the libopencv function @code{cvErode}.
  9224. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9225. with the same syntax and semantics as the @ref{dilate} filter.
  9226. @subsection smooth
  9227. Smooth the input video.
  9228. The filter takes the following parameters:
  9229. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9230. @var{type} is the type of smooth filter to apply, and must be one of
  9231. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9232. or "bilateral". The default value is "gaussian".
  9233. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9234. depend on the smooth type. @var{param1} and
  9235. @var{param2} accept integer positive values or 0. @var{param3} and
  9236. @var{param4} accept floating point values.
  9237. The default value for @var{param1} is 3. The default value for the
  9238. other parameters is 0.
  9239. These parameters correspond to the parameters assigned to the
  9240. libopencv function @code{cvSmooth}.
  9241. @section oscilloscope
  9242. 2D Video Oscilloscope.
  9243. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9244. It accepts the following parameters:
  9245. @table @option
  9246. @item x
  9247. Set scope center x position.
  9248. @item y
  9249. Set scope center y position.
  9250. @item s
  9251. Set scope size, relative to frame diagonal.
  9252. @item t
  9253. Set scope tilt/rotation.
  9254. @item o
  9255. Set trace opacity.
  9256. @item tx
  9257. Set trace center x position.
  9258. @item ty
  9259. Set trace center y position.
  9260. @item tw
  9261. Set trace width, relative to width of frame.
  9262. @item th
  9263. Set trace height, relative to height of frame.
  9264. @item c
  9265. Set which components to trace. By default it traces first three components.
  9266. @item g
  9267. Draw trace grid. By default is enabled.
  9268. @item st
  9269. Draw some statistics. By default is enabled.
  9270. @item sc
  9271. Draw scope. By default is enabled.
  9272. @end table
  9273. @subsection Examples
  9274. @itemize
  9275. @item
  9276. Inspect full first row of video frame.
  9277. @example
  9278. oscilloscope=x=0.5:y=0:s=1
  9279. @end example
  9280. @item
  9281. Inspect full last row of video frame.
  9282. @example
  9283. oscilloscope=x=0.5:y=1:s=1
  9284. @end example
  9285. @item
  9286. Inspect full 5th line of video frame of height 1080.
  9287. @example
  9288. oscilloscope=x=0.5:y=5/1080:s=1
  9289. @end example
  9290. @item
  9291. Inspect full last column of video frame.
  9292. @example
  9293. oscilloscope=x=1:y=0.5:s=1:t=1
  9294. @end example
  9295. @end itemize
  9296. @anchor{overlay}
  9297. @section overlay
  9298. Overlay one video on top of another.
  9299. It takes two inputs and has one output. The first input is the "main"
  9300. video on which the second input is overlaid.
  9301. It accepts the following parameters:
  9302. A description of the accepted options follows.
  9303. @table @option
  9304. @item x
  9305. @item y
  9306. Set the expression for the x and y coordinates of the overlaid video
  9307. on the main video. Default value is "0" for both expressions. In case
  9308. the expression is invalid, it is set to a huge value (meaning that the
  9309. overlay will not be displayed within the output visible area).
  9310. @item eof_action
  9311. See @ref{framesync}.
  9312. @item eval
  9313. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9314. It accepts the following values:
  9315. @table @samp
  9316. @item init
  9317. only evaluate expressions once during the filter initialization or
  9318. when a command is processed
  9319. @item frame
  9320. evaluate expressions for each incoming frame
  9321. @end table
  9322. Default value is @samp{frame}.
  9323. @item shortest
  9324. See @ref{framesync}.
  9325. @item format
  9326. Set the format for the output video.
  9327. It accepts the following values:
  9328. @table @samp
  9329. @item yuv420
  9330. force YUV420 output
  9331. @item yuv422
  9332. force YUV422 output
  9333. @item yuv444
  9334. force YUV444 output
  9335. @item rgb
  9336. force packed RGB output
  9337. @item gbrp
  9338. force planar RGB output
  9339. @item auto
  9340. automatically pick format
  9341. @end table
  9342. Default value is @samp{yuv420}.
  9343. @item repeatlast
  9344. See @ref{framesync}.
  9345. @item alpha
  9346. Set format of alpha of the overlaid video, it can be @var{straight} or
  9347. @var{premultiplied}. Default is @var{straight}.
  9348. @end table
  9349. The @option{x}, and @option{y} expressions can contain the following
  9350. parameters.
  9351. @table @option
  9352. @item main_w, W
  9353. @item main_h, H
  9354. The main input width and height.
  9355. @item overlay_w, w
  9356. @item overlay_h, h
  9357. The overlay input width and height.
  9358. @item x
  9359. @item y
  9360. The computed values for @var{x} and @var{y}. They are evaluated for
  9361. each new frame.
  9362. @item hsub
  9363. @item vsub
  9364. horizontal and vertical chroma subsample values of the output
  9365. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9366. @var{vsub} is 1.
  9367. @item n
  9368. the number of input frame, starting from 0
  9369. @item pos
  9370. the position in the file of the input frame, NAN if unknown
  9371. @item t
  9372. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9373. @end table
  9374. This filter also supports the @ref{framesync} options.
  9375. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9376. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9377. when @option{eval} is set to @samp{init}.
  9378. Be aware that frames are taken from each input video in timestamp
  9379. order, hence, if their initial timestamps differ, it is a good idea
  9380. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9381. have them begin in the same zero timestamp, as the example for
  9382. the @var{movie} filter does.
  9383. You can chain together more overlays but you should test the
  9384. efficiency of such approach.
  9385. @subsection Commands
  9386. This filter supports the following commands:
  9387. @table @option
  9388. @item x
  9389. @item y
  9390. Modify the x and y of the overlay input.
  9391. The command accepts the same syntax of the corresponding option.
  9392. If the specified expression is not valid, it is kept at its current
  9393. value.
  9394. @end table
  9395. @subsection Examples
  9396. @itemize
  9397. @item
  9398. Draw the overlay at 10 pixels from the bottom right corner of the main
  9399. video:
  9400. @example
  9401. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9402. @end example
  9403. Using named options the example above becomes:
  9404. @example
  9405. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9406. @end example
  9407. @item
  9408. Insert a transparent PNG logo in the bottom left corner of the input,
  9409. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9410. @example
  9411. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9412. @end example
  9413. @item
  9414. Insert 2 different transparent PNG logos (second logo on bottom
  9415. right corner) using the @command{ffmpeg} tool:
  9416. @example
  9417. 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
  9418. @end example
  9419. @item
  9420. Add a transparent color layer on top of the main video; @code{WxH}
  9421. must specify the size of the main input to the overlay filter:
  9422. @example
  9423. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9424. @end example
  9425. @item
  9426. Play an original video and a filtered version (here with the deshake
  9427. filter) side by side using the @command{ffplay} tool:
  9428. @example
  9429. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9430. @end example
  9431. The above command is the same as:
  9432. @example
  9433. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9434. @end example
  9435. @item
  9436. Make a sliding overlay appearing from the left to the right top part of the
  9437. screen starting since time 2:
  9438. @example
  9439. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9440. @end example
  9441. @item
  9442. Compose output by putting two input videos side to side:
  9443. @example
  9444. ffmpeg -i left.avi -i right.avi -filter_complex "
  9445. nullsrc=size=200x100 [background];
  9446. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9447. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9448. [background][left] overlay=shortest=1 [background+left];
  9449. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9450. "
  9451. @end example
  9452. @item
  9453. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9454. @example
  9455. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9456. -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]'
  9457. masked.avi
  9458. @end example
  9459. @item
  9460. Chain several overlays in cascade:
  9461. @example
  9462. nullsrc=s=200x200 [bg];
  9463. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9464. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9465. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9466. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9467. [in3] null, [mid2] overlay=100:100 [out0]
  9468. @end example
  9469. @end itemize
  9470. @section owdenoise
  9471. Apply Overcomplete Wavelet denoiser.
  9472. The filter accepts the following options:
  9473. @table @option
  9474. @item depth
  9475. Set depth.
  9476. Larger depth values will denoise lower frequency components more, but
  9477. slow down filtering.
  9478. Must be an int in the range 8-16, default is @code{8}.
  9479. @item luma_strength, ls
  9480. Set luma strength.
  9481. Must be a double value in the range 0-1000, default is @code{1.0}.
  9482. @item chroma_strength, cs
  9483. Set chroma strength.
  9484. Must be a double value in the range 0-1000, default is @code{1.0}.
  9485. @end table
  9486. @anchor{pad}
  9487. @section pad
  9488. Add paddings to the input image, and place the original input at the
  9489. provided @var{x}, @var{y} coordinates.
  9490. It accepts the following parameters:
  9491. @table @option
  9492. @item width, w
  9493. @item height, h
  9494. Specify an expression for the size of the output image with the
  9495. paddings added. If the value for @var{width} or @var{height} is 0, the
  9496. corresponding input size is used for the output.
  9497. The @var{width} expression can reference the value set by the
  9498. @var{height} expression, and vice versa.
  9499. The default value of @var{width} and @var{height} is 0.
  9500. @item x
  9501. @item y
  9502. Specify the offsets to place the input image at within the padded area,
  9503. with respect to the top/left border of the output image.
  9504. The @var{x} expression can reference the value set by the @var{y}
  9505. expression, and vice versa.
  9506. The default value of @var{x} and @var{y} is 0.
  9507. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9508. so the input image is centered on the padded area.
  9509. @item color
  9510. Specify the color of the padded area. For the syntax of this option,
  9511. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9512. manual,ffmpeg-utils}.
  9513. The default value of @var{color} is "black".
  9514. @item eval
  9515. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9516. It accepts the following values:
  9517. @table @samp
  9518. @item init
  9519. Only evaluate expressions once during the filter initialization or when
  9520. a command is processed.
  9521. @item frame
  9522. Evaluate expressions for each incoming frame.
  9523. @end table
  9524. Default value is @samp{init}.
  9525. @item aspect
  9526. Pad to aspect instead to a resolution.
  9527. @end table
  9528. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9529. options are expressions containing the following constants:
  9530. @table @option
  9531. @item in_w
  9532. @item in_h
  9533. The input video width and height.
  9534. @item iw
  9535. @item ih
  9536. These are the same as @var{in_w} and @var{in_h}.
  9537. @item out_w
  9538. @item out_h
  9539. The output width and height (the size of the padded area), as
  9540. specified by the @var{width} and @var{height} expressions.
  9541. @item ow
  9542. @item oh
  9543. These are the same as @var{out_w} and @var{out_h}.
  9544. @item x
  9545. @item y
  9546. The x and y offsets as specified by the @var{x} and @var{y}
  9547. expressions, or NAN if not yet specified.
  9548. @item a
  9549. same as @var{iw} / @var{ih}
  9550. @item sar
  9551. input sample aspect ratio
  9552. @item dar
  9553. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9554. @item hsub
  9555. @item vsub
  9556. The horizontal and vertical chroma subsample values. For example for the
  9557. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9558. @end table
  9559. @subsection Examples
  9560. @itemize
  9561. @item
  9562. Add paddings with the color "violet" to the input video. The output video
  9563. size is 640x480, and the top-left corner of the input video is placed at
  9564. column 0, row 40
  9565. @example
  9566. pad=640:480:0:40:violet
  9567. @end example
  9568. The example above is equivalent to the following command:
  9569. @example
  9570. pad=width=640:height=480:x=0:y=40:color=violet
  9571. @end example
  9572. @item
  9573. Pad the input to get an output with dimensions increased by 3/2,
  9574. and put the input video at the center of the padded area:
  9575. @example
  9576. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9577. @end example
  9578. @item
  9579. Pad the input to get a squared output with size equal to the maximum
  9580. value between the input width and height, and put the input video at
  9581. the center of the padded area:
  9582. @example
  9583. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9584. @end example
  9585. @item
  9586. Pad the input to get a final w/h ratio of 16:9:
  9587. @example
  9588. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9589. @end example
  9590. @item
  9591. In case of anamorphic video, in order to set the output display aspect
  9592. correctly, it is necessary to use @var{sar} in the expression,
  9593. according to the relation:
  9594. @example
  9595. (ih * X / ih) * sar = output_dar
  9596. X = output_dar / sar
  9597. @end example
  9598. Thus the previous example needs to be modified to:
  9599. @example
  9600. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9601. @end example
  9602. @item
  9603. Double the output size and put the input video in the bottom-right
  9604. corner of the output padded area:
  9605. @example
  9606. pad="2*iw:2*ih:ow-iw:oh-ih"
  9607. @end example
  9608. @end itemize
  9609. @anchor{palettegen}
  9610. @section palettegen
  9611. Generate one palette for a whole video stream.
  9612. It accepts the following options:
  9613. @table @option
  9614. @item max_colors
  9615. Set the maximum number of colors to quantize in the palette.
  9616. Note: the palette will still contain 256 colors; the unused palette entries
  9617. will be black.
  9618. @item reserve_transparent
  9619. Create a palette of 255 colors maximum and reserve the last one for
  9620. transparency. Reserving the transparency color is useful for GIF optimization.
  9621. If not set, the maximum of colors in the palette will be 256. You probably want
  9622. to disable this option for a standalone image.
  9623. Set by default.
  9624. @item transparency_color
  9625. Set the color that will be used as background for transparency.
  9626. @item stats_mode
  9627. Set statistics mode.
  9628. It accepts the following values:
  9629. @table @samp
  9630. @item full
  9631. Compute full frame histograms.
  9632. @item diff
  9633. Compute histograms only for the part that differs from previous frame. This
  9634. might be relevant to give more importance to the moving part of your input if
  9635. the background is static.
  9636. @item single
  9637. Compute new histogram for each frame.
  9638. @end table
  9639. Default value is @var{full}.
  9640. @end table
  9641. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9642. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9643. color quantization of the palette. This information is also visible at
  9644. @var{info} logging level.
  9645. @subsection Examples
  9646. @itemize
  9647. @item
  9648. Generate a representative palette of a given video using @command{ffmpeg}:
  9649. @example
  9650. ffmpeg -i input.mkv -vf palettegen palette.png
  9651. @end example
  9652. @end itemize
  9653. @section paletteuse
  9654. Use a palette to downsample an input video stream.
  9655. The filter takes two inputs: one video stream and a palette. The palette must
  9656. be a 256 pixels image.
  9657. It accepts the following options:
  9658. @table @option
  9659. @item dither
  9660. Select dithering mode. Available algorithms are:
  9661. @table @samp
  9662. @item bayer
  9663. Ordered 8x8 bayer dithering (deterministic)
  9664. @item heckbert
  9665. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9666. Note: this dithering is sometimes considered "wrong" and is included as a
  9667. reference.
  9668. @item floyd_steinberg
  9669. Floyd and Steingberg dithering (error diffusion)
  9670. @item sierra2
  9671. Frankie Sierra dithering v2 (error diffusion)
  9672. @item sierra2_4a
  9673. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9674. @end table
  9675. Default is @var{sierra2_4a}.
  9676. @item bayer_scale
  9677. When @var{bayer} dithering is selected, this option defines the scale of the
  9678. pattern (how much the crosshatch pattern is visible). A low value means more
  9679. visible pattern for less banding, and higher value means less visible pattern
  9680. at the cost of more banding.
  9681. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9682. @item diff_mode
  9683. If set, define the zone to process
  9684. @table @samp
  9685. @item rectangle
  9686. Only the changing rectangle will be reprocessed. This is similar to GIF
  9687. cropping/offsetting compression mechanism. This option can be useful for speed
  9688. if only a part of the image is changing, and has use cases such as limiting the
  9689. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9690. moving scene (it leads to more deterministic output if the scene doesn't change
  9691. much, and as a result less moving noise and better GIF compression).
  9692. @end table
  9693. Default is @var{none}.
  9694. @item new
  9695. Take new palette for each output frame.
  9696. @item alpha_threshold
  9697. Sets the alpha threshold for transparency. Alpha values above this threshold
  9698. will be treated as completely opaque, and values below this threshold will be
  9699. treated as completely transparent.
  9700. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9701. @end table
  9702. @subsection Examples
  9703. @itemize
  9704. @item
  9705. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9706. using @command{ffmpeg}:
  9707. @example
  9708. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9709. @end example
  9710. @end itemize
  9711. @section perspective
  9712. Correct perspective of video not recorded perpendicular to the screen.
  9713. A description of the accepted parameters follows.
  9714. @table @option
  9715. @item x0
  9716. @item y0
  9717. @item x1
  9718. @item y1
  9719. @item x2
  9720. @item y2
  9721. @item x3
  9722. @item y3
  9723. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9724. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9725. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9726. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9727. then the corners of the source will be sent to the specified coordinates.
  9728. The expressions can use the following variables:
  9729. @table @option
  9730. @item W
  9731. @item H
  9732. the width and height of video frame.
  9733. @item in
  9734. Input frame count.
  9735. @item on
  9736. Output frame count.
  9737. @end table
  9738. @item interpolation
  9739. Set interpolation for perspective correction.
  9740. It accepts the following values:
  9741. @table @samp
  9742. @item linear
  9743. @item cubic
  9744. @end table
  9745. Default value is @samp{linear}.
  9746. @item sense
  9747. Set interpretation of coordinate options.
  9748. It accepts the following values:
  9749. @table @samp
  9750. @item 0, source
  9751. Send point in the source specified by the given coordinates to
  9752. the corners of the destination.
  9753. @item 1, destination
  9754. Send the corners of the source to the point in the destination specified
  9755. by the given coordinates.
  9756. Default value is @samp{source}.
  9757. @end table
  9758. @item eval
  9759. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9760. It accepts the following values:
  9761. @table @samp
  9762. @item init
  9763. only evaluate expressions once during the filter initialization or
  9764. when a command is processed
  9765. @item frame
  9766. evaluate expressions for each incoming frame
  9767. @end table
  9768. Default value is @samp{init}.
  9769. @end table
  9770. @section phase
  9771. Delay interlaced video by one field time so that the field order changes.
  9772. The intended use is to fix PAL movies that have been captured with the
  9773. opposite field order to the film-to-video transfer.
  9774. A description of the accepted parameters follows.
  9775. @table @option
  9776. @item mode
  9777. Set phase mode.
  9778. It accepts the following values:
  9779. @table @samp
  9780. @item t
  9781. Capture field order top-first, transfer bottom-first.
  9782. Filter will delay the bottom field.
  9783. @item b
  9784. Capture field order bottom-first, transfer top-first.
  9785. Filter will delay the top field.
  9786. @item p
  9787. Capture and transfer with the same field order. This mode only exists
  9788. for the documentation of the other options to refer to, but if you
  9789. actually select it, the filter will faithfully do nothing.
  9790. @item a
  9791. Capture field order determined automatically by field flags, transfer
  9792. opposite.
  9793. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9794. basis using field flags. If no field information is available,
  9795. then this works just like @samp{u}.
  9796. @item u
  9797. Capture unknown or varying, transfer opposite.
  9798. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9799. analyzing the images and selecting the alternative that produces best
  9800. match between the fields.
  9801. @item T
  9802. Capture top-first, transfer unknown or varying.
  9803. Filter selects among @samp{t} and @samp{p} using image analysis.
  9804. @item B
  9805. Capture bottom-first, transfer unknown or varying.
  9806. Filter selects among @samp{b} and @samp{p} using image analysis.
  9807. @item A
  9808. Capture determined by field flags, transfer unknown or varying.
  9809. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9810. image analysis. If no field information is available, then this works just
  9811. like @samp{U}. This is the default mode.
  9812. @item U
  9813. Both capture and transfer unknown or varying.
  9814. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9815. @end table
  9816. @end table
  9817. @section pixdesctest
  9818. Pixel format descriptor test filter, mainly useful for internal
  9819. testing. The output video should be equal to the input video.
  9820. For example:
  9821. @example
  9822. format=monow, pixdesctest
  9823. @end example
  9824. can be used to test the monowhite pixel format descriptor definition.
  9825. @section pixscope
  9826. Display sample values of color channels. Mainly useful for checking color
  9827. and levels. Minimum supported resolution is 640x480.
  9828. The filters accept the following options:
  9829. @table @option
  9830. @item x
  9831. Set scope X position, relative offset on X axis.
  9832. @item y
  9833. Set scope Y position, relative offset on Y axis.
  9834. @item w
  9835. Set scope width.
  9836. @item h
  9837. Set scope height.
  9838. @item o
  9839. Set window opacity. This window also holds statistics about pixel area.
  9840. @item wx
  9841. Set window X position, relative offset on X axis.
  9842. @item wy
  9843. Set window Y position, relative offset on Y axis.
  9844. @end table
  9845. @section pp
  9846. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9847. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9848. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9849. Each subfilter and some options have a short and a long name that can be used
  9850. interchangeably, i.e. dr/dering are the same.
  9851. The filters accept the following options:
  9852. @table @option
  9853. @item subfilters
  9854. Set postprocessing subfilters string.
  9855. @end table
  9856. All subfilters share common options to determine their scope:
  9857. @table @option
  9858. @item a/autoq
  9859. Honor the quality commands for this subfilter.
  9860. @item c/chrom
  9861. Do chrominance filtering, too (default).
  9862. @item y/nochrom
  9863. Do luminance filtering only (no chrominance).
  9864. @item n/noluma
  9865. Do chrominance filtering only (no luminance).
  9866. @end table
  9867. These options can be appended after the subfilter name, separated by a '|'.
  9868. Available subfilters are:
  9869. @table @option
  9870. @item hb/hdeblock[|difference[|flatness]]
  9871. Horizontal deblocking filter
  9872. @table @option
  9873. @item difference
  9874. Difference factor where higher values mean more deblocking (default: @code{32}).
  9875. @item flatness
  9876. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9877. @end table
  9878. @item vb/vdeblock[|difference[|flatness]]
  9879. Vertical deblocking filter
  9880. @table @option
  9881. @item difference
  9882. Difference factor where higher values mean more deblocking (default: @code{32}).
  9883. @item flatness
  9884. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9885. @end table
  9886. @item ha/hadeblock[|difference[|flatness]]
  9887. Accurate horizontal deblocking filter
  9888. @table @option
  9889. @item difference
  9890. Difference factor where higher values mean more deblocking (default: @code{32}).
  9891. @item flatness
  9892. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9893. @end table
  9894. @item va/vadeblock[|difference[|flatness]]
  9895. Accurate vertical deblocking filter
  9896. @table @option
  9897. @item difference
  9898. Difference factor where higher values mean more deblocking (default: @code{32}).
  9899. @item flatness
  9900. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9901. @end table
  9902. @end table
  9903. The horizontal and vertical deblocking filters share the difference and
  9904. flatness values so you cannot set different horizontal and vertical
  9905. thresholds.
  9906. @table @option
  9907. @item h1/x1hdeblock
  9908. Experimental horizontal deblocking filter
  9909. @item v1/x1vdeblock
  9910. Experimental vertical deblocking filter
  9911. @item dr/dering
  9912. Deringing filter
  9913. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9914. @table @option
  9915. @item threshold1
  9916. larger -> stronger filtering
  9917. @item threshold2
  9918. larger -> stronger filtering
  9919. @item threshold3
  9920. larger -> stronger filtering
  9921. @end table
  9922. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9923. @table @option
  9924. @item f/fullyrange
  9925. Stretch luminance to @code{0-255}.
  9926. @end table
  9927. @item lb/linblenddeint
  9928. Linear blend deinterlacing filter that deinterlaces the given block by
  9929. filtering all lines with a @code{(1 2 1)} filter.
  9930. @item li/linipoldeint
  9931. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9932. linearly interpolating every second line.
  9933. @item ci/cubicipoldeint
  9934. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9935. cubically interpolating every second line.
  9936. @item md/mediandeint
  9937. Median deinterlacing filter that deinterlaces the given block by applying a
  9938. median filter to every second line.
  9939. @item fd/ffmpegdeint
  9940. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9941. second line with a @code{(-1 4 2 4 -1)} filter.
  9942. @item l5/lowpass5
  9943. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9944. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9945. @item fq/forceQuant[|quantizer]
  9946. Overrides the quantizer table from the input with the constant quantizer you
  9947. specify.
  9948. @table @option
  9949. @item quantizer
  9950. Quantizer to use
  9951. @end table
  9952. @item de/default
  9953. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9954. @item fa/fast
  9955. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9956. @item ac
  9957. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9958. @end table
  9959. @subsection Examples
  9960. @itemize
  9961. @item
  9962. Apply horizontal and vertical deblocking, deringing and automatic
  9963. brightness/contrast:
  9964. @example
  9965. pp=hb/vb/dr/al
  9966. @end example
  9967. @item
  9968. Apply default filters without brightness/contrast correction:
  9969. @example
  9970. pp=de/-al
  9971. @end example
  9972. @item
  9973. Apply default filters and temporal denoiser:
  9974. @example
  9975. pp=default/tmpnoise|1|2|3
  9976. @end example
  9977. @item
  9978. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9979. automatically depending on available CPU time:
  9980. @example
  9981. pp=hb|y/vb|a
  9982. @end example
  9983. @end itemize
  9984. @section pp7
  9985. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9986. similar to spp = 6 with 7 point DCT, where only the center sample is
  9987. used after IDCT.
  9988. The filter accepts the following options:
  9989. @table @option
  9990. @item qp
  9991. Force a constant quantization parameter. It accepts an integer in range
  9992. 0 to 63. If not set, the filter will use the QP from the video stream
  9993. (if available).
  9994. @item mode
  9995. Set thresholding mode. Available modes are:
  9996. @table @samp
  9997. @item hard
  9998. Set hard thresholding.
  9999. @item soft
  10000. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10001. @item medium
  10002. Set medium thresholding (good results, default).
  10003. @end table
  10004. @end table
  10005. @section premultiply
  10006. Apply alpha premultiply effect to input video stream using first plane
  10007. of second stream as alpha.
  10008. Both streams must have same dimensions and same pixel format.
  10009. The filter accepts the following option:
  10010. @table @option
  10011. @item planes
  10012. Set which planes will be processed, unprocessed planes will be copied.
  10013. By default value 0xf, all planes will be processed.
  10014. @item inplace
  10015. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10016. @end table
  10017. @section prewitt
  10018. Apply prewitt operator to input video stream.
  10019. The filter accepts the following option:
  10020. @table @option
  10021. @item planes
  10022. Set which planes will be processed, unprocessed planes will be copied.
  10023. By default value 0xf, all planes will be processed.
  10024. @item scale
  10025. Set value which will be multiplied with filtered result.
  10026. @item delta
  10027. Set value which will be added to filtered result.
  10028. @end table
  10029. @anchor{program_opencl}
  10030. @section program_opencl
  10031. Filter video using an OpenCL program.
  10032. @table @option
  10033. @item source
  10034. OpenCL program source file.
  10035. @item kernel
  10036. Kernel name in program.
  10037. @item inputs
  10038. Number of inputs to the filter. Defaults to 1.
  10039. @item size, s
  10040. Size of output frames. Defaults to the same as the first input.
  10041. @end table
  10042. The program source file must contain a kernel function with the given name,
  10043. which will be run once for each plane of the output. Each run on a plane
  10044. gets enqueued as a separate 2D global NDRange with one work-item for each
  10045. pixel to be generated. The global ID offset for each work-item is therefore
  10046. the coordinates of a pixel in the destination image.
  10047. The kernel function needs to take the following arguments:
  10048. @itemize
  10049. @item
  10050. Destination image, @var{__write_only image2d_t}.
  10051. This image will become the output; the kernel should write all of it.
  10052. @item
  10053. Frame index, @var{unsigned int}.
  10054. This is a counter starting from zero and increasing by one for each frame.
  10055. @item
  10056. Source images, @var{__read_only image2d_t}.
  10057. These are the most recent images on each input. The kernel may read from
  10058. them to generate the output, but they can't be written to.
  10059. @end itemize
  10060. Example programs:
  10061. @itemize
  10062. @item
  10063. Copy the input to the output (output must be the same size as the input).
  10064. @verbatim
  10065. __kernel void copy(__write_only image2d_t destination,
  10066. unsigned int index,
  10067. __read_only image2d_t source)
  10068. {
  10069. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10070. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10071. float4 value = read_imagef(source, sampler, location);
  10072. write_imagef(destination, location, value);
  10073. }
  10074. @end verbatim
  10075. @item
  10076. Apply a simple transformation, rotating the input by an amount increasing
  10077. with the index counter. Pixel values are linearly interpolated by the
  10078. sampler, and the output need not have the same dimensions as the input.
  10079. @verbatim
  10080. __kernel void rotate_image(__write_only image2d_t dst,
  10081. unsigned int index,
  10082. __read_only image2d_t src)
  10083. {
  10084. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10085. CLK_FILTER_LINEAR);
  10086. float angle = (float)index / 100.0f;
  10087. float2 dst_dim = convert_float2(get_image_dim(dst));
  10088. float2 src_dim = convert_float2(get_image_dim(src));
  10089. float2 dst_cen = dst_dim / 2.0f;
  10090. float2 src_cen = src_dim / 2.0f;
  10091. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10092. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10093. float2 src_pos = {
  10094. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10095. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10096. };
  10097. src_pos = src_pos * src_dim / dst_dim;
  10098. float2 src_loc = src_pos + src_cen;
  10099. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10100. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10101. write_imagef(dst, dst_loc, 0.5f);
  10102. else
  10103. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10104. }
  10105. @end verbatim
  10106. @item
  10107. Blend two inputs together, with the amount of each input used varying
  10108. with the index counter.
  10109. @verbatim
  10110. __kernel void blend_images(__write_only image2d_t dst,
  10111. unsigned int index,
  10112. __read_only image2d_t src1,
  10113. __read_only image2d_t src2)
  10114. {
  10115. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10116. CLK_FILTER_LINEAR);
  10117. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10118. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10119. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10120. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10121. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10122. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10123. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10124. }
  10125. @end verbatim
  10126. @end itemize
  10127. @section pseudocolor
  10128. Alter frame colors in video with pseudocolors.
  10129. This filter accept the following options:
  10130. @table @option
  10131. @item c0
  10132. set pixel first component expression
  10133. @item c1
  10134. set pixel second component expression
  10135. @item c2
  10136. set pixel third component expression
  10137. @item c3
  10138. set pixel fourth component expression, corresponds to the alpha component
  10139. @item i
  10140. set component to use as base for altering colors
  10141. @end table
  10142. Each of them specifies the expression to use for computing the lookup table for
  10143. the corresponding pixel component values.
  10144. The expressions can contain the following constants and functions:
  10145. @table @option
  10146. @item w
  10147. @item h
  10148. The input width and height.
  10149. @item val
  10150. The input value for the pixel component.
  10151. @item ymin, umin, vmin, amin
  10152. The minimum allowed component value.
  10153. @item ymax, umax, vmax, amax
  10154. The maximum allowed component value.
  10155. @end table
  10156. All expressions default to "val".
  10157. @subsection Examples
  10158. @itemize
  10159. @item
  10160. Change too high luma values to gradient:
  10161. @example
  10162. 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'"
  10163. @end example
  10164. @end itemize
  10165. @section psnr
  10166. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10167. Ratio) between two input videos.
  10168. This filter takes in input two input videos, the first input is
  10169. considered the "main" source and is passed unchanged to the
  10170. output. The second input is used as a "reference" video for computing
  10171. the PSNR.
  10172. Both video inputs must have the same resolution and pixel format for
  10173. this filter to work correctly. Also it assumes that both inputs
  10174. have the same number of frames, which are compared one by one.
  10175. The obtained average PSNR is printed through the logging system.
  10176. The filter stores the accumulated MSE (mean squared error) of each
  10177. frame, and at the end of the processing it is averaged across all frames
  10178. equally, and the following formula is applied to obtain the PSNR:
  10179. @example
  10180. PSNR = 10*log10(MAX^2/MSE)
  10181. @end example
  10182. Where MAX is the average of the maximum values of each component of the
  10183. image.
  10184. The description of the accepted parameters follows.
  10185. @table @option
  10186. @item stats_file, f
  10187. If specified the filter will use the named file to save the PSNR of
  10188. each individual frame. When filename equals "-" the data is sent to
  10189. standard output.
  10190. @item stats_version
  10191. Specifies which version of the stats file format to use. Details of
  10192. each format are written below.
  10193. Default value is 1.
  10194. @item stats_add_max
  10195. Determines whether the max value is output to the stats log.
  10196. Default value is 0.
  10197. Requires stats_version >= 2. If this is set and stats_version < 2,
  10198. the filter will return an error.
  10199. @end table
  10200. This filter also supports the @ref{framesync} options.
  10201. The file printed if @var{stats_file} is selected, contains a sequence of
  10202. key/value pairs of the form @var{key}:@var{value} for each compared
  10203. couple of frames.
  10204. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10205. the list of per-frame-pair stats, with key value pairs following the frame
  10206. format with the following parameters:
  10207. @table @option
  10208. @item psnr_log_version
  10209. The version of the log file format. Will match @var{stats_version}.
  10210. @item fields
  10211. A comma separated list of the per-frame-pair parameters included in
  10212. the log.
  10213. @end table
  10214. A description of each shown per-frame-pair parameter follows:
  10215. @table @option
  10216. @item n
  10217. sequential number of the input frame, starting from 1
  10218. @item mse_avg
  10219. Mean Square Error pixel-by-pixel average difference of the compared
  10220. frames, averaged over all the image components.
  10221. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10222. Mean Square Error pixel-by-pixel average difference of the compared
  10223. frames for the component specified by the suffix.
  10224. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10225. Peak Signal to Noise ratio of the compared frames for the component
  10226. specified by the suffix.
  10227. @item max_avg, max_y, max_u, max_v
  10228. Maximum allowed value for each channel, and average over all
  10229. channels.
  10230. @end table
  10231. For example:
  10232. @example
  10233. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10234. [main][ref] psnr="stats_file=stats.log" [out]
  10235. @end example
  10236. On this example the input file being processed is compared with the
  10237. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10238. is stored in @file{stats.log}.
  10239. @anchor{pullup}
  10240. @section pullup
  10241. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10242. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10243. content.
  10244. The pullup filter is designed to take advantage of future context in making
  10245. its decisions. This filter is stateless in the sense that it does not lock
  10246. onto a pattern to follow, but it instead looks forward to the following
  10247. fields in order to identify matches and rebuild progressive frames.
  10248. To produce content with an even framerate, insert the fps filter after
  10249. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10250. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10251. The filter accepts the following options:
  10252. @table @option
  10253. @item jl
  10254. @item jr
  10255. @item jt
  10256. @item jb
  10257. These options set the amount of "junk" to ignore at the left, right, top, and
  10258. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10259. while top and bottom are in units of 2 lines.
  10260. The default is 8 pixels on each side.
  10261. @item sb
  10262. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10263. filter generating an occasional mismatched frame, but it may also cause an
  10264. excessive number of frames to be dropped during high motion sequences.
  10265. Conversely, setting it to -1 will make filter match fields more easily.
  10266. This may help processing of video where there is slight blurring between
  10267. the fields, but may also cause there to be interlaced frames in the output.
  10268. Default value is @code{0}.
  10269. @item mp
  10270. Set the metric plane to use. It accepts the following values:
  10271. @table @samp
  10272. @item l
  10273. Use luma plane.
  10274. @item u
  10275. Use chroma blue plane.
  10276. @item v
  10277. Use chroma red plane.
  10278. @end table
  10279. This option may be set to use chroma plane instead of the default luma plane
  10280. for doing filter's computations. This may improve accuracy on very clean
  10281. source material, but more likely will decrease accuracy, especially if there
  10282. is chroma noise (rainbow effect) or any grayscale video.
  10283. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10284. load and make pullup usable in realtime on slow machines.
  10285. @end table
  10286. For best results (without duplicated frames in the output file) it is
  10287. necessary to change the output frame rate. For example, to inverse
  10288. telecine NTSC input:
  10289. @example
  10290. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10291. @end example
  10292. @section qp
  10293. Change video quantization parameters (QP).
  10294. The filter accepts the following option:
  10295. @table @option
  10296. @item qp
  10297. Set expression for quantization parameter.
  10298. @end table
  10299. The expression is evaluated through the eval API and can contain, among others,
  10300. the following constants:
  10301. @table @var
  10302. @item known
  10303. 1 if index is not 129, 0 otherwise.
  10304. @item qp
  10305. Sequential index starting from -129 to 128.
  10306. @end table
  10307. @subsection Examples
  10308. @itemize
  10309. @item
  10310. Some equation like:
  10311. @example
  10312. qp=2+2*sin(PI*qp)
  10313. @end example
  10314. @end itemize
  10315. @section random
  10316. Flush video frames from internal cache of frames into a random order.
  10317. No frame is discarded.
  10318. Inspired by @ref{frei0r} nervous filter.
  10319. @table @option
  10320. @item frames
  10321. Set size in number of frames of internal cache, in range from @code{2} to
  10322. @code{512}. Default is @code{30}.
  10323. @item seed
  10324. Set seed for random number generator, must be an integer included between
  10325. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10326. less than @code{0}, the filter will try to use a good random seed on a
  10327. best effort basis.
  10328. @end table
  10329. @section readeia608
  10330. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10331. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10332. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10333. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10334. @table @option
  10335. @item lavfi.readeia608.X.cc
  10336. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10337. @item lavfi.readeia608.X.line
  10338. The number of the line on which the EIA-608 data was identified and read.
  10339. @end table
  10340. This filter accepts the following options:
  10341. @table @option
  10342. @item scan_min
  10343. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10344. @item scan_max
  10345. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10346. @item mac
  10347. Set minimal acceptable amplitude change for sync codes detection.
  10348. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10349. @item spw
  10350. Set the ratio of width reserved for sync code detection.
  10351. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10352. @item mhd
  10353. Set the max peaks height difference for sync code detection.
  10354. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10355. @item mpd
  10356. Set max peaks period difference for sync code detection.
  10357. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10358. @item msd
  10359. Set the first two max start code bits differences.
  10360. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10361. @item bhd
  10362. Set the minimum ratio of bits height compared to 3rd start code bit.
  10363. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10364. @item th_w
  10365. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10366. @item th_b
  10367. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10368. @item chp
  10369. Enable checking the parity bit. In the event of a parity error, the filter will output
  10370. @code{0x00} for that character. Default is false.
  10371. @end table
  10372. @subsection Examples
  10373. @itemize
  10374. @item
  10375. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10376. @example
  10377. 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
  10378. @end example
  10379. @end itemize
  10380. @section readvitc
  10381. Read vertical interval timecode (VITC) information from the top lines of a
  10382. video frame.
  10383. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10384. timecode value, if a valid timecode has been detected. Further metadata key
  10385. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10386. timecode data has been found or not.
  10387. This filter accepts the following options:
  10388. @table @option
  10389. @item scan_max
  10390. Set the maximum number of lines to scan for VITC data. If the value is set to
  10391. @code{-1} the full video frame is scanned. Default is @code{45}.
  10392. @item thr_b
  10393. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10394. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10395. @item thr_w
  10396. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10397. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10398. @end table
  10399. @subsection Examples
  10400. @itemize
  10401. @item
  10402. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10403. draw @code{--:--:--:--} as a placeholder:
  10404. @example
  10405. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10406. @end example
  10407. @end itemize
  10408. @section remap
  10409. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10410. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10411. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10412. value for pixel will be used for destination pixel.
  10413. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10414. will have Xmap/Ymap video stream dimensions.
  10415. Xmap and Ymap input video streams are 16bit depth, single channel.
  10416. @section removegrain
  10417. The removegrain filter is a spatial denoiser for progressive video.
  10418. @table @option
  10419. @item m0
  10420. Set mode for the first plane.
  10421. @item m1
  10422. Set mode for the second plane.
  10423. @item m2
  10424. Set mode for the third plane.
  10425. @item m3
  10426. Set mode for the fourth plane.
  10427. @end table
  10428. Range of mode is from 0 to 24. Description of each mode follows:
  10429. @table @var
  10430. @item 0
  10431. Leave input plane unchanged. Default.
  10432. @item 1
  10433. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10434. @item 2
  10435. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10436. @item 3
  10437. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10438. @item 4
  10439. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10440. This is equivalent to a median filter.
  10441. @item 5
  10442. Line-sensitive clipping giving the minimal change.
  10443. @item 6
  10444. Line-sensitive clipping, intermediate.
  10445. @item 7
  10446. Line-sensitive clipping, intermediate.
  10447. @item 8
  10448. Line-sensitive clipping, intermediate.
  10449. @item 9
  10450. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10451. @item 10
  10452. Replaces the target pixel with the closest neighbour.
  10453. @item 11
  10454. [1 2 1] horizontal and vertical kernel blur.
  10455. @item 12
  10456. Same as mode 11.
  10457. @item 13
  10458. Bob mode, interpolates top field from the line where the neighbours
  10459. pixels are the closest.
  10460. @item 14
  10461. Bob mode, interpolates bottom field from the line where the neighbours
  10462. pixels are the closest.
  10463. @item 15
  10464. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10465. interpolation formula.
  10466. @item 16
  10467. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10468. interpolation formula.
  10469. @item 17
  10470. Clips the pixel with the minimum and maximum of respectively the maximum and
  10471. minimum of each pair of opposite neighbour pixels.
  10472. @item 18
  10473. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10474. the current pixel is minimal.
  10475. @item 19
  10476. Replaces the pixel with the average of its 8 neighbours.
  10477. @item 20
  10478. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10479. @item 21
  10480. Clips pixels using the averages of opposite neighbour.
  10481. @item 22
  10482. Same as mode 21 but simpler and faster.
  10483. @item 23
  10484. Small edge and halo removal, but reputed useless.
  10485. @item 24
  10486. Similar as 23.
  10487. @end table
  10488. @section removelogo
  10489. Suppress a TV station logo, using an image file to determine which
  10490. pixels comprise the logo. It works by filling in the pixels that
  10491. comprise the logo with neighboring pixels.
  10492. The filter accepts the following options:
  10493. @table @option
  10494. @item filename, f
  10495. Set the filter bitmap file, which can be any image format supported by
  10496. libavformat. The width and height of the image file must match those of the
  10497. video stream being processed.
  10498. @end table
  10499. Pixels in the provided bitmap image with a value of zero are not
  10500. considered part of the logo, non-zero pixels are considered part of
  10501. the logo. If you use white (255) for the logo and black (0) for the
  10502. rest, you will be safe. For making the filter bitmap, it is
  10503. recommended to take a screen capture of a black frame with the logo
  10504. visible, and then using a threshold filter followed by the erode
  10505. filter once or twice.
  10506. If needed, little splotches can be fixed manually. Remember that if
  10507. logo pixels are not covered, the filter quality will be much
  10508. reduced. Marking too many pixels as part of the logo does not hurt as
  10509. much, but it will increase the amount of blurring needed to cover over
  10510. the image and will destroy more information than necessary, and extra
  10511. pixels will slow things down on a large logo.
  10512. @section repeatfields
  10513. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10514. fields based on its value.
  10515. @section reverse
  10516. Reverse a video clip.
  10517. Warning: This filter requires memory to buffer the entire clip, so trimming
  10518. is suggested.
  10519. @subsection Examples
  10520. @itemize
  10521. @item
  10522. Take the first 5 seconds of a clip, and reverse it.
  10523. @example
  10524. trim=end=5,reverse
  10525. @end example
  10526. @end itemize
  10527. @section roberts
  10528. Apply roberts cross operator to input video stream.
  10529. The filter accepts the following option:
  10530. @table @option
  10531. @item planes
  10532. Set which planes will be processed, unprocessed planes will be copied.
  10533. By default value 0xf, all planes will be processed.
  10534. @item scale
  10535. Set value which will be multiplied with filtered result.
  10536. @item delta
  10537. Set value which will be added to filtered result.
  10538. @end table
  10539. @section rotate
  10540. Rotate video by an arbitrary angle expressed in radians.
  10541. The filter accepts the following options:
  10542. A description of the optional parameters follows.
  10543. @table @option
  10544. @item angle, a
  10545. Set an expression for the angle by which to rotate the input video
  10546. clockwise, expressed as a number of radians. A negative value will
  10547. result in a counter-clockwise rotation. By default it is set to "0".
  10548. This expression is evaluated for each frame.
  10549. @item out_w, ow
  10550. Set the output width expression, default value is "iw".
  10551. This expression is evaluated just once during configuration.
  10552. @item out_h, oh
  10553. Set the output height expression, default value is "ih".
  10554. This expression is evaluated just once during configuration.
  10555. @item bilinear
  10556. Enable bilinear interpolation if set to 1, a value of 0 disables
  10557. it. Default value is 1.
  10558. @item fillcolor, c
  10559. Set the color used to fill the output area not covered by the rotated
  10560. image. For the general syntax of this option, check the
  10561. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10562. If the special value "none" is selected then no
  10563. background is printed (useful for example if the background is never shown).
  10564. Default value is "black".
  10565. @end table
  10566. The expressions for the angle and the output size can contain the
  10567. following constants and functions:
  10568. @table @option
  10569. @item n
  10570. sequential number of the input frame, starting from 0. It is always NAN
  10571. before the first frame is filtered.
  10572. @item t
  10573. time in seconds of the input frame, it is set to 0 when the filter is
  10574. configured. It is always NAN before the first frame is filtered.
  10575. @item hsub
  10576. @item vsub
  10577. horizontal and vertical chroma subsample values. For example for the
  10578. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10579. @item in_w, iw
  10580. @item in_h, ih
  10581. the input video width and height
  10582. @item out_w, ow
  10583. @item out_h, oh
  10584. the output width and height, that is the size of the padded area as
  10585. specified by the @var{width} and @var{height} expressions
  10586. @item rotw(a)
  10587. @item roth(a)
  10588. the minimal width/height required for completely containing the input
  10589. video rotated by @var{a} radians.
  10590. These are only available when computing the @option{out_w} and
  10591. @option{out_h} expressions.
  10592. @end table
  10593. @subsection Examples
  10594. @itemize
  10595. @item
  10596. Rotate the input by PI/6 radians clockwise:
  10597. @example
  10598. rotate=PI/6
  10599. @end example
  10600. @item
  10601. Rotate the input by PI/6 radians counter-clockwise:
  10602. @example
  10603. rotate=-PI/6
  10604. @end example
  10605. @item
  10606. Rotate the input by 45 degrees clockwise:
  10607. @example
  10608. rotate=45*PI/180
  10609. @end example
  10610. @item
  10611. Apply a constant rotation with period T, starting from an angle of PI/3:
  10612. @example
  10613. rotate=PI/3+2*PI*t/T
  10614. @end example
  10615. @item
  10616. Make the input video rotation oscillating with a period of T
  10617. seconds and an amplitude of A radians:
  10618. @example
  10619. rotate=A*sin(2*PI/T*t)
  10620. @end example
  10621. @item
  10622. Rotate the video, output size is chosen so that the whole rotating
  10623. input video is always completely contained in the output:
  10624. @example
  10625. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10626. @end example
  10627. @item
  10628. Rotate the video, reduce the output size so that no background is ever
  10629. shown:
  10630. @example
  10631. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10632. @end example
  10633. @end itemize
  10634. @subsection Commands
  10635. The filter supports the following commands:
  10636. @table @option
  10637. @item a, angle
  10638. Set the angle expression.
  10639. The command accepts the same syntax of the corresponding option.
  10640. If the specified expression is not valid, it is kept at its current
  10641. value.
  10642. @end table
  10643. @section sab
  10644. Apply Shape Adaptive Blur.
  10645. The filter accepts the following options:
  10646. @table @option
  10647. @item luma_radius, lr
  10648. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10649. value is 1.0. A greater value will result in a more blurred image, and
  10650. in slower processing.
  10651. @item luma_pre_filter_radius, lpfr
  10652. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10653. value is 1.0.
  10654. @item luma_strength, ls
  10655. Set luma maximum difference between pixels to still be considered, must
  10656. be a value in the 0.1-100.0 range, default value is 1.0.
  10657. @item chroma_radius, cr
  10658. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10659. greater value will result in a more blurred image, and in slower
  10660. processing.
  10661. @item chroma_pre_filter_radius, cpfr
  10662. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10663. @item chroma_strength, cs
  10664. Set chroma maximum difference between pixels to still be considered,
  10665. must be a value in the -0.9-100.0 range.
  10666. @end table
  10667. Each chroma option value, if not explicitly specified, is set to the
  10668. corresponding luma option value.
  10669. @anchor{scale}
  10670. @section scale
  10671. Scale (resize) the input video, using the libswscale library.
  10672. The scale filter forces the output display aspect ratio to be the same
  10673. of the input, by changing the output sample aspect ratio.
  10674. If the input image format is different from the format requested by
  10675. the next filter, the scale filter will convert the input to the
  10676. requested format.
  10677. @subsection Options
  10678. The filter accepts the following options, or any of the options
  10679. supported by the libswscale scaler.
  10680. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10681. the complete list of scaler options.
  10682. @table @option
  10683. @item width, w
  10684. @item height, h
  10685. Set the output video dimension expression. Default value is the input
  10686. dimension.
  10687. If the @var{width} or @var{w} value is 0, the input width is used for
  10688. the output. If the @var{height} or @var{h} value is 0, the input height
  10689. is used for the output.
  10690. If one and only one of the values is -n with n >= 1, the scale filter
  10691. will use a value that maintains the aspect ratio of the input image,
  10692. calculated from the other specified dimension. After that it will,
  10693. however, make sure that the calculated dimension is divisible by n and
  10694. adjust the value if necessary.
  10695. If both values are -n with n >= 1, the behavior will be identical to
  10696. both values being set to 0 as previously detailed.
  10697. See below for the list of accepted constants for use in the dimension
  10698. expression.
  10699. @item eval
  10700. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10701. @table @samp
  10702. @item init
  10703. Only evaluate expressions once during the filter initialization or when a command is processed.
  10704. @item frame
  10705. Evaluate expressions for each incoming frame.
  10706. @end table
  10707. Default value is @samp{init}.
  10708. @item interl
  10709. Set the interlacing mode. It accepts the following values:
  10710. @table @samp
  10711. @item 1
  10712. Force interlaced aware scaling.
  10713. @item 0
  10714. Do not apply interlaced scaling.
  10715. @item -1
  10716. Select interlaced aware scaling depending on whether the source frames
  10717. are flagged as interlaced or not.
  10718. @end table
  10719. Default value is @samp{0}.
  10720. @item flags
  10721. Set libswscale scaling flags. See
  10722. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10723. complete list of values. If not explicitly specified the filter applies
  10724. the default flags.
  10725. @item param0, param1
  10726. Set libswscale input parameters for scaling algorithms that need them. See
  10727. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10728. complete documentation. If not explicitly specified the filter applies
  10729. empty parameters.
  10730. @item size, s
  10731. Set the video size. For the syntax of this option, check the
  10732. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10733. @item in_color_matrix
  10734. @item out_color_matrix
  10735. Set in/output YCbCr color space type.
  10736. This allows the autodetected value to be overridden as well as allows forcing
  10737. a specific value used for the output and encoder.
  10738. If not specified, the color space type depends on the pixel format.
  10739. Possible values:
  10740. @table @samp
  10741. @item auto
  10742. Choose automatically.
  10743. @item bt709
  10744. Format conforming to International Telecommunication Union (ITU)
  10745. Recommendation BT.709.
  10746. @item fcc
  10747. Set color space conforming to the United States Federal Communications
  10748. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10749. @item bt601
  10750. Set color space conforming to:
  10751. @itemize
  10752. @item
  10753. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10754. @item
  10755. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10756. @item
  10757. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10758. @end itemize
  10759. @item smpte240m
  10760. Set color space conforming to SMPTE ST 240:1999.
  10761. @end table
  10762. @item in_range
  10763. @item out_range
  10764. Set in/output YCbCr sample range.
  10765. This allows the autodetected value to be overridden as well as allows forcing
  10766. a specific value used for the output and encoder. If not specified, the
  10767. range depends on the pixel format. Possible values:
  10768. @table @samp
  10769. @item auto/unknown
  10770. Choose automatically.
  10771. @item jpeg/full/pc
  10772. Set full range (0-255 in case of 8-bit luma).
  10773. @item mpeg/limited/tv
  10774. Set "MPEG" range (16-235 in case of 8-bit luma).
  10775. @end table
  10776. @item force_original_aspect_ratio
  10777. Enable decreasing or increasing output video width or height if necessary to
  10778. keep the original aspect ratio. Possible values:
  10779. @table @samp
  10780. @item disable
  10781. Scale the video as specified and disable this feature.
  10782. @item decrease
  10783. The output video dimensions will automatically be decreased if needed.
  10784. @item increase
  10785. The output video dimensions will automatically be increased if needed.
  10786. @end table
  10787. One useful instance of this option is that when you know a specific device's
  10788. maximum allowed resolution, you can use this to limit the output video to
  10789. that, while retaining the aspect ratio. For example, device A allows
  10790. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10791. decrease) and specifying 1280x720 to the command line makes the output
  10792. 1280x533.
  10793. Please note that this is a different thing than specifying -1 for @option{w}
  10794. or @option{h}, you still need to specify the output resolution for this option
  10795. to work.
  10796. @end table
  10797. The values of the @option{w} and @option{h} options are expressions
  10798. containing the following constants:
  10799. @table @var
  10800. @item in_w
  10801. @item in_h
  10802. The input width and height
  10803. @item iw
  10804. @item ih
  10805. These are the same as @var{in_w} and @var{in_h}.
  10806. @item out_w
  10807. @item out_h
  10808. The output (scaled) width and height
  10809. @item ow
  10810. @item oh
  10811. These are the same as @var{out_w} and @var{out_h}
  10812. @item a
  10813. The same as @var{iw} / @var{ih}
  10814. @item sar
  10815. input sample aspect ratio
  10816. @item dar
  10817. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10818. @item hsub
  10819. @item vsub
  10820. horizontal and vertical input chroma subsample values. For example for the
  10821. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10822. @item ohsub
  10823. @item ovsub
  10824. horizontal and vertical output chroma subsample values. For example for the
  10825. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10826. @end table
  10827. @subsection Examples
  10828. @itemize
  10829. @item
  10830. Scale the input video to a size of 200x100
  10831. @example
  10832. scale=w=200:h=100
  10833. @end example
  10834. This is equivalent to:
  10835. @example
  10836. scale=200:100
  10837. @end example
  10838. or:
  10839. @example
  10840. scale=200x100
  10841. @end example
  10842. @item
  10843. Specify a size abbreviation for the output size:
  10844. @example
  10845. scale=qcif
  10846. @end example
  10847. which can also be written as:
  10848. @example
  10849. scale=size=qcif
  10850. @end example
  10851. @item
  10852. Scale the input to 2x:
  10853. @example
  10854. scale=w=2*iw:h=2*ih
  10855. @end example
  10856. @item
  10857. The above is the same as:
  10858. @example
  10859. scale=2*in_w:2*in_h
  10860. @end example
  10861. @item
  10862. Scale the input to 2x with forced interlaced scaling:
  10863. @example
  10864. scale=2*iw:2*ih:interl=1
  10865. @end example
  10866. @item
  10867. Scale the input to half size:
  10868. @example
  10869. scale=w=iw/2:h=ih/2
  10870. @end example
  10871. @item
  10872. Increase the width, and set the height to the same size:
  10873. @example
  10874. scale=3/2*iw:ow
  10875. @end example
  10876. @item
  10877. Seek Greek harmony:
  10878. @example
  10879. scale=iw:1/PHI*iw
  10880. scale=ih*PHI:ih
  10881. @end example
  10882. @item
  10883. Increase the height, and set the width to 3/2 of the height:
  10884. @example
  10885. scale=w=3/2*oh:h=3/5*ih
  10886. @end example
  10887. @item
  10888. Increase the size, making the size a multiple of the chroma
  10889. subsample values:
  10890. @example
  10891. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10892. @end example
  10893. @item
  10894. Increase the width to a maximum of 500 pixels,
  10895. keeping the same aspect ratio as the input:
  10896. @example
  10897. scale=w='min(500\, iw*3/2):h=-1'
  10898. @end example
  10899. @item
  10900. Make pixels square by combining scale and setsar:
  10901. @example
  10902. scale='trunc(ih*dar):ih',setsar=1/1
  10903. @end example
  10904. @item
  10905. Make pixels square by combining scale and setsar,
  10906. making sure the resulting resolution is even (required by some codecs):
  10907. @example
  10908. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10909. @end example
  10910. @end itemize
  10911. @subsection Commands
  10912. This filter supports the following commands:
  10913. @table @option
  10914. @item width, w
  10915. @item height, h
  10916. Set the output video dimension expression.
  10917. The command accepts the same syntax of the corresponding option.
  10918. If the specified expression is not valid, it is kept at its current
  10919. value.
  10920. @end table
  10921. @section scale_npp
  10922. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10923. format conversion on CUDA video frames. Setting the output width and height
  10924. works in the same way as for the @var{scale} filter.
  10925. The following additional options are accepted:
  10926. @table @option
  10927. @item format
  10928. The pixel format of the output CUDA frames. If set to the string "same" (the
  10929. default), the input format will be kept. Note that automatic format negotiation
  10930. and conversion is not yet supported for hardware frames
  10931. @item interp_algo
  10932. The interpolation algorithm used for resizing. One of the following:
  10933. @table @option
  10934. @item nn
  10935. Nearest neighbour.
  10936. @item linear
  10937. @item cubic
  10938. @item cubic2p_bspline
  10939. 2-parameter cubic (B=1, C=0)
  10940. @item cubic2p_catmullrom
  10941. 2-parameter cubic (B=0, C=1/2)
  10942. @item cubic2p_b05c03
  10943. 2-parameter cubic (B=1/2, C=3/10)
  10944. @item super
  10945. Supersampling
  10946. @item lanczos
  10947. @end table
  10948. @end table
  10949. @section scale2ref
  10950. Scale (resize) the input video, based on a reference video.
  10951. See the scale filter for available options, scale2ref supports the same but
  10952. uses the reference video instead of the main input as basis. scale2ref also
  10953. supports the following additional constants for the @option{w} and
  10954. @option{h} options:
  10955. @table @var
  10956. @item main_w
  10957. @item main_h
  10958. The main input video's width and height
  10959. @item main_a
  10960. The same as @var{main_w} / @var{main_h}
  10961. @item main_sar
  10962. The main input video's sample aspect ratio
  10963. @item main_dar, mdar
  10964. The main input video's display aspect ratio. Calculated from
  10965. @code{(main_w / main_h) * main_sar}.
  10966. @item main_hsub
  10967. @item main_vsub
  10968. The main input video's horizontal and vertical chroma subsample values.
  10969. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10970. is 1.
  10971. @end table
  10972. @subsection Examples
  10973. @itemize
  10974. @item
  10975. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10976. @example
  10977. 'scale2ref[b][a];[a][b]overlay'
  10978. @end example
  10979. @end itemize
  10980. @anchor{selectivecolor}
  10981. @section selectivecolor
  10982. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10983. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10984. by the "purity" of the color (that is, how saturated it already is).
  10985. This filter is similar to the Adobe Photoshop Selective Color tool.
  10986. The filter accepts the following options:
  10987. @table @option
  10988. @item correction_method
  10989. Select color correction method.
  10990. Available values are:
  10991. @table @samp
  10992. @item absolute
  10993. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10994. component value).
  10995. @item relative
  10996. Specified adjustments are relative to the original component value.
  10997. @end table
  10998. Default is @code{absolute}.
  10999. @item reds
  11000. Adjustments for red pixels (pixels where the red component is the maximum)
  11001. @item yellows
  11002. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11003. @item greens
  11004. Adjustments for green pixels (pixels where the green component is the maximum)
  11005. @item cyans
  11006. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11007. @item blues
  11008. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11009. @item magentas
  11010. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11011. @item whites
  11012. Adjustments for white pixels (pixels where all components are greater than 128)
  11013. @item neutrals
  11014. Adjustments for all pixels except pure black and pure white
  11015. @item blacks
  11016. Adjustments for black pixels (pixels where all components are lesser than 128)
  11017. @item psfile
  11018. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11019. @end table
  11020. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11021. 4 space separated floating point adjustment values in the [-1,1] range,
  11022. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11023. pixels of its range.
  11024. @subsection Examples
  11025. @itemize
  11026. @item
  11027. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11028. increase magenta by 27% in blue areas:
  11029. @example
  11030. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11031. @end example
  11032. @item
  11033. Use a Photoshop selective color preset:
  11034. @example
  11035. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11036. @end example
  11037. @end itemize
  11038. @anchor{separatefields}
  11039. @section separatefields
  11040. The @code{separatefields} takes a frame-based video input and splits
  11041. each frame into its components fields, producing a new half height clip
  11042. with twice the frame rate and twice the frame count.
  11043. This filter use field-dominance information in frame to decide which
  11044. of each pair of fields to place first in the output.
  11045. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11046. @section setdar, setsar
  11047. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11048. output video.
  11049. This is done by changing the specified Sample (aka Pixel) Aspect
  11050. Ratio, according to the following equation:
  11051. @example
  11052. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11053. @end example
  11054. Keep in mind that the @code{setdar} filter does not modify the pixel
  11055. dimensions of the video frame. Also, the display aspect ratio set by
  11056. this filter may be changed by later filters in the filterchain,
  11057. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11058. applied.
  11059. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11060. the filter output video.
  11061. Note that as a consequence of the application of this filter, the
  11062. output display aspect ratio will change according to the equation
  11063. above.
  11064. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11065. filter may be changed by later filters in the filterchain, e.g. if
  11066. another "setsar" or a "setdar" filter is applied.
  11067. It accepts the following parameters:
  11068. @table @option
  11069. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11070. Set the aspect ratio used by the filter.
  11071. The parameter can be a floating point number string, an expression, or
  11072. a string of the form @var{num}:@var{den}, where @var{num} and
  11073. @var{den} are the numerator and denominator of the aspect ratio. If
  11074. the parameter is not specified, it is assumed the value "0".
  11075. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11076. should be escaped.
  11077. @item max
  11078. Set the maximum integer value to use for expressing numerator and
  11079. denominator when reducing the expressed aspect ratio to a rational.
  11080. Default value is @code{100}.
  11081. @end table
  11082. The parameter @var{sar} is an expression containing
  11083. the following constants:
  11084. @table @option
  11085. @item E, PI, PHI
  11086. These are approximated values for the mathematical constants e
  11087. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11088. @item w, h
  11089. The input width and height.
  11090. @item a
  11091. These are the same as @var{w} / @var{h}.
  11092. @item sar
  11093. The input sample aspect ratio.
  11094. @item dar
  11095. The input display aspect ratio. It is the same as
  11096. (@var{w} / @var{h}) * @var{sar}.
  11097. @item hsub, vsub
  11098. Horizontal and vertical chroma subsample values. For example, for the
  11099. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11100. @end table
  11101. @subsection Examples
  11102. @itemize
  11103. @item
  11104. To change the display aspect ratio to 16:9, specify one of the following:
  11105. @example
  11106. setdar=dar=1.77777
  11107. setdar=dar=16/9
  11108. @end example
  11109. @item
  11110. To change the sample aspect ratio to 10:11, specify:
  11111. @example
  11112. setsar=sar=10/11
  11113. @end example
  11114. @item
  11115. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11116. 1000 in the aspect ratio reduction, use the command:
  11117. @example
  11118. setdar=ratio=16/9:max=1000
  11119. @end example
  11120. @end itemize
  11121. @anchor{setfield}
  11122. @section setfield
  11123. Force field for the output video frame.
  11124. The @code{setfield} filter marks the interlace type field for the
  11125. output frames. It does not change the input frame, but only sets the
  11126. corresponding property, which affects how the frame is treated by
  11127. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11128. The filter accepts the following options:
  11129. @table @option
  11130. @item mode
  11131. Available values are:
  11132. @table @samp
  11133. @item auto
  11134. Keep the same field property.
  11135. @item bff
  11136. Mark the frame as bottom-field-first.
  11137. @item tff
  11138. Mark the frame as top-field-first.
  11139. @item prog
  11140. Mark the frame as progressive.
  11141. @end table
  11142. @end table
  11143. @section showinfo
  11144. Show a line containing various information for each input video frame.
  11145. The input video is not modified.
  11146. The shown line contains a sequence of key/value pairs of the form
  11147. @var{key}:@var{value}.
  11148. The following values are shown in the output:
  11149. @table @option
  11150. @item n
  11151. The (sequential) number of the input frame, starting from 0.
  11152. @item pts
  11153. The Presentation TimeStamp of the input frame, expressed as a number of
  11154. time base units. The time base unit depends on the filter input pad.
  11155. @item pts_time
  11156. The Presentation TimeStamp of the input frame, expressed as a number of
  11157. seconds.
  11158. @item pos
  11159. The position of the frame in the input stream, or -1 if this information is
  11160. unavailable and/or meaningless (for example in case of synthetic video).
  11161. @item fmt
  11162. The pixel format name.
  11163. @item sar
  11164. The sample aspect ratio of the input frame, expressed in the form
  11165. @var{num}/@var{den}.
  11166. @item s
  11167. The size of the input frame. For the syntax of this option, check the
  11168. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11169. @item i
  11170. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11171. for bottom field first).
  11172. @item iskey
  11173. This is 1 if the frame is a key frame, 0 otherwise.
  11174. @item type
  11175. The picture type of the input frame ("I" for an I-frame, "P" for a
  11176. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11177. Also refer to the documentation of the @code{AVPictureType} enum and of
  11178. the @code{av_get_picture_type_char} function defined in
  11179. @file{libavutil/avutil.h}.
  11180. @item checksum
  11181. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11182. @item plane_checksum
  11183. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11184. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11185. @end table
  11186. @section showpalette
  11187. Displays the 256 colors palette of each frame. This filter is only relevant for
  11188. @var{pal8} pixel format frames.
  11189. It accepts the following option:
  11190. @table @option
  11191. @item s
  11192. Set the size of the box used to represent one palette color entry. Default is
  11193. @code{30} (for a @code{30x30} pixel box).
  11194. @end table
  11195. @section shuffleframes
  11196. Reorder and/or duplicate and/or drop video frames.
  11197. It accepts the following parameters:
  11198. @table @option
  11199. @item mapping
  11200. Set the destination indexes of input frames.
  11201. This is space or '|' separated list of indexes that maps input frames to output
  11202. frames. Number of indexes also sets maximal value that each index may have.
  11203. '-1' index have special meaning and that is to drop frame.
  11204. @end table
  11205. The first frame has the index 0. The default is to keep the input unchanged.
  11206. @subsection Examples
  11207. @itemize
  11208. @item
  11209. Swap second and third frame of every three frames of the input:
  11210. @example
  11211. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11212. @end example
  11213. @item
  11214. Swap 10th and 1st frame of every ten frames of the input:
  11215. @example
  11216. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11217. @end example
  11218. @end itemize
  11219. @section shuffleplanes
  11220. Reorder and/or duplicate video planes.
  11221. It accepts the following parameters:
  11222. @table @option
  11223. @item map0
  11224. The index of the input plane to be used as the first output plane.
  11225. @item map1
  11226. The index of the input plane to be used as the second output plane.
  11227. @item map2
  11228. The index of the input plane to be used as the third output plane.
  11229. @item map3
  11230. The index of the input plane to be used as the fourth output plane.
  11231. @end table
  11232. The first plane has the index 0. The default is to keep the input unchanged.
  11233. @subsection Examples
  11234. @itemize
  11235. @item
  11236. Swap the second and third planes of the input:
  11237. @example
  11238. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11239. @end example
  11240. @end itemize
  11241. @anchor{signalstats}
  11242. @section signalstats
  11243. Evaluate various visual metrics that assist in determining issues associated
  11244. with the digitization of analog video media.
  11245. By default the filter will log these metadata values:
  11246. @table @option
  11247. @item YMIN
  11248. Display the minimal Y value contained within the input frame. Expressed in
  11249. range of [0-255].
  11250. @item YLOW
  11251. Display the Y value at the 10% percentile within the input frame. Expressed in
  11252. range of [0-255].
  11253. @item YAVG
  11254. Display the average Y value within the input frame. Expressed in range of
  11255. [0-255].
  11256. @item YHIGH
  11257. Display the Y value at the 90% percentile within the input frame. Expressed in
  11258. range of [0-255].
  11259. @item YMAX
  11260. Display the maximum Y value contained within the input frame. Expressed in
  11261. range of [0-255].
  11262. @item UMIN
  11263. Display the minimal U value contained within the input frame. Expressed in
  11264. range of [0-255].
  11265. @item ULOW
  11266. Display the U value at the 10% percentile within the input frame. Expressed in
  11267. range of [0-255].
  11268. @item UAVG
  11269. Display the average U value within the input frame. Expressed in range of
  11270. [0-255].
  11271. @item UHIGH
  11272. Display the U value at the 90% percentile within the input frame. Expressed in
  11273. range of [0-255].
  11274. @item UMAX
  11275. Display the maximum U value contained within the input frame. Expressed in
  11276. range of [0-255].
  11277. @item VMIN
  11278. Display the minimal V value contained within the input frame. Expressed in
  11279. range of [0-255].
  11280. @item VLOW
  11281. Display the V value at the 10% percentile within the input frame. Expressed in
  11282. range of [0-255].
  11283. @item VAVG
  11284. Display the average V value within the input frame. Expressed in range of
  11285. [0-255].
  11286. @item VHIGH
  11287. Display the V value at the 90% percentile within the input frame. Expressed in
  11288. range of [0-255].
  11289. @item VMAX
  11290. Display the maximum V value contained within the input frame. Expressed in
  11291. range of [0-255].
  11292. @item SATMIN
  11293. Display the minimal saturation value contained within the input frame.
  11294. Expressed in range of [0-~181.02].
  11295. @item SATLOW
  11296. Display the saturation value at the 10% percentile within the input frame.
  11297. Expressed in range of [0-~181.02].
  11298. @item SATAVG
  11299. Display the average saturation value within the input frame. Expressed in range
  11300. of [0-~181.02].
  11301. @item SATHIGH
  11302. Display the saturation value at the 90% percentile within the input frame.
  11303. Expressed in range of [0-~181.02].
  11304. @item SATMAX
  11305. Display the maximum saturation value contained within the input frame.
  11306. Expressed in range of [0-~181.02].
  11307. @item HUEMED
  11308. Display the median value for hue within the input frame. Expressed in range of
  11309. [0-360].
  11310. @item HUEAVG
  11311. Display the average value for hue within the input frame. Expressed in range of
  11312. [0-360].
  11313. @item YDIF
  11314. Display the average of sample value difference between all values of the Y
  11315. plane in the current frame and corresponding values of the previous input frame.
  11316. Expressed in range of [0-255].
  11317. @item UDIF
  11318. Display the average of sample value difference between all values of the U
  11319. plane in the current frame and corresponding values of the previous input frame.
  11320. Expressed in range of [0-255].
  11321. @item VDIF
  11322. Display the average of sample value difference between all values of the V
  11323. plane in the current frame and corresponding values of the previous input frame.
  11324. Expressed in range of [0-255].
  11325. @item YBITDEPTH
  11326. Display bit depth of Y plane in current frame.
  11327. Expressed in range of [0-16].
  11328. @item UBITDEPTH
  11329. Display bit depth of U plane in current frame.
  11330. Expressed in range of [0-16].
  11331. @item VBITDEPTH
  11332. Display bit depth of V plane in current frame.
  11333. Expressed in range of [0-16].
  11334. @end table
  11335. The filter accepts the following options:
  11336. @table @option
  11337. @item stat
  11338. @item out
  11339. @option{stat} specify an additional form of image analysis.
  11340. @option{out} output video with the specified type of pixel highlighted.
  11341. Both options accept the following values:
  11342. @table @samp
  11343. @item tout
  11344. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11345. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11346. include the results of video dropouts, head clogs, or tape tracking issues.
  11347. @item vrep
  11348. Identify @var{vertical line repetition}. Vertical line repetition includes
  11349. similar rows of pixels within a frame. In born-digital video vertical line
  11350. repetition is common, but this pattern is uncommon in video digitized from an
  11351. analog source. When it occurs in video that results from the digitization of an
  11352. analog source it can indicate concealment from a dropout compensator.
  11353. @item brng
  11354. Identify pixels that fall outside of legal broadcast range.
  11355. @end table
  11356. @item color, c
  11357. Set the highlight color for the @option{out} option. The default color is
  11358. yellow.
  11359. @end table
  11360. @subsection Examples
  11361. @itemize
  11362. @item
  11363. Output data of various video metrics:
  11364. @example
  11365. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11366. @end example
  11367. @item
  11368. Output specific data about the minimum and maximum values of the Y plane per frame:
  11369. @example
  11370. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11371. @end example
  11372. @item
  11373. Playback video while highlighting pixels that are outside of broadcast range in red.
  11374. @example
  11375. ffplay example.mov -vf signalstats="out=brng:color=red"
  11376. @end example
  11377. @item
  11378. Playback video with signalstats metadata drawn over the frame.
  11379. @example
  11380. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11381. @end example
  11382. The contents of signalstat_drawtext.txt used in the command are:
  11383. @example
  11384. time %@{pts:hms@}
  11385. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11386. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11387. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11388. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11389. @end example
  11390. @end itemize
  11391. @anchor{signature}
  11392. @section signature
  11393. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11394. input. In this case the matching between the inputs can be calculated additionally.
  11395. The filter always passes through the first input. The signature of each stream can
  11396. be written into a file.
  11397. It accepts the following options:
  11398. @table @option
  11399. @item detectmode
  11400. Enable or disable the matching process.
  11401. Available values are:
  11402. @table @samp
  11403. @item off
  11404. Disable the calculation of a matching (default).
  11405. @item full
  11406. Calculate the matching for the whole video and output whether the whole video
  11407. matches or only parts.
  11408. @item fast
  11409. Calculate only until a matching is found or the video ends. Should be faster in
  11410. some cases.
  11411. @end table
  11412. @item nb_inputs
  11413. Set the number of inputs. The option value must be a non negative integer.
  11414. Default value is 1.
  11415. @item filename
  11416. Set the path to which the output is written. If there is more than one input,
  11417. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11418. integer), that will be replaced with the input number. If no filename is
  11419. specified, no output will be written. This is the default.
  11420. @item format
  11421. Choose the output format.
  11422. Available values are:
  11423. @table @samp
  11424. @item binary
  11425. Use the specified binary representation (default).
  11426. @item xml
  11427. Use the specified xml representation.
  11428. @end table
  11429. @item th_d
  11430. Set threshold to detect one word as similar. The option value must be an integer
  11431. greater than zero. The default value is 9000.
  11432. @item th_dc
  11433. Set threshold to detect all words as similar. The option value must be an integer
  11434. greater than zero. The default value is 60000.
  11435. @item th_xh
  11436. Set threshold to detect frames as similar. The option value must be an integer
  11437. greater than zero. The default value is 116.
  11438. @item th_di
  11439. Set the minimum length of a sequence in frames to recognize it as matching
  11440. sequence. The option value must be a non negative integer value.
  11441. The default value is 0.
  11442. @item th_it
  11443. Set the minimum relation, that matching frames to all frames must have.
  11444. The option value must be a double value between 0 and 1. The default value is 0.5.
  11445. @end table
  11446. @subsection Examples
  11447. @itemize
  11448. @item
  11449. To calculate the signature of an input video and store it in signature.bin:
  11450. @example
  11451. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11452. @end example
  11453. @item
  11454. To detect whether two videos match and store the signatures in XML format in
  11455. signature0.xml and signature1.xml:
  11456. @example
  11457. 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 -
  11458. @end example
  11459. @end itemize
  11460. @anchor{smartblur}
  11461. @section smartblur
  11462. Blur the input video without impacting the outlines.
  11463. It accepts the following options:
  11464. @table @option
  11465. @item luma_radius, lr
  11466. Set the luma radius. The option value must be a float number in
  11467. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11468. used to blur the image (slower if larger). Default value is 1.0.
  11469. @item luma_strength, ls
  11470. Set the luma strength. The option value must be a float number
  11471. in the range [-1.0,1.0] that configures the blurring. A value included
  11472. in [0.0,1.0] will blur the image whereas a value included in
  11473. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11474. @item luma_threshold, lt
  11475. Set the luma threshold used as a coefficient to determine
  11476. whether a pixel should be blurred or not. The option value must be an
  11477. integer in the range [-30,30]. A value of 0 will filter all the image,
  11478. a value included in [0,30] will filter flat areas and a value included
  11479. in [-30,0] will filter edges. Default value is 0.
  11480. @item chroma_radius, cr
  11481. Set the chroma radius. The option value must be a float number in
  11482. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11483. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11484. @item chroma_strength, cs
  11485. Set the chroma strength. The option value must be a float number
  11486. in the range [-1.0,1.0] that configures the blurring. A value included
  11487. in [0.0,1.0] will blur the image whereas a value included in
  11488. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11489. @item chroma_threshold, ct
  11490. Set the chroma threshold used as a coefficient to determine
  11491. whether a pixel should be blurred or not. The option value must be an
  11492. integer in the range [-30,30]. A value of 0 will filter all the image,
  11493. a value included in [0,30] will filter flat areas and a value included
  11494. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11495. @end table
  11496. If a chroma option is not explicitly set, the corresponding luma value
  11497. is set.
  11498. @section ssim
  11499. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11500. This filter takes in input two input videos, the first input is
  11501. considered the "main" source and is passed unchanged to the
  11502. output. The second input is used as a "reference" video for computing
  11503. the SSIM.
  11504. Both video inputs must have the same resolution and pixel format for
  11505. this filter to work correctly. Also it assumes that both inputs
  11506. have the same number of frames, which are compared one by one.
  11507. The filter stores the calculated SSIM of each frame.
  11508. The description of the accepted parameters follows.
  11509. @table @option
  11510. @item stats_file, f
  11511. If specified the filter will use the named file to save the SSIM of
  11512. each individual frame. When filename equals "-" the data is sent to
  11513. standard output.
  11514. @end table
  11515. The file printed if @var{stats_file} is selected, contains a sequence of
  11516. key/value pairs of the form @var{key}:@var{value} for each compared
  11517. couple of frames.
  11518. A description of each shown parameter follows:
  11519. @table @option
  11520. @item n
  11521. sequential number of the input frame, starting from 1
  11522. @item Y, U, V, R, G, B
  11523. SSIM of the compared frames for the component specified by the suffix.
  11524. @item All
  11525. SSIM of the compared frames for the whole frame.
  11526. @item dB
  11527. Same as above but in dB representation.
  11528. @end table
  11529. This filter also supports the @ref{framesync} options.
  11530. For example:
  11531. @example
  11532. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11533. [main][ref] ssim="stats_file=stats.log" [out]
  11534. @end example
  11535. On this example the input file being processed is compared with the
  11536. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11537. is stored in @file{stats.log}.
  11538. Another example with both psnr and ssim at same time:
  11539. @example
  11540. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11541. @end example
  11542. @section stereo3d
  11543. Convert between different stereoscopic image formats.
  11544. The filters accept the following options:
  11545. @table @option
  11546. @item in
  11547. Set stereoscopic image format of input.
  11548. Available values for input image formats are:
  11549. @table @samp
  11550. @item sbsl
  11551. side by side parallel (left eye left, right eye right)
  11552. @item sbsr
  11553. side by side crosseye (right eye left, left eye right)
  11554. @item sbs2l
  11555. side by side parallel with half width resolution
  11556. (left eye left, right eye right)
  11557. @item sbs2r
  11558. side by side crosseye with half width resolution
  11559. (right eye left, left eye right)
  11560. @item abl
  11561. above-below (left eye above, right eye below)
  11562. @item abr
  11563. above-below (right eye above, left eye below)
  11564. @item ab2l
  11565. above-below with half height resolution
  11566. (left eye above, right eye below)
  11567. @item ab2r
  11568. above-below with half height resolution
  11569. (right eye above, left eye below)
  11570. @item al
  11571. alternating frames (left eye first, right eye second)
  11572. @item ar
  11573. alternating frames (right eye first, left eye second)
  11574. @item irl
  11575. interleaved rows (left eye has top row, right eye starts on next row)
  11576. @item irr
  11577. interleaved rows (right eye has top row, left eye starts on next row)
  11578. @item icl
  11579. interleaved columns, left eye first
  11580. @item icr
  11581. interleaved columns, right eye first
  11582. Default value is @samp{sbsl}.
  11583. @end table
  11584. @item out
  11585. Set stereoscopic image format of output.
  11586. @table @samp
  11587. @item sbsl
  11588. side by side parallel (left eye left, right eye right)
  11589. @item sbsr
  11590. side by side crosseye (right eye left, left eye right)
  11591. @item sbs2l
  11592. side by side parallel with half width resolution
  11593. (left eye left, right eye right)
  11594. @item sbs2r
  11595. side by side crosseye with half width resolution
  11596. (right eye left, left eye right)
  11597. @item abl
  11598. above-below (left eye above, right eye below)
  11599. @item abr
  11600. above-below (right eye above, left eye below)
  11601. @item ab2l
  11602. above-below with half height resolution
  11603. (left eye above, right eye below)
  11604. @item ab2r
  11605. above-below with half height resolution
  11606. (right eye above, left eye below)
  11607. @item al
  11608. alternating frames (left eye first, right eye second)
  11609. @item ar
  11610. alternating frames (right eye first, left eye second)
  11611. @item irl
  11612. interleaved rows (left eye has top row, right eye starts on next row)
  11613. @item irr
  11614. interleaved rows (right eye has top row, left eye starts on next row)
  11615. @item arbg
  11616. anaglyph red/blue gray
  11617. (red filter on left eye, blue filter on right eye)
  11618. @item argg
  11619. anaglyph red/green gray
  11620. (red filter on left eye, green filter on right eye)
  11621. @item arcg
  11622. anaglyph red/cyan gray
  11623. (red filter on left eye, cyan filter on right eye)
  11624. @item arch
  11625. anaglyph red/cyan half colored
  11626. (red filter on left eye, cyan filter on right eye)
  11627. @item arcc
  11628. anaglyph red/cyan color
  11629. (red filter on left eye, cyan filter on right eye)
  11630. @item arcd
  11631. anaglyph red/cyan color optimized with the least squares projection of dubois
  11632. (red filter on left eye, cyan filter on right eye)
  11633. @item agmg
  11634. anaglyph green/magenta gray
  11635. (green filter on left eye, magenta filter on right eye)
  11636. @item agmh
  11637. anaglyph green/magenta half colored
  11638. (green filter on left eye, magenta filter on right eye)
  11639. @item agmc
  11640. anaglyph green/magenta colored
  11641. (green filter on left eye, magenta filter on right eye)
  11642. @item agmd
  11643. anaglyph green/magenta color optimized with the least squares projection of dubois
  11644. (green filter on left eye, magenta filter on right eye)
  11645. @item aybg
  11646. anaglyph yellow/blue gray
  11647. (yellow filter on left eye, blue filter on right eye)
  11648. @item aybh
  11649. anaglyph yellow/blue half colored
  11650. (yellow filter on left eye, blue filter on right eye)
  11651. @item aybc
  11652. anaglyph yellow/blue colored
  11653. (yellow filter on left eye, blue filter on right eye)
  11654. @item aybd
  11655. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11656. (yellow filter on left eye, blue filter on right eye)
  11657. @item ml
  11658. mono output (left eye only)
  11659. @item mr
  11660. mono output (right eye only)
  11661. @item chl
  11662. checkerboard, left eye first
  11663. @item chr
  11664. checkerboard, right eye first
  11665. @item icl
  11666. interleaved columns, left eye first
  11667. @item icr
  11668. interleaved columns, right eye first
  11669. @item hdmi
  11670. HDMI frame pack
  11671. @end table
  11672. Default value is @samp{arcd}.
  11673. @end table
  11674. @subsection Examples
  11675. @itemize
  11676. @item
  11677. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11678. @example
  11679. stereo3d=sbsl:aybd
  11680. @end example
  11681. @item
  11682. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11683. @example
  11684. stereo3d=abl:sbsr
  11685. @end example
  11686. @end itemize
  11687. @section streamselect, astreamselect
  11688. Select video or audio streams.
  11689. The filter accepts the following options:
  11690. @table @option
  11691. @item inputs
  11692. Set number of inputs. Default is 2.
  11693. @item map
  11694. Set input indexes to remap to outputs.
  11695. @end table
  11696. @subsection Commands
  11697. The @code{streamselect} and @code{astreamselect} filter supports the following
  11698. commands:
  11699. @table @option
  11700. @item map
  11701. Set input indexes to remap to outputs.
  11702. @end table
  11703. @subsection Examples
  11704. @itemize
  11705. @item
  11706. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11707. @example
  11708. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11709. @end example
  11710. @item
  11711. Same as above, but for audio:
  11712. @example
  11713. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11714. @end example
  11715. @end itemize
  11716. @section sobel
  11717. Apply sobel operator to input video stream.
  11718. The filter accepts the following option:
  11719. @table @option
  11720. @item planes
  11721. Set which planes will be processed, unprocessed planes will be copied.
  11722. By default value 0xf, all planes will be processed.
  11723. @item scale
  11724. Set value which will be multiplied with filtered result.
  11725. @item delta
  11726. Set value which will be added to filtered result.
  11727. @end table
  11728. @anchor{spp}
  11729. @section spp
  11730. Apply a simple postprocessing filter that compresses and decompresses the image
  11731. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11732. and average the results.
  11733. The filter accepts the following options:
  11734. @table @option
  11735. @item quality
  11736. Set quality. This option defines the number of levels for averaging. It accepts
  11737. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11738. effect. A value of @code{6} means the higher quality. For each increment of
  11739. that value the speed drops by a factor of approximately 2. Default value is
  11740. @code{3}.
  11741. @item qp
  11742. Force a constant quantization parameter. If not set, the filter will use the QP
  11743. from the video stream (if available).
  11744. @item mode
  11745. Set thresholding mode. Available modes are:
  11746. @table @samp
  11747. @item hard
  11748. Set hard thresholding (default).
  11749. @item soft
  11750. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11751. @end table
  11752. @item use_bframe_qp
  11753. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11754. option may cause flicker since the B-Frames have often larger QP. Default is
  11755. @code{0} (not enabled).
  11756. @end table
  11757. @section sr
  11758. Scale the input by applying one of the super-resolution methods based on
  11759. convolutional neural networks.
  11760. Training scripts as well as scripts for model generation are provided in
  11761. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  11762. The filter accepts the following options:
  11763. @table @option
  11764. @item model
  11765. Specify which super-resolution model to use. This option accepts the following values:
  11766. @table @samp
  11767. @item srcnn
  11768. Super-Resolution Convolutional Neural Network model.
  11769. See @url{https://arxiv.org/abs/1501.00092}.
  11770. @item espcn
  11771. Efficient Sub-Pixel Convolutional Neural Network model.
  11772. See @url{https://arxiv.org/abs/1609.05158}.
  11773. @end table
  11774. Default value is @samp{srcnn}.
  11775. @item dnn_backend
  11776. Specify which DNN backend to use for model loading and execution. This option accepts
  11777. the following values:
  11778. @table @samp
  11779. @item native
  11780. Native implementation of DNN loading and execution.
  11781. @item tensorflow
  11782. TensorFlow backend. To enable this backend you
  11783. need to install the TensorFlow for C library (see
  11784. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  11785. @code{--enable-libtensorflow}
  11786. @end table
  11787. Default value is @samp{native}.
  11788. @item scale_factor
  11789. Set scale factor for SRCNN model, for which custom model file was provided.
  11790. Allowed values are @code{2}, @code{3} and @code{4}. Default value is @code{2}.
  11791. Scale factor is necessary for SRCNN model, because it accepts input upscaled
  11792. using bicubic upscaling with proper scale factor.
  11793. @item model_filename
  11794. Set path to model file specifying network architecture and its parameters.
  11795. Note that different backends use different file formats. TensorFlow backend
  11796. can load files for both formats, while native backend can load files for only
  11797. its format.
  11798. @end table
  11799. @anchor{subtitles}
  11800. @section subtitles
  11801. Draw subtitles on top of input video using the libass library.
  11802. To enable compilation of this filter you need to configure FFmpeg with
  11803. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11804. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11805. Alpha) subtitles format.
  11806. The filter accepts the following options:
  11807. @table @option
  11808. @item filename, f
  11809. Set the filename of the subtitle file to read. It must be specified.
  11810. @item original_size
  11811. Specify the size of the original video, the video for which the ASS file
  11812. was composed. For the syntax of this option, check the
  11813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11814. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11815. correctly scale the fonts if the aspect ratio has been changed.
  11816. @item fontsdir
  11817. Set a directory path containing fonts that can be used by the filter.
  11818. These fonts will be used in addition to whatever the font provider uses.
  11819. @item alpha
  11820. Process alpha channel, by default alpha channel is untouched.
  11821. @item charenc
  11822. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11823. useful if not UTF-8.
  11824. @item stream_index, si
  11825. Set subtitles stream index. @code{subtitles} filter only.
  11826. @item force_style
  11827. Override default style or script info parameters of the subtitles. It accepts a
  11828. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11829. @end table
  11830. If the first key is not specified, it is assumed that the first value
  11831. specifies the @option{filename}.
  11832. For example, to render the file @file{sub.srt} on top of the input
  11833. video, use the command:
  11834. @example
  11835. subtitles=sub.srt
  11836. @end example
  11837. which is equivalent to:
  11838. @example
  11839. subtitles=filename=sub.srt
  11840. @end example
  11841. To render the default subtitles stream from file @file{video.mkv}, use:
  11842. @example
  11843. subtitles=video.mkv
  11844. @end example
  11845. To render the second subtitles stream from that file, use:
  11846. @example
  11847. subtitles=video.mkv:si=1
  11848. @end example
  11849. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  11850. @code{DejaVu Serif}, use:
  11851. @example
  11852. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  11853. @end example
  11854. @section super2xsai
  11855. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11856. Interpolate) pixel art scaling algorithm.
  11857. Useful for enlarging pixel art images without reducing sharpness.
  11858. @section swaprect
  11859. Swap two rectangular objects in video.
  11860. This filter accepts the following options:
  11861. @table @option
  11862. @item w
  11863. Set object width.
  11864. @item h
  11865. Set object height.
  11866. @item x1
  11867. Set 1st rect x coordinate.
  11868. @item y1
  11869. Set 1st rect y coordinate.
  11870. @item x2
  11871. Set 2nd rect x coordinate.
  11872. @item y2
  11873. Set 2nd rect y coordinate.
  11874. All expressions are evaluated once for each frame.
  11875. @end table
  11876. The all options are expressions containing the following constants:
  11877. @table @option
  11878. @item w
  11879. @item h
  11880. The input width and height.
  11881. @item a
  11882. same as @var{w} / @var{h}
  11883. @item sar
  11884. input sample aspect ratio
  11885. @item dar
  11886. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11887. @item n
  11888. The number of the input frame, starting from 0.
  11889. @item t
  11890. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11891. @item pos
  11892. the position in the file of the input frame, NAN if unknown
  11893. @end table
  11894. @section swapuv
  11895. Swap U & V plane.
  11896. @section telecine
  11897. Apply telecine process to the video.
  11898. This filter accepts the following options:
  11899. @table @option
  11900. @item first_field
  11901. @table @samp
  11902. @item top, t
  11903. top field first
  11904. @item bottom, b
  11905. bottom field first
  11906. The default value is @code{top}.
  11907. @end table
  11908. @item pattern
  11909. A string of numbers representing the pulldown pattern you wish to apply.
  11910. The default value is @code{23}.
  11911. @end table
  11912. @example
  11913. Some typical patterns:
  11914. NTSC output (30i):
  11915. 27.5p: 32222
  11916. 24p: 23 (classic)
  11917. 24p: 2332 (preferred)
  11918. 20p: 33
  11919. 18p: 334
  11920. 16p: 3444
  11921. PAL output (25i):
  11922. 27.5p: 12222
  11923. 24p: 222222222223 ("Euro pulldown")
  11924. 16.67p: 33
  11925. 16p: 33333334
  11926. @end example
  11927. @section threshold
  11928. Apply threshold effect to video stream.
  11929. This filter needs four video streams to perform thresholding.
  11930. First stream is stream we are filtering.
  11931. Second stream is holding threshold values, third stream is holding min values,
  11932. and last, fourth stream is holding max values.
  11933. The filter accepts the following option:
  11934. @table @option
  11935. @item planes
  11936. Set which planes will be processed, unprocessed planes will be copied.
  11937. By default value 0xf, all planes will be processed.
  11938. @end table
  11939. For example if first stream pixel's component value is less then threshold value
  11940. of pixel component from 2nd threshold stream, third stream value will picked,
  11941. otherwise fourth stream pixel component value will be picked.
  11942. Using color source filter one can perform various types of thresholding:
  11943. @subsection Examples
  11944. @itemize
  11945. @item
  11946. Binary threshold, using gray color as threshold:
  11947. @example
  11948. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11949. @end example
  11950. @item
  11951. Inverted binary threshold, using gray color as threshold:
  11952. @example
  11953. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11954. @end example
  11955. @item
  11956. Truncate binary threshold, using gray color as threshold:
  11957. @example
  11958. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11959. @end example
  11960. @item
  11961. Threshold to zero, using gray color as threshold:
  11962. @example
  11963. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11964. @end example
  11965. @item
  11966. Inverted threshold to zero, using gray color as threshold:
  11967. @example
  11968. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11969. @end example
  11970. @end itemize
  11971. @section thumbnail
  11972. Select the most representative frame in a given sequence of consecutive frames.
  11973. The filter accepts the following options:
  11974. @table @option
  11975. @item n
  11976. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11977. will pick one of them, and then handle the next batch of @var{n} frames until
  11978. the end. Default is @code{100}.
  11979. @end table
  11980. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11981. value will result in a higher memory usage, so a high value is not recommended.
  11982. @subsection Examples
  11983. @itemize
  11984. @item
  11985. Extract one picture each 50 frames:
  11986. @example
  11987. thumbnail=50
  11988. @end example
  11989. @item
  11990. Complete example of a thumbnail creation with @command{ffmpeg}:
  11991. @example
  11992. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11993. @end example
  11994. @end itemize
  11995. @section tile
  11996. Tile several successive frames together.
  11997. The filter accepts the following options:
  11998. @table @option
  11999. @item layout
  12000. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12001. this option, check the
  12002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12003. @item nb_frames
  12004. Set the maximum number of frames to render in the given area. It must be less
  12005. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12006. the area will be used.
  12007. @item margin
  12008. Set the outer border margin in pixels.
  12009. @item padding
  12010. Set the inner border thickness (i.e. the number of pixels between frames). For
  12011. more advanced padding options (such as having different values for the edges),
  12012. refer to the pad video filter.
  12013. @item color
  12014. Specify the color of the unused area. For the syntax of this option, check the
  12015. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12016. The default value of @var{color} is "black".
  12017. @item overlap
  12018. Set the number of frames to overlap when tiling several successive frames together.
  12019. The value must be between @code{0} and @var{nb_frames - 1}.
  12020. @item init_padding
  12021. Set the number of frames to initially be empty before displaying first output frame.
  12022. This controls how soon will one get first output frame.
  12023. The value must be between @code{0} and @var{nb_frames - 1}.
  12024. @end table
  12025. @subsection Examples
  12026. @itemize
  12027. @item
  12028. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12029. @example
  12030. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12031. @end example
  12032. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12033. duplicating each output frame to accommodate the originally detected frame
  12034. rate.
  12035. @item
  12036. Display @code{5} pictures in an area of @code{3x2} frames,
  12037. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12038. mixed flat and named options:
  12039. @example
  12040. tile=3x2:nb_frames=5:padding=7:margin=2
  12041. @end example
  12042. @end itemize
  12043. @section tinterlace
  12044. Perform various types of temporal field interlacing.
  12045. Frames are counted starting from 1, so the first input frame is
  12046. considered odd.
  12047. The filter accepts the following options:
  12048. @table @option
  12049. @item mode
  12050. Specify the mode of the interlacing. This option can also be specified
  12051. as a value alone. See below for a list of values for this option.
  12052. Available values are:
  12053. @table @samp
  12054. @item merge, 0
  12055. Move odd frames into the upper field, even into the lower field,
  12056. generating a double height frame at half frame rate.
  12057. @example
  12058. ------> time
  12059. Input:
  12060. Frame 1 Frame 2 Frame 3 Frame 4
  12061. 11111 22222 33333 44444
  12062. 11111 22222 33333 44444
  12063. 11111 22222 33333 44444
  12064. 11111 22222 33333 44444
  12065. Output:
  12066. 11111 33333
  12067. 22222 44444
  12068. 11111 33333
  12069. 22222 44444
  12070. 11111 33333
  12071. 22222 44444
  12072. 11111 33333
  12073. 22222 44444
  12074. @end example
  12075. @item drop_even, 1
  12076. Only output odd frames, even frames are dropped, generating a frame with
  12077. unchanged height at half frame rate.
  12078. @example
  12079. ------> time
  12080. Input:
  12081. Frame 1 Frame 2 Frame 3 Frame 4
  12082. 11111 22222 33333 44444
  12083. 11111 22222 33333 44444
  12084. 11111 22222 33333 44444
  12085. 11111 22222 33333 44444
  12086. Output:
  12087. 11111 33333
  12088. 11111 33333
  12089. 11111 33333
  12090. 11111 33333
  12091. @end example
  12092. @item drop_odd, 2
  12093. Only output even frames, odd frames are dropped, generating a frame with
  12094. unchanged height at half frame rate.
  12095. @example
  12096. ------> time
  12097. Input:
  12098. Frame 1 Frame 2 Frame 3 Frame 4
  12099. 11111 22222 33333 44444
  12100. 11111 22222 33333 44444
  12101. 11111 22222 33333 44444
  12102. 11111 22222 33333 44444
  12103. Output:
  12104. 22222 44444
  12105. 22222 44444
  12106. 22222 44444
  12107. 22222 44444
  12108. @end example
  12109. @item pad, 3
  12110. Expand each frame to full height, but pad alternate lines with black,
  12111. generating a frame with double height at the same input frame rate.
  12112. @example
  12113. ------> time
  12114. Input:
  12115. Frame 1 Frame 2 Frame 3 Frame 4
  12116. 11111 22222 33333 44444
  12117. 11111 22222 33333 44444
  12118. 11111 22222 33333 44444
  12119. 11111 22222 33333 44444
  12120. Output:
  12121. 11111 ..... 33333 .....
  12122. ..... 22222 ..... 44444
  12123. 11111 ..... 33333 .....
  12124. ..... 22222 ..... 44444
  12125. 11111 ..... 33333 .....
  12126. ..... 22222 ..... 44444
  12127. 11111 ..... 33333 .....
  12128. ..... 22222 ..... 44444
  12129. @end example
  12130. @item interleave_top, 4
  12131. Interleave the upper field from odd frames with the lower field from
  12132. even frames, generating a frame with unchanged height at half frame rate.
  12133. @example
  12134. ------> time
  12135. Input:
  12136. Frame 1 Frame 2 Frame 3 Frame 4
  12137. 11111<- 22222 33333<- 44444
  12138. 11111 22222<- 33333 44444<-
  12139. 11111<- 22222 33333<- 44444
  12140. 11111 22222<- 33333 44444<-
  12141. Output:
  12142. 11111 33333
  12143. 22222 44444
  12144. 11111 33333
  12145. 22222 44444
  12146. @end example
  12147. @item interleave_bottom, 5
  12148. Interleave the lower field from odd frames with the upper field from
  12149. even frames, generating a frame with unchanged height at half frame rate.
  12150. @example
  12151. ------> time
  12152. Input:
  12153. Frame 1 Frame 2 Frame 3 Frame 4
  12154. 11111 22222<- 33333 44444<-
  12155. 11111<- 22222 33333<- 44444
  12156. 11111 22222<- 33333 44444<-
  12157. 11111<- 22222 33333<- 44444
  12158. Output:
  12159. 22222 44444
  12160. 11111 33333
  12161. 22222 44444
  12162. 11111 33333
  12163. @end example
  12164. @item interlacex2, 6
  12165. Double frame rate with unchanged height. Frames are inserted each
  12166. containing the second temporal field from the previous input frame and
  12167. the first temporal field from the next input frame. This mode relies on
  12168. the top_field_first flag. Useful for interlaced video displays with no
  12169. field synchronisation.
  12170. @example
  12171. ------> time
  12172. Input:
  12173. Frame 1 Frame 2 Frame 3 Frame 4
  12174. 11111 22222 33333 44444
  12175. 11111 22222 33333 44444
  12176. 11111 22222 33333 44444
  12177. 11111 22222 33333 44444
  12178. Output:
  12179. 11111 22222 22222 33333 33333 44444 44444
  12180. 11111 11111 22222 22222 33333 33333 44444
  12181. 11111 22222 22222 33333 33333 44444 44444
  12182. 11111 11111 22222 22222 33333 33333 44444
  12183. @end example
  12184. @item mergex2, 7
  12185. Move odd frames into the upper field, even into the lower field,
  12186. generating a double height frame at same frame rate.
  12187. @example
  12188. ------> time
  12189. Input:
  12190. Frame 1 Frame 2 Frame 3 Frame 4
  12191. 11111 22222 33333 44444
  12192. 11111 22222 33333 44444
  12193. 11111 22222 33333 44444
  12194. 11111 22222 33333 44444
  12195. Output:
  12196. 11111 33333 33333 55555
  12197. 22222 22222 44444 44444
  12198. 11111 33333 33333 55555
  12199. 22222 22222 44444 44444
  12200. 11111 33333 33333 55555
  12201. 22222 22222 44444 44444
  12202. 11111 33333 33333 55555
  12203. 22222 22222 44444 44444
  12204. @end example
  12205. @end table
  12206. Numeric values are deprecated but are accepted for backward
  12207. compatibility reasons.
  12208. Default mode is @code{merge}.
  12209. @item flags
  12210. Specify flags influencing the filter process.
  12211. Available value for @var{flags} is:
  12212. @table @option
  12213. @item low_pass_filter, vlfp
  12214. Enable linear vertical low-pass filtering in the filter.
  12215. Vertical low-pass filtering is required when creating an interlaced
  12216. destination from a progressive source which contains high-frequency
  12217. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12218. patterning.
  12219. @item complex_filter, cvlfp
  12220. Enable complex vertical low-pass filtering.
  12221. This will slightly less reduce interlace 'twitter' and Moire
  12222. patterning but better retain detail and subjective sharpness impression.
  12223. @end table
  12224. Vertical low-pass filtering can only be enabled for @option{mode}
  12225. @var{interleave_top} and @var{interleave_bottom}.
  12226. @end table
  12227. @section tmix
  12228. Mix successive video frames.
  12229. A description of the accepted options follows.
  12230. @table @option
  12231. @item frames
  12232. The number of successive frames to mix. If unspecified, it defaults to 3.
  12233. @item weights
  12234. Specify weight of each input video frame.
  12235. Each weight is separated by space. If number of weights is smaller than
  12236. number of @var{frames} last specified weight will be used for all remaining
  12237. unset weights.
  12238. @item scale
  12239. Specify scale, if it is set it will be multiplied with sum
  12240. of each weight multiplied with pixel values to give final destination
  12241. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12242. @end table
  12243. @subsection Examples
  12244. @itemize
  12245. @item
  12246. Average 7 successive frames:
  12247. @example
  12248. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12249. @end example
  12250. @item
  12251. Apply simple temporal convolution:
  12252. @example
  12253. tmix=frames=3:weights="-1 3 -1"
  12254. @end example
  12255. @item
  12256. Similar as above but only showing temporal differences:
  12257. @example
  12258. tmix=frames=3:weights="-1 2 -1":scale=1
  12259. @end example
  12260. @end itemize
  12261. @section tonemap
  12262. Tone map colors from different dynamic ranges.
  12263. This filter expects data in single precision floating point, as it needs to
  12264. operate on (and can output) out-of-range values. Another filter, such as
  12265. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12266. The tonemapping algorithms implemented only work on linear light, so input
  12267. data should be linearized beforehand (and possibly correctly tagged).
  12268. @example
  12269. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12270. @end example
  12271. @subsection Options
  12272. The filter accepts the following options.
  12273. @table @option
  12274. @item tonemap
  12275. Set the tone map algorithm to use.
  12276. Possible values are:
  12277. @table @var
  12278. @item none
  12279. Do not apply any tone map, only desaturate overbright pixels.
  12280. @item clip
  12281. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12282. in-range values, while distorting out-of-range values.
  12283. @item linear
  12284. Stretch the entire reference gamut to a linear multiple of the display.
  12285. @item gamma
  12286. Fit a logarithmic transfer between the tone curves.
  12287. @item reinhard
  12288. Preserve overall image brightness with a simple curve, using nonlinear
  12289. contrast, which results in flattening details and degrading color accuracy.
  12290. @item hable
  12291. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12292. of slightly darkening everything. Use it when detail preservation is more
  12293. important than color and brightness accuracy.
  12294. @item mobius
  12295. Smoothly map out-of-range values, while retaining contrast and colors for
  12296. in-range material as much as possible. Use it when color accuracy is more
  12297. important than detail preservation.
  12298. @end table
  12299. Default is none.
  12300. @item param
  12301. Tune the tone mapping algorithm.
  12302. This affects the following algorithms:
  12303. @table @var
  12304. @item none
  12305. Ignored.
  12306. @item linear
  12307. Specifies the scale factor to use while stretching.
  12308. Default to 1.0.
  12309. @item gamma
  12310. Specifies the exponent of the function.
  12311. Default to 1.8.
  12312. @item clip
  12313. Specify an extra linear coefficient to multiply into the signal before clipping.
  12314. Default to 1.0.
  12315. @item reinhard
  12316. Specify the local contrast coefficient at the display peak.
  12317. Default to 0.5, which means that in-gamut values will be about half as bright
  12318. as when clipping.
  12319. @item hable
  12320. Ignored.
  12321. @item mobius
  12322. Specify the transition point from linear to mobius transform. Every value
  12323. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12324. more accurate the result will be, at the cost of losing bright details.
  12325. Default to 0.3, which due to the steep initial slope still preserves in-range
  12326. colors fairly accurately.
  12327. @end table
  12328. @item desat
  12329. Apply desaturation for highlights that exceed this level of brightness. The
  12330. higher the parameter, the more color information will be preserved. This
  12331. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12332. (smoothly) turning into white instead. This makes images feel more natural,
  12333. at the cost of reducing information about out-of-range colors.
  12334. The default of 2.0 is somewhat conservative and will mostly just apply to
  12335. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12336. This option works only if the input frame has a supported color tag.
  12337. @item peak
  12338. Override signal/nominal/reference peak with this value. Useful when the
  12339. embedded peak information in display metadata is not reliable or when tone
  12340. mapping from a lower range to a higher range.
  12341. @end table
  12342. @section transpose
  12343. Transpose rows with columns in the input video and optionally flip it.
  12344. It accepts the following parameters:
  12345. @table @option
  12346. @item dir
  12347. Specify the transposition direction.
  12348. Can assume the following values:
  12349. @table @samp
  12350. @item 0, 4, cclock_flip
  12351. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12352. @example
  12353. L.R L.l
  12354. . . -> . .
  12355. l.r R.r
  12356. @end example
  12357. @item 1, 5, clock
  12358. Rotate by 90 degrees clockwise, that is:
  12359. @example
  12360. L.R l.L
  12361. . . -> . .
  12362. l.r r.R
  12363. @end example
  12364. @item 2, 6, cclock
  12365. Rotate by 90 degrees counterclockwise, that is:
  12366. @example
  12367. L.R R.r
  12368. . . -> . .
  12369. l.r L.l
  12370. @end example
  12371. @item 3, 7, clock_flip
  12372. Rotate by 90 degrees clockwise and vertically flip, that is:
  12373. @example
  12374. L.R r.R
  12375. . . -> . .
  12376. l.r l.L
  12377. @end example
  12378. @end table
  12379. For values between 4-7, the transposition is only done if the input
  12380. video geometry is portrait and not landscape. These values are
  12381. deprecated, the @code{passthrough} option should be used instead.
  12382. Numerical values are deprecated, and should be dropped in favor of
  12383. symbolic constants.
  12384. @item passthrough
  12385. Do not apply the transposition if the input geometry matches the one
  12386. specified by the specified value. It accepts the following values:
  12387. @table @samp
  12388. @item none
  12389. Always apply transposition.
  12390. @item portrait
  12391. Preserve portrait geometry (when @var{height} >= @var{width}).
  12392. @item landscape
  12393. Preserve landscape geometry (when @var{width} >= @var{height}).
  12394. @end table
  12395. Default value is @code{none}.
  12396. @end table
  12397. For example to rotate by 90 degrees clockwise and preserve portrait
  12398. layout:
  12399. @example
  12400. transpose=dir=1:passthrough=portrait
  12401. @end example
  12402. The command above can also be specified as:
  12403. @example
  12404. transpose=1:portrait
  12405. @end example
  12406. @section trim
  12407. Trim the input so that the output contains one continuous subpart of the input.
  12408. It accepts the following parameters:
  12409. @table @option
  12410. @item start
  12411. Specify the time of the start of the kept section, i.e. the frame with the
  12412. timestamp @var{start} will be the first frame in the output.
  12413. @item end
  12414. Specify the time of the first frame that will be dropped, i.e. the frame
  12415. immediately preceding the one with the timestamp @var{end} will be the last
  12416. frame in the output.
  12417. @item start_pts
  12418. This is the same as @var{start}, except this option sets the start timestamp
  12419. in timebase units instead of seconds.
  12420. @item end_pts
  12421. This is the same as @var{end}, except this option sets the end timestamp
  12422. in timebase units instead of seconds.
  12423. @item duration
  12424. The maximum duration of the output in seconds.
  12425. @item start_frame
  12426. The number of the first frame that should be passed to the output.
  12427. @item end_frame
  12428. The number of the first frame that should be dropped.
  12429. @end table
  12430. @option{start}, @option{end}, and @option{duration} are expressed as time
  12431. duration specifications; see
  12432. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12433. for the accepted syntax.
  12434. Note that the first two sets of the start/end options and the @option{duration}
  12435. option look at the frame timestamp, while the _frame variants simply count the
  12436. frames that pass through the filter. Also note that this filter does not modify
  12437. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12438. setpts filter after the trim filter.
  12439. If multiple start or end options are set, this filter tries to be greedy and
  12440. keep all the frames that match at least one of the specified constraints. To keep
  12441. only the part that matches all the constraints at once, chain multiple trim
  12442. filters.
  12443. The defaults are such that all the input is kept. So it is possible to set e.g.
  12444. just the end values to keep everything before the specified time.
  12445. Examples:
  12446. @itemize
  12447. @item
  12448. Drop everything except the second minute of input:
  12449. @example
  12450. ffmpeg -i INPUT -vf trim=60:120
  12451. @end example
  12452. @item
  12453. Keep only the first second:
  12454. @example
  12455. ffmpeg -i INPUT -vf trim=duration=1
  12456. @end example
  12457. @end itemize
  12458. @section unpremultiply
  12459. Apply alpha unpremultiply effect to input video stream using first plane
  12460. of second stream as alpha.
  12461. Both streams must have same dimensions and same pixel format.
  12462. The filter accepts the following option:
  12463. @table @option
  12464. @item planes
  12465. Set which planes will be processed, unprocessed planes will be copied.
  12466. By default value 0xf, all planes will be processed.
  12467. If the format has 1 or 2 components, then luma is bit 0.
  12468. If the format has 3 or 4 components:
  12469. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12470. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12471. If present, the alpha channel is always the last bit.
  12472. @item inplace
  12473. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12474. @end table
  12475. @anchor{unsharp}
  12476. @section unsharp
  12477. Sharpen or blur the input video.
  12478. It accepts the following parameters:
  12479. @table @option
  12480. @item luma_msize_x, lx
  12481. Set the luma matrix horizontal size. It must be an odd integer between
  12482. 3 and 23. The default value is 5.
  12483. @item luma_msize_y, ly
  12484. Set the luma matrix vertical size. It must be an odd integer between 3
  12485. and 23. The default value is 5.
  12486. @item luma_amount, la
  12487. Set the luma effect strength. It must be a floating point number, reasonable
  12488. values lay between -1.5 and 1.5.
  12489. Negative values will blur the input video, while positive values will
  12490. sharpen it, a value of zero will disable the effect.
  12491. Default value is 1.0.
  12492. @item chroma_msize_x, cx
  12493. Set the chroma matrix horizontal size. It must be an odd integer
  12494. between 3 and 23. The default value is 5.
  12495. @item chroma_msize_y, cy
  12496. Set the chroma matrix vertical size. It must be an odd integer
  12497. between 3 and 23. The default value is 5.
  12498. @item chroma_amount, ca
  12499. Set the chroma effect strength. It must be a floating point number, reasonable
  12500. values lay between -1.5 and 1.5.
  12501. Negative values will blur the input video, while positive values will
  12502. sharpen it, a value of zero will disable the effect.
  12503. Default value is 0.0.
  12504. @end table
  12505. All parameters are optional and default to the equivalent of the
  12506. string '5:5:1.0:5:5:0.0'.
  12507. @subsection Examples
  12508. @itemize
  12509. @item
  12510. Apply strong luma sharpen effect:
  12511. @example
  12512. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12513. @end example
  12514. @item
  12515. Apply a strong blur of both luma and chroma parameters:
  12516. @example
  12517. unsharp=7:7:-2:7:7:-2
  12518. @end example
  12519. @end itemize
  12520. @section uspp
  12521. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12522. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12523. shifts and average the results.
  12524. The way this differs from the behavior of spp is that uspp actually encodes &
  12525. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12526. DCT similar to MJPEG.
  12527. The filter accepts the following options:
  12528. @table @option
  12529. @item quality
  12530. Set quality. This option defines the number of levels for averaging. It accepts
  12531. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12532. effect. A value of @code{8} means the higher quality. For each increment of
  12533. that value the speed drops by a factor of approximately 2. Default value is
  12534. @code{3}.
  12535. @item qp
  12536. Force a constant quantization parameter. If not set, the filter will use the QP
  12537. from the video stream (if available).
  12538. @end table
  12539. @section vaguedenoiser
  12540. Apply a wavelet based denoiser.
  12541. It transforms each frame from the video input into the wavelet domain,
  12542. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12543. the obtained coefficients. It does an inverse wavelet transform after.
  12544. Due to wavelet properties, it should give a nice smoothed result, and
  12545. reduced noise, without blurring picture features.
  12546. This filter accepts the following options:
  12547. @table @option
  12548. @item threshold
  12549. The filtering strength. The higher, the more filtered the video will be.
  12550. Hard thresholding can use a higher threshold than soft thresholding
  12551. before the video looks overfiltered. Default value is 2.
  12552. @item method
  12553. The filtering method the filter will use.
  12554. It accepts the following values:
  12555. @table @samp
  12556. @item hard
  12557. All values under the threshold will be zeroed.
  12558. @item soft
  12559. All values under the threshold will be zeroed. All values above will be
  12560. reduced by the threshold.
  12561. @item garrote
  12562. Scales or nullifies coefficients - intermediary between (more) soft and
  12563. (less) hard thresholding.
  12564. @end table
  12565. Default is garrote.
  12566. @item nsteps
  12567. Number of times, the wavelet will decompose the picture. Picture can't
  12568. be decomposed beyond a particular point (typically, 8 for a 640x480
  12569. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12570. @item percent
  12571. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12572. @item planes
  12573. A list of the planes to process. By default all planes are processed.
  12574. @end table
  12575. @section vectorscope
  12576. Display 2 color component values in the two dimensional graph (which is called
  12577. a vectorscope).
  12578. This filter accepts the following options:
  12579. @table @option
  12580. @item mode, m
  12581. Set vectorscope mode.
  12582. It accepts the following values:
  12583. @table @samp
  12584. @item gray
  12585. Gray values are displayed on graph, higher brightness means more pixels have
  12586. same component color value on location in graph. This is the default mode.
  12587. @item color
  12588. Gray values are displayed on graph. Surrounding pixels values which are not
  12589. present in video frame are drawn in gradient of 2 color components which are
  12590. set by option @code{x} and @code{y}. The 3rd color component is static.
  12591. @item color2
  12592. Actual color components values present in video frame are displayed on graph.
  12593. @item color3
  12594. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12595. on graph increases value of another color component, which is luminance by
  12596. default values of @code{x} and @code{y}.
  12597. @item color4
  12598. Actual colors present in video frame are displayed on graph. If two different
  12599. colors map to same position on graph then color with higher value of component
  12600. not present in graph is picked.
  12601. @item color5
  12602. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12603. component picked from radial gradient.
  12604. @end table
  12605. @item x
  12606. Set which color component will be represented on X-axis. Default is @code{1}.
  12607. @item y
  12608. Set which color component will be represented on Y-axis. Default is @code{2}.
  12609. @item intensity, i
  12610. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12611. of color component which represents frequency of (X, Y) location in graph.
  12612. @item envelope, e
  12613. @table @samp
  12614. @item none
  12615. No envelope, this is default.
  12616. @item instant
  12617. Instant envelope, even darkest single pixel will be clearly highlighted.
  12618. @item peak
  12619. Hold maximum and minimum values presented in graph over time. This way you
  12620. can still spot out of range values without constantly looking at vectorscope.
  12621. @item peak+instant
  12622. Peak and instant envelope combined together.
  12623. @end table
  12624. @item graticule, g
  12625. Set what kind of graticule to draw.
  12626. @table @samp
  12627. @item none
  12628. @item green
  12629. @item color
  12630. @end table
  12631. @item opacity, o
  12632. Set graticule opacity.
  12633. @item flags, f
  12634. Set graticule flags.
  12635. @table @samp
  12636. @item white
  12637. Draw graticule for white point.
  12638. @item black
  12639. Draw graticule for black point.
  12640. @item name
  12641. Draw color points short names.
  12642. @end table
  12643. @item bgopacity, b
  12644. Set background opacity.
  12645. @item lthreshold, l
  12646. Set low threshold for color component not represented on X or Y axis.
  12647. Values lower than this value will be ignored. Default is 0.
  12648. Note this value is multiplied with actual max possible value one pixel component
  12649. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12650. is 0.1 * 255 = 25.
  12651. @item hthreshold, h
  12652. Set high threshold for color component not represented on X or Y axis.
  12653. Values higher than this value will be ignored. Default is 1.
  12654. Note this value is multiplied with actual max possible value one pixel component
  12655. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12656. is 0.9 * 255 = 230.
  12657. @item colorspace, c
  12658. Set what kind of colorspace to use when drawing graticule.
  12659. @table @samp
  12660. @item auto
  12661. @item 601
  12662. @item 709
  12663. @end table
  12664. Default is auto.
  12665. @end table
  12666. @anchor{vidstabdetect}
  12667. @section vidstabdetect
  12668. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12669. @ref{vidstabtransform} for pass 2.
  12670. This filter generates a file with relative translation and rotation
  12671. transform information about subsequent frames, which is then used by
  12672. the @ref{vidstabtransform} filter.
  12673. To enable compilation of this filter you need to configure FFmpeg with
  12674. @code{--enable-libvidstab}.
  12675. This filter accepts the following options:
  12676. @table @option
  12677. @item result
  12678. Set the path to the file used to write the transforms information.
  12679. Default value is @file{transforms.trf}.
  12680. @item shakiness
  12681. Set how shaky the video is and how quick the camera is. It accepts an
  12682. integer in the range 1-10, a value of 1 means little shakiness, a
  12683. value of 10 means strong shakiness. Default value is 5.
  12684. @item accuracy
  12685. Set the accuracy of the detection process. It must be a value in the
  12686. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12687. accuracy. Default value is 15.
  12688. @item stepsize
  12689. Set stepsize of the search process. The region around minimum is
  12690. scanned with 1 pixel resolution. Default value is 6.
  12691. @item mincontrast
  12692. Set minimum contrast. Below this value a local measurement field is
  12693. discarded. Must be a floating point value in the range 0-1. Default
  12694. value is 0.3.
  12695. @item tripod
  12696. Set reference frame number for tripod mode.
  12697. If enabled, the motion of the frames is compared to a reference frame
  12698. in the filtered stream, identified by the specified number. The idea
  12699. is to compensate all movements in a more-or-less static scene and keep
  12700. the camera view absolutely still.
  12701. If set to 0, it is disabled. The frames are counted starting from 1.
  12702. @item show
  12703. Show fields and transforms in the resulting frames. It accepts an
  12704. integer in the range 0-2. Default value is 0, which disables any
  12705. visualization.
  12706. @end table
  12707. @subsection Examples
  12708. @itemize
  12709. @item
  12710. Use default values:
  12711. @example
  12712. vidstabdetect
  12713. @end example
  12714. @item
  12715. Analyze strongly shaky movie and put the results in file
  12716. @file{mytransforms.trf}:
  12717. @example
  12718. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12719. @end example
  12720. @item
  12721. Visualize the result of internal transformations in the resulting
  12722. video:
  12723. @example
  12724. vidstabdetect=show=1
  12725. @end example
  12726. @item
  12727. Analyze a video with medium shakiness using @command{ffmpeg}:
  12728. @example
  12729. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12730. @end example
  12731. @end itemize
  12732. @anchor{vidstabtransform}
  12733. @section vidstabtransform
  12734. Video stabilization/deshaking: pass 2 of 2,
  12735. see @ref{vidstabdetect} for pass 1.
  12736. Read a file with transform information for each frame and
  12737. apply/compensate them. Together with the @ref{vidstabdetect}
  12738. filter this can be used to deshake videos. See also
  12739. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12740. the @ref{unsharp} filter, see below.
  12741. To enable compilation of this filter you need to configure FFmpeg with
  12742. @code{--enable-libvidstab}.
  12743. @subsection Options
  12744. @table @option
  12745. @item input
  12746. Set path to the file used to read the transforms. Default value is
  12747. @file{transforms.trf}.
  12748. @item smoothing
  12749. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12750. camera movements. Default value is 10.
  12751. For example a number of 10 means that 21 frames are used (10 in the
  12752. past and 10 in the future) to smoothen the motion in the video. A
  12753. larger value leads to a smoother video, but limits the acceleration of
  12754. the camera (pan/tilt movements). 0 is a special case where a static
  12755. camera is simulated.
  12756. @item optalgo
  12757. Set the camera path optimization algorithm.
  12758. Accepted values are:
  12759. @table @samp
  12760. @item gauss
  12761. gaussian kernel low-pass filter on camera motion (default)
  12762. @item avg
  12763. averaging on transformations
  12764. @end table
  12765. @item maxshift
  12766. Set maximal number of pixels to translate frames. Default value is -1,
  12767. meaning no limit.
  12768. @item maxangle
  12769. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12770. value is -1, meaning no limit.
  12771. @item crop
  12772. Specify how to deal with borders that may be visible due to movement
  12773. compensation.
  12774. Available values are:
  12775. @table @samp
  12776. @item keep
  12777. keep image information from previous frame (default)
  12778. @item black
  12779. fill the border black
  12780. @end table
  12781. @item invert
  12782. Invert transforms if set to 1. Default value is 0.
  12783. @item relative
  12784. Consider transforms as relative to previous frame if set to 1,
  12785. absolute if set to 0. Default value is 0.
  12786. @item zoom
  12787. Set percentage to zoom. A positive value will result in a zoom-in
  12788. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12789. zoom).
  12790. @item optzoom
  12791. Set optimal zooming to avoid borders.
  12792. Accepted values are:
  12793. @table @samp
  12794. @item 0
  12795. disabled
  12796. @item 1
  12797. optimal static zoom value is determined (only very strong movements
  12798. will lead to visible borders) (default)
  12799. @item 2
  12800. optimal adaptive zoom value is determined (no borders will be
  12801. visible), see @option{zoomspeed}
  12802. @end table
  12803. Note that the value given at zoom is added to the one calculated here.
  12804. @item zoomspeed
  12805. Set percent to zoom maximally each frame (enabled when
  12806. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12807. 0.25.
  12808. @item interpol
  12809. Specify type of interpolation.
  12810. Available values are:
  12811. @table @samp
  12812. @item no
  12813. no interpolation
  12814. @item linear
  12815. linear only horizontal
  12816. @item bilinear
  12817. linear in both directions (default)
  12818. @item bicubic
  12819. cubic in both directions (slow)
  12820. @end table
  12821. @item tripod
  12822. Enable virtual tripod mode if set to 1, which is equivalent to
  12823. @code{relative=0:smoothing=0}. Default value is 0.
  12824. Use also @code{tripod} option of @ref{vidstabdetect}.
  12825. @item debug
  12826. Increase log verbosity if set to 1. Also the detected global motions
  12827. are written to the temporary file @file{global_motions.trf}. Default
  12828. value is 0.
  12829. @end table
  12830. @subsection Examples
  12831. @itemize
  12832. @item
  12833. Use @command{ffmpeg} for a typical stabilization with default values:
  12834. @example
  12835. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12836. @end example
  12837. Note the use of the @ref{unsharp} filter which is always recommended.
  12838. @item
  12839. Zoom in a bit more and load transform data from a given file:
  12840. @example
  12841. vidstabtransform=zoom=5:input="mytransforms.trf"
  12842. @end example
  12843. @item
  12844. Smoothen the video even more:
  12845. @example
  12846. vidstabtransform=smoothing=30
  12847. @end example
  12848. @end itemize
  12849. @section vflip
  12850. Flip the input video vertically.
  12851. For example, to vertically flip a video with @command{ffmpeg}:
  12852. @example
  12853. ffmpeg -i in.avi -vf "vflip" out.avi
  12854. @end example
  12855. @section vfrdet
  12856. Detect variable frame rate video.
  12857. This filter tries to detect if the input is variable or constant frame rate.
  12858. At end it will output number of frames detected as having variable delta pts,
  12859. and ones with constant delta pts.
  12860. If there was frames with variable delta, than it will also show min and max delta
  12861. encountered.
  12862. @anchor{vignette}
  12863. @section vignette
  12864. Make or reverse a natural vignetting effect.
  12865. The filter accepts the following options:
  12866. @table @option
  12867. @item angle, a
  12868. Set lens angle expression as a number of radians.
  12869. The value is clipped in the @code{[0,PI/2]} range.
  12870. Default value: @code{"PI/5"}
  12871. @item x0
  12872. @item y0
  12873. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12874. by default.
  12875. @item mode
  12876. Set forward/backward mode.
  12877. Available modes are:
  12878. @table @samp
  12879. @item forward
  12880. The larger the distance from the central point, the darker the image becomes.
  12881. @item backward
  12882. The larger the distance from the central point, the brighter the image becomes.
  12883. This can be used to reverse a vignette effect, though there is no automatic
  12884. detection to extract the lens @option{angle} and other settings (yet). It can
  12885. also be used to create a burning effect.
  12886. @end table
  12887. Default value is @samp{forward}.
  12888. @item eval
  12889. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12890. It accepts the following values:
  12891. @table @samp
  12892. @item init
  12893. Evaluate expressions only once during the filter initialization.
  12894. @item frame
  12895. Evaluate expressions for each incoming frame. This is way slower than the
  12896. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12897. allows advanced dynamic expressions.
  12898. @end table
  12899. Default value is @samp{init}.
  12900. @item dither
  12901. Set dithering to reduce the circular banding effects. Default is @code{1}
  12902. (enabled).
  12903. @item aspect
  12904. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12905. Setting this value to the SAR of the input will make a rectangular vignetting
  12906. following the dimensions of the video.
  12907. Default is @code{1/1}.
  12908. @end table
  12909. @subsection Expressions
  12910. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12911. following parameters.
  12912. @table @option
  12913. @item w
  12914. @item h
  12915. input width and height
  12916. @item n
  12917. the number of input frame, starting from 0
  12918. @item pts
  12919. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12920. @var{TB} units, NAN if undefined
  12921. @item r
  12922. frame rate of the input video, NAN if the input frame rate is unknown
  12923. @item t
  12924. the PTS (Presentation TimeStamp) of the filtered video frame,
  12925. expressed in seconds, NAN if undefined
  12926. @item tb
  12927. time base of the input video
  12928. @end table
  12929. @subsection Examples
  12930. @itemize
  12931. @item
  12932. Apply simple strong vignetting effect:
  12933. @example
  12934. vignette=PI/4
  12935. @end example
  12936. @item
  12937. Make a flickering vignetting:
  12938. @example
  12939. vignette='PI/4+random(1)*PI/50':eval=frame
  12940. @end example
  12941. @end itemize
  12942. @section vmafmotion
  12943. Obtain the average vmaf motion score of a video.
  12944. It is one of the component filters of VMAF.
  12945. The obtained average motion score is printed through the logging system.
  12946. In the below example the input file @file{ref.mpg} is being processed and score
  12947. is computed.
  12948. @example
  12949. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12950. @end example
  12951. @section vstack
  12952. Stack input videos vertically.
  12953. All streams must be of same pixel format and of same width.
  12954. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12955. to create same output.
  12956. The filter accept the following option:
  12957. @table @option
  12958. @item inputs
  12959. Set number of input streams. Default is 2.
  12960. @item shortest
  12961. If set to 1, force the output to terminate when the shortest input
  12962. terminates. Default value is 0.
  12963. @end table
  12964. @section w3fdif
  12965. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12966. Deinterlacing Filter").
  12967. Based on the process described by Martin Weston for BBC R&D, and
  12968. implemented based on the de-interlace algorithm written by Jim
  12969. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12970. uses filter coefficients calculated by BBC R&D.
  12971. There are two sets of filter coefficients, so called "simple":
  12972. and "complex". Which set of filter coefficients is used can
  12973. be set by passing an optional parameter:
  12974. @table @option
  12975. @item filter
  12976. Set the interlacing filter coefficients. Accepts one of the following values:
  12977. @table @samp
  12978. @item simple
  12979. Simple filter coefficient set.
  12980. @item complex
  12981. More-complex filter coefficient set.
  12982. @end table
  12983. Default value is @samp{complex}.
  12984. @item deint
  12985. Specify which frames to deinterlace. Accept one of the following values:
  12986. @table @samp
  12987. @item all
  12988. Deinterlace all frames,
  12989. @item interlaced
  12990. Only deinterlace frames marked as interlaced.
  12991. @end table
  12992. Default value is @samp{all}.
  12993. @end table
  12994. @section waveform
  12995. Video waveform monitor.
  12996. The waveform monitor plots color component intensity. By default luminance
  12997. only. Each column of the waveform corresponds to a column of pixels in the
  12998. source video.
  12999. It accepts the following options:
  13000. @table @option
  13001. @item mode, m
  13002. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13003. In row mode, the graph on the left side represents color component value 0 and
  13004. the right side represents value = 255. In column mode, the top side represents
  13005. color component value = 0 and bottom side represents value = 255.
  13006. @item intensity, i
  13007. Set intensity. Smaller values are useful to find out how many values of the same
  13008. luminance are distributed across input rows/columns.
  13009. Default value is @code{0.04}. Allowed range is [0, 1].
  13010. @item mirror, r
  13011. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13012. In mirrored mode, higher values will be represented on the left
  13013. side for @code{row} mode and at the top for @code{column} mode. Default is
  13014. @code{1} (mirrored).
  13015. @item display, d
  13016. Set display mode.
  13017. It accepts the following values:
  13018. @table @samp
  13019. @item overlay
  13020. Presents information identical to that in the @code{parade}, except
  13021. that the graphs representing color components are superimposed directly
  13022. over one another.
  13023. This display mode makes it easier to spot relative differences or similarities
  13024. in overlapping areas of the color components that are supposed to be identical,
  13025. such as neutral whites, grays, or blacks.
  13026. @item stack
  13027. Display separate graph for the color components side by side in
  13028. @code{row} mode or one below the other in @code{column} mode.
  13029. @item parade
  13030. Display separate graph for the color components side by side in
  13031. @code{column} mode or one below the other in @code{row} mode.
  13032. Using this display mode makes it easy to spot color casts in the highlights
  13033. and shadows of an image, by comparing the contours of the top and the bottom
  13034. graphs of each waveform. Since whites, grays, and blacks are characterized
  13035. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13036. should display three waveforms of roughly equal width/height. If not, the
  13037. correction is easy to perform by making level adjustments the three waveforms.
  13038. @end table
  13039. Default is @code{stack}.
  13040. @item components, c
  13041. Set which color components to display. Default is 1, which means only luminance
  13042. or red color component if input is in RGB colorspace. If is set for example to
  13043. 7 it will display all 3 (if) available color components.
  13044. @item envelope, e
  13045. @table @samp
  13046. @item none
  13047. No envelope, this is default.
  13048. @item instant
  13049. Instant envelope, minimum and maximum values presented in graph will be easily
  13050. visible even with small @code{step} value.
  13051. @item peak
  13052. Hold minimum and maximum values presented in graph across time. This way you
  13053. can still spot out of range values without constantly looking at waveforms.
  13054. @item peak+instant
  13055. Peak and instant envelope combined together.
  13056. @end table
  13057. @item filter, f
  13058. @table @samp
  13059. @item lowpass
  13060. No filtering, this is default.
  13061. @item flat
  13062. Luma and chroma combined together.
  13063. @item aflat
  13064. Similar as above, but shows difference between blue and red chroma.
  13065. @item xflat
  13066. Similar as above, but use different colors.
  13067. @item chroma
  13068. Displays only chroma.
  13069. @item color
  13070. Displays actual color value on waveform.
  13071. @item acolor
  13072. Similar as above, but with luma showing frequency of chroma values.
  13073. @end table
  13074. @item graticule, g
  13075. Set which graticule to display.
  13076. @table @samp
  13077. @item none
  13078. Do not display graticule.
  13079. @item green
  13080. Display green graticule showing legal broadcast ranges.
  13081. @item orange
  13082. Display orange graticule showing legal broadcast ranges.
  13083. @end table
  13084. @item opacity, o
  13085. Set graticule opacity.
  13086. @item flags, fl
  13087. Set graticule flags.
  13088. @table @samp
  13089. @item numbers
  13090. Draw numbers above lines. By default enabled.
  13091. @item dots
  13092. Draw dots instead of lines.
  13093. @end table
  13094. @item scale, s
  13095. Set scale used for displaying graticule.
  13096. @table @samp
  13097. @item digital
  13098. @item millivolts
  13099. @item ire
  13100. @end table
  13101. Default is digital.
  13102. @item bgopacity, b
  13103. Set background opacity.
  13104. @end table
  13105. @section weave, doubleweave
  13106. The @code{weave} takes a field-based video input and join
  13107. each two sequential fields into single frame, producing a new double
  13108. height clip with half the frame rate and half the frame count.
  13109. The @code{doubleweave} works same as @code{weave} but without
  13110. halving frame rate and frame count.
  13111. It accepts the following option:
  13112. @table @option
  13113. @item first_field
  13114. Set first field. Available values are:
  13115. @table @samp
  13116. @item top, t
  13117. Set the frame as top-field-first.
  13118. @item bottom, b
  13119. Set the frame as bottom-field-first.
  13120. @end table
  13121. @end table
  13122. @subsection Examples
  13123. @itemize
  13124. @item
  13125. Interlace video using @ref{select} and @ref{separatefields} filter:
  13126. @example
  13127. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13128. @end example
  13129. @end itemize
  13130. @section xbr
  13131. Apply the xBR high-quality magnification filter which is designed for pixel
  13132. art. It follows a set of edge-detection rules, see
  13133. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13134. It accepts the following option:
  13135. @table @option
  13136. @item n
  13137. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13138. @code{3xBR} and @code{4} for @code{4xBR}.
  13139. Default is @code{3}.
  13140. @end table
  13141. @anchor{yadif}
  13142. @section yadif
  13143. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13144. filter").
  13145. It accepts the following parameters:
  13146. @table @option
  13147. @item mode
  13148. The interlacing mode to adopt. It accepts one of the following values:
  13149. @table @option
  13150. @item 0, send_frame
  13151. Output one frame for each frame.
  13152. @item 1, send_field
  13153. Output one frame for each field.
  13154. @item 2, send_frame_nospatial
  13155. Like @code{send_frame}, but it skips the spatial interlacing check.
  13156. @item 3, send_field_nospatial
  13157. Like @code{send_field}, but it skips the spatial interlacing check.
  13158. @end table
  13159. The default value is @code{send_frame}.
  13160. @item parity
  13161. The picture field parity assumed for the input interlaced video. It accepts one
  13162. of the following values:
  13163. @table @option
  13164. @item 0, tff
  13165. Assume the top field is first.
  13166. @item 1, bff
  13167. Assume the bottom field is first.
  13168. @item -1, auto
  13169. Enable automatic detection of field parity.
  13170. @end table
  13171. The default value is @code{auto}.
  13172. If the interlacing is unknown or the decoder does not export this information,
  13173. top field first will be assumed.
  13174. @item deint
  13175. Specify which frames to deinterlace. Accept one of the following
  13176. values:
  13177. @table @option
  13178. @item 0, all
  13179. Deinterlace all frames.
  13180. @item 1, interlaced
  13181. Only deinterlace frames marked as interlaced.
  13182. @end table
  13183. The default value is @code{all}.
  13184. @end table
  13185. @section zoompan
  13186. Apply Zoom & Pan effect.
  13187. This filter accepts the following options:
  13188. @table @option
  13189. @item zoom, z
  13190. Set the zoom expression. Default is 1.
  13191. @item x
  13192. @item y
  13193. Set the x and y expression. Default is 0.
  13194. @item d
  13195. Set the duration expression in number of frames.
  13196. This sets for how many number of frames effect will last for
  13197. single input image.
  13198. @item s
  13199. Set the output image size, default is 'hd720'.
  13200. @item fps
  13201. Set the output frame rate, default is '25'.
  13202. @end table
  13203. Each expression can contain the following constants:
  13204. @table @option
  13205. @item in_w, iw
  13206. Input width.
  13207. @item in_h, ih
  13208. Input height.
  13209. @item out_w, ow
  13210. Output width.
  13211. @item out_h, oh
  13212. Output height.
  13213. @item in
  13214. Input frame count.
  13215. @item on
  13216. Output frame count.
  13217. @item x
  13218. @item y
  13219. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13220. for current input frame.
  13221. @item px
  13222. @item py
  13223. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13224. not yet such frame (first input frame).
  13225. @item zoom
  13226. Last calculated zoom from 'z' expression for current input frame.
  13227. @item pzoom
  13228. Last calculated zoom of last output frame of previous input frame.
  13229. @item duration
  13230. Number of output frames for current input frame. Calculated from 'd' expression
  13231. for each input frame.
  13232. @item pduration
  13233. number of output frames created for previous input frame
  13234. @item a
  13235. Rational number: input width / input height
  13236. @item sar
  13237. sample aspect ratio
  13238. @item dar
  13239. display aspect ratio
  13240. @end table
  13241. @subsection Examples
  13242. @itemize
  13243. @item
  13244. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13245. @example
  13246. 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
  13247. @end example
  13248. @item
  13249. Zoom-in up to 1.5 and pan always at center of picture:
  13250. @example
  13251. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13252. @end example
  13253. @item
  13254. Same as above but without pausing:
  13255. @example
  13256. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13257. @end example
  13258. @end itemize
  13259. @anchor{zscale}
  13260. @section zscale
  13261. Scale (resize) the input video, using the z.lib library:
  13262. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13263. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13264. The zscale filter forces the output display aspect ratio to be the same
  13265. as the input, by changing the output sample aspect ratio.
  13266. If the input image format is different from the format requested by
  13267. the next filter, the zscale filter will convert the input to the
  13268. requested format.
  13269. @subsection Options
  13270. The filter accepts the following options.
  13271. @table @option
  13272. @item width, w
  13273. @item height, h
  13274. Set the output video dimension expression. Default value is the input
  13275. dimension.
  13276. If the @var{width} or @var{w} value is 0, the input width is used for
  13277. the output. If the @var{height} or @var{h} value is 0, the input height
  13278. is used for the output.
  13279. If one and only one of the values is -n with n >= 1, the zscale filter
  13280. will use a value that maintains the aspect ratio of the input image,
  13281. calculated from the other specified dimension. After that it will,
  13282. however, make sure that the calculated dimension is divisible by n and
  13283. adjust the value if necessary.
  13284. If both values are -n with n >= 1, the behavior will be identical to
  13285. both values being set to 0 as previously detailed.
  13286. See below for the list of accepted constants for use in the dimension
  13287. expression.
  13288. @item size, s
  13289. Set the video size. For the syntax of this option, check the
  13290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13291. @item dither, d
  13292. Set the dither type.
  13293. Possible values are:
  13294. @table @var
  13295. @item none
  13296. @item ordered
  13297. @item random
  13298. @item error_diffusion
  13299. @end table
  13300. Default is none.
  13301. @item filter, f
  13302. Set the resize filter type.
  13303. Possible values are:
  13304. @table @var
  13305. @item point
  13306. @item bilinear
  13307. @item bicubic
  13308. @item spline16
  13309. @item spline36
  13310. @item lanczos
  13311. @end table
  13312. Default is bilinear.
  13313. @item range, r
  13314. Set the color range.
  13315. Possible values are:
  13316. @table @var
  13317. @item input
  13318. @item limited
  13319. @item full
  13320. @end table
  13321. Default is same as input.
  13322. @item primaries, p
  13323. Set the color primaries.
  13324. Possible values are:
  13325. @table @var
  13326. @item input
  13327. @item 709
  13328. @item unspecified
  13329. @item 170m
  13330. @item 240m
  13331. @item 2020
  13332. @end table
  13333. Default is same as input.
  13334. @item transfer, t
  13335. Set the transfer characteristics.
  13336. Possible values are:
  13337. @table @var
  13338. @item input
  13339. @item 709
  13340. @item unspecified
  13341. @item 601
  13342. @item linear
  13343. @item 2020_10
  13344. @item 2020_12
  13345. @item smpte2084
  13346. @item iec61966-2-1
  13347. @item arib-std-b67
  13348. @end table
  13349. Default is same as input.
  13350. @item matrix, m
  13351. Set the colorspace matrix.
  13352. Possible value are:
  13353. @table @var
  13354. @item input
  13355. @item 709
  13356. @item unspecified
  13357. @item 470bg
  13358. @item 170m
  13359. @item 2020_ncl
  13360. @item 2020_cl
  13361. @end table
  13362. Default is same as input.
  13363. @item rangein, rin
  13364. Set the input color range.
  13365. Possible values are:
  13366. @table @var
  13367. @item input
  13368. @item limited
  13369. @item full
  13370. @end table
  13371. Default is same as input.
  13372. @item primariesin, pin
  13373. Set the input color primaries.
  13374. Possible values are:
  13375. @table @var
  13376. @item input
  13377. @item 709
  13378. @item unspecified
  13379. @item 170m
  13380. @item 240m
  13381. @item 2020
  13382. @end table
  13383. Default is same as input.
  13384. @item transferin, tin
  13385. Set the input transfer characteristics.
  13386. Possible values are:
  13387. @table @var
  13388. @item input
  13389. @item 709
  13390. @item unspecified
  13391. @item 601
  13392. @item linear
  13393. @item 2020_10
  13394. @item 2020_12
  13395. @end table
  13396. Default is same as input.
  13397. @item matrixin, min
  13398. Set the input colorspace matrix.
  13399. Possible value are:
  13400. @table @var
  13401. @item input
  13402. @item 709
  13403. @item unspecified
  13404. @item 470bg
  13405. @item 170m
  13406. @item 2020_ncl
  13407. @item 2020_cl
  13408. @end table
  13409. @item chromal, c
  13410. Set the output chroma location.
  13411. Possible values are:
  13412. @table @var
  13413. @item input
  13414. @item left
  13415. @item center
  13416. @item topleft
  13417. @item top
  13418. @item bottomleft
  13419. @item bottom
  13420. @end table
  13421. @item chromalin, cin
  13422. Set the input chroma location.
  13423. Possible values are:
  13424. @table @var
  13425. @item input
  13426. @item left
  13427. @item center
  13428. @item topleft
  13429. @item top
  13430. @item bottomleft
  13431. @item bottom
  13432. @end table
  13433. @item npl
  13434. Set the nominal peak luminance.
  13435. @end table
  13436. The values of the @option{w} and @option{h} options are expressions
  13437. containing the following constants:
  13438. @table @var
  13439. @item in_w
  13440. @item in_h
  13441. The input width and height
  13442. @item iw
  13443. @item ih
  13444. These are the same as @var{in_w} and @var{in_h}.
  13445. @item out_w
  13446. @item out_h
  13447. The output (scaled) width and height
  13448. @item ow
  13449. @item oh
  13450. These are the same as @var{out_w} and @var{out_h}
  13451. @item a
  13452. The same as @var{iw} / @var{ih}
  13453. @item sar
  13454. input sample aspect ratio
  13455. @item dar
  13456. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13457. @item hsub
  13458. @item vsub
  13459. horizontal and vertical input chroma subsample values. For example for the
  13460. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13461. @item ohsub
  13462. @item ovsub
  13463. horizontal and vertical output chroma subsample values. For example for the
  13464. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13465. @end table
  13466. @table @option
  13467. @end table
  13468. @c man end VIDEO FILTERS
  13469. @chapter Video Sources
  13470. @c man begin VIDEO SOURCES
  13471. Below is a description of the currently available video sources.
  13472. @section buffer
  13473. Buffer video frames, and make them available to the filter chain.
  13474. This source is mainly intended for a programmatic use, in particular
  13475. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13476. It accepts the following parameters:
  13477. @table @option
  13478. @item video_size
  13479. Specify the size (width and height) of the buffered video frames. For the
  13480. syntax of this option, check the
  13481. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13482. @item width
  13483. The input video width.
  13484. @item height
  13485. The input video height.
  13486. @item pix_fmt
  13487. A string representing the pixel format of the buffered video frames.
  13488. It may be a number corresponding to a pixel format, or a pixel format
  13489. name.
  13490. @item time_base
  13491. Specify the timebase assumed by the timestamps of the buffered frames.
  13492. @item frame_rate
  13493. Specify the frame rate expected for the video stream.
  13494. @item pixel_aspect, sar
  13495. The sample (pixel) aspect ratio of the input video.
  13496. @item sws_param
  13497. Specify the optional parameters to be used for the scale filter which
  13498. is automatically inserted when an input change is detected in the
  13499. input size or format.
  13500. @item hw_frames_ctx
  13501. When using a hardware pixel format, this should be a reference to an
  13502. AVHWFramesContext describing input frames.
  13503. @end table
  13504. For example:
  13505. @example
  13506. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13507. @end example
  13508. will instruct the source to accept video frames with size 320x240 and
  13509. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13510. square pixels (1:1 sample aspect ratio).
  13511. Since the pixel format with name "yuv410p" corresponds to the number 6
  13512. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13513. this example corresponds to:
  13514. @example
  13515. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13516. @end example
  13517. Alternatively, the options can be specified as a flat string, but this
  13518. syntax is deprecated:
  13519. @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}]
  13520. @section cellauto
  13521. Create a pattern generated by an elementary cellular automaton.
  13522. The initial state of the cellular automaton can be defined through the
  13523. @option{filename} and @option{pattern} options. If such options are
  13524. not specified an initial state is created randomly.
  13525. At each new frame a new row in the video is filled with the result of
  13526. the cellular automaton next generation. The behavior when the whole
  13527. frame is filled is defined by the @option{scroll} option.
  13528. This source accepts the following options:
  13529. @table @option
  13530. @item filename, f
  13531. Read the initial cellular automaton state, i.e. the starting row, from
  13532. the specified file.
  13533. In the file, each non-whitespace character is considered an alive
  13534. cell, a newline will terminate the row, and further characters in the
  13535. file will be ignored.
  13536. @item pattern, p
  13537. Read the initial cellular automaton state, i.e. the starting row, from
  13538. the specified string.
  13539. Each non-whitespace character in the string is considered an alive
  13540. cell, a newline will terminate the row, and further characters in the
  13541. string will be ignored.
  13542. @item rate, r
  13543. Set the video rate, that is the number of frames generated per second.
  13544. Default is 25.
  13545. @item random_fill_ratio, ratio
  13546. Set the random fill ratio for the initial cellular automaton row. It
  13547. is a floating point number value ranging from 0 to 1, defaults to
  13548. 1/PHI.
  13549. This option is ignored when a file or a pattern is specified.
  13550. @item random_seed, seed
  13551. Set the seed for filling randomly the initial row, must be an integer
  13552. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13553. set to -1, the filter will try to use a good random seed on a best
  13554. effort basis.
  13555. @item rule
  13556. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13557. Default value is 110.
  13558. @item size, s
  13559. Set the size of the output video. For the syntax of this option, check the
  13560. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13561. If @option{filename} or @option{pattern} is specified, the size is set
  13562. by default to the width of the specified initial state row, and the
  13563. height is set to @var{width} * PHI.
  13564. If @option{size} is set, it must contain the width of the specified
  13565. pattern string, and the specified pattern will be centered in the
  13566. larger row.
  13567. If a filename or a pattern string is not specified, the size value
  13568. defaults to "320x518" (used for a randomly generated initial state).
  13569. @item scroll
  13570. If set to 1, scroll the output upward when all the rows in the output
  13571. have been already filled. If set to 0, the new generated row will be
  13572. written over the top row just after the bottom row is filled.
  13573. Defaults to 1.
  13574. @item start_full, full
  13575. If set to 1, completely fill the output with generated rows before
  13576. outputting the first frame.
  13577. This is the default behavior, for disabling set the value to 0.
  13578. @item stitch
  13579. If set to 1, stitch the left and right row edges together.
  13580. This is the default behavior, for disabling set the value to 0.
  13581. @end table
  13582. @subsection Examples
  13583. @itemize
  13584. @item
  13585. Read the initial state from @file{pattern}, and specify an output of
  13586. size 200x400.
  13587. @example
  13588. cellauto=f=pattern:s=200x400
  13589. @end example
  13590. @item
  13591. Generate a random initial row with a width of 200 cells, with a fill
  13592. ratio of 2/3:
  13593. @example
  13594. cellauto=ratio=2/3:s=200x200
  13595. @end example
  13596. @item
  13597. Create a pattern generated by rule 18 starting by a single alive cell
  13598. centered on an initial row with width 100:
  13599. @example
  13600. cellauto=p=@@:s=100x400:full=0:rule=18
  13601. @end example
  13602. @item
  13603. Specify a more elaborated initial pattern:
  13604. @example
  13605. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13606. @end example
  13607. @end itemize
  13608. @anchor{coreimagesrc}
  13609. @section coreimagesrc
  13610. Video source generated on GPU using Apple's CoreImage API on OSX.
  13611. This video source is a specialized version of the @ref{coreimage} video filter.
  13612. Use a core image generator at the beginning of the applied filterchain to
  13613. generate the content.
  13614. The coreimagesrc video source accepts the following options:
  13615. @table @option
  13616. @item list_generators
  13617. List all available generators along with all their respective options as well as
  13618. possible minimum and maximum values along with the default values.
  13619. @example
  13620. list_generators=true
  13621. @end example
  13622. @item size, s
  13623. Specify the size of the sourced video. For the syntax of this option, check the
  13624. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13625. The default value is @code{320x240}.
  13626. @item rate, r
  13627. Specify the frame rate of the sourced video, as the number of frames
  13628. generated per second. It has to be a string in the format
  13629. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13630. number or a valid video frame rate abbreviation. The default value is
  13631. "25".
  13632. @item sar
  13633. Set the sample aspect ratio of the sourced video.
  13634. @item duration, d
  13635. Set the duration of the sourced video. See
  13636. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13637. for the accepted syntax.
  13638. If not specified, or the expressed duration is negative, the video is
  13639. supposed to be generated forever.
  13640. @end table
  13641. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13642. A complete filterchain can be used for further processing of the
  13643. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13644. and examples for details.
  13645. @subsection Examples
  13646. @itemize
  13647. @item
  13648. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13649. given as complete and escaped command-line for Apple's standard bash shell:
  13650. @example
  13651. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13652. @end example
  13653. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13654. need for a nullsrc video source.
  13655. @end itemize
  13656. @section mandelbrot
  13657. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13658. point specified with @var{start_x} and @var{start_y}.
  13659. This source accepts the following options:
  13660. @table @option
  13661. @item end_pts
  13662. Set the terminal pts value. Default value is 400.
  13663. @item end_scale
  13664. Set the terminal scale value.
  13665. Must be a floating point value. Default value is 0.3.
  13666. @item inner
  13667. Set the inner coloring mode, that is the algorithm used to draw the
  13668. Mandelbrot fractal internal region.
  13669. It shall assume one of the following values:
  13670. @table @option
  13671. @item black
  13672. Set black mode.
  13673. @item convergence
  13674. Show time until convergence.
  13675. @item mincol
  13676. Set color based on point closest to the origin of the iterations.
  13677. @item period
  13678. Set period mode.
  13679. @end table
  13680. Default value is @var{mincol}.
  13681. @item bailout
  13682. Set the bailout value. Default value is 10.0.
  13683. @item maxiter
  13684. Set the maximum of iterations performed by the rendering
  13685. algorithm. Default value is 7189.
  13686. @item outer
  13687. Set outer coloring mode.
  13688. It shall assume one of following values:
  13689. @table @option
  13690. @item iteration_count
  13691. Set iteration cound mode.
  13692. @item normalized_iteration_count
  13693. set normalized iteration count mode.
  13694. @end table
  13695. Default value is @var{normalized_iteration_count}.
  13696. @item rate, r
  13697. Set frame rate, expressed as number of frames per second. Default
  13698. value is "25".
  13699. @item size, s
  13700. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13701. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13702. @item start_scale
  13703. Set the initial scale value. Default value is 3.0.
  13704. @item start_x
  13705. Set the initial x position. Must be a floating point value between
  13706. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13707. @item start_y
  13708. Set the initial y position. Must be a floating point value between
  13709. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13710. @end table
  13711. @section mptestsrc
  13712. Generate various test patterns, as generated by the MPlayer test filter.
  13713. The size of the generated video is fixed, and is 256x256.
  13714. This source is useful in particular for testing encoding features.
  13715. This source accepts the following options:
  13716. @table @option
  13717. @item rate, r
  13718. Specify the frame rate of the sourced video, as the number of frames
  13719. generated per second. It has to be a string in the format
  13720. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13721. number or a valid video frame rate abbreviation. The default value is
  13722. "25".
  13723. @item duration, d
  13724. Set the duration of the sourced video. See
  13725. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13726. for the accepted syntax.
  13727. If not specified, or the expressed duration is negative, the video is
  13728. supposed to be generated forever.
  13729. @item test, t
  13730. Set the number or the name of the test to perform. Supported tests are:
  13731. @table @option
  13732. @item dc_luma
  13733. @item dc_chroma
  13734. @item freq_luma
  13735. @item freq_chroma
  13736. @item amp_luma
  13737. @item amp_chroma
  13738. @item cbp
  13739. @item mv
  13740. @item ring1
  13741. @item ring2
  13742. @item all
  13743. @end table
  13744. Default value is "all", which will cycle through the list of all tests.
  13745. @end table
  13746. Some examples:
  13747. @example
  13748. mptestsrc=t=dc_luma
  13749. @end example
  13750. will generate a "dc_luma" test pattern.
  13751. @section frei0r_src
  13752. Provide a frei0r source.
  13753. To enable compilation of this filter you need to install the frei0r
  13754. header and configure FFmpeg with @code{--enable-frei0r}.
  13755. This source accepts the following parameters:
  13756. @table @option
  13757. @item size
  13758. The size of the video to generate. For the syntax of this option, check the
  13759. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13760. @item framerate
  13761. The framerate of the generated video. It may be a string of the form
  13762. @var{num}/@var{den} or a frame rate abbreviation.
  13763. @item filter_name
  13764. The name to the frei0r source to load. For more information regarding frei0r and
  13765. how to set the parameters, read the @ref{frei0r} section in the video filters
  13766. documentation.
  13767. @item filter_params
  13768. A '|'-separated list of parameters to pass to the frei0r source.
  13769. @end table
  13770. For example, to generate a frei0r partik0l source with size 200x200
  13771. and frame rate 10 which is overlaid on the overlay filter main input:
  13772. @example
  13773. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13774. @end example
  13775. @section life
  13776. Generate a life pattern.
  13777. This source is based on a generalization of John Conway's life game.
  13778. The sourced input represents a life grid, each pixel represents a cell
  13779. which can be in one of two possible states, alive or dead. Every cell
  13780. interacts with its eight neighbours, which are the cells that are
  13781. horizontally, vertically, or diagonally adjacent.
  13782. At each interaction the grid evolves according to the adopted rule,
  13783. which specifies the number of neighbor alive cells which will make a
  13784. cell stay alive or born. The @option{rule} option allows one to specify
  13785. the rule to adopt.
  13786. This source accepts the following options:
  13787. @table @option
  13788. @item filename, f
  13789. Set the file from which to read the initial grid state. In the file,
  13790. each non-whitespace character is considered an alive cell, and newline
  13791. is used to delimit the end of each row.
  13792. If this option is not specified, the initial grid is generated
  13793. randomly.
  13794. @item rate, r
  13795. Set the video rate, that is the number of frames generated per second.
  13796. Default is 25.
  13797. @item random_fill_ratio, ratio
  13798. Set the random fill ratio for the initial random grid. It is a
  13799. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13800. It is ignored when a file is specified.
  13801. @item random_seed, seed
  13802. Set the seed for filling the initial random grid, must be an integer
  13803. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13804. set to -1, the filter will try to use a good random seed on a best
  13805. effort basis.
  13806. @item rule
  13807. Set the life rule.
  13808. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13809. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13810. @var{NS} specifies the number of alive neighbor cells which make a
  13811. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13812. which make a dead cell to become alive (i.e. to "born").
  13813. "s" and "b" can be used in place of "S" and "B", respectively.
  13814. Alternatively a rule can be specified by an 18-bits integer. The 9
  13815. high order bits are used to encode the next cell state if it is alive
  13816. for each number of neighbor alive cells, the low order bits specify
  13817. the rule for "borning" new cells. Higher order bits encode for an
  13818. higher number of neighbor cells.
  13819. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13820. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13821. Default value is "S23/B3", which is the original Conway's game of life
  13822. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13823. cells, and will born a new cell if there are three alive cells around
  13824. a dead cell.
  13825. @item size, s
  13826. Set the size of the output video. For the syntax of this option, check the
  13827. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13828. If @option{filename} is specified, the size is set by default to the
  13829. same size of the input file. If @option{size} is set, it must contain
  13830. the size specified in the input file, and the initial grid defined in
  13831. that file is centered in the larger resulting area.
  13832. If a filename is not specified, the size value defaults to "320x240"
  13833. (used for a randomly generated initial grid).
  13834. @item stitch
  13835. If set to 1, stitch the left and right grid edges together, and the
  13836. top and bottom edges also. Defaults to 1.
  13837. @item mold
  13838. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13839. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13840. value from 0 to 255.
  13841. @item life_color
  13842. Set the color of living (or new born) cells.
  13843. @item death_color
  13844. Set the color of dead cells. If @option{mold} is set, this is the first color
  13845. used to represent a dead cell.
  13846. @item mold_color
  13847. Set mold color, for definitely dead and moldy cells.
  13848. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13849. ffmpeg-utils manual,ffmpeg-utils}.
  13850. @end table
  13851. @subsection Examples
  13852. @itemize
  13853. @item
  13854. Read a grid from @file{pattern}, and center it on a grid of size
  13855. 300x300 pixels:
  13856. @example
  13857. life=f=pattern:s=300x300
  13858. @end example
  13859. @item
  13860. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13861. @example
  13862. life=ratio=2/3:s=200x200
  13863. @end example
  13864. @item
  13865. Specify a custom rule for evolving a randomly generated grid:
  13866. @example
  13867. life=rule=S14/B34
  13868. @end example
  13869. @item
  13870. Full example with slow death effect (mold) using @command{ffplay}:
  13871. @example
  13872. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13873. @end example
  13874. @end itemize
  13875. @anchor{allrgb}
  13876. @anchor{allyuv}
  13877. @anchor{color}
  13878. @anchor{haldclutsrc}
  13879. @anchor{nullsrc}
  13880. @anchor{pal75bars}
  13881. @anchor{pal100bars}
  13882. @anchor{rgbtestsrc}
  13883. @anchor{smptebars}
  13884. @anchor{smptehdbars}
  13885. @anchor{testsrc}
  13886. @anchor{testsrc2}
  13887. @anchor{yuvtestsrc}
  13888. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13889. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13890. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13891. The @code{color} source provides an uniformly colored input.
  13892. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13893. @ref{haldclut} filter.
  13894. The @code{nullsrc} source returns unprocessed video frames. It is
  13895. mainly useful to be employed in analysis / debugging tools, or as the
  13896. source for filters which ignore the input data.
  13897. The @code{pal75bars} source generates a color bars pattern, based on
  13898. EBU PAL recommendations with 75% color levels.
  13899. The @code{pal100bars} source generates a color bars pattern, based on
  13900. EBU PAL recommendations with 100% color levels.
  13901. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13902. detecting RGB vs BGR issues. You should see a red, green and blue
  13903. stripe from top to bottom.
  13904. The @code{smptebars} source generates a color bars pattern, based on
  13905. the SMPTE Engineering Guideline EG 1-1990.
  13906. The @code{smptehdbars} source generates a color bars pattern, based on
  13907. the SMPTE RP 219-2002.
  13908. The @code{testsrc} source generates a test video pattern, showing a
  13909. color pattern, a scrolling gradient and a timestamp. This is mainly
  13910. intended for testing purposes.
  13911. The @code{testsrc2} source is similar to testsrc, but supports more
  13912. pixel formats instead of just @code{rgb24}. This allows using it as an
  13913. input for other tests without requiring a format conversion.
  13914. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13915. see a y, cb and cr stripe from top to bottom.
  13916. The sources accept the following parameters:
  13917. @table @option
  13918. @item level
  13919. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13920. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13921. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13922. coded on a @code{1/(N*N)} scale.
  13923. @item color, c
  13924. Specify the color of the source, only available in the @code{color}
  13925. source. For the syntax of this option, check the
  13926. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13927. @item size, s
  13928. Specify the size of the sourced video. For the syntax of this option, check the
  13929. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13930. The default value is @code{320x240}.
  13931. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13932. @code{haldclutsrc} filters.
  13933. @item rate, r
  13934. Specify the frame rate of the sourced video, as the number of frames
  13935. generated per second. It has to be a string in the format
  13936. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13937. number or a valid video frame rate abbreviation. The default value is
  13938. "25".
  13939. @item duration, d
  13940. Set the duration of the sourced video. See
  13941. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13942. for the accepted syntax.
  13943. If not specified, or the expressed duration is negative, the video is
  13944. supposed to be generated forever.
  13945. @item sar
  13946. Set the sample aspect ratio of the sourced video.
  13947. @item alpha
  13948. Specify the alpha (opacity) of the background, only available in the
  13949. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13950. 255 (fully opaque, the default).
  13951. @item decimals, n
  13952. Set the number of decimals to show in the timestamp, only available in the
  13953. @code{testsrc} source.
  13954. The displayed timestamp value will correspond to the original
  13955. timestamp value multiplied by the power of 10 of the specified
  13956. value. Default value is 0.
  13957. @end table
  13958. @subsection Examples
  13959. @itemize
  13960. @item
  13961. Generate a video with a duration of 5.3 seconds, with size
  13962. 176x144 and a frame rate of 10 frames per second:
  13963. @example
  13964. testsrc=duration=5.3:size=qcif:rate=10
  13965. @end example
  13966. @item
  13967. The following graph description will generate a red source
  13968. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13969. frames per second:
  13970. @example
  13971. color=c=red@@0.2:s=qcif:r=10
  13972. @end example
  13973. @item
  13974. If the input content is to be ignored, @code{nullsrc} can be used. The
  13975. following command generates noise in the luminance plane by employing
  13976. the @code{geq} filter:
  13977. @example
  13978. nullsrc=s=256x256, geq=random(1)*255:128:128
  13979. @end example
  13980. @end itemize
  13981. @subsection Commands
  13982. The @code{color} source supports the following commands:
  13983. @table @option
  13984. @item c, color
  13985. Set the color of the created image. Accepts the same syntax of the
  13986. corresponding @option{color} option.
  13987. @end table
  13988. @section openclsrc
  13989. Generate video using an OpenCL program.
  13990. @table @option
  13991. @item source
  13992. OpenCL program source file.
  13993. @item kernel
  13994. Kernel name in program.
  13995. @item size, s
  13996. Size of frames to generate. This must be set.
  13997. @item format
  13998. Pixel format to use for the generated frames. This must be set.
  13999. @item rate, r
  14000. Number of frames generated every second. Default value is '25'.
  14001. @end table
  14002. For details of how the program loading works, see the @ref{program_opencl}
  14003. filter.
  14004. Example programs:
  14005. @itemize
  14006. @item
  14007. Generate a colour ramp by setting pixel values from the position of the pixel
  14008. in the output image. (Note that this will work with all pixel formats, but
  14009. the generated output will not be the same.)
  14010. @verbatim
  14011. __kernel void ramp(__write_only image2d_t dst,
  14012. unsigned int index)
  14013. {
  14014. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14015. float4 val;
  14016. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  14017. write_imagef(dst, loc, val);
  14018. }
  14019. @end verbatim
  14020. @item
  14021. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  14022. @verbatim
  14023. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  14024. unsigned int index)
  14025. {
  14026. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14027. float4 value = 0.0f;
  14028. int x = loc.x + index;
  14029. int y = loc.y + index;
  14030. while (x > 0 || y > 0) {
  14031. if (x % 3 == 1 && y % 3 == 1) {
  14032. value = 1.0f;
  14033. break;
  14034. }
  14035. x /= 3;
  14036. y /= 3;
  14037. }
  14038. write_imagef(dst, loc, value);
  14039. }
  14040. @end verbatim
  14041. @end itemize
  14042. @c man end VIDEO SOURCES
  14043. @chapter Video Sinks
  14044. @c man begin VIDEO SINKS
  14045. Below is a description of the currently available video sinks.
  14046. @section buffersink
  14047. Buffer video frames, and make them available to the end of the filter
  14048. graph.
  14049. This sink is mainly intended for programmatic use, in particular
  14050. through the interface defined in @file{libavfilter/buffersink.h}
  14051. or the options system.
  14052. It accepts a pointer to an AVBufferSinkContext structure, which
  14053. defines the incoming buffers' formats, to be passed as the opaque
  14054. parameter to @code{avfilter_init_filter} for initialization.
  14055. @section nullsink
  14056. Null video sink: do absolutely nothing with the input video. It is
  14057. mainly useful as a template and for use in analysis / debugging
  14058. tools.
  14059. @c man end VIDEO SINKS
  14060. @chapter Multimedia Filters
  14061. @c man begin MULTIMEDIA FILTERS
  14062. Below is a description of the currently available multimedia filters.
  14063. @section abitscope
  14064. Convert input audio to a video output, displaying the audio bit scope.
  14065. The filter accepts the following options:
  14066. @table @option
  14067. @item rate, r
  14068. Set frame rate, expressed as number of frames per second. Default
  14069. value is "25".
  14070. @item size, s
  14071. Specify the video size for the output. For the syntax of this option, check the
  14072. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14073. Default value is @code{1024x256}.
  14074. @item colors
  14075. Specify list of colors separated by space or by '|' which will be used to
  14076. draw channels. Unrecognized or missing colors will be replaced
  14077. by white color.
  14078. @end table
  14079. @section ahistogram
  14080. Convert input audio to a video output, displaying the volume histogram.
  14081. The filter accepts the following options:
  14082. @table @option
  14083. @item dmode
  14084. Specify how histogram is calculated.
  14085. It accepts the following values:
  14086. @table @samp
  14087. @item single
  14088. Use single histogram for all channels.
  14089. @item separate
  14090. Use separate histogram for each channel.
  14091. @end table
  14092. Default is @code{single}.
  14093. @item rate, r
  14094. Set frame rate, expressed as number of frames per second. Default
  14095. value is "25".
  14096. @item size, s
  14097. Specify the video size for the output. For the syntax of this option, check the
  14098. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14099. Default value is @code{hd720}.
  14100. @item scale
  14101. Set display scale.
  14102. It accepts the following values:
  14103. @table @samp
  14104. @item log
  14105. logarithmic
  14106. @item sqrt
  14107. square root
  14108. @item cbrt
  14109. cubic root
  14110. @item lin
  14111. linear
  14112. @item rlog
  14113. reverse logarithmic
  14114. @end table
  14115. Default is @code{log}.
  14116. @item ascale
  14117. Set amplitude scale.
  14118. It accepts the following values:
  14119. @table @samp
  14120. @item log
  14121. logarithmic
  14122. @item lin
  14123. linear
  14124. @end table
  14125. Default is @code{log}.
  14126. @item acount
  14127. Set how much frames to accumulate in histogram.
  14128. Defauls is 1. Setting this to -1 accumulates all frames.
  14129. @item rheight
  14130. Set histogram ratio of window height.
  14131. @item slide
  14132. Set sonogram sliding.
  14133. It accepts the following values:
  14134. @table @samp
  14135. @item replace
  14136. replace old rows with new ones.
  14137. @item scroll
  14138. scroll from top to bottom.
  14139. @end table
  14140. Default is @code{replace}.
  14141. @end table
  14142. @section aphasemeter
  14143. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14144. representing mean phase of current audio frame. A video output can also be produced and is
  14145. enabled by default. The audio is passed through as first output.
  14146. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14147. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14148. and @code{1} means channels are in phase.
  14149. The filter accepts the following options, all related to its video output:
  14150. @table @option
  14151. @item rate, r
  14152. Set the output frame rate. Default value is @code{25}.
  14153. @item size, s
  14154. Set the video size for the output. For the syntax of this option, check the
  14155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14156. Default value is @code{800x400}.
  14157. @item rc
  14158. @item gc
  14159. @item bc
  14160. Specify the red, green, blue contrast. Default values are @code{2},
  14161. @code{7} and @code{1}.
  14162. Allowed range is @code{[0, 255]}.
  14163. @item mpc
  14164. Set color which will be used for drawing median phase. If color is
  14165. @code{none} which is default, no median phase value will be drawn.
  14166. @item video
  14167. Enable video output. Default is enabled.
  14168. @end table
  14169. @section avectorscope
  14170. Convert input audio to a video output, representing the audio vector
  14171. scope.
  14172. The filter is used to measure the difference between channels of stereo
  14173. audio stream. A monoaural signal, consisting of identical left and right
  14174. signal, results in straight vertical line. Any stereo separation is visible
  14175. as a deviation from this line, creating a Lissajous figure.
  14176. If the straight (or deviation from it) but horizontal line appears this
  14177. indicates that the left and right channels are out of phase.
  14178. The filter accepts the following options:
  14179. @table @option
  14180. @item mode, m
  14181. Set the vectorscope mode.
  14182. Available values are:
  14183. @table @samp
  14184. @item lissajous
  14185. Lissajous rotated by 45 degrees.
  14186. @item lissajous_xy
  14187. Same as above but not rotated.
  14188. @item polar
  14189. Shape resembling half of circle.
  14190. @end table
  14191. Default value is @samp{lissajous}.
  14192. @item size, s
  14193. Set the video size for the output. For the syntax of this option, check the
  14194. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14195. Default value is @code{400x400}.
  14196. @item rate, r
  14197. Set the output frame rate. Default value is @code{25}.
  14198. @item rc
  14199. @item gc
  14200. @item bc
  14201. @item ac
  14202. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14203. @code{160}, @code{80} and @code{255}.
  14204. Allowed range is @code{[0, 255]}.
  14205. @item rf
  14206. @item gf
  14207. @item bf
  14208. @item af
  14209. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14210. @code{10}, @code{5} and @code{5}.
  14211. Allowed range is @code{[0, 255]}.
  14212. @item zoom
  14213. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14214. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14215. @item draw
  14216. Set the vectorscope drawing mode.
  14217. Available values are:
  14218. @table @samp
  14219. @item dot
  14220. Draw dot for each sample.
  14221. @item line
  14222. Draw line between previous and current sample.
  14223. @end table
  14224. Default value is @samp{dot}.
  14225. @item scale
  14226. Specify amplitude scale of audio samples.
  14227. Available values are:
  14228. @table @samp
  14229. @item lin
  14230. Linear.
  14231. @item sqrt
  14232. Square root.
  14233. @item cbrt
  14234. Cubic root.
  14235. @item log
  14236. Logarithmic.
  14237. @end table
  14238. @item swap
  14239. Swap left channel axis with right channel axis.
  14240. @item mirror
  14241. Mirror axis.
  14242. @table @samp
  14243. @item none
  14244. No mirror.
  14245. @item x
  14246. Mirror only x axis.
  14247. @item y
  14248. Mirror only y axis.
  14249. @item xy
  14250. Mirror both axis.
  14251. @end table
  14252. @end table
  14253. @subsection Examples
  14254. @itemize
  14255. @item
  14256. Complete example using @command{ffplay}:
  14257. @example
  14258. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14259. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14260. @end example
  14261. @end itemize
  14262. @section bench, abench
  14263. Benchmark part of a filtergraph.
  14264. The filter accepts the following options:
  14265. @table @option
  14266. @item action
  14267. Start or stop a timer.
  14268. Available values are:
  14269. @table @samp
  14270. @item start
  14271. Get the current time, set it as frame metadata (using the key
  14272. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14273. @item stop
  14274. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14275. the input frame metadata to get the time difference. Time difference, average,
  14276. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14277. @code{min}) are then printed. The timestamps are expressed in seconds.
  14278. @end table
  14279. @end table
  14280. @subsection Examples
  14281. @itemize
  14282. @item
  14283. Benchmark @ref{selectivecolor} filter:
  14284. @example
  14285. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14286. @end example
  14287. @end itemize
  14288. @section concat
  14289. Concatenate audio and video streams, joining them together one after the
  14290. other.
  14291. The filter works on segments of synchronized video and audio streams. All
  14292. segments must have the same number of streams of each type, and that will
  14293. also be the number of streams at output.
  14294. The filter accepts the following options:
  14295. @table @option
  14296. @item n
  14297. Set the number of segments. Default is 2.
  14298. @item v
  14299. Set the number of output video streams, that is also the number of video
  14300. streams in each segment. Default is 1.
  14301. @item a
  14302. Set the number of output audio streams, that is also the number of audio
  14303. streams in each segment. Default is 0.
  14304. @item unsafe
  14305. Activate unsafe mode: do not fail if segments have a different format.
  14306. @end table
  14307. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14308. @var{a} audio outputs.
  14309. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14310. segment, in the same order as the outputs, then the inputs for the second
  14311. segment, etc.
  14312. Related streams do not always have exactly the same duration, for various
  14313. reasons including codec frame size or sloppy authoring. For that reason,
  14314. related synchronized streams (e.g. a video and its audio track) should be
  14315. concatenated at once. The concat filter will use the duration of the longest
  14316. stream in each segment (except the last one), and if necessary pad shorter
  14317. audio streams with silence.
  14318. For this filter to work correctly, all segments must start at timestamp 0.
  14319. All corresponding streams must have the same parameters in all segments; the
  14320. filtering system will automatically select a common pixel format for video
  14321. streams, and a common sample format, sample rate and channel layout for
  14322. audio streams, but other settings, such as resolution, must be converted
  14323. explicitly by the user.
  14324. Different frame rates are acceptable but will result in variable frame rate
  14325. at output; be sure to configure the output file to handle it.
  14326. @subsection Examples
  14327. @itemize
  14328. @item
  14329. Concatenate an opening, an episode and an ending, all in bilingual version
  14330. (video in stream 0, audio in streams 1 and 2):
  14331. @example
  14332. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14333. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14334. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14335. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14336. @end example
  14337. @item
  14338. Concatenate two parts, handling audio and video separately, using the
  14339. (a)movie sources, and adjusting the resolution:
  14340. @example
  14341. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14342. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14343. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14344. @end example
  14345. Note that a desync will happen at the stitch if the audio and video streams
  14346. do not have exactly the same duration in the first file.
  14347. @end itemize
  14348. @subsection Commands
  14349. This filter supports the following commands:
  14350. @table @option
  14351. @item next
  14352. Close the current segment and step to the next one
  14353. @end table
  14354. @section drawgraph, adrawgraph
  14355. Draw a graph using input video or audio metadata.
  14356. It accepts the following parameters:
  14357. @table @option
  14358. @item m1
  14359. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14360. @item fg1
  14361. Set 1st foreground color expression.
  14362. @item m2
  14363. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14364. @item fg2
  14365. Set 2nd foreground color expression.
  14366. @item m3
  14367. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14368. @item fg3
  14369. Set 3rd foreground color expression.
  14370. @item m4
  14371. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14372. @item fg4
  14373. Set 4th foreground color expression.
  14374. @item min
  14375. Set minimal value of metadata value.
  14376. @item max
  14377. Set maximal value of metadata value.
  14378. @item bg
  14379. Set graph background color. Default is white.
  14380. @item mode
  14381. Set graph mode.
  14382. Available values for mode is:
  14383. @table @samp
  14384. @item bar
  14385. @item dot
  14386. @item line
  14387. @end table
  14388. Default is @code{line}.
  14389. @item slide
  14390. Set slide mode.
  14391. Available values for slide is:
  14392. @table @samp
  14393. @item frame
  14394. Draw new frame when right border is reached.
  14395. @item replace
  14396. Replace old columns with new ones.
  14397. @item scroll
  14398. Scroll from right to left.
  14399. @item rscroll
  14400. Scroll from left to right.
  14401. @item picture
  14402. Draw single picture.
  14403. @end table
  14404. Default is @code{frame}.
  14405. @item size
  14406. Set size of graph video. For the syntax of this option, check the
  14407. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14408. The default value is @code{900x256}.
  14409. The foreground color expressions can use the following variables:
  14410. @table @option
  14411. @item MIN
  14412. Minimal value of metadata value.
  14413. @item MAX
  14414. Maximal value of metadata value.
  14415. @item VAL
  14416. Current metadata key value.
  14417. @end table
  14418. The color is defined as 0xAABBGGRR.
  14419. @end table
  14420. Example using metadata from @ref{signalstats} filter:
  14421. @example
  14422. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14423. @end example
  14424. Example using metadata from @ref{ebur128} filter:
  14425. @example
  14426. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14427. @end example
  14428. @anchor{ebur128}
  14429. @section ebur128
  14430. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14431. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14432. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14433. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14434. The filter also has a video output (see the @var{video} option) with a real
  14435. time graph to observe the loudness evolution. The graphic contains the logged
  14436. message mentioned above, so it is not printed anymore when this option is set,
  14437. unless the verbose logging is set. The main graphing area contains the
  14438. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14439. the momentary loudness (400 milliseconds).
  14440. More information about the Loudness Recommendation EBU R128 on
  14441. @url{http://tech.ebu.ch/loudness}.
  14442. The filter accepts the following options:
  14443. @table @option
  14444. @item video
  14445. Activate the video output. The audio stream is passed unchanged whether this
  14446. option is set or no. The video stream will be the first output stream if
  14447. activated. Default is @code{0}.
  14448. @item size
  14449. Set the video size. This option is for video only. For the syntax of this
  14450. option, check the
  14451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14452. Default and minimum resolution is @code{640x480}.
  14453. @item meter
  14454. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14455. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14456. other integer value between this range is allowed.
  14457. @item metadata
  14458. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14459. into 100ms output frames, each of them containing various loudness information
  14460. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14461. Default is @code{0}.
  14462. @item framelog
  14463. Force the frame logging level.
  14464. Available values are:
  14465. @table @samp
  14466. @item info
  14467. information logging level
  14468. @item verbose
  14469. verbose logging level
  14470. @end table
  14471. By default, the logging level is set to @var{info}. If the @option{video} or
  14472. the @option{metadata} options are set, it switches to @var{verbose}.
  14473. @item peak
  14474. Set peak mode(s).
  14475. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14476. values are:
  14477. @table @samp
  14478. @item none
  14479. Disable any peak mode (default).
  14480. @item sample
  14481. Enable sample-peak mode.
  14482. Simple peak mode looking for the higher sample value. It logs a message
  14483. for sample-peak (identified by @code{SPK}).
  14484. @item true
  14485. Enable true-peak mode.
  14486. If enabled, the peak lookup is done on an over-sampled version of the input
  14487. stream for better peak accuracy. It logs a message for true-peak.
  14488. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14489. This mode requires a build with @code{libswresample}.
  14490. @end table
  14491. @item dualmono
  14492. Treat mono input files as "dual mono". If a mono file is intended for playback
  14493. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14494. If set to @code{true}, this option will compensate for this effect.
  14495. Multi-channel input files are not affected by this option.
  14496. @item panlaw
  14497. Set a specific pan law to be used for the measurement of dual mono files.
  14498. This parameter is optional, and has a default value of -3.01dB.
  14499. @end table
  14500. @subsection Examples
  14501. @itemize
  14502. @item
  14503. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14504. @example
  14505. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14506. @end example
  14507. @item
  14508. Run an analysis with @command{ffmpeg}:
  14509. @example
  14510. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14511. @end example
  14512. @end itemize
  14513. @section interleave, ainterleave
  14514. Temporally interleave frames from several inputs.
  14515. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14516. These filters read frames from several inputs and send the oldest
  14517. queued frame to the output.
  14518. Input streams must have well defined, monotonically increasing frame
  14519. timestamp values.
  14520. In order to submit one frame to output, these filters need to enqueue
  14521. at least one frame for each input, so they cannot work in case one
  14522. input is not yet terminated and will not receive incoming frames.
  14523. For example consider the case when one input is a @code{select} filter
  14524. which always drops input frames. The @code{interleave} filter will keep
  14525. reading from that input, but it will never be able to send new frames
  14526. to output until the input sends an end-of-stream signal.
  14527. Also, depending on inputs synchronization, the filters will drop
  14528. frames in case one input receives more frames than the other ones, and
  14529. the queue is already filled.
  14530. These filters accept the following options:
  14531. @table @option
  14532. @item nb_inputs, n
  14533. Set the number of different inputs, it is 2 by default.
  14534. @end table
  14535. @subsection Examples
  14536. @itemize
  14537. @item
  14538. Interleave frames belonging to different streams using @command{ffmpeg}:
  14539. @example
  14540. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14541. @end example
  14542. @item
  14543. Add flickering blur effect:
  14544. @example
  14545. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14546. @end example
  14547. @end itemize
  14548. @section metadata, ametadata
  14549. Manipulate frame metadata.
  14550. This filter accepts the following options:
  14551. @table @option
  14552. @item mode
  14553. Set mode of operation of the filter.
  14554. Can be one of the following:
  14555. @table @samp
  14556. @item select
  14557. If both @code{value} and @code{key} is set, select frames
  14558. which have such metadata. If only @code{key} is set, select
  14559. every frame that has such key in metadata.
  14560. @item add
  14561. Add new metadata @code{key} and @code{value}. If key is already available
  14562. do nothing.
  14563. @item modify
  14564. Modify value of already present key.
  14565. @item delete
  14566. If @code{value} is set, delete only keys that have such value.
  14567. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14568. the frame.
  14569. @item print
  14570. Print key and its value if metadata was found. If @code{key} is not set print all
  14571. metadata values available in frame.
  14572. @end table
  14573. @item key
  14574. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14575. @item value
  14576. Set metadata value which will be used. This option is mandatory for
  14577. @code{modify} and @code{add} mode.
  14578. @item function
  14579. Which function to use when comparing metadata value and @code{value}.
  14580. Can be one of following:
  14581. @table @samp
  14582. @item same_str
  14583. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14584. @item starts_with
  14585. Values are interpreted as strings, returns true if metadata value starts with
  14586. the @code{value} option string.
  14587. @item less
  14588. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14589. @item equal
  14590. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14591. @item greater
  14592. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14593. @item expr
  14594. Values are interpreted as floats, returns true if expression from option @code{expr}
  14595. evaluates to true.
  14596. @end table
  14597. @item expr
  14598. Set expression which is used when @code{function} is set to @code{expr}.
  14599. The expression is evaluated through the eval API and can contain the following
  14600. constants:
  14601. @table @option
  14602. @item VALUE1
  14603. Float representation of @code{value} from metadata key.
  14604. @item VALUE2
  14605. Float representation of @code{value} as supplied by user in @code{value} option.
  14606. @end table
  14607. @item file
  14608. If specified in @code{print} mode, output is written to the named file. Instead of
  14609. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14610. for standard output. If @code{file} option is not set, output is written to the log
  14611. with AV_LOG_INFO loglevel.
  14612. @end table
  14613. @subsection Examples
  14614. @itemize
  14615. @item
  14616. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14617. between 0 and 1.
  14618. @example
  14619. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14620. @end example
  14621. @item
  14622. Print silencedetect output to file @file{metadata.txt}.
  14623. @example
  14624. silencedetect,ametadata=mode=print:file=metadata.txt
  14625. @end example
  14626. @item
  14627. Direct all metadata to a pipe with file descriptor 4.
  14628. @example
  14629. metadata=mode=print:file='pipe\:4'
  14630. @end example
  14631. @end itemize
  14632. @section perms, aperms
  14633. Set read/write permissions for the output frames.
  14634. These filters are mainly aimed at developers to test direct path in the
  14635. following filter in the filtergraph.
  14636. The filters accept the following options:
  14637. @table @option
  14638. @item mode
  14639. Select the permissions mode.
  14640. It accepts the following values:
  14641. @table @samp
  14642. @item none
  14643. Do nothing. This is the default.
  14644. @item ro
  14645. Set all the output frames read-only.
  14646. @item rw
  14647. Set all the output frames directly writable.
  14648. @item toggle
  14649. Make the frame read-only if writable, and writable if read-only.
  14650. @item random
  14651. Set each output frame read-only or writable randomly.
  14652. @end table
  14653. @item seed
  14654. Set the seed for the @var{random} mode, must be an integer included between
  14655. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14656. @code{-1}, the filter will try to use a good random seed on a best effort
  14657. basis.
  14658. @end table
  14659. Note: in case of auto-inserted filter between the permission filter and the
  14660. following one, the permission might not be received as expected in that
  14661. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14662. perms/aperms filter can avoid this problem.
  14663. @section realtime, arealtime
  14664. Slow down filtering to match real time approximately.
  14665. These filters will pause the filtering for a variable amount of time to
  14666. match the output rate with the input timestamps.
  14667. They are similar to the @option{re} option to @code{ffmpeg}.
  14668. They accept the following options:
  14669. @table @option
  14670. @item limit
  14671. Time limit for the pauses. Any pause longer than that will be considered
  14672. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14673. @end table
  14674. @anchor{select}
  14675. @section select, aselect
  14676. Select frames to pass in output.
  14677. This filter accepts the following options:
  14678. @table @option
  14679. @item expr, e
  14680. Set expression, which is evaluated for each input frame.
  14681. If the expression is evaluated to zero, the frame is discarded.
  14682. If the evaluation result is negative or NaN, the frame is sent to the
  14683. first output; otherwise it is sent to the output with index
  14684. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14685. For example a value of @code{1.2} corresponds to the output with index
  14686. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14687. @item outputs, n
  14688. Set the number of outputs. The output to which to send the selected
  14689. frame is based on the result of the evaluation. Default value is 1.
  14690. @end table
  14691. The expression can contain the following constants:
  14692. @table @option
  14693. @item n
  14694. The (sequential) number of the filtered frame, starting from 0.
  14695. @item selected_n
  14696. The (sequential) number of the selected frame, starting from 0.
  14697. @item prev_selected_n
  14698. The sequential number of the last selected frame. It's NAN if undefined.
  14699. @item TB
  14700. The timebase of the input timestamps.
  14701. @item pts
  14702. The PTS (Presentation TimeStamp) of the filtered video frame,
  14703. expressed in @var{TB} units. It's NAN if undefined.
  14704. @item t
  14705. The PTS of the filtered video frame,
  14706. expressed in seconds. It's NAN if undefined.
  14707. @item prev_pts
  14708. The PTS of the previously filtered video frame. It's NAN if undefined.
  14709. @item prev_selected_pts
  14710. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14711. @item prev_selected_t
  14712. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14713. @item start_pts
  14714. The PTS of the first video frame in the video. It's NAN if undefined.
  14715. @item start_t
  14716. The time of the first video frame in the video. It's NAN if undefined.
  14717. @item pict_type @emph{(video only)}
  14718. The type of the filtered frame. It can assume one of the following
  14719. values:
  14720. @table @option
  14721. @item I
  14722. @item P
  14723. @item B
  14724. @item S
  14725. @item SI
  14726. @item SP
  14727. @item BI
  14728. @end table
  14729. @item interlace_type @emph{(video only)}
  14730. The frame interlace type. It can assume one of the following values:
  14731. @table @option
  14732. @item PROGRESSIVE
  14733. The frame is progressive (not interlaced).
  14734. @item TOPFIRST
  14735. The frame is top-field-first.
  14736. @item BOTTOMFIRST
  14737. The frame is bottom-field-first.
  14738. @end table
  14739. @item consumed_sample_n @emph{(audio only)}
  14740. the number of selected samples before the current frame
  14741. @item samples_n @emph{(audio only)}
  14742. the number of samples in the current frame
  14743. @item sample_rate @emph{(audio only)}
  14744. the input sample rate
  14745. @item key
  14746. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14747. @item pos
  14748. the position in the file of the filtered frame, -1 if the information
  14749. is not available (e.g. for synthetic video)
  14750. @item scene @emph{(video only)}
  14751. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14752. probability for the current frame to introduce a new scene, while a higher
  14753. value means the current frame is more likely to be one (see the example below)
  14754. @item concatdec_select
  14755. The concat demuxer can select only part of a concat input file by setting an
  14756. inpoint and an outpoint, but the output packets may not be entirely contained
  14757. in the selected interval. By using this variable, it is possible to skip frames
  14758. generated by the concat demuxer which are not exactly contained in the selected
  14759. interval.
  14760. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14761. and the @var{lavf.concat.duration} packet metadata values which are also
  14762. present in the decoded frames.
  14763. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14764. start_time and either the duration metadata is missing or the frame pts is less
  14765. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14766. missing.
  14767. That basically means that an input frame is selected if its pts is within the
  14768. interval set by the concat demuxer.
  14769. @end table
  14770. The default value of the select expression is "1".
  14771. @subsection Examples
  14772. @itemize
  14773. @item
  14774. Select all frames in input:
  14775. @example
  14776. select
  14777. @end example
  14778. The example above is the same as:
  14779. @example
  14780. select=1
  14781. @end example
  14782. @item
  14783. Skip all frames:
  14784. @example
  14785. select=0
  14786. @end example
  14787. @item
  14788. Select only I-frames:
  14789. @example
  14790. select='eq(pict_type\,I)'
  14791. @end example
  14792. @item
  14793. Select one frame every 100:
  14794. @example
  14795. select='not(mod(n\,100))'
  14796. @end example
  14797. @item
  14798. Select only frames contained in the 10-20 time interval:
  14799. @example
  14800. select=between(t\,10\,20)
  14801. @end example
  14802. @item
  14803. Select only I-frames contained in the 10-20 time interval:
  14804. @example
  14805. select=between(t\,10\,20)*eq(pict_type\,I)
  14806. @end example
  14807. @item
  14808. Select frames with a minimum distance of 10 seconds:
  14809. @example
  14810. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14811. @end example
  14812. @item
  14813. Use aselect to select only audio frames with samples number > 100:
  14814. @example
  14815. aselect='gt(samples_n\,100)'
  14816. @end example
  14817. @item
  14818. Create a mosaic of the first scenes:
  14819. @example
  14820. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14821. @end example
  14822. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14823. choice.
  14824. @item
  14825. Send even and odd frames to separate outputs, and compose them:
  14826. @example
  14827. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14828. @end example
  14829. @item
  14830. Select useful frames from an ffconcat file which is using inpoints and
  14831. outpoints but where the source files are not intra frame only.
  14832. @example
  14833. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14834. @end example
  14835. @end itemize
  14836. @section sendcmd, asendcmd
  14837. Send commands to filters in the filtergraph.
  14838. These filters read commands to be sent to other filters in the
  14839. filtergraph.
  14840. @code{sendcmd} must be inserted between two video filters,
  14841. @code{asendcmd} must be inserted between two audio filters, but apart
  14842. from that they act the same way.
  14843. The specification of commands can be provided in the filter arguments
  14844. with the @var{commands} option, or in a file specified by the
  14845. @var{filename} option.
  14846. These filters accept the following options:
  14847. @table @option
  14848. @item commands, c
  14849. Set the commands to be read and sent to the other filters.
  14850. @item filename, f
  14851. Set the filename of the commands to be read and sent to the other
  14852. filters.
  14853. @end table
  14854. @subsection Commands syntax
  14855. A commands description consists of a sequence of interval
  14856. specifications, comprising a list of commands to be executed when a
  14857. particular event related to that interval occurs. The occurring event
  14858. is typically the current frame time entering or leaving a given time
  14859. interval.
  14860. An interval is specified by the following syntax:
  14861. @example
  14862. @var{START}[-@var{END}] @var{COMMANDS};
  14863. @end example
  14864. The time interval is specified by the @var{START} and @var{END} times.
  14865. @var{END} is optional and defaults to the maximum time.
  14866. The current frame time is considered within the specified interval if
  14867. it is included in the interval [@var{START}, @var{END}), that is when
  14868. the time is greater or equal to @var{START} and is lesser than
  14869. @var{END}.
  14870. @var{COMMANDS} consists of a sequence of one or more command
  14871. specifications, separated by ",", relating to that interval. The
  14872. syntax of a command specification is given by:
  14873. @example
  14874. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14875. @end example
  14876. @var{FLAGS} is optional and specifies the type of events relating to
  14877. the time interval which enable sending the specified command, and must
  14878. be a non-null sequence of identifier flags separated by "+" or "|" and
  14879. enclosed between "[" and "]".
  14880. The following flags are recognized:
  14881. @table @option
  14882. @item enter
  14883. The command is sent when the current frame timestamp enters the
  14884. specified interval. In other words, the command is sent when the
  14885. previous frame timestamp was not in the given interval, and the
  14886. current is.
  14887. @item leave
  14888. The command is sent when the current frame timestamp leaves the
  14889. specified interval. In other words, the command is sent when the
  14890. previous frame timestamp was in the given interval, and the
  14891. current is not.
  14892. @end table
  14893. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14894. assumed.
  14895. @var{TARGET} specifies the target of the command, usually the name of
  14896. the filter class or a specific filter instance name.
  14897. @var{COMMAND} specifies the name of the command for the target filter.
  14898. @var{ARG} is optional and specifies the optional list of argument for
  14899. the given @var{COMMAND}.
  14900. Between one interval specification and another, whitespaces, or
  14901. sequences of characters starting with @code{#} until the end of line,
  14902. are ignored and can be used to annotate comments.
  14903. A simplified BNF description of the commands specification syntax
  14904. follows:
  14905. @example
  14906. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14907. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14908. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14909. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14910. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14911. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14912. @end example
  14913. @subsection Examples
  14914. @itemize
  14915. @item
  14916. Specify audio tempo change at second 4:
  14917. @example
  14918. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14919. @end example
  14920. @item
  14921. Target a specific filter instance:
  14922. @example
  14923. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14924. @end example
  14925. @item
  14926. Specify a list of drawtext and hue commands in a file.
  14927. @example
  14928. # show text in the interval 5-10
  14929. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14930. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14931. # desaturate the image in the interval 15-20
  14932. 15.0-20.0 [enter] hue s 0,
  14933. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14934. [leave] hue s 1,
  14935. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14936. # apply an exponential saturation fade-out effect, starting from time 25
  14937. 25 [enter] hue s exp(25-t)
  14938. @end example
  14939. A filtergraph allowing to read and process the above command list
  14940. stored in a file @file{test.cmd}, can be specified with:
  14941. @example
  14942. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14943. @end example
  14944. @end itemize
  14945. @anchor{setpts}
  14946. @section setpts, asetpts
  14947. Change the PTS (presentation timestamp) of the input frames.
  14948. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14949. This filter accepts the following options:
  14950. @table @option
  14951. @item expr
  14952. The expression which is evaluated for each frame to construct its timestamp.
  14953. @end table
  14954. The expression is evaluated through the eval API and can contain the following
  14955. constants:
  14956. @table @option
  14957. @item FRAME_RATE, FR
  14958. frame rate, only defined for constant frame-rate video
  14959. @item PTS
  14960. The presentation timestamp in input
  14961. @item N
  14962. The count of the input frame for video or the number of consumed samples,
  14963. not including the current frame for audio, starting from 0.
  14964. @item NB_CONSUMED_SAMPLES
  14965. The number of consumed samples, not including the current frame (only
  14966. audio)
  14967. @item NB_SAMPLES, S
  14968. The number of samples in the current frame (only audio)
  14969. @item SAMPLE_RATE, SR
  14970. The audio sample rate.
  14971. @item STARTPTS
  14972. The PTS of the first frame.
  14973. @item STARTT
  14974. the time in seconds of the first frame
  14975. @item INTERLACED
  14976. State whether the current frame is interlaced.
  14977. @item T
  14978. the time in seconds of the current frame
  14979. @item POS
  14980. original position in the file of the frame, or undefined if undefined
  14981. for the current frame
  14982. @item PREV_INPTS
  14983. The previous input PTS.
  14984. @item PREV_INT
  14985. previous input time in seconds
  14986. @item PREV_OUTPTS
  14987. The previous output PTS.
  14988. @item PREV_OUTT
  14989. previous output time in seconds
  14990. @item RTCTIME
  14991. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14992. instead.
  14993. @item RTCSTART
  14994. The wallclock (RTC) time at the start of the movie in microseconds.
  14995. @item TB
  14996. The timebase of the input timestamps.
  14997. @end table
  14998. @subsection Examples
  14999. @itemize
  15000. @item
  15001. Start counting PTS from zero
  15002. @example
  15003. setpts=PTS-STARTPTS
  15004. @end example
  15005. @item
  15006. Apply fast motion effect:
  15007. @example
  15008. setpts=0.5*PTS
  15009. @end example
  15010. @item
  15011. Apply slow motion effect:
  15012. @example
  15013. setpts=2.0*PTS
  15014. @end example
  15015. @item
  15016. Set fixed rate of 25 frames per second:
  15017. @example
  15018. setpts=N/(25*TB)
  15019. @end example
  15020. @item
  15021. Set fixed rate 25 fps with some jitter:
  15022. @example
  15023. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  15024. @end example
  15025. @item
  15026. Apply an offset of 10 seconds to the input PTS:
  15027. @example
  15028. setpts=PTS+10/TB
  15029. @end example
  15030. @item
  15031. Generate timestamps from a "live source" and rebase onto the current timebase:
  15032. @example
  15033. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  15034. @end example
  15035. @item
  15036. Generate timestamps by counting samples:
  15037. @example
  15038. asetpts=N/SR/TB
  15039. @end example
  15040. @end itemize
  15041. @section setrange
  15042. Force color range for the output video frame.
  15043. The @code{setrange} filter marks the color range property for the
  15044. output frames. It does not change the input frame, but only sets the
  15045. corresponding property, which affects how the frame is treated by
  15046. following filters.
  15047. The filter accepts the following options:
  15048. @table @option
  15049. @item range
  15050. Available values are:
  15051. @table @samp
  15052. @item auto
  15053. Keep the same color range property.
  15054. @item unspecified, unknown
  15055. Set the color range as unspecified.
  15056. @item limited, tv, mpeg
  15057. Set the color range as limited.
  15058. @item full, pc, jpeg
  15059. Set the color range as full.
  15060. @end table
  15061. @end table
  15062. @section settb, asettb
  15063. Set the timebase to use for the output frames timestamps.
  15064. It is mainly useful for testing timebase configuration.
  15065. It accepts the following parameters:
  15066. @table @option
  15067. @item expr, tb
  15068. The expression which is evaluated into the output timebase.
  15069. @end table
  15070. The value for @option{tb} is an arithmetic expression representing a
  15071. rational. The expression can contain the constants "AVTB" (the default
  15072. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15073. audio only). Default value is "intb".
  15074. @subsection Examples
  15075. @itemize
  15076. @item
  15077. Set the timebase to 1/25:
  15078. @example
  15079. settb=expr=1/25
  15080. @end example
  15081. @item
  15082. Set the timebase to 1/10:
  15083. @example
  15084. settb=expr=0.1
  15085. @end example
  15086. @item
  15087. Set the timebase to 1001/1000:
  15088. @example
  15089. settb=1+0.001
  15090. @end example
  15091. @item
  15092. Set the timebase to 2*intb:
  15093. @example
  15094. settb=2*intb
  15095. @end example
  15096. @item
  15097. Set the default timebase value:
  15098. @example
  15099. settb=AVTB
  15100. @end example
  15101. @end itemize
  15102. @section showcqt
  15103. Convert input audio to a video output representing frequency spectrum
  15104. logarithmically using Brown-Puckette constant Q transform algorithm with
  15105. direct frequency domain coefficient calculation (but the transform itself
  15106. is not really constant Q, instead the Q factor is actually variable/clamped),
  15107. with musical tone scale, from E0 to D#10.
  15108. The filter accepts the following options:
  15109. @table @option
  15110. @item size, s
  15111. Specify the video size for the output. It must be even. For the syntax of this option,
  15112. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15113. Default value is @code{1920x1080}.
  15114. @item fps, rate, r
  15115. Set the output frame rate. Default value is @code{25}.
  15116. @item bar_h
  15117. Set the bargraph height. It must be even. Default value is @code{-1} which
  15118. computes the bargraph height automatically.
  15119. @item axis_h
  15120. Set the axis height. It must be even. Default value is @code{-1} which computes
  15121. the axis height automatically.
  15122. @item sono_h
  15123. Set the sonogram height. It must be even. Default value is @code{-1} which
  15124. computes the sonogram height automatically.
  15125. @item fullhd
  15126. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15127. instead. Default value is @code{1}.
  15128. @item sono_v, volume
  15129. Specify the sonogram volume expression. It can contain variables:
  15130. @table @option
  15131. @item bar_v
  15132. the @var{bar_v} evaluated expression
  15133. @item frequency, freq, f
  15134. the frequency where it is evaluated
  15135. @item timeclamp, tc
  15136. the value of @var{timeclamp} option
  15137. @end table
  15138. and functions:
  15139. @table @option
  15140. @item a_weighting(f)
  15141. A-weighting of equal loudness
  15142. @item b_weighting(f)
  15143. B-weighting of equal loudness
  15144. @item c_weighting(f)
  15145. C-weighting of equal loudness.
  15146. @end table
  15147. Default value is @code{16}.
  15148. @item bar_v, volume2
  15149. Specify the bargraph volume expression. It can contain variables:
  15150. @table @option
  15151. @item sono_v
  15152. the @var{sono_v} evaluated expression
  15153. @item frequency, freq, f
  15154. the frequency where it is evaluated
  15155. @item timeclamp, tc
  15156. the value of @var{timeclamp} option
  15157. @end table
  15158. and functions:
  15159. @table @option
  15160. @item a_weighting(f)
  15161. A-weighting of equal loudness
  15162. @item b_weighting(f)
  15163. B-weighting of equal loudness
  15164. @item c_weighting(f)
  15165. C-weighting of equal loudness.
  15166. @end table
  15167. Default value is @code{sono_v}.
  15168. @item sono_g, gamma
  15169. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15170. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15171. Acceptable range is @code{[1, 7]}.
  15172. @item bar_g, gamma2
  15173. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15174. @code{[1, 7]}.
  15175. @item bar_t
  15176. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15177. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15178. @item timeclamp, tc
  15179. Specify the transform timeclamp. At low frequency, there is trade-off between
  15180. accuracy in time domain and frequency domain. If timeclamp is lower,
  15181. event in time domain is represented more accurately (such as fast bass drum),
  15182. otherwise event in frequency domain is represented more accurately
  15183. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15184. @item attack
  15185. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15186. limits future samples by applying asymmetric windowing in time domain, useful
  15187. when low latency is required. Accepted range is @code{[0, 1]}.
  15188. @item basefreq
  15189. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15190. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15191. @item endfreq
  15192. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15193. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15194. @item coeffclamp
  15195. This option is deprecated and ignored.
  15196. @item tlength
  15197. Specify the transform length in time domain. Use this option to control accuracy
  15198. trade-off between time domain and frequency domain at every frequency sample.
  15199. It can contain variables:
  15200. @table @option
  15201. @item frequency, freq, f
  15202. the frequency where it is evaluated
  15203. @item timeclamp, tc
  15204. the value of @var{timeclamp} option.
  15205. @end table
  15206. Default value is @code{384*tc/(384+tc*f)}.
  15207. @item count
  15208. Specify the transform count for every video frame. Default value is @code{6}.
  15209. Acceptable range is @code{[1, 30]}.
  15210. @item fcount
  15211. Specify the transform count for every single pixel. Default value is @code{0},
  15212. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15213. @item fontfile
  15214. Specify font file for use with freetype to draw the axis. If not specified,
  15215. use embedded font. Note that drawing with font file or embedded font is not
  15216. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15217. option instead.
  15218. @item font
  15219. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15220. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15221. @item fontcolor
  15222. Specify font color expression. This is arithmetic expression that should return
  15223. integer value 0xRRGGBB. It can contain variables:
  15224. @table @option
  15225. @item frequency, freq, f
  15226. the frequency where it is evaluated
  15227. @item timeclamp, tc
  15228. the value of @var{timeclamp} option
  15229. @end table
  15230. and functions:
  15231. @table @option
  15232. @item midi(f)
  15233. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15234. @item r(x), g(x), b(x)
  15235. red, green, and blue value of intensity x.
  15236. @end table
  15237. Default value is @code{st(0, (midi(f)-59.5)/12);
  15238. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15239. r(1-ld(1)) + b(ld(1))}.
  15240. @item axisfile
  15241. Specify image file to draw the axis. This option override @var{fontfile} and
  15242. @var{fontcolor} option.
  15243. @item axis, text
  15244. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15245. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15246. Default value is @code{1}.
  15247. @item csp
  15248. Set colorspace. The accepted values are:
  15249. @table @samp
  15250. @item unspecified
  15251. Unspecified (default)
  15252. @item bt709
  15253. BT.709
  15254. @item fcc
  15255. FCC
  15256. @item bt470bg
  15257. BT.470BG or BT.601-6 625
  15258. @item smpte170m
  15259. SMPTE-170M or BT.601-6 525
  15260. @item smpte240m
  15261. SMPTE-240M
  15262. @item bt2020ncl
  15263. BT.2020 with non-constant luminance
  15264. @end table
  15265. @item cscheme
  15266. Set spectrogram color scheme. This is list of floating point values with format
  15267. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15268. The default is @code{1|0.5|0|0|0.5|1}.
  15269. @end table
  15270. @subsection Examples
  15271. @itemize
  15272. @item
  15273. Playing audio while showing the spectrum:
  15274. @example
  15275. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15276. @end example
  15277. @item
  15278. Same as above, but with frame rate 30 fps:
  15279. @example
  15280. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15281. @end example
  15282. @item
  15283. Playing at 1280x720:
  15284. @example
  15285. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15286. @end example
  15287. @item
  15288. Disable sonogram display:
  15289. @example
  15290. sono_h=0
  15291. @end example
  15292. @item
  15293. A1 and its harmonics: A1, A2, (near)E3, A3:
  15294. @example
  15295. 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),
  15296. asplit[a][out1]; [a] showcqt [out0]'
  15297. @end example
  15298. @item
  15299. Same as above, but with more accuracy in frequency domain:
  15300. @example
  15301. 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),
  15302. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15303. @end example
  15304. @item
  15305. Custom volume:
  15306. @example
  15307. bar_v=10:sono_v=bar_v*a_weighting(f)
  15308. @end example
  15309. @item
  15310. Custom gamma, now spectrum is linear to the amplitude.
  15311. @example
  15312. bar_g=2:sono_g=2
  15313. @end example
  15314. @item
  15315. Custom tlength equation:
  15316. @example
  15317. 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)))'
  15318. @end example
  15319. @item
  15320. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15321. @example
  15322. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15323. @end example
  15324. @item
  15325. Custom font using fontconfig:
  15326. @example
  15327. font='Courier New,Monospace,mono|bold'
  15328. @end example
  15329. @item
  15330. Custom frequency range with custom axis using image file:
  15331. @example
  15332. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15333. @end example
  15334. @end itemize
  15335. @section showfreqs
  15336. Convert input audio to video output representing the audio power spectrum.
  15337. Audio amplitude is on Y-axis while frequency is on X-axis.
  15338. The filter accepts the following options:
  15339. @table @option
  15340. @item size, s
  15341. Specify size of video. For the syntax of this option, check the
  15342. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15343. Default is @code{1024x512}.
  15344. @item mode
  15345. Set display mode.
  15346. This set how each frequency bin will be represented.
  15347. It accepts the following values:
  15348. @table @samp
  15349. @item line
  15350. @item bar
  15351. @item dot
  15352. @end table
  15353. Default is @code{bar}.
  15354. @item ascale
  15355. Set amplitude scale.
  15356. It accepts the following values:
  15357. @table @samp
  15358. @item lin
  15359. Linear scale.
  15360. @item sqrt
  15361. Square root scale.
  15362. @item cbrt
  15363. Cubic root scale.
  15364. @item log
  15365. Logarithmic scale.
  15366. @end table
  15367. Default is @code{log}.
  15368. @item fscale
  15369. Set frequency scale.
  15370. It accepts the following values:
  15371. @table @samp
  15372. @item lin
  15373. Linear scale.
  15374. @item log
  15375. Logarithmic scale.
  15376. @item rlog
  15377. Reverse logarithmic scale.
  15378. @end table
  15379. Default is @code{lin}.
  15380. @item win_size
  15381. Set window size.
  15382. It accepts the following values:
  15383. @table @samp
  15384. @item w16
  15385. @item w32
  15386. @item w64
  15387. @item w128
  15388. @item w256
  15389. @item w512
  15390. @item w1024
  15391. @item w2048
  15392. @item w4096
  15393. @item w8192
  15394. @item w16384
  15395. @item w32768
  15396. @item w65536
  15397. @end table
  15398. Default is @code{w2048}
  15399. @item win_func
  15400. Set windowing function.
  15401. It accepts the following values:
  15402. @table @samp
  15403. @item rect
  15404. @item bartlett
  15405. @item hanning
  15406. @item hamming
  15407. @item blackman
  15408. @item welch
  15409. @item flattop
  15410. @item bharris
  15411. @item bnuttall
  15412. @item bhann
  15413. @item sine
  15414. @item nuttall
  15415. @item lanczos
  15416. @item gauss
  15417. @item tukey
  15418. @item dolph
  15419. @item cauchy
  15420. @item parzen
  15421. @item poisson
  15422. @end table
  15423. Default is @code{hanning}.
  15424. @item overlap
  15425. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15426. which means optimal overlap for selected window function will be picked.
  15427. @item averaging
  15428. Set time averaging. Setting this to 0 will display current maximal peaks.
  15429. Default is @code{1}, which means time averaging is disabled.
  15430. @item colors
  15431. Specify list of colors separated by space or by '|' which will be used to
  15432. draw channel frequencies. Unrecognized or missing colors will be replaced
  15433. by white color.
  15434. @item cmode
  15435. Set channel display mode.
  15436. It accepts the following values:
  15437. @table @samp
  15438. @item combined
  15439. @item separate
  15440. @end table
  15441. Default is @code{combined}.
  15442. @item minamp
  15443. Set minimum amplitude used in @code{log} amplitude scaler.
  15444. @end table
  15445. @anchor{showspectrum}
  15446. @section showspectrum
  15447. Convert input audio to a video output, representing the audio frequency
  15448. spectrum.
  15449. The filter accepts the following options:
  15450. @table @option
  15451. @item size, s
  15452. Specify the video size for the output. For the syntax of this option, check the
  15453. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15454. Default value is @code{640x512}.
  15455. @item slide
  15456. Specify how the spectrum should slide along the window.
  15457. It accepts the following values:
  15458. @table @samp
  15459. @item replace
  15460. the samples start again on the left when they reach the right
  15461. @item scroll
  15462. the samples scroll from right to left
  15463. @item fullframe
  15464. frames are only produced when the samples reach the right
  15465. @item rscroll
  15466. the samples scroll from left to right
  15467. @end table
  15468. Default value is @code{replace}.
  15469. @item mode
  15470. Specify display mode.
  15471. It accepts the following values:
  15472. @table @samp
  15473. @item combined
  15474. all channels are displayed in the same row
  15475. @item separate
  15476. all channels are displayed in separate rows
  15477. @end table
  15478. Default value is @samp{combined}.
  15479. @item color
  15480. Specify display color mode.
  15481. It accepts the following values:
  15482. @table @samp
  15483. @item channel
  15484. each channel is displayed in a separate color
  15485. @item intensity
  15486. each channel is displayed using the same color scheme
  15487. @item rainbow
  15488. each channel is displayed using the rainbow color scheme
  15489. @item moreland
  15490. each channel is displayed using the moreland color scheme
  15491. @item nebulae
  15492. each channel is displayed using the nebulae color scheme
  15493. @item fire
  15494. each channel is displayed using the fire color scheme
  15495. @item fiery
  15496. each channel is displayed using the fiery color scheme
  15497. @item fruit
  15498. each channel is displayed using the fruit color scheme
  15499. @item cool
  15500. each channel is displayed using the cool color scheme
  15501. @end table
  15502. Default value is @samp{channel}.
  15503. @item scale
  15504. Specify scale used for calculating intensity color values.
  15505. It accepts the following values:
  15506. @table @samp
  15507. @item lin
  15508. linear
  15509. @item sqrt
  15510. square root, default
  15511. @item cbrt
  15512. cubic root
  15513. @item log
  15514. logarithmic
  15515. @item 4thrt
  15516. 4th root
  15517. @item 5thrt
  15518. 5th root
  15519. @end table
  15520. Default value is @samp{sqrt}.
  15521. @item saturation
  15522. Set saturation modifier for displayed colors. Negative values provide
  15523. alternative color scheme. @code{0} is no saturation at all.
  15524. Saturation must be in [-10.0, 10.0] range.
  15525. Default value is @code{1}.
  15526. @item win_func
  15527. Set window function.
  15528. It accepts the following values:
  15529. @table @samp
  15530. @item rect
  15531. @item bartlett
  15532. @item hann
  15533. @item hanning
  15534. @item hamming
  15535. @item blackman
  15536. @item welch
  15537. @item flattop
  15538. @item bharris
  15539. @item bnuttall
  15540. @item bhann
  15541. @item sine
  15542. @item nuttall
  15543. @item lanczos
  15544. @item gauss
  15545. @item tukey
  15546. @item dolph
  15547. @item cauchy
  15548. @item parzen
  15549. @item poisson
  15550. @end table
  15551. Default value is @code{hann}.
  15552. @item orientation
  15553. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15554. @code{horizontal}. Default is @code{vertical}.
  15555. @item overlap
  15556. Set ratio of overlap window. Default value is @code{0}.
  15557. When value is @code{1} overlap is set to recommended size for specific
  15558. window function currently used.
  15559. @item gain
  15560. Set scale gain for calculating intensity color values.
  15561. Default value is @code{1}.
  15562. @item data
  15563. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15564. @item rotation
  15565. Set color rotation, must be in [-1.0, 1.0] range.
  15566. Default value is @code{0}.
  15567. @end table
  15568. The usage is very similar to the showwaves filter; see the examples in that
  15569. section.
  15570. @subsection Examples
  15571. @itemize
  15572. @item
  15573. Large window with logarithmic color scaling:
  15574. @example
  15575. showspectrum=s=1280x480:scale=log
  15576. @end example
  15577. @item
  15578. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15579. @example
  15580. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15581. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15582. @end example
  15583. @end itemize
  15584. @section showspectrumpic
  15585. Convert input audio to a single video frame, representing the audio frequency
  15586. spectrum.
  15587. The filter accepts the following options:
  15588. @table @option
  15589. @item size, s
  15590. Specify the video size for the output. For the syntax of this option, check the
  15591. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15592. Default value is @code{4096x2048}.
  15593. @item mode
  15594. Specify display mode.
  15595. It accepts the following values:
  15596. @table @samp
  15597. @item combined
  15598. all channels are displayed in the same row
  15599. @item separate
  15600. all channels are displayed in separate rows
  15601. @end table
  15602. Default value is @samp{combined}.
  15603. @item color
  15604. Specify display color mode.
  15605. It accepts the following values:
  15606. @table @samp
  15607. @item channel
  15608. each channel is displayed in a separate color
  15609. @item intensity
  15610. each channel is displayed using the same color scheme
  15611. @item rainbow
  15612. each channel is displayed using the rainbow color scheme
  15613. @item moreland
  15614. each channel is displayed using the moreland color scheme
  15615. @item nebulae
  15616. each channel is displayed using the nebulae color scheme
  15617. @item fire
  15618. each channel is displayed using the fire color scheme
  15619. @item fiery
  15620. each channel is displayed using the fiery color scheme
  15621. @item fruit
  15622. each channel is displayed using the fruit color scheme
  15623. @item cool
  15624. each channel is displayed using the cool color scheme
  15625. @end table
  15626. Default value is @samp{intensity}.
  15627. @item scale
  15628. Specify scale used for calculating intensity color values.
  15629. It accepts the following values:
  15630. @table @samp
  15631. @item lin
  15632. linear
  15633. @item sqrt
  15634. square root, default
  15635. @item cbrt
  15636. cubic root
  15637. @item log
  15638. logarithmic
  15639. @item 4thrt
  15640. 4th root
  15641. @item 5thrt
  15642. 5th root
  15643. @end table
  15644. Default value is @samp{log}.
  15645. @item saturation
  15646. Set saturation modifier for displayed colors. Negative values provide
  15647. alternative color scheme. @code{0} is no saturation at all.
  15648. Saturation must be in [-10.0, 10.0] range.
  15649. Default value is @code{1}.
  15650. @item win_func
  15651. Set window function.
  15652. It accepts the following values:
  15653. @table @samp
  15654. @item rect
  15655. @item bartlett
  15656. @item hann
  15657. @item hanning
  15658. @item hamming
  15659. @item blackman
  15660. @item welch
  15661. @item flattop
  15662. @item bharris
  15663. @item bnuttall
  15664. @item bhann
  15665. @item sine
  15666. @item nuttall
  15667. @item lanczos
  15668. @item gauss
  15669. @item tukey
  15670. @item dolph
  15671. @item cauchy
  15672. @item parzen
  15673. @item poisson
  15674. @end table
  15675. Default value is @code{hann}.
  15676. @item orientation
  15677. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15678. @code{horizontal}. Default is @code{vertical}.
  15679. @item gain
  15680. Set scale gain for calculating intensity color values.
  15681. Default value is @code{1}.
  15682. @item legend
  15683. Draw time and frequency axes and legends. Default is enabled.
  15684. @item rotation
  15685. Set color rotation, must be in [-1.0, 1.0] range.
  15686. Default value is @code{0}.
  15687. @end table
  15688. @subsection Examples
  15689. @itemize
  15690. @item
  15691. Extract an audio spectrogram of a whole audio track
  15692. in a 1024x1024 picture using @command{ffmpeg}:
  15693. @example
  15694. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15695. @end example
  15696. @end itemize
  15697. @section showvolume
  15698. Convert input audio volume to a video output.
  15699. The filter accepts the following options:
  15700. @table @option
  15701. @item rate, r
  15702. Set video rate.
  15703. @item b
  15704. Set border width, allowed range is [0, 5]. Default is 1.
  15705. @item w
  15706. Set channel width, allowed range is [80, 8192]. Default is 400.
  15707. @item h
  15708. Set channel height, allowed range is [1, 900]. Default is 20.
  15709. @item f
  15710. Set fade, allowed range is [0, 1]. Default is 0.95.
  15711. @item c
  15712. Set volume color expression.
  15713. The expression can use the following variables:
  15714. @table @option
  15715. @item VOLUME
  15716. Current max volume of channel in dB.
  15717. @item PEAK
  15718. Current peak.
  15719. @item CHANNEL
  15720. Current channel number, starting from 0.
  15721. @end table
  15722. @item t
  15723. If set, displays channel names. Default is enabled.
  15724. @item v
  15725. If set, displays volume values. Default is enabled.
  15726. @item o
  15727. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15728. default is @code{h}.
  15729. @item s
  15730. Set step size, allowed range is [0, 5]. Default is 0, which means
  15731. step is disabled.
  15732. @item p
  15733. Set background opacity, allowed range is [0, 1]. Default is 0.
  15734. @item m
  15735. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15736. default is @code{p}.
  15737. @item ds
  15738. Set display scale, can be linear: @code{lin} or log: @code{log},
  15739. default is @code{lin}.
  15740. @item dm
  15741. In second.
  15742. If set to > 0., display a line for the max level
  15743. in the previous seconds.
  15744. default is disabled: @code{0.}
  15745. @item dmc
  15746. The color of the max line. Use when @code{dm} option is set to > 0.
  15747. default is: @code{orange}
  15748. @end table
  15749. @section showwaves
  15750. Convert input audio to a video output, representing the samples waves.
  15751. The filter accepts the following options:
  15752. @table @option
  15753. @item size, s
  15754. Specify the video size for the output. For the syntax of this option, check the
  15755. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15756. Default value is @code{600x240}.
  15757. @item mode
  15758. Set display mode.
  15759. Available values are:
  15760. @table @samp
  15761. @item point
  15762. Draw a point for each sample.
  15763. @item line
  15764. Draw a vertical line for each sample.
  15765. @item p2p
  15766. Draw a point for each sample and a line between them.
  15767. @item cline
  15768. Draw a centered vertical line for each sample.
  15769. @end table
  15770. Default value is @code{point}.
  15771. @item n
  15772. Set the number of samples which are printed on the same column. A
  15773. larger value will decrease the frame rate. Must be a positive
  15774. integer. This option can be set only if the value for @var{rate}
  15775. is not explicitly specified.
  15776. @item rate, r
  15777. Set the (approximate) output frame rate. This is done by setting the
  15778. option @var{n}. Default value is "25".
  15779. @item split_channels
  15780. Set if channels should be drawn separately or overlap. Default value is 0.
  15781. @item colors
  15782. Set colors separated by '|' which are going to be used for drawing of each channel.
  15783. @item scale
  15784. Set amplitude scale.
  15785. Available values are:
  15786. @table @samp
  15787. @item lin
  15788. Linear.
  15789. @item log
  15790. Logarithmic.
  15791. @item sqrt
  15792. Square root.
  15793. @item cbrt
  15794. Cubic root.
  15795. @end table
  15796. Default is linear.
  15797. @item draw
  15798. Set the draw mode. This is mostly useful to set for high @var{n}.
  15799. Available values are:
  15800. @table @samp
  15801. @item scale
  15802. Scale pixel values for each drawn sample.
  15803. @item full
  15804. Draw every sample directly.
  15805. @end table
  15806. Default value is @code{scale}.
  15807. @end table
  15808. @subsection Examples
  15809. @itemize
  15810. @item
  15811. Output the input file audio and the corresponding video representation
  15812. at the same time:
  15813. @example
  15814. amovie=a.mp3,asplit[out0],showwaves[out1]
  15815. @end example
  15816. @item
  15817. Create a synthetic signal and show it with showwaves, forcing a
  15818. frame rate of 30 frames per second:
  15819. @example
  15820. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15821. @end example
  15822. @end itemize
  15823. @section showwavespic
  15824. Convert input audio to a single video frame, representing the samples waves.
  15825. The filter accepts the following options:
  15826. @table @option
  15827. @item size, s
  15828. Specify the video size for the output. For the syntax of this option, check the
  15829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15830. Default value is @code{600x240}.
  15831. @item split_channels
  15832. Set if channels should be drawn separately or overlap. Default value is 0.
  15833. @item colors
  15834. Set colors separated by '|' which are going to be used for drawing of each channel.
  15835. @item scale
  15836. Set amplitude scale.
  15837. Available values are:
  15838. @table @samp
  15839. @item lin
  15840. Linear.
  15841. @item log
  15842. Logarithmic.
  15843. @item sqrt
  15844. Square root.
  15845. @item cbrt
  15846. Cubic root.
  15847. @end table
  15848. Default is linear.
  15849. @end table
  15850. @subsection Examples
  15851. @itemize
  15852. @item
  15853. Extract a channel split representation of the wave form of a whole audio track
  15854. in a 1024x800 picture using @command{ffmpeg}:
  15855. @example
  15856. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15857. @end example
  15858. @end itemize
  15859. @section sidedata, asidedata
  15860. Delete frame side data, or select frames based on it.
  15861. This filter accepts the following options:
  15862. @table @option
  15863. @item mode
  15864. Set mode of operation of the filter.
  15865. Can be one of the following:
  15866. @table @samp
  15867. @item select
  15868. Select every frame with side data of @code{type}.
  15869. @item delete
  15870. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15871. data in the frame.
  15872. @end table
  15873. @item type
  15874. Set side data type used with all modes. Must be set for @code{select} mode. For
  15875. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15876. in @file{libavutil/frame.h}. For example, to choose
  15877. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15878. @end table
  15879. @section spectrumsynth
  15880. Sythesize audio from 2 input video spectrums, first input stream represents
  15881. magnitude across time and second represents phase across time.
  15882. The filter will transform from frequency domain as displayed in videos back
  15883. to time domain as presented in audio output.
  15884. This filter is primarily created for reversing processed @ref{showspectrum}
  15885. filter outputs, but can synthesize sound from other spectrograms too.
  15886. But in such case results are going to be poor if the phase data is not
  15887. available, because in such cases phase data need to be recreated, usually
  15888. its just recreated from random noise.
  15889. For best results use gray only output (@code{channel} color mode in
  15890. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15891. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15892. @code{data} option. Inputs videos should generally use @code{fullframe}
  15893. slide mode as that saves resources needed for decoding video.
  15894. The filter accepts the following options:
  15895. @table @option
  15896. @item sample_rate
  15897. Specify sample rate of output audio, the sample rate of audio from which
  15898. spectrum was generated may differ.
  15899. @item channels
  15900. Set number of channels represented in input video spectrums.
  15901. @item scale
  15902. Set scale which was used when generating magnitude input spectrum.
  15903. Can be @code{lin} or @code{log}. Default is @code{log}.
  15904. @item slide
  15905. Set slide which was used when generating inputs spectrums.
  15906. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15907. Default is @code{fullframe}.
  15908. @item win_func
  15909. Set window function used for resynthesis.
  15910. @item overlap
  15911. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15912. which means optimal overlap for selected window function will be picked.
  15913. @item orientation
  15914. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15915. Default is @code{vertical}.
  15916. @end table
  15917. @subsection Examples
  15918. @itemize
  15919. @item
  15920. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15921. then resynthesize videos back to audio with spectrumsynth:
  15922. @example
  15923. 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
  15924. 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
  15925. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15926. @end example
  15927. @end itemize
  15928. @section split, asplit
  15929. Split input into several identical outputs.
  15930. @code{asplit} works with audio input, @code{split} with video.
  15931. The filter accepts a single parameter which specifies the number of outputs. If
  15932. unspecified, it defaults to 2.
  15933. @subsection Examples
  15934. @itemize
  15935. @item
  15936. Create two separate outputs from the same input:
  15937. @example
  15938. [in] split [out0][out1]
  15939. @end example
  15940. @item
  15941. To create 3 or more outputs, you need to specify the number of
  15942. outputs, like in:
  15943. @example
  15944. [in] asplit=3 [out0][out1][out2]
  15945. @end example
  15946. @item
  15947. Create two separate outputs from the same input, one cropped and
  15948. one padded:
  15949. @example
  15950. [in] split [splitout1][splitout2];
  15951. [splitout1] crop=100:100:0:0 [cropout];
  15952. [splitout2] pad=200:200:100:100 [padout];
  15953. @end example
  15954. @item
  15955. Create 5 copies of the input audio with @command{ffmpeg}:
  15956. @example
  15957. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15958. @end example
  15959. @end itemize
  15960. @section zmq, azmq
  15961. Receive commands sent through a libzmq client, and forward them to
  15962. filters in the filtergraph.
  15963. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15964. must be inserted between two video filters, @code{azmq} between two
  15965. audio filters. Both are capable to send messages to any filter type.
  15966. To enable these filters you need to install the libzmq library and
  15967. headers and configure FFmpeg with @code{--enable-libzmq}.
  15968. For more information about libzmq see:
  15969. @url{http://www.zeromq.org/}
  15970. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15971. receives messages sent through a network interface defined by the
  15972. @option{bind_address} (or the abbreviation "@option{b}") option.
  15973. Default value of this option is @file{tcp://localhost:5555}. You may
  15974. want to alter this value to your needs, but do not forget to escape any
  15975. ':' signs (see @ref{filtergraph escaping}).
  15976. The received message must be in the form:
  15977. @example
  15978. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15979. @end example
  15980. @var{TARGET} specifies the target of the command, usually the name of
  15981. the filter class or a specific filter instance name. The default
  15982. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15983. but you can override this by using the @samp{filter_name@@id} syntax
  15984. (see @ref{Filtergraph syntax}).
  15985. @var{COMMAND} specifies the name of the command for the target filter.
  15986. @var{ARG} is optional and specifies the optional argument list for the
  15987. given @var{COMMAND}.
  15988. Upon reception, the message is processed and the corresponding command
  15989. is injected into the filtergraph. Depending on the result, the filter
  15990. will send a reply to the client, adopting the format:
  15991. @example
  15992. @var{ERROR_CODE} @var{ERROR_REASON}
  15993. @var{MESSAGE}
  15994. @end example
  15995. @var{MESSAGE} is optional.
  15996. @subsection Examples
  15997. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15998. be used to send commands processed by these filters.
  15999. Consider the following filtergraph generated by @command{ffplay}.
  16000. In this example the last overlay filter has an instance name. All other
  16001. filters will have default instance names.
  16002. @example
  16003. ffplay -dumpgraph 1 -f lavfi "
  16004. color=s=100x100:c=red [l];
  16005. color=s=100x100:c=blue [r];
  16006. nullsrc=s=200x100, zmq [bg];
  16007. [bg][l] overlay [bg+l];
  16008. [bg+l][r] overlay@@my=x=100 "
  16009. @end example
  16010. To change the color of the left side of the video, the following
  16011. command can be used:
  16012. @example
  16013. echo Parsed_color_0 c yellow | tools/zmqsend
  16014. @end example
  16015. To change the right side:
  16016. @example
  16017. echo Parsed_color_1 c pink | tools/zmqsend
  16018. @end example
  16019. To change the position of the right side:
  16020. @example
  16021. echo overlay@@my x 150 | tools/zmqsend
  16022. @end example
  16023. @c man end MULTIMEDIA FILTERS
  16024. @chapter Multimedia Sources
  16025. @c man begin MULTIMEDIA SOURCES
  16026. Below is a description of the currently available multimedia sources.
  16027. @section amovie
  16028. This is the same as @ref{movie} source, except it selects an audio
  16029. stream by default.
  16030. @anchor{movie}
  16031. @section movie
  16032. Read audio and/or video stream(s) from a movie container.
  16033. It accepts the following parameters:
  16034. @table @option
  16035. @item filename
  16036. The name of the resource to read (not necessarily a file; it can also be a
  16037. device or a stream accessed through some protocol).
  16038. @item format_name, f
  16039. Specifies the format assumed for the movie to read, and can be either
  16040. the name of a container or an input device. If not specified, the
  16041. format is guessed from @var{movie_name} or by probing.
  16042. @item seek_point, sp
  16043. Specifies the seek point in seconds. The frames will be output
  16044. starting from this seek point. The parameter is evaluated with
  16045. @code{av_strtod}, so the numerical value may be suffixed by an IS
  16046. postfix. The default value is "0".
  16047. @item streams, s
  16048. Specifies the streams to read. Several streams can be specified,
  16049. separated by "+". The source will then have as many outputs, in the
  16050. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16051. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16052. respectively the default (best suited) video and audio stream. Default
  16053. is "dv", or "da" if the filter is called as "amovie".
  16054. @item stream_index, si
  16055. Specifies the index of the video stream to read. If the value is -1,
  16056. the most suitable video stream will be automatically selected. The default
  16057. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16058. audio instead of video.
  16059. @item loop
  16060. Specifies how many times to read the stream in sequence.
  16061. If the value is 0, the stream will be looped infinitely.
  16062. Default value is "1".
  16063. Note that when the movie is looped the source timestamps are not
  16064. changed, so it will generate non monotonically increasing timestamps.
  16065. @item discontinuity
  16066. Specifies the time difference between frames above which the point is
  16067. considered a timestamp discontinuity which is removed by adjusting the later
  16068. timestamps.
  16069. @end table
  16070. It allows overlaying a second video on top of the main input of
  16071. a filtergraph, as shown in this graph:
  16072. @example
  16073. input -----------> deltapts0 --> overlay --> output
  16074. ^
  16075. |
  16076. movie --> scale--> deltapts1 -------+
  16077. @end example
  16078. @subsection Examples
  16079. @itemize
  16080. @item
  16081. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16082. on top of the input labelled "in":
  16083. @example
  16084. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16085. [in] setpts=PTS-STARTPTS [main];
  16086. [main][over] overlay=16:16 [out]
  16087. @end example
  16088. @item
  16089. Read from a video4linux2 device, and overlay it on top of the input
  16090. labelled "in":
  16091. @example
  16092. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16093. [in] setpts=PTS-STARTPTS [main];
  16094. [main][over] overlay=16:16 [out]
  16095. @end example
  16096. @item
  16097. Read the first video stream and the audio stream with id 0x81 from
  16098. dvd.vob; the video is connected to the pad named "video" and the audio is
  16099. connected to the pad named "audio":
  16100. @example
  16101. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16102. @end example
  16103. @end itemize
  16104. @subsection Commands
  16105. Both movie and amovie support the following commands:
  16106. @table @option
  16107. @item seek
  16108. Perform seek using "av_seek_frame".
  16109. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16110. @itemize
  16111. @item
  16112. @var{stream_index}: If stream_index is -1, a default
  16113. stream is selected, and @var{timestamp} is automatically converted
  16114. from AV_TIME_BASE units to the stream specific time_base.
  16115. @item
  16116. @var{timestamp}: Timestamp in AVStream.time_base units
  16117. or, if no stream is specified, in AV_TIME_BASE units.
  16118. @item
  16119. @var{flags}: Flags which select direction and seeking mode.
  16120. @end itemize
  16121. @item get_duration
  16122. Get movie duration in AV_TIME_BASE units.
  16123. @end table
  16124. @c man end MULTIMEDIA SOURCES