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.

21309 lines
566KB

  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 acue
  434. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  435. filter.
  436. @section adeclick
  437. Remove impulsive noise from input audio.
  438. Samples detected as impulsive noise are replaced by interpolated samples using
  439. autoregressive modelling.
  440. @table @option
  441. @item w
  442. Set window size, in milliseconds. Allowed range is from @code{10} to
  443. @code{100}. Default value is @code{55} milliseconds.
  444. This sets size of window which will be processed at once.
  445. @item o
  446. Set window overlap, in percentage of window size. Allowed range is from
  447. @code{50} to @code{95}. Default value is @code{75} percent.
  448. Setting this to a very high value increases impulsive noise removal but makes
  449. whole process much slower.
  450. @item a
  451. Set autoregression order, in percentage of window size. Allowed range is from
  452. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  453. controls quality of interpolated samples using neighbour good samples.
  454. @item t
  455. Set threshold value. Allowed range is from @code{1} to @code{100}.
  456. Default value is @code{2}.
  457. This controls the strength of impulsive noise which is going to be removed.
  458. The lower value, the more samples will be detected as impulsive noise.
  459. @item b
  460. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  461. @code{10}. Default value is @code{2}.
  462. If any two samples deteced as noise are spaced less than this value then any
  463. sample inbetween those two samples will be also detected as noise.
  464. @item m
  465. Set overlap method.
  466. It accepts the following values:
  467. @table @option
  468. @item a
  469. Select overlap-add method. Even not interpolated samples are slightly
  470. changed with this method.
  471. @item s
  472. Select overlap-save method. Not interpolated samples remain unchanged.
  473. @end table
  474. Default value is @code{a}.
  475. @end table
  476. @section adeclip
  477. Remove clipped samples from input audio.
  478. Samples detected as clipped are replaced by interpolated samples using
  479. autoregressive modelling.
  480. @table @option
  481. @item w
  482. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  483. Default value is @code{55} milliseconds.
  484. This sets size of window which will be processed at once.
  485. @item o
  486. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  487. to @code{95}. Default value is @code{75} percent.
  488. @item a
  489. Set autoregression order, in percentage of window size. Allowed range is from
  490. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  491. quality of interpolated samples using neighbour good samples.
  492. @item t
  493. Set threshold value. Allowed range is from @code{1} to @code{100}.
  494. Default value is @code{10}. Higher values make clip detection less aggressive.
  495. @item n
  496. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  497. Default value is @code{1000}. Higher values make clip detection less aggressive.
  498. @item m
  499. Set overlap method.
  500. It accepts the following values:
  501. @table @option
  502. @item a
  503. Select overlap-add method. Even not interpolated samples are slightly changed
  504. with this method.
  505. @item s
  506. Select overlap-save method. Not interpolated samples remain unchanged.
  507. @end table
  508. Default value is @code{a}.
  509. @end table
  510. @section adelay
  511. Delay one or more audio channels.
  512. Samples in delayed channel are filled with silence.
  513. The filter accepts the following option:
  514. @table @option
  515. @item delays
  516. Set list of delays in milliseconds for each channel separated by '|'.
  517. Unused delays will be silently ignored. If number of given delays is
  518. smaller than number of channels all remaining channels will not be delayed.
  519. If you want to delay exact number of samples, append 'S' to number.
  520. @end table
  521. @subsection Examples
  522. @itemize
  523. @item
  524. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  525. the second channel (and any other channels that may be present) unchanged.
  526. @example
  527. adelay=1500|0|500
  528. @end example
  529. @item
  530. Delay second channel by 500 samples, the third channel by 700 samples and leave
  531. the first channel (and any other channels that may be present) unchanged.
  532. @example
  533. adelay=0|500S|700S
  534. @end example
  535. @end itemize
  536. @section aderivative, aintegral
  537. Compute derivative/integral of audio stream.
  538. Applying both filters one after another produces original audio.
  539. @section aecho
  540. Apply echoing to the input audio.
  541. Echoes are reflected sound and can occur naturally amongst mountains
  542. (and sometimes large buildings) when talking or shouting; digital echo
  543. effects emulate this behaviour and are often used to help fill out the
  544. sound of a single instrument or vocal. The time difference between the
  545. original signal and the reflection is the @code{delay}, and the
  546. loudness of the reflected signal is the @code{decay}.
  547. Multiple echoes can have different delays and decays.
  548. A description of the accepted parameters follows.
  549. @table @option
  550. @item in_gain
  551. Set input gain of reflected signal. Default is @code{0.6}.
  552. @item out_gain
  553. Set output gain of reflected signal. Default is @code{0.3}.
  554. @item delays
  555. Set list of time intervals in milliseconds between original signal and reflections
  556. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  557. Default is @code{1000}.
  558. @item decays
  559. Set list of loudness of reflected signals separated by '|'.
  560. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  561. Default is @code{0.5}.
  562. @end table
  563. @subsection Examples
  564. @itemize
  565. @item
  566. Make it sound as if there are twice as many instruments as are actually playing:
  567. @example
  568. aecho=0.8:0.88:60:0.4
  569. @end example
  570. @item
  571. If delay is very short, then it sound like a (metallic) robot playing music:
  572. @example
  573. aecho=0.8:0.88:6:0.4
  574. @end example
  575. @item
  576. A longer delay will sound like an open air concert in the mountains:
  577. @example
  578. aecho=0.8:0.9:1000:0.3
  579. @end example
  580. @item
  581. Same as above but with one more mountain:
  582. @example
  583. aecho=0.8:0.9:1000|1800:0.3|0.25
  584. @end example
  585. @end itemize
  586. @section aemphasis
  587. Audio emphasis filter creates or restores material directly taken from LPs or
  588. emphased CDs with different filter curves. E.g. to store music on vinyl the
  589. signal has to be altered by a filter first to even out the disadvantages of
  590. this recording medium.
  591. Once the material is played back the inverse filter has to be applied to
  592. restore the distortion of the frequency response.
  593. The filter accepts the following options:
  594. @table @option
  595. @item level_in
  596. Set input gain.
  597. @item level_out
  598. Set output gain.
  599. @item mode
  600. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  601. use @code{production} mode. Default is @code{reproduction} mode.
  602. @item type
  603. Set filter type. Selects medium. Can be one of the following:
  604. @table @option
  605. @item col
  606. select Columbia.
  607. @item emi
  608. select EMI.
  609. @item bsi
  610. select BSI (78RPM).
  611. @item riaa
  612. select RIAA.
  613. @item cd
  614. select Compact Disc (CD).
  615. @item 50fm
  616. select 50µs (FM).
  617. @item 75fm
  618. select 75µs (FM).
  619. @item 50kf
  620. select 50µs (FM-KF).
  621. @item 75kf
  622. select 75µs (FM-KF).
  623. @end table
  624. @end table
  625. @section aeval
  626. Modify an audio signal according to the specified expressions.
  627. This filter accepts one or more expressions (one for each channel),
  628. which are evaluated and used to modify a corresponding audio signal.
  629. It accepts the following parameters:
  630. @table @option
  631. @item exprs
  632. Set the '|'-separated expressions list for each separate channel. If
  633. the number of input channels is greater than the number of
  634. expressions, the last specified expression is used for the remaining
  635. output channels.
  636. @item channel_layout, c
  637. Set output channel layout. If not specified, the channel layout is
  638. specified by the number of expressions. If set to @samp{same}, it will
  639. use by default the same input channel layout.
  640. @end table
  641. Each expression in @var{exprs} can contain the following constants and functions:
  642. @table @option
  643. @item ch
  644. channel number of the current expression
  645. @item n
  646. number of the evaluated sample, starting from 0
  647. @item s
  648. sample rate
  649. @item t
  650. time of the evaluated sample expressed in seconds
  651. @item nb_in_channels
  652. @item nb_out_channels
  653. input and output number of channels
  654. @item val(CH)
  655. the value of input channel with number @var{CH}
  656. @end table
  657. Note: this filter is slow. For faster processing you should use a
  658. dedicated filter.
  659. @subsection Examples
  660. @itemize
  661. @item
  662. Half volume:
  663. @example
  664. aeval=val(ch)/2:c=same
  665. @end example
  666. @item
  667. Invert phase of the second channel:
  668. @example
  669. aeval=val(0)|-val(1)
  670. @end example
  671. @end itemize
  672. @anchor{afade}
  673. @section afade
  674. Apply fade-in/out effect to input audio.
  675. A description of the accepted parameters follows.
  676. @table @option
  677. @item type, t
  678. Specify the effect type, can be either @code{in} for fade-in, or
  679. @code{out} for a fade-out effect. Default is @code{in}.
  680. @item start_sample, ss
  681. Specify the number of the start sample for starting to apply the fade
  682. effect. Default is 0.
  683. @item nb_samples, ns
  684. Specify the number of samples for which the fade effect has to last. At
  685. the end of the fade-in effect the output audio will have the same
  686. volume as the input audio, at the end of the fade-out transition
  687. the output audio will be silence. Default is 44100.
  688. @item start_time, st
  689. Specify the start time of the fade effect. Default is 0.
  690. The value must be specified as a time duration; see
  691. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  692. for the accepted syntax.
  693. If set this option is used instead of @var{start_sample}.
  694. @item duration, d
  695. Specify the duration of the fade effect. See
  696. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  697. for the accepted syntax.
  698. At the end of the fade-in effect the output audio will have the same
  699. volume as the input audio, at the end of the fade-out transition
  700. the output audio will be silence.
  701. By default the duration is determined by @var{nb_samples}.
  702. If set this option is used instead of @var{nb_samples}.
  703. @item curve
  704. Set curve for fade transition.
  705. It accepts the following values:
  706. @table @option
  707. @item tri
  708. select triangular, linear slope (default)
  709. @item qsin
  710. select quarter of sine wave
  711. @item hsin
  712. select half of sine wave
  713. @item esin
  714. select exponential sine wave
  715. @item log
  716. select logarithmic
  717. @item ipar
  718. select inverted parabola
  719. @item qua
  720. select quadratic
  721. @item cub
  722. select cubic
  723. @item squ
  724. select square root
  725. @item cbr
  726. select cubic root
  727. @item par
  728. select parabola
  729. @item exp
  730. select exponential
  731. @item iqsin
  732. select inverted quarter of sine wave
  733. @item ihsin
  734. select inverted half of sine wave
  735. @item dese
  736. select double-exponential seat
  737. @item desi
  738. select double-exponential sigmoid
  739. @end table
  740. @end table
  741. @subsection Examples
  742. @itemize
  743. @item
  744. Fade in first 15 seconds of audio:
  745. @example
  746. afade=t=in:ss=0:d=15
  747. @end example
  748. @item
  749. Fade out last 25 seconds of a 900 seconds audio:
  750. @example
  751. afade=t=out:st=875:d=25
  752. @end example
  753. @end itemize
  754. @section afftfilt
  755. Apply arbitrary expressions to samples in frequency domain.
  756. @table @option
  757. @item real
  758. Set frequency domain real expression for each separate channel separated
  759. by '|'. Default is "1".
  760. If the number of input channels is greater than the number of
  761. expressions, the last specified expression is used for the remaining
  762. output channels.
  763. @item imag
  764. Set frequency domain imaginary expression for each separate channel
  765. separated by '|'. If not set, @var{real} option is used.
  766. Each expression in @var{real} and @var{imag} can contain the following
  767. constants:
  768. @table @option
  769. @item sr
  770. sample rate
  771. @item b
  772. current frequency bin number
  773. @item nb
  774. number of available bins
  775. @item ch
  776. channel number of the current expression
  777. @item chs
  778. number of channels
  779. @item pts
  780. current frame pts
  781. @end table
  782. @item win_size
  783. Set window size.
  784. It accepts the following values:
  785. @table @samp
  786. @item w16
  787. @item w32
  788. @item w64
  789. @item w128
  790. @item w256
  791. @item w512
  792. @item w1024
  793. @item w2048
  794. @item w4096
  795. @item w8192
  796. @item w16384
  797. @item w32768
  798. @item w65536
  799. @end table
  800. Default is @code{w4096}
  801. @item win_func
  802. Set window function. Default is @code{hann}.
  803. @item overlap
  804. Set window overlap. If set to 1, the recommended overlap for selected
  805. window function will be picked. Default is @code{0.75}.
  806. @end table
  807. @subsection Examples
  808. @itemize
  809. @item
  810. Leave almost only low frequencies in audio:
  811. @example
  812. afftfilt="1-clip((b/nb)*b,0,1)"
  813. @end example
  814. @end itemize
  815. @anchor{afir}
  816. @section afir
  817. Apply an arbitrary Frequency Impulse Response filter.
  818. This filter is designed for applying long FIR filters,
  819. up to 30 seconds long.
  820. It can be used as component for digital crossover filters,
  821. room equalization, cross talk cancellation, wavefield synthesis,
  822. auralization, ambiophonics and ambisonics.
  823. This filter uses second stream as FIR coefficients.
  824. If second stream holds single channel, it will be used
  825. for all input channels in first stream, otherwise
  826. number of channels in second stream must be same as
  827. number of channels in first stream.
  828. It accepts the following parameters:
  829. @table @option
  830. @item dry
  831. Set dry gain. This sets input gain.
  832. @item wet
  833. Set wet gain. This sets final output gain.
  834. @item length
  835. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  836. @item again
  837. Enable applying gain measured from power of IR.
  838. @item maxir
  839. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  840. Allowed range is 0.1 to 60 seconds.
  841. @item response
  842. Show IR frequency reponse, magnitude and phase in additional video stream.
  843. By default it is disabled.
  844. @item channel
  845. Set for which IR channel to display frequency response. By default is first channel
  846. displayed. This option is used only when @var{response} is enabled.
  847. @item size
  848. Set video stream size. This option is used only when @var{response} is enabled.
  849. @end table
  850. @subsection Examples
  851. @itemize
  852. @item
  853. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  854. @example
  855. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  856. @end example
  857. @end itemize
  858. @anchor{aformat}
  859. @section aformat
  860. Set output format constraints for the input audio. The framework will
  861. negotiate the most appropriate format to minimize conversions.
  862. It accepts the following parameters:
  863. @table @option
  864. @item sample_fmts
  865. A '|'-separated list of requested sample formats.
  866. @item sample_rates
  867. A '|'-separated list of requested sample rates.
  868. @item channel_layouts
  869. A '|'-separated list of requested channel layouts.
  870. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  871. for the required syntax.
  872. @end table
  873. If a parameter is omitted, all values are allowed.
  874. Force the output to either unsigned 8-bit or signed 16-bit stereo
  875. @example
  876. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  877. @end example
  878. @section agate
  879. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  880. processing reduces disturbing noise between useful signals.
  881. Gating is done by detecting the volume below a chosen level @var{threshold}
  882. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  883. floor is set via @var{range}. Because an exact manipulation of the signal
  884. would cause distortion of the waveform the reduction can be levelled over
  885. time. This is done by setting @var{attack} and @var{release}.
  886. @var{attack} determines how long the signal has to fall below the threshold
  887. before any reduction will occur and @var{release} sets the time the signal
  888. has to rise above the threshold to reduce the reduction again.
  889. Shorter signals than the chosen attack time will be left untouched.
  890. @table @option
  891. @item level_in
  892. Set input level before filtering.
  893. Default is 1. Allowed range is from 0.015625 to 64.
  894. @item range
  895. Set the level of gain reduction when the signal is below the threshold.
  896. Default is 0.06125. Allowed range is from 0 to 1.
  897. @item threshold
  898. If a signal rises above this level the gain reduction is released.
  899. Default is 0.125. Allowed range is from 0 to 1.
  900. @item ratio
  901. Set a ratio by which the signal is reduced.
  902. Default is 2. Allowed range is from 1 to 9000.
  903. @item attack
  904. Amount of milliseconds the signal has to rise above the threshold before gain
  905. reduction stops.
  906. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  907. @item release
  908. Amount of milliseconds the signal has to fall below the threshold before the
  909. reduction is increased again. Default is 250 milliseconds.
  910. Allowed range is from 0.01 to 9000.
  911. @item makeup
  912. Set amount of amplification of signal after processing.
  913. Default is 1. Allowed range is from 1 to 64.
  914. @item knee
  915. Curve the sharp knee around the threshold to enter gain reduction more softly.
  916. Default is 2.828427125. Allowed range is from 1 to 8.
  917. @item detection
  918. Choose if exact signal should be taken for detection or an RMS like one.
  919. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  920. @item link
  921. Choose if the average level between all channels or the louder channel affects
  922. the reduction.
  923. Default is @code{average}. Can be @code{average} or @code{maximum}.
  924. @end table
  925. @section aiir
  926. Apply an arbitrary Infinite Impulse Response filter.
  927. It accepts the following parameters:
  928. @table @option
  929. @item z
  930. Set numerator/zeros coefficients.
  931. @item p
  932. Set denominator/poles coefficients.
  933. @item k
  934. Set channels gains.
  935. @item dry_gain
  936. Set input gain.
  937. @item wet_gain
  938. Set output gain.
  939. @item f
  940. Set coefficients format.
  941. @table @samp
  942. @item tf
  943. transfer function
  944. @item zp
  945. Z-plane zeros/poles, cartesian (default)
  946. @item pr
  947. Z-plane zeros/poles, polar radians
  948. @item pd
  949. Z-plane zeros/poles, polar degrees
  950. @end table
  951. @item r
  952. Set kind of processing.
  953. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  954. @item e
  955. Set filtering precision.
  956. @table @samp
  957. @item dbl
  958. double-precision floating-point (default)
  959. @item flt
  960. single-precision floating-point
  961. @item i32
  962. 32-bit integers
  963. @item i16
  964. 16-bit integers
  965. @end table
  966. @item response
  967. Show IR frequency reponse, magnitude and phase in additional video stream.
  968. By default it is disabled.
  969. @item channel
  970. Set for which IR channel to display frequency response. By default is first channel
  971. displayed. This option is used only when @var{response} is enabled.
  972. @item size
  973. Set video stream size. This option is used only when @var{response} is enabled.
  974. @end table
  975. Coefficients in @code{tf} format are separated by spaces and are in ascending
  976. order.
  977. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  978. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  979. imaginary unit.
  980. Different coefficients and gains can be provided for every channel, in such case
  981. use '|' to separate coefficients or gains. Last provided coefficients will be
  982. used for all remaining channels.
  983. @subsection Examples
  984. @itemize
  985. @item
  986. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  987. @example
  988. 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
  989. @end example
  990. @item
  991. Same as above but in @code{zp} format:
  992. @example
  993. 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
  994. @end example
  995. @end itemize
  996. @section alimiter
  997. The limiter prevents an input signal from rising over a desired threshold.
  998. This limiter uses lookahead technology to prevent your signal from distorting.
  999. It means that there is a small delay after the signal is processed. Keep in mind
  1000. that the delay it produces is the attack time you set.
  1001. The filter accepts the following options:
  1002. @table @option
  1003. @item level_in
  1004. Set input gain. Default is 1.
  1005. @item level_out
  1006. Set output gain. Default is 1.
  1007. @item limit
  1008. Don't let signals above this level pass the limiter. Default is 1.
  1009. @item attack
  1010. The limiter will reach its attenuation level in this amount of time in
  1011. milliseconds. Default is 5 milliseconds.
  1012. @item release
  1013. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1014. Default is 50 milliseconds.
  1015. @item asc
  1016. When gain reduction is always needed ASC takes care of releasing to an
  1017. average reduction level rather than reaching a reduction of 0 in the release
  1018. time.
  1019. @item asc_level
  1020. Select how much the release time is affected by ASC, 0 means nearly no changes
  1021. in release time while 1 produces higher release times.
  1022. @item level
  1023. Auto level output signal. Default is enabled.
  1024. This normalizes audio back to 0dB if enabled.
  1025. @end table
  1026. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1027. with @ref{aresample} before applying this filter.
  1028. @section allpass
  1029. Apply a two-pole all-pass filter with central frequency (in Hz)
  1030. @var{frequency}, and filter-width @var{width}.
  1031. An all-pass filter changes the audio's frequency to phase relationship
  1032. without changing its frequency to amplitude relationship.
  1033. The filter accepts the following options:
  1034. @table @option
  1035. @item frequency, f
  1036. Set frequency in Hz.
  1037. @item width_type, t
  1038. Set method to specify band-width of filter.
  1039. @table @option
  1040. @item h
  1041. Hz
  1042. @item q
  1043. Q-Factor
  1044. @item o
  1045. octave
  1046. @item s
  1047. slope
  1048. @item k
  1049. kHz
  1050. @end table
  1051. @item width, w
  1052. Specify the band-width of a filter in width_type units.
  1053. @item channels, c
  1054. Specify which channels to filter, by default all available are filtered.
  1055. @end table
  1056. @subsection Commands
  1057. This filter supports the following commands:
  1058. @table @option
  1059. @item frequency, f
  1060. Change allpass frequency.
  1061. Syntax for the command is : "@var{frequency}"
  1062. @item width_type, t
  1063. Change allpass width_type.
  1064. Syntax for the command is : "@var{width_type}"
  1065. @item width, w
  1066. Change allpass width.
  1067. Syntax for the command is : "@var{width}"
  1068. @end table
  1069. @section aloop
  1070. Loop audio samples.
  1071. The filter accepts the following options:
  1072. @table @option
  1073. @item loop
  1074. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1075. Default is 0.
  1076. @item size
  1077. Set maximal number of samples. Default is 0.
  1078. @item start
  1079. Set first sample of loop. Default is 0.
  1080. @end table
  1081. @anchor{amerge}
  1082. @section amerge
  1083. Merge two or more audio streams into a single multi-channel stream.
  1084. The filter accepts the following options:
  1085. @table @option
  1086. @item inputs
  1087. Set the number of inputs. Default is 2.
  1088. @end table
  1089. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1090. the channel layout of the output will be set accordingly and the channels
  1091. will be reordered as necessary. If the channel layouts of the inputs are not
  1092. disjoint, the output will have all the channels of the first input then all
  1093. the channels of the second input, in that order, and the channel layout of
  1094. the output will be the default value corresponding to the total number of
  1095. channels.
  1096. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1097. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1098. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1099. first input, b1 is the first channel of the second input).
  1100. On the other hand, if both input are in stereo, the output channels will be
  1101. in the default order: a1, a2, b1, b2, and the channel layout will be
  1102. arbitrarily set to 4.0, which may or may not be the expected value.
  1103. All inputs must have the same sample rate, and format.
  1104. If inputs do not have the same duration, the output will stop with the
  1105. shortest.
  1106. @subsection Examples
  1107. @itemize
  1108. @item
  1109. Merge two mono files into a stereo stream:
  1110. @example
  1111. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1112. @end example
  1113. @item
  1114. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1115. @example
  1116. 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
  1117. @end example
  1118. @end itemize
  1119. @section amix
  1120. Mixes multiple audio inputs into a single output.
  1121. Note that this filter only supports float samples (the @var{amerge}
  1122. and @var{pan} audio filters support many formats). If the @var{amix}
  1123. input has integer samples then @ref{aresample} will be automatically
  1124. inserted to perform the conversion to float samples.
  1125. For example
  1126. @example
  1127. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1128. @end example
  1129. will mix 3 input audio streams to a single output with the same duration as the
  1130. first input and a dropout transition time of 3 seconds.
  1131. It accepts the following parameters:
  1132. @table @option
  1133. @item inputs
  1134. The number of inputs. If unspecified, it defaults to 2.
  1135. @item duration
  1136. How to determine the end-of-stream.
  1137. @table @option
  1138. @item longest
  1139. The duration of the longest input. (default)
  1140. @item shortest
  1141. The duration of the shortest input.
  1142. @item first
  1143. The duration of the first input.
  1144. @end table
  1145. @item dropout_transition
  1146. The transition time, in seconds, for volume renormalization when an input
  1147. stream ends. The default value is 2 seconds.
  1148. @item weights
  1149. Specify weight of each input audio stream as sequence.
  1150. Each weight is separated by space. By default all inputs have same weight.
  1151. @end table
  1152. @section amultiply
  1153. Multiply first audio stream with second audio stream and store result
  1154. in output audio stream. Multiplication is done by multiplying each
  1155. sample from first stream with sample at same position from second stream.
  1156. With this element-wise multiplication one can create amplitude fades and
  1157. amplitude modulations.
  1158. @section anequalizer
  1159. High-order parametric multiband equalizer for each channel.
  1160. It accepts the following parameters:
  1161. @table @option
  1162. @item params
  1163. This option string is in format:
  1164. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1165. Each equalizer band is separated by '|'.
  1166. @table @option
  1167. @item chn
  1168. Set channel number to which equalization will be applied.
  1169. If input doesn't have that channel the entry is ignored.
  1170. @item f
  1171. Set central frequency for band.
  1172. If input doesn't have that frequency the entry is ignored.
  1173. @item w
  1174. Set band width in hertz.
  1175. @item g
  1176. Set band gain in dB.
  1177. @item t
  1178. Set filter type for band, optional, can be:
  1179. @table @samp
  1180. @item 0
  1181. Butterworth, this is default.
  1182. @item 1
  1183. Chebyshev type 1.
  1184. @item 2
  1185. Chebyshev type 2.
  1186. @end table
  1187. @end table
  1188. @item curves
  1189. With this option activated frequency response of anequalizer is displayed
  1190. in video stream.
  1191. @item size
  1192. Set video stream size. Only useful if curves option is activated.
  1193. @item mgain
  1194. Set max gain that will be displayed. Only useful if curves option is activated.
  1195. Setting this to a reasonable value makes it possible to display gain which is derived from
  1196. neighbour bands which are too close to each other and thus produce higher gain
  1197. when both are activated.
  1198. @item fscale
  1199. Set frequency scale used to draw frequency response in video output.
  1200. Can be linear or logarithmic. Default is logarithmic.
  1201. @item colors
  1202. Set color for each channel curve which is going to be displayed in video stream.
  1203. This is list of color names separated by space or by '|'.
  1204. Unrecognised or missing colors will be replaced by white color.
  1205. @end table
  1206. @subsection Examples
  1207. @itemize
  1208. @item
  1209. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1210. for first 2 channels using Chebyshev type 1 filter:
  1211. @example
  1212. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1213. @end example
  1214. @end itemize
  1215. @subsection Commands
  1216. This filter supports the following commands:
  1217. @table @option
  1218. @item change
  1219. Alter existing filter parameters.
  1220. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1221. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1222. error is returned.
  1223. @var{freq} set new frequency parameter.
  1224. @var{width} set new width parameter in herz.
  1225. @var{gain} set new gain parameter in dB.
  1226. Full filter invocation with asendcmd may look like this:
  1227. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1228. @end table
  1229. @section anull
  1230. Pass the audio source unchanged to the output.
  1231. @section apad
  1232. Pad the end of an audio stream with silence.
  1233. This can be used together with @command{ffmpeg} @option{-shortest} to
  1234. extend audio streams to the same length as the video stream.
  1235. A description of the accepted options follows.
  1236. @table @option
  1237. @item packet_size
  1238. Set silence packet size. Default value is 4096.
  1239. @item pad_len
  1240. Set the number of samples of silence to add to the end. After the
  1241. value is reached, the stream is terminated. This option is mutually
  1242. exclusive with @option{whole_len}.
  1243. @item whole_len
  1244. Set the minimum total number of samples in the output audio stream. If
  1245. the value is longer than the input audio length, silence is added to
  1246. the end, until the value is reached. This option is mutually exclusive
  1247. with @option{pad_len}.
  1248. @end table
  1249. If neither the @option{pad_len} nor the @option{whole_len} option is
  1250. set, the filter will add silence to the end of the input stream
  1251. indefinitely.
  1252. @subsection Examples
  1253. @itemize
  1254. @item
  1255. Add 1024 samples of silence to the end of the input:
  1256. @example
  1257. apad=pad_len=1024
  1258. @end example
  1259. @item
  1260. Make sure the audio output will contain at least 10000 samples, pad
  1261. the input with silence if required:
  1262. @example
  1263. apad=whole_len=10000
  1264. @end example
  1265. @item
  1266. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1267. video stream will always result the shortest and will be converted
  1268. until the end in the output file when using the @option{shortest}
  1269. option:
  1270. @example
  1271. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1272. @end example
  1273. @end itemize
  1274. @section aphaser
  1275. Add a phasing effect to the input audio.
  1276. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1277. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1278. A description of the accepted parameters follows.
  1279. @table @option
  1280. @item in_gain
  1281. Set input gain. Default is 0.4.
  1282. @item out_gain
  1283. Set output gain. Default is 0.74
  1284. @item delay
  1285. Set delay in milliseconds. Default is 3.0.
  1286. @item decay
  1287. Set decay. Default is 0.4.
  1288. @item speed
  1289. Set modulation speed in Hz. Default is 0.5.
  1290. @item type
  1291. Set modulation type. Default is triangular.
  1292. It accepts the following values:
  1293. @table @samp
  1294. @item triangular, t
  1295. @item sinusoidal, s
  1296. @end table
  1297. @end table
  1298. @section apulsator
  1299. Audio pulsator is something between an autopanner and a tremolo.
  1300. But it can produce funny stereo effects as well. Pulsator changes the volume
  1301. of the left and right channel based on a LFO (low frequency oscillator) with
  1302. different waveforms and shifted phases.
  1303. This filter have the ability to define an offset between left and right
  1304. channel. An offset of 0 means that both LFO shapes match each other.
  1305. The left and right channel are altered equally - a conventional tremolo.
  1306. An offset of 50% means that the shape of the right channel is exactly shifted
  1307. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1308. an autopanner. At 1 both curves match again. Every setting in between moves the
  1309. phase shift gapless between all stages and produces some "bypassing" sounds with
  1310. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1311. the 0.5) the faster the signal passes from the left to the right speaker.
  1312. The filter accepts the following options:
  1313. @table @option
  1314. @item level_in
  1315. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1316. @item level_out
  1317. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1318. @item mode
  1319. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1320. sawup or sawdown. Default is sine.
  1321. @item amount
  1322. Set modulation. Define how much of original signal is affected by the LFO.
  1323. @item offset_l
  1324. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1325. @item offset_r
  1326. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1327. @item width
  1328. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1329. @item timing
  1330. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1331. @item bpm
  1332. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1333. is set to bpm.
  1334. @item ms
  1335. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1336. is set to ms.
  1337. @item hz
  1338. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1339. if timing is set to hz.
  1340. @end table
  1341. @anchor{aresample}
  1342. @section aresample
  1343. Resample the input audio to the specified parameters, using the
  1344. libswresample library. If none are specified then the filter will
  1345. automatically convert between its input and output.
  1346. This filter is also able to stretch/squeeze the audio data to make it match
  1347. the timestamps or to inject silence / cut out audio to make it match the
  1348. timestamps, do a combination of both or do neither.
  1349. The filter accepts the syntax
  1350. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1351. expresses a sample rate and @var{resampler_options} is a list of
  1352. @var{key}=@var{value} pairs, separated by ":". See the
  1353. @ref{Resampler Options,,"Resampler Options" section in the
  1354. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1355. for the complete list of supported options.
  1356. @subsection Examples
  1357. @itemize
  1358. @item
  1359. Resample the input audio to 44100Hz:
  1360. @example
  1361. aresample=44100
  1362. @end example
  1363. @item
  1364. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1365. samples per second compensation:
  1366. @example
  1367. aresample=async=1000
  1368. @end example
  1369. @end itemize
  1370. @section areverse
  1371. Reverse an audio clip.
  1372. Warning: This filter requires memory to buffer the entire clip, so trimming
  1373. is suggested.
  1374. @subsection Examples
  1375. @itemize
  1376. @item
  1377. Take the first 5 seconds of a clip, and reverse it.
  1378. @example
  1379. atrim=end=5,areverse
  1380. @end example
  1381. @end itemize
  1382. @section asetnsamples
  1383. Set the number of samples per each output audio frame.
  1384. The last output packet may contain a different number of samples, as
  1385. the filter will flush all the remaining samples when the input audio
  1386. signals its end.
  1387. The filter accepts the following options:
  1388. @table @option
  1389. @item nb_out_samples, n
  1390. Set the number of frames per each output audio frame. The number is
  1391. intended as the number of samples @emph{per each channel}.
  1392. Default value is 1024.
  1393. @item pad, p
  1394. If set to 1, the filter will pad the last audio frame with zeroes, so
  1395. that the last frame will contain the same number of samples as the
  1396. previous ones. Default value is 1.
  1397. @end table
  1398. For example, to set the number of per-frame samples to 1234 and
  1399. disable padding for the last frame, use:
  1400. @example
  1401. asetnsamples=n=1234:p=0
  1402. @end example
  1403. @section asetrate
  1404. Set the sample rate without altering the PCM data.
  1405. This will result in a change of speed and pitch.
  1406. The filter accepts the following options:
  1407. @table @option
  1408. @item sample_rate, r
  1409. Set the output sample rate. Default is 44100 Hz.
  1410. @end table
  1411. @section ashowinfo
  1412. Show a line containing various information for each input audio frame.
  1413. The input audio is not modified.
  1414. The shown line contains a sequence of key/value pairs of the form
  1415. @var{key}:@var{value}.
  1416. The following values are shown in the output:
  1417. @table @option
  1418. @item n
  1419. The (sequential) number of the input frame, starting from 0.
  1420. @item pts
  1421. The presentation timestamp of the input frame, in time base units; the time base
  1422. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1423. @item pts_time
  1424. The presentation timestamp of the input frame in seconds.
  1425. @item pos
  1426. position of the frame in the input stream, -1 if this information in
  1427. unavailable and/or meaningless (for example in case of synthetic audio)
  1428. @item fmt
  1429. The sample format.
  1430. @item chlayout
  1431. The channel layout.
  1432. @item rate
  1433. The sample rate for the audio frame.
  1434. @item nb_samples
  1435. The number of samples (per channel) in the frame.
  1436. @item checksum
  1437. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1438. audio, the data is treated as if all the planes were concatenated.
  1439. @item plane_checksums
  1440. A list of Adler-32 checksums for each data plane.
  1441. @end table
  1442. @anchor{astats}
  1443. @section astats
  1444. Display time domain statistical information about the audio channels.
  1445. Statistics are calculated and displayed for each audio channel and,
  1446. where applicable, an overall figure is also given.
  1447. It accepts the following option:
  1448. @table @option
  1449. @item length
  1450. Short window length in seconds, used for peak and trough RMS measurement.
  1451. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1452. @item metadata
  1453. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1454. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1455. disabled.
  1456. Available keys for each channel are:
  1457. DC_offset
  1458. Min_level
  1459. Max_level
  1460. Min_difference
  1461. Max_difference
  1462. Mean_difference
  1463. RMS_difference
  1464. Peak_level
  1465. RMS_peak
  1466. RMS_trough
  1467. Crest_factor
  1468. Flat_factor
  1469. Peak_count
  1470. Bit_depth
  1471. Dynamic_range
  1472. and for Overall:
  1473. DC_offset
  1474. Min_level
  1475. Max_level
  1476. Min_difference
  1477. Max_difference
  1478. Mean_difference
  1479. RMS_difference
  1480. Peak_level
  1481. RMS_level
  1482. RMS_peak
  1483. RMS_trough
  1484. Flat_factor
  1485. Peak_count
  1486. Bit_depth
  1487. Number_of_samples
  1488. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1489. this @code{lavfi.astats.Overall.Peak_count}.
  1490. For description what each key means read below.
  1491. @item reset
  1492. Set number of frame after which stats are going to be recalculated.
  1493. Default is disabled.
  1494. @end table
  1495. A description of each shown parameter follows:
  1496. @table @option
  1497. @item DC offset
  1498. Mean amplitude displacement from zero.
  1499. @item Min level
  1500. Minimal sample level.
  1501. @item Max level
  1502. Maximal sample level.
  1503. @item Min difference
  1504. Minimal difference between two consecutive samples.
  1505. @item Max difference
  1506. Maximal difference between two consecutive samples.
  1507. @item Mean difference
  1508. Mean difference between two consecutive samples.
  1509. The average of each difference between two consecutive samples.
  1510. @item RMS difference
  1511. Root Mean Square difference between two consecutive samples.
  1512. @item Peak level dB
  1513. @item RMS level dB
  1514. Standard peak and RMS level measured in dBFS.
  1515. @item RMS peak dB
  1516. @item RMS trough dB
  1517. Peak and trough values for RMS level measured over a short window.
  1518. @item Crest factor
  1519. Standard ratio of peak to RMS level (note: not in dB).
  1520. @item Flat factor
  1521. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1522. (i.e. either @var{Min level} or @var{Max level}).
  1523. @item Peak count
  1524. Number of occasions (not the number of samples) that the signal attained either
  1525. @var{Min level} or @var{Max level}.
  1526. @item Bit depth
  1527. Overall bit depth of audio. Number of bits used for each sample.
  1528. @item Dynamic range
  1529. Measured dynamic range of audio in dB.
  1530. @end table
  1531. @section atempo
  1532. Adjust audio tempo.
  1533. The filter accepts exactly one parameter, the audio tempo. If not
  1534. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1535. be in the [0.5, 100.0] range.
  1536. Note that tempo greater than 2 will skip some samples rather than
  1537. blend them in. If for any reason this is a concern it is always
  1538. possible to daisy-chain several instances of atempo to achieve the
  1539. desired product tempo.
  1540. @subsection Examples
  1541. @itemize
  1542. @item
  1543. Slow down audio to 80% tempo:
  1544. @example
  1545. atempo=0.8
  1546. @end example
  1547. @item
  1548. To speed up audio to 300% tempo:
  1549. @example
  1550. atempo=3
  1551. @end example
  1552. @item
  1553. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1554. @example
  1555. atempo=sqrt(3),atempo=sqrt(3)
  1556. @end example
  1557. @end itemize
  1558. @section atrim
  1559. Trim the input so that the output contains one continuous subpart of the input.
  1560. It accepts the following parameters:
  1561. @table @option
  1562. @item start
  1563. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1564. sample with the timestamp @var{start} will be the first sample in the output.
  1565. @item end
  1566. Specify time of the first audio sample that will be dropped, i.e. the
  1567. audio sample immediately preceding the one with the timestamp @var{end} will be
  1568. the last sample in the output.
  1569. @item start_pts
  1570. Same as @var{start}, except this option sets the start timestamp in samples
  1571. instead of seconds.
  1572. @item end_pts
  1573. Same as @var{end}, except this option sets the end timestamp in samples instead
  1574. of seconds.
  1575. @item duration
  1576. The maximum duration of the output in seconds.
  1577. @item start_sample
  1578. The number of the first sample that should be output.
  1579. @item end_sample
  1580. The number of the first sample that should be dropped.
  1581. @end table
  1582. @option{start}, @option{end}, and @option{duration} are expressed as time
  1583. duration specifications; see
  1584. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1585. Note that the first two sets of the start/end options and the @option{duration}
  1586. option look at the frame timestamp, while the _sample options simply count the
  1587. samples that pass through the filter. So start/end_pts and start/end_sample will
  1588. give different results when the timestamps are wrong, inexact or do not start at
  1589. zero. Also note that this filter does not modify the timestamps. If you wish
  1590. to have the output timestamps start at zero, insert the asetpts filter after the
  1591. atrim filter.
  1592. If multiple start or end options are set, this filter tries to be greedy and
  1593. keep all samples that match at least one of the specified constraints. To keep
  1594. only the part that matches all the constraints at once, chain multiple atrim
  1595. filters.
  1596. The defaults are such that all the input is kept. So it is possible to set e.g.
  1597. just the end values to keep everything before the specified time.
  1598. Examples:
  1599. @itemize
  1600. @item
  1601. Drop everything except the second minute of input:
  1602. @example
  1603. ffmpeg -i INPUT -af atrim=60:120
  1604. @end example
  1605. @item
  1606. Keep only the first 1000 samples:
  1607. @example
  1608. ffmpeg -i INPUT -af atrim=end_sample=1000
  1609. @end example
  1610. @end itemize
  1611. @section bandpass
  1612. Apply a two-pole Butterworth band-pass filter with central
  1613. frequency @var{frequency}, and (3dB-point) band-width width.
  1614. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1615. instead of the default: constant 0dB peak gain.
  1616. The filter roll off at 6dB per octave (20dB per decade).
  1617. The filter accepts the following options:
  1618. @table @option
  1619. @item frequency, f
  1620. Set the filter's central frequency. Default is @code{3000}.
  1621. @item csg
  1622. Constant skirt gain if set to 1. Defaults to 0.
  1623. @item width_type, t
  1624. Set method to specify band-width of filter.
  1625. @table @option
  1626. @item h
  1627. Hz
  1628. @item q
  1629. Q-Factor
  1630. @item o
  1631. octave
  1632. @item s
  1633. slope
  1634. @item k
  1635. kHz
  1636. @end table
  1637. @item width, w
  1638. Specify the band-width of a filter in width_type units.
  1639. @item channels, c
  1640. Specify which channels to filter, by default all available are filtered.
  1641. @end table
  1642. @subsection Commands
  1643. This filter supports the following commands:
  1644. @table @option
  1645. @item frequency, f
  1646. Change bandpass frequency.
  1647. Syntax for the command is : "@var{frequency}"
  1648. @item width_type, t
  1649. Change bandpass width_type.
  1650. Syntax for the command is : "@var{width_type}"
  1651. @item width, w
  1652. Change bandpass width.
  1653. Syntax for the command is : "@var{width}"
  1654. @end table
  1655. @section bandreject
  1656. Apply a two-pole Butterworth band-reject filter with central
  1657. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1658. The filter roll off at 6dB per octave (20dB per decade).
  1659. The filter accepts the following options:
  1660. @table @option
  1661. @item frequency, f
  1662. Set the filter's central frequency. Default is @code{3000}.
  1663. @item width_type, t
  1664. Set method to specify band-width of filter.
  1665. @table @option
  1666. @item h
  1667. Hz
  1668. @item q
  1669. Q-Factor
  1670. @item o
  1671. octave
  1672. @item s
  1673. slope
  1674. @item k
  1675. kHz
  1676. @end table
  1677. @item width, w
  1678. Specify the band-width of a filter in width_type units.
  1679. @item channels, c
  1680. Specify which channels to filter, by default all available are filtered.
  1681. @end table
  1682. @subsection Commands
  1683. This filter supports the following commands:
  1684. @table @option
  1685. @item frequency, f
  1686. Change bandreject frequency.
  1687. Syntax for the command is : "@var{frequency}"
  1688. @item width_type, t
  1689. Change bandreject width_type.
  1690. Syntax for the command is : "@var{width_type}"
  1691. @item width, w
  1692. Change bandreject width.
  1693. Syntax for the command is : "@var{width}"
  1694. @end table
  1695. @section bass, lowshelf
  1696. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1697. shelving filter with a response similar to that of a standard
  1698. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1699. The filter accepts the following options:
  1700. @table @option
  1701. @item gain, g
  1702. Give the gain at 0 Hz. Its useful range is about -20
  1703. (for a large cut) to +20 (for a large boost).
  1704. Beware of clipping when using a positive gain.
  1705. @item frequency, f
  1706. Set the filter's central frequency and so can be used
  1707. to extend or reduce the frequency range to be boosted or cut.
  1708. The default value is @code{100} Hz.
  1709. @item width_type, t
  1710. Set method to specify band-width of filter.
  1711. @table @option
  1712. @item h
  1713. Hz
  1714. @item q
  1715. Q-Factor
  1716. @item o
  1717. octave
  1718. @item s
  1719. slope
  1720. @item k
  1721. kHz
  1722. @end table
  1723. @item width, w
  1724. Determine how steep is the filter's shelf transition.
  1725. @item channels, c
  1726. Specify which channels to filter, by default all available are filtered.
  1727. @end table
  1728. @subsection Commands
  1729. This filter supports the following commands:
  1730. @table @option
  1731. @item frequency, f
  1732. Change bass frequency.
  1733. Syntax for the command is : "@var{frequency}"
  1734. @item width_type, t
  1735. Change bass width_type.
  1736. Syntax for the command is : "@var{width_type}"
  1737. @item width, w
  1738. Change bass width.
  1739. Syntax for the command is : "@var{width}"
  1740. @item gain, g
  1741. Change bass gain.
  1742. Syntax for the command is : "@var{gain}"
  1743. @end table
  1744. @section biquad
  1745. Apply a biquad IIR filter with the given coefficients.
  1746. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1747. are the numerator and denominator coefficients respectively.
  1748. and @var{channels}, @var{c} specify which channels to filter, by default all
  1749. available are filtered.
  1750. @subsection Commands
  1751. This filter supports the following commands:
  1752. @table @option
  1753. @item a0
  1754. @item a1
  1755. @item a2
  1756. @item b0
  1757. @item b1
  1758. @item b2
  1759. Change biquad parameter.
  1760. Syntax for the command is : "@var{value}"
  1761. @end table
  1762. @section bs2b
  1763. Bauer stereo to binaural transformation, which improves headphone listening of
  1764. stereo audio records.
  1765. To enable compilation of this filter you need to configure FFmpeg with
  1766. @code{--enable-libbs2b}.
  1767. It accepts the following parameters:
  1768. @table @option
  1769. @item profile
  1770. Pre-defined crossfeed level.
  1771. @table @option
  1772. @item default
  1773. Default level (fcut=700, feed=50).
  1774. @item cmoy
  1775. Chu Moy circuit (fcut=700, feed=60).
  1776. @item jmeier
  1777. Jan Meier circuit (fcut=650, feed=95).
  1778. @end table
  1779. @item fcut
  1780. Cut frequency (in Hz).
  1781. @item feed
  1782. Feed level (in Hz).
  1783. @end table
  1784. @section channelmap
  1785. Remap input channels to new locations.
  1786. It accepts the following parameters:
  1787. @table @option
  1788. @item map
  1789. Map channels from input to output. The argument is a '|'-separated list of
  1790. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1791. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1792. channel (e.g. FL for front left) or its index in the input channel layout.
  1793. @var{out_channel} is the name of the output channel or its index in the output
  1794. channel layout. If @var{out_channel} is not given then it is implicitly an
  1795. index, starting with zero and increasing by one for each mapping.
  1796. @item channel_layout
  1797. The channel layout of the output stream.
  1798. @end table
  1799. If no mapping is present, the filter will implicitly map input channels to
  1800. output channels, preserving indices.
  1801. @subsection Examples
  1802. @itemize
  1803. @item
  1804. For example, assuming a 5.1+downmix input MOV file,
  1805. @example
  1806. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1807. @end example
  1808. will create an output WAV file tagged as stereo from the downmix channels of
  1809. the input.
  1810. @item
  1811. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1812. @example
  1813. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1814. @end example
  1815. @end itemize
  1816. @section channelsplit
  1817. Split each channel from an input audio stream into a separate output stream.
  1818. It accepts the following parameters:
  1819. @table @option
  1820. @item channel_layout
  1821. The channel layout of the input stream. The default is "stereo".
  1822. @item channels
  1823. A channel layout describing the channels to be extracted as separate output streams
  1824. or "all" to extract each input channel as a separate stream. The default is "all".
  1825. Choosing channels not present in channel layout in the input will result in an error.
  1826. @end table
  1827. @subsection Examples
  1828. @itemize
  1829. @item
  1830. For example, assuming a stereo input MP3 file,
  1831. @example
  1832. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1833. @end example
  1834. will create an output Matroska file with two audio streams, one containing only
  1835. the left channel and the other the right channel.
  1836. @item
  1837. Split a 5.1 WAV file into per-channel files:
  1838. @example
  1839. ffmpeg -i in.wav -filter_complex
  1840. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1841. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1842. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1843. side_right.wav
  1844. @end example
  1845. @item
  1846. Extract only LFE from a 5.1 WAV file:
  1847. @example
  1848. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1849. -map '[LFE]' lfe.wav
  1850. @end example
  1851. @end itemize
  1852. @section chorus
  1853. Add a chorus effect to the audio.
  1854. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1855. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1856. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1857. The modulation depth defines the range the modulated delay is played before or after
  1858. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1859. sound tuned around the original one, like in a chorus where some vocals are slightly
  1860. off key.
  1861. It accepts the following parameters:
  1862. @table @option
  1863. @item in_gain
  1864. Set input gain. Default is 0.4.
  1865. @item out_gain
  1866. Set output gain. Default is 0.4.
  1867. @item delays
  1868. Set delays. A typical delay is around 40ms to 60ms.
  1869. @item decays
  1870. Set decays.
  1871. @item speeds
  1872. Set speeds.
  1873. @item depths
  1874. Set depths.
  1875. @end table
  1876. @subsection Examples
  1877. @itemize
  1878. @item
  1879. A single delay:
  1880. @example
  1881. chorus=0.7:0.9:55:0.4:0.25:2
  1882. @end example
  1883. @item
  1884. Two delays:
  1885. @example
  1886. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1887. @end example
  1888. @item
  1889. Fuller sounding chorus with three delays:
  1890. @example
  1891. 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
  1892. @end example
  1893. @end itemize
  1894. @section compand
  1895. Compress or expand the audio's dynamic range.
  1896. It accepts the following parameters:
  1897. @table @option
  1898. @item attacks
  1899. @item decays
  1900. A list of times in seconds for each channel over which the instantaneous level
  1901. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1902. increase of volume and @var{decays} refers to decrease of volume. For most
  1903. situations, the attack time (response to the audio getting louder) should be
  1904. shorter than the decay time, because the human ear is more sensitive to sudden
  1905. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1906. a typical value for decay is 0.8 seconds.
  1907. If specified number of attacks & decays is lower than number of channels, the last
  1908. set attack/decay will be used for all remaining channels.
  1909. @item points
  1910. A list of points for the transfer function, specified in dB relative to the
  1911. maximum possible signal amplitude. Each key points list must be defined using
  1912. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1913. @code{x0/y0 x1/y1 x2/y2 ....}
  1914. The input values must be in strictly increasing order but the transfer function
  1915. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1916. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1917. function are @code{-70/-70|-60/-20|1/0}.
  1918. @item soft-knee
  1919. Set the curve radius in dB for all joints. It defaults to 0.01.
  1920. @item gain
  1921. Set the additional gain in dB to be applied at all points on the transfer
  1922. function. This allows for easy adjustment of the overall gain.
  1923. It defaults to 0.
  1924. @item volume
  1925. Set an initial volume, in dB, to be assumed for each channel when filtering
  1926. starts. This permits the user to supply a nominal level initially, so that, for
  1927. example, a very large gain is not applied to initial signal levels before the
  1928. companding has begun to operate. A typical value for audio which is initially
  1929. quiet is -90 dB. It defaults to 0.
  1930. @item delay
  1931. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1932. delayed before being fed to the volume adjuster. Specifying a delay
  1933. approximately equal to the attack/decay times allows the filter to effectively
  1934. operate in predictive rather than reactive mode. It defaults to 0.
  1935. @end table
  1936. @subsection Examples
  1937. @itemize
  1938. @item
  1939. Make music with both quiet and loud passages suitable for listening to in a
  1940. noisy environment:
  1941. @example
  1942. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1943. @end example
  1944. Another example for audio with whisper and explosion parts:
  1945. @example
  1946. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1947. @end example
  1948. @item
  1949. A noise gate for when the noise is at a lower level than the signal:
  1950. @example
  1951. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1952. @end example
  1953. @item
  1954. Here is another noise gate, this time for when the noise is at a higher level
  1955. than the signal (making it, in some ways, similar to squelch):
  1956. @example
  1957. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1958. @end example
  1959. @item
  1960. 2:1 compression starting at -6dB:
  1961. @example
  1962. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1963. @end example
  1964. @item
  1965. 2:1 compression starting at -9dB:
  1966. @example
  1967. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1968. @end example
  1969. @item
  1970. 2:1 compression starting at -12dB:
  1971. @example
  1972. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1973. @end example
  1974. @item
  1975. 2:1 compression starting at -18dB:
  1976. @example
  1977. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1978. @end example
  1979. @item
  1980. 3:1 compression starting at -15dB:
  1981. @example
  1982. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1983. @end example
  1984. @item
  1985. Compressor/Gate:
  1986. @example
  1987. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1988. @end example
  1989. @item
  1990. Expander:
  1991. @example
  1992. 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
  1993. @end example
  1994. @item
  1995. Hard limiter at -6dB:
  1996. @example
  1997. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1998. @end example
  1999. @item
  2000. Hard limiter at -12dB:
  2001. @example
  2002. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2003. @end example
  2004. @item
  2005. Hard noise gate at -35 dB:
  2006. @example
  2007. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2008. @end example
  2009. @item
  2010. Soft limiter:
  2011. @example
  2012. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2013. @end example
  2014. @end itemize
  2015. @section compensationdelay
  2016. Compensation Delay Line is a metric based delay to compensate differing
  2017. positions of microphones or speakers.
  2018. For example, you have recorded guitar with two microphones placed in
  2019. different location. Because the front of sound wave has fixed speed in
  2020. normal conditions, the phasing of microphones can vary and depends on
  2021. their location and interposition. The best sound mix can be achieved when
  2022. these microphones are in phase (synchronized). Note that distance of
  2023. ~30 cm between microphones makes one microphone to capture signal in
  2024. antiphase to another microphone. That makes the final mix sounding moody.
  2025. This filter helps to solve phasing problems by adding different delays
  2026. to each microphone track and make them synchronized.
  2027. The best result can be reached when you take one track as base and
  2028. synchronize other tracks one by one with it.
  2029. Remember that synchronization/delay tolerance depends on sample rate, too.
  2030. Higher sample rates will give more tolerance.
  2031. It accepts the following parameters:
  2032. @table @option
  2033. @item mm
  2034. Set millimeters distance. This is compensation distance for fine tuning.
  2035. Default is 0.
  2036. @item cm
  2037. Set cm distance. This is compensation distance for tightening distance setup.
  2038. Default is 0.
  2039. @item m
  2040. Set meters distance. This is compensation distance for hard distance setup.
  2041. Default is 0.
  2042. @item dry
  2043. Set dry amount. Amount of unprocessed (dry) signal.
  2044. Default is 0.
  2045. @item wet
  2046. Set wet amount. Amount of processed (wet) signal.
  2047. Default is 1.
  2048. @item temp
  2049. Set temperature degree in Celsius. This is the temperature of the environment.
  2050. Default is 20.
  2051. @end table
  2052. @section crossfeed
  2053. Apply headphone crossfeed filter.
  2054. Crossfeed is the process of blending the left and right channels of stereo
  2055. audio recording.
  2056. It is mainly used to reduce extreme stereo separation of low frequencies.
  2057. The intent is to produce more speaker like sound to the listener.
  2058. The filter accepts the following options:
  2059. @table @option
  2060. @item strength
  2061. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2062. This sets gain of low shelf filter for side part of stereo image.
  2063. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2064. @item range
  2065. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2066. This sets cut off frequency of low shelf filter. Default is cut off near
  2067. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2068. @item level_in
  2069. Set input gain. Default is 0.9.
  2070. @item level_out
  2071. Set output gain. Default is 1.
  2072. @end table
  2073. @section crystalizer
  2074. Simple algorithm to expand audio dynamic range.
  2075. The filter accepts the following options:
  2076. @table @option
  2077. @item i
  2078. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2079. (unchanged sound) to 10.0 (maximum effect).
  2080. @item c
  2081. Enable clipping. By default is enabled.
  2082. @end table
  2083. @section dcshift
  2084. Apply a DC shift to the audio.
  2085. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2086. in the recording chain) from the audio. The effect of a DC offset is reduced
  2087. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2088. a signal has a DC offset.
  2089. @table @option
  2090. @item shift
  2091. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2092. the audio.
  2093. @item limitergain
  2094. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2095. used to prevent clipping.
  2096. @end table
  2097. @section drmeter
  2098. Measure audio dynamic range.
  2099. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2100. is found in transition material. And anything less that 8 have very poor dynamics
  2101. and is very compressed.
  2102. The filter accepts the following options:
  2103. @table @option
  2104. @item length
  2105. Set window length in seconds used to split audio into segments of equal length.
  2106. Default is 3 seconds.
  2107. @end table
  2108. @section dynaudnorm
  2109. Dynamic Audio Normalizer.
  2110. This filter applies a certain amount of gain to the input audio in order
  2111. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2112. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2113. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2114. This allows for applying extra gain to the "quiet" sections of the audio
  2115. while avoiding distortions or clipping the "loud" sections. In other words:
  2116. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2117. sections, in the sense that the volume of each section is brought to the
  2118. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2119. this goal *without* applying "dynamic range compressing". It will retain 100%
  2120. of the dynamic range *within* each section of the audio file.
  2121. @table @option
  2122. @item f
  2123. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2124. Default is 500 milliseconds.
  2125. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2126. referred to as frames. This is required, because a peak magnitude has no
  2127. meaning for just a single sample value. Instead, we need to determine the
  2128. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2129. normalizer would simply use the peak magnitude of the complete file, the
  2130. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2131. frame. The length of a frame is specified in milliseconds. By default, the
  2132. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2133. been found to give good results with most files.
  2134. Note that the exact frame length, in number of samples, will be determined
  2135. automatically, based on the sampling rate of the individual input audio file.
  2136. @item g
  2137. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2138. number. Default is 31.
  2139. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2140. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2141. is specified in frames, centered around the current frame. For the sake of
  2142. simplicity, this must be an odd number. Consequently, the default value of 31
  2143. takes into account the current frame, as well as the 15 preceding frames and
  2144. the 15 subsequent frames. Using a larger window results in a stronger
  2145. smoothing effect and thus in less gain variation, i.e. slower gain
  2146. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2147. effect and thus in more gain variation, i.e. faster gain adaptation.
  2148. In other words, the more you increase this value, the more the Dynamic Audio
  2149. Normalizer will behave like a "traditional" normalization filter. On the
  2150. contrary, the more you decrease this value, the more the Dynamic Audio
  2151. Normalizer will behave like a dynamic range compressor.
  2152. @item p
  2153. Set the target peak value. This specifies the highest permissible magnitude
  2154. level for the normalized audio input. This filter will try to approach the
  2155. target peak magnitude as closely as possible, but at the same time it also
  2156. makes sure that the normalized signal will never exceed the peak magnitude.
  2157. A frame's maximum local gain factor is imposed directly by the target peak
  2158. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2159. It is not recommended to go above this value.
  2160. @item m
  2161. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2162. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2163. factor for each input frame, i.e. the maximum gain factor that does not
  2164. result in clipping or distortion. The maximum gain factor is determined by
  2165. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2166. additionally bounds the frame's maximum gain factor by a predetermined
  2167. (global) maximum gain factor. This is done in order to avoid excessive gain
  2168. factors in "silent" or almost silent frames. By default, the maximum gain
  2169. factor is 10.0, For most inputs the default value should be sufficient and
  2170. it usually is not recommended to increase this value. Though, for input
  2171. with an extremely low overall volume level, it may be necessary to allow even
  2172. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2173. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2174. Instead, a "sigmoid" threshold function will be applied. This way, the
  2175. gain factors will smoothly approach the threshold value, but never exceed that
  2176. value.
  2177. @item r
  2178. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2179. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2180. This means that the maximum local gain factor for each frame is defined
  2181. (only) by the frame's highest magnitude sample. This way, the samples can
  2182. be amplified as much as possible without exceeding the maximum signal
  2183. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2184. Normalizer can also take into account the frame's root mean square,
  2185. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2186. determine the power of a time-varying signal. It is therefore considered
  2187. that the RMS is a better approximation of the "perceived loudness" than
  2188. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2189. frames to a constant RMS value, a uniform "perceived loudness" can be
  2190. established. If a target RMS value has been specified, a frame's local gain
  2191. factor is defined as the factor that would result in exactly that RMS value.
  2192. Note, however, that the maximum local gain factor is still restricted by the
  2193. frame's highest magnitude sample, in order to prevent clipping.
  2194. @item n
  2195. Enable channels coupling. By default is enabled.
  2196. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2197. amount. This means the same gain factor will be applied to all channels, i.e.
  2198. the maximum possible gain factor is determined by the "loudest" channel.
  2199. However, in some recordings, it may happen that the volume of the different
  2200. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2201. In this case, this option can be used to disable the channel coupling. This way,
  2202. the gain factor will be determined independently for each channel, depending
  2203. only on the individual channel's highest magnitude sample. This allows for
  2204. harmonizing the volume of the different channels.
  2205. @item c
  2206. Enable DC bias correction. By default is disabled.
  2207. An audio signal (in the time domain) is a sequence of sample values.
  2208. In the Dynamic Audio Normalizer these sample values are represented in the
  2209. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2210. audio signal, or "waveform", should be centered around the zero point.
  2211. That means if we calculate the mean value of all samples in a file, or in a
  2212. single frame, then the result should be 0.0 or at least very close to that
  2213. value. If, however, there is a significant deviation of the mean value from
  2214. 0.0, in either positive or negative direction, this is referred to as a
  2215. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2216. Audio Normalizer provides optional DC bias correction.
  2217. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2218. the mean value, or "DC correction" offset, of each input frame and subtract
  2219. that value from all of the frame's sample values which ensures those samples
  2220. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2221. boundaries, the DC correction offset values will be interpolated smoothly
  2222. between neighbouring frames.
  2223. @item b
  2224. Enable alternative boundary mode. By default is disabled.
  2225. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2226. around each frame. This includes the preceding frames as well as the
  2227. subsequent frames. However, for the "boundary" frames, located at the very
  2228. beginning and at the very end of the audio file, not all neighbouring
  2229. frames are available. In particular, for the first few frames in the audio
  2230. file, the preceding frames are not known. And, similarly, for the last few
  2231. frames in the audio file, the subsequent frames are not known. Thus, the
  2232. question arises which gain factors should be assumed for the missing frames
  2233. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2234. to deal with this situation. The default boundary mode assumes a gain factor
  2235. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2236. "fade out" at the beginning and at the end of the input, respectively.
  2237. @item s
  2238. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2239. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2240. compression. This means that signal peaks will not be pruned and thus the
  2241. full dynamic range will be retained within each local neighbourhood. However,
  2242. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2243. normalization algorithm with a more "traditional" compression.
  2244. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2245. (thresholding) function. If (and only if) the compression feature is enabled,
  2246. all input frames will be processed by a soft knee thresholding function prior
  2247. to the actual normalization process. Put simply, the thresholding function is
  2248. going to prune all samples whose magnitude exceeds a certain threshold value.
  2249. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2250. value. Instead, the threshold value will be adjusted for each individual
  2251. frame.
  2252. In general, smaller parameters result in stronger compression, and vice versa.
  2253. Values below 3.0 are not recommended, because audible distortion may appear.
  2254. @end table
  2255. @section earwax
  2256. Make audio easier to listen to on headphones.
  2257. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2258. so that when listened to on headphones the stereo image is moved from
  2259. inside your head (standard for headphones) to outside and in front of
  2260. the listener (standard for speakers).
  2261. Ported from SoX.
  2262. @section equalizer
  2263. Apply a two-pole peaking equalisation (EQ) filter. With this
  2264. filter, the signal-level at and around a selected frequency can
  2265. be increased or decreased, whilst (unlike bandpass and bandreject
  2266. filters) that at all other frequencies is unchanged.
  2267. In order to produce complex equalisation curves, this filter can
  2268. be given several times, each with a different central frequency.
  2269. The filter accepts the following options:
  2270. @table @option
  2271. @item frequency, f
  2272. Set the filter's central frequency in Hz.
  2273. @item width_type, t
  2274. Set method to specify band-width of filter.
  2275. @table @option
  2276. @item h
  2277. Hz
  2278. @item q
  2279. Q-Factor
  2280. @item o
  2281. octave
  2282. @item s
  2283. slope
  2284. @item k
  2285. kHz
  2286. @end table
  2287. @item width, w
  2288. Specify the band-width of a filter in width_type units.
  2289. @item gain, g
  2290. Set the required gain or attenuation in dB.
  2291. Beware of clipping when using a positive gain.
  2292. @item channels, c
  2293. Specify which channels to filter, by default all available are filtered.
  2294. @end table
  2295. @subsection Examples
  2296. @itemize
  2297. @item
  2298. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2299. @example
  2300. equalizer=f=1000:t=h:width=200:g=-10
  2301. @end example
  2302. @item
  2303. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2304. @example
  2305. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2306. @end example
  2307. @end itemize
  2308. @subsection Commands
  2309. This filter supports the following commands:
  2310. @table @option
  2311. @item frequency, f
  2312. Change equalizer frequency.
  2313. Syntax for the command is : "@var{frequency}"
  2314. @item width_type, t
  2315. Change equalizer width_type.
  2316. Syntax for the command is : "@var{width_type}"
  2317. @item width, w
  2318. Change equalizer width.
  2319. Syntax for the command is : "@var{width}"
  2320. @item gain, g
  2321. Change equalizer gain.
  2322. Syntax for the command is : "@var{gain}"
  2323. @end table
  2324. @section extrastereo
  2325. Linearly increases the difference between left and right channels which
  2326. adds some sort of "live" effect to playback.
  2327. The filter accepts the following options:
  2328. @table @option
  2329. @item m
  2330. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2331. (average of both channels), with 1.0 sound will be unchanged, with
  2332. -1.0 left and right channels will be swapped.
  2333. @item c
  2334. Enable clipping. By default is enabled.
  2335. @end table
  2336. @section firequalizer
  2337. Apply FIR Equalization using arbitrary frequency response.
  2338. The filter accepts the following option:
  2339. @table @option
  2340. @item gain
  2341. Set gain curve equation (in dB). The expression can contain variables:
  2342. @table @option
  2343. @item f
  2344. the evaluated frequency
  2345. @item sr
  2346. sample rate
  2347. @item ch
  2348. channel number, set to 0 when multichannels evaluation is disabled
  2349. @item chid
  2350. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2351. multichannels evaluation is disabled
  2352. @item chs
  2353. number of channels
  2354. @item chlayout
  2355. channel_layout, see libavutil/channel_layout.h
  2356. @end table
  2357. and functions:
  2358. @table @option
  2359. @item gain_interpolate(f)
  2360. interpolate gain on frequency f based on gain_entry
  2361. @item cubic_interpolate(f)
  2362. same as gain_interpolate, but smoother
  2363. @end table
  2364. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2365. @item gain_entry
  2366. Set gain entry for gain_interpolate function. The expression can
  2367. contain functions:
  2368. @table @option
  2369. @item entry(f, g)
  2370. store gain entry at frequency f with value g
  2371. @end table
  2372. This option is also available as command.
  2373. @item delay
  2374. Set filter delay in seconds. Higher value means more accurate.
  2375. Default is @code{0.01}.
  2376. @item accuracy
  2377. Set filter accuracy in Hz. Lower value means more accurate.
  2378. Default is @code{5}.
  2379. @item wfunc
  2380. Set window function. Acceptable values are:
  2381. @table @option
  2382. @item rectangular
  2383. rectangular window, useful when gain curve is already smooth
  2384. @item hann
  2385. hann window (default)
  2386. @item hamming
  2387. hamming window
  2388. @item blackman
  2389. blackman window
  2390. @item nuttall3
  2391. 3-terms continuous 1st derivative nuttall window
  2392. @item mnuttall3
  2393. minimum 3-terms discontinuous nuttall window
  2394. @item nuttall
  2395. 4-terms continuous 1st derivative nuttall window
  2396. @item bnuttall
  2397. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2398. @item bharris
  2399. blackman-harris window
  2400. @item tukey
  2401. tukey window
  2402. @end table
  2403. @item fixed
  2404. If enabled, use fixed number of audio samples. This improves speed when
  2405. filtering with large delay. Default is disabled.
  2406. @item multi
  2407. Enable multichannels evaluation on gain. Default is disabled.
  2408. @item zero_phase
  2409. Enable zero phase mode by subtracting timestamp to compensate delay.
  2410. Default is disabled.
  2411. @item scale
  2412. Set scale used by gain. Acceptable values are:
  2413. @table @option
  2414. @item linlin
  2415. linear frequency, linear gain
  2416. @item linlog
  2417. linear frequency, logarithmic (in dB) gain (default)
  2418. @item loglin
  2419. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2420. @item loglog
  2421. logarithmic frequency, logarithmic gain
  2422. @end table
  2423. @item dumpfile
  2424. Set file for dumping, suitable for gnuplot.
  2425. @item dumpscale
  2426. Set scale for dumpfile. Acceptable values are same with scale option.
  2427. Default is linlog.
  2428. @item fft2
  2429. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2430. Default is disabled.
  2431. @item min_phase
  2432. Enable minimum phase impulse response. Default is disabled.
  2433. @end table
  2434. @subsection Examples
  2435. @itemize
  2436. @item
  2437. lowpass at 1000 Hz:
  2438. @example
  2439. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2440. @end example
  2441. @item
  2442. lowpass at 1000 Hz with gain_entry:
  2443. @example
  2444. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2445. @end example
  2446. @item
  2447. custom equalization:
  2448. @example
  2449. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2450. @end example
  2451. @item
  2452. higher delay with zero phase to compensate delay:
  2453. @example
  2454. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2455. @end example
  2456. @item
  2457. lowpass on left channel, highpass on right channel:
  2458. @example
  2459. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2460. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2461. @end example
  2462. @end itemize
  2463. @section flanger
  2464. Apply a flanging effect to the audio.
  2465. The filter accepts the following options:
  2466. @table @option
  2467. @item delay
  2468. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2469. @item depth
  2470. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2471. @item regen
  2472. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2473. Default value is 0.
  2474. @item width
  2475. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2476. Default value is 71.
  2477. @item speed
  2478. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2479. @item shape
  2480. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2481. Default value is @var{sinusoidal}.
  2482. @item phase
  2483. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2484. Default value is 25.
  2485. @item interp
  2486. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2487. Default is @var{linear}.
  2488. @end table
  2489. @section haas
  2490. Apply Haas effect to audio.
  2491. Note that this makes most sense to apply on mono signals.
  2492. With this filter applied to mono signals it give some directionality and
  2493. stretches its stereo image.
  2494. The filter accepts the following options:
  2495. @table @option
  2496. @item level_in
  2497. Set input level. By default is @var{1}, or 0dB
  2498. @item level_out
  2499. Set output level. By default is @var{1}, or 0dB.
  2500. @item side_gain
  2501. Set gain applied to side part of signal. By default is @var{1}.
  2502. @item middle_source
  2503. Set kind of middle source. Can be one of the following:
  2504. @table @samp
  2505. @item left
  2506. Pick left channel.
  2507. @item right
  2508. Pick right channel.
  2509. @item mid
  2510. Pick middle part signal of stereo image.
  2511. @item side
  2512. Pick side part signal of stereo image.
  2513. @end table
  2514. @item middle_phase
  2515. Change middle phase. By default is disabled.
  2516. @item left_delay
  2517. Set left channel delay. By default is @var{2.05} milliseconds.
  2518. @item left_balance
  2519. Set left channel balance. By default is @var{-1}.
  2520. @item left_gain
  2521. Set left channel gain. By default is @var{1}.
  2522. @item left_phase
  2523. Change left phase. By default is disabled.
  2524. @item right_delay
  2525. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2526. @item right_balance
  2527. Set right channel balance. By default is @var{1}.
  2528. @item right_gain
  2529. Set right channel gain. By default is @var{1}.
  2530. @item right_phase
  2531. Change right phase. By default is enabled.
  2532. @end table
  2533. @section hdcd
  2534. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2535. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2536. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2537. of HDCD, and detects the Transient Filter flag.
  2538. @example
  2539. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2540. @end example
  2541. When using the filter with wav, note the default encoding for wav is 16-bit,
  2542. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2543. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2544. @example
  2545. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2546. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2547. @end example
  2548. The filter accepts the following options:
  2549. @table @option
  2550. @item disable_autoconvert
  2551. Disable any automatic format conversion or resampling in the filter graph.
  2552. @item process_stereo
  2553. Process the stereo channels together. If target_gain does not match between
  2554. channels, consider it invalid and use the last valid target_gain.
  2555. @item cdt_ms
  2556. Set the code detect timer period in ms.
  2557. @item force_pe
  2558. Always extend peaks above -3dBFS even if PE isn't signaled.
  2559. @item analyze_mode
  2560. Replace audio with a solid tone and adjust the amplitude to signal some
  2561. specific aspect of the decoding process. The output file can be loaded in
  2562. an audio editor alongside the original to aid analysis.
  2563. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2564. Modes are:
  2565. @table @samp
  2566. @item 0, off
  2567. Disabled
  2568. @item 1, lle
  2569. Gain adjustment level at each sample
  2570. @item 2, pe
  2571. Samples where peak extend occurs
  2572. @item 3, cdt
  2573. Samples where the code detect timer is active
  2574. @item 4, tgm
  2575. Samples where the target gain does not match between channels
  2576. @end table
  2577. @end table
  2578. @section headphone
  2579. Apply head-related transfer functions (HRTFs) to create virtual
  2580. loudspeakers around the user for binaural listening via headphones.
  2581. The HRIRs are provided via additional streams, for each channel
  2582. one stereo input stream is needed.
  2583. The filter accepts the following options:
  2584. @table @option
  2585. @item map
  2586. Set mapping of input streams for convolution.
  2587. The argument is a '|'-separated list of channel names in order as they
  2588. are given as additional stream inputs for filter.
  2589. This also specify number of input streams. Number of input streams
  2590. must be not less than number of channels in first stream plus one.
  2591. @item gain
  2592. Set gain applied to audio. Value is in dB. Default is 0.
  2593. @item type
  2594. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2595. processing audio in time domain which is slow.
  2596. @var{freq} is processing audio in frequency domain which is fast.
  2597. Default is @var{freq}.
  2598. @item lfe
  2599. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2600. @item size
  2601. Set size of frame in number of samples which will be processed at once.
  2602. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2603. @item hrir
  2604. Set format of hrir stream.
  2605. Default value is @var{stereo}. Alternative value is @var{multich}.
  2606. If value is set to @var{stereo}, number of additional streams should
  2607. be greater or equal to number of input channels in first input stream.
  2608. Also each additional stream should have stereo number of channels.
  2609. If value is set to @var{multich}, number of additional streams should
  2610. be exactly one. Also number of input channels of additional stream
  2611. should be equal or greater than twice number of channels of first input
  2612. stream.
  2613. @end table
  2614. @subsection Examples
  2615. @itemize
  2616. @item
  2617. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2618. each amovie filter use stereo file with IR coefficients as input.
  2619. The files give coefficients for each position of virtual loudspeaker:
  2620. @example
  2621. 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"
  2622. output.wav
  2623. @end example
  2624. @item
  2625. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2626. but now in @var{multich} @var{hrir} format.
  2627. @example
  2628. 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"
  2629. output.wav
  2630. @end example
  2631. @end itemize
  2632. @section highpass
  2633. Apply a high-pass filter with 3dB point frequency.
  2634. The filter can be either single-pole, or double-pole (the default).
  2635. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2636. The filter accepts the following options:
  2637. @table @option
  2638. @item frequency, f
  2639. Set frequency in Hz. Default is 3000.
  2640. @item poles, p
  2641. Set number of poles. Default is 2.
  2642. @item width_type, t
  2643. Set method to specify band-width of filter.
  2644. @table @option
  2645. @item h
  2646. Hz
  2647. @item q
  2648. Q-Factor
  2649. @item o
  2650. octave
  2651. @item s
  2652. slope
  2653. @item k
  2654. kHz
  2655. @end table
  2656. @item width, w
  2657. Specify the band-width of a filter in width_type units.
  2658. Applies only to double-pole filter.
  2659. The default is 0.707q and gives a Butterworth response.
  2660. @item channels, c
  2661. Specify which channels to filter, by default all available are filtered.
  2662. @end table
  2663. @subsection Commands
  2664. This filter supports the following commands:
  2665. @table @option
  2666. @item frequency, f
  2667. Change highpass frequency.
  2668. Syntax for the command is : "@var{frequency}"
  2669. @item width_type, t
  2670. Change highpass width_type.
  2671. Syntax for the command is : "@var{width_type}"
  2672. @item width, w
  2673. Change highpass width.
  2674. Syntax for the command is : "@var{width}"
  2675. @end table
  2676. @section join
  2677. Join multiple input streams into one multi-channel stream.
  2678. It accepts the following parameters:
  2679. @table @option
  2680. @item inputs
  2681. The number of input streams. It defaults to 2.
  2682. @item channel_layout
  2683. The desired output channel layout. It defaults to stereo.
  2684. @item map
  2685. Map channels from inputs to output. The argument is a '|'-separated list of
  2686. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2687. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2688. can be either the name of the input channel (e.g. FL for front left) or its
  2689. index in the specified input stream. @var{out_channel} is the name of the output
  2690. channel.
  2691. @end table
  2692. The filter will attempt to guess the mappings when they are not specified
  2693. explicitly. It does so by first trying to find an unused matching input channel
  2694. and if that fails it picks the first unused input channel.
  2695. Join 3 inputs (with properly set channel layouts):
  2696. @example
  2697. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2698. @end example
  2699. Build a 5.1 output from 6 single-channel streams:
  2700. @example
  2701. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2702. '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'
  2703. out
  2704. @end example
  2705. @section ladspa
  2706. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2707. To enable compilation of this filter you need to configure FFmpeg with
  2708. @code{--enable-ladspa}.
  2709. @table @option
  2710. @item file, f
  2711. Specifies the name of LADSPA plugin library to load. If the environment
  2712. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2713. each one of the directories specified by the colon separated list in
  2714. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2715. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2716. @file{/usr/lib/ladspa/}.
  2717. @item plugin, p
  2718. Specifies the plugin within the library. Some libraries contain only
  2719. one plugin, but others contain many of them. If this is not set filter
  2720. will list all available plugins within the specified library.
  2721. @item controls, c
  2722. Set the '|' separated list of controls which are zero or more floating point
  2723. values that determine the behavior of the loaded plugin (for example delay,
  2724. threshold or gain).
  2725. Controls need to be defined using the following syntax:
  2726. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2727. @var{valuei} is the value set on the @var{i}-th control.
  2728. Alternatively they can be also defined using the following syntax:
  2729. @var{value0}|@var{value1}|@var{value2}|..., where
  2730. @var{valuei} is the value set on the @var{i}-th control.
  2731. If @option{controls} is set to @code{help}, all available controls and
  2732. their valid ranges are printed.
  2733. @item sample_rate, s
  2734. Specify the sample rate, default to 44100. Only used if plugin have
  2735. zero inputs.
  2736. @item nb_samples, n
  2737. Set the number of samples per channel per each output frame, default
  2738. is 1024. Only used if plugin have zero inputs.
  2739. @item duration, d
  2740. Set the minimum duration of the sourced audio. See
  2741. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2742. for the accepted syntax.
  2743. Note that the resulting duration may be greater than the specified duration,
  2744. as the generated audio is always cut at the end of a complete frame.
  2745. If not specified, or the expressed duration is negative, the audio is
  2746. supposed to be generated forever.
  2747. Only used if plugin have zero inputs.
  2748. @end table
  2749. @subsection Examples
  2750. @itemize
  2751. @item
  2752. List all available plugins within amp (LADSPA example plugin) library:
  2753. @example
  2754. ladspa=file=amp
  2755. @end example
  2756. @item
  2757. List all available controls and their valid ranges for @code{vcf_notch}
  2758. plugin from @code{VCF} library:
  2759. @example
  2760. ladspa=f=vcf:p=vcf_notch:c=help
  2761. @end example
  2762. @item
  2763. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2764. plugin library:
  2765. @example
  2766. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2767. @end example
  2768. @item
  2769. Add reverberation to the audio using TAP-plugins
  2770. (Tom's Audio Processing plugins):
  2771. @example
  2772. ladspa=file=tap_reverb:tap_reverb
  2773. @end example
  2774. @item
  2775. Generate white noise, with 0.2 amplitude:
  2776. @example
  2777. ladspa=file=cmt:noise_source_white:c=c0=.2
  2778. @end example
  2779. @item
  2780. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2781. @code{C* Audio Plugin Suite} (CAPS) library:
  2782. @example
  2783. ladspa=file=caps:Click:c=c1=20'
  2784. @end example
  2785. @item
  2786. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2787. @example
  2788. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2789. @end example
  2790. @item
  2791. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2792. @code{SWH Plugins} collection:
  2793. @example
  2794. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2795. @end example
  2796. @item
  2797. Attenuate low frequencies using Multiband EQ from Steve Harris
  2798. @code{SWH Plugins} collection:
  2799. @example
  2800. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2801. @end example
  2802. @item
  2803. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2804. (CAPS) library:
  2805. @example
  2806. ladspa=caps:Narrower
  2807. @end example
  2808. @item
  2809. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2810. @example
  2811. ladspa=caps:White:.2
  2812. @end example
  2813. @item
  2814. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2815. @example
  2816. ladspa=caps:Fractal:c=c1=1
  2817. @end example
  2818. @item
  2819. Dynamic volume normalization using @code{VLevel} plugin:
  2820. @example
  2821. ladspa=vlevel-ladspa:vlevel_mono
  2822. @end example
  2823. @end itemize
  2824. @subsection Commands
  2825. This filter supports the following commands:
  2826. @table @option
  2827. @item cN
  2828. Modify the @var{N}-th control value.
  2829. If the specified value is not valid, it is ignored and prior one is kept.
  2830. @end table
  2831. @section loudnorm
  2832. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2833. Support for both single pass (livestreams, files) and double pass (files) modes.
  2834. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2835. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2836. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2837. The filter accepts the following options:
  2838. @table @option
  2839. @item I, i
  2840. Set integrated loudness target.
  2841. Range is -70.0 - -5.0. Default value is -24.0.
  2842. @item LRA, lra
  2843. Set loudness range target.
  2844. Range is 1.0 - 20.0. Default value is 7.0.
  2845. @item TP, tp
  2846. Set maximum true peak.
  2847. Range is -9.0 - +0.0. Default value is -2.0.
  2848. @item measured_I, measured_i
  2849. Measured IL of input file.
  2850. Range is -99.0 - +0.0.
  2851. @item measured_LRA, measured_lra
  2852. Measured LRA of input file.
  2853. Range is 0.0 - 99.0.
  2854. @item measured_TP, measured_tp
  2855. Measured true peak of input file.
  2856. Range is -99.0 - +99.0.
  2857. @item measured_thresh
  2858. Measured threshold of input file.
  2859. Range is -99.0 - +0.0.
  2860. @item offset
  2861. Set offset gain. Gain is applied before the true-peak limiter.
  2862. Range is -99.0 - +99.0. Default is +0.0.
  2863. @item linear
  2864. Normalize linearly if possible.
  2865. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2866. to be specified in order to use this mode.
  2867. Options are true or false. Default is true.
  2868. @item dual_mono
  2869. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2870. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2871. If set to @code{true}, this option will compensate for this effect.
  2872. Multi-channel input files are not affected by this option.
  2873. Options are true or false. Default is false.
  2874. @item print_format
  2875. Set print format for stats. Options are summary, json, or none.
  2876. Default value is none.
  2877. @end table
  2878. @section lowpass
  2879. Apply a low-pass filter with 3dB point frequency.
  2880. The filter can be either single-pole or double-pole (the default).
  2881. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2882. The filter accepts the following options:
  2883. @table @option
  2884. @item frequency, f
  2885. Set frequency in Hz. Default is 500.
  2886. @item poles, p
  2887. Set number of poles. Default is 2.
  2888. @item width_type, t
  2889. Set method to specify band-width of filter.
  2890. @table @option
  2891. @item h
  2892. Hz
  2893. @item q
  2894. Q-Factor
  2895. @item o
  2896. octave
  2897. @item s
  2898. slope
  2899. @item k
  2900. kHz
  2901. @end table
  2902. @item width, w
  2903. Specify the band-width of a filter in width_type units.
  2904. Applies only to double-pole filter.
  2905. The default is 0.707q and gives a Butterworth response.
  2906. @item channels, c
  2907. Specify which channels to filter, by default all available are filtered.
  2908. @end table
  2909. @subsection Examples
  2910. @itemize
  2911. @item
  2912. Lowpass only LFE channel, it LFE is not present it does nothing:
  2913. @example
  2914. lowpass=c=LFE
  2915. @end example
  2916. @end itemize
  2917. @subsection Commands
  2918. This filter supports the following commands:
  2919. @table @option
  2920. @item frequency, f
  2921. Change lowpass frequency.
  2922. Syntax for the command is : "@var{frequency}"
  2923. @item width_type, t
  2924. Change lowpass width_type.
  2925. Syntax for the command is : "@var{width_type}"
  2926. @item width, w
  2927. Change lowpass width.
  2928. Syntax for the command is : "@var{width}"
  2929. @end table
  2930. @section lv2
  2931. Load a LV2 (LADSPA Version 2) plugin.
  2932. To enable compilation of this filter you need to configure FFmpeg with
  2933. @code{--enable-lv2}.
  2934. @table @option
  2935. @item plugin, p
  2936. Specifies the plugin URI. You may need to escape ':'.
  2937. @item controls, c
  2938. Set the '|' separated list of controls which are zero or more floating point
  2939. values that determine the behavior of the loaded plugin (for example delay,
  2940. threshold or gain).
  2941. If @option{controls} is set to @code{help}, all available controls and
  2942. their valid ranges are printed.
  2943. @item sample_rate, s
  2944. Specify the sample rate, default to 44100. Only used if plugin have
  2945. zero inputs.
  2946. @item nb_samples, n
  2947. Set the number of samples per channel per each output frame, default
  2948. is 1024. Only used if plugin have zero inputs.
  2949. @item duration, d
  2950. Set the minimum duration of the sourced audio. See
  2951. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2952. for the accepted syntax.
  2953. Note that the resulting duration may be greater than the specified duration,
  2954. as the generated audio is always cut at the end of a complete frame.
  2955. If not specified, or the expressed duration is negative, the audio is
  2956. supposed to be generated forever.
  2957. Only used if plugin have zero inputs.
  2958. @end table
  2959. @subsection Examples
  2960. @itemize
  2961. @item
  2962. Apply bass enhancer plugin from Calf:
  2963. @example
  2964. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2965. @end example
  2966. @item
  2967. Apply vinyl plugin from Calf:
  2968. @example
  2969. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2970. @end example
  2971. @item
  2972. Apply bit crusher plugin from ArtyFX:
  2973. @example
  2974. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2975. @end example
  2976. @end itemize
  2977. @section mcompand
  2978. Multiband Compress or expand the audio's dynamic range.
  2979. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2980. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2981. response when absent compander action.
  2982. It accepts the following parameters:
  2983. @table @option
  2984. @item args
  2985. This option syntax is:
  2986. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2987. For explanation of each item refer to compand filter documentation.
  2988. @end table
  2989. @anchor{pan}
  2990. @section pan
  2991. Mix channels with specific gain levels. The filter accepts the output
  2992. channel layout followed by a set of channels definitions.
  2993. This filter is also designed to efficiently remap the channels of an audio
  2994. stream.
  2995. The filter accepts parameters of the form:
  2996. "@var{l}|@var{outdef}|@var{outdef}|..."
  2997. @table @option
  2998. @item l
  2999. output channel layout or number of channels
  3000. @item outdef
  3001. output channel specification, of the form:
  3002. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3003. @item out_name
  3004. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3005. number (c0, c1, etc.)
  3006. @item gain
  3007. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3008. @item in_name
  3009. input channel to use, see out_name for details; it is not possible to mix
  3010. named and numbered input channels
  3011. @end table
  3012. If the `=' in a channel specification is replaced by `<', then the gains for
  3013. that specification will be renormalized so that the total is 1, thus
  3014. avoiding clipping noise.
  3015. @subsection Mixing examples
  3016. For example, if you want to down-mix from stereo to mono, but with a bigger
  3017. factor for the left channel:
  3018. @example
  3019. pan=1c|c0=0.9*c0+0.1*c1
  3020. @end example
  3021. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3022. 7-channels surround:
  3023. @example
  3024. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3025. @end example
  3026. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3027. that should be preferred (see "-ac" option) unless you have very specific
  3028. needs.
  3029. @subsection Remapping examples
  3030. The channel remapping will be effective if, and only if:
  3031. @itemize
  3032. @item gain coefficients are zeroes or ones,
  3033. @item only one input per channel output,
  3034. @end itemize
  3035. If all these conditions are satisfied, the filter will notify the user ("Pure
  3036. channel mapping detected"), and use an optimized and lossless method to do the
  3037. remapping.
  3038. For example, if you have a 5.1 source and want a stereo audio stream by
  3039. dropping the extra channels:
  3040. @example
  3041. pan="stereo| c0=FL | c1=FR"
  3042. @end example
  3043. Given the same source, you can also switch front left and front right channels
  3044. and keep the input channel layout:
  3045. @example
  3046. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3047. @end example
  3048. If the input is a stereo audio stream, you can mute the front left channel (and
  3049. still keep the stereo channel layout) with:
  3050. @example
  3051. pan="stereo|c1=c1"
  3052. @end example
  3053. Still with a stereo audio stream input, you can copy the right channel in both
  3054. front left and right:
  3055. @example
  3056. pan="stereo| c0=FR | c1=FR"
  3057. @end example
  3058. @section replaygain
  3059. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3060. outputs it unchanged.
  3061. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3062. @section resample
  3063. Convert the audio sample format, sample rate and channel layout. It is
  3064. not meant to be used directly.
  3065. @section rubberband
  3066. Apply time-stretching and pitch-shifting with librubberband.
  3067. To enable compilation of this filter, you need to configure FFmpeg with
  3068. @code{--enable-librubberband}.
  3069. The filter accepts the following options:
  3070. @table @option
  3071. @item tempo
  3072. Set tempo scale factor.
  3073. @item pitch
  3074. Set pitch scale factor.
  3075. @item transients
  3076. Set transients detector.
  3077. Possible values are:
  3078. @table @var
  3079. @item crisp
  3080. @item mixed
  3081. @item smooth
  3082. @end table
  3083. @item detector
  3084. Set detector.
  3085. Possible values are:
  3086. @table @var
  3087. @item compound
  3088. @item percussive
  3089. @item soft
  3090. @end table
  3091. @item phase
  3092. Set phase.
  3093. Possible values are:
  3094. @table @var
  3095. @item laminar
  3096. @item independent
  3097. @end table
  3098. @item window
  3099. Set processing window size.
  3100. Possible values are:
  3101. @table @var
  3102. @item standard
  3103. @item short
  3104. @item long
  3105. @end table
  3106. @item smoothing
  3107. Set smoothing.
  3108. Possible values are:
  3109. @table @var
  3110. @item off
  3111. @item on
  3112. @end table
  3113. @item formant
  3114. Enable formant preservation when shift pitching.
  3115. Possible values are:
  3116. @table @var
  3117. @item shifted
  3118. @item preserved
  3119. @end table
  3120. @item pitchq
  3121. Set pitch quality.
  3122. Possible values are:
  3123. @table @var
  3124. @item quality
  3125. @item speed
  3126. @item consistency
  3127. @end table
  3128. @item channels
  3129. Set channels.
  3130. Possible values are:
  3131. @table @var
  3132. @item apart
  3133. @item together
  3134. @end table
  3135. @end table
  3136. @section sidechaincompress
  3137. This filter acts like normal compressor but has the ability to compress
  3138. detected signal using second input signal.
  3139. It needs two input streams and returns one output stream.
  3140. First input stream will be processed depending on second stream signal.
  3141. The filtered signal then can be filtered with other filters in later stages of
  3142. processing. See @ref{pan} and @ref{amerge} filter.
  3143. The filter accepts the following options:
  3144. @table @option
  3145. @item level_in
  3146. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3147. @item threshold
  3148. If a signal of second stream raises above this level it will affect the gain
  3149. reduction of first stream.
  3150. By default is 0.125. Range is between 0.00097563 and 1.
  3151. @item ratio
  3152. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3153. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3154. Default is 2. Range is between 1 and 20.
  3155. @item attack
  3156. Amount of milliseconds the signal has to rise above the threshold before gain
  3157. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3158. @item release
  3159. Amount of milliseconds the signal has to fall below the threshold before
  3160. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3161. @item makeup
  3162. Set the amount by how much signal will be amplified after processing.
  3163. Default is 1. Range is from 1 to 64.
  3164. @item knee
  3165. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3166. Default is 2.82843. Range is between 1 and 8.
  3167. @item link
  3168. Choose if the @code{average} level between all channels of side-chain stream
  3169. or the louder(@code{maximum}) channel of side-chain stream affects the
  3170. reduction. Default is @code{average}.
  3171. @item detection
  3172. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3173. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3174. @item level_sc
  3175. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3176. @item mix
  3177. How much to use compressed signal in output. Default is 1.
  3178. Range is between 0 and 1.
  3179. @end table
  3180. @subsection Examples
  3181. @itemize
  3182. @item
  3183. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3184. depending on the signal of 2nd input and later compressed signal to be
  3185. merged with 2nd input:
  3186. @example
  3187. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3188. @end example
  3189. @end itemize
  3190. @section sidechaingate
  3191. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3192. filter the detected signal before sending it to the gain reduction stage.
  3193. Normally a gate uses the full range signal to detect a level above the
  3194. threshold.
  3195. For example: If you cut all lower frequencies from your sidechain signal
  3196. the gate will decrease the volume of your track only if not enough highs
  3197. appear. With this technique you are able to reduce the resonation of a
  3198. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3199. guitar.
  3200. It needs two input streams and returns one output stream.
  3201. First input stream will be processed depending on second stream signal.
  3202. The filter accepts the following options:
  3203. @table @option
  3204. @item level_in
  3205. Set input level before filtering.
  3206. Default is 1. Allowed range is from 0.015625 to 64.
  3207. @item range
  3208. Set the level of gain reduction when the signal is below the threshold.
  3209. Default is 0.06125. Allowed range is from 0 to 1.
  3210. @item threshold
  3211. If a signal rises above this level the gain reduction is released.
  3212. Default is 0.125. Allowed range is from 0 to 1.
  3213. @item ratio
  3214. Set a ratio about which the signal is reduced.
  3215. Default is 2. Allowed range is from 1 to 9000.
  3216. @item attack
  3217. Amount of milliseconds the signal has to rise above the threshold before gain
  3218. reduction stops.
  3219. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3220. @item release
  3221. Amount of milliseconds the signal has to fall below the threshold before the
  3222. reduction is increased again. Default is 250 milliseconds.
  3223. Allowed range is from 0.01 to 9000.
  3224. @item makeup
  3225. Set amount of amplification of signal after processing.
  3226. Default is 1. Allowed range is from 1 to 64.
  3227. @item knee
  3228. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3229. Default is 2.828427125. Allowed range is from 1 to 8.
  3230. @item detection
  3231. Choose if exact signal should be taken for detection or an RMS like one.
  3232. Default is rms. Can be peak or rms.
  3233. @item link
  3234. Choose if the average level between all channels or the louder channel affects
  3235. the reduction.
  3236. Default is average. Can be average or maximum.
  3237. @item level_sc
  3238. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3239. @end table
  3240. @section silencedetect
  3241. Detect silence in an audio stream.
  3242. This filter logs a message when it detects that the input audio volume is less
  3243. or equal to a noise tolerance value for a duration greater or equal to the
  3244. minimum detected noise duration.
  3245. The printed times and duration are expressed in seconds.
  3246. The filter accepts the following options:
  3247. @table @option
  3248. @item duration, d
  3249. Set silence duration until notification (default is 2 seconds).
  3250. @item noise, n
  3251. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3252. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3253. @end table
  3254. @subsection Examples
  3255. @itemize
  3256. @item
  3257. Detect 5 seconds of silence with -50dB noise tolerance:
  3258. @example
  3259. silencedetect=n=-50dB:d=5
  3260. @end example
  3261. @item
  3262. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3263. tolerance in @file{silence.mp3}:
  3264. @example
  3265. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3266. @end example
  3267. @end itemize
  3268. @section silenceremove
  3269. Remove silence from the beginning, middle or end of the audio.
  3270. The filter accepts the following options:
  3271. @table @option
  3272. @item start_periods
  3273. This value is used to indicate if audio should be trimmed at beginning of
  3274. the audio. A value of zero indicates no silence should be trimmed from the
  3275. beginning. When specifying a non-zero value, it trims audio up until it
  3276. finds non-silence. Normally, when trimming silence from beginning of audio
  3277. the @var{start_periods} will be @code{1} but it can be increased to higher
  3278. values to trim all audio up to specific count of non-silence periods.
  3279. Default value is @code{0}.
  3280. @item start_duration
  3281. Specify the amount of time that non-silence must be detected before it stops
  3282. trimming audio. By increasing the duration, bursts of noises can be treated
  3283. as silence and trimmed off. Default value is @code{0}.
  3284. @item start_threshold
  3285. This indicates what sample value should be treated as silence. For digital
  3286. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3287. you may wish to increase the value to account for background noise.
  3288. Can be specified in dB (in case "dB" is appended to the specified value)
  3289. or amplitude ratio. Default value is @code{0}.
  3290. @item stop_periods
  3291. Set the count for trimming silence from the end of audio.
  3292. To remove silence from the middle of a file, specify a @var{stop_periods}
  3293. that is negative. This value is then treated as a positive value and is
  3294. used to indicate the effect should restart processing as specified by
  3295. @var{start_periods}, making it suitable for removing periods of silence
  3296. in the middle of the audio.
  3297. Default value is @code{0}.
  3298. @item stop_duration
  3299. Specify a duration of silence that must exist before audio is not copied any
  3300. more. By specifying a higher duration, silence that is wanted can be left in
  3301. the audio.
  3302. Default value is @code{0}.
  3303. @item stop_threshold
  3304. This is the same as @option{start_threshold} but for trimming silence from
  3305. the end of audio.
  3306. Can be specified in dB (in case "dB" is appended to the specified value)
  3307. or amplitude ratio. Default value is @code{0}.
  3308. @item leave_silence
  3309. This indicates that @var{stop_duration} length of audio should be left intact
  3310. at the beginning of each period of silence.
  3311. For example, if you want to remove long pauses between words but do not want
  3312. to remove the pauses completely. Default value is @code{0}.
  3313. @item detection
  3314. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3315. and works better with digital silence which is exactly 0.
  3316. Default value is @code{rms}.
  3317. @item window
  3318. Set ratio used to calculate size of window for detecting silence.
  3319. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3320. @end table
  3321. @subsection Examples
  3322. @itemize
  3323. @item
  3324. The following example shows how this filter can be used to start a recording
  3325. that does not contain the delay at the start which usually occurs between
  3326. pressing the record button and the start of the performance:
  3327. @example
  3328. silenceremove=1:5:0.02
  3329. @end example
  3330. @item
  3331. Trim all silence encountered from beginning to end where there is more than 1
  3332. second of silence in audio:
  3333. @example
  3334. silenceremove=0:0:0:-1:1:-90dB
  3335. @end example
  3336. @end itemize
  3337. @section sofalizer
  3338. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3339. loudspeakers around the user for binaural listening via headphones (audio
  3340. formats up to 9 channels supported).
  3341. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3342. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3343. Austrian Academy of Sciences.
  3344. To enable compilation of this filter you need to configure FFmpeg with
  3345. @code{--enable-libmysofa}.
  3346. The filter accepts the following options:
  3347. @table @option
  3348. @item sofa
  3349. Set the SOFA file used for rendering.
  3350. @item gain
  3351. Set gain applied to audio. Value is in dB. Default is 0.
  3352. @item rotation
  3353. Set rotation of virtual loudspeakers in deg. Default is 0.
  3354. @item elevation
  3355. Set elevation of virtual speakers in deg. Default is 0.
  3356. @item radius
  3357. Set distance in meters between loudspeakers and the listener with near-field
  3358. HRTFs. Default is 1.
  3359. @item type
  3360. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3361. processing audio in time domain which is slow.
  3362. @var{freq} is processing audio in frequency domain which is fast.
  3363. Default is @var{freq}.
  3364. @item speakers
  3365. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3366. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3367. Each virtual loudspeaker is described with short channel name following with
  3368. azimuth and elevation in degrees.
  3369. Each virtual loudspeaker description is separated by '|'.
  3370. For example to override front left and front right channel positions use:
  3371. 'speakers=FL 45 15|FR 345 15'.
  3372. Descriptions with unrecognised channel names are ignored.
  3373. @item lfegain
  3374. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3375. @end table
  3376. @subsection Examples
  3377. @itemize
  3378. @item
  3379. Using ClubFritz6 sofa file:
  3380. @example
  3381. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3382. @end example
  3383. @item
  3384. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3385. @example
  3386. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3387. @end example
  3388. @item
  3389. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3390. and also with custom gain:
  3391. @example
  3392. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3393. @end example
  3394. @end itemize
  3395. @section stereotools
  3396. This filter has some handy utilities to manage stereo signals, for converting
  3397. M/S stereo recordings to L/R signal while having control over the parameters
  3398. or spreading the stereo image of master track.
  3399. The filter accepts the following options:
  3400. @table @option
  3401. @item level_in
  3402. Set input level before filtering for both channels. Defaults is 1.
  3403. Allowed range is from 0.015625 to 64.
  3404. @item level_out
  3405. Set output level after filtering for both channels. Defaults is 1.
  3406. Allowed range is from 0.015625 to 64.
  3407. @item balance_in
  3408. Set input balance between both channels. Default is 0.
  3409. Allowed range is from -1 to 1.
  3410. @item balance_out
  3411. Set output balance between both channels. Default is 0.
  3412. Allowed range is from -1 to 1.
  3413. @item softclip
  3414. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3415. clipping. Disabled by default.
  3416. @item mutel
  3417. Mute the left channel. Disabled by default.
  3418. @item muter
  3419. Mute the right channel. Disabled by default.
  3420. @item phasel
  3421. Change the phase of the left channel. Disabled by default.
  3422. @item phaser
  3423. Change the phase of the right channel. Disabled by default.
  3424. @item mode
  3425. Set stereo mode. Available values are:
  3426. @table @samp
  3427. @item lr>lr
  3428. Left/Right to Left/Right, this is default.
  3429. @item lr>ms
  3430. Left/Right to Mid/Side.
  3431. @item ms>lr
  3432. Mid/Side to Left/Right.
  3433. @item lr>ll
  3434. Left/Right to Left/Left.
  3435. @item lr>rr
  3436. Left/Right to Right/Right.
  3437. @item lr>l+r
  3438. Left/Right to Left + Right.
  3439. @item lr>rl
  3440. Left/Right to Right/Left.
  3441. @item ms>ll
  3442. Mid/Side to Left/Left.
  3443. @item ms>rr
  3444. Mid/Side to Right/Right.
  3445. @end table
  3446. @item slev
  3447. Set level of side signal. Default is 1.
  3448. Allowed range is from 0.015625 to 64.
  3449. @item sbal
  3450. Set balance of side signal. Default is 0.
  3451. Allowed range is from -1 to 1.
  3452. @item mlev
  3453. Set level of the middle signal. Default is 1.
  3454. Allowed range is from 0.015625 to 64.
  3455. @item mpan
  3456. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3457. @item base
  3458. Set stereo base between mono and inversed channels. Default is 0.
  3459. Allowed range is from -1 to 1.
  3460. @item delay
  3461. Set delay in milliseconds how much to delay left from right channel and
  3462. vice versa. Default is 0. Allowed range is from -20 to 20.
  3463. @item sclevel
  3464. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3465. @item phase
  3466. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3467. @item bmode_in, bmode_out
  3468. Set balance mode for balance_in/balance_out option.
  3469. Can be one of the following:
  3470. @table @samp
  3471. @item balance
  3472. Classic balance mode. Attenuate one channel at time.
  3473. Gain is raised up to 1.
  3474. @item amplitude
  3475. Similar as classic mode above but gain is raised up to 2.
  3476. @item power
  3477. Equal power distribution, from -6dB to +6dB range.
  3478. @end table
  3479. @end table
  3480. @subsection Examples
  3481. @itemize
  3482. @item
  3483. Apply karaoke like effect:
  3484. @example
  3485. stereotools=mlev=0.015625
  3486. @end example
  3487. @item
  3488. Convert M/S signal to L/R:
  3489. @example
  3490. "stereotools=mode=ms>lr"
  3491. @end example
  3492. @end itemize
  3493. @section stereowiden
  3494. This filter enhance the stereo effect by suppressing signal common to both
  3495. channels and by delaying the signal of left into right and vice versa,
  3496. thereby widening the stereo effect.
  3497. The filter accepts the following options:
  3498. @table @option
  3499. @item delay
  3500. Time in milliseconds of the delay of left signal into right and vice versa.
  3501. Default is 20 milliseconds.
  3502. @item feedback
  3503. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3504. effect of left signal in right output and vice versa which gives widening
  3505. effect. Default is 0.3.
  3506. @item crossfeed
  3507. Cross feed of left into right with inverted phase. This helps in suppressing
  3508. the mono. If the value is 1 it will cancel all the signal common to both
  3509. channels. Default is 0.3.
  3510. @item drymix
  3511. Set level of input signal of original channel. Default is 0.8.
  3512. @end table
  3513. @section superequalizer
  3514. Apply 18 band equalizer.
  3515. The filter accepts the following options:
  3516. @table @option
  3517. @item 1b
  3518. Set 65Hz band gain.
  3519. @item 2b
  3520. Set 92Hz band gain.
  3521. @item 3b
  3522. Set 131Hz band gain.
  3523. @item 4b
  3524. Set 185Hz band gain.
  3525. @item 5b
  3526. Set 262Hz band gain.
  3527. @item 6b
  3528. Set 370Hz band gain.
  3529. @item 7b
  3530. Set 523Hz band gain.
  3531. @item 8b
  3532. Set 740Hz band gain.
  3533. @item 9b
  3534. Set 1047Hz band gain.
  3535. @item 10b
  3536. Set 1480Hz band gain.
  3537. @item 11b
  3538. Set 2093Hz band gain.
  3539. @item 12b
  3540. Set 2960Hz band gain.
  3541. @item 13b
  3542. Set 4186Hz band gain.
  3543. @item 14b
  3544. Set 5920Hz band gain.
  3545. @item 15b
  3546. Set 8372Hz band gain.
  3547. @item 16b
  3548. Set 11840Hz band gain.
  3549. @item 17b
  3550. Set 16744Hz band gain.
  3551. @item 18b
  3552. Set 20000Hz band gain.
  3553. @end table
  3554. @section surround
  3555. Apply audio surround upmix filter.
  3556. This filter allows to produce multichannel output from audio stream.
  3557. The filter accepts the following options:
  3558. @table @option
  3559. @item chl_out
  3560. Set output channel layout. By default, this is @var{5.1}.
  3561. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3562. for the required syntax.
  3563. @item chl_in
  3564. Set input channel layout. By default, this is @var{stereo}.
  3565. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3566. for the required syntax.
  3567. @item level_in
  3568. Set input volume level. By default, this is @var{1}.
  3569. @item level_out
  3570. Set output volume level. By default, this is @var{1}.
  3571. @item lfe
  3572. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3573. @item lfe_low
  3574. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3575. @item lfe_high
  3576. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3577. @item fc_in
  3578. Set front center input volume. By default, this is @var{1}.
  3579. @item fc_out
  3580. Set front center output volume. By default, this is @var{1}.
  3581. @item lfe_in
  3582. Set LFE input volume. By default, this is @var{1}.
  3583. @item lfe_out
  3584. Set LFE output volume. By default, this is @var{1}.
  3585. @end table
  3586. @section treble, highshelf
  3587. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3588. shelving filter with a response similar to that of a standard
  3589. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3590. The filter accepts the following options:
  3591. @table @option
  3592. @item gain, g
  3593. Give the gain at whichever is the lower of ~22 kHz and the
  3594. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3595. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3596. @item frequency, f
  3597. Set the filter's central frequency and so can be used
  3598. to extend or reduce the frequency range to be boosted or cut.
  3599. The default value is @code{3000} Hz.
  3600. @item width_type, t
  3601. Set method to specify band-width of filter.
  3602. @table @option
  3603. @item h
  3604. Hz
  3605. @item q
  3606. Q-Factor
  3607. @item o
  3608. octave
  3609. @item s
  3610. slope
  3611. @item k
  3612. kHz
  3613. @end table
  3614. @item width, w
  3615. Determine how steep is the filter's shelf transition.
  3616. @item channels, c
  3617. Specify which channels to filter, by default all available are filtered.
  3618. @end table
  3619. @subsection Commands
  3620. This filter supports the following commands:
  3621. @table @option
  3622. @item frequency, f
  3623. Change treble frequency.
  3624. Syntax for the command is : "@var{frequency}"
  3625. @item width_type, t
  3626. Change treble width_type.
  3627. Syntax for the command is : "@var{width_type}"
  3628. @item width, w
  3629. Change treble width.
  3630. Syntax for the command is : "@var{width}"
  3631. @item gain, g
  3632. Change treble gain.
  3633. Syntax for the command is : "@var{gain}"
  3634. @end table
  3635. @section tremolo
  3636. Sinusoidal amplitude modulation.
  3637. The filter accepts the following options:
  3638. @table @option
  3639. @item f
  3640. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3641. (20 Hz or lower) will result in a tremolo effect.
  3642. This filter may also be used as a ring modulator by specifying
  3643. a modulation frequency higher than 20 Hz.
  3644. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3645. @item d
  3646. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3647. Default value is 0.5.
  3648. @end table
  3649. @section vibrato
  3650. Sinusoidal phase modulation.
  3651. The filter accepts the following options:
  3652. @table @option
  3653. @item f
  3654. Modulation frequency in Hertz.
  3655. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3656. @item d
  3657. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3658. Default value is 0.5.
  3659. @end table
  3660. @section volume
  3661. Adjust the input audio volume.
  3662. It accepts the following parameters:
  3663. @table @option
  3664. @item volume
  3665. Set audio volume expression.
  3666. Output values are clipped to the maximum value.
  3667. The output audio volume is given by the relation:
  3668. @example
  3669. @var{output_volume} = @var{volume} * @var{input_volume}
  3670. @end example
  3671. The default value for @var{volume} is "1.0".
  3672. @item precision
  3673. This parameter represents the mathematical precision.
  3674. It determines which input sample formats will be allowed, which affects the
  3675. precision of the volume scaling.
  3676. @table @option
  3677. @item fixed
  3678. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3679. @item float
  3680. 32-bit floating-point; this limits input sample format to FLT. (default)
  3681. @item double
  3682. 64-bit floating-point; this limits input sample format to DBL.
  3683. @end table
  3684. @item replaygain
  3685. Choose the behaviour on encountering ReplayGain side data in input frames.
  3686. @table @option
  3687. @item drop
  3688. Remove ReplayGain side data, ignoring its contents (the default).
  3689. @item ignore
  3690. Ignore ReplayGain side data, but leave it in the frame.
  3691. @item track
  3692. Prefer the track gain, if present.
  3693. @item album
  3694. Prefer the album gain, if present.
  3695. @end table
  3696. @item replaygain_preamp
  3697. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3698. Default value for @var{replaygain_preamp} is 0.0.
  3699. @item eval
  3700. Set when the volume expression is evaluated.
  3701. It accepts the following values:
  3702. @table @samp
  3703. @item once
  3704. only evaluate expression once during the filter initialization, or
  3705. when the @samp{volume} command is sent
  3706. @item frame
  3707. evaluate expression for each incoming frame
  3708. @end table
  3709. Default value is @samp{once}.
  3710. @end table
  3711. The volume expression can contain the following parameters.
  3712. @table @option
  3713. @item n
  3714. frame number (starting at zero)
  3715. @item nb_channels
  3716. number of channels
  3717. @item nb_consumed_samples
  3718. number of samples consumed by the filter
  3719. @item nb_samples
  3720. number of samples in the current frame
  3721. @item pos
  3722. original frame position in the file
  3723. @item pts
  3724. frame PTS
  3725. @item sample_rate
  3726. sample rate
  3727. @item startpts
  3728. PTS at start of stream
  3729. @item startt
  3730. time at start of stream
  3731. @item t
  3732. frame time
  3733. @item tb
  3734. timestamp timebase
  3735. @item volume
  3736. last set volume value
  3737. @end table
  3738. Note that when @option{eval} is set to @samp{once} only the
  3739. @var{sample_rate} and @var{tb} variables are available, all other
  3740. variables will evaluate to NAN.
  3741. @subsection Commands
  3742. This filter supports the following commands:
  3743. @table @option
  3744. @item volume
  3745. Modify the volume expression.
  3746. The command accepts the same syntax of the corresponding option.
  3747. If the specified expression is not valid, it is kept at its current
  3748. value.
  3749. @item replaygain_noclip
  3750. Prevent clipping by limiting the gain applied.
  3751. Default value for @var{replaygain_noclip} is 1.
  3752. @end table
  3753. @subsection Examples
  3754. @itemize
  3755. @item
  3756. Halve the input audio volume:
  3757. @example
  3758. volume=volume=0.5
  3759. volume=volume=1/2
  3760. volume=volume=-6.0206dB
  3761. @end example
  3762. In all the above example the named key for @option{volume} can be
  3763. omitted, for example like in:
  3764. @example
  3765. volume=0.5
  3766. @end example
  3767. @item
  3768. Increase input audio power by 6 decibels using fixed-point precision:
  3769. @example
  3770. volume=volume=6dB:precision=fixed
  3771. @end example
  3772. @item
  3773. Fade volume after time 10 with an annihilation period of 5 seconds:
  3774. @example
  3775. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3776. @end example
  3777. @end itemize
  3778. @section volumedetect
  3779. Detect the volume of the input video.
  3780. The filter has no parameters. The input is not modified. Statistics about
  3781. the volume will be printed in the log when the input stream end is reached.
  3782. In particular it will show the mean volume (root mean square), maximum
  3783. volume (on a per-sample basis), and the beginning of a histogram of the
  3784. registered volume values (from the maximum value to a cumulated 1/1000 of
  3785. the samples).
  3786. All volumes are in decibels relative to the maximum PCM value.
  3787. @subsection Examples
  3788. Here is an excerpt of the output:
  3789. @example
  3790. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3791. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3792. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3793. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3794. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3795. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3796. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3797. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3798. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3799. @end example
  3800. It means that:
  3801. @itemize
  3802. @item
  3803. The mean square energy is approximately -27 dB, or 10^-2.7.
  3804. @item
  3805. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3806. @item
  3807. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3808. @end itemize
  3809. In other words, raising the volume by +4 dB does not cause any clipping,
  3810. raising it by +5 dB causes clipping for 6 samples, etc.
  3811. @c man end AUDIO FILTERS
  3812. @chapter Audio Sources
  3813. @c man begin AUDIO SOURCES
  3814. Below is a description of the currently available audio sources.
  3815. @section abuffer
  3816. Buffer audio frames, and make them available to the filter chain.
  3817. This source is mainly intended for a programmatic use, in particular
  3818. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3819. It accepts the following parameters:
  3820. @table @option
  3821. @item time_base
  3822. The timebase which will be used for timestamps of submitted frames. It must be
  3823. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3824. @item sample_rate
  3825. The sample rate of the incoming audio buffers.
  3826. @item sample_fmt
  3827. The sample format of the incoming audio buffers.
  3828. Either a sample format name or its corresponding integer representation from
  3829. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3830. @item channel_layout
  3831. The channel layout of the incoming audio buffers.
  3832. Either a channel layout name from channel_layout_map in
  3833. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3834. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3835. @item channels
  3836. The number of channels of the incoming audio buffers.
  3837. If both @var{channels} and @var{channel_layout} are specified, then they
  3838. must be consistent.
  3839. @end table
  3840. @subsection Examples
  3841. @example
  3842. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3843. @end example
  3844. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3845. Since the sample format with name "s16p" corresponds to the number
  3846. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3847. equivalent to:
  3848. @example
  3849. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3850. @end example
  3851. @section aevalsrc
  3852. Generate an audio signal specified by an expression.
  3853. This source accepts in input one or more expressions (one for each
  3854. channel), which are evaluated and used to generate a corresponding
  3855. audio signal.
  3856. This source accepts the following options:
  3857. @table @option
  3858. @item exprs
  3859. Set the '|'-separated expressions list for each separate channel. In case the
  3860. @option{channel_layout} option is not specified, the selected channel layout
  3861. depends on the number of provided expressions. Otherwise the last
  3862. specified expression is applied to the remaining output channels.
  3863. @item channel_layout, c
  3864. Set the channel layout. The number of channels in the specified layout
  3865. must be equal to the number of specified expressions.
  3866. @item duration, d
  3867. Set the minimum duration of the sourced audio. See
  3868. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3869. for the accepted syntax.
  3870. Note that the resulting duration may be greater than the specified
  3871. duration, as the generated audio is always cut at the end of a
  3872. complete frame.
  3873. If not specified, or the expressed duration is negative, the audio is
  3874. supposed to be generated forever.
  3875. @item nb_samples, n
  3876. Set the number of samples per channel per each output frame,
  3877. default to 1024.
  3878. @item sample_rate, s
  3879. Specify the sample rate, default to 44100.
  3880. @end table
  3881. Each expression in @var{exprs} can contain the following constants:
  3882. @table @option
  3883. @item n
  3884. number of the evaluated sample, starting from 0
  3885. @item t
  3886. time of the evaluated sample expressed in seconds, starting from 0
  3887. @item s
  3888. sample rate
  3889. @end table
  3890. @subsection Examples
  3891. @itemize
  3892. @item
  3893. Generate silence:
  3894. @example
  3895. aevalsrc=0
  3896. @end example
  3897. @item
  3898. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3899. 8000 Hz:
  3900. @example
  3901. aevalsrc="sin(440*2*PI*t):s=8000"
  3902. @end example
  3903. @item
  3904. Generate a two channels signal, specify the channel layout (Front
  3905. Center + Back Center) explicitly:
  3906. @example
  3907. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3908. @end example
  3909. @item
  3910. Generate white noise:
  3911. @example
  3912. aevalsrc="-2+random(0)"
  3913. @end example
  3914. @item
  3915. Generate an amplitude modulated signal:
  3916. @example
  3917. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3918. @end example
  3919. @item
  3920. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3921. @example
  3922. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3923. @end example
  3924. @end itemize
  3925. @section anullsrc
  3926. The null audio source, return unprocessed audio frames. It is mainly useful
  3927. as a template and to be employed in analysis / debugging tools, or as
  3928. the source for filters which ignore the input data (for example the sox
  3929. synth filter).
  3930. This source accepts the following options:
  3931. @table @option
  3932. @item channel_layout, cl
  3933. Specifies the channel layout, and can be either an integer or a string
  3934. representing a channel layout. The default value of @var{channel_layout}
  3935. is "stereo".
  3936. Check the channel_layout_map definition in
  3937. @file{libavutil/channel_layout.c} for the mapping between strings and
  3938. channel layout values.
  3939. @item sample_rate, r
  3940. Specifies the sample rate, and defaults to 44100.
  3941. @item nb_samples, n
  3942. Set the number of samples per requested frames.
  3943. @end table
  3944. @subsection Examples
  3945. @itemize
  3946. @item
  3947. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3948. @example
  3949. anullsrc=r=48000:cl=4
  3950. @end example
  3951. @item
  3952. Do the same operation with a more obvious syntax:
  3953. @example
  3954. anullsrc=r=48000:cl=mono
  3955. @end example
  3956. @end itemize
  3957. All the parameters need to be explicitly defined.
  3958. @section flite
  3959. Synthesize a voice utterance using the libflite library.
  3960. To enable compilation of this filter you need to configure FFmpeg with
  3961. @code{--enable-libflite}.
  3962. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3963. The filter accepts the following options:
  3964. @table @option
  3965. @item list_voices
  3966. If set to 1, list the names of the available voices and exit
  3967. immediately. Default value is 0.
  3968. @item nb_samples, n
  3969. Set the maximum number of samples per frame. Default value is 512.
  3970. @item textfile
  3971. Set the filename containing the text to speak.
  3972. @item text
  3973. Set the text to speak.
  3974. @item voice, v
  3975. Set the voice to use for the speech synthesis. Default value is
  3976. @code{kal}. See also the @var{list_voices} option.
  3977. @end table
  3978. @subsection Examples
  3979. @itemize
  3980. @item
  3981. Read from file @file{speech.txt}, and synthesize the text using the
  3982. standard flite voice:
  3983. @example
  3984. flite=textfile=speech.txt
  3985. @end example
  3986. @item
  3987. Read the specified text selecting the @code{slt} voice:
  3988. @example
  3989. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3990. @end example
  3991. @item
  3992. Input text to ffmpeg:
  3993. @example
  3994. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3995. @end example
  3996. @item
  3997. Make @file{ffplay} speak the specified text, using @code{flite} and
  3998. the @code{lavfi} device:
  3999. @example
  4000. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4001. @end example
  4002. @end itemize
  4003. For more information about libflite, check:
  4004. @url{http://www.festvox.org/flite/}
  4005. @section anoisesrc
  4006. Generate a noise audio signal.
  4007. The filter accepts the following options:
  4008. @table @option
  4009. @item sample_rate, r
  4010. Specify the sample rate. Default value is 48000 Hz.
  4011. @item amplitude, a
  4012. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4013. is 1.0.
  4014. @item duration, d
  4015. Specify the duration of the generated audio stream. Not specifying this option
  4016. results in noise with an infinite length.
  4017. @item color, colour, c
  4018. Specify the color of noise. Available noise colors are white, pink, brown,
  4019. blue and violet. Default color is white.
  4020. @item seed, s
  4021. Specify a value used to seed the PRNG.
  4022. @item nb_samples, n
  4023. Set the number of samples per each output frame, default is 1024.
  4024. @end table
  4025. @subsection Examples
  4026. @itemize
  4027. @item
  4028. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4029. @example
  4030. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4031. @end example
  4032. @end itemize
  4033. @section hilbert
  4034. Generate odd-tap Hilbert transform FIR coefficients.
  4035. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4036. the signal by 90 degrees.
  4037. This is used in many matrix coding schemes and for analytic signal generation.
  4038. The process is often written as a multiplication by i (or j), the imaginary unit.
  4039. The filter accepts the following options:
  4040. @table @option
  4041. @item sample_rate, s
  4042. Set sample rate, default is 44100.
  4043. @item taps, t
  4044. Set length of FIR filter, default is 22051.
  4045. @item nb_samples, n
  4046. Set number of samples per each frame.
  4047. @item win_func, w
  4048. Set window function to be used when generating FIR coefficients.
  4049. @end table
  4050. @section sine
  4051. Generate an audio signal made of a sine wave with amplitude 1/8.
  4052. The audio signal is bit-exact.
  4053. The filter accepts the following options:
  4054. @table @option
  4055. @item frequency, f
  4056. Set the carrier frequency. Default is 440 Hz.
  4057. @item beep_factor, b
  4058. Enable a periodic beep every second with frequency @var{beep_factor} times
  4059. the carrier frequency. Default is 0, meaning the beep is disabled.
  4060. @item sample_rate, r
  4061. Specify the sample rate, default is 44100.
  4062. @item duration, d
  4063. Specify the duration of the generated audio stream.
  4064. @item samples_per_frame
  4065. Set the number of samples per output frame.
  4066. The expression can contain the following constants:
  4067. @table @option
  4068. @item n
  4069. The (sequential) number of the output audio frame, starting from 0.
  4070. @item pts
  4071. The PTS (Presentation TimeStamp) of the output audio frame,
  4072. expressed in @var{TB} units.
  4073. @item t
  4074. The PTS of the output audio frame, expressed in seconds.
  4075. @item TB
  4076. The timebase of the output audio frames.
  4077. @end table
  4078. Default is @code{1024}.
  4079. @end table
  4080. @subsection Examples
  4081. @itemize
  4082. @item
  4083. Generate a simple 440 Hz sine wave:
  4084. @example
  4085. sine
  4086. @end example
  4087. @item
  4088. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4089. @example
  4090. sine=220:4:d=5
  4091. sine=f=220:b=4:d=5
  4092. sine=frequency=220:beep_factor=4:duration=5
  4093. @end example
  4094. @item
  4095. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4096. pattern:
  4097. @example
  4098. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4099. @end example
  4100. @end itemize
  4101. @c man end AUDIO SOURCES
  4102. @chapter Audio Sinks
  4103. @c man begin AUDIO SINKS
  4104. Below is a description of the currently available audio sinks.
  4105. @section abuffersink
  4106. Buffer audio frames, and make them available to the end of filter chain.
  4107. This sink is mainly intended for programmatic use, in particular
  4108. through the interface defined in @file{libavfilter/buffersink.h}
  4109. or the options system.
  4110. It accepts a pointer to an AVABufferSinkContext structure, which
  4111. defines the incoming buffers' formats, to be passed as the opaque
  4112. parameter to @code{avfilter_init_filter} for initialization.
  4113. @section anullsink
  4114. Null audio sink; do absolutely nothing with the input audio. It is
  4115. mainly useful as a template and for use in analysis / debugging
  4116. tools.
  4117. @c man end AUDIO SINKS
  4118. @chapter Video Filters
  4119. @c man begin VIDEO FILTERS
  4120. When you configure your FFmpeg build, you can disable any of the
  4121. existing filters using @code{--disable-filters}.
  4122. The configure output will show the video filters included in your
  4123. build.
  4124. Below is a description of the currently available video filters.
  4125. @section alphaextract
  4126. Extract the alpha component from the input as a grayscale video. This
  4127. is especially useful with the @var{alphamerge} filter.
  4128. @section alphamerge
  4129. Add or replace the alpha component of the primary input with the
  4130. grayscale value of a second input. This is intended for use with
  4131. @var{alphaextract} to allow the transmission or storage of frame
  4132. sequences that have alpha in a format that doesn't support an alpha
  4133. channel.
  4134. For example, to reconstruct full frames from a normal YUV-encoded video
  4135. and a separate video created with @var{alphaextract}, you might use:
  4136. @example
  4137. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4138. @end example
  4139. Since this filter is designed for reconstruction, it operates on frame
  4140. sequences without considering timestamps, and terminates when either
  4141. input reaches end of stream. This will cause problems if your encoding
  4142. pipeline drops frames. If you're trying to apply an image as an
  4143. overlay to a video stream, consider the @var{overlay} filter instead.
  4144. @section amplify
  4145. Amplify differences between current pixel and pixels of adjacent frames in
  4146. same pixel location.
  4147. This filter accepts the following options:
  4148. @table @option
  4149. @item radius
  4150. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4151. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4152. @item factor
  4153. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4154. @item threshold
  4155. Set threshold for difference amplification. Any differrence greater or equal to
  4156. this value will not alter source pixel. Default is 10.
  4157. Allowed range is from 0 to 65535.
  4158. @item low
  4159. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4160. This option controls maximum possible value that will decrease source pixel value.
  4161. @item high
  4162. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4163. This option controls maximum possible value that will increase source pixel value.
  4164. @item planes
  4165. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4166. @end table
  4167. @section ass
  4168. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4169. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4170. Substation Alpha) subtitles files.
  4171. This filter accepts the following option in addition to the common options from
  4172. the @ref{subtitles} filter:
  4173. @table @option
  4174. @item shaping
  4175. Set the shaping engine
  4176. Available values are:
  4177. @table @samp
  4178. @item auto
  4179. The default libass shaping engine, which is the best available.
  4180. @item simple
  4181. Fast, font-agnostic shaper that can do only substitutions
  4182. @item complex
  4183. Slower shaper using OpenType for substitutions and positioning
  4184. @end table
  4185. The default is @code{auto}.
  4186. @end table
  4187. @section atadenoise
  4188. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4189. The filter accepts the following options:
  4190. @table @option
  4191. @item 0a
  4192. Set threshold A for 1st plane. Default is 0.02.
  4193. Valid range is 0 to 0.3.
  4194. @item 0b
  4195. Set threshold B for 1st plane. Default is 0.04.
  4196. Valid range is 0 to 5.
  4197. @item 1a
  4198. Set threshold A for 2nd plane. Default is 0.02.
  4199. Valid range is 0 to 0.3.
  4200. @item 1b
  4201. Set threshold B for 2nd plane. Default is 0.04.
  4202. Valid range is 0 to 5.
  4203. @item 2a
  4204. Set threshold A for 3rd plane. Default is 0.02.
  4205. Valid range is 0 to 0.3.
  4206. @item 2b
  4207. Set threshold B for 3rd plane. Default is 0.04.
  4208. Valid range is 0 to 5.
  4209. Threshold A is designed to react on abrupt changes in the input signal and
  4210. threshold B is designed to react on continuous changes in the input signal.
  4211. @item s
  4212. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4213. number in range [5, 129].
  4214. @item p
  4215. Set what planes of frame filter will use for averaging. Default is all.
  4216. @end table
  4217. @section avgblur
  4218. Apply average blur filter.
  4219. The filter accepts the following options:
  4220. @table @option
  4221. @item sizeX
  4222. Set horizontal radius size.
  4223. @item planes
  4224. Set which planes to filter. By default all planes are filtered.
  4225. @item sizeY
  4226. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4227. Default is @code{0}.
  4228. @end table
  4229. @section bbox
  4230. Compute the bounding box for the non-black pixels in the input frame
  4231. luminance plane.
  4232. This filter computes the bounding box containing all the pixels with a
  4233. luminance value greater than the minimum allowed value.
  4234. The parameters describing the bounding box are printed on the filter
  4235. log.
  4236. The filter accepts the following option:
  4237. @table @option
  4238. @item min_val
  4239. Set the minimal luminance value. Default is @code{16}.
  4240. @end table
  4241. @section bitplanenoise
  4242. Show and measure bit plane noise.
  4243. The filter accepts the following options:
  4244. @table @option
  4245. @item bitplane
  4246. Set which plane to analyze. Default is @code{1}.
  4247. @item filter
  4248. Filter out noisy pixels from @code{bitplane} set above.
  4249. Default is disabled.
  4250. @end table
  4251. @section blackdetect
  4252. Detect video intervals that are (almost) completely black. Can be
  4253. useful to detect chapter transitions, commercials, or invalid
  4254. recordings. Output lines contains the time for the start, end and
  4255. duration of the detected black interval expressed in seconds.
  4256. In order to display the output lines, you need to set the loglevel at
  4257. least to the AV_LOG_INFO value.
  4258. The filter accepts the following options:
  4259. @table @option
  4260. @item black_min_duration, d
  4261. Set the minimum detected black duration expressed in seconds. It must
  4262. be a non-negative floating point number.
  4263. Default value is 2.0.
  4264. @item picture_black_ratio_th, pic_th
  4265. Set the threshold for considering a picture "black".
  4266. Express the minimum value for the ratio:
  4267. @example
  4268. @var{nb_black_pixels} / @var{nb_pixels}
  4269. @end example
  4270. for which a picture is considered black.
  4271. Default value is 0.98.
  4272. @item pixel_black_th, pix_th
  4273. Set the threshold for considering a pixel "black".
  4274. The threshold expresses the maximum pixel luminance value for which a
  4275. pixel is considered "black". The provided value is scaled according to
  4276. the following equation:
  4277. @example
  4278. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4279. @end example
  4280. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4281. the input video format, the range is [0-255] for YUV full-range
  4282. formats and [16-235] for YUV non full-range formats.
  4283. Default value is 0.10.
  4284. @end table
  4285. The following example sets the maximum pixel threshold to the minimum
  4286. value, and detects only black intervals of 2 or more seconds:
  4287. @example
  4288. blackdetect=d=2:pix_th=0.00
  4289. @end example
  4290. @section blackframe
  4291. Detect frames that are (almost) completely black. Can be useful to
  4292. detect chapter transitions or commercials. Output lines consist of
  4293. the frame number of the detected frame, the percentage of blackness,
  4294. the position in the file if known or -1 and the timestamp in seconds.
  4295. In order to display the output lines, you need to set the loglevel at
  4296. least to the AV_LOG_INFO value.
  4297. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4298. The value represents the percentage of pixels in the picture that
  4299. are below the threshold value.
  4300. It accepts the following parameters:
  4301. @table @option
  4302. @item amount
  4303. The percentage of the pixels that have to be below the threshold; it defaults to
  4304. @code{98}.
  4305. @item threshold, thresh
  4306. The threshold below which a pixel value is considered black; it defaults to
  4307. @code{32}.
  4308. @end table
  4309. @section blend, tblend
  4310. Blend two video frames into each other.
  4311. The @code{blend} filter takes two input streams and outputs one
  4312. stream, the first input is the "top" layer and second input is
  4313. "bottom" layer. By default, the output terminates when the longest input terminates.
  4314. The @code{tblend} (time blend) filter takes two consecutive frames
  4315. from one single stream, and outputs the result obtained by blending
  4316. the new frame on top of the old frame.
  4317. A description of the accepted options follows.
  4318. @table @option
  4319. @item c0_mode
  4320. @item c1_mode
  4321. @item c2_mode
  4322. @item c3_mode
  4323. @item all_mode
  4324. Set blend mode for specific pixel component or all pixel components in case
  4325. of @var{all_mode}. Default value is @code{normal}.
  4326. Available values for component modes are:
  4327. @table @samp
  4328. @item addition
  4329. @item grainmerge
  4330. @item and
  4331. @item average
  4332. @item burn
  4333. @item darken
  4334. @item difference
  4335. @item grainextract
  4336. @item divide
  4337. @item dodge
  4338. @item freeze
  4339. @item exclusion
  4340. @item extremity
  4341. @item glow
  4342. @item hardlight
  4343. @item hardmix
  4344. @item heat
  4345. @item lighten
  4346. @item linearlight
  4347. @item multiply
  4348. @item multiply128
  4349. @item negation
  4350. @item normal
  4351. @item or
  4352. @item overlay
  4353. @item phoenix
  4354. @item pinlight
  4355. @item reflect
  4356. @item screen
  4357. @item softlight
  4358. @item subtract
  4359. @item vividlight
  4360. @item xor
  4361. @end table
  4362. @item c0_opacity
  4363. @item c1_opacity
  4364. @item c2_opacity
  4365. @item c3_opacity
  4366. @item all_opacity
  4367. Set blend opacity for specific pixel component or all pixel components in case
  4368. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4369. @item c0_expr
  4370. @item c1_expr
  4371. @item c2_expr
  4372. @item c3_expr
  4373. @item all_expr
  4374. Set blend expression for specific pixel component or all pixel components in case
  4375. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4376. The expressions can use the following variables:
  4377. @table @option
  4378. @item N
  4379. The sequential number of the filtered frame, starting from @code{0}.
  4380. @item X
  4381. @item Y
  4382. the coordinates of the current sample
  4383. @item W
  4384. @item H
  4385. the width and height of currently filtered plane
  4386. @item SW
  4387. @item SH
  4388. Width and height scale for the plane being filtered. It is the
  4389. ratio between the dimensions of the current plane to the luma plane,
  4390. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4391. the luma plane and @code{0.5,0.5} for the chroma planes.
  4392. @item T
  4393. Time of the current frame, expressed in seconds.
  4394. @item TOP, A
  4395. Value of pixel component at current location for first video frame (top layer).
  4396. @item BOTTOM, B
  4397. Value of pixel component at current location for second video frame (bottom layer).
  4398. @end table
  4399. @end table
  4400. The @code{blend} filter also supports the @ref{framesync} options.
  4401. @subsection Examples
  4402. @itemize
  4403. @item
  4404. Apply transition from bottom layer to top layer in first 10 seconds:
  4405. @example
  4406. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4407. @end example
  4408. @item
  4409. Apply linear horizontal transition from top layer to bottom layer:
  4410. @example
  4411. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4412. @end example
  4413. @item
  4414. Apply 1x1 checkerboard effect:
  4415. @example
  4416. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4417. @end example
  4418. @item
  4419. Apply uncover left effect:
  4420. @example
  4421. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4422. @end example
  4423. @item
  4424. Apply uncover down effect:
  4425. @example
  4426. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4427. @end example
  4428. @item
  4429. Apply uncover up-left effect:
  4430. @example
  4431. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4432. @end example
  4433. @item
  4434. Split diagonally video and shows top and bottom layer on each side:
  4435. @example
  4436. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4437. @end example
  4438. @item
  4439. Display differences between the current and the previous frame:
  4440. @example
  4441. tblend=all_mode=grainextract
  4442. @end example
  4443. @end itemize
  4444. @section bm3d
  4445. Denoise frames using Block-Matching 3D algorithm.
  4446. The filter accepts the following options.
  4447. @table @option
  4448. @item sigma
  4449. Set denoising strength. Default value is 1.
  4450. Allowed range is from 0 to 999.9.
  4451. The denoising algorith is very sensitive to sigma, so adjust it
  4452. according to the source.
  4453. @item block
  4454. Set local patch size. This sets dimensions in 2D.
  4455. @item bstep
  4456. Set sliding step for processing blocks. Default value is 4.
  4457. Allowed range is from 1 to 64.
  4458. Smaller values allows processing more reference blocks and is slower.
  4459. @item group
  4460. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4461. When set to 1, no block matching is done. Larger values allows more blocks
  4462. in single group.
  4463. Allowed range is from 1 to 256.
  4464. @item range
  4465. Set radius for search block matching. Default is 9.
  4466. Allowed range is from 1 to INT32_MAX.
  4467. @item mstep
  4468. Set step between two search locations for block matching. Default is 1.
  4469. Allowed range is from 1 to 64. Smaller is slower.
  4470. @item thmse
  4471. Set threshold of mean square error for block matching. Valid range is 0 to
  4472. INT32_MAX.
  4473. @item hdthr
  4474. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4475. Larger values results in stronger hard-thresholding filtering in frequency
  4476. domain.
  4477. @item estim
  4478. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4479. Default is @code{basic}.
  4480. @item ref
  4481. If enabled, filter will use 2nd stream for block matching.
  4482. Default is disabled for @code{basic} value of @var{estim} option,
  4483. and always enabled if value of @var{estim} is @code{final}.
  4484. @item planes
  4485. Set planes to filter. Default is all available except alpha.
  4486. @end table
  4487. @subsection Examples
  4488. @itemize
  4489. @item
  4490. Basic filtering with bm3d:
  4491. @example
  4492. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4493. @end example
  4494. @item
  4495. Same as above, but filtering only luma:
  4496. @example
  4497. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4498. @end example
  4499. @item
  4500. Same as above, but with both estimation modes:
  4501. @example
  4502. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4503. @end example
  4504. @item
  4505. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4506. @example
  4507. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4508. @end example
  4509. @end itemize
  4510. @section boxblur
  4511. Apply a boxblur algorithm to the input video.
  4512. It accepts the following parameters:
  4513. @table @option
  4514. @item luma_radius, lr
  4515. @item luma_power, lp
  4516. @item chroma_radius, cr
  4517. @item chroma_power, cp
  4518. @item alpha_radius, ar
  4519. @item alpha_power, ap
  4520. @end table
  4521. A description of the accepted options follows.
  4522. @table @option
  4523. @item luma_radius, lr
  4524. @item chroma_radius, cr
  4525. @item alpha_radius, ar
  4526. Set an expression for the box radius in pixels used for blurring the
  4527. corresponding input plane.
  4528. The radius value must be a non-negative number, and must not be
  4529. greater than the value of the expression @code{min(w,h)/2} for the
  4530. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4531. planes.
  4532. Default value for @option{luma_radius} is "2". If not specified,
  4533. @option{chroma_radius} and @option{alpha_radius} default to the
  4534. corresponding value set for @option{luma_radius}.
  4535. The expressions can contain the following constants:
  4536. @table @option
  4537. @item w
  4538. @item h
  4539. The input width and height in pixels.
  4540. @item cw
  4541. @item ch
  4542. The input chroma image width and height in pixels.
  4543. @item hsub
  4544. @item vsub
  4545. The horizontal and vertical chroma subsample values. For example, for the
  4546. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4547. @end table
  4548. @item luma_power, lp
  4549. @item chroma_power, cp
  4550. @item alpha_power, ap
  4551. Specify how many times the boxblur filter is applied to the
  4552. corresponding plane.
  4553. Default value for @option{luma_power} is 2. If not specified,
  4554. @option{chroma_power} and @option{alpha_power} default to the
  4555. corresponding value set for @option{luma_power}.
  4556. A value of 0 will disable the effect.
  4557. @end table
  4558. @subsection Examples
  4559. @itemize
  4560. @item
  4561. Apply a boxblur filter with the luma, chroma, and alpha radii
  4562. set to 2:
  4563. @example
  4564. boxblur=luma_radius=2:luma_power=1
  4565. boxblur=2:1
  4566. @end example
  4567. @item
  4568. Set the luma radius to 2, and alpha and chroma radius to 0:
  4569. @example
  4570. boxblur=2:1:cr=0:ar=0
  4571. @end example
  4572. @item
  4573. Set the luma and chroma radii to a fraction of the video dimension:
  4574. @example
  4575. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4576. @end example
  4577. @end itemize
  4578. @section bwdif
  4579. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4580. Deinterlacing Filter").
  4581. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4582. interpolation algorithms.
  4583. It accepts the following parameters:
  4584. @table @option
  4585. @item mode
  4586. The interlacing mode to adopt. It accepts one of the following values:
  4587. @table @option
  4588. @item 0, send_frame
  4589. Output one frame for each frame.
  4590. @item 1, send_field
  4591. Output one frame for each field.
  4592. @end table
  4593. The default value is @code{send_field}.
  4594. @item parity
  4595. The picture field parity assumed for the input interlaced video. It accepts one
  4596. of the following values:
  4597. @table @option
  4598. @item 0, tff
  4599. Assume the top field is first.
  4600. @item 1, bff
  4601. Assume the bottom field is first.
  4602. @item -1, auto
  4603. Enable automatic detection of field parity.
  4604. @end table
  4605. The default value is @code{auto}.
  4606. If the interlacing is unknown or the decoder does not export this information,
  4607. top field first will be assumed.
  4608. @item deint
  4609. Specify which frames to deinterlace. Accept one of the following
  4610. values:
  4611. @table @option
  4612. @item 0, all
  4613. Deinterlace all frames.
  4614. @item 1, interlaced
  4615. Only deinterlace frames marked as interlaced.
  4616. @end table
  4617. The default value is @code{all}.
  4618. @end table
  4619. @section chromakey
  4620. YUV colorspace color/chroma keying.
  4621. The filter accepts the following options:
  4622. @table @option
  4623. @item color
  4624. The color which will be replaced with transparency.
  4625. @item similarity
  4626. Similarity percentage with the key color.
  4627. 0.01 matches only the exact key color, while 1.0 matches everything.
  4628. @item blend
  4629. Blend percentage.
  4630. 0.0 makes pixels either fully transparent, or not transparent at all.
  4631. Higher values result in semi-transparent pixels, with a higher transparency
  4632. the more similar the pixels color is to the key color.
  4633. @item yuv
  4634. Signals that the color passed is already in YUV instead of RGB.
  4635. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4636. This can be used to pass exact YUV values as hexadecimal numbers.
  4637. @end table
  4638. @subsection Examples
  4639. @itemize
  4640. @item
  4641. Make every green pixel in the input image transparent:
  4642. @example
  4643. ffmpeg -i input.png -vf chromakey=green out.png
  4644. @end example
  4645. @item
  4646. Overlay a greenscreen-video on top of a static black background.
  4647. @example
  4648. 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
  4649. @end example
  4650. @end itemize
  4651. @section ciescope
  4652. Display CIE color diagram with pixels overlaid onto it.
  4653. The filter accepts the following options:
  4654. @table @option
  4655. @item system
  4656. Set color system.
  4657. @table @samp
  4658. @item ntsc, 470m
  4659. @item ebu, 470bg
  4660. @item smpte
  4661. @item 240m
  4662. @item apple
  4663. @item widergb
  4664. @item cie1931
  4665. @item rec709, hdtv
  4666. @item uhdtv, rec2020
  4667. @end table
  4668. @item cie
  4669. Set CIE system.
  4670. @table @samp
  4671. @item xyy
  4672. @item ucs
  4673. @item luv
  4674. @end table
  4675. @item gamuts
  4676. Set what gamuts to draw.
  4677. See @code{system} option for available values.
  4678. @item size, s
  4679. Set ciescope size, by default set to 512.
  4680. @item intensity, i
  4681. Set intensity used to map input pixel values to CIE diagram.
  4682. @item contrast
  4683. Set contrast used to draw tongue colors that are out of active color system gamut.
  4684. @item corrgamma
  4685. Correct gamma displayed on scope, by default enabled.
  4686. @item showwhite
  4687. Show white point on CIE diagram, by default disabled.
  4688. @item gamma
  4689. Set input gamma. Used only with XYZ input color space.
  4690. @end table
  4691. @section codecview
  4692. Visualize information exported by some codecs.
  4693. Some codecs can export information through frames using side-data or other
  4694. means. For example, some MPEG based codecs export motion vectors through the
  4695. @var{export_mvs} flag in the codec @option{flags2} option.
  4696. The filter accepts the following option:
  4697. @table @option
  4698. @item mv
  4699. Set motion vectors to visualize.
  4700. Available flags for @var{mv} are:
  4701. @table @samp
  4702. @item pf
  4703. forward predicted MVs of P-frames
  4704. @item bf
  4705. forward predicted MVs of B-frames
  4706. @item bb
  4707. backward predicted MVs of B-frames
  4708. @end table
  4709. @item qp
  4710. Display quantization parameters using the chroma planes.
  4711. @item mv_type, mvt
  4712. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4713. Available flags for @var{mv_type} are:
  4714. @table @samp
  4715. @item fp
  4716. forward predicted MVs
  4717. @item bp
  4718. backward predicted MVs
  4719. @end table
  4720. @item frame_type, ft
  4721. Set frame type to visualize motion vectors of.
  4722. Available flags for @var{frame_type} are:
  4723. @table @samp
  4724. @item if
  4725. intra-coded frames (I-frames)
  4726. @item pf
  4727. predicted frames (P-frames)
  4728. @item bf
  4729. bi-directionally predicted frames (B-frames)
  4730. @end table
  4731. @end table
  4732. @subsection Examples
  4733. @itemize
  4734. @item
  4735. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4736. @example
  4737. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4738. @end example
  4739. @item
  4740. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4741. @example
  4742. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4743. @end example
  4744. @end itemize
  4745. @section colorbalance
  4746. Modify intensity of primary colors (red, green and blue) of input frames.
  4747. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4748. regions for the red-cyan, green-magenta or blue-yellow balance.
  4749. A positive adjustment value shifts the balance towards the primary color, a negative
  4750. value towards the complementary color.
  4751. The filter accepts the following options:
  4752. @table @option
  4753. @item rs
  4754. @item gs
  4755. @item bs
  4756. Adjust red, green and blue shadows (darkest pixels).
  4757. @item rm
  4758. @item gm
  4759. @item bm
  4760. Adjust red, green and blue midtones (medium pixels).
  4761. @item rh
  4762. @item gh
  4763. @item bh
  4764. Adjust red, green and blue highlights (brightest pixels).
  4765. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4766. @end table
  4767. @subsection Examples
  4768. @itemize
  4769. @item
  4770. Add red color cast to shadows:
  4771. @example
  4772. colorbalance=rs=.3
  4773. @end example
  4774. @end itemize
  4775. @section colorkey
  4776. RGB colorspace color keying.
  4777. The filter accepts the following options:
  4778. @table @option
  4779. @item color
  4780. The color which will be replaced with transparency.
  4781. @item similarity
  4782. Similarity percentage with the key color.
  4783. 0.01 matches only the exact key color, while 1.0 matches everything.
  4784. @item blend
  4785. Blend percentage.
  4786. 0.0 makes pixels either fully transparent, or not transparent at all.
  4787. Higher values result in semi-transparent pixels, with a higher transparency
  4788. the more similar the pixels color is to the key color.
  4789. @end table
  4790. @subsection Examples
  4791. @itemize
  4792. @item
  4793. Make every green pixel in the input image transparent:
  4794. @example
  4795. ffmpeg -i input.png -vf colorkey=green out.png
  4796. @end example
  4797. @item
  4798. Overlay a greenscreen-video on top of a static background image.
  4799. @example
  4800. 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
  4801. @end example
  4802. @end itemize
  4803. @section colorlevels
  4804. Adjust video input frames using levels.
  4805. The filter accepts the following options:
  4806. @table @option
  4807. @item rimin
  4808. @item gimin
  4809. @item bimin
  4810. @item aimin
  4811. Adjust red, green, blue and alpha input black point.
  4812. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4813. @item rimax
  4814. @item gimax
  4815. @item bimax
  4816. @item aimax
  4817. Adjust red, green, blue and alpha input white point.
  4818. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4819. Input levels are used to lighten highlights (bright tones), darken shadows
  4820. (dark tones), change the balance of bright and dark tones.
  4821. @item romin
  4822. @item gomin
  4823. @item bomin
  4824. @item aomin
  4825. Adjust red, green, blue and alpha output black point.
  4826. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4827. @item romax
  4828. @item gomax
  4829. @item bomax
  4830. @item aomax
  4831. Adjust red, green, blue and alpha output white point.
  4832. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4833. Output levels allows manual selection of a constrained output level range.
  4834. @end table
  4835. @subsection Examples
  4836. @itemize
  4837. @item
  4838. Make video output darker:
  4839. @example
  4840. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4841. @end example
  4842. @item
  4843. Increase contrast:
  4844. @example
  4845. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4846. @end example
  4847. @item
  4848. Make video output lighter:
  4849. @example
  4850. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4851. @end example
  4852. @item
  4853. Increase brightness:
  4854. @example
  4855. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4856. @end example
  4857. @end itemize
  4858. @section colorchannelmixer
  4859. Adjust video input frames by re-mixing color channels.
  4860. This filter modifies a color channel by adding the values associated to
  4861. the other channels of the same pixels. For example if the value to
  4862. modify is red, the output value will be:
  4863. @example
  4864. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4865. @end example
  4866. The filter accepts the following options:
  4867. @table @option
  4868. @item rr
  4869. @item rg
  4870. @item rb
  4871. @item ra
  4872. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4873. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4874. @item gr
  4875. @item gg
  4876. @item gb
  4877. @item ga
  4878. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4879. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4880. @item br
  4881. @item bg
  4882. @item bb
  4883. @item ba
  4884. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4885. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4886. @item ar
  4887. @item ag
  4888. @item ab
  4889. @item aa
  4890. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4891. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4892. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4893. @end table
  4894. @subsection Examples
  4895. @itemize
  4896. @item
  4897. Convert source to grayscale:
  4898. @example
  4899. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4900. @end example
  4901. @item
  4902. Simulate sepia tones:
  4903. @example
  4904. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4905. @end example
  4906. @end itemize
  4907. @section colormatrix
  4908. Convert color matrix.
  4909. The filter accepts the following options:
  4910. @table @option
  4911. @item src
  4912. @item dst
  4913. Specify the source and destination color matrix. Both values must be
  4914. specified.
  4915. The accepted values are:
  4916. @table @samp
  4917. @item bt709
  4918. BT.709
  4919. @item fcc
  4920. FCC
  4921. @item bt601
  4922. BT.601
  4923. @item bt470
  4924. BT.470
  4925. @item bt470bg
  4926. BT.470BG
  4927. @item smpte170m
  4928. SMPTE-170M
  4929. @item smpte240m
  4930. SMPTE-240M
  4931. @item bt2020
  4932. BT.2020
  4933. @end table
  4934. @end table
  4935. For example to convert from BT.601 to SMPTE-240M, use the command:
  4936. @example
  4937. colormatrix=bt601:smpte240m
  4938. @end example
  4939. @section colorspace
  4940. Convert colorspace, transfer characteristics or color primaries.
  4941. Input video needs to have an even size.
  4942. The filter accepts the following options:
  4943. @table @option
  4944. @anchor{all}
  4945. @item all
  4946. Specify all color properties at once.
  4947. The accepted values are:
  4948. @table @samp
  4949. @item bt470m
  4950. BT.470M
  4951. @item bt470bg
  4952. BT.470BG
  4953. @item bt601-6-525
  4954. BT.601-6 525
  4955. @item bt601-6-625
  4956. BT.601-6 625
  4957. @item bt709
  4958. BT.709
  4959. @item smpte170m
  4960. SMPTE-170M
  4961. @item smpte240m
  4962. SMPTE-240M
  4963. @item bt2020
  4964. BT.2020
  4965. @end table
  4966. @anchor{space}
  4967. @item space
  4968. Specify output colorspace.
  4969. The accepted values are:
  4970. @table @samp
  4971. @item bt709
  4972. BT.709
  4973. @item fcc
  4974. FCC
  4975. @item bt470bg
  4976. BT.470BG or BT.601-6 625
  4977. @item smpte170m
  4978. SMPTE-170M or BT.601-6 525
  4979. @item smpte240m
  4980. SMPTE-240M
  4981. @item ycgco
  4982. YCgCo
  4983. @item bt2020ncl
  4984. BT.2020 with non-constant luminance
  4985. @end table
  4986. @anchor{trc}
  4987. @item trc
  4988. Specify output transfer characteristics.
  4989. The accepted values are:
  4990. @table @samp
  4991. @item bt709
  4992. BT.709
  4993. @item bt470m
  4994. BT.470M
  4995. @item bt470bg
  4996. BT.470BG
  4997. @item gamma22
  4998. Constant gamma of 2.2
  4999. @item gamma28
  5000. Constant gamma of 2.8
  5001. @item smpte170m
  5002. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5003. @item smpte240m
  5004. SMPTE-240M
  5005. @item srgb
  5006. SRGB
  5007. @item iec61966-2-1
  5008. iec61966-2-1
  5009. @item iec61966-2-4
  5010. iec61966-2-4
  5011. @item xvycc
  5012. xvycc
  5013. @item bt2020-10
  5014. BT.2020 for 10-bits content
  5015. @item bt2020-12
  5016. BT.2020 for 12-bits content
  5017. @end table
  5018. @anchor{primaries}
  5019. @item primaries
  5020. Specify output color primaries.
  5021. The accepted values are:
  5022. @table @samp
  5023. @item bt709
  5024. BT.709
  5025. @item bt470m
  5026. BT.470M
  5027. @item bt470bg
  5028. BT.470BG or BT.601-6 625
  5029. @item smpte170m
  5030. SMPTE-170M or BT.601-6 525
  5031. @item smpte240m
  5032. SMPTE-240M
  5033. @item film
  5034. film
  5035. @item smpte431
  5036. SMPTE-431
  5037. @item smpte432
  5038. SMPTE-432
  5039. @item bt2020
  5040. BT.2020
  5041. @item jedec-p22
  5042. JEDEC P22 phosphors
  5043. @end table
  5044. @anchor{range}
  5045. @item range
  5046. Specify output color range.
  5047. The accepted values are:
  5048. @table @samp
  5049. @item tv
  5050. TV (restricted) range
  5051. @item mpeg
  5052. MPEG (restricted) range
  5053. @item pc
  5054. PC (full) range
  5055. @item jpeg
  5056. JPEG (full) range
  5057. @end table
  5058. @item format
  5059. Specify output color format.
  5060. The accepted values are:
  5061. @table @samp
  5062. @item yuv420p
  5063. YUV 4:2:0 planar 8-bits
  5064. @item yuv420p10
  5065. YUV 4:2:0 planar 10-bits
  5066. @item yuv420p12
  5067. YUV 4:2:0 planar 12-bits
  5068. @item yuv422p
  5069. YUV 4:2:2 planar 8-bits
  5070. @item yuv422p10
  5071. YUV 4:2:2 planar 10-bits
  5072. @item yuv422p12
  5073. YUV 4:2:2 planar 12-bits
  5074. @item yuv444p
  5075. YUV 4:4:4 planar 8-bits
  5076. @item yuv444p10
  5077. YUV 4:4:4 planar 10-bits
  5078. @item yuv444p12
  5079. YUV 4:4:4 planar 12-bits
  5080. @end table
  5081. @item fast
  5082. Do a fast conversion, which skips gamma/primary correction. This will take
  5083. significantly less CPU, but will be mathematically incorrect. To get output
  5084. compatible with that produced by the colormatrix filter, use fast=1.
  5085. @item dither
  5086. Specify dithering mode.
  5087. The accepted values are:
  5088. @table @samp
  5089. @item none
  5090. No dithering
  5091. @item fsb
  5092. Floyd-Steinberg dithering
  5093. @end table
  5094. @item wpadapt
  5095. Whitepoint adaptation mode.
  5096. The accepted values are:
  5097. @table @samp
  5098. @item bradford
  5099. Bradford whitepoint adaptation
  5100. @item vonkries
  5101. von Kries whitepoint adaptation
  5102. @item identity
  5103. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5104. @end table
  5105. @item iall
  5106. Override all input properties at once. Same accepted values as @ref{all}.
  5107. @item ispace
  5108. Override input colorspace. Same accepted values as @ref{space}.
  5109. @item iprimaries
  5110. Override input color primaries. Same accepted values as @ref{primaries}.
  5111. @item itrc
  5112. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5113. @item irange
  5114. Override input color range. Same accepted values as @ref{range}.
  5115. @end table
  5116. The filter converts the transfer characteristics, color space and color
  5117. primaries to the specified user values. The output value, if not specified,
  5118. is set to a default value based on the "all" property. If that property is
  5119. also not specified, the filter will log an error. The output color range and
  5120. format default to the same value as the input color range and format. The
  5121. input transfer characteristics, color space, color primaries and color range
  5122. should be set on the input data. If any of these are missing, the filter will
  5123. log an error and no conversion will take place.
  5124. For example to convert the input to SMPTE-240M, use the command:
  5125. @example
  5126. colorspace=smpte240m
  5127. @end example
  5128. @section convolution
  5129. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5130. The filter accepts the following options:
  5131. @table @option
  5132. @item 0m
  5133. @item 1m
  5134. @item 2m
  5135. @item 3m
  5136. Set matrix for each plane.
  5137. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5138. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5139. @item 0rdiv
  5140. @item 1rdiv
  5141. @item 2rdiv
  5142. @item 3rdiv
  5143. Set multiplier for calculated value for each plane.
  5144. If unset or 0, it will be sum of all matrix elements.
  5145. @item 0bias
  5146. @item 1bias
  5147. @item 2bias
  5148. @item 3bias
  5149. Set bias for each plane. This value is added to the result of the multiplication.
  5150. Useful for making the overall image brighter or darker. Default is 0.0.
  5151. @item 0mode
  5152. @item 1mode
  5153. @item 2mode
  5154. @item 3mode
  5155. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5156. Default is @var{square}.
  5157. @end table
  5158. @subsection Examples
  5159. @itemize
  5160. @item
  5161. Apply sharpen:
  5162. @example
  5163. 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"
  5164. @end example
  5165. @item
  5166. Apply blur:
  5167. @example
  5168. 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"
  5169. @end example
  5170. @item
  5171. Apply edge enhance:
  5172. @example
  5173. 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"
  5174. @end example
  5175. @item
  5176. Apply edge detect:
  5177. @example
  5178. 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"
  5179. @end example
  5180. @item
  5181. Apply laplacian edge detector which includes diagonals:
  5182. @example
  5183. 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"
  5184. @end example
  5185. @item
  5186. Apply emboss:
  5187. @example
  5188. 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"
  5189. @end example
  5190. @end itemize
  5191. @section convolve
  5192. Apply 2D convolution of video stream in frequency domain using second stream
  5193. as impulse.
  5194. The filter accepts the following options:
  5195. @table @option
  5196. @item planes
  5197. Set which planes to process.
  5198. @item impulse
  5199. Set which impulse video frames will be processed, can be @var{first}
  5200. or @var{all}. Default is @var{all}.
  5201. @end table
  5202. The @code{convolve} filter also supports the @ref{framesync} options.
  5203. @section copy
  5204. Copy the input video source unchanged to the output. This is mainly useful for
  5205. testing purposes.
  5206. @anchor{coreimage}
  5207. @section coreimage
  5208. Video filtering on GPU using Apple's CoreImage API on OSX.
  5209. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5210. processed by video hardware. However, software-based OpenGL implementations
  5211. exist which means there is no guarantee for hardware processing. It depends on
  5212. the respective OSX.
  5213. There are many filters and image generators provided by Apple that come with a
  5214. large variety of options. The filter has to be referenced by its name along
  5215. with its options.
  5216. The coreimage filter accepts the following options:
  5217. @table @option
  5218. @item list_filters
  5219. List all available filters and generators along with all their respective
  5220. options as well as possible minimum and maximum values along with the default
  5221. values.
  5222. @example
  5223. list_filters=true
  5224. @end example
  5225. @item filter
  5226. Specify all filters by their respective name and options.
  5227. Use @var{list_filters} to determine all valid filter names and options.
  5228. Numerical options are specified by a float value and are automatically clamped
  5229. to their respective value range. Vector and color options have to be specified
  5230. by a list of space separated float values. Character escaping has to be done.
  5231. A special option name @code{default} is available to use default options for a
  5232. filter.
  5233. It is required to specify either @code{default} or at least one of the filter options.
  5234. All omitted options are used with their default values.
  5235. The syntax of the filter string is as follows:
  5236. @example
  5237. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5238. @end example
  5239. @item output_rect
  5240. Specify a rectangle where the output of the filter chain is copied into the
  5241. input image. It is given by a list of space separated float values:
  5242. @example
  5243. output_rect=x\ y\ width\ height
  5244. @end example
  5245. If not given, the output rectangle equals the dimensions of the input image.
  5246. The output rectangle is automatically cropped at the borders of the input
  5247. image. Negative values are valid for each component.
  5248. @example
  5249. output_rect=25\ 25\ 100\ 100
  5250. @end example
  5251. @end table
  5252. Several filters can be chained for successive processing without GPU-HOST
  5253. transfers allowing for fast processing of complex filter chains.
  5254. Currently, only filters with zero (generators) or exactly one (filters) input
  5255. image and one output image are supported. Also, transition filters are not yet
  5256. usable as intended.
  5257. Some filters generate output images with additional padding depending on the
  5258. respective filter kernel. The padding is automatically removed to ensure the
  5259. filter output has the same size as the input image.
  5260. For image generators, the size of the output image is determined by the
  5261. previous output image of the filter chain or the input image of the whole
  5262. filterchain, respectively. The generators do not use the pixel information of
  5263. this image to generate their output. However, the generated output is
  5264. blended onto this image, resulting in partial or complete coverage of the
  5265. output image.
  5266. The @ref{coreimagesrc} video source can be used for generating input images
  5267. which are directly fed into the filter chain. By using it, providing input
  5268. images by another video source or an input video is not required.
  5269. @subsection Examples
  5270. @itemize
  5271. @item
  5272. List all filters available:
  5273. @example
  5274. coreimage=list_filters=true
  5275. @end example
  5276. @item
  5277. Use the CIBoxBlur filter with default options to blur an image:
  5278. @example
  5279. coreimage=filter=CIBoxBlur@@default
  5280. @end example
  5281. @item
  5282. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5283. its center at 100x100 and a radius of 50 pixels:
  5284. @example
  5285. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5286. @end example
  5287. @item
  5288. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5289. given as complete and escaped command-line for Apple's standard bash shell:
  5290. @example
  5291. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5292. @end example
  5293. @end itemize
  5294. @section crop
  5295. Crop the input video to given dimensions.
  5296. It accepts the following parameters:
  5297. @table @option
  5298. @item w, out_w
  5299. The width of the output video. It defaults to @code{iw}.
  5300. This expression is evaluated only once during the filter
  5301. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5302. @item h, out_h
  5303. The height of the output video. It defaults to @code{ih}.
  5304. This expression is evaluated only once during the filter
  5305. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5306. @item x
  5307. The horizontal position, in the input video, of the left edge of the output
  5308. video. It defaults to @code{(in_w-out_w)/2}.
  5309. This expression is evaluated per-frame.
  5310. @item y
  5311. The vertical position, in the input video, of the top edge of the output video.
  5312. It defaults to @code{(in_h-out_h)/2}.
  5313. This expression is evaluated per-frame.
  5314. @item keep_aspect
  5315. If set to 1 will force the output display aspect ratio
  5316. to be the same of the input, by changing the output sample aspect
  5317. ratio. It defaults to 0.
  5318. @item exact
  5319. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5320. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5321. It defaults to 0.
  5322. @end table
  5323. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5324. expressions containing the following constants:
  5325. @table @option
  5326. @item x
  5327. @item y
  5328. The computed values for @var{x} and @var{y}. They are evaluated for
  5329. each new frame.
  5330. @item in_w
  5331. @item in_h
  5332. The input width and height.
  5333. @item iw
  5334. @item ih
  5335. These are the same as @var{in_w} and @var{in_h}.
  5336. @item out_w
  5337. @item out_h
  5338. The output (cropped) width and height.
  5339. @item ow
  5340. @item oh
  5341. These are the same as @var{out_w} and @var{out_h}.
  5342. @item a
  5343. same as @var{iw} / @var{ih}
  5344. @item sar
  5345. input sample aspect ratio
  5346. @item dar
  5347. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5348. @item hsub
  5349. @item vsub
  5350. horizontal and vertical chroma subsample values. For example for the
  5351. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5352. @item n
  5353. The number of the input frame, starting from 0.
  5354. @item pos
  5355. the position in the file of the input frame, NAN if unknown
  5356. @item t
  5357. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5358. @end table
  5359. The expression for @var{out_w} may depend on the value of @var{out_h},
  5360. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5361. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5362. evaluated after @var{out_w} and @var{out_h}.
  5363. The @var{x} and @var{y} parameters specify the expressions for the
  5364. position of the top-left corner of the output (non-cropped) area. They
  5365. are evaluated for each frame. If the evaluated value is not valid, it
  5366. is approximated to the nearest valid value.
  5367. The expression for @var{x} may depend on @var{y}, and the expression
  5368. for @var{y} may depend on @var{x}.
  5369. @subsection Examples
  5370. @itemize
  5371. @item
  5372. Crop area with size 100x100 at position (12,34).
  5373. @example
  5374. crop=100:100:12:34
  5375. @end example
  5376. Using named options, the example above becomes:
  5377. @example
  5378. crop=w=100:h=100:x=12:y=34
  5379. @end example
  5380. @item
  5381. Crop the central input area with size 100x100:
  5382. @example
  5383. crop=100:100
  5384. @end example
  5385. @item
  5386. Crop the central input area with size 2/3 of the input video:
  5387. @example
  5388. crop=2/3*in_w:2/3*in_h
  5389. @end example
  5390. @item
  5391. Crop the input video central square:
  5392. @example
  5393. crop=out_w=in_h
  5394. crop=in_h
  5395. @end example
  5396. @item
  5397. Delimit the rectangle with the top-left corner placed at position
  5398. 100:100 and the right-bottom corner corresponding to the right-bottom
  5399. corner of the input image.
  5400. @example
  5401. crop=in_w-100:in_h-100:100:100
  5402. @end example
  5403. @item
  5404. Crop 10 pixels from the left and right borders, and 20 pixels from
  5405. the top and bottom borders
  5406. @example
  5407. crop=in_w-2*10:in_h-2*20
  5408. @end example
  5409. @item
  5410. Keep only the bottom right quarter of the input image:
  5411. @example
  5412. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5413. @end example
  5414. @item
  5415. Crop height for getting Greek harmony:
  5416. @example
  5417. crop=in_w:1/PHI*in_w
  5418. @end example
  5419. @item
  5420. Apply trembling effect:
  5421. @example
  5422. 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)
  5423. @end example
  5424. @item
  5425. Apply erratic camera effect depending on timestamp:
  5426. @example
  5427. 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)"
  5428. @end example
  5429. @item
  5430. Set x depending on the value of y:
  5431. @example
  5432. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5433. @end example
  5434. @end itemize
  5435. @subsection Commands
  5436. This filter supports the following commands:
  5437. @table @option
  5438. @item w, out_w
  5439. @item h, out_h
  5440. @item x
  5441. @item y
  5442. Set width/height of the output video and the horizontal/vertical position
  5443. in the input video.
  5444. The command accepts the same syntax of the corresponding option.
  5445. If the specified expression is not valid, it is kept at its current
  5446. value.
  5447. @end table
  5448. @section cropdetect
  5449. Auto-detect the crop size.
  5450. It calculates the necessary cropping parameters and prints the
  5451. recommended parameters via the logging system. The detected dimensions
  5452. correspond to the non-black area of the input video.
  5453. It accepts the following parameters:
  5454. @table @option
  5455. @item limit
  5456. Set higher black value threshold, which can be optionally specified
  5457. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5458. value greater to the set value is considered non-black. It defaults to 24.
  5459. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5460. on the bitdepth of the pixel format.
  5461. @item round
  5462. The value which the width/height should be divisible by. It defaults to
  5463. 16. The offset is automatically adjusted to center the video. Use 2 to
  5464. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5465. encoding to most video codecs.
  5466. @item reset_count, reset
  5467. Set the counter that determines after how many frames cropdetect will
  5468. reset the previously detected largest video area and start over to
  5469. detect the current optimal crop area. Default value is 0.
  5470. This can be useful when channel logos distort the video area. 0
  5471. indicates 'never reset', and returns the largest area encountered during
  5472. playback.
  5473. @end table
  5474. @anchor{cue}
  5475. @section cue
  5476. Delay video filtering until a given wallclock timestamp. The filter first
  5477. passes on @option{preroll} amount of frames, then it buffers at most
  5478. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5479. it forwards the buffered frames and also any subsequent frames coming in its
  5480. input.
  5481. The filter can be used synchronize the output of multiple ffmpeg processes for
  5482. realtime output devices like decklink. By putting the delay in the filtering
  5483. chain and pre-buffering frames the process can pass on data to output almost
  5484. immediately after the target wallclock timestamp is reached.
  5485. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5486. some use cases.
  5487. @table @option
  5488. @item cue
  5489. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5490. @item preroll
  5491. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5492. @item buffer
  5493. The maximum duration of content to buffer before waiting for the cue expressed
  5494. in seconds. Default is 0.
  5495. @end table
  5496. @anchor{curves}
  5497. @section curves
  5498. Apply color adjustments using curves.
  5499. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5500. component (red, green and blue) has its values defined by @var{N} key points
  5501. tied from each other using a smooth curve. The x-axis represents the pixel
  5502. values from the input frame, and the y-axis the new pixel values to be set for
  5503. the output frame.
  5504. By default, a component curve is defined by the two points @var{(0;0)} and
  5505. @var{(1;1)}. This creates a straight line where each original pixel value is
  5506. "adjusted" to its own value, which means no change to the image.
  5507. The filter allows you to redefine these two points and add some more. A new
  5508. curve (using a natural cubic spline interpolation) will be define to pass
  5509. smoothly through all these new coordinates. The new defined points needs to be
  5510. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5511. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5512. the vector spaces, the values will be clipped accordingly.
  5513. The filter accepts the following options:
  5514. @table @option
  5515. @item preset
  5516. Select one of the available color presets. This option can be used in addition
  5517. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5518. options takes priority on the preset values.
  5519. Available presets are:
  5520. @table @samp
  5521. @item none
  5522. @item color_negative
  5523. @item cross_process
  5524. @item darker
  5525. @item increase_contrast
  5526. @item lighter
  5527. @item linear_contrast
  5528. @item medium_contrast
  5529. @item negative
  5530. @item strong_contrast
  5531. @item vintage
  5532. @end table
  5533. Default is @code{none}.
  5534. @item master, m
  5535. Set the master key points. These points will define a second pass mapping. It
  5536. is sometimes called a "luminance" or "value" mapping. It can be used with
  5537. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5538. post-processing LUT.
  5539. @item red, r
  5540. Set the key points for the red component.
  5541. @item green, g
  5542. Set the key points for the green component.
  5543. @item blue, b
  5544. Set the key points for the blue component.
  5545. @item all
  5546. Set the key points for all components (not including master).
  5547. Can be used in addition to the other key points component
  5548. options. In this case, the unset component(s) will fallback on this
  5549. @option{all} setting.
  5550. @item psfile
  5551. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5552. @item plot
  5553. Save Gnuplot script of the curves in specified file.
  5554. @end table
  5555. To avoid some filtergraph syntax conflicts, each key points list need to be
  5556. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5557. @subsection Examples
  5558. @itemize
  5559. @item
  5560. Increase slightly the middle level of blue:
  5561. @example
  5562. curves=blue='0/0 0.5/0.58 1/1'
  5563. @end example
  5564. @item
  5565. Vintage effect:
  5566. @example
  5567. 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'
  5568. @end example
  5569. Here we obtain the following coordinates for each components:
  5570. @table @var
  5571. @item red
  5572. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5573. @item green
  5574. @code{(0;0) (0.50;0.48) (1;1)}
  5575. @item blue
  5576. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5577. @end table
  5578. @item
  5579. The previous example can also be achieved with the associated built-in preset:
  5580. @example
  5581. curves=preset=vintage
  5582. @end example
  5583. @item
  5584. Or simply:
  5585. @example
  5586. curves=vintage
  5587. @end example
  5588. @item
  5589. Use a Photoshop preset and redefine the points of the green component:
  5590. @example
  5591. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5592. @end example
  5593. @item
  5594. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5595. and @command{gnuplot}:
  5596. @example
  5597. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5598. gnuplot -p /tmp/curves.plt
  5599. @end example
  5600. @end itemize
  5601. @section datascope
  5602. Video data analysis filter.
  5603. This filter shows hexadecimal pixel values of part of video.
  5604. The filter accepts the following options:
  5605. @table @option
  5606. @item size, s
  5607. Set output video size.
  5608. @item x
  5609. Set x offset from where to pick pixels.
  5610. @item y
  5611. Set y offset from where to pick pixels.
  5612. @item mode
  5613. Set scope mode, can be one of the following:
  5614. @table @samp
  5615. @item mono
  5616. Draw hexadecimal pixel values with white color on black background.
  5617. @item color
  5618. Draw hexadecimal pixel values with input video pixel color on black
  5619. background.
  5620. @item color2
  5621. Draw hexadecimal pixel values on color background picked from input video,
  5622. the text color is picked in such way so its always visible.
  5623. @end table
  5624. @item axis
  5625. Draw rows and columns numbers on left and top of video.
  5626. @item opacity
  5627. Set background opacity.
  5628. @end table
  5629. @section dctdnoiz
  5630. Denoise frames using 2D DCT (frequency domain filtering).
  5631. This filter is not designed for real time.
  5632. The filter accepts the following options:
  5633. @table @option
  5634. @item sigma, s
  5635. Set the noise sigma constant.
  5636. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5637. coefficient (absolute value) below this threshold with be dropped.
  5638. If you need a more advanced filtering, see @option{expr}.
  5639. Default is @code{0}.
  5640. @item overlap
  5641. Set number overlapping pixels for each block. Since the filter can be slow, you
  5642. may want to reduce this value, at the cost of a less effective filter and the
  5643. risk of various artefacts.
  5644. If the overlapping value doesn't permit processing the whole input width or
  5645. height, a warning will be displayed and according borders won't be denoised.
  5646. Default value is @var{blocksize}-1, which is the best possible setting.
  5647. @item expr, e
  5648. Set the coefficient factor expression.
  5649. For each coefficient of a DCT block, this expression will be evaluated as a
  5650. multiplier value for the coefficient.
  5651. If this is option is set, the @option{sigma} option will be ignored.
  5652. The absolute value of the coefficient can be accessed through the @var{c}
  5653. variable.
  5654. @item n
  5655. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5656. @var{blocksize}, which is the width and height of the processed blocks.
  5657. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5658. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5659. on the speed processing. Also, a larger block size does not necessarily means a
  5660. better de-noising.
  5661. @end table
  5662. @subsection Examples
  5663. Apply a denoise with a @option{sigma} of @code{4.5}:
  5664. @example
  5665. dctdnoiz=4.5
  5666. @end example
  5667. The same operation can be achieved using the expression system:
  5668. @example
  5669. dctdnoiz=e='gte(c, 4.5*3)'
  5670. @end example
  5671. Violent denoise using a block size of @code{16x16}:
  5672. @example
  5673. dctdnoiz=15:n=4
  5674. @end example
  5675. @section deband
  5676. Remove banding artifacts from input video.
  5677. It works by replacing banded pixels with average value of referenced pixels.
  5678. The filter accepts the following options:
  5679. @table @option
  5680. @item 1thr
  5681. @item 2thr
  5682. @item 3thr
  5683. @item 4thr
  5684. Set banding detection threshold for each plane. Default is 0.02.
  5685. Valid range is 0.00003 to 0.5.
  5686. If difference between current pixel and reference pixel is less than threshold,
  5687. it will be considered as banded.
  5688. @item range, r
  5689. Banding detection range in pixels. Default is 16. If positive, random number
  5690. in range 0 to set value will be used. If negative, exact absolute value
  5691. will be used.
  5692. The range defines square of four pixels around current pixel.
  5693. @item direction, d
  5694. Set direction in radians from which four pixel will be compared. If positive,
  5695. random direction from 0 to set direction will be picked. If negative, exact of
  5696. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5697. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5698. column.
  5699. @item blur, b
  5700. If enabled, current pixel is compared with average value of all four
  5701. surrounding pixels. The default is enabled. If disabled current pixel is
  5702. compared with all four surrounding pixels. The pixel is considered banded
  5703. if only all four differences with surrounding pixels are less than threshold.
  5704. @item coupling, c
  5705. If enabled, current pixel is changed if and only if all pixel components are banded,
  5706. e.g. banding detection threshold is triggered for all color components.
  5707. The default is disabled.
  5708. @end table
  5709. @section deblock
  5710. Remove blocking artifacts from input video.
  5711. The filter accepts the following options:
  5712. @table @option
  5713. @item filter
  5714. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5715. This controls what kind of deblocking is applied.
  5716. @item block
  5717. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5718. @item alpha
  5719. @item beta
  5720. @item gamma
  5721. @item delta
  5722. Set blocking detection thresholds. Allowed range is 0 to 1.
  5723. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5724. Using higher threshold gives more deblocking strength.
  5725. Setting @var{alpha} controls threshold detection at exact edge of block.
  5726. Remaining options controls threshold detection near the edge. Each one for
  5727. below/above or left/right. Setting any of those to @var{0} disables
  5728. deblocking.
  5729. @item planes
  5730. Set planes to filter. Default is to filter all available planes.
  5731. @end table
  5732. @subsection Examples
  5733. @itemize
  5734. @item
  5735. Deblock using weak filter and block size of 4 pixels.
  5736. @example
  5737. deblock=filter=weak:block=4
  5738. @end example
  5739. @item
  5740. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5741. deblocking more edges.
  5742. @example
  5743. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5744. @end example
  5745. @item
  5746. Similar as above, but filter only first plane.
  5747. @example
  5748. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5749. @end example
  5750. @item
  5751. Similar as above, but filter only second and third plane.
  5752. @example
  5753. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5754. @end example
  5755. @end itemize
  5756. @anchor{decimate}
  5757. @section decimate
  5758. Drop duplicated frames at regular intervals.
  5759. The filter accepts the following options:
  5760. @table @option
  5761. @item cycle
  5762. Set the number of frames from which one will be dropped. Setting this to
  5763. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5764. Default is @code{5}.
  5765. @item dupthresh
  5766. Set the threshold for duplicate detection. If the difference metric for a frame
  5767. is less than or equal to this value, then it is declared as duplicate. Default
  5768. is @code{1.1}
  5769. @item scthresh
  5770. Set scene change threshold. Default is @code{15}.
  5771. @item blockx
  5772. @item blocky
  5773. Set the size of the x and y-axis blocks used during metric calculations.
  5774. Larger blocks give better noise suppression, but also give worse detection of
  5775. small movements. Must be a power of two. Default is @code{32}.
  5776. @item ppsrc
  5777. Mark main input as a pre-processed input and activate clean source input
  5778. stream. This allows the input to be pre-processed with various filters to help
  5779. the metrics calculation while keeping the frame selection lossless. When set to
  5780. @code{1}, the first stream is for the pre-processed input, and the second
  5781. stream is the clean source from where the kept frames are chosen. Default is
  5782. @code{0}.
  5783. @item chroma
  5784. Set whether or not chroma is considered in the metric calculations. Default is
  5785. @code{1}.
  5786. @end table
  5787. @section deconvolve
  5788. Apply 2D deconvolution of video stream in frequency domain using second stream
  5789. as impulse.
  5790. The filter accepts the following options:
  5791. @table @option
  5792. @item planes
  5793. Set which planes to process.
  5794. @item impulse
  5795. Set which impulse video frames will be processed, can be @var{first}
  5796. or @var{all}. Default is @var{all}.
  5797. @item noise
  5798. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5799. and height are not same and not power of 2 or if stream prior to convolving
  5800. had noise.
  5801. @end table
  5802. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5803. @section deflate
  5804. Apply deflate effect to the video.
  5805. This filter replaces the pixel by the local(3x3) average by taking into account
  5806. only values lower than the pixel.
  5807. It accepts the following options:
  5808. @table @option
  5809. @item threshold0
  5810. @item threshold1
  5811. @item threshold2
  5812. @item threshold3
  5813. Limit the maximum change for each plane, default is 65535.
  5814. If 0, plane will remain unchanged.
  5815. @end table
  5816. @section deflicker
  5817. Remove temporal frame luminance variations.
  5818. It accepts the following options:
  5819. @table @option
  5820. @item size, s
  5821. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5822. @item mode, m
  5823. Set averaging mode to smooth temporal luminance variations.
  5824. Available values are:
  5825. @table @samp
  5826. @item am
  5827. Arithmetic mean
  5828. @item gm
  5829. Geometric mean
  5830. @item hm
  5831. Harmonic mean
  5832. @item qm
  5833. Quadratic mean
  5834. @item cm
  5835. Cubic mean
  5836. @item pm
  5837. Power mean
  5838. @item median
  5839. Median
  5840. @end table
  5841. @item bypass
  5842. Do not actually modify frame. Useful when one only wants metadata.
  5843. @end table
  5844. @section dejudder
  5845. Remove judder produced by partially interlaced telecined content.
  5846. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5847. source was partially telecined content then the output of @code{pullup,dejudder}
  5848. will have a variable frame rate. May change the recorded frame rate of the
  5849. container. Aside from that change, this filter will not affect constant frame
  5850. rate video.
  5851. The option available in this filter is:
  5852. @table @option
  5853. @item cycle
  5854. Specify the length of the window over which the judder repeats.
  5855. Accepts any integer greater than 1. Useful values are:
  5856. @table @samp
  5857. @item 4
  5858. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5859. @item 5
  5860. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5861. @item 20
  5862. If a mixture of the two.
  5863. @end table
  5864. The default is @samp{4}.
  5865. @end table
  5866. @section delogo
  5867. Suppress a TV station logo by a simple interpolation of the surrounding
  5868. pixels. Just set a rectangle covering the logo and watch it disappear
  5869. (and sometimes something even uglier appear - your mileage may vary).
  5870. It accepts the following parameters:
  5871. @table @option
  5872. @item x
  5873. @item y
  5874. Specify the top left corner coordinates of the logo. They must be
  5875. specified.
  5876. @item w
  5877. @item h
  5878. Specify the width and height of the logo to clear. They must be
  5879. specified.
  5880. @item band, t
  5881. Specify the thickness of the fuzzy edge of the rectangle (added to
  5882. @var{w} and @var{h}). The default value is 1. This option is
  5883. deprecated, setting higher values should no longer be necessary and
  5884. is not recommended.
  5885. @item show
  5886. When set to 1, a green rectangle is drawn on the screen to simplify
  5887. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5888. The default value is 0.
  5889. The rectangle is drawn on the outermost pixels which will be (partly)
  5890. replaced with interpolated values. The values of the next pixels
  5891. immediately outside this rectangle in each direction will be used to
  5892. compute the interpolated pixel values inside the rectangle.
  5893. @end table
  5894. @subsection Examples
  5895. @itemize
  5896. @item
  5897. Set a rectangle covering the area with top left corner coordinates 0,0
  5898. and size 100x77, and a band of size 10:
  5899. @example
  5900. delogo=x=0:y=0:w=100:h=77:band=10
  5901. @end example
  5902. @end itemize
  5903. @section deshake
  5904. Attempt to fix small changes in horizontal and/or vertical shift. This
  5905. filter helps remove camera shake from hand-holding a camera, bumping a
  5906. tripod, moving on a vehicle, etc.
  5907. The filter accepts the following options:
  5908. @table @option
  5909. @item x
  5910. @item y
  5911. @item w
  5912. @item h
  5913. Specify a rectangular area where to limit the search for motion
  5914. vectors.
  5915. If desired the search for motion vectors can be limited to a
  5916. rectangular area of the frame defined by its top left corner, width
  5917. and height. These parameters have the same meaning as the drawbox
  5918. filter which can be used to visualise the position of the bounding
  5919. box.
  5920. This is useful when simultaneous movement of subjects within the frame
  5921. might be confused for camera motion by the motion vector search.
  5922. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5923. then the full frame is used. This allows later options to be set
  5924. without specifying the bounding box for the motion vector search.
  5925. Default - search the whole frame.
  5926. @item rx
  5927. @item ry
  5928. Specify the maximum extent of movement in x and y directions in the
  5929. range 0-64 pixels. Default 16.
  5930. @item edge
  5931. Specify how to generate pixels to fill blanks at the edge of the
  5932. frame. Available values are:
  5933. @table @samp
  5934. @item blank, 0
  5935. Fill zeroes at blank locations
  5936. @item original, 1
  5937. Original image at blank locations
  5938. @item clamp, 2
  5939. Extruded edge value at blank locations
  5940. @item mirror, 3
  5941. Mirrored edge at blank locations
  5942. @end table
  5943. Default value is @samp{mirror}.
  5944. @item blocksize
  5945. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5946. default 8.
  5947. @item contrast
  5948. Specify the contrast threshold for blocks. Only blocks with more than
  5949. the specified contrast (difference between darkest and lightest
  5950. pixels) will be considered. Range 1-255, default 125.
  5951. @item search
  5952. Specify the search strategy. Available values are:
  5953. @table @samp
  5954. @item exhaustive, 0
  5955. Set exhaustive search
  5956. @item less, 1
  5957. Set less exhaustive search.
  5958. @end table
  5959. Default value is @samp{exhaustive}.
  5960. @item filename
  5961. If set then a detailed log of the motion search is written to the
  5962. specified file.
  5963. @end table
  5964. @section despill
  5965. Remove unwanted contamination of foreground colors, caused by reflected color of
  5966. greenscreen or bluescreen.
  5967. This filter accepts the following options:
  5968. @table @option
  5969. @item type
  5970. Set what type of despill to use.
  5971. @item mix
  5972. Set how spillmap will be generated.
  5973. @item expand
  5974. Set how much to get rid of still remaining spill.
  5975. @item red
  5976. Controls amount of red in spill area.
  5977. @item green
  5978. Controls amount of green in spill area.
  5979. Should be -1 for greenscreen.
  5980. @item blue
  5981. Controls amount of blue in spill area.
  5982. Should be -1 for bluescreen.
  5983. @item brightness
  5984. Controls brightness of spill area, preserving colors.
  5985. @item alpha
  5986. Modify alpha from generated spillmap.
  5987. @end table
  5988. @section detelecine
  5989. Apply an exact inverse of the telecine operation. It requires a predefined
  5990. pattern specified using the pattern option which must be the same as that passed
  5991. to the telecine filter.
  5992. This filter accepts the following options:
  5993. @table @option
  5994. @item first_field
  5995. @table @samp
  5996. @item top, t
  5997. top field first
  5998. @item bottom, b
  5999. bottom field first
  6000. The default value is @code{top}.
  6001. @end table
  6002. @item pattern
  6003. A string of numbers representing the pulldown pattern you wish to apply.
  6004. The default value is @code{23}.
  6005. @item start_frame
  6006. A number representing position of the first frame with respect to the telecine
  6007. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6008. @end table
  6009. @section dilation
  6010. Apply dilation effect to the video.
  6011. This filter replaces the pixel by the local(3x3) maximum.
  6012. It accepts the following options:
  6013. @table @option
  6014. @item threshold0
  6015. @item threshold1
  6016. @item threshold2
  6017. @item threshold3
  6018. Limit the maximum change for each plane, default is 65535.
  6019. If 0, plane will remain unchanged.
  6020. @item coordinates
  6021. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6022. pixels are used.
  6023. Flags to local 3x3 coordinates maps like this:
  6024. 1 2 3
  6025. 4 5
  6026. 6 7 8
  6027. @end table
  6028. @section displace
  6029. Displace pixels as indicated by second and third input stream.
  6030. It takes three input streams and outputs one stream, the first input is the
  6031. source, and second and third input are displacement maps.
  6032. The second input specifies how much to displace pixels along the
  6033. x-axis, while the third input specifies how much to displace pixels
  6034. along the y-axis.
  6035. If one of displacement map streams terminates, last frame from that
  6036. displacement map will be used.
  6037. Note that once generated, displacements maps can be reused over and over again.
  6038. A description of the accepted options follows.
  6039. @table @option
  6040. @item edge
  6041. Set displace behavior for pixels that are out of range.
  6042. Available values are:
  6043. @table @samp
  6044. @item blank
  6045. Missing pixels are replaced by black pixels.
  6046. @item smear
  6047. Adjacent pixels will spread out to replace missing pixels.
  6048. @item wrap
  6049. Out of range pixels are wrapped so they point to pixels of other side.
  6050. @item mirror
  6051. Out of range pixels will be replaced with mirrored pixels.
  6052. @end table
  6053. Default is @samp{smear}.
  6054. @end table
  6055. @subsection Examples
  6056. @itemize
  6057. @item
  6058. Add ripple effect to rgb input of video size hd720:
  6059. @example
  6060. 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
  6061. @end example
  6062. @item
  6063. Add wave effect to rgb input of video size hd720:
  6064. @example
  6065. 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
  6066. @end example
  6067. @end itemize
  6068. @section drawbox
  6069. Draw a colored box on the input image.
  6070. It accepts the following parameters:
  6071. @table @option
  6072. @item x
  6073. @item y
  6074. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6075. @item width, w
  6076. @item height, h
  6077. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6078. the input width and height. It defaults to 0.
  6079. @item color, c
  6080. Specify the color of the box to write. For the general syntax of this option,
  6081. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6082. value @code{invert} is used, the box edge color is the same as the
  6083. video with inverted luma.
  6084. @item thickness, t
  6085. The expression which sets the thickness of the box edge.
  6086. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6087. See below for the list of accepted constants.
  6088. @item replace
  6089. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6090. will overwrite the video's color and alpha pixels.
  6091. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6092. @end table
  6093. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6094. following constants:
  6095. @table @option
  6096. @item dar
  6097. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6098. @item hsub
  6099. @item vsub
  6100. horizontal and vertical chroma subsample values. For example for the
  6101. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6102. @item in_h, ih
  6103. @item in_w, iw
  6104. The input width and height.
  6105. @item sar
  6106. The input sample aspect ratio.
  6107. @item x
  6108. @item y
  6109. The x and y offset coordinates where the box is drawn.
  6110. @item w
  6111. @item h
  6112. The width and height of the drawn box.
  6113. @item t
  6114. The thickness of the drawn box.
  6115. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6116. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6117. @end table
  6118. @subsection Examples
  6119. @itemize
  6120. @item
  6121. Draw a black box around the edge of the input image:
  6122. @example
  6123. drawbox
  6124. @end example
  6125. @item
  6126. Draw a box with color red and an opacity of 50%:
  6127. @example
  6128. drawbox=10:20:200:60:red@@0.5
  6129. @end example
  6130. The previous example can be specified as:
  6131. @example
  6132. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6133. @end example
  6134. @item
  6135. Fill the box with pink color:
  6136. @example
  6137. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6138. @end example
  6139. @item
  6140. Draw a 2-pixel red 2.40:1 mask:
  6141. @example
  6142. 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
  6143. @end example
  6144. @end itemize
  6145. @section drawgrid
  6146. Draw a grid on the input image.
  6147. It accepts the following parameters:
  6148. @table @option
  6149. @item x
  6150. @item y
  6151. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6152. @item width, w
  6153. @item height, h
  6154. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6155. input width and height, respectively, minus @code{thickness}, so image gets
  6156. framed. Default to 0.
  6157. @item color, c
  6158. Specify the color of the grid. For the general syntax of this option,
  6159. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6160. value @code{invert} is used, the grid color is the same as the
  6161. video with inverted luma.
  6162. @item thickness, t
  6163. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6164. See below for the list of accepted constants.
  6165. @item replace
  6166. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6167. will overwrite the video's color and alpha pixels.
  6168. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6169. @end table
  6170. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6171. following constants:
  6172. @table @option
  6173. @item dar
  6174. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6175. @item hsub
  6176. @item vsub
  6177. horizontal and vertical chroma subsample values. For example for the
  6178. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6179. @item in_h, ih
  6180. @item in_w, iw
  6181. The input grid cell width and height.
  6182. @item sar
  6183. The input sample aspect ratio.
  6184. @item x
  6185. @item y
  6186. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6187. @item w
  6188. @item h
  6189. The width and height of the drawn cell.
  6190. @item t
  6191. The thickness of the drawn cell.
  6192. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6193. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6194. @end table
  6195. @subsection Examples
  6196. @itemize
  6197. @item
  6198. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6199. @example
  6200. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6201. @end example
  6202. @item
  6203. Draw a white 3x3 grid with an opacity of 50%:
  6204. @example
  6205. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6206. @end example
  6207. @end itemize
  6208. @anchor{drawtext}
  6209. @section drawtext
  6210. Draw a text string or text from a specified file on top of a video, using the
  6211. libfreetype library.
  6212. To enable compilation of this filter, you need to configure FFmpeg with
  6213. @code{--enable-libfreetype}.
  6214. To enable default font fallback and the @var{font} option you need to
  6215. configure FFmpeg with @code{--enable-libfontconfig}.
  6216. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6217. @code{--enable-libfribidi}.
  6218. @subsection Syntax
  6219. It accepts the following parameters:
  6220. @table @option
  6221. @item box
  6222. Used to draw a box around text using the background color.
  6223. The value must be either 1 (enable) or 0 (disable).
  6224. The default value of @var{box} is 0.
  6225. @item boxborderw
  6226. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6227. The default value of @var{boxborderw} is 0.
  6228. @item boxcolor
  6229. The color to be used for drawing box around text. For the syntax of this
  6230. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6231. The default value of @var{boxcolor} is "white".
  6232. @item line_spacing
  6233. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6234. The default value of @var{line_spacing} is 0.
  6235. @item borderw
  6236. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6237. The default value of @var{borderw} is 0.
  6238. @item bordercolor
  6239. Set the color to be used for drawing border around text. For the syntax of this
  6240. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6241. The default value of @var{bordercolor} is "black".
  6242. @item expansion
  6243. Select how the @var{text} is expanded. Can be either @code{none},
  6244. @code{strftime} (deprecated) or
  6245. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6246. below for details.
  6247. @item basetime
  6248. Set a start time for the count. Value is in microseconds. Only applied
  6249. in the deprecated strftime expansion mode. To emulate in normal expansion
  6250. mode use the @code{pts} function, supplying the start time (in seconds)
  6251. as the second argument.
  6252. @item fix_bounds
  6253. If true, check and fix text coords to avoid clipping.
  6254. @item fontcolor
  6255. The color to be used for drawing fonts. For the syntax of this option, check
  6256. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6257. The default value of @var{fontcolor} is "black".
  6258. @item fontcolor_expr
  6259. String which is expanded the same way as @var{text} to obtain dynamic
  6260. @var{fontcolor} value. By default this option has empty value and is not
  6261. processed. When this option is set, it overrides @var{fontcolor} option.
  6262. @item font
  6263. The font family to be used for drawing text. By default Sans.
  6264. @item fontfile
  6265. The font file to be used for drawing text. The path must be included.
  6266. This parameter is mandatory if the fontconfig support is disabled.
  6267. @item alpha
  6268. Draw the text applying alpha blending. The value can
  6269. be a number between 0.0 and 1.0.
  6270. The expression accepts the same variables @var{x, y} as well.
  6271. The default value is 1.
  6272. Please see @var{fontcolor_expr}.
  6273. @item fontsize
  6274. The font size to be used for drawing text.
  6275. The default value of @var{fontsize} is 16.
  6276. @item text_shaping
  6277. If set to 1, attempt to shape the text (for example, reverse the order of
  6278. right-to-left text and join Arabic characters) before drawing it.
  6279. Otherwise, just draw the text exactly as given.
  6280. By default 1 (if supported).
  6281. @item ft_load_flags
  6282. The flags to be used for loading the fonts.
  6283. The flags map the corresponding flags supported by libfreetype, and are
  6284. a combination of the following values:
  6285. @table @var
  6286. @item default
  6287. @item no_scale
  6288. @item no_hinting
  6289. @item render
  6290. @item no_bitmap
  6291. @item vertical_layout
  6292. @item force_autohint
  6293. @item crop_bitmap
  6294. @item pedantic
  6295. @item ignore_global_advance_width
  6296. @item no_recurse
  6297. @item ignore_transform
  6298. @item monochrome
  6299. @item linear_design
  6300. @item no_autohint
  6301. @end table
  6302. Default value is "default".
  6303. For more information consult the documentation for the FT_LOAD_*
  6304. libfreetype flags.
  6305. @item shadowcolor
  6306. The color to be used for drawing a shadow behind the drawn text. For the
  6307. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6308. ffmpeg-utils manual,ffmpeg-utils}.
  6309. The default value of @var{shadowcolor} is "black".
  6310. @item shadowx
  6311. @item shadowy
  6312. The x and y offsets for the text shadow position with respect to the
  6313. position of the text. They can be either positive or negative
  6314. values. The default value for both is "0".
  6315. @item start_number
  6316. The starting frame number for the n/frame_num variable. The default value
  6317. is "0".
  6318. @item tabsize
  6319. The size in number of spaces to use for rendering the tab.
  6320. Default value is 4.
  6321. @item timecode
  6322. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6323. format. It can be used with or without text parameter. @var{timecode_rate}
  6324. option must be specified.
  6325. @item timecode_rate, rate, r
  6326. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6327. integer. Minimum value is "1".
  6328. Drop-frame timecode is supported for frame rates 30 & 60.
  6329. @item tc24hmax
  6330. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6331. Default is 0 (disabled).
  6332. @item text
  6333. The text string to be drawn. The text must be a sequence of UTF-8
  6334. encoded characters.
  6335. This parameter is mandatory if no file is specified with the parameter
  6336. @var{textfile}.
  6337. @item textfile
  6338. A text file containing text to be drawn. The text must be a sequence
  6339. of UTF-8 encoded characters.
  6340. This parameter is mandatory if no text string is specified with the
  6341. parameter @var{text}.
  6342. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6343. @item reload
  6344. If set to 1, the @var{textfile} will be reloaded before each frame.
  6345. Be sure to update it atomically, or it may be read partially, or even fail.
  6346. @item x
  6347. @item y
  6348. The expressions which specify the offsets where text will be drawn
  6349. within the video frame. They are relative to the top/left border of the
  6350. output image.
  6351. The default value of @var{x} and @var{y} is "0".
  6352. See below for the list of accepted constants and functions.
  6353. @end table
  6354. The parameters for @var{x} and @var{y} are expressions containing the
  6355. following constants and functions:
  6356. @table @option
  6357. @item dar
  6358. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6359. @item hsub
  6360. @item vsub
  6361. horizontal and vertical chroma subsample values. For example for the
  6362. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6363. @item line_h, lh
  6364. the height of each text line
  6365. @item main_h, h, H
  6366. the input height
  6367. @item main_w, w, W
  6368. the input width
  6369. @item max_glyph_a, ascent
  6370. the maximum distance from the baseline to the highest/upper grid
  6371. coordinate used to place a glyph outline point, for all the rendered
  6372. glyphs.
  6373. It is a positive value, due to the grid's orientation with the Y axis
  6374. upwards.
  6375. @item max_glyph_d, descent
  6376. the maximum distance from the baseline to the lowest grid coordinate
  6377. used to place a glyph outline point, for all the rendered glyphs.
  6378. This is a negative value, due to the grid's orientation, with the Y axis
  6379. upwards.
  6380. @item max_glyph_h
  6381. maximum glyph height, that is the maximum height for all the glyphs
  6382. contained in the rendered text, it is equivalent to @var{ascent} -
  6383. @var{descent}.
  6384. @item max_glyph_w
  6385. maximum glyph width, that is the maximum width for all the glyphs
  6386. contained in the rendered text
  6387. @item n
  6388. the number of input frame, starting from 0
  6389. @item rand(min, max)
  6390. return a random number included between @var{min} and @var{max}
  6391. @item sar
  6392. The input sample aspect ratio.
  6393. @item t
  6394. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6395. @item text_h, th
  6396. the height of the rendered text
  6397. @item text_w, tw
  6398. the width of the rendered text
  6399. @item x
  6400. @item y
  6401. the x and y offset coordinates where the text is drawn.
  6402. These parameters allow the @var{x} and @var{y} expressions to refer
  6403. each other, so you can for example specify @code{y=x/dar}.
  6404. @end table
  6405. @anchor{drawtext_expansion}
  6406. @subsection Text expansion
  6407. If @option{expansion} is set to @code{strftime},
  6408. the filter recognizes strftime() sequences in the provided text and
  6409. expands them accordingly. Check the documentation of strftime(). This
  6410. feature is deprecated.
  6411. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6412. If @option{expansion} is set to @code{normal} (which is the default),
  6413. the following expansion mechanism is used.
  6414. The backslash character @samp{\}, followed by any character, always expands to
  6415. the second character.
  6416. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6417. braces is a function name, possibly followed by arguments separated by ':'.
  6418. If the arguments contain special characters or delimiters (':' or '@}'),
  6419. they should be escaped.
  6420. Note that they probably must also be escaped as the value for the
  6421. @option{text} option in the filter argument string and as the filter
  6422. argument in the filtergraph description, and possibly also for the shell,
  6423. that makes up to four levels of escaping; using a text file avoids these
  6424. problems.
  6425. The following functions are available:
  6426. @table @command
  6427. @item expr, e
  6428. The expression evaluation result.
  6429. It must take one argument specifying the expression to be evaluated,
  6430. which accepts the same constants and functions as the @var{x} and
  6431. @var{y} values. Note that not all constants should be used, for
  6432. example the text size is not known when evaluating the expression, so
  6433. the constants @var{text_w} and @var{text_h} will have an undefined
  6434. value.
  6435. @item expr_int_format, eif
  6436. Evaluate the expression's value and output as formatted integer.
  6437. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6438. The second argument specifies the output format. Allowed values are @samp{x},
  6439. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6440. @code{printf} function.
  6441. The third parameter is optional and sets the number of positions taken by the output.
  6442. It can be used to add padding with zeros from the left.
  6443. @item gmtime
  6444. The time at which the filter is running, expressed in UTC.
  6445. It can accept an argument: a strftime() format string.
  6446. @item localtime
  6447. The time at which the filter is running, expressed in the local time zone.
  6448. It can accept an argument: a strftime() format string.
  6449. @item metadata
  6450. Frame metadata. Takes one or two arguments.
  6451. The first argument is mandatory and specifies the metadata key.
  6452. The second argument is optional and specifies a default value, used when the
  6453. metadata key is not found or empty.
  6454. @item n, frame_num
  6455. The frame number, starting from 0.
  6456. @item pict_type
  6457. A 1 character description of the current picture type.
  6458. @item pts
  6459. The timestamp of the current frame.
  6460. It can take up to three arguments.
  6461. The first argument is the format of the timestamp; it defaults to @code{flt}
  6462. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6463. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6464. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6465. @code{localtime} stands for the timestamp of the frame formatted as
  6466. local time zone time.
  6467. The second argument is an offset added to the timestamp.
  6468. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6469. supplied to present the hour part of the formatted timestamp in 24h format
  6470. (00-23).
  6471. If the format is set to @code{localtime} or @code{gmtime},
  6472. a third argument may be supplied: a strftime() format string.
  6473. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6474. @end table
  6475. @subsection Examples
  6476. @itemize
  6477. @item
  6478. Draw "Test Text" with font FreeSerif, using the default values for the
  6479. optional parameters.
  6480. @example
  6481. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6482. @end example
  6483. @item
  6484. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6485. and y=50 (counting from the top-left corner of the screen), text is
  6486. yellow with a red box around it. Both the text and the box have an
  6487. opacity of 20%.
  6488. @example
  6489. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6490. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6491. @end example
  6492. Note that the double quotes are not necessary if spaces are not used
  6493. within the parameter list.
  6494. @item
  6495. Show the text at the center of the video frame:
  6496. @example
  6497. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6498. @end example
  6499. @item
  6500. Show the text at a random position, switching to a new position every 30 seconds:
  6501. @example
  6502. 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)"
  6503. @end example
  6504. @item
  6505. Show a text line sliding from right to left in the last row of the video
  6506. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6507. with no newlines.
  6508. @example
  6509. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6510. @end example
  6511. @item
  6512. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6513. @example
  6514. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6515. @end example
  6516. @item
  6517. Draw a single green letter "g", at the center of the input video.
  6518. The glyph baseline is placed at half screen height.
  6519. @example
  6520. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6521. @end example
  6522. @item
  6523. Show text for 1 second every 3 seconds:
  6524. @example
  6525. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6526. @end example
  6527. @item
  6528. Use fontconfig to set the font. Note that the colons need to be escaped.
  6529. @example
  6530. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6531. @end example
  6532. @item
  6533. Print the date of a real-time encoding (see strftime(3)):
  6534. @example
  6535. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6536. @end example
  6537. @item
  6538. Show text fading in and out (appearing/disappearing):
  6539. @example
  6540. #!/bin/sh
  6541. DS=1.0 # display start
  6542. DE=10.0 # display end
  6543. FID=1.5 # fade in duration
  6544. FOD=5 # fade out duration
  6545. 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 @}"
  6546. @end example
  6547. @item
  6548. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6549. and the @option{fontsize} value are included in the @option{y} offset.
  6550. @example
  6551. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6552. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6553. @end example
  6554. @end itemize
  6555. For more information about libfreetype, check:
  6556. @url{http://www.freetype.org/}.
  6557. For more information about fontconfig, check:
  6558. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6559. For more information about libfribidi, check:
  6560. @url{http://fribidi.org/}.
  6561. @section edgedetect
  6562. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6563. The filter accepts the following options:
  6564. @table @option
  6565. @item low
  6566. @item high
  6567. Set low and high threshold values used by the Canny thresholding
  6568. algorithm.
  6569. The high threshold selects the "strong" edge pixels, which are then
  6570. connected through 8-connectivity with the "weak" edge pixels selected
  6571. by the low threshold.
  6572. @var{low} and @var{high} threshold values must be chosen in the range
  6573. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6574. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6575. is @code{50/255}.
  6576. @item mode
  6577. Define the drawing mode.
  6578. @table @samp
  6579. @item wires
  6580. Draw white/gray wires on black background.
  6581. @item colormix
  6582. Mix the colors to create a paint/cartoon effect.
  6583. @item canny
  6584. Apply Canny edge detector on all selected planes.
  6585. @end table
  6586. Default value is @var{wires}.
  6587. @item planes
  6588. Select planes for filtering. By default all available planes are filtered.
  6589. @end table
  6590. @subsection Examples
  6591. @itemize
  6592. @item
  6593. Standard edge detection with custom values for the hysteresis thresholding:
  6594. @example
  6595. edgedetect=low=0.1:high=0.4
  6596. @end example
  6597. @item
  6598. Painting effect without thresholding:
  6599. @example
  6600. edgedetect=mode=colormix:high=0
  6601. @end example
  6602. @end itemize
  6603. @section eq
  6604. Set brightness, contrast, saturation and approximate gamma adjustment.
  6605. The filter accepts the following options:
  6606. @table @option
  6607. @item contrast
  6608. Set the contrast expression. The value must be a float value in range
  6609. @code{-2.0} to @code{2.0}. The default value is "1".
  6610. @item brightness
  6611. Set the brightness expression. The value must be a float value in
  6612. range @code{-1.0} to @code{1.0}. The default value is "0".
  6613. @item saturation
  6614. Set the saturation expression. The value must be a float in
  6615. range @code{0.0} to @code{3.0}. The default value is "1".
  6616. @item gamma
  6617. Set the gamma expression. The value must be a float in range
  6618. @code{0.1} to @code{10.0}. The default value is "1".
  6619. @item gamma_r
  6620. Set the gamma expression for red. The value must be a float in
  6621. range @code{0.1} to @code{10.0}. The default value is "1".
  6622. @item gamma_g
  6623. Set the gamma expression for green. The value must be a float in range
  6624. @code{0.1} to @code{10.0}. The default value is "1".
  6625. @item gamma_b
  6626. Set the gamma expression for blue. The value must be a float in range
  6627. @code{0.1} to @code{10.0}. The default value is "1".
  6628. @item gamma_weight
  6629. Set the gamma weight expression. It can be used to reduce the effect
  6630. of a high gamma value on bright image areas, e.g. keep them from
  6631. getting overamplified and just plain white. The value must be a float
  6632. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6633. gamma correction all the way down while @code{1.0} leaves it at its
  6634. full strength. Default is "1".
  6635. @item eval
  6636. Set when the expressions for brightness, contrast, saturation and
  6637. gamma expressions are evaluated.
  6638. It accepts the following values:
  6639. @table @samp
  6640. @item init
  6641. only evaluate expressions once during the filter initialization or
  6642. when a command is processed
  6643. @item frame
  6644. evaluate expressions for each incoming frame
  6645. @end table
  6646. Default value is @samp{init}.
  6647. @end table
  6648. The expressions accept the following parameters:
  6649. @table @option
  6650. @item n
  6651. frame count of the input frame starting from 0
  6652. @item pos
  6653. byte position of the corresponding packet in the input file, NAN if
  6654. unspecified
  6655. @item r
  6656. frame rate of the input video, NAN if the input frame rate is unknown
  6657. @item t
  6658. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6659. @end table
  6660. @subsection Commands
  6661. The filter supports the following commands:
  6662. @table @option
  6663. @item contrast
  6664. Set the contrast expression.
  6665. @item brightness
  6666. Set the brightness expression.
  6667. @item saturation
  6668. Set the saturation expression.
  6669. @item gamma
  6670. Set the gamma expression.
  6671. @item gamma_r
  6672. Set the gamma_r expression.
  6673. @item gamma_g
  6674. Set gamma_g expression.
  6675. @item gamma_b
  6676. Set gamma_b expression.
  6677. @item gamma_weight
  6678. Set gamma_weight expression.
  6679. The command accepts the same syntax of the corresponding option.
  6680. If the specified expression is not valid, it is kept at its current
  6681. value.
  6682. @end table
  6683. @section erosion
  6684. Apply erosion effect to the video.
  6685. This filter replaces the pixel by the local(3x3) minimum.
  6686. It accepts the following options:
  6687. @table @option
  6688. @item threshold0
  6689. @item threshold1
  6690. @item threshold2
  6691. @item threshold3
  6692. Limit the maximum change for each plane, default is 65535.
  6693. If 0, plane will remain unchanged.
  6694. @item coordinates
  6695. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6696. pixels are used.
  6697. Flags to local 3x3 coordinates maps like this:
  6698. 1 2 3
  6699. 4 5
  6700. 6 7 8
  6701. @end table
  6702. @section extractplanes
  6703. Extract color channel components from input video stream into
  6704. separate grayscale video streams.
  6705. The filter accepts the following option:
  6706. @table @option
  6707. @item planes
  6708. Set plane(s) to extract.
  6709. Available values for planes are:
  6710. @table @samp
  6711. @item y
  6712. @item u
  6713. @item v
  6714. @item a
  6715. @item r
  6716. @item g
  6717. @item b
  6718. @end table
  6719. Choosing planes not available in the input will result in an error.
  6720. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6721. with @code{y}, @code{u}, @code{v} planes at same time.
  6722. @end table
  6723. @subsection Examples
  6724. @itemize
  6725. @item
  6726. Extract luma, u and v color channel component from input video frame
  6727. into 3 grayscale outputs:
  6728. @example
  6729. 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
  6730. @end example
  6731. @end itemize
  6732. @section elbg
  6733. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6734. For each input image, the filter will compute the optimal mapping from
  6735. the input to the output given the codebook length, that is the number
  6736. of distinct output colors.
  6737. This filter accepts the following options.
  6738. @table @option
  6739. @item codebook_length, l
  6740. Set codebook length. The value must be a positive integer, and
  6741. represents the number of distinct output colors. Default value is 256.
  6742. @item nb_steps, n
  6743. Set the maximum number of iterations to apply for computing the optimal
  6744. mapping. The higher the value the better the result and the higher the
  6745. computation time. Default value is 1.
  6746. @item seed, s
  6747. Set a random seed, must be an integer included between 0 and
  6748. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6749. will try to use a good random seed on a best effort basis.
  6750. @item pal8
  6751. Set pal8 output pixel format. This option does not work with codebook
  6752. length greater than 256.
  6753. @end table
  6754. @section entropy
  6755. Measure graylevel entropy in histogram of color channels of video frames.
  6756. It accepts the following parameters:
  6757. @table @option
  6758. @item mode
  6759. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6760. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6761. between neighbour histogram values.
  6762. @end table
  6763. @section fade
  6764. Apply a fade-in/out effect to the input video.
  6765. It accepts the following parameters:
  6766. @table @option
  6767. @item type, t
  6768. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6769. effect.
  6770. Default is @code{in}.
  6771. @item start_frame, s
  6772. Specify the number of the frame to start applying the fade
  6773. effect at. Default is 0.
  6774. @item nb_frames, n
  6775. The number of frames that the fade effect lasts. At the end of the
  6776. fade-in effect, the output video will have the same intensity as the input video.
  6777. At the end of the fade-out transition, the output video will be filled with the
  6778. selected @option{color}.
  6779. Default is 25.
  6780. @item alpha
  6781. If set to 1, fade only alpha channel, if one exists on the input.
  6782. Default value is 0.
  6783. @item start_time, st
  6784. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6785. effect. If both start_frame and start_time are specified, the fade will start at
  6786. whichever comes last. Default is 0.
  6787. @item duration, d
  6788. The number of seconds for which the fade effect has to last. At the end of the
  6789. fade-in effect the output video will have the same intensity as the input video,
  6790. at the end of the fade-out transition the output video will be filled with the
  6791. selected @option{color}.
  6792. If both duration and nb_frames are specified, duration is used. Default is 0
  6793. (nb_frames is used by default).
  6794. @item color, c
  6795. Specify the color of the fade. Default is "black".
  6796. @end table
  6797. @subsection Examples
  6798. @itemize
  6799. @item
  6800. Fade in the first 30 frames of video:
  6801. @example
  6802. fade=in:0:30
  6803. @end example
  6804. The command above is equivalent to:
  6805. @example
  6806. fade=t=in:s=0:n=30
  6807. @end example
  6808. @item
  6809. Fade out the last 45 frames of a 200-frame video:
  6810. @example
  6811. fade=out:155:45
  6812. fade=type=out:start_frame=155:nb_frames=45
  6813. @end example
  6814. @item
  6815. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6816. @example
  6817. fade=in:0:25, fade=out:975:25
  6818. @end example
  6819. @item
  6820. Make the first 5 frames yellow, then fade in from frame 5-24:
  6821. @example
  6822. fade=in:5:20:color=yellow
  6823. @end example
  6824. @item
  6825. Fade in alpha over first 25 frames of video:
  6826. @example
  6827. fade=in:0:25:alpha=1
  6828. @end example
  6829. @item
  6830. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6831. @example
  6832. fade=t=in:st=5.5:d=0.5
  6833. @end example
  6834. @end itemize
  6835. @section fftfilt
  6836. Apply arbitrary expressions to samples in frequency domain
  6837. @table @option
  6838. @item dc_Y
  6839. Adjust the dc value (gain) of the luma plane of the image. The filter
  6840. accepts an integer value in range @code{0} to @code{1000}. The default
  6841. value is set to @code{0}.
  6842. @item dc_U
  6843. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6844. filter accepts an integer value in range @code{0} to @code{1000}. The
  6845. default value is set to @code{0}.
  6846. @item dc_V
  6847. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6848. filter accepts an integer value in range @code{0} to @code{1000}. The
  6849. default value is set to @code{0}.
  6850. @item weight_Y
  6851. Set the frequency domain weight expression for the luma plane.
  6852. @item weight_U
  6853. Set the frequency domain weight expression for the 1st chroma plane.
  6854. @item weight_V
  6855. Set the frequency domain weight expression for the 2nd chroma plane.
  6856. @item eval
  6857. Set when the expressions are evaluated.
  6858. It accepts the following values:
  6859. @table @samp
  6860. @item init
  6861. Only evaluate expressions once during the filter initialization.
  6862. @item frame
  6863. Evaluate expressions for each incoming frame.
  6864. @end table
  6865. Default value is @samp{init}.
  6866. The filter accepts the following variables:
  6867. @item X
  6868. @item Y
  6869. The coordinates of the current sample.
  6870. @item W
  6871. @item H
  6872. The width and height of the image.
  6873. @item N
  6874. The number of input frame, starting from 0.
  6875. @end table
  6876. @subsection Examples
  6877. @itemize
  6878. @item
  6879. High-pass:
  6880. @example
  6881. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6882. @end example
  6883. @item
  6884. Low-pass:
  6885. @example
  6886. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6887. @end example
  6888. @item
  6889. Sharpen:
  6890. @example
  6891. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6892. @end example
  6893. @item
  6894. Blur:
  6895. @example
  6896. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6897. @end example
  6898. @end itemize
  6899. @section fftdnoiz
  6900. Denoise frames using 3D FFT (frequency domain filtering).
  6901. The filter accepts the following options:
  6902. @table @option
  6903. @item sigma
  6904. Set the noise sigma constant. This sets denoising strength.
  6905. Default value is 1. Allowed range is from 0 to 30.
  6906. Using very high sigma with low overlap may give blocking artifacts.
  6907. @item amount
  6908. Set amount of denoising. By default all detected noise is reduced.
  6909. Default value is 1. Allowed range is from 0 to 1.
  6910. @item block
  6911. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6912. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6913. block size in pixels is 2^4 which is 16.
  6914. @item overlap
  6915. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6916. @item prev
  6917. Set number of previous frames to use for denoising. By default is set to 0.
  6918. @item next
  6919. Set number of next frames to to use for denoising. By default is set to 0.
  6920. @item planes
  6921. Set planes which will be filtered, by default are all available filtered
  6922. except alpha.
  6923. @end table
  6924. @section field
  6925. Extract a single field from an interlaced image using stride
  6926. arithmetic to avoid wasting CPU time. The output frames are marked as
  6927. non-interlaced.
  6928. The filter accepts the following options:
  6929. @table @option
  6930. @item type
  6931. Specify whether to extract the top (if the value is @code{0} or
  6932. @code{top}) or the bottom field (if the value is @code{1} or
  6933. @code{bottom}).
  6934. @end table
  6935. @section fieldhint
  6936. Create new frames by copying the top and bottom fields from surrounding frames
  6937. supplied as numbers by the hint file.
  6938. @table @option
  6939. @item hint
  6940. Set file containing hints: absolute/relative frame numbers.
  6941. There must be one line for each frame in a clip. Each line must contain two
  6942. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6943. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6944. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6945. for @code{relative} mode. First number tells from which frame to pick up top
  6946. field and second number tells from which frame to pick up bottom field.
  6947. If optionally followed by @code{+} output frame will be marked as interlaced,
  6948. else if followed by @code{-} output frame will be marked as progressive, else
  6949. it will be marked same as input frame.
  6950. If line starts with @code{#} or @code{;} that line is skipped.
  6951. @item mode
  6952. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6953. @end table
  6954. Example of first several lines of @code{hint} file for @code{relative} mode:
  6955. @example
  6956. 0,0 - # first frame
  6957. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6958. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6959. 1,0 -
  6960. 0,0 -
  6961. 0,0 -
  6962. 1,0 -
  6963. 1,0 -
  6964. 1,0 -
  6965. 0,0 -
  6966. 0,0 -
  6967. 1,0 -
  6968. 1,0 -
  6969. 1,0 -
  6970. 0,0 -
  6971. @end example
  6972. @section fieldmatch
  6973. Field matching filter for inverse telecine. It is meant to reconstruct the
  6974. progressive frames from a telecined stream. The filter does not drop duplicated
  6975. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6976. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6977. The separation of the field matching and the decimation is notably motivated by
  6978. the possibility of inserting a de-interlacing filter fallback between the two.
  6979. If the source has mixed telecined and real interlaced content,
  6980. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6981. But these remaining combed frames will be marked as interlaced, and thus can be
  6982. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6983. In addition to the various configuration options, @code{fieldmatch} can take an
  6984. optional second stream, activated through the @option{ppsrc} option. If
  6985. enabled, the frames reconstruction will be based on the fields and frames from
  6986. this second stream. This allows the first input to be pre-processed in order to
  6987. help the various algorithms of the filter, while keeping the output lossless
  6988. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6989. or brightness/contrast adjustments can help.
  6990. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6991. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6992. which @code{fieldmatch} is based on. While the semantic and usage are very
  6993. close, some behaviour and options names can differ.
  6994. The @ref{decimate} filter currently only works for constant frame rate input.
  6995. If your input has mixed telecined (30fps) and progressive content with a lower
  6996. framerate like 24fps use the following filterchain to produce the necessary cfr
  6997. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6998. The filter accepts the following options:
  6999. @table @option
  7000. @item order
  7001. Specify the assumed field order of the input stream. Available values are:
  7002. @table @samp
  7003. @item auto
  7004. Auto detect parity (use FFmpeg's internal parity value).
  7005. @item bff
  7006. Assume bottom field first.
  7007. @item tff
  7008. Assume top field first.
  7009. @end table
  7010. Note that it is sometimes recommended not to trust the parity announced by the
  7011. stream.
  7012. Default value is @var{auto}.
  7013. @item mode
  7014. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7015. sense that it won't risk creating jerkiness due to duplicate frames when
  7016. possible, but if there are bad edits or blended fields it will end up
  7017. outputting combed frames when a good match might actually exist. On the other
  7018. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7019. but will almost always find a good frame if there is one. The other values are
  7020. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7021. jerkiness and creating duplicate frames versus finding good matches in sections
  7022. with bad edits, orphaned fields, blended fields, etc.
  7023. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7024. Available values are:
  7025. @table @samp
  7026. @item pc
  7027. 2-way matching (p/c)
  7028. @item pc_n
  7029. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7030. @item pc_u
  7031. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7032. @item pc_n_ub
  7033. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7034. still combed (p/c + n + u/b)
  7035. @item pcn
  7036. 3-way matching (p/c/n)
  7037. @item pcn_ub
  7038. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7039. detected as combed (p/c/n + u/b)
  7040. @end table
  7041. The parenthesis at the end indicate the matches that would be used for that
  7042. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7043. @var{top}).
  7044. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7045. the slowest.
  7046. Default value is @var{pc_n}.
  7047. @item ppsrc
  7048. Mark the main input stream as a pre-processed input, and enable the secondary
  7049. input stream as the clean source to pick the fields from. See the filter
  7050. introduction for more details. It is similar to the @option{clip2} feature from
  7051. VFM/TFM.
  7052. Default value is @code{0} (disabled).
  7053. @item field
  7054. Set the field to match from. It is recommended to set this to the same value as
  7055. @option{order} unless you experience matching failures with that setting. In
  7056. certain circumstances changing the field that is used to match from can have a
  7057. large impact on matching performance. Available values are:
  7058. @table @samp
  7059. @item auto
  7060. Automatic (same value as @option{order}).
  7061. @item bottom
  7062. Match from the bottom field.
  7063. @item top
  7064. Match from the top field.
  7065. @end table
  7066. Default value is @var{auto}.
  7067. @item mchroma
  7068. Set whether or not chroma is included during the match comparisons. In most
  7069. cases it is recommended to leave this enabled. You should set this to @code{0}
  7070. only if your clip has bad chroma problems such as heavy rainbowing or other
  7071. artifacts. Setting this to @code{0} could also be used to speed things up at
  7072. the cost of some accuracy.
  7073. Default value is @code{1}.
  7074. @item y0
  7075. @item y1
  7076. These define an exclusion band which excludes the lines between @option{y0} and
  7077. @option{y1} from being included in the field matching decision. An exclusion
  7078. band can be used to ignore subtitles, a logo, or other things that may
  7079. interfere with the matching. @option{y0} sets the starting scan line and
  7080. @option{y1} sets the ending line; all lines in between @option{y0} and
  7081. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7082. @option{y0} and @option{y1} to the same value will disable the feature.
  7083. @option{y0} and @option{y1} defaults to @code{0}.
  7084. @item scthresh
  7085. Set the scene change detection threshold as a percentage of maximum change on
  7086. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7087. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7088. @option{scthresh} is @code{[0.0, 100.0]}.
  7089. Default value is @code{12.0}.
  7090. @item combmatch
  7091. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7092. account the combed scores of matches when deciding what match to use as the
  7093. final match. Available values are:
  7094. @table @samp
  7095. @item none
  7096. No final matching based on combed scores.
  7097. @item sc
  7098. Combed scores are only used when a scene change is detected.
  7099. @item full
  7100. Use combed scores all the time.
  7101. @end table
  7102. Default is @var{sc}.
  7103. @item combdbg
  7104. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7105. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7106. Available values are:
  7107. @table @samp
  7108. @item none
  7109. No forced calculation.
  7110. @item pcn
  7111. Force p/c/n calculations.
  7112. @item pcnub
  7113. Force p/c/n/u/b calculations.
  7114. @end table
  7115. Default value is @var{none}.
  7116. @item cthresh
  7117. This is the area combing threshold used for combed frame detection. This
  7118. essentially controls how "strong" or "visible" combing must be to be detected.
  7119. Larger values mean combing must be more visible and smaller values mean combing
  7120. can be less visible or strong and still be detected. Valid settings are from
  7121. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7122. be detected as combed). This is basically a pixel difference value. A good
  7123. range is @code{[8, 12]}.
  7124. Default value is @code{9}.
  7125. @item chroma
  7126. Sets whether or not chroma is considered in the combed frame decision. Only
  7127. disable this if your source has chroma problems (rainbowing, etc.) that are
  7128. causing problems for the combed frame detection with chroma enabled. Actually,
  7129. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7130. where there is chroma only combing in the source.
  7131. Default value is @code{0}.
  7132. @item blockx
  7133. @item blocky
  7134. Respectively set the x-axis and y-axis size of the window used during combed
  7135. frame detection. This has to do with the size of the area in which
  7136. @option{combpel} pixels are required to be detected as combed for a frame to be
  7137. declared combed. See the @option{combpel} parameter description for more info.
  7138. Possible values are any number that is a power of 2 starting at 4 and going up
  7139. to 512.
  7140. Default value is @code{16}.
  7141. @item combpel
  7142. The number of combed pixels inside any of the @option{blocky} by
  7143. @option{blockx} size blocks on the frame for the frame to be detected as
  7144. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7145. setting controls "how much" combing there must be in any localized area (a
  7146. window defined by the @option{blockx} and @option{blocky} settings) on the
  7147. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7148. which point no frames will ever be detected as combed). This setting is known
  7149. as @option{MI} in TFM/VFM vocabulary.
  7150. Default value is @code{80}.
  7151. @end table
  7152. @anchor{p/c/n/u/b meaning}
  7153. @subsection p/c/n/u/b meaning
  7154. @subsubsection p/c/n
  7155. We assume the following telecined stream:
  7156. @example
  7157. Top fields: 1 2 2 3 4
  7158. Bottom fields: 1 2 3 4 4
  7159. @end example
  7160. The numbers correspond to the progressive frame the fields relate to. Here, the
  7161. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7162. When @code{fieldmatch} is configured to run a matching from bottom
  7163. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7164. @example
  7165. Input stream:
  7166. T 1 2 2 3 4
  7167. B 1 2 3 4 4 <-- matching reference
  7168. Matches: c c n n c
  7169. Output stream:
  7170. T 1 2 3 4 4
  7171. B 1 2 3 4 4
  7172. @end example
  7173. As a result of the field matching, we can see that some frames get duplicated.
  7174. To perform a complete inverse telecine, you need to rely on a decimation filter
  7175. after this operation. See for instance the @ref{decimate} filter.
  7176. The same operation now matching from top fields (@option{field}=@var{top})
  7177. looks like this:
  7178. @example
  7179. Input stream:
  7180. T 1 2 2 3 4 <-- matching reference
  7181. B 1 2 3 4 4
  7182. Matches: c c p p c
  7183. Output stream:
  7184. T 1 2 2 3 4
  7185. B 1 2 2 3 4
  7186. @end example
  7187. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7188. basically, they refer to the frame and field of the opposite parity:
  7189. @itemize
  7190. @item @var{p} matches the field of the opposite parity in the previous frame
  7191. @item @var{c} matches the field of the opposite parity in the current frame
  7192. @item @var{n} matches the field of the opposite parity in the next frame
  7193. @end itemize
  7194. @subsubsection u/b
  7195. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7196. from the opposite parity flag. In the following examples, we assume that we are
  7197. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7198. 'x' is placed above and below each matched fields.
  7199. With bottom matching (@option{field}=@var{bottom}):
  7200. @example
  7201. Match: c p n b u
  7202. x x x x x
  7203. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7204. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7205. x x x x x
  7206. Output frames:
  7207. 2 1 2 2 2
  7208. 2 2 2 1 3
  7209. @end example
  7210. With top matching (@option{field}=@var{top}):
  7211. @example
  7212. Match: c p n b u
  7213. x x x x x
  7214. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7215. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7216. x x x x x
  7217. Output frames:
  7218. 2 2 2 1 2
  7219. 2 1 3 2 2
  7220. @end example
  7221. @subsection Examples
  7222. Simple IVTC of a top field first telecined stream:
  7223. @example
  7224. fieldmatch=order=tff:combmatch=none, decimate
  7225. @end example
  7226. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7227. @example
  7228. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7229. @end example
  7230. @section fieldorder
  7231. Transform the field order of the input video.
  7232. It accepts the following parameters:
  7233. @table @option
  7234. @item order
  7235. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7236. for bottom field first.
  7237. @end table
  7238. The default value is @samp{tff}.
  7239. The transformation is done by shifting the picture content up or down
  7240. by one line, and filling the remaining line with appropriate picture content.
  7241. This method is consistent with most broadcast field order converters.
  7242. If the input video is not flagged as being interlaced, or it is already
  7243. flagged as being of the required output field order, then this filter does
  7244. not alter the incoming video.
  7245. It is very useful when converting to or from PAL DV material,
  7246. which is bottom field first.
  7247. For example:
  7248. @example
  7249. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7250. @end example
  7251. @section fifo, afifo
  7252. Buffer input images and send them when they are requested.
  7253. It is mainly useful when auto-inserted by the libavfilter
  7254. framework.
  7255. It does not take parameters.
  7256. @section fillborders
  7257. Fill borders of the input video, without changing video stream dimensions.
  7258. Sometimes video can have garbage at the four edges and you may not want to
  7259. crop video input to keep size multiple of some number.
  7260. This filter accepts the following options:
  7261. @table @option
  7262. @item left
  7263. Number of pixels to fill from left border.
  7264. @item right
  7265. Number of pixels to fill from right border.
  7266. @item top
  7267. Number of pixels to fill from top border.
  7268. @item bottom
  7269. Number of pixels to fill from bottom border.
  7270. @item mode
  7271. Set fill mode.
  7272. It accepts the following values:
  7273. @table @samp
  7274. @item smear
  7275. fill pixels using outermost pixels
  7276. @item mirror
  7277. fill pixels using mirroring
  7278. @item fixed
  7279. fill pixels with constant value
  7280. @end table
  7281. Default is @var{smear}.
  7282. @item color
  7283. Set color for pixels in fixed mode. Default is @var{black}.
  7284. @end table
  7285. @section find_rect
  7286. Find a rectangular object
  7287. It accepts the following options:
  7288. @table @option
  7289. @item object
  7290. Filepath of the object image, needs to be in gray8.
  7291. @item threshold
  7292. Detection threshold, default is 0.5.
  7293. @item mipmaps
  7294. Number of mipmaps, default is 3.
  7295. @item xmin, ymin, xmax, ymax
  7296. Specifies the rectangle in which to search.
  7297. @end table
  7298. @subsection Examples
  7299. @itemize
  7300. @item
  7301. Generate a representative palette of a given video using @command{ffmpeg}:
  7302. @example
  7303. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7304. @end example
  7305. @end itemize
  7306. @section cover_rect
  7307. Cover a rectangular object
  7308. It accepts the following options:
  7309. @table @option
  7310. @item cover
  7311. Filepath of the optional cover image, needs to be in yuv420.
  7312. @item mode
  7313. Set covering mode.
  7314. It accepts the following values:
  7315. @table @samp
  7316. @item cover
  7317. cover it by the supplied image
  7318. @item blur
  7319. cover it by interpolating the surrounding pixels
  7320. @end table
  7321. Default value is @var{blur}.
  7322. @end table
  7323. @subsection Examples
  7324. @itemize
  7325. @item
  7326. Generate a representative palette of a given video using @command{ffmpeg}:
  7327. @example
  7328. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7329. @end example
  7330. @end itemize
  7331. @section floodfill
  7332. Flood area with values of same pixel components with another values.
  7333. It accepts the following options:
  7334. @table @option
  7335. @item x
  7336. Set pixel x coordinate.
  7337. @item y
  7338. Set pixel y coordinate.
  7339. @item s0
  7340. Set source #0 component value.
  7341. @item s1
  7342. Set source #1 component value.
  7343. @item s2
  7344. Set source #2 component value.
  7345. @item s3
  7346. Set source #3 component value.
  7347. @item d0
  7348. Set destination #0 component value.
  7349. @item d1
  7350. Set destination #1 component value.
  7351. @item d2
  7352. Set destination #2 component value.
  7353. @item d3
  7354. Set destination #3 component value.
  7355. @end table
  7356. @anchor{format}
  7357. @section format
  7358. Convert the input video to one of the specified pixel formats.
  7359. Libavfilter will try to pick one that is suitable as input to
  7360. the next filter.
  7361. It accepts the following parameters:
  7362. @table @option
  7363. @item pix_fmts
  7364. A '|'-separated list of pixel format names, such as
  7365. "pix_fmts=yuv420p|monow|rgb24".
  7366. @end table
  7367. @subsection Examples
  7368. @itemize
  7369. @item
  7370. Convert the input video to the @var{yuv420p} format
  7371. @example
  7372. format=pix_fmts=yuv420p
  7373. @end example
  7374. Convert the input video to any of the formats in the list
  7375. @example
  7376. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7377. @end example
  7378. @end itemize
  7379. @anchor{fps}
  7380. @section fps
  7381. Convert the video to specified constant frame rate by duplicating or dropping
  7382. frames as necessary.
  7383. It accepts the following parameters:
  7384. @table @option
  7385. @item fps
  7386. The desired output frame rate. The default is @code{25}.
  7387. @item start_time
  7388. Assume the first PTS should be the given value, in seconds. This allows for
  7389. padding/trimming at the start of stream. By default, no assumption is made
  7390. about the first frame's expected PTS, so no padding or trimming is done.
  7391. For example, this could be set to 0 to pad the beginning with duplicates of
  7392. the first frame if a video stream starts after the audio stream or to trim any
  7393. frames with a negative PTS.
  7394. @item round
  7395. Timestamp (PTS) rounding method.
  7396. Possible values are:
  7397. @table @option
  7398. @item zero
  7399. round towards 0
  7400. @item inf
  7401. round away from 0
  7402. @item down
  7403. round towards -infinity
  7404. @item up
  7405. round towards +infinity
  7406. @item near
  7407. round to nearest
  7408. @end table
  7409. The default is @code{near}.
  7410. @item eof_action
  7411. Action performed when reading the last frame.
  7412. Possible values are:
  7413. @table @option
  7414. @item round
  7415. Use same timestamp rounding method as used for other frames.
  7416. @item pass
  7417. Pass through last frame if input duration has not been reached yet.
  7418. @end table
  7419. The default is @code{round}.
  7420. @end table
  7421. Alternatively, the options can be specified as a flat string:
  7422. @var{fps}[:@var{start_time}[:@var{round}]].
  7423. See also the @ref{setpts} filter.
  7424. @subsection Examples
  7425. @itemize
  7426. @item
  7427. A typical usage in order to set the fps to 25:
  7428. @example
  7429. fps=fps=25
  7430. @end example
  7431. @item
  7432. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7433. @example
  7434. fps=fps=film:round=near
  7435. @end example
  7436. @end itemize
  7437. @section framepack
  7438. Pack two different video streams into a stereoscopic video, setting proper
  7439. metadata on supported codecs. The two views should have the same size and
  7440. framerate and processing will stop when the shorter video ends. Please note
  7441. that you may conveniently adjust view properties with the @ref{scale} and
  7442. @ref{fps} filters.
  7443. It accepts the following parameters:
  7444. @table @option
  7445. @item format
  7446. The desired packing format. Supported values are:
  7447. @table @option
  7448. @item sbs
  7449. The views are next to each other (default).
  7450. @item tab
  7451. The views are on top of each other.
  7452. @item lines
  7453. The views are packed by line.
  7454. @item columns
  7455. The views are packed by column.
  7456. @item frameseq
  7457. The views are temporally interleaved.
  7458. @end table
  7459. @end table
  7460. Some examples:
  7461. @example
  7462. # Convert left and right views into a frame-sequential video
  7463. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7464. # Convert views into a side-by-side video with the same output resolution as the input
  7465. 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
  7466. @end example
  7467. @section framerate
  7468. Change the frame rate by interpolating new video output frames from the source
  7469. frames.
  7470. This filter is not designed to function correctly with interlaced media. If
  7471. you wish to change the frame rate of interlaced media then you are required
  7472. to deinterlace before this filter and re-interlace after this filter.
  7473. A description of the accepted options follows.
  7474. @table @option
  7475. @item fps
  7476. Specify the output frames per second. This option can also be specified
  7477. as a value alone. The default is @code{50}.
  7478. @item interp_start
  7479. Specify the start of a range where the output frame will be created as a
  7480. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7481. the default is @code{15}.
  7482. @item interp_end
  7483. Specify the end of a range where the output frame will be created as a
  7484. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7485. the default is @code{240}.
  7486. @item scene
  7487. Specify the level at which a scene change is detected as a value between
  7488. 0 and 100 to indicate a new scene; a low value reflects a low
  7489. probability for the current frame to introduce a new scene, while a higher
  7490. value means the current frame is more likely to be one.
  7491. The default is @code{8.2}.
  7492. @item flags
  7493. Specify flags influencing the filter process.
  7494. Available value for @var{flags} is:
  7495. @table @option
  7496. @item scene_change_detect, scd
  7497. Enable scene change detection using the value of the option @var{scene}.
  7498. This flag is enabled by default.
  7499. @end table
  7500. @end table
  7501. @section framestep
  7502. Select one frame every N-th frame.
  7503. This filter accepts the following option:
  7504. @table @option
  7505. @item step
  7506. Select frame after every @code{step} frames.
  7507. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7508. @end table
  7509. @anchor{frei0r}
  7510. @section frei0r
  7511. Apply a frei0r effect to the input video.
  7512. To enable the compilation of this filter, you need to install the frei0r
  7513. header and configure FFmpeg with @code{--enable-frei0r}.
  7514. It accepts the following parameters:
  7515. @table @option
  7516. @item filter_name
  7517. The name of the frei0r effect to load. If the environment variable
  7518. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7519. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7520. Otherwise, the standard frei0r paths are searched, in this order:
  7521. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7522. @file{/usr/lib/frei0r-1/}.
  7523. @item filter_params
  7524. A '|'-separated list of parameters to pass to the frei0r effect.
  7525. @end table
  7526. A frei0r effect parameter can be a boolean (its value is either
  7527. "y" or "n"), a double, a color (specified as
  7528. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7529. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7530. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7531. a position (specified as @var{X}/@var{Y}, where
  7532. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7533. The number and types of parameters depend on the loaded effect. If an
  7534. effect parameter is not specified, the default value is set.
  7535. @subsection Examples
  7536. @itemize
  7537. @item
  7538. Apply the distort0r effect, setting the first two double parameters:
  7539. @example
  7540. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7541. @end example
  7542. @item
  7543. Apply the colordistance effect, taking a color as the first parameter:
  7544. @example
  7545. frei0r=colordistance:0.2/0.3/0.4
  7546. frei0r=colordistance:violet
  7547. frei0r=colordistance:0x112233
  7548. @end example
  7549. @item
  7550. Apply the perspective effect, specifying the top left and top right image
  7551. positions:
  7552. @example
  7553. frei0r=perspective:0.2/0.2|0.8/0.2
  7554. @end example
  7555. @end itemize
  7556. For more information, see
  7557. @url{http://frei0r.dyne.org}
  7558. @section fspp
  7559. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7560. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7561. processing filter, one of them is performed once per block, not per pixel.
  7562. This allows for much higher speed.
  7563. The filter accepts the following options:
  7564. @table @option
  7565. @item quality
  7566. Set quality. This option defines the number of levels for averaging. It accepts
  7567. an integer in the range 4-5. Default value is @code{4}.
  7568. @item qp
  7569. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7570. If not set, the filter will use the QP from the video stream (if available).
  7571. @item strength
  7572. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7573. more details but also more artifacts, while higher values make the image smoother
  7574. but also blurrier. Default value is @code{0} − PSNR optimal.
  7575. @item use_bframe_qp
  7576. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7577. option may cause flicker since the B-Frames have often larger QP. Default is
  7578. @code{0} (not enabled).
  7579. @end table
  7580. @section gblur
  7581. Apply Gaussian blur filter.
  7582. The filter accepts the following options:
  7583. @table @option
  7584. @item sigma
  7585. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7586. @item steps
  7587. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7588. @item planes
  7589. Set which planes to filter. By default all planes are filtered.
  7590. @item sigmaV
  7591. Set vertical sigma, if negative it will be same as @code{sigma}.
  7592. Default is @code{-1}.
  7593. @end table
  7594. @section geq
  7595. The filter accepts the following options:
  7596. @table @option
  7597. @item lum_expr, lum
  7598. Set the luminance expression.
  7599. @item cb_expr, cb
  7600. Set the chrominance blue expression.
  7601. @item cr_expr, cr
  7602. Set the chrominance red expression.
  7603. @item alpha_expr, a
  7604. Set the alpha expression.
  7605. @item red_expr, r
  7606. Set the red expression.
  7607. @item green_expr, g
  7608. Set the green expression.
  7609. @item blue_expr, b
  7610. Set the blue expression.
  7611. @end table
  7612. The colorspace is selected according to the specified options. If one
  7613. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7614. options is specified, the filter will automatically select a YCbCr
  7615. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7616. @option{blue_expr} options is specified, it will select an RGB
  7617. colorspace.
  7618. If one of the chrominance expression is not defined, it falls back on the other
  7619. one. If no alpha expression is specified it will evaluate to opaque value.
  7620. If none of chrominance expressions are specified, they will evaluate
  7621. to the luminance expression.
  7622. The expressions can use the following variables and functions:
  7623. @table @option
  7624. @item N
  7625. The sequential number of the filtered frame, starting from @code{0}.
  7626. @item X
  7627. @item Y
  7628. The coordinates of the current sample.
  7629. @item W
  7630. @item H
  7631. The width and height of the image.
  7632. @item SW
  7633. @item SH
  7634. Width and height scale depending on the currently filtered plane. It is the
  7635. ratio between the corresponding luma plane number of pixels and the current
  7636. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7637. @code{0.5,0.5} for chroma planes.
  7638. @item T
  7639. Time of the current frame, expressed in seconds.
  7640. @item p(x, y)
  7641. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7642. plane.
  7643. @item lum(x, y)
  7644. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7645. plane.
  7646. @item cb(x, y)
  7647. Return the value of the pixel at location (@var{x},@var{y}) of the
  7648. blue-difference chroma plane. Return 0 if there is no such plane.
  7649. @item cr(x, y)
  7650. Return the value of the pixel at location (@var{x},@var{y}) of the
  7651. red-difference chroma plane. Return 0 if there is no such plane.
  7652. @item r(x, y)
  7653. @item g(x, y)
  7654. @item b(x, y)
  7655. Return the value of the pixel at location (@var{x},@var{y}) of the
  7656. red/green/blue component. Return 0 if there is no such component.
  7657. @item alpha(x, y)
  7658. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7659. plane. Return 0 if there is no such plane.
  7660. @end table
  7661. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7662. automatically clipped to the closer edge.
  7663. @subsection Examples
  7664. @itemize
  7665. @item
  7666. Flip the image horizontally:
  7667. @example
  7668. geq=p(W-X\,Y)
  7669. @end example
  7670. @item
  7671. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7672. wavelength of 100 pixels:
  7673. @example
  7674. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7675. @end example
  7676. @item
  7677. Generate a fancy enigmatic moving light:
  7678. @example
  7679. 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
  7680. @end example
  7681. @item
  7682. Generate a quick emboss effect:
  7683. @example
  7684. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7685. @end example
  7686. @item
  7687. Modify RGB components depending on pixel position:
  7688. @example
  7689. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7690. @end example
  7691. @item
  7692. Create a radial gradient that is the same size as the input (also see
  7693. the @ref{vignette} filter):
  7694. @example
  7695. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7696. @end example
  7697. @end itemize
  7698. @section gradfun
  7699. Fix the banding artifacts that are sometimes introduced into nearly flat
  7700. regions by truncation to 8-bit color depth.
  7701. Interpolate the gradients that should go where the bands are, and
  7702. dither them.
  7703. It is designed for playback only. Do not use it prior to
  7704. lossy compression, because compression tends to lose the dither and
  7705. bring back the bands.
  7706. It accepts the following parameters:
  7707. @table @option
  7708. @item strength
  7709. The maximum amount by which the filter will change any one pixel. This is also
  7710. the threshold for detecting nearly flat regions. Acceptable values range from
  7711. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7712. valid range.
  7713. @item radius
  7714. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7715. gradients, but also prevents the filter from modifying the pixels near detailed
  7716. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7717. values will be clipped to the valid range.
  7718. @end table
  7719. Alternatively, the options can be specified as a flat string:
  7720. @var{strength}[:@var{radius}]
  7721. @subsection Examples
  7722. @itemize
  7723. @item
  7724. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7725. @example
  7726. gradfun=3.5:8
  7727. @end example
  7728. @item
  7729. Specify radius, omitting the strength (which will fall-back to the default
  7730. value):
  7731. @example
  7732. gradfun=radius=8
  7733. @end example
  7734. @end itemize
  7735. @section greyedge
  7736. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7737. and corrects the scene colors accordingly.
  7738. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7739. The filter accepts the following options:
  7740. @table @option
  7741. @item difford
  7742. The order of differentiation to be applied on the scene. Must be chosen in the range
  7743. [0,2] and default value is 1.
  7744. @item minknorm
  7745. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7746. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7747. max value instead of calculating Minkowski distance.
  7748. @item sigma
  7749. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7750. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7751. can't be euqal to 0 if @var{difford} is greater than 0.
  7752. @end table
  7753. @subsection Examples
  7754. @itemize
  7755. @item
  7756. Grey Edge:
  7757. @example
  7758. greyedge=difford=1:minknorm=5:sigma=2
  7759. @end example
  7760. @item
  7761. Max Edge:
  7762. @example
  7763. greyedge=difford=1:minknorm=0:sigma=2
  7764. @end example
  7765. @end itemize
  7766. @anchor{haldclut}
  7767. @section haldclut
  7768. Apply a Hald CLUT to a video stream.
  7769. First input is the video stream to process, and second one is the Hald CLUT.
  7770. The Hald CLUT input can be a simple picture or a complete video stream.
  7771. The filter accepts the following options:
  7772. @table @option
  7773. @item shortest
  7774. Force termination when the shortest input terminates. Default is @code{0}.
  7775. @item repeatlast
  7776. Continue applying the last CLUT after the end of the stream. A value of
  7777. @code{0} disable the filter after the last frame of the CLUT is reached.
  7778. Default is @code{1}.
  7779. @end table
  7780. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7781. filters share the same internals).
  7782. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7783. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7784. @subsection Workflow examples
  7785. @subsubsection Hald CLUT video stream
  7786. Generate an identity Hald CLUT stream altered with various effects:
  7787. @example
  7788. 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
  7789. @end example
  7790. Note: make sure you use a lossless codec.
  7791. Then use it with @code{haldclut} to apply it on some random stream:
  7792. @example
  7793. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7794. @end example
  7795. The Hald CLUT will be applied to the 10 first seconds (duration of
  7796. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7797. to the remaining frames of the @code{mandelbrot} stream.
  7798. @subsubsection Hald CLUT with preview
  7799. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7800. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7801. biggest possible square starting at the top left of the picture. The remaining
  7802. padding pixels (bottom or right) will be ignored. This area can be used to add
  7803. a preview of the Hald CLUT.
  7804. Typically, the following generated Hald CLUT will be supported by the
  7805. @code{haldclut} filter:
  7806. @example
  7807. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7808. pad=iw+320 [padded_clut];
  7809. smptebars=s=320x256, split [a][b];
  7810. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7811. [main][b] overlay=W-320" -frames:v 1 clut.png
  7812. @end example
  7813. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7814. bars are displayed on the right-top, and below the same color bars processed by
  7815. the color changes.
  7816. Then, the effect of this Hald CLUT can be visualized with:
  7817. @example
  7818. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7819. @end example
  7820. @section hflip
  7821. Flip the input video horizontally.
  7822. For example, to horizontally flip the input video with @command{ffmpeg}:
  7823. @example
  7824. ffmpeg -i in.avi -vf "hflip" out.avi
  7825. @end example
  7826. @section histeq
  7827. This filter applies a global color histogram equalization on a
  7828. per-frame basis.
  7829. It can be used to correct video that has a compressed range of pixel
  7830. intensities. The filter redistributes the pixel intensities to
  7831. equalize their distribution across the intensity range. It may be
  7832. viewed as an "automatically adjusting contrast filter". This filter is
  7833. useful only for correcting degraded or poorly captured source
  7834. video.
  7835. The filter accepts the following options:
  7836. @table @option
  7837. @item strength
  7838. Determine the amount of equalization to be applied. As the strength
  7839. is reduced, the distribution of pixel intensities more-and-more
  7840. approaches that of the input frame. The value must be a float number
  7841. in the range [0,1] and defaults to 0.200.
  7842. @item intensity
  7843. Set the maximum intensity that can generated and scale the output
  7844. values appropriately. The strength should be set as desired and then
  7845. the intensity can be limited if needed to avoid washing-out. The value
  7846. must be a float number in the range [0,1] and defaults to 0.210.
  7847. @item antibanding
  7848. Set the antibanding level. If enabled the filter will randomly vary
  7849. the luminance of output pixels by a small amount to avoid banding of
  7850. the histogram. Possible values are @code{none}, @code{weak} or
  7851. @code{strong}. It defaults to @code{none}.
  7852. @end table
  7853. @section histogram
  7854. Compute and draw a color distribution histogram for the input video.
  7855. The computed histogram is a representation of the color component
  7856. distribution in an image.
  7857. Standard histogram displays the color components distribution in an image.
  7858. Displays color graph for each color component. Shows distribution of
  7859. the Y, U, V, A or R, G, B components, depending on input format, in the
  7860. current frame. Below each graph a color component scale meter is shown.
  7861. The filter accepts the following options:
  7862. @table @option
  7863. @item level_height
  7864. Set height of level. Default value is @code{200}.
  7865. Allowed range is [50, 2048].
  7866. @item scale_height
  7867. Set height of color scale. Default value is @code{12}.
  7868. Allowed range is [0, 40].
  7869. @item display_mode
  7870. Set display mode.
  7871. It accepts the following values:
  7872. @table @samp
  7873. @item stack
  7874. Per color component graphs are placed below each other.
  7875. @item parade
  7876. Per color component graphs are placed side by side.
  7877. @item overlay
  7878. Presents information identical to that in the @code{parade}, except
  7879. that the graphs representing color components are superimposed directly
  7880. over one another.
  7881. @end table
  7882. Default is @code{stack}.
  7883. @item levels_mode
  7884. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7885. Default is @code{linear}.
  7886. @item components
  7887. Set what color components to display.
  7888. Default is @code{7}.
  7889. @item fgopacity
  7890. Set foreground opacity. Default is @code{0.7}.
  7891. @item bgopacity
  7892. Set background opacity. Default is @code{0.5}.
  7893. @end table
  7894. @subsection Examples
  7895. @itemize
  7896. @item
  7897. Calculate and draw histogram:
  7898. @example
  7899. ffplay -i input -vf histogram
  7900. @end example
  7901. @end itemize
  7902. @anchor{hqdn3d}
  7903. @section hqdn3d
  7904. This is a high precision/quality 3d denoise filter. It aims to reduce
  7905. image noise, producing smooth images and making still images really
  7906. still. It should enhance compressibility.
  7907. It accepts the following optional parameters:
  7908. @table @option
  7909. @item luma_spatial
  7910. A non-negative floating point number which specifies spatial luma strength.
  7911. It defaults to 4.0.
  7912. @item chroma_spatial
  7913. A non-negative floating point number which specifies spatial chroma strength.
  7914. It defaults to 3.0*@var{luma_spatial}/4.0.
  7915. @item luma_tmp
  7916. A floating point number which specifies luma temporal strength. It defaults to
  7917. 6.0*@var{luma_spatial}/4.0.
  7918. @item chroma_tmp
  7919. A floating point number which specifies chroma temporal strength. It defaults to
  7920. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7921. @end table
  7922. @section hwdownload
  7923. Download hardware frames to system memory.
  7924. The input must be in hardware frames, and the output a non-hardware format.
  7925. Not all formats will be supported on the output - it may be necessary to insert
  7926. an additional @option{format} filter immediately following in the graph to get
  7927. the output in a supported format.
  7928. @section hwmap
  7929. Map hardware frames to system memory or to another device.
  7930. This filter has several different modes of operation; which one is used depends
  7931. on the input and output formats:
  7932. @itemize
  7933. @item
  7934. Hardware frame input, normal frame output
  7935. Map the input frames to system memory and pass them to the output. If the
  7936. original hardware frame is later required (for example, after overlaying
  7937. something else on part of it), the @option{hwmap} filter can be used again
  7938. in the next mode to retrieve it.
  7939. @item
  7940. Normal frame input, hardware frame output
  7941. If the input is actually a software-mapped hardware frame, then unmap it -
  7942. that is, return the original hardware frame.
  7943. Otherwise, a device must be provided. Create new hardware surfaces on that
  7944. device for the output, then map them back to the software format at the input
  7945. and give those frames to the preceding filter. This will then act like the
  7946. @option{hwupload} filter, but may be able to avoid an additional copy when
  7947. the input is already in a compatible format.
  7948. @item
  7949. Hardware frame input and output
  7950. A device must be supplied for the output, either directly or with the
  7951. @option{derive_device} option. The input and output devices must be of
  7952. different types and compatible - the exact meaning of this is
  7953. system-dependent, but typically it means that they must refer to the same
  7954. underlying hardware context (for example, refer to the same graphics card).
  7955. If the input frames were originally created on the output device, then unmap
  7956. to retrieve the original frames.
  7957. Otherwise, map the frames to the output device - create new hardware frames
  7958. on the output corresponding to the frames on the input.
  7959. @end itemize
  7960. The following additional parameters are accepted:
  7961. @table @option
  7962. @item mode
  7963. Set the frame mapping mode. Some combination of:
  7964. @table @var
  7965. @item read
  7966. The mapped frame should be readable.
  7967. @item write
  7968. The mapped frame should be writeable.
  7969. @item overwrite
  7970. The mapping will always overwrite the entire frame.
  7971. This may improve performance in some cases, as the original contents of the
  7972. frame need not be loaded.
  7973. @item direct
  7974. The mapping must not involve any copying.
  7975. Indirect mappings to copies of frames are created in some cases where either
  7976. direct mapping is not possible or it would have unexpected properties.
  7977. Setting this flag ensures that the mapping is direct and will fail if that is
  7978. not possible.
  7979. @end table
  7980. Defaults to @var{read+write} if not specified.
  7981. @item derive_device @var{type}
  7982. Rather than using the device supplied at initialisation, instead derive a new
  7983. device of type @var{type} from the device the input frames exist on.
  7984. @item reverse
  7985. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7986. and map them back to the source. This may be necessary in some cases where
  7987. a mapping in one direction is required but only the opposite direction is
  7988. supported by the devices being used.
  7989. This option is dangerous - it may break the preceding filter in undefined
  7990. ways if there are any additional constraints on that filter's output.
  7991. Do not use it without fully understanding the implications of its use.
  7992. @end table
  7993. @section hwupload
  7994. Upload system memory frames to hardware surfaces.
  7995. The device to upload to must be supplied when the filter is initialised. If
  7996. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7997. option.
  7998. @anchor{hwupload_cuda}
  7999. @section hwupload_cuda
  8000. Upload system memory frames to a CUDA device.
  8001. It accepts the following optional parameters:
  8002. @table @option
  8003. @item device
  8004. The number of the CUDA device to use
  8005. @end table
  8006. @section hqx
  8007. Apply a high-quality magnification filter designed for pixel art. This filter
  8008. was originally created by Maxim Stepin.
  8009. It accepts the following option:
  8010. @table @option
  8011. @item n
  8012. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8013. @code{hq3x} and @code{4} for @code{hq4x}.
  8014. Default is @code{3}.
  8015. @end table
  8016. @section hstack
  8017. Stack input videos horizontally.
  8018. All streams must be of same pixel format and of same height.
  8019. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8020. to create same output.
  8021. The filter accept the following option:
  8022. @table @option
  8023. @item inputs
  8024. Set number of input streams. Default is 2.
  8025. @item shortest
  8026. If set to 1, force the output to terminate when the shortest input
  8027. terminates. Default value is 0.
  8028. @end table
  8029. @section hue
  8030. Modify the hue and/or the saturation of the input.
  8031. It accepts the following parameters:
  8032. @table @option
  8033. @item h
  8034. Specify the hue angle as a number of degrees. It accepts an expression,
  8035. and defaults to "0".
  8036. @item s
  8037. Specify the saturation in the [-10,10] range. It accepts an expression and
  8038. defaults to "1".
  8039. @item H
  8040. Specify the hue angle as a number of radians. It accepts an
  8041. expression, and defaults to "0".
  8042. @item b
  8043. Specify the brightness in the [-10,10] range. It accepts an expression and
  8044. defaults to "0".
  8045. @end table
  8046. @option{h} and @option{H} are mutually exclusive, and can't be
  8047. specified at the same time.
  8048. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8049. expressions containing the following constants:
  8050. @table @option
  8051. @item n
  8052. frame count of the input frame starting from 0
  8053. @item pts
  8054. presentation timestamp of the input frame expressed in time base units
  8055. @item r
  8056. frame rate of the input video, NAN if the input frame rate is unknown
  8057. @item t
  8058. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8059. @item tb
  8060. time base of the input video
  8061. @end table
  8062. @subsection Examples
  8063. @itemize
  8064. @item
  8065. Set the hue to 90 degrees and the saturation to 1.0:
  8066. @example
  8067. hue=h=90:s=1
  8068. @end example
  8069. @item
  8070. Same command but expressing the hue in radians:
  8071. @example
  8072. hue=H=PI/2:s=1
  8073. @end example
  8074. @item
  8075. Rotate hue and make the saturation swing between 0
  8076. and 2 over a period of 1 second:
  8077. @example
  8078. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8079. @end example
  8080. @item
  8081. Apply a 3 seconds saturation fade-in effect starting at 0:
  8082. @example
  8083. hue="s=min(t/3\,1)"
  8084. @end example
  8085. The general fade-in expression can be written as:
  8086. @example
  8087. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8088. @end example
  8089. @item
  8090. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8091. @example
  8092. hue="s=max(0\, min(1\, (8-t)/3))"
  8093. @end example
  8094. The general fade-out expression can be written as:
  8095. @example
  8096. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8097. @end example
  8098. @end itemize
  8099. @subsection Commands
  8100. This filter supports the following commands:
  8101. @table @option
  8102. @item b
  8103. @item s
  8104. @item h
  8105. @item H
  8106. Modify the hue and/or the saturation and/or brightness of the input video.
  8107. The command accepts the same syntax of the corresponding option.
  8108. If the specified expression is not valid, it is kept at its current
  8109. value.
  8110. @end table
  8111. @section hysteresis
  8112. Grow first stream into second stream by connecting components.
  8113. This makes it possible to build more robust edge masks.
  8114. This filter accepts the following options:
  8115. @table @option
  8116. @item planes
  8117. Set which planes will be processed as bitmap, unprocessed planes will be
  8118. copied from first stream.
  8119. By default value 0xf, all planes will be processed.
  8120. @item threshold
  8121. Set threshold which is used in filtering. If pixel component value is higher than
  8122. this value filter algorithm for connecting components is activated.
  8123. By default value is 0.
  8124. @end table
  8125. @section idet
  8126. Detect video interlacing type.
  8127. This filter tries to detect if the input frames are interlaced, progressive,
  8128. top or bottom field first. It will also try to detect fields that are
  8129. repeated between adjacent frames (a sign of telecine).
  8130. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8131. Multiple frame detection incorporates the classification history of previous frames.
  8132. The filter will log these metadata values:
  8133. @table @option
  8134. @item single.current_frame
  8135. Detected type of current frame using single-frame detection. One of:
  8136. ``tff'' (top field first), ``bff'' (bottom field first),
  8137. ``progressive'', or ``undetermined''
  8138. @item single.tff
  8139. Cumulative number of frames detected as top field first using single-frame detection.
  8140. @item multiple.tff
  8141. Cumulative number of frames detected as top field first using multiple-frame detection.
  8142. @item single.bff
  8143. Cumulative number of frames detected as bottom field first using single-frame detection.
  8144. @item multiple.current_frame
  8145. Detected type of current frame using multiple-frame detection. One of:
  8146. ``tff'' (top field first), ``bff'' (bottom field first),
  8147. ``progressive'', or ``undetermined''
  8148. @item multiple.bff
  8149. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8150. @item single.progressive
  8151. Cumulative number of frames detected as progressive using single-frame detection.
  8152. @item multiple.progressive
  8153. Cumulative number of frames detected as progressive using multiple-frame detection.
  8154. @item single.undetermined
  8155. Cumulative number of frames that could not be classified using single-frame detection.
  8156. @item multiple.undetermined
  8157. Cumulative number of frames that could not be classified using multiple-frame detection.
  8158. @item repeated.current_frame
  8159. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8160. @item repeated.neither
  8161. Cumulative number of frames with no repeated field.
  8162. @item repeated.top
  8163. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8164. @item repeated.bottom
  8165. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8166. @end table
  8167. The filter accepts the following options:
  8168. @table @option
  8169. @item intl_thres
  8170. Set interlacing threshold.
  8171. @item prog_thres
  8172. Set progressive threshold.
  8173. @item rep_thres
  8174. Threshold for repeated field detection.
  8175. @item half_life
  8176. Number of frames after which a given frame's contribution to the
  8177. statistics is halved (i.e., it contributes only 0.5 to its
  8178. classification). The default of 0 means that all frames seen are given
  8179. full weight of 1.0 forever.
  8180. @item analyze_interlaced_flag
  8181. When this is not 0 then idet will use the specified number of frames to determine
  8182. if the interlaced flag is accurate, it will not count undetermined frames.
  8183. If the flag is found to be accurate it will be used without any further
  8184. computations, if it is found to be inaccurate it will be cleared without any
  8185. further computations. This allows inserting the idet filter as a low computational
  8186. method to clean up the interlaced flag
  8187. @end table
  8188. @section il
  8189. Deinterleave or interleave fields.
  8190. This filter allows one to process interlaced images fields without
  8191. deinterlacing them. Deinterleaving splits the input frame into 2
  8192. fields (so called half pictures). Odd lines are moved to the top
  8193. half of the output image, even lines to the bottom half.
  8194. You can process (filter) them independently and then re-interleave them.
  8195. The filter accepts the following options:
  8196. @table @option
  8197. @item luma_mode, l
  8198. @item chroma_mode, c
  8199. @item alpha_mode, a
  8200. Available values for @var{luma_mode}, @var{chroma_mode} and
  8201. @var{alpha_mode} are:
  8202. @table @samp
  8203. @item none
  8204. Do nothing.
  8205. @item deinterleave, d
  8206. Deinterleave fields, placing one above the other.
  8207. @item interleave, i
  8208. Interleave fields. Reverse the effect of deinterleaving.
  8209. @end table
  8210. Default value is @code{none}.
  8211. @item luma_swap, ls
  8212. @item chroma_swap, cs
  8213. @item alpha_swap, as
  8214. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8215. @end table
  8216. @section inflate
  8217. Apply inflate effect to the video.
  8218. This filter replaces the pixel by the local(3x3) average by taking into account
  8219. only values higher than the pixel.
  8220. It accepts the following options:
  8221. @table @option
  8222. @item threshold0
  8223. @item threshold1
  8224. @item threshold2
  8225. @item threshold3
  8226. Limit the maximum change for each plane, default is 65535.
  8227. If 0, plane will remain unchanged.
  8228. @end table
  8229. @section interlace
  8230. Simple interlacing filter from progressive contents. This interleaves upper (or
  8231. lower) lines from odd frames with lower (or upper) lines from even frames,
  8232. halving the frame rate and preserving image height.
  8233. @example
  8234. Original Original New Frame
  8235. Frame 'j' Frame 'j+1' (tff)
  8236. ========== =========== ==================
  8237. Line 0 --------------------> Frame 'j' Line 0
  8238. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8239. Line 2 ---------------------> Frame 'j' Line 2
  8240. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8241. ... ... ...
  8242. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8243. @end example
  8244. It accepts the following optional parameters:
  8245. @table @option
  8246. @item scan
  8247. This determines whether the interlaced frame is taken from the even
  8248. (tff - default) or odd (bff) lines of the progressive frame.
  8249. @item lowpass
  8250. Vertical lowpass filter to avoid twitter interlacing and
  8251. reduce moire patterns.
  8252. @table @samp
  8253. @item 0, off
  8254. Disable vertical lowpass filter
  8255. @item 1, linear
  8256. Enable linear filter (default)
  8257. @item 2, complex
  8258. Enable complex filter. This will slightly less reduce twitter and moire
  8259. but better retain detail and subjective sharpness impression.
  8260. @end table
  8261. @end table
  8262. @section kerndeint
  8263. Deinterlace input video by applying Donald Graft's adaptive kernel
  8264. deinterling. Work on interlaced parts of a video to produce
  8265. progressive frames.
  8266. The description of the accepted parameters follows.
  8267. @table @option
  8268. @item thresh
  8269. Set the threshold which affects the filter's tolerance when
  8270. determining if a pixel line must be processed. It must be an integer
  8271. in the range [0,255] and defaults to 10. A value of 0 will result in
  8272. applying the process on every pixels.
  8273. @item map
  8274. Paint pixels exceeding the threshold value to white if set to 1.
  8275. Default is 0.
  8276. @item order
  8277. Set the fields order. Swap fields if set to 1, leave fields alone if
  8278. 0. Default is 0.
  8279. @item sharp
  8280. Enable additional sharpening if set to 1. Default is 0.
  8281. @item twoway
  8282. Enable twoway sharpening if set to 1. Default is 0.
  8283. @end table
  8284. @subsection Examples
  8285. @itemize
  8286. @item
  8287. Apply default values:
  8288. @example
  8289. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8290. @end example
  8291. @item
  8292. Enable additional sharpening:
  8293. @example
  8294. kerndeint=sharp=1
  8295. @end example
  8296. @item
  8297. Paint processed pixels in white:
  8298. @example
  8299. kerndeint=map=1
  8300. @end example
  8301. @end itemize
  8302. @section lenscorrection
  8303. Correct radial lens distortion
  8304. This filter can be used to correct for radial distortion as can result from the use
  8305. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8306. one can use tools available for example as part of opencv or simply trial-and-error.
  8307. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8308. and extract the k1 and k2 coefficients from the resulting matrix.
  8309. Note that effectively the same filter is available in the open-source tools Krita and
  8310. Digikam from the KDE project.
  8311. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8312. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8313. brightness distribution, so you may want to use both filters together in certain
  8314. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8315. be applied before or after lens correction.
  8316. @subsection Options
  8317. The filter accepts the following options:
  8318. @table @option
  8319. @item cx
  8320. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8321. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8322. width. Default is 0.5.
  8323. @item cy
  8324. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8325. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8326. height. Default is 0.5.
  8327. @item k1
  8328. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8329. no correction. Default is 0.
  8330. @item k2
  8331. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8332. 0 means no correction. Default is 0.
  8333. @end table
  8334. The formula that generates the correction is:
  8335. @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)
  8336. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8337. distances from the focal point in the source and target images, respectively.
  8338. @section lensfun
  8339. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8340. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8341. to apply the lens correction. The filter will load the lensfun database and
  8342. query it to find the corresponding camera and lens entries in the database. As
  8343. long as these entries can be found with the given options, the filter can
  8344. perform corrections on frames. Note that incomplete strings will result in the
  8345. filter choosing the best match with the given options, and the filter will
  8346. output the chosen camera and lens models (logged with level "info"). You must
  8347. provide the make, camera model, and lens model as they are required.
  8348. The filter accepts the following options:
  8349. @table @option
  8350. @item make
  8351. The make of the camera (for example, "Canon"). This option is required.
  8352. @item model
  8353. The model of the camera (for example, "Canon EOS 100D"). This option is
  8354. required.
  8355. @item lens_model
  8356. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8357. option is required.
  8358. @item mode
  8359. The type of correction to apply. The following values are valid options:
  8360. @table @samp
  8361. @item vignetting
  8362. Enables fixing lens vignetting.
  8363. @item geometry
  8364. Enables fixing lens geometry. This is the default.
  8365. @item subpixel
  8366. Enables fixing chromatic aberrations.
  8367. @item vig_geo
  8368. Enables fixing lens vignetting and lens geometry.
  8369. @item vig_subpixel
  8370. Enables fixing lens vignetting and chromatic aberrations.
  8371. @item distortion
  8372. Enables fixing both lens geometry and chromatic aberrations.
  8373. @item all
  8374. Enables all possible corrections.
  8375. @end table
  8376. @item focal_length
  8377. The focal length of the image/video (zoom; expected constant for video). For
  8378. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8379. range should be chosen when using that lens. Default 18.
  8380. @item aperture
  8381. The aperture of the image/video (expected constant for video). Note that
  8382. aperture is only used for vignetting correction. Default 3.5.
  8383. @item focus_distance
  8384. The focus distance of the image/video (expected constant for video). Note that
  8385. focus distance is only used for vignetting and only slightly affects the
  8386. vignetting correction process. If unknown, leave it at the default value (which
  8387. is 1000).
  8388. @item target_geometry
  8389. The target geometry of the output image/video. The following values are valid
  8390. options:
  8391. @table @samp
  8392. @item rectilinear (default)
  8393. @item fisheye
  8394. @item panoramic
  8395. @item equirectangular
  8396. @item fisheye_orthographic
  8397. @item fisheye_stereographic
  8398. @item fisheye_equisolid
  8399. @item fisheye_thoby
  8400. @end table
  8401. @item reverse
  8402. Apply the reverse of image correction (instead of correcting distortion, apply
  8403. it).
  8404. @item interpolation
  8405. The type of interpolation used when correcting distortion. The following values
  8406. are valid options:
  8407. @table @samp
  8408. @item nearest
  8409. @item linear (default)
  8410. @item lanczos
  8411. @end table
  8412. @end table
  8413. @subsection Examples
  8414. @itemize
  8415. @item
  8416. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8417. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8418. aperture of "8.0".
  8419. @example
  8420. 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
  8421. @end example
  8422. @item
  8423. Apply the same as before, but only for the first 5 seconds of video.
  8424. @example
  8425. 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
  8426. @end example
  8427. @end itemize
  8428. @section libvmaf
  8429. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8430. score between two input videos.
  8431. The obtained VMAF score is printed through the logging system.
  8432. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8433. After installing the library it can be enabled using:
  8434. @code{./configure --enable-libvmaf --enable-version3}.
  8435. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8436. The filter has following options:
  8437. @table @option
  8438. @item model_path
  8439. Set the model path which is to be used for SVM.
  8440. Default value: @code{"vmaf_v0.6.1.pkl"}
  8441. @item log_path
  8442. Set the file path to be used to store logs.
  8443. @item log_fmt
  8444. Set the format of the log file (xml or json).
  8445. @item enable_transform
  8446. Enables transform for computing vmaf.
  8447. @item phone_model
  8448. Invokes the phone model which will generate VMAF scores higher than in the
  8449. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8450. @item psnr
  8451. Enables computing psnr along with vmaf.
  8452. @item ssim
  8453. Enables computing ssim along with vmaf.
  8454. @item ms_ssim
  8455. Enables computing ms_ssim along with vmaf.
  8456. @item pool
  8457. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8458. @item n_threads
  8459. Set number of threads to be used when computing vmaf.
  8460. @item n_subsample
  8461. Set interval for frame subsampling used when computing vmaf.
  8462. @item enable_conf_interval
  8463. Enables confidence interval.
  8464. @end table
  8465. This filter also supports the @ref{framesync} options.
  8466. On the below examples the input file @file{main.mpg} being processed is
  8467. compared with the reference file @file{ref.mpg}.
  8468. @example
  8469. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8470. @end example
  8471. Example with options:
  8472. @example
  8473. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8474. @end example
  8475. @section limiter
  8476. Limits the pixel components values to the specified range [min, max].
  8477. The filter accepts the following options:
  8478. @table @option
  8479. @item min
  8480. Lower bound. Defaults to the lowest allowed value for the input.
  8481. @item max
  8482. Upper bound. Defaults to the highest allowed value for the input.
  8483. @item planes
  8484. Specify which planes will be processed. Defaults to all available.
  8485. @end table
  8486. @section loop
  8487. Loop video frames.
  8488. The filter accepts the following options:
  8489. @table @option
  8490. @item loop
  8491. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8492. Default is 0.
  8493. @item size
  8494. Set maximal size in number of frames. Default is 0.
  8495. @item start
  8496. Set first frame of loop. Default is 0.
  8497. @end table
  8498. @section lut1d
  8499. Apply a 1D LUT to an input video.
  8500. The filter accepts the following options:
  8501. @table @option
  8502. @item file
  8503. Set the 1D LUT file name.
  8504. Currently supported formats:
  8505. @table @samp
  8506. @item cube
  8507. Iridas
  8508. @end table
  8509. @item interp
  8510. Select interpolation mode.
  8511. Available values are:
  8512. @table @samp
  8513. @item nearest
  8514. Use values from the nearest defined point.
  8515. @item linear
  8516. Interpolate values using the linear interpolation.
  8517. @item cubic
  8518. Interpolate values using the cubic interpolation.
  8519. @end table
  8520. @end table
  8521. @anchor{lut3d}
  8522. @section lut3d
  8523. Apply a 3D LUT to an input video.
  8524. The filter accepts the following options:
  8525. @table @option
  8526. @item file
  8527. Set the 3D LUT file name.
  8528. Currently supported formats:
  8529. @table @samp
  8530. @item 3dl
  8531. AfterEffects
  8532. @item cube
  8533. Iridas
  8534. @item dat
  8535. DaVinci
  8536. @item m3d
  8537. Pandora
  8538. @end table
  8539. @item interp
  8540. Select interpolation mode.
  8541. Available values are:
  8542. @table @samp
  8543. @item nearest
  8544. Use values from the nearest defined point.
  8545. @item trilinear
  8546. Interpolate values using the 8 points defining a cube.
  8547. @item tetrahedral
  8548. Interpolate values using a tetrahedron.
  8549. @end table
  8550. @end table
  8551. This filter also supports the @ref{framesync} options.
  8552. @section lumakey
  8553. Turn certain luma values into transparency.
  8554. The filter accepts the following options:
  8555. @table @option
  8556. @item threshold
  8557. Set the luma which will be used as base for transparency.
  8558. Default value is @code{0}.
  8559. @item tolerance
  8560. Set the range of luma values to be keyed out.
  8561. Default value is @code{0}.
  8562. @item softness
  8563. Set the range of softness. Default value is @code{0}.
  8564. Use this to control gradual transition from zero to full transparency.
  8565. @end table
  8566. @section lut, lutrgb, lutyuv
  8567. Compute a look-up table for binding each pixel component input value
  8568. to an output value, and apply it to the input video.
  8569. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8570. to an RGB input video.
  8571. These filters accept the following parameters:
  8572. @table @option
  8573. @item c0
  8574. set first pixel component expression
  8575. @item c1
  8576. set second pixel component expression
  8577. @item c2
  8578. set third pixel component expression
  8579. @item c3
  8580. set fourth pixel component expression, corresponds to the alpha component
  8581. @item r
  8582. set red component expression
  8583. @item g
  8584. set green component expression
  8585. @item b
  8586. set blue component expression
  8587. @item a
  8588. alpha component expression
  8589. @item y
  8590. set Y/luminance component expression
  8591. @item u
  8592. set U/Cb component expression
  8593. @item v
  8594. set V/Cr component expression
  8595. @end table
  8596. Each of them specifies the expression to use for computing the lookup table for
  8597. the corresponding pixel component values.
  8598. The exact component associated to each of the @var{c*} options depends on the
  8599. format in input.
  8600. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8601. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8602. The expressions can contain the following constants and functions:
  8603. @table @option
  8604. @item w
  8605. @item h
  8606. The input width and height.
  8607. @item val
  8608. The input value for the pixel component.
  8609. @item clipval
  8610. The input value, clipped to the @var{minval}-@var{maxval} range.
  8611. @item maxval
  8612. The maximum value for the pixel component.
  8613. @item minval
  8614. The minimum value for the pixel component.
  8615. @item negval
  8616. The negated value for the pixel component value, clipped to the
  8617. @var{minval}-@var{maxval} range; it corresponds to the expression
  8618. "maxval-clipval+minval".
  8619. @item clip(val)
  8620. The computed value in @var{val}, clipped to the
  8621. @var{minval}-@var{maxval} range.
  8622. @item gammaval(gamma)
  8623. The computed gamma correction value of the pixel component value,
  8624. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8625. expression
  8626. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8627. @end table
  8628. All expressions default to "val".
  8629. @subsection Examples
  8630. @itemize
  8631. @item
  8632. Negate input video:
  8633. @example
  8634. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8635. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8636. @end example
  8637. The above is the same as:
  8638. @example
  8639. lutrgb="r=negval:g=negval:b=negval"
  8640. lutyuv="y=negval:u=negval:v=negval"
  8641. @end example
  8642. @item
  8643. Negate luminance:
  8644. @example
  8645. lutyuv=y=negval
  8646. @end example
  8647. @item
  8648. Remove chroma components, turning the video into a graytone image:
  8649. @example
  8650. lutyuv="u=128:v=128"
  8651. @end example
  8652. @item
  8653. Apply a luma burning effect:
  8654. @example
  8655. lutyuv="y=2*val"
  8656. @end example
  8657. @item
  8658. Remove green and blue components:
  8659. @example
  8660. lutrgb="g=0:b=0"
  8661. @end example
  8662. @item
  8663. Set a constant alpha channel value on input:
  8664. @example
  8665. format=rgba,lutrgb=a="maxval-minval/2"
  8666. @end example
  8667. @item
  8668. Correct luminance gamma by a factor of 0.5:
  8669. @example
  8670. lutyuv=y=gammaval(0.5)
  8671. @end example
  8672. @item
  8673. Discard least significant bits of luma:
  8674. @example
  8675. lutyuv=y='bitand(val, 128+64+32)'
  8676. @end example
  8677. @item
  8678. Technicolor like effect:
  8679. @example
  8680. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8681. @end example
  8682. @end itemize
  8683. @section lut2, tlut2
  8684. The @code{lut2} filter takes two input streams and outputs one
  8685. stream.
  8686. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8687. from one single stream.
  8688. This filter accepts the following parameters:
  8689. @table @option
  8690. @item c0
  8691. set first pixel component expression
  8692. @item c1
  8693. set second pixel component expression
  8694. @item c2
  8695. set third pixel component expression
  8696. @item c3
  8697. set fourth pixel component expression, corresponds to the alpha component
  8698. @end table
  8699. Each of them specifies the expression to use for computing the lookup table for
  8700. the corresponding pixel component values.
  8701. The exact component associated to each of the @var{c*} options depends on the
  8702. format in inputs.
  8703. The expressions can contain the following constants:
  8704. @table @option
  8705. @item w
  8706. @item h
  8707. The input width and height.
  8708. @item x
  8709. The first input value for the pixel component.
  8710. @item y
  8711. The second input value for the pixel component.
  8712. @item bdx
  8713. The first input video bit depth.
  8714. @item bdy
  8715. The second input video bit depth.
  8716. @end table
  8717. All expressions default to "x".
  8718. @subsection Examples
  8719. @itemize
  8720. @item
  8721. Highlight differences between two RGB video streams:
  8722. @example
  8723. 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)'
  8724. @end example
  8725. @item
  8726. Highlight differences between two YUV video streams:
  8727. @example
  8728. 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)'
  8729. @end example
  8730. @item
  8731. Show max difference between two video streams:
  8732. @example
  8733. 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)))'
  8734. @end example
  8735. @end itemize
  8736. @section maskedclamp
  8737. Clamp the first input stream with the second input and third input stream.
  8738. Returns the value of first stream to be between second input
  8739. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8740. This filter accepts the following options:
  8741. @table @option
  8742. @item undershoot
  8743. Default value is @code{0}.
  8744. @item overshoot
  8745. Default value is @code{0}.
  8746. @item planes
  8747. Set which planes will be processed as bitmap, unprocessed planes will be
  8748. copied from first stream.
  8749. By default value 0xf, all planes will be processed.
  8750. @end table
  8751. @section maskedmerge
  8752. Merge the first input stream with the second input stream using per pixel
  8753. weights in the third input stream.
  8754. A value of 0 in the third stream pixel component means that pixel component
  8755. from first stream is returned unchanged, while maximum value (eg. 255 for
  8756. 8-bit videos) means that pixel component from second stream is returned
  8757. unchanged. Intermediate values define the amount of merging between both
  8758. input stream's pixel components.
  8759. This filter accepts the following options:
  8760. @table @option
  8761. @item planes
  8762. Set which planes will be processed as bitmap, unprocessed planes will be
  8763. copied from first stream.
  8764. By default value 0xf, all planes will be processed.
  8765. @end table
  8766. @section mcdeint
  8767. Apply motion-compensation deinterlacing.
  8768. It needs one field per frame as input and must thus be used together
  8769. with yadif=1/3 or equivalent.
  8770. This filter accepts the following options:
  8771. @table @option
  8772. @item mode
  8773. Set the deinterlacing mode.
  8774. It accepts one of the following values:
  8775. @table @samp
  8776. @item fast
  8777. @item medium
  8778. @item slow
  8779. use iterative motion estimation
  8780. @item extra_slow
  8781. like @samp{slow}, but use multiple reference frames.
  8782. @end table
  8783. Default value is @samp{fast}.
  8784. @item parity
  8785. Set the picture field parity assumed for the input video. It must be
  8786. one of the following values:
  8787. @table @samp
  8788. @item 0, tff
  8789. assume top field first
  8790. @item 1, bff
  8791. assume bottom field first
  8792. @end table
  8793. Default value is @samp{bff}.
  8794. @item qp
  8795. Set per-block quantization parameter (QP) used by the internal
  8796. encoder.
  8797. Higher values should result in a smoother motion vector field but less
  8798. optimal individual vectors. Default value is 1.
  8799. @end table
  8800. @section mergeplanes
  8801. Merge color channel components from several video streams.
  8802. The filter accepts up to 4 input streams, and merge selected input
  8803. planes to the output video.
  8804. This filter accepts the following options:
  8805. @table @option
  8806. @item mapping
  8807. Set input to output plane mapping. Default is @code{0}.
  8808. The mappings is specified as a bitmap. It should be specified as a
  8809. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8810. mapping for the first plane of the output stream. 'A' sets the number of
  8811. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8812. corresponding input to use (from 0 to 3). The rest of the mappings is
  8813. similar, 'Bb' describes the mapping for the output stream second
  8814. plane, 'Cc' describes the mapping for the output stream third plane and
  8815. 'Dd' describes the mapping for the output stream fourth plane.
  8816. @item format
  8817. Set output pixel format. Default is @code{yuva444p}.
  8818. @end table
  8819. @subsection Examples
  8820. @itemize
  8821. @item
  8822. Merge three gray video streams of same width and height into single video stream:
  8823. @example
  8824. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8825. @end example
  8826. @item
  8827. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8828. @example
  8829. [a0][a1]mergeplanes=0x00010210:yuva444p
  8830. @end example
  8831. @item
  8832. Swap Y and A plane in yuva444p stream:
  8833. @example
  8834. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8835. @end example
  8836. @item
  8837. Swap U and V plane in yuv420p stream:
  8838. @example
  8839. format=yuv420p,mergeplanes=0x000201:yuv420p
  8840. @end example
  8841. @item
  8842. Cast a rgb24 clip to yuv444p:
  8843. @example
  8844. format=rgb24,mergeplanes=0x000102:yuv444p
  8845. @end example
  8846. @end itemize
  8847. @section mestimate
  8848. Estimate and export motion vectors using block matching algorithms.
  8849. Motion vectors are stored in frame side data to be used by other filters.
  8850. This filter accepts the following options:
  8851. @table @option
  8852. @item method
  8853. Specify the motion estimation method. Accepts one of the following values:
  8854. @table @samp
  8855. @item esa
  8856. Exhaustive search algorithm.
  8857. @item tss
  8858. Three step search algorithm.
  8859. @item tdls
  8860. Two dimensional logarithmic search algorithm.
  8861. @item ntss
  8862. New three step search algorithm.
  8863. @item fss
  8864. Four step search algorithm.
  8865. @item ds
  8866. Diamond search algorithm.
  8867. @item hexbs
  8868. Hexagon-based search algorithm.
  8869. @item epzs
  8870. Enhanced predictive zonal search algorithm.
  8871. @item umh
  8872. Uneven multi-hexagon search algorithm.
  8873. @end table
  8874. Default value is @samp{esa}.
  8875. @item mb_size
  8876. Macroblock size. Default @code{16}.
  8877. @item search_param
  8878. Search parameter. Default @code{7}.
  8879. @end table
  8880. @section midequalizer
  8881. Apply Midway Image Equalization effect using two video streams.
  8882. Midway Image Equalization adjusts a pair of images to have the same
  8883. histogram, while maintaining their dynamics as much as possible. It's
  8884. useful for e.g. matching exposures from a pair of stereo cameras.
  8885. This filter has two inputs and one output, which must be of same pixel format, but
  8886. may be of different sizes. The output of filter is first input adjusted with
  8887. midway histogram of both inputs.
  8888. This filter accepts the following option:
  8889. @table @option
  8890. @item planes
  8891. Set which planes to process. Default is @code{15}, which is all available planes.
  8892. @end table
  8893. @section minterpolate
  8894. Convert the video to specified frame rate using motion interpolation.
  8895. This filter accepts the following options:
  8896. @table @option
  8897. @item fps
  8898. 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}.
  8899. @item mi_mode
  8900. Motion interpolation mode. Following values are accepted:
  8901. @table @samp
  8902. @item dup
  8903. Duplicate previous or next frame for interpolating new ones.
  8904. @item blend
  8905. Blend source frames. Interpolated frame is mean of previous and next frames.
  8906. @item mci
  8907. Motion compensated interpolation. Following options are effective when this mode is selected:
  8908. @table @samp
  8909. @item mc_mode
  8910. Motion compensation mode. Following values are accepted:
  8911. @table @samp
  8912. @item obmc
  8913. Overlapped block motion compensation.
  8914. @item aobmc
  8915. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8916. @end table
  8917. Default mode is @samp{obmc}.
  8918. @item me_mode
  8919. Motion estimation mode. Following values are accepted:
  8920. @table @samp
  8921. @item bidir
  8922. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8923. @item bilat
  8924. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8925. @end table
  8926. Default mode is @samp{bilat}.
  8927. @item me
  8928. The algorithm to be used for motion estimation. Following values are accepted:
  8929. @table @samp
  8930. @item esa
  8931. Exhaustive search algorithm.
  8932. @item tss
  8933. Three step search algorithm.
  8934. @item tdls
  8935. Two dimensional logarithmic search algorithm.
  8936. @item ntss
  8937. New three step search algorithm.
  8938. @item fss
  8939. Four step search algorithm.
  8940. @item ds
  8941. Diamond search algorithm.
  8942. @item hexbs
  8943. Hexagon-based search algorithm.
  8944. @item epzs
  8945. Enhanced predictive zonal search algorithm.
  8946. @item umh
  8947. Uneven multi-hexagon search algorithm.
  8948. @end table
  8949. Default algorithm is @samp{epzs}.
  8950. @item mb_size
  8951. Macroblock size. Default @code{16}.
  8952. @item search_param
  8953. Motion estimation search parameter. Default @code{32}.
  8954. @item vsbmc
  8955. 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).
  8956. @end table
  8957. @end table
  8958. @item scd
  8959. 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:
  8960. @table @samp
  8961. @item none
  8962. Disable scene change detection.
  8963. @item fdiff
  8964. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8965. @end table
  8966. Default method is @samp{fdiff}.
  8967. @item scd_threshold
  8968. Scene change detection threshold. Default is @code{5.0}.
  8969. @end table
  8970. @section mix
  8971. Mix several video input streams into one video stream.
  8972. A description of the accepted options follows.
  8973. @table @option
  8974. @item nb_inputs
  8975. The number of inputs. If unspecified, it defaults to 2.
  8976. @item weights
  8977. Specify weight of each input video stream as sequence.
  8978. Each weight is separated by space. If number of weights
  8979. is smaller than number of @var{frames} last specified
  8980. weight will be used for all remaining unset weights.
  8981. @item scale
  8982. Specify scale, if it is set it will be multiplied with sum
  8983. of each weight multiplied with pixel values to give final destination
  8984. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8985. @item duration
  8986. Specify how end of stream is determined.
  8987. @table @samp
  8988. @item longest
  8989. The duration of the longest input. (default)
  8990. @item shortest
  8991. The duration of the shortest input.
  8992. @item first
  8993. The duration of the first input.
  8994. @end table
  8995. @end table
  8996. @section mpdecimate
  8997. Drop frames that do not differ greatly from the previous frame in
  8998. order to reduce frame rate.
  8999. The main use of this filter is for very-low-bitrate encoding
  9000. (e.g. streaming over dialup modem), but it could in theory be used for
  9001. fixing movies that were inverse-telecined incorrectly.
  9002. A description of the accepted options follows.
  9003. @table @option
  9004. @item max
  9005. Set the maximum number of consecutive frames which can be dropped (if
  9006. positive), or the minimum interval between dropped frames (if
  9007. negative). If the value is 0, the frame is dropped disregarding the
  9008. number of previous sequentially dropped frames.
  9009. Default value is 0.
  9010. @item hi
  9011. @item lo
  9012. @item frac
  9013. Set the dropping threshold values.
  9014. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9015. represent actual pixel value differences, so a threshold of 64
  9016. corresponds to 1 unit of difference for each pixel, or the same spread
  9017. out differently over the block.
  9018. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9019. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9020. meaning the whole image) differ by more than a threshold of @option{lo}.
  9021. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9022. 64*5, and default value for @option{frac} is 0.33.
  9023. @end table
  9024. @section negate
  9025. Negate (invert) the input video.
  9026. It accepts the following option:
  9027. @table @option
  9028. @item negate_alpha
  9029. With value 1, it negates the alpha component, if present. Default value is 0.
  9030. @end table
  9031. @anchor{nlmeans}
  9032. @section nlmeans
  9033. Denoise frames using Non-Local Means algorithm.
  9034. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9035. context similarity is defined by comparing their surrounding patches of size
  9036. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9037. around the pixel.
  9038. Note that the research area defines centers for patches, which means some
  9039. patches will be made of pixels outside that research area.
  9040. The filter accepts the following options.
  9041. @table @option
  9042. @item s
  9043. Set denoising strength.
  9044. @item p
  9045. Set patch size.
  9046. @item pc
  9047. Same as @option{p} but for chroma planes.
  9048. The default value is @var{0} and means automatic.
  9049. @item r
  9050. Set research size.
  9051. @item rc
  9052. Same as @option{r} but for chroma planes.
  9053. The default value is @var{0} and means automatic.
  9054. @end table
  9055. @section nnedi
  9056. Deinterlace video using neural network edge directed interpolation.
  9057. This filter accepts the following options:
  9058. @table @option
  9059. @item weights
  9060. Mandatory option, without binary file filter can not work.
  9061. Currently file can be found here:
  9062. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9063. @item deint
  9064. Set which frames to deinterlace, by default it is @code{all}.
  9065. Can be @code{all} or @code{interlaced}.
  9066. @item field
  9067. Set mode of operation.
  9068. Can be one of the following:
  9069. @table @samp
  9070. @item af
  9071. Use frame flags, both fields.
  9072. @item a
  9073. Use frame flags, single field.
  9074. @item t
  9075. Use top field only.
  9076. @item b
  9077. Use bottom field only.
  9078. @item tf
  9079. Use both fields, top first.
  9080. @item bf
  9081. Use both fields, bottom first.
  9082. @end table
  9083. @item planes
  9084. Set which planes to process, by default filter process all frames.
  9085. @item nsize
  9086. Set size of local neighborhood around each pixel, used by the predictor neural
  9087. network.
  9088. Can be one of the following:
  9089. @table @samp
  9090. @item s8x6
  9091. @item s16x6
  9092. @item s32x6
  9093. @item s48x6
  9094. @item s8x4
  9095. @item s16x4
  9096. @item s32x4
  9097. @end table
  9098. @item nns
  9099. Set the number of neurons in predictor neural network.
  9100. Can be one of the following:
  9101. @table @samp
  9102. @item n16
  9103. @item n32
  9104. @item n64
  9105. @item n128
  9106. @item n256
  9107. @end table
  9108. @item qual
  9109. Controls the number of different neural network predictions that are blended
  9110. together to compute the final output value. Can be @code{fast}, default or
  9111. @code{slow}.
  9112. @item etype
  9113. Set which set of weights to use in the predictor.
  9114. Can be one of the following:
  9115. @table @samp
  9116. @item a
  9117. weights trained to minimize absolute error
  9118. @item s
  9119. weights trained to minimize squared error
  9120. @end table
  9121. @item pscrn
  9122. Controls whether or not the prescreener neural network is used to decide
  9123. which pixels should be processed by the predictor neural network and which
  9124. can be handled by simple cubic interpolation.
  9125. The prescreener is trained to know whether cubic interpolation will be
  9126. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9127. The computational complexity of the prescreener nn is much less than that of
  9128. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9129. using the prescreener generally results in much faster processing.
  9130. The prescreener is pretty accurate, so the difference between using it and not
  9131. using it is almost always unnoticeable.
  9132. Can be one of the following:
  9133. @table @samp
  9134. @item none
  9135. @item original
  9136. @item new
  9137. @end table
  9138. Default is @code{new}.
  9139. @item fapprox
  9140. Set various debugging flags.
  9141. @end table
  9142. @section noformat
  9143. Force libavfilter not to use any of the specified pixel formats for the
  9144. input to the next filter.
  9145. It accepts the following parameters:
  9146. @table @option
  9147. @item pix_fmts
  9148. A '|'-separated list of pixel format names, such as
  9149. pix_fmts=yuv420p|monow|rgb24".
  9150. @end table
  9151. @subsection Examples
  9152. @itemize
  9153. @item
  9154. Force libavfilter to use a format different from @var{yuv420p} for the
  9155. input to the vflip filter:
  9156. @example
  9157. noformat=pix_fmts=yuv420p,vflip
  9158. @end example
  9159. @item
  9160. Convert the input video to any of the formats not contained in the list:
  9161. @example
  9162. noformat=yuv420p|yuv444p|yuv410p
  9163. @end example
  9164. @end itemize
  9165. @section noise
  9166. Add noise on video input frame.
  9167. The filter accepts the following options:
  9168. @table @option
  9169. @item all_seed
  9170. @item c0_seed
  9171. @item c1_seed
  9172. @item c2_seed
  9173. @item c3_seed
  9174. Set noise seed for specific pixel component or all pixel components in case
  9175. of @var{all_seed}. Default value is @code{123457}.
  9176. @item all_strength, alls
  9177. @item c0_strength, c0s
  9178. @item c1_strength, c1s
  9179. @item c2_strength, c2s
  9180. @item c3_strength, c3s
  9181. Set noise strength for specific pixel component or all pixel components in case
  9182. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9183. @item all_flags, allf
  9184. @item c0_flags, c0f
  9185. @item c1_flags, c1f
  9186. @item c2_flags, c2f
  9187. @item c3_flags, c3f
  9188. Set pixel component flags or set flags for all components if @var{all_flags}.
  9189. Available values for component flags are:
  9190. @table @samp
  9191. @item a
  9192. averaged temporal noise (smoother)
  9193. @item p
  9194. mix random noise with a (semi)regular pattern
  9195. @item t
  9196. temporal noise (noise pattern changes between frames)
  9197. @item u
  9198. uniform noise (gaussian otherwise)
  9199. @end table
  9200. @end table
  9201. @subsection Examples
  9202. Add temporal and uniform noise to input video:
  9203. @example
  9204. noise=alls=20:allf=t+u
  9205. @end example
  9206. @section normalize
  9207. Normalize RGB video (aka histogram stretching, contrast stretching).
  9208. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9209. For each channel of each frame, the filter computes the input range and maps
  9210. it linearly to the user-specified output range. The output range defaults
  9211. to the full dynamic range from pure black to pure white.
  9212. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9213. changes in brightness) caused when small dark or bright objects enter or leave
  9214. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9215. video camera, and, like a video camera, it may cause a period of over- or
  9216. under-exposure of the video.
  9217. The R,G,B channels can be normalized independently, which may cause some
  9218. color shifting, or linked together as a single channel, which prevents
  9219. color shifting. Linked normalization preserves hue. Independent normalization
  9220. does not, so it can be used to remove some color casts. Independent and linked
  9221. normalization can be combined in any ratio.
  9222. The normalize filter accepts the following options:
  9223. @table @option
  9224. @item blackpt
  9225. @item whitept
  9226. Colors which define the output range. The minimum input value is mapped to
  9227. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9228. The defaults are black and white respectively. Specifying white for
  9229. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9230. normalized video. Shades of grey can be used to reduce the dynamic range
  9231. (contrast). Specifying saturated colors here can create some interesting
  9232. effects.
  9233. @item smoothing
  9234. The number of previous frames to use for temporal smoothing. The input range
  9235. of each channel is smoothed using a rolling average over the current frame
  9236. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9237. smoothing).
  9238. @item independence
  9239. Controls the ratio of independent (color shifting) channel normalization to
  9240. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9241. independent. Defaults to 1.0 (fully independent).
  9242. @item strength
  9243. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9244. expensive no-op. Defaults to 1.0 (full strength).
  9245. @end table
  9246. @subsection Examples
  9247. Stretch video contrast to use the full dynamic range, with no temporal
  9248. smoothing; may flicker depending on the source content:
  9249. @example
  9250. normalize=blackpt=black:whitept=white:smoothing=0
  9251. @end example
  9252. As above, but with 50 frames of temporal smoothing; flicker should be
  9253. reduced, depending on the source content:
  9254. @example
  9255. normalize=blackpt=black:whitept=white:smoothing=50
  9256. @end example
  9257. As above, but with hue-preserving linked channel normalization:
  9258. @example
  9259. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9260. @end example
  9261. As above, but with half strength:
  9262. @example
  9263. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9264. @end example
  9265. Map the darkest input color to red, the brightest input color to cyan:
  9266. @example
  9267. normalize=blackpt=red:whitept=cyan
  9268. @end example
  9269. @section null
  9270. Pass the video source unchanged to the output.
  9271. @section ocr
  9272. Optical Character Recognition
  9273. This filter uses Tesseract for optical character recognition. To enable
  9274. compilation of this filter, you need to configure FFmpeg with
  9275. @code{--enable-libtesseract}.
  9276. It accepts the following options:
  9277. @table @option
  9278. @item datapath
  9279. Set datapath to tesseract data. Default is to use whatever was
  9280. set at installation.
  9281. @item language
  9282. Set language, default is "eng".
  9283. @item whitelist
  9284. Set character whitelist.
  9285. @item blacklist
  9286. Set character blacklist.
  9287. @end table
  9288. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9289. @section ocv
  9290. Apply a video transform using libopencv.
  9291. To enable this filter, install the libopencv library and headers and
  9292. configure FFmpeg with @code{--enable-libopencv}.
  9293. It accepts the following parameters:
  9294. @table @option
  9295. @item filter_name
  9296. The name of the libopencv filter to apply.
  9297. @item filter_params
  9298. The parameters to pass to the libopencv filter. If not specified, the default
  9299. values are assumed.
  9300. @end table
  9301. Refer to the official libopencv documentation for more precise
  9302. information:
  9303. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9304. Several libopencv filters are supported; see the following subsections.
  9305. @anchor{dilate}
  9306. @subsection dilate
  9307. Dilate an image by using a specific structuring element.
  9308. It corresponds to the libopencv function @code{cvDilate}.
  9309. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9310. @var{struct_el} represents a structuring element, and has the syntax:
  9311. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9312. @var{cols} and @var{rows} represent the number of columns and rows of
  9313. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9314. point, and @var{shape} the shape for the structuring element. @var{shape}
  9315. must be "rect", "cross", "ellipse", or "custom".
  9316. If the value for @var{shape} is "custom", it must be followed by a
  9317. string of the form "=@var{filename}". The file with name
  9318. @var{filename} is assumed to represent a binary image, with each
  9319. printable character corresponding to a bright pixel. When a custom
  9320. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9321. or columns and rows of the read file are assumed instead.
  9322. The default value for @var{struct_el} is "3x3+0x0/rect".
  9323. @var{nb_iterations} specifies the number of times the transform is
  9324. applied to the image, and defaults to 1.
  9325. Some examples:
  9326. @example
  9327. # Use the default values
  9328. ocv=dilate
  9329. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9330. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9331. # Read the shape from the file diamond.shape, iterating two times.
  9332. # The file diamond.shape may contain a pattern of characters like this
  9333. # *
  9334. # ***
  9335. # *****
  9336. # ***
  9337. # *
  9338. # The specified columns and rows are ignored
  9339. # but the anchor point coordinates are not
  9340. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9341. @end example
  9342. @subsection erode
  9343. Erode an image by using a specific structuring element.
  9344. It corresponds to the libopencv function @code{cvErode}.
  9345. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9346. with the same syntax and semantics as the @ref{dilate} filter.
  9347. @subsection smooth
  9348. Smooth the input video.
  9349. The filter takes the following parameters:
  9350. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9351. @var{type} is the type of smooth filter to apply, and must be one of
  9352. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9353. or "bilateral". The default value is "gaussian".
  9354. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9355. depend on the smooth type. @var{param1} and
  9356. @var{param2} accept integer positive values or 0. @var{param3} and
  9357. @var{param4} accept floating point values.
  9358. The default value for @var{param1} is 3. The default value for the
  9359. other parameters is 0.
  9360. These parameters correspond to the parameters assigned to the
  9361. libopencv function @code{cvSmooth}.
  9362. @section oscilloscope
  9363. 2D Video Oscilloscope.
  9364. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9365. It accepts the following parameters:
  9366. @table @option
  9367. @item x
  9368. Set scope center x position.
  9369. @item y
  9370. Set scope center y position.
  9371. @item s
  9372. Set scope size, relative to frame diagonal.
  9373. @item t
  9374. Set scope tilt/rotation.
  9375. @item o
  9376. Set trace opacity.
  9377. @item tx
  9378. Set trace center x position.
  9379. @item ty
  9380. Set trace center y position.
  9381. @item tw
  9382. Set trace width, relative to width of frame.
  9383. @item th
  9384. Set trace height, relative to height of frame.
  9385. @item c
  9386. Set which components to trace. By default it traces first three components.
  9387. @item g
  9388. Draw trace grid. By default is enabled.
  9389. @item st
  9390. Draw some statistics. By default is enabled.
  9391. @item sc
  9392. Draw scope. By default is enabled.
  9393. @end table
  9394. @subsection Examples
  9395. @itemize
  9396. @item
  9397. Inspect full first row of video frame.
  9398. @example
  9399. oscilloscope=x=0.5:y=0:s=1
  9400. @end example
  9401. @item
  9402. Inspect full last row of video frame.
  9403. @example
  9404. oscilloscope=x=0.5:y=1:s=1
  9405. @end example
  9406. @item
  9407. Inspect full 5th line of video frame of height 1080.
  9408. @example
  9409. oscilloscope=x=0.5:y=5/1080:s=1
  9410. @end example
  9411. @item
  9412. Inspect full last column of video frame.
  9413. @example
  9414. oscilloscope=x=1:y=0.5:s=1:t=1
  9415. @end example
  9416. @end itemize
  9417. @anchor{overlay}
  9418. @section overlay
  9419. Overlay one video on top of another.
  9420. It takes two inputs and has one output. The first input is the "main"
  9421. video on which the second input is overlaid.
  9422. It accepts the following parameters:
  9423. A description of the accepted options follows.
  9424. @table @option
  9425. @item x
  9426. @item y
  9427. Set the expression for the x and y coordinates of the overlaid video
  9428. on the main video. Default value is "0" for both expressions. In case
  9429. the expression is invalid, it is set to a huge value (meaning that the
  9430. overlay will not be displayed within the output visible area).
  9431. @item eof_action
  9432. See @ref{framesync}.
  9433. @item eval
  9434. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9435. It accepts the following values:
  9436. @table @samp
  9437. @item init
  9438. only evaluate expressions once during the filter initialization or
  9439. when a command is processed
  9440. @item frame
  9441. evaluate expressions for each incoming frame
  9442. @end table
  9443. Default value is @samp{frame}.
  9444. @item shortest
  9445. See @ref{framesync}.
  9446. @item format
  9447. Set the format for the output video.
  9448. It accepts the following values:
  9449. @table @samp
  9450. @item yuv420
  9451. force YUV420 output
  9452. @item yuv422
  9453. force YUV422 output
  9454. @item yuv444
  9455. force YUV444 output
  9456. @item rgb
  9457. force packed RGB output
  9458. @item gbrp
  9459. force planar RGB output
  9460. @item auto
  9461. automatically pick format
  9462. @end table
  9463. Default value is @samp{yuv420}.
  9464. @item repeatlast
  9465. See @ref{framesync}.
  9466. @item alpha
  9467. Set format of alpha of the overlaid video, it can be @var{straight} or
  9468. @var{premultiplied}. Default is @var{straight}.
  9469. @end table
  9470. The @option{x}, and @option{y} expressions can contain the following
  9471. parameters.
  9472. @table @option
  9473. @item main_w, W
  9474. @item main_h, H
  9475. The main input width and height.
  9476. @item overlay_w, w
  9477. @item overlay_h, h
  9478. The overlay input width and height.
  9479. @item x
  9480. @item y
  9481. The computed values for @var{x} and @var{y}. They are evaluated for
  9482. each new frame.
  9483. @item hsub
  9484. @item vsub
  9485. horizontal and vertical chroma subsample values of the output
  9486. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9487. @var{vsub} is 1.
  9488. @item n
  9489. the number of input frame, starting from 0
  9490. @item pos
  9491. the position in the file of the input frame, NAN if unknown
  9492. @item t
  9493. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9494. @end table
  9495. This filter also supports the @ref{framesync} options.
  9496. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9497. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9498. when @option{eval} is set to @samp{init}.
  9499. Be aware that frames are taken from each input video in timestamp
  9500. order, hence, if their initial timestamps differ, it is a good idea
  9501. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9502. have them begin in the same zero timestamp, as the example for
  9503. the @var{movie} filter does.
  9504. You can chain together more overlays but you should test the
  9505. efficiency of such approach.
  9506. @subsection Commands
  9507. This filter supports the following commands:
  9508. @table @option
  9509. @item x
  9510. @item y
  9511. Modify the x and y of the overlay input.
  9512. The command accepts the same syntax of the corresponding option.
  9513. If the specified expression is not valid, it is kept at its current
  9514. value.
  9515. @end table
  9516. @subsection Examples
  9517. @itemize
  9518. @item
  9519. Draw the overlay at 10 pixels from the bottom right corner of the main
  9520. video:
  9521. @example
  9522. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9523. @end example
  9524. Using named options the example above becomes:
  9525. @example
  9526. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9527. @end example
  9528. @item
  9529. Insert a transparent PNG logo in the bottom left corner of the input,
  9530. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9531. @example
  9532. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9533. @end example
  9534. @item
  9535. Insert 2 different transparent PNG logos (second logo on bottom
  9536. right corner) using the @command{ffmpeg} tool:
  9537. @example
  9538. 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
  9539. @end example
  9540. @item
  9541. Add a transparent color layer on top of the main video; @code{WxH}
  9542. must specify the size of the main input to the overlay filter:
  9543. @example
  9544. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9545. @end example
  9546. @item
  9547. Play an original video and a filtered version (here with the deshake
  9548. filter) side by side using the @command{ffplay} tool:
  9549. @example
  9550. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9551. @end example
  9552. The above command is the same as:
  9553. @example
  9554. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9555. @end example
  9556. @item
  9557. Make a sliding overlay appearing from the left to the right top part of the
  9558. screen starting since time 2:
  9559. @example
  9560. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9561. @end example
  9562. @item
  9563. Compose output by putting two input videos side to side:
  9564. @example
  9565. ffmpeg -i left.avi -i right.avi -filter_complex "
  9566. nullsrc=size=200x100 [background];
  9567. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9568. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9569. [background][left] overlay=shortest=1 [background+left];
  9570. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9571. "
  9572. @end example
  9573. @item
  9574. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9575. @example
  9576. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9577. -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]'
  9578. masked.avi
  9579. @end example
  9580. @item
  9581. Chain several overlays in cascade:
  9582. @example
  9583. nullsrc=s=200x200 [bg];
  9584. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9585. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9586. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9587. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9588. [in3] null, [mid2] overlay=100:100 [out0]
  9589. @end example
  9590. @end itemize
  9591. @section owdenoise
  9592. Apply Overcomplete Wavelet denoiser.
  9593. The filter accepts the following options:
  9594. @table @option
  9595. @item depth
  9596. Set depth.
  9597. Larger depth values will denoise lower frequency components more, but
  9598. slow down filtering.
  9599. Must be an int in the range 8-16, default is @code{8}.
  9600. @item luma_strength, ls
  9601. Set luma strength.
  9602. Must be a double value in the range 0-1000, default is @code{1.0}.
  9603. @item chroma_strength, cs
  9604. Set chroma strength.
  9605. Must be a double value in the range 0-1000, default is @code{1.0}.
  9606. @end table
  9607. @anchor{pad}
  9608. @section pad
  9609. Add paddings to the input image, and place the original input at the
  9610. provided @var{x}, @var{y} coordinates.
  9611. It accepts the following parameters:
  9612. @table @option
  9613. @item width, w
  9614. @item height, h
  9615. Specify an expression for the size of the output image with the
  9616. paddings added. If the value for @var{width} or @var{height} is 0, the
  9617. corresponding input size is used for the output.
  9618. The @var{width} expression can reference the value set by the
  9619. @var{height} expression, and vice versa.
  9620. The default value of @var{width} and @var{height} is 0.
  9621. @item x
  9622. @item y
  9623. Specify the offsets to place the input image at within the padded area,
  9624. with respect to the top/left border of the output image.
  9625. The @var{x} expression can reference the value set by the @var{y}
  9626. expression, and vice versa.
  9627. The default value of @var{x} and @var{y} is 0.
  9628. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9629. so the input image is centered on the padded area.
  9630. @item color
  9631. Specify the color of the padded area. For the syntax of this option,
  9632. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9633. manual,ffmpeg-utils}.
  9634. The default value of @var{color} is "black".
  9635. @item eval
  9636. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9637. It accepts the following values:
  9638. @table @samp
  9639. @item init
  9640. Only evaluate expressions once during the filter initialization or when
  9641. a command is processed.
  9642. @item frame
  9643. Evaluate expressions for each incoming frame.
  9644. @end table
  9645. Default value is @samp{init}.
  9646. @item aspect
  9647. Pad to aspect instead to a resolution.
  9648. @end table
  9649. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9650. options are expressions containing the following constants:
  9651. @table @option
  9652. @item in_w
  9653. @item in_h
  9654. The input video width and height.
  9655. @item iw
  9656. @item ih
  9657. These are the same as @var{in_w} and @var{in_h}.
  9658. @item out_w
  9659. @item out_h
  9660. The output width and height (the size of the padded area), as
  9661. specified by the @var{width} and @var{height} expressions.
  9662. @item ow
  9663. @item oh
  9664. These are the same as @var{out_w} and @var{out_h}.
  9665. @item x
  9666. @item y
  9667. The x and y offsets as specified by the @var{x} and @var{y}
  9668. expressions, or NAN if not yet specified.
  9669. @item a
  9670. same as @var{iw} / @var{ih}
  9671. @item sar
  9672. input sample aspect ratio
  9673. @item dar
  9674. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9675. @item hsub
  9676. @item vsub
  9677. The horizontal and vertical chroma subsample values. For example for the
  9678. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9679. @end table
  9680. @subsection Examples
  9681. @itemize
  9682. @item
  9683. Add paddings with the color "violet" to the input video. The output video
  9684. size is 640x480, and the top-left corner of the input video is placed at
  9685. column 0, row 40
  9686. @example
  9687. pad=640:480:0:40:violet
  9688. @end example
  9689. The example above is equivalent to the following command:
  9690. @example
  9691. pad=width=640:height=480:x=0:y=40:color=violet
  9692. @end example
  9693. @item
  9694. Pad the input to get an output with dimensions increased by 3/2,
  9695. and put the input video at the center of the padded area:
  9696. @example
  9697. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9698. @end example
  9699. @item
  9700. Pad the input to get a squared output with size equal to the maximum
  9701. value between the input width and height, and put the input video at
  9702. the center of the padded area:
  9703. @example
  9704. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9705. @end example
  9706. @item
  9707. Pad the input to get a final w/h ratio of 16:9:
  9708. @example
  9709. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9710. @end example
  9711. @item
  9712. In case of anamorphic video, in order to set the output display aspect
  9713. correctly, it is necessary to use @var{sar} in the expression,
  9714. according to the relation:
  9715. @example
  9716. (ih * X / ih) * sar = output_dar
  9717. X = output_dar / sar
  9718. @end example
  9719. Thus the previous example needs to be modified to:
  9720. @example
  9721. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9722. @end example
  9723. @item
  9724. Double the output size and put the input video in the bottom-right
  9725. corner of the output padded area:
  9726. @example
  9727. pad="2*iw:2*ih:ow-iw:oh-ih"
  9728. @end example
  9729. @end itemize
  9730. @anchor{palettegen}
  9731. @section palettegen
  9732. Generate one palette for a whole video stream.
  9733. It accepts the following options:
  9734. @table @option
  9735. @item max_colors
  9736. Set the maximum number of colors to quantize in the palette.
  9737. Note: the palette will still contain 256 colors; the unused palette entries
  9738. will be black.
  9739. @item reserve_transparent
  9740. Create a palette of 255 colors maximum and reserve the last one for
  9741. transparency. Reserving the transparency color is useful for GIF optimization.
  9742. If not set, the maximum of colors in the palette will be 256. You probably want
  9743. to disable this option for a standalone image.
  9744. Set by default.
  9745. @item transparency_color
  9746. Set the color that will be used as background for transparency.
  9747. @item stats_mode
  9748. Set statistics mode.
  9749. It accepts the following values:
  9750. @table @samp
  9751. @item full
  9752. Compute full frame histograms.
  9753. @item diff
  9754. Compute histograms only for the part that differs from previous frame. This
  9755. might be relevant to give more importance to the moving part of your input if
  9756. the background is static.
  9757. @item single
  9758. Compute new histogram for each frame.
  9759. @end table
  9760. Default value is @var{full}.
  9761. @end table
  9762. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9763. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9764. color quantization of the palette. This information is also visible at
  9765. @var{info} logging level.
  9766. @subsection Examples
  9767. @itemize
  9768. @item
  9769. Generate a representative palette of a given video using @command{ffmpeg}:
  9770. @example
  9771. ffmpeg -i input.mkv -vf palettegen palette.png
  9772. @end example
  9773. @end itemize
  9774. @section paletteuse
  9775. Use a palette to downsample an input video stream.
  9776. The filter takes two inputs: one video stream and a palette. The palette must
  9777. be a 256 pixels image.
  9778. It accepts the following options:
  9779. @table @option
  9780. @item dither
  9781. Select dithering mode. Available algorithms are:
  9782. @table @samp
  9783. @item bayer
  9784. Ordered 8x8 bayer dithering (deterministic)
  9785. @item heckbert
  9786. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9787. Note: this dithering is sometimes considered "wrong" and is included as a
  9788. reference.
  9789. @item floyd_steinberg
  9790. Floyd and Steingberg dithering (error diffusion)
  9791. @item sierra2
  9792. Frankie Sierra dithering v2 (error diffusion)
  9793. @item sierra2_4a
  9794. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9795. @end table
  9796. Default is @var{sierra2_4a}.
  9797. @item bayer_scale
  9798. When @var{bayer} dithering is selected, this option defines the scale of the
  9799. pattern (how much the crosshatch pattern is visible). A low value means more
  9800. visible pattern for less banding, and higher value means less visible pattern
  9801. at the cost of more banding.
  9802. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9803. @item diff_mode
  9804. If set, define the zone to process
  9805. @table @samp
  9806. @item rectangle
  9807. Only the changing rectangle will be reprocessed. This is similar to GIF
  9808. cropping/offsetting compression mechanism. This option can be useful for speed
  9809. if only a part of the image is changing, and has use cases such as limiting the
  9810. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9811. moving scene (it leads to more deterministic output if the scene doesn't change
  9812. much, and as a result less moving noise and better GIF compression).
  9813. @end table
  9814. Default is @var{none}.
  9815. @item new
  9816. Take new palette for each output frame.
  9817. @item alpha_threshold
  9818. Sets the alpha threshold for transparency. Alpha values above this threshold
  9819. will be treated as completely opaque, and values below this threshold will be
  9820. treated as completely transparent.
  9821. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9822. @end table
  9823. @subsection Examples
  9824. @itemize
  9825. @item
  9826. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9827. using @command{ffmpeg}:
  9828. @example
  9829. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9830. @end example
  9831. @end itemize
  9832. @section perspective
  9833. Correct perspective of video not recorded perpendicular to the screen.
  9834. A description of the accepted parameters follows.
  9835. @table @option
  9836. @item x0
  9837. @item y0
  9838. @item x1
  9839. @item y1
  9840. @item x2
  9841. @item y2
  9842. @item x3
  9843. @item y3
  9844. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9845. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9846. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9847. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9848. then the corners of the source will be sent to the specified coordinates.
  9849. The expressions can use the following variables:
  9850. @table @option
  9851. @item W
  9852. @item H
  9853. the width and height of video frame.
  9854. @item in
  9855. Input frame count.
  9856. @item on
  9857. Output frame count.
  9858. @end table
  9859. @item interpolation
  9860. Set interpolation for perspective correction.
  9861. It accepts the following values:
  9862. @table @samp
  9863. @item linear
  9864. @item cubic
  9865. @end table
  9866. Default value is @samp{linear}.
  9867. @item sense
  9868. Set interpretation of coordinate options.
  9869. It accepts the following values:
  9870. @table @samp
  9871. @item 0, source
  9872. Send point in the source specified by the given coordinates to
  9873. the corners of the destination.
  9874. @item 1, destination
  9875. Send the corners of the source to the point in the destination specified
  9876. by the given coordinates.
  9877. Default value is @samp{source}.
  9878. @end table
  9879. @item eval
  9880. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9881. It accepts the following values:
  9882. @table @samp
  9883. @item init
  9884. only evaluate expressions once during the filter initialization or
  9885. when a command is processed
  9886. @item frame
  9887. evaluate expressions for each incoming frame
  9888. @end table
  9889. Default value is @samp{init}.
  9890. @end table
  9891. @section phase
  9892. Delay interlaced video by one field time so that the field order changes.
  9893. The intended use is to fix PAL movies that have been captured with the
  9894. opposite field order to the film-to-video transfer.
  9895. A description of the accepted parameters follows.
  9896. @table @option
  9897. @item mode
  9898. Set phase mode.
  9899. It accepts the following values:
  9900. @table @samp
  9901. @item t
  9902. Capture field order top-first, transfer bottom-first.
  9903. Filter will delay the bottom field.
  9904. @item b
  9905. Capture field order bottom-first, transfer top-first.
  9906. Filter will delay the top field.
  9907. @item p
  9908. Capture and transfer with the same field order. This mode only exists
  9909. for the documentation of the other options to refer to, but if you
  9910. actually select it, the filter will faithfully do nothing.
  9911. @item a
  9912. Capture field order determined automatically by field flags, transfer
  9913. opposite.
  9914. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9915. basis using field flags. If no field information is available,
  9916. then this works just like @samp{u}.
  9917. @item u
  9918. Capture unknown or varying, transfer opposite.
  9919. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9920. analyzing the images and selecting the alternative that produces best
  9921. match between the fields.
  9922. @item T
  9923. Capture top-first, transfer unknown or varying.
  9924. Filter selects among @samp{t} and @samp{p} using image analysis.
  9925. @item B
  9926. Capture bottom-first, transfer unknown or varying.
  9927. Filter selects among @samp{b} and @samp{p} using image analysis.
  9928. @item A
  9929. Capture determined by field flags, transfer unknown or varying.
  9930. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9931. image analysis. If no field information is available, then this works just
  9932. like @samp{U}. This is the default mode.
  9933. @item U
  9934. Both capture and transfer unknown or varying.
  9935. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9936. @end table
  9937. @end table
  9938. @section pixdesctest
  9939. Pixel format descriptor test filter, mainly useful for internal
  9940. testing. The output video should be equal to the input video.
  9941. For example:
  9942. @example
  9943. format=monow, pixdesctest
  9944. @end example
  9945. can be used to test the monowhite pixel format descriptor definition.
  9946. @section pixscope
  9947. Display sample values of color channels. Mainly useful for checking color
  9948. and levels. Minimum supported resolution is 640x480.
  9949. The filters accept the following options:
  9950. @table @option
  9951. @item x
  9952. Set scope X position, relative offset on X axis.
  9953. @item y
  9954. Set scope Y position, relative offset on Y axis.
  9955. @item w
  9956. Set scope width.
  9957. @item h
  9958. Set scope height.
  9959. @item o
  9960. Set window opacity. This window also holds statistics about pixel area.
  9961. @item wx
  9962. Set window X position, relative offset on X axis.
  9963. @item wy
  9964. Set window Y position, relative offset on Y axis.
  9965. @end table
  9966. @section pp
  9967. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9968. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9969. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9970. Each subfilter and some options have a short and a long name that can be used
  9971. interchangeably, i.e. dr/dering are the same.
  9972. The filters accept the following options:
  9973. @table @option
  9974. @item subfilters
  9975. Set postprocessing subfilters string.
  9976. @end table
  9977. All subfilters share common options to determine their scope:
  9978. @table @option
  9979. @item a/autoq
  9980. Honor the quality commands for this subfilter.
  9981. @item c/chrom
  9982. Do chrominance filtering, too (default).
  9983. @item y/nochrom
  9984. Do luminance filtering only (no chrominance).
  9985. @item n/noluma
  9986. Do chrominance filtering only (no luminance).
  9987. @end table
  9988. These options can be appended after the subfilter name, separated by a '|'.
  9989. Available subfilters are:
  9990. @table @option
  9991. @item hb/hdeblock[|difference[|flatness]]
  9992. Horizontal deblocking filter
  9993. @table @option
  9994. @item difference
  9995. Difference factor where higher values mean more deblocking (default: @code{32}).
  9996. @item flatness
  9997. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9998. @end table
  9999. @item vb/vdeblock[|difference[|flatness]]
  10000. Vertical deblocking filter
  10001. @table @option
  10002. @item difference
  10003. Difference factor where higher values mean more deblocking (default: @code{32}).
  10004. @item flatness
  10005. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10006. @end table
  10007. @item ha/hadeblock[|difference[|flatness]]
  10008. Accurate horizontal deblocking filter
  10009. @table @option
  10010. @item difference
  10011. Difference factor where higher values mean more deblocking (default: @code{32}).
  10012. @item flatness
  10013. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10014. @end table
  10015. @item va/vadeblock[|difference[|flatness]]
  10016. Accurate vertical deblocking filter
  10017. @table @option
  10018. @item difference
  10019. Difference factor where higher values mean more deblocking (default: @code{32}).
  10020. @item flatness
  10021. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10022. @end table
  10023. @end table
  10024. The horizontal and vertical deblocking filters share the difference and
  10025. flatness values so you cannot set different horizontal and vertical
  10026. thresholds.
  10027. @table @option
  10028. @item h1/x1hdeblock
  10029. Experimental horizontal deblocking filter
  10030. @item v1/x1vdeblock
  10031. Experimental vertical deblocking filter
  10032. @item dr/dering
  10033. Deringing filter
  10034. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10035. @table @option
  10036. @item threshold1
  10037. larger -> stronger filtering
  10038. @item threshold2
  10039. larger -> stronger filtering
  10040. @item threshold3
  10041. larger -> stronger filtering
  10042. @end table
  10043. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10044. @table @option
  10045. @item f/fullyrange
  10046. Stretch luminance to @code{0-255}.
  10047. @end table
  10048. @item lb/linblenddeint
  10049. Linear blend deinterlacing filter that deinterlaces the given block by
  10050. filtering all lines with a @code{(1 2 1)} filter.
  10051. @item li/linipoldeint
  10052. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10053. linearly interpolating every second line.
  10054. @item ci/cubicipoldeint
  10055. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10056. cubically interpolating every second line.
  10057. @item md/mediandeint
  10058. Median deinterlacing filter that deinterlaces the given block by applying a
  10059. median filter to every second line.
  10060. @item fd/ffmpegdeint
  10061. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10062. second line with a @code{(-1 4 2 4 -1)} filter.
  10063. @item l5/lowpass5
  10064. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10065. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10066. @item fq/forceQuant[|quantizer]
  10067. Overrides the quantizer table from the input with the constant quantizer you
  10068. specify.
  10069. @table @option
  10070. @item quantizer
  10071. Quantizer to use
  10072. @end table
  10073. @item de/default
  10074. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10075. @item fa/fast
  10076. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10077. @item ac
  10078. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10079. @end table
  10080. @subsection Examples
  10081. @itemize
  10082. @item
  10083. Apply horizontal and vertical deblocking, deringing and automatic
  10084. brightness/contrast:
  10085. @example
  10086. pp=hb/vb/dr/al
  10087. @end example
  10088. @item
  10089. Apply default filters without brightness/contrast correction:
  10090. @example
  10091. pp=de/-al
  10092. @end example
  10093. @item
  10094. Apply default filters and temporal denoiser:
  10095. @example
  10096. pp=default/tmpnoise|1|2|3
  10097. @end example
  10098. @item
  10099. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10100. automatically depending on available CPU time:
  10101. @example
  10102. pp=hb|y/vb|a
  10103. @end example
  10104. @end itemize
  10105. @section pp7
  10106. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10107. similar to spp = 6 with 7 point DCT, where only the center sample is
  10108. used after IDCT.
  10109. The filter accepts the following options:
  10110. @table @option
  10111. @item qp
  10112. Force a constant quantization parameter. It accepts an integer in range
  10113. 0 to 63. If not set, the filter will use the QP from the video stream
  10114. (if available).
  10115. @item mode
  10116. Set thresholding mode. Available modes are:
  10117. @table @samp
  10118. @item hard
  10119. Set hard thresholding.
  10120. @item soft
  10121. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10122. @item medium
  10123. Set medium thresholding (good results, default).
  10124. @end table
  10125. @end table
  10126. @section premultiply
  10127. Apply alpha premultiply effect to input video stream using first plane
  10128. of second stream as alpha.
  10129. Both streams must have same dimensions and same pixel format.
  10130. The filter accepts the following option:
  10131. @table @option
  10132. @item planes
  10133. Set which planes will be processed, unprocessed planes will be copied.
  10134. By default value 0xf, all planes will be processed.
  10135. @item inplace
  10136. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10137. @end table
  10138. @section prewitt
  10139. Apply prewitt operator to input video stream.
  10140. The filter accepts the following option:
  10141. @table @option
  10142. @item planes
  10143. Set which planes will be processed, unprocessed planes will be copied.
  10144. By default value 0xf, all planes will be processed.
  10145. @item scale
  10146. Set value which will be multiplied with filtered result.
  10147. @item delta
  10148. Set value which will be added to filtered result.
  10149. @end table
  10150. @anchor{program_opencl}
  10151. @section program_opencl
  10152. Filter video using an OpenCL program.
  10153. @table @option
  10154. @item source
  10155. OpenCL program source file.
  10156. @item kernel
  10157. Kernel name in program.
  10158. @item inputs
  10159. Number of inputs to the filter. Defaults to 1.
  10160. @item size, s
  10161. Size of output frames. Defaults to the same as the first input.
  10162. @end table
  10163. The program source file must contain a kernel function with the given name,
  10164. which will be run once for each plane of the output. Each run on a plane
  10165. gets enqueued as a separate 2D global NDRange with one work-item for each
  10166. pixel to be generated. The global ID offset for each work-item is therefore
  10167. the coordinates of a pixel in the destination image.
  10168. The kernel function needs to take the following arguments:
  10169. @itemize
  10170. @item
  10171. Destination image, @var{__write_only image2d_t}.
  10172. This image will become the output; the kernel should write all of it.
  10173. @item
  10174. Frame index, @var{unsigned int}.
  10175. This is a counter starting from zero and increasing by one for each frame.
  10176. @item
  10177. Source images, @var{__read_only image2d_t}.
  10178. These are the most recent images on each input. The kernel may read from
  10179. them to generate the output, but they can't be written to.
  10180. @end itemize
  10181. Example programs:
  10182. @itemize
  10183. @item
  10184. Copy the input to the output (output must be the same size as the input).
  10185. @verbatim
  10186. __kernel void copy(__write_only image2d_t destination,
  10187. unsigned int index,
  10188. __read_only image2d_t source)
  10189. {
  10190. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10191. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10192. float4 value = read_imagef(source, sampler, location);
  10193. write_imagef(destination, location, value);
  10194. }
  10195. @end verbatim
  10196. @item
  10197. Apply a simple transformation, rotating the input by an amount increasing
  10198. with the index counter. Pixel values are linearly interpolated by the
  10199. sampler, and the output need not have the same dimensions as the input.
  10200. @verbatim
  10201. __kernel void rotate_image(__write_only image2d_t dst,
  10202. unsigned int index,
  10203. __read_only image2d_t src)
  10204. {
  10205. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10206. CLK_FILTER_LINEAR);
  10207. float angle = (float)index / 100.0f;
  10208. float2 dst_dim = convert_float2(get_image_dim(dst));
  10209. float2 src_dim = convert_float2(get_image_dim(src));
  10210. float2 dst_cen = dst_dim / 2.0f;
  10211. float2 src_cen = src_dim / 2.0f;
  10212. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10213. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10214. float2 src_pos = {
  10215. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10216. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10217. };
  10218. src_pos = src_pos * src_dim / dst_dim;
  10219. float2 src_loc = src_pos + src_cen;
  10220. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10221. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10222. write_imagef(dst, dst_loc, 0.5f);
  10223. else
  10224. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10225. }
  10226. @end verbatim
  10227. @item
  10228. Blend two inputs together, with the amount of each input used varying
  10229. with the index counter.
  10230. @verbatim
  10231. __kernel void blend_images(__write_only image2d_t dst,
  10232. unsigned int index,
  10233. __read_only image2d_t src1,
  10234. __read_only image2d_t src2)
  10235. {
  10236. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10237. CLK_FILTER_LINEAR);
  10238. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10239. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10240. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10241. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10242. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10243. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10244. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10245. }
  10246. @end verbatim
  10247. @end itemize
  10248. @section pseudocolor
  10249. Alter frame colors in video with pseudocolors.
  10250. This filter accept the following options:
  10251. @table @option
  10252. @item c0
  10253. set pixel first component expression
  10254. @item c1
  10255. set pixel second component expression
  10256. @item c2
  10257. set pixel third component expression
  10258. @item c3
  10259. set pixel fourth component expression, corresponds to the alpha component
  10260. @item i
  10261. set component to use as base for altering colors
  10262. @end table
  10263. Each of them specifies the expression to use for computing the lookup table for
  10264. the corresponding pixel component values.
  10265. The expressions can contain the following constants and functions:
  10266. @table @option
  10267. @item w
  10268. @item h
  10269. The input width and height.
  10270. @item val
  10271. The input value for the pixel component.
  10272. @item ymin, umin, vmin, amin
  10273. The minimum allowed component value.
  10274. @item ymax, umax, vmax, amax
  10275. The maximum allowed component value.
  10276. @end table
  10277. All expressions default to "val".
  10278. @subsection Examples
  10279. @itemize
  10280. @item
  10281. Change too high luma values to gradient:
  10282. @example
  10283. 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'"
  10284. @end example
  10285. @end itemize
  10286. @section psnr
  10287. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10288. Ratio) between two input videos.
  10289. This filter takes in input two input videos, the first input is
  10290. considered the "main" source and is passed unchanged to the
  10291. output. The second input is used as a "reference" video for computing
  10292. the PSNR.
  10293. Both video inputs must have the same resolution and pixel format for
  10294. this filter to work correctly. Also it assumes that both inputs
  10295. have the same number of frames, which are compared one by one.
  10296. The obtained average PSNR is printed through the logging system.
  10297. The filter stores the accumulated MSE (mean squared error) of each
  10298. frame, and at the end of the processing it is averaged across all frames
  10299. equally, and the following formula is applied to obtain the PSNR:
  10300. @example
  10301. PSNR = 10*log10(MAX^2/MSE)
  10302. @end example
  10303. Where MAX is the average of the maximum values of each component of the
  10304. image.
  10305. The description of the accepted parameters follows.
  10306. @table @option
  10307. @item stats_file, f
  10308. If specified the filter will use the named file to save the PSNR of
  10309. each individual frame. When filename equals "-" the data is sent to
  10310. standard output.
  10311. @item stats_version
  10312. Specifies which version of the stats file format to use. Details of
  10313. each format are written below.
  10314. Default value is 1.
  10315. @item stats_add_max
  10316. Determines whether the max value is output to the stats log.
  10317. Default value is 0.
  10318. Requires stats_version >= 2. If this is set and stats_version < 2,
  10319. the filter will return an error.
  10320. @end table
  10321. This filter also supports the @ref{framesync} options.
  10322. The file printed if @var{stats_file} is selected, contains a sequence of
  10323. key/value pairs of the form @var{key}:@var{value} for each compared
  10324. couple of frames.
  10325. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10326. the list of per-frame-pair stats, with key value pairs following the frame
  10327. format with the following parameters:
  10328. @table @option
  10329. @item psnr_log_version
  10330. The version of the log file format. Will match @var{stats_version}.
  10331. @item fields
  10332. A comma separated list of the per-frame-pair parameters included in
  10333. the log.
  10334. @end table
  10335. A description of each shown per-frame-pair parameter follows:
  10336. @table @option
  10337. @item n
  10338. sequential number of the input frame, starting from 1
  10339. @item mse_avg
  10340. Mean Square Error pixel-by-pixel average difference of the compared
  10341. frames, averaged over all the image components.
  10342. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10343. Mean Square Error pixel-by-pixel average difference of the compared
  10344. frames for the component specified by the suffix.
  10345. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10346. Peak Signal to Noise ratio of the compared frames for the component
  10347. specified by the suffix.
  10348. @item max_avg, max_y, max_u, max_v
  10349. Maximum allowed value for each channel, and average over all
  10350. channels.
  10351. @end table
  10352. For example:
  10353. @example
  10354. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10355. [main][ref] psnr="stats_file=stats.log" [out]
  10356. @end example
  10357. On this example the input file being processed is compared with the
  10358. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10359. is stored in @file{stats.log}.
  10360. @anchor{pullup}
  10361. @section pullup
  10362. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10363. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10364. content.
  10365. The pullup filter is designed to take advantage of future context in making
  10366. its decisions. This filter is stateless in the sense that it does not lock
  10367. onto a pattern to follow, but it instead looks forward to the following
  10368. fields in order to identify matches and rebuild progressive frames.
  10369. To produce content with an even framerate, insert the fps filter after
  10370. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10371. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10372. The filter accepts the following options:
  10373. @table @option
  10374. @item jl
  10375. @item jr
  10376. @item jt
  10377. @item jb
  10378. These options set the amount of "junk" to ignore at the left, right, top, and
  10379. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10380. while top and bottom are in units of 2 lines.
  10381. The default is 8 pixels on each side.
  10382. @item sb
  10383. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10384. filter generating an occasional mismatched frame, but it may also cause an
  10385. excessive number of frames to be dropped during high motion sequences.
  10386. Conversely, setting it to -1 will make filter match fields more easily.
  10387. This may help processing of video where there is slight blurring between
  10388. the fields, but may also cause there to be interlaced frames in the output.
  10389. Default value is @code{0}.
  10390. @item mp
  10391. Set the metric plane to use. It accepts the following values:
  10392. @table @samp
  10393. @item l
  10394. Use luma plane.
  10395. @item u
  10396. Use chroma blue plane.
  10397. @item v
  10398. Use chroma red plane.
  10399. @end table
  10400. This option may be set to use chroma plane instead of the default luma plane
  10401. for doing filter's computations. This may improve accuracy on very clean
  10402. source material, but more likely will decrease accuracy, especially if there
  10403. is chroma noise (rainbow effect) or any grayscale video.
  10404. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10405. load and make pullup usable in realtime on slow machines.
  10406. @end table
  10407. For best results (without duplicated frames in the output file) it is
  10408. necessary to change the output frame rate. For example, to inverse
  10409. telecine NTSC input:
  10410. @example
  10411. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10412. @end example
  10413. @section qp
  10414. Change video quantization parameters (QP).
  10415. The filter accepts the following option:
  10416. @table @option
  10417. @item qp
  10418. Set expression for quantization parameter.
  10419. @end table
  10420. The expression is evaluated through the eval API and can contain, among others,
  10421. the following constants:
  10422. @table @var
  10423. @item known
  10424. 1 if index is not 129, 0 otherwise.
  10425. @item qp
  10426. Sequential index starting from -129 to 128.
  10427. @end table
  10428. @subsection Examples
  10429. @itemize
  10430. @item
  10431. Some equation like:
  10432. @example
  10433. qp=2+2*sin(PI*qp)
  10434. @end example
  10435. @end itemize
  10436. @section random
  10437. Flush video frames from internal cache of frames into a random order.
  10438. No frame is discarded.
  10439. Inspired by @ref{frei0r} nervous filter.
  10440. @table @option
  10441. @item frames
  10442. Set size in number of frames of internal cache, in range from @code{2} to
  10443. @code{512}. Default is @code{30}.
  10444. @item seed
  10445. Set seed for random number generator, must be an integer included between
  10446. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10447. less than @code{0}, the filter will try to use a good random seed on a
  10448. best effort basis.
  10449. @end table
  10450. @section readeia608
  10451. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10452. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10453. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10454. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10455. @table @option
  10456. @item lavfi.readeia608.X.cc
  10457. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10458. @item lavfi.readeia608.X.line
  10459. The number of the line on which the EIA-608 data was identified and read.
  10460. @end table
  10461. This filter accepts the following options:
  10462. @table @option
  10463. @item scan_min
  10464. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10465. @item scan_max
  10466. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10467. @item mac
  10468. Set minimal acceptable amplitude change for sync codes detection.
  10469. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10470. @item spw
  10471. Set the ratio of width reserved for sync code detection.
  10472. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10473. @item mhd
  10474. Set the max peaks height difference for sync code detection.
  10475. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10476. @item mpd
  10477. Set max peaks period difference for sync code detection.
  10478. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10479. @item msd
  10480. Set the first two max start code bits differences.
  10481. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10482. @item bhd
  10483. Set the minimum ratio of bits height compared to 3rd start code bit.
  10484. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10485. @item th_w
  10486. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10487. @item th_b
  10488. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10489. @item chp
  10490. Enable checking the parity bit. In the event of a parity error, the filter will output
  10491. @code{0x00} for that character. Default is false.
  10492. @end table
  10493. @subsection Examples
  10494. @itemize
  10495. @item
  10496. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10497. @example
  10498. 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
  10499. @end example
  10500. @end itemize
  10501. @section readvitc
  10502. Read vertical interval timecode (VITC) information from the top lines of a
  10503. video frame.
  10504. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10505. timecode value, if a valid timecode has been detected. Further metadata key
  10506. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10507. timecode data has been found or not.
  10508. This filter accepts the following options:
  10509. @table @option
  10510. @item scan_max
  10511. Set the maximum number of lines to scan for VITC data. If the value is set to
  10512. @code{-1} the full video frame is scanned. Default is @code{45}.
  10513. @item thr_b
  10514. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10515. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10516. @item thr_w
  10517. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10518. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10519. @end table
  10520. @subsection Examples
  10521. @itemize
  10522. @item
  10523. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10524. draw @code{--:--:--:--} as a placeholder:
  10525. @example
  10526. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10527. @end example
  10528. @end itemize
  10529. @section remap
  10530. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10531. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10532. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10533. value for pixel will be used for destination pixel.
  10534. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10535. will have Xmap/Ymap video stream dimensions.
  10536. Xmap and Ymap input video streams are 16bit depth, single channel.
  10537. @section removegrain
  10538. The removegrain filter is a spatial denoiser for progressive video.
  10539. @table @option
  10540. @item m0
  10541. Set mode for the first plane.
  10542. @item m1
  10543. Set mode for the second plane.
  10544. @item m2
  10545. Set mode for the third plane.
  10546. @item m3
  10547. Set mode for the fourth plane.
  10548. @end table
  10549. Range of mode is from 0 to 24. Description of each mode follows:
  10550. @table @var
  10551. @item 0
  10552. Leave input plane unchanged. Default.
  10553. @item 1
  10554. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10555. @item 2
  10556. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10557. @item 3
  10558. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10559. @item 4
  10560. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10561. This is equivalent to a median filter.
  10562. @item 5
  10563. Line-sensitive clipping giving the minimal change.
  10564. @item 6
  10565. Line-sensitive clipping, intermediate.
  10566. @item 7
  10567. Line-sensitive clipping, intermediate.
  10568. @item 8
  10569. Line-sensitive clipping, intermediate.
  10570. @item 9
  10571. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10572. @item 10
  10573. Replaces the target pixel with the closest neighbour.
  10574. @item 11
  10575. [1 2 1] horizontal and vertical kernel blur.
  10576. @item 12
  10577. Same as mode 11.
  10578. @item 13
  10579. Bob mode, interpolates top field from the line where the neighbours
  10580. pixels are the closest.
  10581. @item 14
  10582. Bob mode, interpolates bottom field from the line where the neighbours
  10583. pixels are the closest.
  10584. @item 15
  10585. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10586. interpolation formula.
  10587. @item 16
  10588. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10589. interpolation formula.
  10590. @item 17
  10591. Clips the pixel with the minimum and maximum of respectively the maximum and
  10592. minimum of each pair of opposite neighbour pixels.
  10593. @item 18
  10594. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10595. the current pixel is minimal.
  10596. @item 19
  10597. Replaces the pixel with the average of its 8 neighbours.
  10598. @item 20
  10599. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10600. @item 21
  10601. Clips pixels using the averages of opposite neighbour.
  10602. @item 22
  10603. Same as mode 21 but simpler and faster.
  10604. @item 23
  10605. Small edge and halo removal, but reputed useless.
  10606. @item 24
  10607. Similar as 23.
  10608. @end table
  10609. @section removelogo
  10610. Suppress a TV station logo, using an image file to determine which
  10611. pixels comprise the logo. It works by filling in the pixels that
  10612. comprise the logo with neighboring pixels.
  10613. The filter accepts the following options:
  10614. @table @option
  10615. @item filename, f
  10616. Set the filter bitmap file, which can be any image format supported by
  10617. libavformat. The width and height of the image file must match those of the
  10618. video stream being processed.
  10619. @end table
  10620. Pixels in the provided bitmap image with a value of zero are not
  10621. considered part of the logo, non-zero pixels are considered part of
  10622. the logo. If you use white (255) for the logo and black (0) for the
  10623. rest, you will be safe. For making the filter bitmap, it is
  10624. recommended to take a screen capture of a black frame with the logo
  10625. visible, and then using a threshold filter followed by the erode
  10626. filter once or twice.
  10627. If needed, little splotches can be fixed manually. Remember that if
  10628. logo pixels are not covered, the filter quality will be much
  10629. reduced. Marking too many pixels as part of the logo does not hurt as
  10630. much, but it will increase the amount of blurring needed to cover over
  10631. the image and will destroy more information than necessary, and extra
  10632. pixels will slow things down on a large logo.
  10633. @section repeatfields
  10634. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10635. fields based on its value.
  10636. @section reverse
  10637. Reverse a video clip.
  10638. Warning: This filter requires memory to buffer the entire clip, so trimming
  10639. is suggested.
  10640. @subsection Examples
  10641. @itemize
  10642. @item
  10643. Take the first 5 seconds of a clip, and reverse it.
  10644. @example
  10645. trim=end=5,reverse
  10646. @end example
  10647. @end itemize
  10648. @section roberts
  10649. Apply roberts cross operator to input video stream.
  10650. The filter accepts the following option:
  10651. @table @option
  10652. @item planes
  10653. Set which planes will be processed, unprocessed planes will be copied.
  10654. By default value 0xf, all planes will be processed.
  10655. @item scale
  10656. Set value which will be multiplied with filtered result.
  10657. @item delta
  10658. Set value which will be added to filtered result.
  10659. @end table
  10660. @section rotate
  10661. Rotate video by an arbitrary angle expressed in radians.
  10662. The filter accepts the following options:
  10663. A description of the optional parameters follows.
  10664. @table @option
  10665. @item angle, a
  10666. Set an expression for the angle by which to rotate the input video
  10667. clockwise, expressed as a number of radians. A negative value will
  10668. result in a counter-clockwise rotation. By default it is set to "0".
  10669. This expression is evaluated for each frame.
  10670. @item out_w, ow
  10671. Set the output width expression, default value is "iw".
  10672. This expression is evaluated just once during configuration.
  10673. @item out_h, oh
  10674. Set the output height expression, default value is "ih".
  10675. This expression is evaluated just once during configuration.
  10676. @item bilinear
  10677. Enable bilinear interpolation if set to 1, a value of 0 disables
  10678. it. Default value is 1.
  10679. @item fillcolor, c
  10680. Set the color used to fill the output area not covered by the rotated
  10681. image. For the general syntax of this option, check the
  10682. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10683. If the special value "none" is selected then no
  10684. background is printed (useful for example if the background is never shown).
  10685. Default value is "black".
  10686. @end table
  10687. The expressions for the angle and the output size can contain the
  10688. following constants and functions:
  10689. @table @option
  10690. @item n
  10691. sequential number of the input frame, starting from 0. It is always NAN
  10692. before the first frame is filtered.
  10693. @item t
  10694. time in seconds of the input frame, it is set to 0 when the filter is
  10695. configured. It is always NAN before the first frame is filtered.
  10696. @item hsub
  10697. @item vsub
  10698. horizontal and vertical chroma subsample values. For example for the
  10699. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10700. @item in_w, iw
  10701. @item in_h, ih
  10702. the input video width and height
  10703. @item out_w, ow
  10704. @item out_h, oh
  10705. the output width and height, that is the size of the padded area as
  10706. specified by the @var{width} and @var{height} expressions
  10707. @item rotw(a)
  10708. @item roth(a)
  10709. the minimal width/height required for completely containing the input
  10710. video rotated by @var{a} radians.
  10711. These are only available when computing the @option{out_w} and
  10712. @option{out_h} expressions.
  10713. @end table
  10714. @subsection Examples
  10715. @itemize
  10716. @item
  10717. Rotate the input by PI/6 radians clockwise:
  10718. @example
  10719. rotate=PI/6
  10720. @end example
  10721. @item
  10722. Rotate the input by PI/6 radians counter-clockwise:
  10723. @example
  10724. rotate=-PI/6
  10725. @end example
  10726. @item
  10727. Rotate the input by 45 degrees clockwise:
  10728. @example
  10729. rotate=45*PI/180
  10730. @end example
  10731. @item
  10732. Apply a constant rotation with period T, starting from an angle of PI/3:
  10733. @example
  10734. rotate=PI/3+2*PI*t/T
  10735. @end example
  10736. @item
  10737. Make the input video rotation oscillating with a period of T
  10738. seconds and an amplitude of A radians:
  10739. @example
  10740. rotate=A*sin(2*PI/T*t)
  10741. @end example
  10742. @item
  10743. Rotate the video, output size is chosen so that the whole rotating
  10744. input video is always completely contained in the output:
  10745. @example
  10746. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10747. @end example
  10748. @item
  10749. Rotate the video, reduce the output size so that no background is ever
  10750. shown:
  10751. @example
  10752. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10753. @end example
  10754. @end itemize
  10755. @subsection Commands
  10756. The filter supports the following commands:
  10757. @table @option
  10758. @item a, angle
  10759. Set the angle expression.
  10760. The command accepts the same syntax of the corresponding option.
  10761. If the specified expression is not valid, it is kept at its current
  10762. value.
  10763. @end table
  10764. @section sab
  10765. Apply Shape Adaptive Blur.
  10766. The filter accepts the following options:
  10767. @table @option
  10768. @item luma_radius, lr
  10769. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10770. value is 1.0. A greater value will result in a more blurred image, and
  10771. in slower processing.
  10772. @item luma_pre_filter_radius, lpfr
  10773. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10774. value is 1.0.
  10775. @item luma_strength, ls
  10776. Set luma maximum difference between pixels to still be considered, must
  10777. be a value in the 0.1-100.0 range, default value is 1.0.
  10778. @item chroma_radius, cr
  10779. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10780. greater value will result in a more blurred image, and in slower
  10781. processing.
  10782. @item chroma_pre_filter_radius, cpfr
  10783. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10784. @item chroma_strength, cs
  10785. Set chroma maximum difference between pixels to still be considered,
  10786. must be a value in the -0.9-100.0 range.
  10787. @end table
  10788. Each chroma option value, if not explicitly specified, is set to the
  10789. corresponding luma option value.
  10790. @anchor{scale}
  10791. @section scale
  10792. Scale (resize) the input video, using the libswscale library.
  10793. The scale filter forces the output display aspect ratio to be the same
  10794. of the input, by changing the output sample aspect ratio.
  10795. If the input image format is different from the format requested by
  10796. the next filter, the scale filter will convert the input to the
  10797. requested format.
  10798. @subsection Options
  10799. The filter accepts the following options, or any of the options
  10800. supported by the libswscale scaler.
  10801. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10802. the complete list of scaler options.
  10803. @table @option
  10804. @item width, w
  10805. @item height, h
  10806. Set the output video dimension expression. Default value is the input
  10807. dimension.
  10808. If the @var{width} or @var{w} value is 0, the input width is used for
  10809. the output. If the @var{height} or @var{h} value is 0, the input height
  10810. is used for the output.
  10811. If one and only one of the values is -n with n >= 1, the scale filter
  10812. will use a value that maintains the aspect ratio of the input image,
  10813. calculated from the other specified dimension. After that it will,
  10814. however, make sure that the calculated dimension is divisible by n and
  10815. adjust the value if necessary.
  10816. If both values are -n with n >= 1, the behavior will be identical to
  10817. both values being set to 0 as previously detailed.
  10818. See below for the list of accepted constants for use in the dimension
  10819. expression.
  10820. @item eval
  10821. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10822. @table @samp
  10823. @item init
  10824. Only evaluate expressions once during the filter initialization or when a command is processed.
  10825. @item frame
  10826. Evaluate expressions for each incoming frame.
  10827. @end table
  10828. Default value is @samp{init}.
  10829. @item interl
  10830. Set the interlacing mode. It accepts the following values:
  10831. @table @samp
  10832. @item 1
  10833. Force interlaced aware scaling.
  10834. @item 0
  10835. Do not apply interlaced scaling.
  10836. @item -1
  10837. Select interlaced aware scaling depending on whether the source frames
  10838. are flagged as interlaced or not.
  10839. @end table
  10840. Default value is @samp{0}.
  10841. @item flags
  10842. Set libswscale scaling flags. See
  10843. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10844. complete list of values. If not explicitly specified the filter applies
  10845. the default flags.
  10846. @item param0, param1
  10847. Set libswscale input parameters for scaling algorithms that need them. See
  10848. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10849. complete documentation. If not explicitly specified the filter applies
  10850. empty parameters.
  10851. @item size, s
  10852. Set the video size. For the syntax of this option, check the
  10853. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10854. @item in_color_matrix
  10855. @item out_color_matrix
  10856. Set in/output YCbCr color space type.
  10857. This allows the autodetected value to be overridden as well as allows forcing
  10858. a specific value used for the output and encoder.
  10859. If not specified, the color space type depends on the pixel format.
  10860. Possible values:
  10861. @table @samp
  10862. @item auto
  10863. Choose automatically.
  10864. @item bt709
  10865. Format conforming to International Telecommunication Union (ITU)
  10866. Recommendation BT.709.
  10867. @item fcc
  10868. Set color space conforming to the United States Federal Communications
  10869. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10870. @item bt601
  10871. Set color space conforming to:
  10872. @itemize
  10873. @item
  10874. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10875. @item
  10876. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10877. @item
  10878. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10879. @end itemize
  10880. @item smpte240m
  10881. Set color space conforming to SMPTE ST 240:1999.
  10882. @end table
  10883. @item in_range
  10884. @item out_range
  10885. Set in/output YCbCr sample range.
  10886. This allows the autodetected value to be overridden as well as allows forcing
  10887. a specific value used for the output and encoder. If not specified, the
  10888. range depends on the pixel format. Possible values:
  10889. @table @samp
  10890. @item auto/unknown
  10891. Choose automatically.
  10892. @item jpeg/full/pc
  10893. Set full range (0-255 in case of 8-bit luma).
  10894. @item mpeg/limited/tv
  10895. Set "MPEG" range (16-235 in case of 8-bit luma).
  10896. @end table
  10897. @item force_original_aspect_ratio
  10898. Enable decreasing or increasing output video width or height if necessary to
  10899. keep the original aspect ratio. Possible values:
  10900. @table @samp
  10901. @item disable
  10902. Scale the video as specified and disable this feature.
  10903. @item decrease
  10904. The output video dimensions will automatically be decreased if needed.
  10905. @item increase
  10906. The output video dimensions will automatically be increased if needed.
  10907. @end table
  10908. One useful instance of this option is that when you know a specific device's
  10909. maximum allowed resolution, you can use this to limit the output video to
  10910. that, while retaining the aspect ratio. For example, device A allows
  10911. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10912. decrease) and specifying 1280x720 to the command line makes the output
  10913. 1280x533.
  10914. Please note that this is a different thing than specifying -1 for @option{w}
  10915. or @option{h}, you still need to specify the output resolution for this option
  10916. to work.
  10917. @end table
  10918. The values of the @option{w} and @option{h} options are expressions
  10919. containing the following constants:
  10920. @table @var
  10921. @item in_w
  10922. @item in_h
  10923. The input width and height
  10924. @item iw
  10925. @item ih
  10926. These are the same as @var{in_w} and @var{in_h}.
  10927. @item out_w
  10928. @item out_h
  10929. The output (scaled) width and height
  10930. @item ow
  10931. @item oh
  10932. These are the same as @var{out_w} and @var{out_h}
  10933. @item a
  10934. The same as @var{iw} / @var{ih}
  10935. @item sar
  10936. input sample aspect ratio
  10937. @item dar
  10938. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10939. @item hsub
  10940. @item vsub
  10941. horizontal and vertical input chroma subsample values. For example for the
  10942. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10943. @item ohsub
  10944. @item ovsub
  10945. horizontal and vertical output chroma subsample values. For example for the
  10946. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10947. @end table
  10948. @subsection Examples
  10949. @itemize
  10950. @item
  10951. Scale the input video to a size of 200x100
  10952. @example
  10953. scale=w=200:h=100
  10954. @end example
  10955. This is equivalent to:
  10956. @example
  10957. scale=200:100
  10958. @end example
  10959. or:
  10960. @example
  10961. scale=200x100
  10962. @end example
  10963. @item
  10964. Specify a size abbreviation for the output size:
  10965. @example
  10966. scale=qcif
  10967. @end example
  10968. which can also be written as:
  10969. @example
  10970. scale=size=qcif
  10971. @end example
  10972. @item
  10973. Scale the input to 2x:
  10974. @example
  10975. scale=w=2*iw:h=2*ih
  10976. @end example
  10977. @item
  10978. The above is the same as:
  10979. @example
  10980. scale=2*in_w:2*in_h
  10981. @end example
  10982. @item
  10983. Scale the input to 2x with forced interlaced scaling:
  10984. @example
  10985. scale=2*iw:2*ih:interl=1
  10986. @end example
  10987. @item
  10988. Scale the input to half size:
  10989. @example
  10990. scale=w=iw/2:h=ih/2
  10991. @end example
  10992. @item
  10993. Increase the width, and set the height to the same size:
  10994. @example
  10995. scale=3/2*iw:ow
  10996. @end example
  10997. @item
  10998. Seek Greek harmony:
  10999. @example
  11000. scale=iw:1/PHI*iw
  11001. scale=ih*PHI:ih
  11002. @end example
  11003. @item
  11004. Increase the height, and set the width to 3/2 of the height:
  11005. @example
  11006. scale=w=3/2*oh:h=3/5*ih
  11007. @end example
  11008. @item
  11009. Increase the size, making the size a multiple of the chroma
  11010. subsample values:
  11011. @example
  11012. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11013. @end example
  11014. @item
  11015. Increase the width to a maximum of 500 pixels,
  11016. keeping the same aspect ratio as the input:
  11017. @example
  11018. scale=w='min(500\, iw*3/2):h=-1'
  11019. @end example
  11020. @item
  11021. Make pixels square by combining scale and setsar:
  11022. @example
  11023. scale='trunc(ih*dar):ih',setsar=1/1
  11024. @end example
  11025. @item
  11026. Make pixels square by combining scale and setsar,
  11027. making sure the resulting resolution is even (required by some codecs):
  11028. @example
  11029. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11030. @end example
  11031. @end itemize
  11032. @subsection Commands
  11033. This filter supports the following commands:
  11034. @table @option
  11035. @item width, w
  11036. @item height, h
  11037. Set the output video dimension expression.
  11038. The command accepts the same syntax of the corresponding option.
  11039. If the specified expression is not valid, it is kept at its current
  11040. value.
  11041. @end table
  11042. @section scale_npp
  11043. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11044. format conversion on CUDA video frames. Setting the output width and height
  11045. works in the same way as for the @var{scale} filter.
  11046. The following additional options are accepted:
  11047. @table @option
  11048. @item format
  11049. The pixel format of the output CUDA frames. If set to the string "same" (the
  11050. default), the input format will be kept. Note that automatic format negotiation
  11051. and conversion is not yet supported for hardware frames
  11052. @item interp_algo
  11053. The interpolation algorithm used for resizing. One of the following:
  11054. @table @option
  11055. @item nn
  11056. Nearest neighbour.
  11057. @item linear
  11058. @item cubic
  11059. @item cubic2p_bspline
  11060. 2-parameter cubic (B=1, C=0)
  11061. @item cubic2p_catmullrom
  11062. 2-parameter cubic (B=0, C=1/2)
  11063. @item cubic2p_b05c03
  11064. 2-parameter cubic (B=1/2, C=3/10)
  11065. @item super
  11066. Supersampling
  11067. @item lanczos
  11068. @end table
  11069. @end table
  11070. @section scale2ref
  11071. Scale (resize) the input video, based on a reference video.
  11072. See the scale filter for available options, scale2ref supports the same but
  11073. uses the reference video instead of the main input as basis. scale2ref also
  11074. supports the following additional constants for the @option{w} and
  11075. @option{h} options:
  11076. @table @var
  11077. @item main_w
  11078. @item main_h
  11079. The main input video's width and height
  11080. @item main_a
  11081. The same as @var{main_w} / @var{main_h}
  11082. @item main_sar
  11083. The main input video's sample aspect ratio
  11084. @item main_dar, mdar
  11085. The main input video's display aspect ratio. Calculated from
  11086. @code{(main_w / main_h) * main_sar}.
  11087. @item main_hsub
  11088. @item main_vsub
  11089. The main input video's horizontal and vertical chroma subsample values.
  11090. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11091. is 1.
  11092. @end table
  11093. @subsection Examples
  11094. @itemize
  11095. @item
  11096. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11097. @example
  11098. 'scale2ref[b][a];[a][b]overlay'
  11099. @end example
  11100. @end itemize
  11101. @anchor{selectivecolor}
  11102. @section selectivecolor
  11103. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11104. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11105. by the "purity" of the color (that is, how saturated it already is).
  11106. This filter is similar to the Adobe Photoshop Selective Color tool.
  11107. The filter accepts the following options:
  11108. @table @option
  11109. @item correction_method
  11110. Select color correction method.
  11111. Available values are:
  11112. @table @samp
  11113. @item absolute
  11114. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11115. component value).
  11116. @item relative
  11117. Specified adjustments are relative to the original component value.
  11118. @end table
  11119. Default is @code{absolute}.
  11120. @item reds
  11121. Adjustments for red pixels (pixels where the red component is the maximum)
  11122. @item yellows
  11123. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11124. @item greens
  11125. Adjustments for green pixels (pixels where the green component is the maximum)
  11126. @item cyans
  11127. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11128. @item blues
  11129. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11130. @item magentas
  11131. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11132. @item whites
  11133. Adjustments for white pixels (pixels where all components are greater than 128)
  11134. @item neutrals
  11135. Adjustments for all pixels except pure black and pure white
  11136. @item blacks
  11137. Adjustments for black pixels (pixels where all components are lesser than 128)
  11138. @item psfile
  11139. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11140. @end table
  11141. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11142. 4 space separated floating point adjustment values in the [-1,1] range,
  11143. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11144. pixels of its range.
  11145. @subsection Examples
  11146. @itemize
  11147. @item
  11148. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11149. increase magenta by 27% in blue areas:
  11150. @example
  11151. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11152. @end example
  11153. @item
  11154. Use a Photoshop selective color preset:
  11155. @example
  11156. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11157. @end example
  11158. @end itemize
  11159. @anchor{separatefields}
  11160. @section separatefields
  11161. The @code{separatefields} takes a frame-based video input and splits
  11162. each frame into its components fields, producing a new half height clip
  11163. with twice the frame rate and twice the frame count.
  11164. This filter use field-dominance information in frame to decide which
  11165. of each pair of fields to place first in the output.
  11166. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11167. @section setdar, setsar
  11168. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11169. output video.
  11170. This is done by changing the specified Sample (aka Pixel) Aspect
  11171. Ratio, according to the following equation:
  11172. @example
  11173. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11174. @end example
  11175. Keep in mind that the @code{setdar} filter does not modify the pixel
  11176. dimensions of the video frame. Also, the display aspect ratio set by
  11177. this filter may be changed by later filters in the filterchain,
  11178. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11179. applied.
  11180. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11181. the filter output video.
  11182. Note that as a consequence of the application of this filter, the
  11183. output display aspect ratio will change according to the equation
  11184. above.
  11185. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11186. filter may be changed by later filters in the filterchain, e.g. if
  11187. another "setsar" or a "setdar" filter is applied.
  11188. It accepts the following parameters:
  11189. @table @option
  11190. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11191. Set the aspect ratio used by the filter.
  11192. The parameter can be a floating point number string, an expression, or
  11193. a string of the form @var{num}:@var{den}, where @var{num} and
  11194. @var{den} are the numerator and denominator of the aspect ratio. If
  11195. the parameter is not specified, it is assumed the value "0".
  11196. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11197. should be escaped.
  11198. @item max
  11199. Set the maximum integer value to use for expressing numerator and
  11200. denominator when reducing the expressed aspect ratio to a rational.
  11201. Default value is @code{100}.
  11202. @end table
  11203. The parameter @var{sar} is an expression containing
  11204. the following constants:
  11205. @table @option
  11206. @item E, PI, PHI
  11207. These are approximated values for the mathematical constants e
  11208. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11209. @item w, h
  11210. The input width and height.
  11211. @item a
  11212. These are the same as @var{w} / @var{h}.
  11213. @item sar
  11214. The input sample aspect ratio.
  11215. @item dar
  11216. The input display aspect ratio. It is the same as
  11217. (@var{w} / @var{h}) * @var{sar}.
  11218. @item hsub, vsub
  11219. Horizontal and vertical chroma subsample values. For example, for the
  11220. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11221. @end table
  11222. @subsection Examples
  11223. @itemize
  11224. @item
  11225. To change the display aspect ratio to 16:9, specify one of the following:
  11226. @example
  11227. setdar=dar=1.77777
  11228. setdar=dar=16/9
  11229. @end example
  11230. @item
  11231. To change the sample aspect ratio to 10:11, specify:
  11232. @example
  11233. setsar=sar=10/11
  11234. @end example
  11235. @item
  11236. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11237. 1000 in the aspect ratio reduction, use the command:
  11238. @example
  11239. setdar=ratio=16/9:max=1000
  11240. @end example
  11241. @end itemize
  11242. @anchor{setfield}
  11243. @section setfield
  11244. Force field for the output video frame.
  11245. The @code{setfield} filter marks the interlace type field for the
  11246. output frames. It does not change the input frame, but only sets the
  11247. corresponding property, which affects how the frame is treated by
  11248. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11249. The filter accepts the following options:
  11250. @table @option
  11251. @item mode
  11252. Available values are:
  11253. @table @samp
  11254. @item auto
  11255. Keep the same field property.
  11256. @item bff
  11257. Mark the frame as bottom-field-first.
  11258. @item tff
  11259. Mark the frame as top-field-first.
  11260. @item prog
  11261. Mark the frame as progressive.
  11262. @end table
  11263. @end table
  11264. @section showinfo
  11265. Show a line containing various information for each input video frame.
  11266. The input video is not modified.
  11267. The shown line contains a sequence of key/value pairs of the form
  11268. @var{key}:@var{value}.
  11269. The following values are shown in the output:
  11270. @table @option
  11271. @item n
  11272. The (sequential) number of the input frame, starting from 0.
  11273. @item pts
  11274. The Presentation TimeStamp of the input frame, expressed as a number of
  11275. time base units. The time base unit depends on the filter input pad.
  11276. @item pts_time
  11277. The Presentation TimeStamp of the input frame, expressed as a number of
  11278. seconds.
  11279. @item pos
  11280. The position of the frame in the input stream, or -1 if this information is
  11281. unavailable and/or meaningless (for example in case of synthetic video).
  11282. @item fmt
  11283. The pixel format name.
  11284. @item sar
  11285. The sample aspect ratio of the input frame, expressed in the form
  11286. @var{num}/@var{den}.
  11287. @item s
  11288. The size of the input frame. For the syntax of this option, check the
  11289. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11290. @item i
  11291. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11292. for bottom field first).
  11293. @item iskey
  11294. This is 1 if the frame is a key frame, 0 otherwise.
  11295. @item type
  11296. The picture type of the input frame ("I" for an I-frame, "P" for a
  11297. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11298. Also refer to the documentation of the @code{AVPictureType} enum and of
  11299. the @code{av_get_picture_type_char} function defined in
  11300. @file{libavutil/avutil.h}.
  11301. @item checksum
  11302. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11303. @item plane_checksum
  11304. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11305. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11306. @end table
  11307. @section showpalette
  11308. Displays the 256 colors palette of each frame. This filter is only relevant for
  11309. @var{pal8} pixel format frames.
  11310. It accepts the following option:
  11311. @table @option
  11312. @item s
  11313. Set the size of the box used to represent one palette color entry. Default is
  11314. @code{30} (for a @code{30x30} pixel box).
  11315. @end table
  11316. @section shuffleframes
  11317. Reorder and/or duplicate and/or drop video frames.
  11318. It accepts the following parameters:
  11319. @table @option
  11320. @item mapping
  11321. Set the destination indexes of input frames.
  11322. This is space or '|' separated list of indexes that maps input frames to output
  11323. frames. Number of indexes also sets maximal value that each index may have.
  11324. '-1' index have special meaning and that is to drop frame.
  11325. @end table
  11326. The first frame has the index 0. The default is to keep the input unchanged.
  11327. @subsection Examples
  11328. @itemize
  11329. @item
  11330. Swap second and third frame of every three frames of the input:
  11331. @example
  11332. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11333. @end example
  11334. @item
  11335. Swap 10th and 1st frame of every ten frames of the input:
  11336. @example
  11337. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11338. @end example
  11339. @end itemize
  11340. @section shuffleplanes
  11341. Reorder and/or duplicate video planes.
  11342. It accepts the following parameters:
  11343. @table @option
  11344. @item map0
  11345. The index of the input plane to be used as the first output plane.
  11346. @item map1
  11347. The index of the input plane to be used as the second output plane.
  11348. @item map2
  11349. The index of the input plane to be used as the third output plane.
  11350. @item map3
  11351. The index of the input plane to be used as the fourth output plane.
  11352. @end table
  11353. The first plane has the index 0. The default is to keep the input unchanged.
  11354. @subsection Examples
  11355. @itemize
  11356. @item
  11357. Swap the second and third planes of the input:
  11358. @example
  11359. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11360. @end example
  11361. @end itemize
  11362. @anchor{signalstats}
  11363. @section signalstats
  11364. Evaluate various visual metrics that assist in determining issues associated
  11365. with the digitization of analog video media.
  11366. By default the filter will log these metadata values:
  11367. @table @option
  11368. @item YMIN
  11369. Display the minimal Y value contained within the input frame. Expressed in
  11370. range of [0-255].
  11371. @item YLOW
  11372. Display the Y value at the 10% percentile within the input frame. Expressed in
  11373. range of [0-255].
  11374. @item YAVG
  11375. Display the average Y value within the input frame. Expressed in range of
  11376. [0-255].
  11377. @item YHIGH
  11378. Display the Y value at the 90% percentile within the input frame. Expressed in
  11379. range of [0-255].
  11380. @item YMAX
  11381. Display the maximum Y value contained within the input frame. Expressed in
  11382. range of [0-255].
  11383. @item UMIN
  11384. Display the minimal U value contained within the input frame. Expressed in
  11385. range of [0-255].
  11386. @item ULOW
  11387. Display the U value at the 10% percentile within the input frame. Expressed in
  11388. range of [0-255].
  11389. @item UAVG
  11390. Display the average U value within the input frame. Expressed in range of
  11391. [0-255].
  11392. @item UHIGH
  11393. Display the U value at the 90% percentile within the input frame. Expressed in
  11394. range of [0-255].
  11395. @item UMAX
  11396. Display the maximum U value contained within the input frame. Expressed in
  11397. range of [0-255].
  11398. @item VMIN
  11399. Display the minimal V value contained within the input frame. Expressed in
  11400. range of [0-255].
  11401. @item VLOW
  11402. Display the V value at the 10% percentile within the input frame. Expressed in
  11403. range of [0-255].
  11404. @item VAVG
  11405. Display the average V value within the input frame. Expressed in range of
  11406. [0-255].
  11407. @item VHIGH
  11408. Display the V value at the 90% percentile within the input frame. Expressed in
  11409. range of [0-255].
  11410. @item VMAX
  11411. Display the maximum V value contained within the input frame. Expressed in
  11412. range of [0-255].
  11413. @item SATMIN
  11414. Display the minimal saturation value contained within the input frame.
  11415. Expressed in range of [0-~181.02].
  11416. @item SATLOW
  11417. Display the saturation value at the 10% percentile within the input frame.
  11418. Expressed in range of [0-~181.02].
  11419. @item SATAVG
  11420. Display the average saturation value within the input frame. Expressed in range
  11421. of [0-~181.02].
  11422. @item SATHIGH
  11423. Display the saturation value at the 90% percentile within the input frame.
  11424. Expressed in range of [0-~181.02].
  11425. @item SATMAX
  11426. Display the maximum saturation value contained within the input frame.
  11427. Expressed in range of [0-~181.02].
  11428. @item HUEMED
  11429. Display the median value for hue within the input frame. Expressed in range of
  11430. [0-360].
  11431. @item HUEAVG
  11432. Display the average value for hue within the input frame. Expressed in range of
  11433. [0-360].
  11434. @item YDIF
  11435. Display the average of sample value difference between all values of the Y
  11436. plane in the current frame and corresponding values of the previous input frame.
  11437. Expressed in range of [0-255].
  11438. @item UDIF
  11439. Display the average of sample value difference between all values of the U
  11440. plane in the current frame and corresponding values of the previous input frame.
  11441. Expressed in range of [0-255].
  11442. @item VDIF
  11443. Display the average of sample value difference between all values of the V
  11444. plane in the current frame and corresponding values of the previous input frame.
  11445. Expressed in range of [0-255].
  11446. @item YBITDEPTH
  11447. Display bit depth of Y plane in current frame.
  11448. Expressed in range of [0-16].
  11449. @item UBITDEPTH
  11450. Display bit depth of U plane in current frame.
  11451. Expressed in range of [0-16].
  11452. @item VBITDEPTH
  11453. Display bit depth of V plane in current frame.
  11454. Expressed in range of [0-16].
  11455. @end table
  11456. The filter accepts the following options:
  11457. @table @option
  11458. @item stat
  11459. @item out
  11460. @option{stat} specify an additional form of image analysis.
  11461. @option{out} output video with the specified type of pixel highlighted.
  11462. Both options accept the following values:
  11463. @table @samp
  11464. @item tout
  11465. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11466. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11467. include the results of video dropouts, head clogs, or tape tracking issues.
  11468. @item vrep
  11469. Identify @var{vertical line repetition}. Vertical line repetition includes
  11470. similar rows of pixels within a frame. In born-digital video vertical line
  11471. repetition is common, but this pattern is uncommon in video digitized from an
  11472. analog source. When it occurs in video that results from the digitization of an
  11473. analog source it can indicate concealment from a dropout compensator.
  11474. @item brng
  11475. Identify pixels that fall outside of legal broadcast range.
  11476. @end table
  11477. @item color, c
  11478. Set the highlight color for the @option{out} option. The default color is
  11479. yellow.
  11480. @end table
  11481. @subsection Examples
  11482. @itemize
  11483. @item
  11484. Output data of various video metrics:
  11485. @example
  11486. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11487. @end example
  11488. @item
  11489. Output specific data about the minimum and maximum values of the Y plane per frame:
  11490. @example
  11491. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11492. @end example
  11493. @item
  11494. Playback video while highlighting pixels that are outside of broadcast range in red.
  11495. @example
  11496. ffplay example.mov -vf signalstats="out=brng:color=red"
  11497. @end example
  11498. @item
  11499. Playback video with signalstats metadata drawn over the frame.
  11500. @example
  11501. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11502. @end example
  11503. The contents of signalstat_drawtext.txt used in the command are:
  11504. @example
  11505. time %@{pts:hms@}
  11506. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11507. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11508. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11509. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11510. @end example
  11511. @end itemize
  11512. @anchor{signature}
  11513. @section signature
  11514. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11515. input. In this case the matching between the inputs can be calculated additionally.
  11516. The filter always passes through the first input. The signature of each stream can
  11517. be written into a file.
  11518. It accepts the following options:
  11519. @table @option
  11520. @item detectmode
  11521. Enable or disable the matching process.
  11522. Available values are:
  11523. @table @samp
  11524. @item off
  11525. Disable the calculation of a matching (default).
  11526. @item full
  11527. Calculate the matching for the whole video and output whether the whole video
  11528. matches or only parts.
  11529. @item fast
  11530. Calculate only until a matching is found or the video ends. Should be faster in
  11531. some cases.
  11532. @end table
  11533. @item nb_inputs
  11534. Set the number of inputs. The option value must be a non negative integer.
  11535. Default value is 1.
  11536. @item filename
  11537. Set the path to which the output is written. If there is more than one input,
  11538. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11539. integer), that will be replaced with the input number. If no filename is
  11540. specified, no output will be written. This is the default.
  11541. @item format
  11542. Choose the output format.
  11543. Available values are:
  11544. @table @samp
  11545. @item binary
  11546. Use the specified binary representation (default).
  11547. @item xml
  11548. Use the specified xml representation.
  11549. @end table
  11550. @item th_d
  11551. Set threshold to detect one word as similar. The option value must be an integer
  11552. greater than zero. The default value is 9000.
  11553. @item th_dc
  11554. Set threshold to detect all words as similar. The option value must be an integer
  11555. greater than zero. The default value is 60000.
  11556. @item th_xh
  11557. Set threshold to detect frames as similar. The option value must be an integer
  11558. greater than zero. The default value is 116.
  11559. @item th_di
  11560. Set the minimum length of a sequence in frames to recognize it as matching
  11561. sequence. The option value must be a non negative integer value.
  11562. The default value is 0.
  11563. @item th_it
  11564. Set the minimum relation, that matching frames to all frames must have.
  11565. The option value must be a double value between 0 and 1. The default value is 0.5.
  11566. @end table
  11567. @subsection Examples
  11568. @itemize
  11569. @item
  11570. To calculate the signature of an input video and store it in signature.bin:
  11571. @example
  11572. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11573. @end example
  11574. @item
  11575. To detect whether two videos match and store the signatures in XML format in
  11576. signature0.xml and signature1.xml:
  11577. @example
  11578. 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 -
  11579. @end example
  11580. @end itemize
  11581. @anchor{smartblur}
  11582. @section smartblur
  11583. Blur the input video without impacting the outlines.
  11584. It accepts the following options:
  11585. @table @option
  11586. @item luma_radius, lr
  11587. Set the luma radius. The option value must be a float number in
  11588. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11589. used to blur the image (slower if larger). Default value is 1.0.
  11590. @item luma_strength, ls
  11591. Set the luma strength. The option value must be a float number
  11592. in the range [-1.0,1.0] that configures the blurring. A value included
  11593. in [0.0,1.0] will blur the image whereas a value included in
  11594. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11595. @item luma_threshold, lt
  11596. Set the luma threshold used as a coefficient to determine
  11597. whether a pixel should be blurred or not. The option value must be an
  11598. integer in the range [-30,30]. A value of 0 will filter all the image,
  11599. a value included in [0,30] will filter flat areas and a value included
  11600. in [-30,0] will filter edges. Default value is 0.
  11601. @item chroma_radius, cr
  11602. Set the chroma radius. The option value must be a float number in
  11603. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11604. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11605. @item chroma_strength, cs
  11606. Set the chroma strength. The option value must be a float number
  11607. in the range [-1.0,1.0] that configures the blurring. A value included
  11608. in [0.0,1.0] will blur the image whereas a value included in
  11609. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11610. @item chroma_threshold, ct
  11611. Set the chroma threshold used as a coefficient to determine
  11612. whether a pixel should be blurred or not. The option value must be an
  11613. integer in the range [-30,30]. A value of 0 will filter all the image,
  11614. a value included in [0,30] will filter flat areas and a value included
  11615. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11616. @end table
  11617. If a chroma option is not explicitly set, the corresponding luma value
  11618. is set.
  11619. @section ssim
  11620. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11621. This filter takes in input two input videos, the first input is
  11622. considered the "main" source and is passed unchanged to the
  11623. output. The second input is used as a "reference" video for computing
  11624. the SSIM.
  11625. Both video inputs must have the same resolution and pixel format for
  11626. this filter to work correctly. Also it assumes that both inputs
  11627. have the same number of frames, which are compared one by one.
  11628. The filter stores the calculated SSIM of each frame.
  11629. The description of the accepted parameters follows.
  11630. @table @option
  11631. @item stats_file, f
  11632. If specified the filter will use the named file to save the SSIM of
  11633. each individual frame. When filename equals "-" the data is sent to
  11634. standard output.
  11635. @end table
  11636. The file printed if @var{stats_file} is selected, contains a sequence of
  11637. key/value pairs of the form @var{key}:@var{value} for each compared
  11638. couple of frames.
  11639. A description of each shown parameter follows:
  11640. @table @option
  11641. @item n
  11642. sequential number of the input frame, starting from 1
  11643. @item Y, U, V, R, G, B
  11644. SSIM of the compared frames for the component specified by the suffix.
  11645. @item All
  11646. SSIM of the compared frames for the whole frame.
  11647. @item dB
  11648. Same as above but in dB representation.
  11649. @end table
  11650. This filter also supports the @ref{framesync} options.
  11651. For example:
  11652. @example
  11653. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11654. [main][ref] ssim="stats_file=stats.log" [out]
  11655. @end example
  11656. On this example the input file being processed is compared with the
  11657. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11658. is stored in @file{stats.log}.
  11659. Another example with both psnr and ssim at same time:
  11660. @example
  11661. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11662. @end example
  11663. @section stereo3d
  11664. Convert between different stereoscopic image formats.
  11665. The filters accept the following options:
  11666. @table @option
  11667. @item in
  11668. Set stereoscopic image format of input.
  11669. Available values for input image formats are:
  11670. @table @samp
  11671. @item sbsl
  11672. side by side parallel (left eye left, right eye right)
  11673. @item sbsr
  11674. side by side crosseye (right eye left, left eye right)
  11675. @item sbs2l
  11676. side by side parallel with half width resolution
  11677. (left eye left, right eye right)
  11678. @item sbs2r
  11679. side by side crosseye with half width resolution
  11680. (right eye left, left eye right)
  11681. @item abl
  11682. above-below (left eye above, right eye below)
  11683. @item abr
  11684. above-below (right eye above, left eye below)
  11685. @item ab2l
  11686. above-below with half height resolution
  11687. (left eye above, right eye below)
  11688. @item ab2r
  11689. above-below with half height resolution
  11690. (right eye above, left eye below)
  11691. @item al
  11692. alternating frames (left eye first, right eye second)
  11693. @item ar
  11694. alternating frames (right eye first, left eye second)
  11695. @item irl
  11696. interleaved rows (left eye has top row, right eye starts on next row)
  11697. @item irr
  11698. interleaved rows (right eye has top row, left eye starts on next row)
  11699. @item icl
  11700. interleaved columns, left eye first
  11701. @item icr
  11702. interleaved columns, right eye first
  11703. Default value is @samp{sbsl}.
  11704. @end table
  11705. @item out
  11706. Set stereoscopic image format of output.
  11707. @table @samp
  11708. @item sbsl
  11709. side by side parallel (left eye left, right eye right)
  11710. @item sbsr
  11711. side by side crosseye (right eye left, left eye right)
  11712. @item sbs2l
  11713. side by side parallel with half width resolution
  11714. (left eye left, right eye right)
  11715. @item sbs2r
  11716. side by side crosseye with half width resolution
  11717. (right eye left, left eye right)
  11718. @item abl
  11719. above-below (left eye above, right eye below)
  11720. @item abr
  11721. above-below (right eye above, left eye below)
  11722. @item ab2l
  11723. above-below with half height resolution
  11724. (left eye above, right eye below)
  11725. @item ab2r
  11726. above-below with half height resolution
  11727. (right eye above, left eye below)
  11728. @item al
  11729. alternating frames (left eye first, right eye second)
  11730. @item ar
  11731. alternating frames (right eye first, left eye second)
  11732. @item irl
  11733. interleaved rows (left eye has top row, right eye starts on next row)
  11734. @item irr
  11735. interleaved rows (right eye has top row, left eye starts on next row)
  11736. @item arbg
  11737. anaglyph red/blue gray
  11738. (red filter on left eye, blue filter on right eye)
  11739. @item argg
  11740. anaglyph red/green gray
  11741. (red filter on left eye, green filter on right eye)
  11742. @item arcg
  11743. anaglyph red/cyan gray
  11744. (red filter on left eye, cyan filter on right eye)
  11745. @item arch
  11746. anaglyph red/cyan half colored
  11747. (red filter on left eye, cyan filter on right eye)
  11748. @item arcc
  11749. anaglyph red/cyan color
  11750. (red filter on left eye, cyan filter on right eye)
  11751. @item arcd
  11752. anaglyph red/cyan color optimized with the least squares projection of dubois
  11753. (red filter on left eye, cyan filter on right eye)
  11754. @item agmg
  11755. anaglyph green/magenta gray
  11756. (green filter on left eye, magenta filter on right eye)
  11757. @item agmh
  11758. anaglyph green/magenta half colored
  11759. (green filter on left eye, magenta filter on right eye)
  11760. @item agmc
  11761. anaglyph green/magenta colored
  11762. (green filter on left eye, magenta filter on right eye)
  11763. @item agmd
  11764. anaglyph green/magenta color optimized with the least squares projection of dubois
  11765. (green filter on left eye, magenta filter on right eye)
  11766. @item aybg
  11767. anaglyph yellow/blue gray
  11768. (yellow filter on left eye, blue filter on right eye)
  11769. @item aybh
  11770. anaglyph yellow/blue half colored
  11771. (yellow filter on left eye, blue filter on right eye)
  11772. @item aybc
  11773. anaglyph yellow/blue colored
  11774. (yellow filter on left eye, blue filter on right eye)
  11775. @item aybd
  11776. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11777. (yellow filter on left eye, blue filter on right eye)
  11778. @item ml
  11779. mono output (left eye only)
  11780. @item mr
  11781. mono output (right eye only)
  11782. @item chl
  11783. checkerboard, left eye first
  11784. @item chr
  11785. checkerboard, right eye first
  11786. @item icl
  11787. interleaved columns, left eye first
  11788. @item icr
  11789. interleaved columns, right eye first
  11790. @item hdmi
  11791. HDMI frame pack
  11792. @end table
  11793. Default value is @samp{arcd}.
  11794. @end table
  11795. @subsection Examples
  11796. @itemize
  11797. @item
  11798. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11799. @example
  11800. stereo3d=sbsl:aybd
  11801. @end example
  11802. @item
  11803. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11804. @example
  11805. stereo3d=abl:sbsr
  11806. @end example
  11807. @end itemize
  11808. @section streamselect, astreamselect
  11809. Select video or audio streams.
  11810. The filter accepts the following options:
  11811. @table @option
  11812. @item inputs
  11813. Set number of inputs. Default is 2.
  11814. @item map
  11815. Set input indexes to remap to outputs.
  11816. @end table
  11817. @subsection Commands
  11818. The @code{streamselect} and @code{astreamselect} filter supports the following
  11819. commands:
  11820. @table @option
  11821. @item map
  11822. Set input indexes to remap to outputs.
  11823. @end table
  11824. @subsection Examples
  11825. @itemize
  11826. @item
  11827. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11828. @example
  11829. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11830. @end example
  11831. @item
  11832. Same as above, but for audio:
  11833. @example
  11834. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11835. @end example
  11836. @end itemize
  11837. @section sobel
  11838. Apply sobel operator to input video stream.
  11839. The filter accepts the following option:
  11840. @table @option
  11841. @item planes
  11842. Set which planes will be processed, unprocessed planes will be copied.
  11843. By default value 0xf, all planes will be processed.
  11844. @item scale
  11845. Set value which will be multiplied with filtered result.
  11846. @item delta
  11847. Set value which will be added to filtered result.
  11848. @end table
  11849. @anchor{spp}
  11850. @section spp
  11851. Apply a simple postprocessing filter that compresses and decompresses the image
  11852. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11853. and average the results.
  11854. The filter accepts the following options:
  11855. @table @option
  11856. @item quality
  11857. Set quality. This option defines the number of levels for averaging. It accepts
  11858. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11859. effect. A value of @code{6} means the higher quality. For each increment of
  11860. that value the speed drops by a factor of approximately 2. Default value is
  11861. @code{3}.
  11862. @item qp
  11863. Force a constant quantization parameter. If not set, the filter will use the QP
  11864. from the video stream (if available).
  11865. @item mode
  11866. Set thresholding mode. Available modes are:
  11867. @table @samp
  11868. @item hard
  11869. Set hard thresholding (default).
  11870. @item soft
  11871. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11872. @end table
  11873. @item use_bframe_qp
  11874. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11875. option may cause flicker since the B-Frames have often larger QP. Default is
  11876. @code{0} (not enabled).
  11877. @end table
  11878. @section sr
  11879. Scale the input by applying one of the super-resolution methods based on
  11880. convolutional neural networks.
  11881. Training scripts as well as scripts for model generation are provided in
  11882. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  11883. The filter accepts the following options:
  11884. @table @option
  11885. @item model
  11886. Specify which super-resolution model to use. This option accepts the following values:
  11887. @table @samp
  11888. @item srcnn
  11889. Super-Resolution Convolutional Neural Network model.
  11890. See @url{https://arxiv.org/abs/1501.00092}.
  11891. @item espcn
  11892. Efficient Sub-Pixel Convolutional Neural Network model.
  11893. See @url{https://arxiv.org/abs/1609.05158}.
  11894. @end table
  11895. Default value is @samp{srcnn}.
  11896. @item dnn_backend
  11897. Specify which DNN backend to use for model loading and execution. This option accepts
  11898. the following values:
  11899. @table @samp
  11900. @item native
  11901. Native implementation of DNN loading and execution.
  11902. @item tensorflow
  11903. TensorFlow backend. To enable this backend you
  11904. need to install the TensorFlow for C library (see
  11905. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  11906. @code{--enable-libtensorflow}
  11907. @end table
  11908. Default value is @samp{native}.
  11909. @item scale_factor
  11910. Set scale factor for SRCNN model, for which custom model file was provided.
  11911. Allowed values are @code{2}, @code{3} and @code{4}. Default value is @code{2}.
  11912. Scale factor is necessary for SRCNN model, because it accepts input upscaled
  11913. using bicubic upscaling with proper scale factor.
  11914. @item model_filename
  11915. Set path to model file specifying network architecture and its parameters.
  11916. Note that different backends use different file formats. TensorFlow backend
  11917. can load files for both formats, while native backend can load files for only
  11918. its format.
  11919. @end table
  11920. @anchor{subtitles}
  11921. @section subtitles
  11922. Draw subtitles on top of input video using the libass library.
  11923. To enable compilation of this filter you need to configure FFmpeg with
  11924. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11925. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11926. Alpha) subtitles format.
  11927. The filter accepts the following options:
  11928. @table @option
  11929. @item filename, f
  11930. Set the filename of the subtitle file to read. It must be specified.
  11931. @item original_size
  11932. Specify the size of the original video, the video for which the ASS file
  11933. was composed. For the syntax of this option, check the
  11934. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11935. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11936. correctly scale the fonts if the aspect ratio has been changed.
  11937. @item fontsdir
  11938. Set a directory path containing fonts that can be used by the filter.
  11939. These fonts will be used in addition to whatever the font provider uses.
  11940. @item alpha
  11941. Process alpha channel, by default alpha channel is untouched.
  11942. @item charenc
  11943. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11944. useful if not UTF-8.
  11945. @item stream_index, si
  11946. Set subtitles stream index. @code{subtitles} filter only.
  11947. @item force_style
  11948. Override default style or script info parameters of the subtitles. It accepts a
  11949. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11950. @end table
  11951. If the first key is not specified, it is assumed that the first value
  11952. specifies the @option{filename}.
  11953. For example, to render the file @file{sub.srt} on top of the input
  11954. video, use the command:
  11955. @example
  11956. subtitles=sub.srt
  11957. @end example
  11958. which is equivalent to:
  11959. @example
  11960. subtitles=filename=sub.srt
  11961. @end example
  11962. To render the default subtitles stream from file @file{video.mkv}, use:
  11963. @example
  11964. subtitles=video.mkv
  11965. @end example
  11966. To render the second subtitles stream from that file, use:
  11967. @example
  11968. subtitles=video.mkv:si=1
  11969. @end example
  11970. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  11971. @code{DejaVu Serif}, use:
  11972. @example
  11973. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  11974. @end example
  11975. @section super2xsai
  11976. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11977. Interpolate) pixel art scaling algorithm.
  11978. Useful for enlarging pixel art images without reducing sharpness.
  11979. @section swaprect
  11980. Swap two rectangular objects in video.
  11981. This filter accepts the following options:
  11982. @table @option
  11983. @item w
  11984. Set object width.
  11985. @item h
  11986. Set object height.
  11987. @item x1
  11988. Set 1st rect x coordinate.
  11989. @item y1
  11990. Set 1st rect y coordinate.
  11991. @item x2
  11992. Set 2nd rect x coordinate.
  11993. @item y2
  11994. Set 2nd rect y coordinate.
  11995. All expressions are evaluated once for each frame.
  11996. @end table
  11997. The all options are expressions containing the following constants:
  11998. @table @option
  11999. @item w
  12000. @item h
  12001. The input width and height.
  12002. @item a
  12003. same as @var{w} / @var{h}
  12004. @item sar
  12005. input sample aspect ratio
  12006. @item dar
  12007. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12008. @item n
  12009. The number of the input frame, starting from 0.
  12010. @item t
  12011. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12012. @item pos
  12013. the position in the file of the input frame, NAN if unknown
  12014. @end table
  12015. @section swapuv
  12016. Swap U & V plane.
  12017. @section telecine
  12018. Apply telecine process to the video.
  12019. This filter accepts the following options:
  12020. @table @option
  12021. @item first_field
  12022. @table @samp
  12023. @item top, t
  12024. top field first
  12025. @item bottom, b
  12026. bottom field first
  12027. The default value is @code{top}.
  12028. @end table
  12029. @item pattern
  12030. A string of numbers representing the pulldown pattern you wish to apply.
  12031. The default value is @code{23}.
  12032. @end table
  12033. @example
  12034. Some typical patterns:
  12035. NTSC output (30i):
  12036. 27.5p: 32222
  12037. 24p: 23 (classic)
  12038. 24p: 2332 (preferred)
  12039. 20p: 33
  12040. 18p: 334
  12041. 16p: 3444
  12042. PAL output (25i):
  12043. 27.5p: 12222
  12044. 24p: 222222222223 ("Euro pulldown")
  12045. 16.67p: 33
  12046. 16p: 33333334
  12047. @end example
  12048. @section threshold
  12049. Apply threshold effect to video stream.
  12050. This filter needs four video streams to perform thresholding.
  12051. First stream is stream we are filtering.
  12052. Second stream is holding threshold values, third stream is holding min values,
  12053. and last, fourth stream is holding max values.
  12054. The filter accepts the following option:
  12055. @table @option
  12056. @item planes
  12057. Set which planes will be processed, unprocessed planes will be copied.
  12058. By default value 0xf, all planes will be processed.
  12059. @end table
  12060. For example if first stream pixel's component value is less then threshold value
  12061. of pixel component from 2nd threshold stream, third stream value will picked,
  12062. otherwise fourth stream pixel component value will be picked.
  12063. Using color source filter one can perform various types of thresholding:
  12064. @subsection Examples
  12065. @itemize
  12066. @item
  12067. Binary threshold, using gray color as threshold:
  12068. @example
  12069. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12070. @end example
  12071. @item
  12072. Inverted binary threshold, using gray color as threshold:
  12073. @example
  12074. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12075. @end example
  12076. @item
  12077. Truncate binary threshold, using gray color as threshold:
  12078. @example
  12079. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12080. @end example
  12081. @item
  12082. Threshold to zero, using gray color as threshold:
  12083. @example
  12084. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12085. @end example
  12086. @item
  12087. Inverted threshold to zero, using gray color as threshold:
  12088. @example
  12089. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12090. @end example
  12091. @end itemize
  12092. @section thumbnail
  12093. Select the most representative frame in a given sequence of consecutive frames.
  12094. The filter accepts the following options:
  12095. @table @option
  12096. @item n
  12097. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12098. will pick one of them, and then handle the next batch of @var{n} frames until
  12099. the end. Default is @code{100}.
  12100. @end table
  12101. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12102. value will result in a higher memory usage, so a high value is not recommended.
  12103. @subsection Examples
  12104. @itemize
  12105. @item
  12106. Extract one picture each 50 frames:
  12107. @example
  12108. thumbnail=50
  12109. @end example
  12110. @item
  12111. Complete example of a thumbnail creation with @command{ffmpeg}:
  12112. @example
  12113. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12114. @end example
  12115. @end itemize
  12116. @section tile
  12117. Tile several successive frames together.
  12118. The filter accepts the following options:
  12119. @table @option
  12120. @item layout
  12121. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12122. this option, check the
  12123. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12124. @item nb_frames
  12125. Set the maximum number of frames to render in the given area. It must be less
  12126. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12127. the area will be used.
  12128. @item margin
  12129. Set the outer border margin in pixels.
  12130. @item padding
  12131. Set the inner border thickness (i.e. the number of pixels between frames). For
  12132. more advanced padding options (such as having different values for the edges),
  12133. refer to the pad video filter.
  12134. @item color
  12135. Specify the color of the unused area. For the syntax of this option, check the
  12136. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12137. The default value of @var{color} is "black".
  12138. @item overlap
  12139. Set the number of frames to overlap when tiling several successive frames together.
  12140. The value must be between @code{0} and @var{nb_frames - 1}.
  12141. @item init_padding
  12142. Set the number of frames to initially be empty before displaying first output frame.
  12143. This controls how soon will one get first output frame.
  12144. The value must be between @code{0} and @var{nb_frames - 1}.
  12145. @end table
  12146. @subsection Examples
  12147. @itemize
  12148. @item
  12149. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12150. @example
  12151. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12152. @end example
  12153. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12154. duplicating each output frame to accommodate the originally detected frame
  12155. rate.
  12156. @item
  12157. Display @code{5} pictures in an area of @code{3x2} frames,
  12158. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12159. mixed flat and named options:
  12160. @example
  12161. tile=3x2:nb_frames=5:padding=7:margin=2
  12162. @end example
  12163. @end itemize
  12164. @section tinterlace
  12165. Perform various types of temporal field interlacing.
  12166. Frames are counted starting from 1, so the first input frame is
  12167. considered odd.
  12168. The filter accepts the following options:
  12169. @table @option
  12170. @item mode
  12171. Specify the mode of the interlacing. This option can also be specified
  12172. as a value alone. See below for a list of values for this option.
  12173. Available values are:
  12174. @table @samp
  12175. @item merge, 0
  12176. Move odd frames into the upper field, even into the lower field,
  12177. generating a double height frame at half frame rate.
  12178. @example
  12179. ------> time
  12180. Input:
  12181. Frame 1 Frame 2 Frame 3 Frame 4
  12182. 11111 22222 33333 44444
  12183. 11111 22222 33333 44444
  12184. 11111 22222 33333 44444
  12185. 11111 22222 33333 44444
  12186. Output:
  12187. 11111 33333
  12188. 22222 44444
  12189. 11111 33333
  12190. 22222 44444
  12191. 11111 33333
  12192. 22222 44444
  12193. 11111 33333
  12194. 22222 44444
  12195. @end example
  12196. @item drop_even, 1
  12197. Only output odd frames, even frames are dropped, generating a frame with
  12198. unchanged height at half frame rate.
  12199. @example
  12200. ------> time
  12201. Input:
  12202. Frame 1 Frame 2 Frame 3 Frame 4
  12203. 11111 22222 33333 44444
  12204. 11111 22222 33333 44444
  12205. 11111 22222 33333 44444
  12206. 11111 22222 33333 44444
  12207. Output:
  12208. 11111 33333
  12209. 11111 33333
  12210. 11111 33333
  12211. 11111 33333
  12212. @end example
  12213. @item drop_odd, 2
  12214. Only output even frames, odd frames are dropped, generating a frame with
  12215. unchanged height at half frame rate.
  12216. @example
  12217. ------> time
  12218. Input:
  12219. Frame 1 Frame 2 Frame 3 Frame 4
  12220. 11111 22222 33333 44444
  12221. 11111 22222 33333 44444
  12222. 11111 22222 33333 44444
  12223. 11111 22222 33333 44444
  12224. Output:
  12225. 22222 44444
  12226. 22222 44444
  12227. 22222 44444
  12228. 22222 44444
  12229. @end example
  12230. @item pad, 3
  12231. Expand each frame to full height, but pad alternate lines with black,
  12232. generating a frame with double height at the same input frame rate.
  12233. @example
  12234. ------> time
  12235. Input:
  12236. Frame 1 Frame 2 Frame 3 Frame 4
  12237. 11111 22222 33333 44444
  12238. 11111 22222 33333 44444
  12239. 11111 22222 33333 44444
  12240. 11111 22222 33333 44444
  12241. Output:
  12242. 11111 ..... 33333 .....
  12243. ..... 22222 ..... 44444
  12244. 11111 ..... 33333 .....
  12245. ..... 22222 ..... 44444
  12246. 11111 ..... 33333 .....
  12247. ..... 22222 ..... 44444
  12248. 11111 ..... 33333 .....
  12249. ..... 22222 ..... 44444
  12250. @end example
  12251. @item interleave_top, 4
  12252. Interleave the upper field from odd frames with the lower field from
  12253. even frames, generating a frame with unchanged height at half frame rate.
  12254. @example
  12255. ------> time
  12256. Input:
  12257. Frame 1 Frame 2 Frame 3 Frame 4
  12258. 11111<- 22222 33333<- 44444
  12259. 11111 22222<- 33333 44444<-
  12260. 11111<- 22222 33333<- 44444
  12261. 11111 22222<- 33333 44444<-
  12262. Output:
  12263. 11111 33333
  12264. 22222 44444
  12265. 11111 33333
  12266. 22222 44444
  12267. @end example
  12268. @item interleave_bottom, 5
  12269. Interleave the lower field from odd frames with the upper field from
  12270. even frames, generating a frame with unchanged height at half frame rate.
  12271. @example
  12272. ------> time
  12273. Input:
  12274. Frame 1 Frame 2 Frame 3 Frame 4
  12275. 11111 22222<- 33333 44444<-
  12276. 11111<- 22222 33333<- 44444
  12277. 11111 22222<- 33333 44444<-
  12278. 11111<- 22222 33333<- 44444
  12279. Output:
  12280. 22222 44444
  12281. 11111 33333
  12282. 22222 44444
  12283. 11111 33333
  12284. @end example
  12285. @item interlacex2, 6
  12286. Double frame rate with unchanged height. Frames are inserted each
  12287. containing the second temporal field from the previous input frame and
  12288. the first temporal field from the next input frame. This mode relies on
  12289. the top_field_first flag. Useful for interlaced video displays with no
  12290. field synchronisation.
  12291. @example
  12292. ------> time
  12293. Input:
  12294. Frame 1 Frame 2 Frame 3 Frame 4
  12295. 11111 22222 33333 44444
  12296. 11111 22222 33333 44444
  12297. 11111 22222 33333 44444
  12298. 11111 22222 33333 44444
  12299. Output:
  12300. 11111 22222 22222 33333 33333 44444 44444
  12301. 11111 11111 22222 22222 33333 33333 44444
  12302. 11111 22222 22222 33333 33333 44444 44444
  12303. 11111 11111 22222 22222 33333 33333 44444
  12304. @end example
  12305. @item mergex2, 7
  12306. Move odd frames into the upper field, even into the lower field,
  12307. generating a double height frame at same frame rate.
  12308. @example
  12309. ------> time
  12310. Input:
  12311. Frame 1 Frame 2 Frame 3 Frame 4
  12312. 11111 22222 33333 44444
  12313. 11111 22222 33333 44444
  12314. 11111 22222 33333 44444
  12315. 11111 22222 33333 44444
  12316. Output:
  12317. 11111 33333 33333 55555
  12318. 22222 22222 44444 44444
  12319. 11111 33333 33333 55555
  12320. 22222 22222 44444 44444
  12321. 11111 33333 33333 55555
  12322. 22222 22222 44444 44444
  12323. 11111 33333 33333 55555
  12324. 22222 22222 44444 44444
  12325. @end example
  12326. @end table
  12327. Numeric values are deprecated but are accepted for backward
  12328. compatibility reasons.
  12329. Default mode is @code{merge}.
  12330. @item flags
  12331. Specify flags influencing the filter process.
  12332. Available value for @var{flags} is:
  12333. @table @option
  12334. @item low_pass_filter, vlfp
  12335. Enable linear vertical low-pass filtering in the filter.
  12336. Vertical low-pass filtering is required when creating an interlaced
  12337. destination from a progressive source which contains high-frequency
  12338. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12339. patterning.
  12340. @item complex_filter, cvlfp
  12341. Enable complex vertical low-pass filtering.
  12342. This will slightly less reduce interlace 'twitter' and Moire
  12343. patterning but better retain detail and subjective sharpness impression.
  12344. @end table
  12345. Vertical low-pass filtering can only be enabled for @option{mode}
  12346. @var{interleave_top} and @var{interleave_bottom}.
  12347. @end table
  12348. @section tmix
  12349. Mix successive video frames.
  12350. A description of the accepted options follows.
  12351. @table @option
  12352. @item frames
  12353. The number of successive frames to mix. If unspecified, it defaults to 3.
  12354. @item weights
  12355. Specify weight of each input video frame.
  12356. Each weight is separated by space. If number of weights is smaller than
  12357. number of @var{frames} last specified weight will be used for all remaining
  12358. unset weights.
  12359. @item scale
  12360. Specify scale, if it is set it will be multiplied with sum
  12361. of each weight multiplied with pixel values to give final destination
  12362. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12363. @end table
  12364. @subsection Examples
  12365. @itemize
  12366. @item
  12367. Average 7 successive frames:
  12368. @example
  12369. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12370. @end example
  12371. @item
  12372. Apply simple temporal convolution:
  12373. @example
  12374. tmix=frames=3:weights="-1 3 -1"
  12375. @end example
  12376. @item
  12377. Similar as above but only showing temporal differences:
  12378. @example
  12379. tmix=frames=3:weights="-1 2 -1":scale=1
  12380. @end example
  12381. @end itemize
  12382. @section tonemap
  12383. Tone map colors from different dynamic ranges.
  12384. This filter expects data in single precision floating point, as it needs to
  12385. operate on (and can output) out-of-range values. Another filter, such as
  12386. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12387. The tonemapping algorithms implemented only work on linear light, so input
  12388. data should be linearized beforehand (and possibly correctly tagged).
  12389. @example
  12390. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12391. @end example
  12392. @subsection Options
  12393. The filter accepts the following options.
  12394. @table @option
  12395. @item tonemap
  12396. Set the tone map algorithm to use.
  12397. Possible values are:
  12398. @table @var
  12399. @item none
  12400. Do not apply any tone map, only desaturate overbright pixels.
  12401. @item clip
  12402. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12403. in-range values, while distorting out-of-range values.
  12404. @item linear
  12405. Stretch the entire reference gamut to a linear multiple of the display.
  12406. @item gamma
  12407. Fit a logarithmic transfer between the tone curves.
  12408. @item reinhard
  12409. Preserve overall image brightness with a simple curve, using nonlinear
  12410. contrast, which results in flattening details and degrading color accuracy.
  12411. @item hable
  12412. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12413. of slightly darkening everything. Use it when detail preservation is more
  12414. important than color and brightness accuracy.
  12415. @item mobius
  12416. Smoothly map out-of-range values, while retaining contrast and colors for
  12417. in-range material as much as possible. Use it when color accuracy is more
  12418. important than detail preservation.
  12419. @end table
  12420. Default is none.
  12421. @item param
  12422. Tune the tone mapping algorithm.
  12423. This affects the following algorithms:
  12424. @table @var
  12425. @item none
  12426. Ignored.
  12427. @item linear
  12428. Specifies the scale factor to use while stretching.
  12429. Default to 1.0.
  12430. @item gamma
  12431. Specifies the exponent of the function.
  12432. Default to 1.8.
  12433. @item clip
  12434. Specify an extra linear coefficient to multiply into the signal before clipping.
  12435. Default to 1.0.
  12436. @item reinhard
  12437. Specify the local contrast coefficient at the display peak.
  12438. Default to 0.5, which means that in-gamut values will be about half as bright
  12439. as when clipping.
  12440. @item hable
  12441. Ignored.
  12442. @item mobius
  12443. Specify the transition point from linear to mobius transform. Every value
  12444. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12445. more accurate the result will be, at the cost of losing bright details.
  12446. Default to 0.3, which due to the steep initial slope still preserves in-range
  12447. colors fairly accurately.
  12448. @end table
  12449. @item desat
  12450. Apply desaturation for highlights that exceed this level of brightness. The
  12451. higher the parameter, the more color information will be preserved. This
  12452. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12453. (smoothly) turning into white instead. This makes images feel more natural,
  12454. at the cost of reducing information about out-of-range colors.
  12455. The default of 2.0 is somewhat conservative and will mostly just apply to
  12456. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12457. This option works only if the input frame has a supported color tag.
  12458. @item peak
  12459. Override signal/nominal/reference peak with this value. Useful when the
  12460. embedded peak information in display metadata is not reliable or when tone
  12461. mapping from a lower range to a higher range.
  12462. @end table
  12463. @anchor{transpose}
  12464. @section transpose
  12465. Transpose rows with columns in the input video and optionally flip it.
  12466. It accepts the following parameters:
  12467. @table @option
  12468. @item dir
  12469. Specify the transposition direction.
  12470. Can assume the following values:
  12471. @table @samp
  12472. @item 0, 4, cclock_flip
  12473. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12474. @example
  12475. L.R L.l
  12476. . . -> . .
  12477. l.r R.r
  12478. @end example
  12479. @item 1, 5, clock
  12480. Rotate by 90 degrees clockwise, that is:
  12481. @example
  12482. L.R l.L
  12483. . . -> . .
  12484. l.r r.R
  12485. @end example
  12486. @item 2, 6, cclock
  12487. Rotate by 90 degrees counterclockwise, that is:
  12488. @example
  12489. L.R R.r
  12490. . . -> . .
  12491. l.r L.l
  12492. @end example
  12493. @item 3, 7, clock_flip
  12494. Rotate by 90 degrees clockwise and vertically flip, that is:
  12495. @example
  12496. L.R r.R
  12497. . . -> . .
  12498. l.r l.L
  12499. @end example
  12500. @end table
  12501. For values between 4-7, the transposition is only done if the input
  12502. video geometry is portrait and not landscape. These values are
  12503. deprecated, the @code{passthrough} option should be used instead.
  12504. Numerical values are deprecated, and should be dropped in favor of
  12505. symbolic constants.
  12506. @item passthrough
  12507. Do not apply the transposition if the input geometry matches the one
  12508. specified by the specified value. It accepts the following values:
  12509. @table @samp
  12510. @item none
  12511. Always apply transposition.
  12512. @item portrait
  12513. Preserve portrait geometry (when @var{height} >= @var{width}).
  12514. @item landscape
  12515. Preserve landscape geometry (when @var{width} >= @var{height}).
  12516. @end table
  12517. Default value is @code{none}.
  12518. @end table
  12519. For example to rotate by 90 degrees clockwise and preserve portrait
  12520. layout:
  12521. @example
  12522. transpose=dir=1:passthrough=portrait
  12523. @end example
  12524. The command above can also be specified as:
  12525. @example
  12526. transpose=1:portrait
  12527. @end example
  12528. @section transpose_npp
  12529. Transpose rows with columns in the input video and optionally flip it.
  12530. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12531. It accepts the following parameters:
  12532. @table @option
  12533. @item dir
  12534. Specify the transposition direction.
  12535. Can assume the following values:
  12536. @table @samp
  12537. @item cclock_flip
  12538. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12539. @item clock
  12540. Rotate by 90 degrees clockwise.
  12541. @item cclock
  12542. Rotate by 90 degrees counterclockwise.
  12543. @item clock_flip
  12544. Rotate by 90 degrees clockwise and vertically flip.
  12545. @end table
  12546. @item passthrough
  12547. Do not apply the transposition if the input geometry matches the one
  12548. specified by the specified value. It accepts the following values:
  12549. @table @samp
  12550. @item none
  12551. Always apply transposition. (default)
  12552. @item portrait
  12553. Preserve portrait geometry (when @var{height} >= @var{width}).
  12554. @item landscape
  12555. Preserve landscape geometry (when @var{width} >= @var{height}).
  12556. @end table
  12557. @end table
  12558. @section trim
  12559. Trim the input so that the output contains one continuous subpart of the input.
  12560. It accepts the following parameters:
  12561. @table @option
  12562. @item start
  12563. Specify the time of the start of the kept section, i.e. the frame with the
  12564. timestamp @var{start} will be the first frame in the output.
  12565. @item end
  12566. Specify the time of the first frame that will be dropped, i.e. the frame
  12567. immediately preceding the one with the timestamp @var{end} will be the last
  12568. frame in the output.
  12569. @item start_pts
  12570. This is the same as @var{start}, except this option sets the start timestamp
  12571. in timebase units instead of seconds.
  12572. @item end_pts
  12573. This is the same as @var{end}, except this option sets the end timestamp
  12574. in timebase units instead of seconds.
  12575. @item duration
  12576. The maximum duration of the output in seconds.
  12577. @item start_frame
  12578. The number of the first frame that should be passed to the output.
  12579. @item end_frame
  12580. The number of the first frame that should be dropped.
  12581. @end table
  12582. @option{start}, @option{end}, and @option{duration} are expressed as time
  12583. duration specifications; see
  12584. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12585. for the accepted syntax.
  12586. Note that the first two sets of the start/end options and the @option{duration}
  12587. option look at the frame timestamp, while the _frame variants simply count the
  12588. frames that pass through the filter. Also note that this filter does not modify
  12589. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12590. setpts filter after the trim filter.
  12591. If multiple start or end options are set, this filter tries to be greedy and
  12592. keep all the frames that match at least one of the specified constraints. To keep
  12593. only the part that matches all the constraints at once, chain multiple trim
  12594. filters.
  12595. The defaults are such that all the input is kept. So it is possible to set e.g.
  12596. just the end values to keep everything before the specified time.
  12597. Examples:
  12598. @itemize
  12599. @item
  12600. Drop everything except the second minute of input:
  12601. @example
  12602. ffmpeg -i INPUT -vf trim=60:120
  12603. @end example
  12604. @item
  12605. Keep only the first second:
  12606. @example
  12607. ffmpeg -i INPUT -vf trim=duration=1
  12608. @end example
  12609. @end itemize
  12610. @section unpremultiply
  12611. Apply alpha unpremultiply effect to input video stream using first plane
  12612. of second stream as alpha.
  12613. Both streams must have same dimensions and same pixel format.
  12614. The filter accepts the following option:
  12615. @table @option
  12616. @item planes
  12617. Set which planes will be processed, unprocessed planes will be copied.
  12618. By default value 0xf, all planes will be processed.
  12619. If the format has 1 or 2 components, then luma is bit 0.
  12620. If the format has 3 or 4 components:
  12621. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12622. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12623. If present, the alpha channel is always the last bit.
  12624. @item inplace
  12625. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12626. @end table
  12627. @anchor{unsharp}
  12628. @section unsharp
  12629. Sharpen or blur the input video.
  12630. It accepts the following parameters:
  12631. @table @option
  12632. @item luma_msize_x, lx
  12633. Set the luma matrix horizontal size. It must be an odd integer between
  12634. 3 and 23. The default value is 5.
  12635. @item luma_msize_y, ly
  12636. Set the luma matrix vertical size. It must be an odd integer between 3
  12637. and 23. The default value is 5.
  12638. @item luma_amount, la
  12639. Set the luma effect strength. It must be a floating point number, reasonable
  12640. values lay between -1.5 and 1.5.
  12641. Negative values will blur the input video, while positive values will
  12642. sharpen it, a value of zero will disable the effect.
  12643. Default value is 1.0.
  12644. @item chroma_msize_x, cx
  12645. Set the chroma matrix horizontal size. It must be an odd integer
  12646. between 3 and 23. The default value is 5.
  12647. @item chroma_msize_y, cy
  12648. Set the chroma matrix vertical size. It must be an odd integer
  12649. between 3 and 23. The default value is 5.
  12650. @item chroma_amount, ca
  12651. Set the chroma effect strength. It must be a floating point number, reasonable
  12652. values lay between -1.5 and 1.5.
  12653. Negative values will blur the input video, while positive values will
  12654. sharpen it, a value of zero will disable the effect.
  12655. Default value is 0.0.
  12656. @end table
  12657. All parameters are optional and default to the equivalent of the
  12658. string '5:5:1.0:5:5:0.0'.
  12659. @subsection Examples
  12660. @itemize
  12661. @item
  12662. Apply strong luma sharpen effect:
  12663. @example
  12664. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12665. @end example
  12666. @item
  12667. Apply a strong blur of both luma and chroma parameters:
  12668. @example
  12669. unsharp=7:7:-2:7:7:-2
  12670. @end example
  12671. @end itemize
  12672. @section uspp
  12673. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12674. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12675. shifts and average the results.
  12676. The way this differs from the behavior of spp is that uspp actually encodes &
  12677. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12678. DCT similar to MJPEG.
  12679. The filter accepts the following options:
  12680. @table @option
  12681. @item quality
  12682. Set quality. This option defines the number of levels for averaging. It accepts
  12683. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12684. effect. A value of @code{8} means the higher quality. For each increment of
  12685. that value the speed drops by a factor of approximately 2. Default value is
  12686. @code{3}.
  12687. @item qp
  12688. Force a constant quantization parameter. If not set, the filter will use the QP
  12689. from the video stream (if available).
  12690. @end table
  12691. @section vaguedenoiser
  12692. Apply a wavelet based denoiser.
  12693. It transforms each frame from the video input into the wavelet domain,
  12694. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12695. the obtained coefficients. It does an inverse wavelet transform after.
  12696. Due to wavelet properties, it should give a nice smoothed result, and
  12697. reduced noise, without blurring picture features.
  12698. This filter accepts the following options:
  12699. @table @option
  12700. @item threshold
  12701. The filtering strength. The higher, the more filtered the video will be.
  12702. Hard thresholding can use a higher threshold than soft thresholding
  12703. before the video looks overfiltered. Default value is 2.
  12704. @item method
  12705. The filtering method the filter will use.
  12706. It accepts the following values:
  12707. @table @samp
  12708. @item hard
  12709. All values under the threshold will be zeroed.
  12710. @item soft
  12711. All values under the threshold will be zeroed. All values above will be
  12712. reduced by the threshold.
  12713. @item garrote
  12714. Scales or nullifies coefficients - intermediary between (more) soft and
  12715. (less) hard thresholding.
  12716. @end table
  12717. Default is garrote.
  12718. @item nsteps
  12719. Number of times, the wavelet will decompose the picture. Picture can't
  12720. be decomposed beyond a particular point (typically, 8 for a 640x480
  12721. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12722. @item percent
  12723. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12724. @item planes
  12725. A list of the planes to process. By default all planes are processed.
  12726. @end table
  12727. @section vectorscope
  12728. Display 2 color component values in the two dimensional graph (which is called
  12729. a vectorscope).
  12730. This filter accepts the following options:
  12731. @table @option
  12732. @item mode, m
  12733. Set vectorscope mode.
  12734. It accepts the following values:
  12735. @table @samp
  12736. @item gray
  12737. Gray values are displayed on graph, higher brightness means more pixels have
  12738. same component color value on location in graph. This is the default mode.
  12739. @item color
  12740. Gray values are displayed on graph. Surrounding pixels values which are not
  12741. present in video frame are drawn in gradient of 2 color components which are
  12742. set by option @code{x} and @code{y}. The 3rd color component is static.
  12743. @item color2
  12744. Actual color components values present in video frame are displayed on graph.
  12745. @item color3
  12746. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12747. on graph increases value of another color component, which is luminance by
  12748. default values of @code{x} and @code{y}.
  12749. @item color4
  12750. Actual colors present in video frame are displayed on graph. If two different
  12751. colors map to same position on graph then color with higher value of component
  12752. not present in graph is picked.
  12753. @item color5
  12754. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12755. component picked from radial gradient.
  12756. @end table
  12757. @item x
  12758. Set which color component will be represented on X-axis. Default is @code{1}.
  12759. @item y
  12760. Set which color component will be represented on Y-axis. Default is @code{2}.
  12761. @item intensity, i
  12762. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12763. of color component which represents frequency of (X, Y) location in graph.
  12764. @item envelope, e
  12765. @table @samp
  12766. @item none
  12767. No envelope, this is default.
  12768. @item instant
  12769. Instant envelope, even darkest single pixel will be clearly highlighted.
  12770. @item peak
  12771. Hold maximum and minimum values presented in graph over time. This way you
  12772. can still spot out of range values without constantly looking at vectorscope.
  12773. @item peak+instant
  12774. Peak and instant envelope combined together.
  12775. @end table
  12776. @item graticule, g
  12777. Set what kind of graticule to draw.
  12778. @table @samp
  12779. @item none
  12780. @item green
  12781. @item color
  12782. @end table
  12783. @item opacity, o
  12784. Set graticule opacity.
  12785. @item flags, f
  12786. Set graticule flags.
  12787. @table @samp
  12788. @item white
  12789. Draw graticule for white point.
  12790. @item black
  12791. Draw graticule for black point.
  12792. @item name
  12793. Draw color points short names.
  12794. @end table
  12795. @item bgopacity, b
  12796. Set background opacity.
  12797. @item lthreshold, l
  12798. Set low threshold for color component not represented on X or Y axis.
  12799. Values lower than this value will be ignored. Default is 0.
  12800. Note this value is multiplied with actual max possible value one pixel component
  12801. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12802. is 0.1 * 255 = 25.
  12803. @item hthreshold, h
  12804. Set high threshold for color component not represented on X or Y axis.
  12805. Values higher than this value will be ignored. Default is 1.
  12806. Note this value is multiplied with actual max possible value one pixel component
  12807. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12808. is 0.9 * 255 = 230.
  12809. @item colorspace, c
  12810. Set what kind of colorspace to use when drawing graticule.
  12811. @table @samp
  12812. @item auto
  12813. @item 601
  12814. @item 709
  12815. @end table
  12816. Default is auto.
  12817. @end table
  12818. @anchor{vidstabdetect}
  12819. @section vidstabdetect
  12820. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12821. @ref{vidstabtransform} for pass 2.
  12822. This filter generates a file with relative translation and rotation
  12823. transform information about subsequent frames, which is then used by
  12824. the @ref{vidstabtransform} filter.
  12825. To enable compilation of this filter you need to configure FFmpeg with
  12826. @code{--enable-libvidstab}.
  12827. This filter accepts the following options:
  12828. @table @option
  12829. @item result
  12830. Set the path to the file used to write the transforms information.
  12831. Default value is @file{transforms.trf}.
  12832. @item shakiness
  12833. Set how shaky the video is and how quick the camera is. It accepts an
  12834. integer in the range 1-10, a value of 1 means little shakiness, a
  12835. value of 10 means strong shakiness. Default value is 5.
  12836. @item accuracy
  12837. Set the accuracy of the detection process. It must be a value in the
  12838. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12839. accuracy. Default value is 15.
  12840. @item stepsize
  12841. Set stepsize of the search process. The region around minimum is
  12842. scanned with 1 pixel resolution. Default value is 6.
  12843. @item mincontrast
  12844. Set minimum contrast. Below this value a local measurement field is
  12845. discarded. Must be a floating point value in the range 0-1. Default
  12846. value is 0.3.
  12847. @item tripod
  12848. Set reference frame number for tripod mode.
  12849. If enabled, the motion of the frames is compared to a reference frame
  12850. in the filtered stream, identified by the specified number. The idea
  12851. is to compensate all movements in a more-or-less static scene and keep
  12852. the camera view absolutely still.
  12853. If set to 0, it is disabled. The frames are counted starting from 1.
  12854. @item show
  12855. Show fields and transforms in the resulting frames. It accepts an
  12856. integer in the range 0-2. Default value is 0, which disables any
  12857. visualization.
  12858. @end table
  12859. @subsection Examples
  12860. @itemize
  12861. @item
  12862. Use default values:
  12863. @example
  12864. vidstabdetect
  12865. @end example
  12866. @item
  12867. Analyze strongly shaky movie and put the results in file
  12868. @file{mytransforms.trf}:
  12869. @example
  12870. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12871. @end example
  12872. @item
  12873. Visualize the result of internal transformations in the resulting
  12874. video:
  12875. @example
  12876. vidstabdetect=show=1
  12877. @end example
  12878. @item
  12879. Analyze a video with medium shakiness using @command{ffmpeg}:
  12880. @example
  12881. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12882. @end example
  12883. @end itemize
  12884. @anchor{vidstabtransform}
  12885. @section vidstabtransform
  12886. Video stabilization/deshaking: pass 2 of 2,
  12887. see @ref{vidstabdetect} for pass 1.
  12888. Read a file with transform information for each frame and
  12889. apply/compensate them. Together with the @ref{vidstabdetect}
  12890. filter this can be used to deshake videos. See also
  12891. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12892. the @ref{unsharp} filter, see below.
  12893. To enable compilation of this filter you need to configure FFmpeg with
  12894. @code{--enable-libvidstab}.
  12895. @subsection Options
  12896. @table @option
  12897. @item input
  12898. Set path to the file used to read the transforms. Default value is
  12899. @file{transforms.trf}.
  12900. @item smoothing
  12901. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12902. camera movements. Default value is 10.
  12903. For example a number of 10 means that 21 frames are used (10 in the
  12904. past and 10 in the future) to smoothen the motion in the video. A
  12905. larger value leads to a smoother video, but limits the acceleration of
  12906. the camera (pan/tilt movements). 0 is a special case where a static
  12907. camera is simulated.
  12908. @item optalgo
  12909. Set the camera path optimization algorithm.
  12910. Accepted values are:
  12911. @table @samp
  12912. @item gauss
  12913. gaussian kernel low-pass filter on camera motion (default)
  12914. @item avg
  12915. averaging on transformations
  12916. @end table
  12917. @item maxshift
  12918. Set maximal number of pixels to translate frames. Default value is -1,
  12919. meaning no limit.
  12920. @item maxangle
  12921. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12922. value is -1, meaning no limit.
  12923. @item crop
  12924. Specify how to deal with borders that may be visible due to movement
  12925. compensation.
  12926. Available values are:
  12927. @table @samp
  12928. @item keep
  12929. keep image information from previous frame (default)
  12930. @item black
  12931. fill the border black
  12932. @end table
  12933. @item invert
  12934. Invert transforms if set to 1. Default value is 0.
  12935. @item relative
  12936. Consider transforms as relative to previous frame if set to 1,
  12937. absolute if set to 0. Default value is 0.
  12938. @item zoom
  12939. Set percentage to zoom. A positive value will result in a zoom-in
  12940. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12941. zoom).
  12942. @item optzoom
  12943. Set optimal zooming to avoid borders.
  12944. Accepted values are:
  12945. @table @samp
  12946. @item 0
  12947. disabled
  12948. @item 1
  12949. optimal static zoom value is determined (only very strong movements
  12950. will lead to visible borders) (default)
  12951. @item 2
  12952. optimal adaptive zoom value is determined (no borders will be
  12953. visible), see @option{zoomspeed}
  12954. @end table
  12955. Note that the value given at zoom is added to the one calculated here.
  12956. @item zoomspeed
  12957. Set percent to zoom maximally each frame (enabled when
  12958. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12959. 0.25.
  12960. @item interpol
  12961. Specify type of interpolation.
  12962. Available values are:
  12963. @table @samp
  12964. @item no
  12965. no interpolation
  12966. @item linear
  12967. linear only horizontal
  12968. @item bilinear
  12969. linear in both directions (default)
  12970. @item bicubic
  12971. cubic in both directions (slow)
  12972. @end table
  12973. @item tripod
  12974. Enable virtual tripod mode if set to 1, which is equivalent to
  12975. @code{relative=0:smoothing=0}. Default value is 0.
  12976. Use also @code{tripod} option of @ref{vidstabdetect}.
  12977. @item debug
  12978. Increase log verbosity if set to 1. Also the detected global motions
  12979. are written to the temporary file @file{global_motions.trf}. Default
  12980. value is 0.
  12981. @end table
  12982. @subsection Examples
  12983. @itemize
  12984. @item
  12985. Use @command{ffmpeg} for a typical stabilization with default values:
  12986. @example
  12987. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12988. @end example
  12989. Note the use of the @ref{unsharp} filter which is always recommended.
  12990. @item
  12991. Zoom in a bit more and load transform data from a given file:
  12992. @example
  12993. vidstabtransform=zoom=5:input="mytransforms.trf"
  12994. @end example
  12995. @item
  12996. Smoothen the video even more:
  12997. @example
  12998. vidstabtransform=smoothing=30
  12999. @end example
  13000. @end itemize
  13001. @section vflip
  13002. Flip the input video vertically.
  13003. For example, to vertically flip a video with @command{ffmpeg}:
  13004. @example
  13005. ffmpeg -i in.avi -vf "vflip" out.avi
  13006. @end example
  13007. @section vfrdet
  13008. Detect variable frame rate video.
  13009. This filter tries to detect if the input is variable or constant frame rate.
  13010. At end it will output number of frames detected as having variable delta pts,
  13011. and ones with constant delta pts.
  13012. If there was frames with variable delta, than it will also show min and max delta
  13013. encountered.
  13014. @anchor{vignette}
  13015. @section vignette
  13016. Make or reverse a natural vignetting effect.
  13017. The filter accepts the following options:
  13018. @table @option
  13019. @item angle, a
  13020. Set lens angle expression as a number of radians.
  13021. The value is clipped in the @code{[0,PI/2]} range.
  13022. Default value: @code{"PI/5"}
  13023. @item x0
  13024. @item y0
  13025. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13026. by default.
  13027. @item mode
  13028. Set forward/backward mode.
  13029. Available modes are:
  13030. @table @samp
  13031. @item forward
  13032. The larger the distance from the central point, the darker the image becomes.
  13033. @item backward
  13034. The larger the distance from the central point, the brighter the image becomes.
  13035. This can be used to reverse a vignette effect, though there is no automatic
  13036. detection to extract the lens @option{angle} and other settings (yet). It can
  13037. also be used to create a burning effect.
  13038. @end table
  13039. Default value is @samp{forward}.
  13040. @item eval
  13041. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13042. It accepts the following values:
  13043. @table @samp
  13044. @item init
  13045. Evaluate expressions only once during the filter initialization.
  13046. @item frame
  13047. Evaluate expressions for each incoming frame. This is way slower than the
  13048. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13049. allows advanced dynamic expressions.
  13050. @end table
  13051. Default value is @samp{init}.
  13052. @item dither
  13053. Set dithering to reduce the circular banding effects. Default is @code{1}
  13054. (enabled).
  13055. @item aspect
  13056. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13057. Setting this value to the SAR of the input will make a rectangular vignetting
  13058. following the dimensions of the video.
  13059. Default is @code{1/1}.
  13060. @end table
  13061. @subsection Expressions
  13062. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13063. following parameters.
  13064. @table @option
  13065. @item w
  13066. @item h
  13067. input width and height
  13068. @item n
  13069. the number of input frame, starting from 0
  13070. @item pts
  13071. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13072. @var{TB} units, NAN if undefined
  13073. @item r
  13074. frame rate of the input video, NAN if the input frame rate is unknown
  13075. @item t
  13076. the PTS (Presentation TimeStamp) of the filtered video frame,
  13077. expressed in seconds, NAN if undefined
  13078. @item tb
  13079. time base of the input video
  13080. @end table
  13081. @subsection Examples
  13082. @itemize
  13083. @item
  13084. Apply simple strong vignetting effect:
  13085. @example
  13086. vignette=PI/4
  13087. @end example
  13088. @item
  13089. Make a flickering vignetting:
  13090. @example
  13091. vignette='PI/4+random(1)*PI/50':eval=frame
  13092. @end example
  13093. @end itemize
  13094. @section vmafmotion
  13095. Obtain the average vmaf motion score of a video.
  13096. It is one of the component filters of VMAF.
  13097. The obtained average motion score is printed through the logging system.
  13098. In the below example the input file @file{ref.mpg} is being processed and score
  13099. is computed.
  13100. @example
  13101. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13102. @end example
  13103. @section vstack
  13104. Stack input videos vertically.
  13105. All streams must be of same pixel format and of same width.
  13106. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13107. to create same output.
  13108. The filter accept the following option:
  13109. @table @option
  13110. @item inputs
  13111. Set number of input streams. Default is 2.
  13112. @item shortest
  13113. If set to 1, force the output to terminate when the shortest input
  13114. terminates. Default value is 0.
  13115. @end table
  13116. @section w3fdif
  13117. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13118. Deinterlacing Filter").
  13119. Based on the process described by Martin Weston for BBC R&D, and
  13120. implemented based on the de-interlace algorithm written by Jim
  13121. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13122. uses filter coefficients calculated by BBC R&D.
  13123. There are two sets of filter coefficients, so called "simple":
  13124. and "complex". Which set of filter coefficients is used can
  13125. be set by passing an optional parameter:
  13126. @table @option
  13127. @item filter
  13128. Set the interlacing filter coefficients. Accepts one of the following values:
  13129. @table @samp
  13130. @item simple
  13131. Simple filter coefficient set.
  13132. @item complex
  13133. More-complex filter coefficient set.
  13134. @end table
  13135. Default value is @samp{complex}.
  13136. @item deint
  13137. Specify which frames to deinterlace. Accept one of the following values:
  13138. @table @samp
  13139. @item all
  13140. Deinterlace all frames,
  13141. @item interlaced
  13142. Only deinterlace frames marked as interlaced.
  13143. @end table
  13144. Default value is @samp{all}.
  13145. @end table
  13146. @section waveform
  13147. Video waveform monitor.
  13148. The waveform monitor plots color component intensity. By default luminance
  13149. only. Each column of the waveform corresponds to a column of pixels in the
  13150. source video.
  13151. It accepts the following options:
  13152. @table @option
  13153. @item mode, m
  13154. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13155. In row mode, the graph on the left side represents color component value 0 and
  13156. the right side represents value = 255. In column mode, the top side represents
  13157. color component value = 0 and bottom side represents value = 255.
  13158. @item intensity, i
  13159. Set intensity. Smaller values are useful to find out how many values of the same
  13160. luminance are distributed across input rows/columns.
  13161. Default value is @code{0.04}. Allowed range is [0, 1].
  13162. @item mirror, r
  13163. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13164. In mirrored mode, higher values will be represented on the left
  13165. side for @code{row} mode and at the top for @code{column} mode. Default is
  13166. @code{1} (mirrored).
  13167. @item display, d
  13168. Set display mode.
  13169. It accepts the following values:
  13170. @table @samp
  13171. @item overlay
  13172. Presents information identical to that in the @code{parade}, except
  13173. that the graphs representing color components are superimposed directly
  13174. over one another.
  13175. This display mode makes it easier to spot relative differences or similarities
  13176. in overlapping areas of the color components that are supposed to be identical,
  13177. such as neutral whites, grays, or blacks.
  13178. @item stack
  13179. Display separate graph for the color components side by side in
  13180. @code{row} mode or one below the other in @code{column} mode.
  13181. @item parade
  13182. Display separate graph for the color components side by side in
  13183. @code{column} mode or one below the other in @code{row} mode.
  13184. Using this display mode makes it easy to spot color casts in the highlights
  13185. and shadows of an image, by comparing the contours of the top and the bottom
  13186. graphs of each waveform. Since whites, grays, and blacks are characterized
  13187. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13188. should display three waveforms of roughly equal width/height. If not, the
  13189. correction is easy to perform by making level adjustments the three waveforms.
  13190. @end table
  13191. Default is @code{stack}.
  13192. @item components, c
  13193. Set which color components to display. Default is 1, which means only luminance
  13194. or red color component if input is in RGB colorspace. If is set for example to
  13195. 7 it will display all 3 (if) available color components.
  13196. @item envelope, e
  13197. @table @samp
  13198. @item none
  13199. No envelope, this is default.
  13200. @item instant
  13201. Instant envelope, minimum and maximum values presented in graph will be easily
  13202. visible even with small @code{step} value.
  13203. @item peak
  13204. Hold minimum and maximum values presented in graph across time. This way you
  13205. can still spot out of range values without constantly looking at waveforms.
  13206. @item peak+instant
  13207. Peak and instant envelope combined together.
  13208. @end table
  13209. @item filter, f
  13210. @table @samp
  13211. @item lowpass
  13212. No filtering, this is default.
  13213. @item flat
  13214. Luma and chroma combined together.
  13215. @item aflat
  13216. Similar as above, but shows difference between blue and red chroma.
  13217. @item xflat
  13218. Similar as above, but use different colors.
  13219. @item chroma
  13220. Displays only chroma.
  13221. @item color
  13222. Displays actual color value on waveform.
  13223. @item acolor
  13224. Similar as above, but with luma showing frequency of chroma values.
  13225. @end table
  13226. @item graticule, g
  13227. Set which graticule to display.
  13228. @table @samp
  13229. @item none
  13230. Do not display graticule.
  13231. @item green
  13232. Display green graticule showing legal broadcast ranges.
  13233. @item orange
  13234. Display orange graticule showing legal broadcast ranges.
  13235. @end table
  13236. @item opacity, o
  13237. Set graticule opacity.
  13238. @item flags, fl
  13239. Set graticule flags.
  13240. @table @samp
  13241. @item numbers
  13242. Draw numbers above lines. By default enabled.
  13243. @item dots
  13244. Draw dots instead of lines.
  13245. @end table
  13246. @item scale, s
  13247. Set scale used for displaying graticule.
  13248. @table @samp
  13249. @item digital
  13250. @item millivolts
  13251. @item ire
  13252. @end table
  13253. Default is digital.
  13254. @item bgopacity, b
  13255. Set background opacity.
  13256. @end table
  13257. @section weave, doubleweave
  13258. The @code{weave} takes a field-based video input and join
  13259. each two sequential fields into single frame, producing a new double
  13260. height clip with half the frame rate and half the frame count.
  13261. The @code{doubleweave} works same as @code{weave} but without
  13262. halving frame rate and frame count.
  13263. It accepts the following option:
  13264. @table @option
  13265. @item first_field
  13266. Set first field. Available values are:
  13267. @table @samp
  13268. @item top, t
  13269. Set the frame as top-field-first.
  13270. @item bottom, b
  13271. Set the frame as bottom-field-first.
  13272. @end table
  13273. @end table
  13274. @subsection Examples
  13275. @itemize
  13276. @item
  13277. Interlace video using @ref{select} and @ref{separatefields} filter:
  13278. @example
  13279. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13280. @end example
  13281. @end itemize
  13282. @section xbr
  13283. Apply the xBR high-quality magnification filter which is designed for pixel
  13284. art. It follows a set of edge-detection rules, see
  13285. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13286. It accepts the following option:
  13287. @table @option
  13288. @item n
  13289. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13290. @code{3xBR} and @code{4} for @code{4xBR}.
  13291. Default is @code{3}.
  13292. @end table
  13293. @anchor{yadif}
  13294. @section yadif
  13295. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13296. filter").
  13297. It accepts the following parameters:
  13298. @table @option
  13299. @item mode
  13300. The interlacing mode to adopt. It accepts one of the following values:
  13301. @table @option
  13302. @item 0, send_frame
  13303. Output one frame for each frame.
  13304. @item 1, send_field
  13305. Output one frame for each field.
  13306. @item 2, send_frame_nospatial
  13307. Like @code{send_frame}, but it skips the spatial interlacing check.
  13308. @item 3, send_field_nospatial
  13309. Like @code{send_field}, but it skips the spatial interlacing check.
  13310. @end table
  13311. The default value is @code{send_frame}.
  13312. @item parity
  13313. The picture field parity assumed for the input interlaced video. It accepts one
  13314. of the following values:
  13315. @table @option
  13316. @item 0, tff
  13317. Assume the top field is first.
  13318. @item 1, bff
  13319. Assume the bottom field is first.
  13320. @item -1, auto
  13321. Enable automatic detection of field parity.
  13322. @end table
  13323. The default value is @code{auto}.
  13324. If the interlacing is unknown or the decoder does not export this information,
  13325. top field first will be assumed.
  13326. @item deint
  13327. Specify which frames to deinterlace. Accept one of the following
  13328. values:
  13329. @table @option
  13330. @item 0, all
  13331. Deinterlace all frames.
  13332. @item 1, interlaced
  13333. Only deinterlace frames marked as interlaced.
  13334. @end table
  13335. The default value is @code{all}.
  13336. @end table
  13337. @section zoompan
  13338. Apply Zoom & Pan effect.
  13339. This filter accepts the following options:
  13340. @table @option
  13341. @item zoom, z
  13342. Set the zoom expression. Default is 1.
  13343. @item x
  13344. @item y
  13345. Set the x and y expression. Default is 0.
  13346. @item d
  13347. Set the duration expression in number of frames.
  13348. This sets for how many number of frames effect will last for
  13349. single input image.
  13350. @item s
  13351. Set the output image size, default is 'hd720'.
  13352. @item fps
  13353. Set the output frame rate, default is '25'.
  13354. @end table
  13355. Each expression can contain the following constants:
  13356. @table @option
  13357. @item in_w, iw
  13358. Input width.
  13359. @item in_h, ih
  13360. Input height.
  13361. @item out_w, ow
  13362. Output width.
  13363. @item out_h, oh
  13364. Output height.
  13365. @item in
  13366. Input frame count.
  13367. @item on
  13368. Output frame count.
  13369. @item x
  13370. @item y
  13371. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13372. for current input frame.
  13373. @item px
  13374. @item py
  13375. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13376. not yet such frame (first input frame).
  13377. @item zoom
  13378. Last calculated zoom from 'z' expression for current input frame.
  13379. @item pzoom
  13380. Last calculated zoom of last output frame of previous input frame.
  13381. @item duration
  13382. Number of output frames for current input frame. Calculated from 'd' expression
  13383. for each input frame.
  13384. @item pduration
  13385. number of output frames created for previous input frame
  13386. @item a
  13387. Rational number: input width / input height
  13388. @item sar
  13389. sample aspect ratio
  13390. @item dar
  13391. display aspect ratio
  13392. @end table
  13393. @subsection Examples
  13394. @itemize
  13395. @item
  13396. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13397. @example
  13398. 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
  13399. @end example
  13400. @item
  13401. Zoom-in up to 1.5 and pan always at center of picture:
  13402. @example
  13403. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13404. @end example
  13405. @item
  13406. Same as above but without pausing:
  13407. @example
  13408. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13409. @end example
  13410. @end itemize
  13411. @anchor{zscale}
  13412. @section zscale
  13413. Scale (resize) the input video, using the z.lib library:
  13414. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13415. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13416. The zscale filter forces the output display aspect ratio to be the same
  13417. as the input, by changing the output sample aspect ratio.
  13418. If the input image format is different from the format requested by
  13419. the next filter, the zscale filter will convert the input to the
  13420. requested format.
  13421. @subsection Options
  13422. The filter accepts the following options.
  13423. @table @option
  13424. @item width, w
  13425. @item height, h
  13426. Set the output video dimension expression. Default value is the input
  13427. dimension.
  13428. If the @var{width} or @var{w} value is 0, the input width is used for
  13429. the output. If the @var{height} or @var{h} value is 0, the input height
  13430. is used for the output.
  13431. If one and only one of the values is -n with n >= 1, the zscale filter
  13432. will use a value that maintains the aspect ratio of the input image,
  13433. calculated from the other specified dimension. After that it will,
  13434. however, make sure that the calculated dimension is divisible by n and
  13435. adjust the value if necessary.
  13436. If both values are -n with n >= 1, the behavior will be identical to
  13437. both values being set to 0 as previously detailed.
  13438. See below for the list of accepted constants for use in the dimension
  13439. expression.
  13440. @item size, s
  13441. Set the video size. For the syntax of this option, check the
  13442. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13443. @item dither, d
  13444. Set the dither type.
  13445. Possible values are:
  13446. @table @var
  13447. @item none
  13448. @item ordered
  13449. @item random
  13450. @item error_diffusion
  13451. @end table
  13452. Default is none.
  13453. @item filter, f
  13454. Set the resize filter type.
  13455. Possible values are:
  13456. @table @var
  13457. @item point
  13458. @item bilinear
  13459. @item bicubic
  13460. @item spline16
  13461. @item spline36
  13462. @item lanczos
  13463. @end table
  13464. Default is bilinear.
  13465. @item range, r
  13466. Set the color range.
  13467. Possible values are:
  13468. @table @var
  13469. @item input
  13470. @item limited
  13471. @item full
  13472. @end table
  13473. Default is same as input.
  13474. @item primaries, p
  13475. Set the color primaries.
  13476. Possible values are:
  13477. @table @var
  13478. @item input
  13479. @item 709
  13480. @item unspecified
  13481. @item 170m
  13482. @item 240m
  13483. @item 2020
  13484. @end table
  13485. Default is same as input.
  13486. @item transfer, t
  13487. Set the transfer characteristics.
  13488. Possible values are:
  13489. @table @var
  13490. @item input
  13491. @item 709
  13492. @item unspecified
  13493. @item 601
  13494. @item linear
  13495. @item 2020_10
  13496. @item 2020_12
  13497. @item smpte2084
  13498. @item iec61966-2-1
  13499. @item arib-std-b67
  13500. @end table
  13501. Default is same as input.
  13502. @item matrix, m
  13503. Set the colorspace matrix.
  13504. Possible value are:
  13505. @table @var
  13506. @item input
  13507. @item 709
  13508. @item unspecified
  13509. @item 470bg
  13510. @item 170m
  13511. @item 2020_ncl
  13512. @item 2020_cl
  13513. @end table
  13514. Default is same as input.
  13515. @item rangein, rin
  13516. Set the input color range.
  13517. Possible values are:
  13518. @table @var
  13519. @item input
  13520. @item limited
  13521. @item full
  13522. @end table
  13523. Default is same as input.
  13524. @item primariesin, pin
  13525. Set the input color primaries.
  13526. Possible values are:
  13527. @table @var
  13528. @item input
  13529. @item 709
  13530. @item unspecified
  13531. @item 170m
  13532. @item 240m
  13533. @item 2020
  13534. @end table
  13535. Default is same as input.
  13536. @item transferin, tin
  13537. Set the input transfer characteristics.
  13538. Possible values are:
  13539. @table @var
  13540. @item input
  13541. @item 709
  13542. @item unspecified
  13543. @item 601
  13544. @item linear
  13545. @item 2020_10
  13546. @item 2020_12
  13547. @end table
  13548. Default is same as input.
  13549. @item matrixin, min
  13550. Set the input colorspace matrix.
  13551. Possible value are:
  13552. @table @var
  13553. @item input
  13554. @item 709
  13555. @item unspecified
  13556. @item 470bg
  13557. @item 170m
  13558. @item 2020_ncl
  13559. @item 2020_cl
  13560. @end table
  13561. @item chromal, c
  13562. Set the output chroma location.
  13563. Possible values are:
  13564. @table @var
  13565. @item input
  13566. @item left
  13567. @item center
  13568. @item topleft
  13569. @item top
  13570. @item bottomleft
  13571. @item bottom
  13572. @end table
  13573. @item chromalin, cin
  13574. Set the input chroma location.
  13575. Possible values are:
  13576. @table @var
  13577. @item input
  13578. @item left
  13579. @item center
  13580. @item topleft
  13581. @item top
  13582. @item bottomleft
  13583. @item bottom
  13584. @end table
  13585. @item npl
  13586. Set the nominal peak luminance.
  13587. @end table
  13588. The values of the @option{w} and @option{h} options are expressions
  13589. containing the following constants:
  13590. @table @var
  13591. @item in_w
  13592. @item in_h
  13593. The input width and height
  13594. @item iw
  13595. @item ih
  13596. These are the same as @var{in_w} and @var{in_h}.
  13597. @item out_w
  13598. @item out_h
  13599. The output (scaled) width and height
  13600. @item ow
  13601. @item oh
  13602. These are the same as @var{out_w} and @var{out_h}
  13603. @item a
  13604. The same as @var{iw} / @var{ih}
  13605. @item sar
  13606. input sample aspect ratio
  13607. @item dar
  13608. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13609. @item hsub
  13610. @item vsub
  13611. horizontal and vertical input chroma subsample values. For example for the
  13612. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13613. @item ohsub
  13614. @item ovsub
  13615. horizontal and vertical output chroma subsample values. For example for the
  13616. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13617. @end table
  13618. @table @option
  13619. @end table
  13620. @c man end VIDEO FILTERS
  13621. @chapter Video Sources
  13622. @c man begin VIDEO SOURCES
  13623. Below is a description of the currently available video sources.
  13624. @section buffer
  13625. Buffer video frames, and make them available to the filter chain.
  13626. This source is mainly intended for a programmatic use, in particular
  13627. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13628. It accepts the following parameters:
  13629. @table @option
  13630. @item video_size
  13631. Specify the size (width and height) of the buffered video frames. For the
  13632. syntax of this option, check the
  13633. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13634. @item width
  13635. The input video width.
  13636. @item height
  13637. The input video height.
  13638. @item pix_fmt
  13639. A string representing the pixel format of the buffered video frames.
  13640. It may be a number corresponding to a pixel format, or a pixel format
  13641. name.
  13642. @item time_base
  13643. Specify the timebase assumed by the timestamps of the buffered frames.
  13644. @item frame_rate
  13645. Specify the frame rate expected for the video stream.
  13646. @item pixel_aspect, sar
  13647. The sample (pixel) aspect ratio of the input video.
  13648. @item sws_param
  13649. Specify the optional parameters to be used for the scale filter which
  13650. is automatically inserted when an input change is detected in the
  13651. input size or format.
  13652. @item hw_frames_ctx
  13653. When using a hardware pixel format, this should be a reference to an
  13654. AVHWFramesContext describing input frames.
  13655. @end table
  13656. For example:
  13657. @example
  13658. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13659. @end example
  13660. will instruct the source to accept video frames with size 320x240 and
  13661. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13662. square pixels (1:1 sample aspect ratio).
  13663. Since the pixel format with name "yuv410p" corresponds to the number 6
  13664. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13665. this example corresponds to:
  13666. @example
  13667. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13668. @end example
  13669. Alternatively, the options can be specified as a flat string, but this
  13670. syntax is deprecated:
  13671. @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}]
  13672. @section cellauto
  13673. Create a pattern generated by an elementary cellular automaton.
  13674. The initial state of the cellular automaton can be defined through the
  13675. @option{filename} and @option{pattern} options. If such options are
  13676. not specified an initial state is created randomly.
  13677. At each new frame a new row in the video is filled with the result of
  13678. the cellular automaton next generation. The behavior when the whole
  13679. frame is filled is defined by the @option{scroll} option.
  13680. This source accepts the following options:
  13681. @table @option
  13682. @item filename, f
  13683. Read the initial cellular automaton state, i.e. the starting row, from
  13684. the specified file.
  13685. In the file, each non-whitespace character is considered an alive
  13686. cell, a newline will terminate the row, and further characters in the
  13687. file will be ignored.
  13688. @item pattern, p
  13689. Read the initial cellular automaton state, i.e. the starting row, from
  13690. the specified string.
  13691. Each non-whitespace character in the string is considered an alive
  13692. cell, a newline will terminate the row, and further characters in the
  13693. string will be ignored.
  13694. @item rate, r
  13695. Set the video rate, that is the number of frames generated per second.
  13696. Default is 25.
  13697. @item random_fill_ratio, ratio
  13698. Set the random fill ratio for the initial cellular automaton row. It
  13699. is a floating point number value ranging from 0 to 1, defaults to
  13700. 1/PHI.
  13701. This option is ignored when a file or a pattern is specified.
  13702. @item random_seed, seed
  13703. Set the seed for filling randomly the initial row, must be an integer
  13704. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13705. set to -1, the filter will try to use a good random seed on a best
  13706. effort basis.
  13707. @item rule
  13708. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13709. Default value is 110.
  13710. @item size, s
  13711. Set the size of the output video. For the syntax of this option, check the
  13712. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13713. If @option{filename} or @option{pattern} is specified, the size is set
  13714. by default to the width of the specified initial state row, and the
  13715. height is set to @var{width} * PHI.
  13716. If @option{size} is set, it must contain the width of the specified
  13717. pattern string, and the specified pattern will be centered in the
  13718. larger row.
  13719. If a filename or a pattern string is not specified, the size value
  13720. defaults to "320x518" (used for a randomly generated initial state).
  13721. @item scroll
  13722. If set to 1, scroll the output upward when all the rows in the output
  13723. have been already filled. If set to 0, the new generated row will be
  13724. written over the top row just after the bottom row is filled.
  13725. Defaults to 1.
  13726. @item start_full, full
  13727. If set to 1, completely fill the output with generated rows before
  13728. outputting the first frame.
  13729. This is the default behavior, for disabling set the value to 0.
  13730. @item stitch
  13731. If set to 1, stitch the left and right row edges together.
  13732. This is the default behavior, for disabling set the value to 0.
  13733. @end table
  13734. @subsection Examples
  13735. @itemize
  13736. @item
  13737. Read the initial state from @file{pattern}, and specify an output of
  13738. size 200x400.
  13739. @example
  13740. cellauto=f=pattern:s=200x400
  13741. @end example
  13742. @item
  13743. Generate a random initial row with a width of 200 cells, with a fill
  13744. ratio of 2/3:
  13745. @example
  13746. cellauto=ratio=2/3:s=200x200
  13747. @end example
  13748. @item
  13749. Create a pattern generated by rule 18 starting by a single alive cell
  13750. centered on an initial row with width 100:
  13751. @example
  13752. cellauto=p=@@:s=100x400:full=0:rule=18
  13753. @end example
  13754. @item
  13755. Specify a more elaborated initial pattern:
  13756. @example
  13757. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13758. @end example
  13759. @end itemize
  13760. @anchor{coreimagesrc}
  13761. @section coreimagesrc
  13762. Video source generated on GPU using Apple's CoreImage API on OSX.
  13763. This video source is a specialized version of the @ref{coreimage} video filter.
  13764. Use a core image generator at the beginning of the applied filterchain to
  13765. generate the content.
  13766. The coreimagesrc video source accepts the following options:
  13767. @table @option
  13768. @item list_generators
  13769. List all available generators along with all their respective options as well as
  13770. possible minimum and maximum values along with the default values.
  13771. @example
  13772. list_generators=true
  13773. @end example
  13774. @item size, s
  13775. Specify the size of the sourced video. For the syntax of this option, check the
  13776. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13777. The default value is @code{320x240}.
  13778. @item rate, r
  13779. Specify the frame rate of the sourced video, as the number of frames
  13780. generated per second. It has to be a string in the format
  13781. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13782. number or a valid video frame rate abbreviation. The default value is
  13783. "25".
  13784. @item sar
  13785. Set the sample aspect ratio of the sourced video.
  13786. @item duration, d
  13787. Set the duration of the sourced video. See
  13788. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13789. for the accepted syntax.
  13790. If not specified, or the expressed duration is negative, the video is
  13791. supposed to be generated forever.
  13792. @end table
  13793. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13794. A complete filterchain can be used for further processing of the
  13795. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13796. and examples for details.
  13797. @subsection Examples
  13798. @itemize
  13799. @item
  13800. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13801. given as complete and escaped command-line for Apple's standard bash shell:
  13802. @example
  13803. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13804. @end example
  13805. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13806. need for a nullsrc video source.
  13807. @end itemize
  13808. @section mandelbrot
  13809. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13810. point specified with @var{start_x} and @var{start_y}.
  13811. This source accepts the following options:
  13812. @table @option
  13813. @item end_pts
  13814. Set the terminal pts value. Default value is 400.
  13815. @item end_scale
  13816. Set the terminal scale value.
  13817. Must be a floating point value. Default value is 0.3.
  13818. @item inner
  13819. Set the inner coloring mode, that is the algorithm used to draw the
  13820. Mandelbrot fractal internal region.
  13821. It shall assume one of the following values:
  13822. @table @option
  13823. @item black
  13824. Set black mode.
  13825. @item convergence
  13826. Show time until convergence.
  13827. @item mincol
  13828. Set color based on point closest to the origin of the iterations.
  13829. @item period
  13830. Set period mode.
  13831. @end table
  13832. Default value is @var{mincol}.
  13833. @item bailout
  13834. Set the bailout value. Default value is 10.0.
  13835. @item maxiter
  13836. Set the maximum of iterations performed by the rendering
  13837. algorithm. Default value is 7189.
  13838. @item outer
  13839. Set outer coloring mode.
  13840. It shall assume one of following values:
  13841. @table @option
  13842. @item iteration_count
  13843. Set iteration cound mode.
  13844. @item normalized_iteration_count
  13845. set normalized iteration count mode.
  13846. @end table
  13847. Default value is @var{normalized_iteration_count}.
  13848. @item rate, r
  13849. Set frame rate, expressed as number of frames per second. Default
  13850. value is "25".
  13851. @item size, s
  13852. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13853. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13854. @item start_scale
  13855. Set the initial scale value. Default value is 3.0.
  13856. @item start_x
  13857. Set the initial x position. Must be a floating point value between
  13858. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13859. @item start_y
  13860. Set the initial y position. Must be a floating point value between
  13861. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13862. @end table
  13863. @section mptestsrc
  13864. Generate various test patterns, as generated by the MPlayer test filter.
  13865. The size of the generated video is fixed, and is 256x256.
  13866. This source is useful in particular for testing encoding features.
  13867. This source accepts the following options:
  13868. @table @option
  13869. @item rate, r
  13870. Specify the frame rate of the sourced video, as the number of frames
  13871. generated per second. It has to be a string in the format
  13872. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13873. number or a valid video frame rate abbreviation. The default value is
  13874. "25".
  13875. @item duration, d
  13876. Set the duration of the sourced video. See
  13877. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13878. for the accepted syntax.
  13879. If not specified, or the expressed duration is negative, the video is
  13880. supposed to be generated forever.
  13881. @item test, t
  13882. Set the number or the name of the test to perform. Supported tests are:
  13883. @table @option
  13884. @item dc_luma
  13885. @item dc_chroma
  13886. @item freq_luma
  13887. @item freq_chroma
  13888. @item amp_luma
  13889. @item amp_chroma
  13890. @item cbp
  13891. @item mv
  13892. @item ring1
  13893. @item ring2
  13894. @item all
  13895. @end table
  13896. Default value is "all", which will cycle through the list of all tests.
  13897. @end table
  13898. Some examples:
  13899. @example
  13900. mptestsrc=t=dc_luma
  13901. @end example
  13902. will generate a "dc_luma" test pattern.
  13903. @section frei0r_src
  13904. Provide a frei0r source.
  13905. To enable compilation of this filter you need to install the frei0r
  13906. header and configure FFmpeg with @code{--enable-frei0r}.
  13907. This source accepts the following parameters:
  13908. @table @option
  13909. @item size
  13910. The size of the video to generate. For the syntax of this option, check the
  13911. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13912. @item framerate
  13913. The framerate of the generated video. It may be a string of the form
  13914. @var{num}/@var{den} or a frame rate abbreviation.
  13915. @item filter_name
  13916. The name to the frei0r source to load. For more information regarding frei0r and
  13917. how to set the parameters, read the @ref{frei0r} section in the video filters
  13918. documentation.
  13919. @item filter_params
  13920. A '|'-separated list of parameters to pass to the frei0r source.
  13921. @end table
  13922. For example, to generate a frei0r partik0l source with size 200x200
  13923. and frame rate 10 which is overlaid on the overlay filter main input:
  13924. @example
  13925. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13926. @end example
  13927. @section life
  13928. Generate a life pattern.
  13929. This source is based on a generalization of John Conway's life game.
  13930. The sourced input represents a life grid, each pixel represents a cell
  13931. which can be in one of two possible states, alive or dead. Every cell
  13932. interacts with its eight neighbours, which are the cells that are
  13933. horizontally, vertically, or diagonally adjacent.
  13934. At each interaction the grid evolves according to the adopted rule,
  13935. which specifies the number of neighbor alive cells which will make a
  13936. cell stay alive or born. The @option{rule} option allows one to specify
  13937. the rule to adopt.
  13938. This source accepts the following options:
  13939. @table @option
  13940. @item filename, f
  13941. Set the file from which to read the initial grid state. In the file,
  13942. each non-whitespace character is considered an alive cell, and newline
  13943. is used to delimit the end of each row.
  13944. If this option is not specified, the initial grid is generated
  13945. randomly.
  13946. @item rate, r
  13947. Set the video rate, that is the number of frames generated per second.
  13948. Default is 25.
  13949. @item random_fill_ratio, ratio
  13950. Set the random fill ratio for the initial random grid. It is a
  13951. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13952. It is ignored when a file is specified.
  13953. @item random_seed, seed
  13954. Set the seed for filling the initial random grid, must be an integer
  13955. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13956. set to -1, the filter will try to use a good random seed on a best
  13957. effort basis.
  13958. @item rule
  13959. Set the life rule.
  13960. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13961. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13962. @var{NS} specifies the number of alive neighbor cells which make a
  13963. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13964. which make a dead cell to become alive (i.e. to "born").
  13965. "s" and "b" can be used in place of "S" and "B", respectively.
  13966. Alternatively a rule can be specified by an 18-bits integer. The 9
  13967. high order bits are used to encode the next cell state if it is alive
  13968. for each number of neighbor alive cells, the low order bits specify
  13969. the rule for "borning" new cells. Higher order bits encode for an
  13970. higher number of neighbor cells.
  13971. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13972. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13973. Default value is "S23/B3", which is the original Conway's game of life
  13974. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13975. cells, and will born a new cell if there are three alive cells around
  13976. a dead cell.
  13977. @item size, s
  13978. Set the size of the output video. For the syntax of this option, check the
  13979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13980. If @option{filename} is specified, the size is set by default to the
  13981. same size of the input file. If @option{size} is set, it must contain
  13982. the size specified in the input file, and the initial grid defined in
  13983. that file is centered in the larger resulting area.
  13984. If a filename is not specified, the size value defaults to "320x240"
  13985. (used for a randomly generated initial grid).
  13986. @item stitch
  13987. If set to 1, stitch the left and right grid edges together, and the
  13988. top and bottom edges also. Defaults to 1.
  13989. @item mold
  13990. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13991. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13992. value from 0 to 255.
  13993. @item life_color
  13994. Set the color of living (or new born) cells.
  13995. @item death_color
  13996. Set the color of dead cells. If @option{mold} is set, this is the first color
  13997. used to represent a dead cell.
  13998. @item mold_color
  13999. Set mold color, for definitely dead and moldy cells.
  14000. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14001. ffmpeg-utils manual,ffmpeg-utils}.
  14002. @end table
  14003. @subsection Examples
  14004. @itemize
  14005. @item
  14006. Read a grid from @file{pattern}, and center it on a grid of size
  14007. 300x300 pixels:
  14008. @example
  14009. life=f=pattern:s=300x300
  14010. @end example
  14011. @item
  14012. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  14013. @example
  14014. life=ratio=2/3:s=200x200
  14015. @end example
  14016. @item
  14017. Specify a custom rule for evolving a randomly generated grid:
  14018. @example
  14019. life=rule=S14/B34
  14020. @end example
  14021. @item
  14022. Full example with slow death effect (mold) using @command{ffplay}:
  14023. @example
  14024. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  14025. @end example
  14026. @end itemize
  14027. @anchor{allrgb}
  14028. @anchor{allyuv}
  14029. @anchor{color}
  14030. @anchor{haldclutsrc}
  14031. @anchor{nullsrc}
  14032. @anchor{pal75bars}
  14033. @anchor{pal100bars}
  14034. @anchor{rgbtestsrc}
  14035. @anchor{smptebars}
  14036. @anchor{smptehdbars}
  14037. @anchor{testsrc}
  14038. @anchor{testsrc2}
  14039. @anchor{yuvtestsrc}
  14040. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  14041. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  14042. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  14043. The @code{color} source provides an uniformly colored input.
  14044. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  14045. @ref{haldclut} filter.
  14046. The @code{nullsrc} source returns unprocessed video frames. It is
  14047. mainly useful to be employed in analysis / debugging tools, or as the
  14048. source for filters which ignore the input data.
  14049. The @code{pal75bars} source generates a color bars pattern, based on
  14050. EBU PAL recommendations with 75% color levels.
  14051. The @code{pal100bars} source generates a color bars pattern, based on
  14052. EBU PAL recommendations with 100% color levels.
  14053. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  14054. detecting RGB vs BGR issues. You should see a red, green and blue
  14055. stripe from top to bottom.
  14056. The @code{smptebars} source generates a color bars pattern, based on
  14057. the SMPTE Engineering Guideline EG 1-1990.
  14058. The @code{smptehdbars} source generates a color bars pattern, based on
  14059. the SMPTE RP 219-2002.
  14060. The @code{testsrc} source generates a test video pattern, showing a
  14061. color pattern, a scrolling gradient and a timestamp. This is mainly
  14062. intended for testing purposes.
  14063. The @code{testsrc2} source is similar to testsrc, but supports more
  14064. pixel formats instead of just @code{rgb24}. This allows using it as an
  14065. input for other tests without requiring a format conversion.
  14066. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  14067. see a y, cb and cr stripe from top to bottom.
  14068. The sources accept the following parameters:
  14069. @table @option
  14070. @item level
  14071. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  14072. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  14073. pixels to be used as identity matrix for 3D lookup tables. Each component is
  14074. coded on a @code{1/(N*N)} scale.
  14075. @item color, c
  14076. Specify the color of the source, only available in the @code{color}
  14077. source. For the syntax of this option, check the
  14078. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14079. @item size, s
  14080. Specify the size of the sourced video. For the syntax of this option, check the
  14081. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14082. The default value is @code{320x240}.
  14083. This option is not available with the @code{allrgb}, @code{allyuv}, and
  14084. @code{haldclutsrc} filters.
  14085. @item rate, r
  14086. Specify the frame rate of the sourced video, as the number of frames
  14087. generated per second. It has to be a string in the format
  14088. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14089. number or a valid video frame rate abbreviation. The default value is
  14090. "25".
  14091. @item duration, d
  14092. Set the duration of the sourced video. See
  14093. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14094. for the accepted syntax.
  14095. If not specified, or the expressed duration is negative, the video is
  14096. supposed to be generated forever.
  14097. @item sar
  14098. Set the sample aspect ratio of the sourced video.
  14099. @item alpha
  14100. Specify the alpha (opacity) of the background, only available in the
  14101. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  14102. 255 (fully opaque, the default).
  14103. @item decimals, n
  14104. Set the number of decimals to show in the timestamp, only available in the
  14105. @code{testsrc} source.
  14106. The displayed timestamp value will correspond to the original
  14107. timestamp value multiplied by the power of 10 of the specified
  14108. value. Default value is 0.
  14109. @end table
  14110. @subsection Examples
  14111. @itemize
  14112. @item
  14113. Generate a video with a duration of 5.3 seconds, with size
  14114. 176x144 and a frame rate of 10 frames per second:
  14115. @example
  14116. testsrc=duration=5.3:size=qcif:rate=10
  14117. @end example
  14118. @item
  14119. The following graph description will generate a red source
  14120. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  14121. frames per second:
  14122. @example
  14123. color=c=red@@0.2:s=qcif:r=10
  14124. @end example
  14125. @item
  14126. If the input content is to be ignored, @code{nullsrc} can be used. The
  14127. following command generates noise in the luminance plane by employing
  14128. the @code{geq} filter:
  14129. @example
  14130. nullsrc=s=256x256, geq=random(1)*255:128:128
  14131. @end example
  14132. @end itemize
  14133. @subsection Commands
  14134. The @code{color} source supports the following commands:
  14135. @table @option
  14136. @item c, color
  14137. Set the color of the created image. Accepts the same syntax of the
  14138. corresponding @option{color} option.
  14139. @end table
  14140. @section openclsrc
  14141. Generate video using an OpenCL program.
  14142. @table @option
  14143. @item source
  14144. OpenCL program source file.
  14145. @item kernel
  14146. Kernel name in program.
  14147. @item size, s
  14148. Size of frames to generate. This must be set.
  14149. @item format
  14150. Pixel format to use for the generated frames. This must be set.
  14151. @item rate, r
  14152. Number of frames generated every second. Default value is '25'.
  14153. @end table
  14154. For details of how the program loading works, see the @ref{program_opencl}
  14155. filter.
  14156. Example programs:
  14157. @itemize
  14158. @item
  14159. Generate a colour ramp by setting pixel values from the position of the pixel
  14160. in the output image. (Note that this will work with all pixel formats, but
  14161. the generated output will not be the same.)
  14162. @verbatim
  14163. __kernel void ramp(__write_only image2d_t dst,
  14164. unsigned int index)
  14165. {
  14166. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14167. float4 val;
  14168. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  14169. write_imagef(dst, loc, val);
  14170. }
  14171. @end verbatim
  14172. @item
  14173. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  14174. @verbatim
  14175. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  14176. unsigned int index)
  14177. {
  14178. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14179. float4 value = 0.0f;
  14180. int x = loc.x + index;
  14181. int y = loc.y + index;
  14182. while (x > 0 || y > 0) {
  14183. if (x % 3 == 1 && y % 3 == 1) {
  14184. value = 1.0f;
  14185. break;
  14186. }
  14187. x /= 3;
  14188. y /= 3;
  14189. }
  14190. write_imagef(dst, loc, value);
  14191. }
  14192. @end verbatim
  14193. @end itemize
  14194. @c man end VIDEO SOURCES
  14195. @chapter Video Sinks
  14196. @c man begin VIDEO SINKS
  14197. Below is a description of the currently available video sinks.
  14198. @section buffersink
  14199. Buffer video frames, and make them available to the end of the filter
  14200. graph.
  14201. This sink is mainly intended for programmatic use, in particular
  14202. through the interface defined in @file{libavfilter/buffersink.h}
  14203. or the options system.
  14204. It accepts a pointer to an AVBufferSinkContext structure, which
  14205. defines the incoming buffers' formats, to be passed as the opaque
  14206. parameter to @code{avfilter_init_filter} for initialization.
  14207. @section nullsink
  14208. Null video sink: do absolutely nothing with the input video. It is
  14209. mainly useful as a template and for use in analysis / debugging
  14210. tools.
  14211. @c man end VIDEO SINKS
  14212. @chapter Multimedia Filters
  14213. @c man begin MULTIMEDIA FILTERS
  14214. Below is a description of the currently available multimedia filters.
  14215. @section abitscope
  14216. Convert input audio to a video output, displaying the audio bit scope.
  14217. The filter accepts the following options:
  14218. @table @option
  14219. @item rate, r
  14220. Set frame rate, expressed as number of frames per second. Default
  14221. value is "25".
  14222. @item size, s
  14223. Specify the video size for the output. For the syntax of this option, check the
  14224. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14225. Default value is @code{1024x256}.
  14226. @item colors
  14227. Specify list of colors separated by space or by '|' which will be used to
  14228. draw channels. Unrecognized or missing colors will be replaced
  14229. by white color.
  14230. @end table
  14231. @section ahistogram
  14232. Convert input audio to a video output, displaying the volume histogram.
  14233. The filter accepts the following options:
  14234. @table @option
  14235. @item dmode
  14236. Specify how histogram is calculated.
  14237. It accepts the following values:
  14238. @table @samp
  14239. @item single
  14240. Use single histogram for all channels.
  14241. @item separate
  14242. Use separate histogram for each channel.
  14243. @end table
  14244. Default is @code{single}.
  14245. @item rate, r
  14246. Set frame rate, expressed as number of frames per second. Default
  14247. value is "25".
  14248. @item size, s
  14249. Specify the video size for the output. For the syntax of this option, check the
  14250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14251. Default value is @code{hd720}.
  14252. @item scale
  14253. Set display scale.
  14254. It accepts the following values:
  14255. @table @samp
  14256. @item log
  14257. logarithmic
  14258. @item sqrt
  14259. square root
  14260. @item cbrt
  14261. cubic root
  14262. @item lin
  14263. linear
  14264. @item rlog
  14265. reverse logarithmic
  14266. @end table
  14267. Default is @code{log}.
  14268. @item ascale
  14269. Set amplitude scale.
  14270. It accepts the following values:
  14271. @table @samp
  14272. @item log
  14273. logarithmic
  14274. @item lin
  14275. linear
  14276. @end table
  14277. Default is @code{log}.
  14278. @item acount
  14279. Set how much frames to accumulate in histogram.
  14280. Defauls is 1. Setting this to -1 accumulates all frames.
  14281. @item rheight
  14282. Set histogram ratio of window height.
  14283. @item slide
  14284. Set sonogram sliding.
  14285. It accepts the following values:
  14286. @table @samp
  14287. @item replace
  14288. replace old rows with new ones.
  14289. @item scroll
  14290. scroll from top to bottom.
  14291. @end table
  14292. Default is @code{replace}.
  14293. @end table
  14294. @section aphasemeter
  14295. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14296. representing mean phase of current audio frame. A video output can also be produced and is
  14297. enabled by default. The audio is passed through as first output.
  14298. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14299. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14300. and @code{1} means channels are in phase.
  14301. The filter accepts the following options, all related to its video output:
  14302. @table @option
  14303. @item rate, r
  14304. Set the output frame rate. Default value is @code{25}.
  14305. @item size, s
  14306. Set the video size for the output. For the syntax of this option, check the
  14307. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14308. Default value is @code{800x400}.
  14309. @item rc
  14310. @item gc
  14311. @item bc
  14312. Specify the red, green, blue contrast. Default values are @code{2},
  14313. @code{7} and @code{1}.
  14314. Allowed range is @code{[0, 255]}.
  14315. @item mpc
  14316. Set color which will be used for drawing median phase. If color is
  14317. @code{none} which is default, no median phase value will be drawn.
  14318. @item video
  14319. Enable video output. Default is enabled.
  14320. @end table
  14321. @section avectorscope
  14322. Convert input audio to a video output, representing the audio vector
  14323. scope.
  14324. The filter is used to measure the difference between channels of stereo
  14325. audio stream. A monoaural signal, consisting of identical left and right
  14326. signal, results in straight vertical line. Any stereo separation is visible
  14327. as a deviation from this line, creating a Lissajous figure.
  14328. If the straight (or deviation from it) but horizontal line appears this
  14329. indicates that the left and right channels are out of phase.
  14330. The filter accepts the following options:
  14331. @table @option
  14332. @item mode, m
  14333. Set the vectorscope mode.
  14334. Available values are:
  14335. @table @samp
  14336. @item lissajous
  14337. Lissajous rotated by 45 degrees.
  14338. @item lissajous_xy
  14339. Same as above but not rotated.
  14340. @item polar
  14341. Shape resembling half of circle.
  14342. @end table
  14343. Default value is @samp{lissajous}.
  14344. @item size, s
  14345. Set the video size for the output. For the syntax of this option, check the
  14346. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14347. Default value is @code{400x400}.
  14348. @item rate, r
  14349. Set the output frame rate. Default value is @code{25}.
  14350. @item rc
  14351. @item gc
  14352. @item bc
  14353. @item ac
  14354. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14355. @code{160}, @code{80} and @code{255}.
  14356. Allowed range is @code{[0, 255]}.
  14357. @item rf
  14358. @item gf
  14359. @item bf
  14360. @item af
  14361. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14362. @code{10}, @code{5} and @code{5}.
  14363. Allowed range is @code{[0, 255]}.
  14364. @item zoom
  14365. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14366. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14367. @item draw
  14368. Set the vectorscope drawing mode.
  14369. Available values are:
  14370. @table @samp
  14371. @item dot
  14372. Draw dot for each sample.
  14373. @item line
  14374. Draw line between previous and current sample.
  14375. @end table
  14376. Default value is @samp{dot}.
  14377. @item scale
  14378. Specify amplitude scale of audio samples.
  14379. Available values are:
  14380. @table @samp
  14381. @item lin
  14382. Linear.
  14383. @item sqrt
  14384. Square root.
  14385. @item cbrt
  14386. Cubic root.
  14387. @item log
  14388. Logarithmic.
  14389. @end table
  14390. @item swap
  14391. Swap left channel axis with right channel axis.
  14392. @item mirror
  14393. Mirror axis.
  14394. @table @samp
  14395. @item none
  14396. No mirror.
  14397. @item x
  14398. Mirror only x axis.
  14399. @item y
  14400. Mirror only y axis.
  14401. @item xy
  14402. Mirror both axis.
  14403. @end table
  14404. @end table
  14405. @subsection Examples
  14406. @itemize
  14407. @item
  14408. Complete example using @command{ffplay}:
  14409. @example
  14410. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14411. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14412. @end example
  14413. @end itemize
  14414. @section bench, abench
  14415. Benchmark part of a filtergraph.
  14416. The filter accepts the following options:
  14417. @table @option
  14418. @item action
  14419. Start or stop a timer.
  14420. Available values are:
  14421. @table @samp
  14422. @item start
  14423. Get the current time, set it as frame metadata (using the key
  14424. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14425. @item stop
  14426. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14427. the input frame metadata to get the time difference. Time difference, average,
  14428. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14429. @code{min}) are then printed. The timestamps are expressed in seconds.
  14430. @end table
  14431. @end table
  14432. @subsection Examples
  14433. @itemize
  14434. @item
  14435. Benchmark @ref{selectivecolor} filter:
  14436. @example
  14437. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14438. @end example
  14439. @end itemize
  14440. @section concat
  14441. Concatenate audio and video streams, joining them together one after the
  14442. other.
  14443. The filter works on segments of synchronized video and audio streams. All
  14444. segments must have the same number of streams of each type, and that will
  14445. also be the number of streams at output.
  14446. The filter accepts the following options:
  14447. @table @option
  14448. @item n
  14449. Set the number of segments. Default is 2.
  14450. @item v
  14451. Set the number of output video streams, that is also the number of video
  14452. streams in each segment. Default is 1.
  14453. @item a
  14454. Set the number of output audio streams, that is also the number of audio
  14455. streams in each segment. Default is 0.
  14456. @item unsafe
  14457. Activate unsafe mode: do not fail if segments have a different format.
  14458. @end table
  14459. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14460. @var{a} audio outputs.
  14461. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14462. segment, in the same order as the outputs, then the inputs for the second
  14463. segment, etc.
  14464. Related streams do not always have exactly the same duration, for various
  14465. reasons including codec frame size or sloppy authoring. For that reason,
  14466. related synchronized streams (e.g. a video and its audio track) should be
  14467. concatenated at once. The concat filter will use the duration of the longest
  14468. stream in each segment (except the last one), and if necessary pad shorter
  14469. audio streams with silence.
  14470. For this filter to work correctly, all segments must start at timestamp 0.
  14471. All corresponding streams must have the same parameters in all segments; the
  14472. filtering system will automatically select a common pixel format for video
  14473. streams, and a common sample format, sample rate and channel layout for
  14474. audio streams, but other settings, such as resolution, must be converted
  14475. explicitly by the user.
  14476. Different frame rates are acceptable but will result in variable frame rate
  14477. at output; be sure to configure the output file to handle it.
  14478. @subsection Examples
  14479. @itemize
  14480. @item
  14481. Concatenate an opening, an episode and an ending, all in bilingual version
  14482. (video in stream 0, audio in streams 1 and 2):
  14483. @example
  14484. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14485. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14486. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14487. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14488. @end example
  14489. @item
  14490. Concatenate two parts, handling audio and video separately, using the
  14491. (a)movie sources, and adjusting the resolution:
  14492. @example
  14493. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14494. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14495. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14496. @end example
  14497. Note that a desync will happen at the stitch if the audio and video streams
  14498. do not have exactly the same duration in the first file.
  14499. @end itemize
  14500. @subsection Commands
  14501. This filter supports the following commands:
  14502. @table @option
  14503. @item next
  14504. Close the current segment and step to the next one
  14505. @end table
  14506. @section drawgraph, adrawgraph
  14507. Draw a graph using input video or audio metadata.
  14508. It accepts the following parameters:
  14509. @table @option
  14510. @item m1
  14511. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14512. @item fg1
  14513. Set 1st foreground color expression.
  14514. @item m2
  14515. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14516. @item fg2
  14517. Set 2nd foreground color expression.
  14518. @item m3
  14519. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14520. @item fg3
  14521. Set 3rd foreground color expression.
  14522. @item m4
  14523. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14524. @item fg4
  14525. Set 4th foreground color expression.
  14526. @item min
  14527. Set minimal value of metadata value.
  14528. @item max
  14529. Set maximal value of metadata value.
  14530. @item bg
  14531. Set graph background color. Default is white.
  14532. @item mode
  14533. Set graph mode.
  14534. Available values for mode is:
  14535. @table @samp
  14536. @item bar
  14537. @item dot
  14538. @item line
  14539. @end table
  14540. Default is @code{line}.
  14541. @item slide
  14542. Set slide mode.
  14543. Available values for slide is:
  14544. @table @samp
  14545. @item frame
  14546. Draw new frame when right border is reached.
  14547. @item replace
  14548. Replace old columns with new ones.
  14549. @item scroll
  14550. Scroll from right to left.
  14551. @item rscroll
  14552. Scroll from left to right.
  14553. @item picture
  14554. Draw single picture.
  14555. @end table
  14556. Default is @code{frame}.
  14557. @item size
  14558. Set size of graph video. For the syntax of this option, check the
  14559. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14560. The default value is @code{900x256}.
  14561. The foreground color expressions can use the following variables:
  14562. @table @option
  14563. @item MIN
  14564. Minimal value of metadata value.
  14565. @item MAX
  14566. Maximal value of metadata value.
  14567. @item VAL
  14568. Current metadata key value.
  14569. @end table
  14570. The color is defined as 0xAABBGGRR.
  14571. @end table
  14572. Example using metadata from @ref{signalstats} filter:
  14573. @example
  14574. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14575. @end example
  14576. Example using metadata from @ref{ebur128} filter:
  14577. @example
  14578. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14579. @end example
  14580. @anchor{ebur128}
  14581. @section ebur128
  14582. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14583. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14584. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14585. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14586. The filter also has a video output (see the @var{video} option) with a real
  14587. time graph to observe the loudness evolution. The graphic contains the logged
  14588. message mentioned above, so it is not printed anymore when this option is set,
  14589. unless the verbose logging is set. The main graphing area contains the
  14590. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14591. the momentary loudness (400 milliseconds).
  14592. More information about the Loudness Recommendation EBU R128 on
  14593. @url{http://tech.ebu.ch/loudness}.
  14594. The filter accepts the following options:
  14595. @table @option
  14596. @item video
  14597. Activate the video output. The audio stream is passed unchanged whether this
  14598. option is set or no. The video stream will be the first output stream if
  14599. activated. Default is @code{0}.
  14600. @item size
  14601. Set the video size. This option is for video only. For the syntax of this
  14602. option, check the
  14603. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14604. Default and minimum resolution is @code{640x480}.
  14605. @item meter
  14606. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14607. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14608. other integer value between this range is allowed.
  14609. @item metadata
  14610. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14611. into 100ms output frames, each of them containing various loudness information
  14612. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14613. Default is @code{0}.
  14614. @item framelog
  14615. Force the frame logging level.
  14616. Available values are:
  14617. @table @samp
  14618. @item info
  14619. information logging level
  14620. @item verbose
  14621. verbose logging level
  14622. @end table
  14623. By default, the logging level is set to @var{info}. If the @option{video} or
  14624. the @option{metadata} options are set, it switches to @var{verbose}.
  14625. @item peak
  14626. Set peak mode(s).
  14627. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14628. values are:
  14629. @table @samp
  14630. @item none
  14631. Disable any peak mode (default).
  14632. @item sample
  14633. Enable sample-peak mode.
  14634. Simple peak mode looking for the higher sample value. It logs a message
  14635. for sample-peak (identified by @code{SPK}).
  14636. @item true
  14637. Enable true-peak mode.
  14638. If enabled, the peak lookup is done on an over-sampled version of the input
  14639. stream for better peak accuracy. It logs a message for true-peak.
  14640. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14641. This mode requires a build with @code{libswresample}.
  14642. @end table
  14643. @item dualmono
  14644. Treat mono input files as "dual mono". If a mono file is intended for playback
  14645. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14646. If set to @code{true}, this option will compensate for this effect.
  14647. Multi-channel input files are not affected by this option.
  14648. @item panlaw
  14649. Set a specific pan law to be used for the measurement of dual mono files.
  14650. This parameter is optional, and has a default value of -3.01dB.
  14651. @end table
  14652. @subsection Examples
  14653. @itemize
  14654. @item
  14655. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14656. @example
  14657. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14658. @end example
  14659. @item
  14660. Run an analysis with @command{ffmpeg}:
  14661. @example
  14662. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14663. @end example
  14664. @end itemize
  14665. @section interleave, ainterleave
  14666. Temporally interleave frames from several inputs.
  14667. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14668. These filters read frames from several inputs and send the oldest
  14669. queued frame to the output.
  14670. Input streams must have well defined, monotonically increasing frame
  14671. timestamp values.
  14672. In order to submit one frame to output, these filters need to enqueue
  14673. at least one frame for each input, so they cannot work in case one
  14674. input is not yet terminated and will not receive incoming frames.
  14675. For example consider the case when one input is a @code{select} filter
  14676. which always drops input frames. The @code{interleave} filter will keep
  14677. reading from that input, but it will never be able to send new frames
  14678. to output until the input sends an end-of-stream signal.
  14679. Also, depending on inputs synchronization, the filters will drop
  14680. frames in case one input receives more frames than the other ones, and
  14681. the queue is already filled.
  14682. These filters accept the following options:
  14683. @table @option
  14684. @item nb_inputs, n
  14685. Set the number of different inputs, it is 2 by default.
  14686. @end table
  14687. @subsection Examples
  14688. @itemize
  14689. @item
  14690. Interleave frames belonging to different streams using @command{ffmpeg}:
  14691. @example
  14692. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14693. @end example
  14694. @item
  14695. Add flickering blur effect:
  14696. @example
  14697. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14698. @end example
  14699. @end itemize
  14700. @section metadata, ametadata
  14701. Manipulate frame metadata.
  14702. This filter accepts the following options:
  14703. @table @option
  14704. @item mode
  14705. Set mode of operation of the filter.
  14706. Can be one of the following:
  14707. @table @samp
  14708. @item select
  14709. If both @code{value} and @code{key} is set, select frames
  14710. which have such metadata. If only @code{key} is set, select
  14711. every frame that has such key in metadata.
  14712. @item add
  14713. Add new metadata @code{key} and @code{value}. If key is already available
  14714. do nothing.
  14715. @item modify
  14716. Modify value of already present key.
  14717. @item delete
  14718. If @code{value} is set, delete only keys that have such value.
  14719. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14720. the frame.
  14721. @item print
  14722. Print key and its value if metadata was found. If @code{key} is not set print all
  14723. metadata values available in frame.
  14724. @end table
  14725. @item key
  14726. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14727. @item value
  14728. Set metadata value which will be used. This option is mandatory for
  14729. @code{modify} and @code{add} mode.
  14730. @item function
  14731. Which function to use when comparing metadata value and @code{value}.
  14732. Can be one of following:
  14733. @table @samp
  14734. @item same_str
  14735. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14736. @item starts_with
  14737. Values are interpreted as strings, returns true if metadata value starts with
  14738. the @code{value} option string.
  14739. @item less
  14740. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14741. @item equal
  14742. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14743. @item greater
  14744. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14745. @item expr
  14746. Values are interpreted as floats, returns true if expression from option @code{expr}
  14747. evaluates to true.
  14748. @end table
  14749. @item expr
  14750. Set expression which is used when @code{function} is set to @code{expr}.
  14751. The expression is evaluated through the eval API and can contain the following
  14752. constants:
  14753. @table @option
  14754. @item VALUE1
  14755. Float representation of @code{value} from metadata key.
  14756. @item VALUE2
  14757. Float representation of @code{value} as supplied by user in @code{value} option.
  14758. @end table
  14759. @item file
  14760. If specified in @code{print} mode, output is written to the named file. Instead of
  14761. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14762. for standard output. If @code{file} option is not set, output is written to the log
  14763. with AV_LOG_INFO loglevel.
  14764. @end table
  14765. @subsection Examples
  14766. @itemize
  14767. @item
  14768. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14769. between 0 and 1.
  14770. @example
  14771. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14772. @end example
  14773. @item
  14774. Print silencedetect output to file @file{metadata.txt}.
  14775. @example
  14776. silencedetect,ametadata=mode=print:file=metadata.txt
  14777. @end example
  14778. @item
  14779. Direct all metadata to a pipe with file descriptor 4.
  14780. @example
  14781. metadata=mode=print:file='pipe\:4'
  14782. @end example
  14783. @end itemize
  14784. @section perms, aperms
  14785. Set read/write permissions for the output frames.
  14786. These filters are mainly aimed at developers to test direct path in the
  14787. following filter in the filtergraph.
  14788. The filters accept the following options:
  14789. @table @option
  14790. @item mode
  14791. Select the permissions mode.
  14792. It accepts the following values:
  14793. @table @samp
  14794. @item none
  14795. Do nothing. This is the default.
  14796. @item ro
  14797. Set all the output frames read-only.
  14798. @item rw
  14799. Set all the output frames directly writable.
  14800. @item toggle
  14801. Make the frame read-only if writable, and writable if read-only.
  14802. @item random
  14803. Set each output frame read-only or writable randomly.
  14804. @end table
  14805. @item seed
  14806. Set the seed for the @var{random} mode, must be an integer included between
  14807. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14808. @code{-1}, the filter will try to use a good random seed on a best effort
  14809. basis.
  14810. @end table
  14811. Note: in case of auto-inserted filter between the permission filter and the
  14812. following one, the permission might not be received as expected in that
  14813. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14814. perms/aperms filter can avoid this problem.
  14815. @section realtime, arealtime
  14816. Slow down filtering to match real time approximately.
  14817. These filters will pause the filtering for a variable amount of time to
  14818. match the output rate with the input timestamps.
  14819. They are similar to the @option{re} option to @code{ffmpeg}.
  14820. They accept the following options:
  14821. @table @option
  14822. @item limit
  14823. Time limit for the pauses. Any pause longer than that will be considered
  14824. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14825. @end table
  14826. @anchor{select}
  14827. @section select, aselect
  14828. Select frames to pass in output.
  14829. This filter accepts the following options:
  14830. @table @option
  14831. @item expr, e
  14832. Set expression, which is evaluated for each input frame.
  14833. If the expression is evaluated to zero, the frame is discarded.
  14834. If the evaluation result is negative or NaN, the frame is sent to the
  14835. first output; otherwise it is sent to the output with index
  14836. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14837. For example a value of @code{1.2} corresponds to the output with index
  14838. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14839. @item outputs, n
  14840. Set the number of outputs. The output to which to send the selected
  14841. frame is based on the result of the evaluation. Default value is 1.
  14842. @end table
  14843. The expression can contain the following constants:
  14844. @table @option
  14845. @item n
  14846. The (sequential) number of the filtered frame, starting from 0.
  14847. @item selected_n
  14848. The (sequential) number of the selected frame, starting from 0.
  14849. @item prev_selected_n
  14850. The sequential number of the last selected frame. It's NAN if undefined.
  14851. @item TB
  14852. The timebase of the input timestamps.
  14853. @item pts
  14854. The PTS (Presentation TimeStamp) of the filtered video frame,
  14855. expressed in @var{TB} units. It's NAN if undefined.
  14856. @item t
  14857. The PTS of the filtered video frame,
  14858. expressed in seconds. It's NAN if undefined.
  14859. @item prev_pts
  14860. The PTS of the previously filtered video frame. It's NAN if undefined.
  14861. @item prev_selected_pts
  14862. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14863. @item prev_selected_t
  14864. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14865. @item start_pts
  14866. The PTS of the first video frame in the video. It's NAN if undefined.
  14867. @item start_t
  14868. The time of the first video frame in the video. It's NAN if undefined.
  14869. @item pict_type @emph{(video only)}
  14870. The type of the filtered frame. It can assume one of the following
  14871. values:
  14872. @table @option
  14873. @item I
  14874. @item P
  14875. @item B
  14876. @item S
  14877. @item SI
  14878. @item SP
  14879. @item BI
  14880. @end table
  14881. @item interlace_type @emph{(video only)}
  14882. The frame interlace type. It can assume one of the following values:
  14883. @table @option
  14884. @item PROGRESSIVE
  14885. The frame is progressive (not interlaced).
  14886. @item TOPFIRST
  14887. The frame is top-field-first.
  14888. @item BOTTOMFIRST
  14889. The frame is bottom-field-first.
  14890. @end table
  14891. @item consumed_sample_n @emph{(audio only)}
  14892. the number of selected samples before the current frame
  14893. @item samples_n @emph{(audio only)}
  14894. the number of samples in the current frame
  14895. @item sample_rate @emph{(audio only)}
  14896. the input sample rate
  14897. @item key
  14898. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14899. @item pos
  14900. the position in the file of the filtered frame, -1 if the information
  14901. is not available (e.g. for synthetic video)
  14902. @item scene @emph{(video only)}
  14903. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14904. probability for the current frame to introduce a new scene, while a higher
  14905. value means the current frame is more likely to be one (see the example below)
  14906. @item concatdec_select
  14907. The concat demuxer can select only part of a concat input file by setting an
  14908. inpoint and an outpoint, but the output packets may not be entirely contained
  14909. in the selected interval. By using this variable, it is possible to skip frames
  14910. generated by the concat demuxer which are not exactly contained in the selected
  14911. interval.
  14912. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14913. and the @var{lavf.concat.duration} packet metadata values which are also
  14914. present in the decoded frames.
  14915. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14916. start_time and either the duration metadata is missing or the frame pts is less
  14917. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14918. missing.
  14919. That basically means that an input frame is selected if its pts is within the
  14920. interval set by the concat demuxer.
  14921. @end table
  14922. The default value of the select expression is "1".
  14923. @subsection Examples
  14924. @itemize
  14925. @item
  14926. Select all frames in input:
  14927. @example
  14928. select
  14929. @end example
  14930. The example above is the same as:
  14931. @example
  14932. select=1
  14933. @end example
  14934. @item
  14935. Skip all frames:
  14936. @example
  14937. select=0
  14938. @end example
  14939. @item
  14940. Select only I-frames:
  14941. @example
  14942. select='eq(pict_type\,I)'
  14943. @end example
  14944. @item
  14945. Select one frame every 100:
  14946. @example
  14947. select='not(mod(n\,100))'
  14948. @end example
  14949. @item
  14950. Select only frames contained in the 10-20 time interval:
  14951. @example
  14952. select=between(t\,10\,20)
  14953. @end example
  14954. @item
  14955. Select only I-frames contained in the 10-20 time interval:
  14956. @example
  14957. select=between(t\,10\,20)*eq(pict_type\,I)
  14958. @end example
  14959. @item
  14960. Select frames with a minimum distance of 10 seconds:
  14961. @example
  14962. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14963. @end example
  14964. @item
  14965. Use aselect to select only audio frames with samples number > 100:
  14966. @example
  14967. aselect='gt(samples_n\,100)'
  14968. @end example
  14969. @item
  14970. Create a mosaic of the first scenes:
  14971. @example
  14972. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14973. @end example
  14974. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14975. choice.
  14976. @item
  14977. Send even and odd frames to separate outputs, and compose them:
  14978. @example
  14979. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14980. @end example
  14981. @item
  14982. Select useful frames from an ffconcat file which is using inpoints and
  14983. outpoints but where the source files are not intra frame only.
  14984. @example
  14985. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14986. @end example
  14987. @end itemize
  14988. @section sendcmd, asendcmd
  14989. Send commands to filters in the filtergraph.
  14990. These filters read commands to be sent to other filters in the
  14991. filtergraph.
  14992. @code{sendcmd} must be inserted between two video filters,
  14993. @code{asendcmd} must be inserted between two audio filters, but apart
  14994. from that they act the same way.
  14995. The specification of commands can be provided in the filter arguments
  14996. with the @var{commands} option, or in a file specified by the
  14997. @var{filename} option.
  14998. These filters accept the following options:
  14999. @table @option
  15000. @item commands, c
  15001. Set the commands to be read and sent to the other filters.
  15002. @item filename, f
  15003. Set the filename of the commands to be read and sent to the other
  15004. filters.
  15005. @end table
  15006. @subsection Commands syntax
  15007. A commands description consists of a sequence of interval
  15008. specifications, comprising a list of commands to be executed when a
  15009. particular event related to that interval occurs. The occurring event
  15010. is typically the current frame time entering or leaving a given time
  15011. interval.
  15012. An interval is specified by the following syntax:
  15013. @example
  15014. @var{START}[-@var{END}] @var{COMMANDS};
  15015. @end example
  15016. The time interval is specified by the @var{START} and @var{END} times.
  15017. @var{END} is optional and defaults to the maximum time.
  15018. The current frame time is considered within the specified interval if
  15019. it is included in the interval [@var{START}, @var{END}), that is when
  15020. the time is greater or equal to @var{START} and is lesser than
  15021. @var{END}.
  15022. @var{COMMANDS} consists of a sequence of one or more command
  15023. specifications, separated by ",", relating to that interval. The
  15024. syntax of a command specification is given by:
  15025. @example
  15026. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  15027. @end example
  15028. @var{FLAGS} is optional and specifies the type of events relating to
  15029. the time interval which enable sending the specified command, and must
  15030. be a non-null sequence of identifier flags separated by "+" or "|" and
  15031. enclosed between "[" and "]".
  15032. The following flags are recognized:
  15033. @table @option
  15034. @item enter
  15035. The command is sent when the current frame timestamp enters the
  15036. specified interval. In other words, the command is sent when the
  15037. previous frame timestamp was not in the given interval, and the
  15038. current is.
  15039. @item leave
  15040. The command is sent when the current frame timestamp leaves the
  15041. specified interval. In other words, the command is sent when the
  15042. previous frame timestamp was in the given interval, and the
  15043. current is not.
  15044. @end table
  15045. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  15046. assumed.
  15047. @var{TARGET} specifies the target of the command, usually the name of
  15048. the filter class or a specific filter instance name.
  15049. @var{COMMAND} specifies the name of the command for the target filter.
  15050. @var{ARG} is optional and specifies the optional list of argument for
  15051. the given @var{COMMAND}.
  15052. Between one interval specification and another, whitespaces, or
  15053. sequences of characters starting with @code{#} until the end of line,
  15054. are ignored and can be used to annotate comments.
  15055. A simplified BNF description of the commands specification syntax
  15056. follows:
  15057. @example
  15058. @var{COMMAND_FLAG} ::= "enter" | "leave"
  15059. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  15060. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  15061. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  15062. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  15063. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  15064. @end example
  15065. @subsection Examples
  15066. @itemize
  15067. @item
  15068. Specify audio tempo change at second 4:
  15069. @example
  15070. asendcmd=c='4.0 atempo tempo 1.5',atempo
  15071. @end example
  15072. @item
  15073. Target a specific filter instance:
  15074. @example
  15075. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  15076. @end example
  15077. @item
  15078. Specify a list of drawtext and hue commands in a file.
  15079. @example
  15080. # show text in the interval 5-10
  15081. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  15082. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  15083. # desaturate the image in the interval 15-20
  15084. 15.0-20.0 [enter] hue s 0,
  15085. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  15086. [leave] hue s 1,
  15087. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  15088. # apply an exponential saturation fade-out effect, starting from time 25
  15089. 25 [enter] hue s exp(25-t)
  15090. @end example
  15091. A filtergraph allowing to read and process the above command list
  15092. stored in a file @file{test.cmd}, can be specified with:
  15093. @example
  15094. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  15095. @end example
  15096. @end itemize
  15097. @anchor{setpts}
  15098. @section setpts, asetpts
  15099. Change the PTS (presentation timestamp) of the input frames.
  15100. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  15101. This filter accepts the following options:
  15102. @table @option
  15103. @item expr
  15104. The expression which is evaluated for each frame to construct its timestamp.
  15105. @end table
  15106. The expression is evaluated through the eval API and can contain the following
  15107. constants:
  15108. @table @option
  15109. @item FRAME_RATE, FR
  15110. frame rate, only defined for constant frame-rate video
  15111. @item PTS
  15112. The presentation timestamp in input
  15113. @item N
  15114. The count of the input frame for video or the number of consumed samples,
  15115. not including the current frame for audio, starting from 0.
  15116. @item NB_CONSUMED_SAMPLES
  15117. The number of consumed samples, not including the current frame (only
  15118. audio)
  15119. @item NB_SAMPLES, S
  15120. The number of samples in the current frame (only audio)
  15121. @item SAMPLE_RATE, SR
  15122. The audio sample rate.
  15123. @item STARTPTS
  15124. The PTS of the first frame.
  15125. @item STARTT
  15126. the time in seconds of the first frame
  15127. @item INTERLACED
  15128. State whether the current frame is interlaced.
  15129. @item T
  15130. the time in seconds of the current frame
  15131. @item POS
  15132. original position in the file of the frame, or undefined if undefined
  15133. for the current frame
  15134. @item PREV_INPTS
  15135. The previous input PTS.
  15136. @item PREV_INT
  15137. previous input time in seconds
  15138. @item PREV_OUTPTS
  15139. The previous output PTS.
  15140. @item PREV_OUTT
  15141. previous output time in seconds
  15142. @item RTCTIME
  15143. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  15144. instead.
  15145. @item RTCSTART
  15146. The wallclock (RTC) time at the start of the movie in microseconds.
  15147. @item TB
  15148. The timebase of the input timestamps.
  15149. @end table
  15150. @subsection Examples
  15151. @itemize
  15152. @item
  15153. Start counting PTS from zero
  15154. @example
  15155. setpts=PTS-STARTPTS
  15156. @end example
  15157. @item
  15158. Apply fast motion effect:
  15159. @example
  15160. setpts=0.5*PTS
  15161. @end example
  15162. @item
  15163. Apply slow motion effect:
  15164. @example
  15165. setpts=2.0*PTS
  15166. @end example
  15167. @item
  15168. Set fixed rate of 25 frames per second:
  15169. @example
  15170. setpts=N/(25*TB)
  15171. @end example
  15172. @item
  15173. Set fixed rate 25 fps with some jitter:
  15174. @example
  15175. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  15176. @end example
  15177. @item
  15178. Apply an offset of 10 seconds to the input PTS:
  15179. @example
  15180. setpts=PTS+10/TB
  15181. @end example
  15182. @item
  15183. Generate timestamps from a "live source" and rebase onto the current timebase:
  15184. @example
  15185. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  15186. @end example
  15187. @item
  15188. Generate timestamps by counting samples:
  15189. @example
  15190. asetpts=N/SR/TB
  15191. @end example
  15192. @end itemize
  15193. @section setrange
  15194. Force color range for the output video frame.
  15195. The @code{setrange} filter marks the color range property for the
  15196. output frames. It does not change the input frame, but only sets the
  15197. corresponding property, which affects how the frame is treated by
  15198. following filters.
  15199. The filter accepts the following options:
  15200. @table @option
  15201. @item range
  15202. Available values are:
  15203. @table @samp
  15204. @item auto
  15205. Keep the same color range property.
  15206. @item unspecified, unknown
  15207. Set the color range as unspecified.
  15208. @item limited, tv, mpeg
  15209. Set the color range as limited.
  15210. @item full, pc, jpeg
  15211. Set the color range as full.
  15212. @end table
  15213. @end table
  15214. @section settb, asettb
  15215. Set the timebase to use for the output frames timestamps.
  15216. It is mainly useful for testing timebase configuration.
  15217. It accepts the following parameters:
  15218. @table @option
  15219. @item expr, tb
  15220. The expression which is evaluated into the output timebase.
  15221. @end table
  15222. The value for @option{tb} is an arithmetic expression representing a
  15223. rational. The expression can contain the constants "AVTB" (the default
  15224. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15225. audio only). Default value is "intb".
  15226. @subsection Examples
  15227. @itemize
  15228. @item
  15229. Set the timebase to 1/25:
  15230. @example
  15231. settb=expr=1/25
  15232. @end example
  15233. @item
  15234. Set the timebase to 1/10:
  15235. @example
  15236. settb=expr=0.1
  15237. @end example
  15238. @item
  15239. Set the timebase to 1001/1000:
  15240. @example
  15241. settb=1+0.001
  15242. @end example
  15243. @item
  15244. Set the timebase to 2*intb:
  15245. @example
  15246. settb=2*intb
  15247. @end example
  15248. @item
  15249. Set the default timebase value:
  15250. @example
  15251. settb=AVTB
  15252. @end example
  15253. @end itemize
  15254. @section showcqt
  15255. Convert input audio to a video output representing frequency spectrum
  15256. logarithmically using Brown-Puckette constant Q transform algorithm with
  15257. direct frequency domain coefficient calculation (but the transform itself
  15258. is not really constant Q, instead the Q factor is actually variable/clamped),
  15259. with musical tone scale, from E0 to D#10.
  15260. The filter accepts the following options:
  15261. @table @option
  15262. @item size, s
  15263. Specify the video size for the output. It must be even. For the syntax of this option,
  15264. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15265. Default value is @code{1920x1080}.
  15266. @item fps, rate, r
  15267. Set the output frame rate. Default value is @code{25}.
  15268. @item bar_h
  15269. Set the bargraph height. It must be even. Default value is @code{-1} which
  15270. computes the bargraph height automatically.
  15271. @item axis_h
  15272. Set the axis height. It must be even. Default value is @code{-1} which computes
  15273. the axis height automatically.
  15274. @item sono_h
  15275. Set the sonogram height. It must be even. Default value is @code{-1} which
  15276. computes the sonogram height automatically.
  15277. @item fullhd
  15278. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15279. instead. Default value is @code{1}.
  15280. @item sono_v, volume
  15281. Specify the sonogram volume expression. It can contain variables:
  15282. @table @option
  15283. @item bar_v
  15284. the @var{bar_v} evaluated expression
  15285. @item frequency, freq, f
  15286. the frequency where it is evaluated
  15287. @item timeclamp, tc
  15288. the value of @var{timeclamp} option
  15289. @end table
  15290. and functions:
  15291. @table @option
  15292. @item a_weighting(f)
  15293. A-weighting of equal loudness
  15294. @item b_weighting(f)
  15295. B-weighting of equal loudness
  15296. @item c_weighting(f)
  15297. C-weighting of equal loudness.
  15298. @end table
  15299. Default value is @code{16}.
  15300. @item bar_v, volume2
  15301. Specify the bargraph volume expression. It can contain variables:
  15302. @table @option
  15303. @item sono_v
  15304. the @var{sono_v} evaluated expression
  15305. @item frequency, freq, f
  15306. the frequency where it is evaluated
  15307. @item timeclamp, tc
  15308. the value of @var{timeclamp} option
  15309. @end table
  15310. and functions:
  15311. @table @option
  15312. @item a_weighting(f)
  15313. A-weighting of equal loudness
  15314. @item b_weighting(f)
  15315. B-weighting of equal loudness
  15316. @item c_weighting(f)
  15317. C-weighting of equal loudness.
  15318. @end table
  15319. Default value is @code{sono_v}.
  15320. @item sono_g, gamma
  15321. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15322. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15323. Acceptable range is @code{[1, 7]}.
  15324. @item bar_g, gamma2
  15325. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15326. @code{[1, 7]}.
  15327. @item bar_t
  15328. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15329. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15330. @item timeclamp, tc
  15331. Specify the transform timeclamp. At low frequency, there is trade-off between
  15332. accuracy in time domain and frequency domain. If timeclamp is lower,
  15333. event in time domain is represented more accurately (such as fast bass drum),
  15334. otherwise event in frequency domain is represented more accurately
  15335. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15336. @item attack
  15337. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15338. limits future samples by applying asymmetric windowing in time domain, useful
  15339. when low latency is required. Accepted range is @code{[0, 1]}.
  15340. @item basefreq
  15341. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15342. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15343. @item endfreq
  15344. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15345. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15346. @item coeffclamp
  15347. This option is deprecated and ignored.
  15348. @item tlength
  15349. Specify the transform length in time domain. Use this option to control accuracy
  15350. trade-off between time domain and frequency domain at every frequency sample.
  15351. It can contain variables:
  15352. @table @option
  15353. @item frequency, freq, f
  15354. the frequency where it is evaluated
  15355. @item timeclamp, tc
  15356. the value of @var{timeclamp} option.
  15357. @end table
  15358. Default value is @code{384*tc/(384+tc*f)}.
  15359. @item count
  15360. Specify the transform count for every video frame. Default value is @code{6}.
  15361. Acceptable range is @code{[1, 30]}.
  15362. @item fcount
  15363. Specify the transform count for every single pixel. Default value is @code{0},
  15364. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15365. @item fontfile
  15366. Specify font file for use with freetype to draw the axis. If not specified,
  15367. use embedded font. Note that drawing with font file or embedded font is not
  15368. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15369. option instead.
  15370. @item font
  15371. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15372. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15373. @item fontcolor
  15374. Specify font color expression. This is arithmetic expression that should return
  15375. integer value 0xRRGGBB. It can contain variables:
  15376. @table @option
  15377. @item frequency, freq, f
  15378. the frequency where it is evaluated
  15379. @item timeclamp, tc
  15380. the value of @var{timeclamp} option
  15381. @end table
  15382. and functions:
  15383. @table @option
  15384. @item midi(f)
  15385. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15386. @item r(x), g(x), b(x)
  15387. red, green, and blue value of intensity x.
  15388. @end table
  15389. Default value is @code{st(0, (midi(f)-59.5)/12);
  15390. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15391. r(1-ld(1)) + b(ld(1))}.
  15392. @item axisfile
  15393. Specify image file to draw the axis. This option override @var{fontfile} and
  15394. @var{fontcolor} option.
  15395. @item axis, text
  15396. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15397. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15398. Default value is @code{1}.
  15399. @item csp
  15400. Set colorspace. The accepted values are:
  15401. @table @samp
  15402. @item unspecified
  15403. Unspecified (default)
  15404. @item bt709
  15405. BT.709
  15406. @item fcc
  15407. FCC
  15408. @item bt470bg
  15409. BT.470BG or BT.601-6 625
  15410. @item smpte170m
  15411. SMPTE-170M or BT.601-6 525
  15412. @item smpte240m
  15413. SMPTE-240M
  15414. @item bt2020ncl
  15415. BT.2020 with non-constant luminance
  15416. @end table
  15417. @item cscheme
  15418. Set spectrogram color scheme. This is list of floating point values with format
  15419. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15420. The default is @code{1|0.5|0|0|0.5|1}.
  15421. @end table
  15422. @subsection Examples
  15423. @itemize
  15424. @item
  15425. Playing audio while showing the spectrum:
  15426. @example
  15427. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15428. @end example
  15429. @item
  15430. Same as above, but with frame rate 30 fps:
  15431. @example
  15432. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15433. @end example
  15434. @item
  15435. Playing at 1280x720:
  15436. @example
  15437. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15438. @end example
  15439. @item
  15440. Disable sonogram display:
  15441. @example
  15442. sono_h=0
  15443. @end example
  15444. @item
  15445. A1 and its harmonics: A1, A2, (near)E3, A3:
  15446. @example
  15447. 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),
  15448. asplit[a][out1]; [a] showcqt [out0]'
  15449. @end example
  15450. @item
  15451. Same as above, but with more accuracy in frequency domain:
  15452. @example
  15453. 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),
  15454. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15455. @end example
  15456. @item
  15457. Custom volume:
  15458. @example
  15459. bar_v=10:sono_v=bar_v*a_weighting(f)
  15460. @end example
  15461. @item
  15462. Custom gamma, now spectrum is linear to the amplitude.
  15463. @example
  15464. bar_g=2:sono_g=2
  15465. @end example
  15466. @item
  15467. Custom tlength equation:
  15468. @example
  15469. 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)))'
  15470. @end example
  15471. @item
  15472. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15473. @example
  15474. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15475. @end example
  15476. @item
  15477. Custom font using fontconfig:
  15478. @example
  15479. font='Courier New,Monospace,mono|bold'
  15480. @end example
  15481. @item
  15482. Custom frequency range with custom axis using image file:
  15483. @example
  15484. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15485. @end example
  15486. @end itemize
  15487. @section showfreqs
  15488. Convert input audio to video output representing the audio power spectrum.
  15489. Audio amplitude is on Y-axis while frequency is on X-axis.
  15490. The filter accepts the following options:
  15491. @table @option
  15492. @item size, s
  15493. Specify size of video. For the syntax of this option, check the
  15494. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15495. Default is @code{1024x512}.
  15496. @item mode
  15497. Set display mode.
  15498. This set how each frequency bin will be represented.
  15499. It accepts the following values:
  15500. @table @samp
  15501. @item line
  15502. @item bar
  15503. @item dot
  15504. @end table
  15505. Default is @code{bar}.
  15506. @item ascale
  15507. Set amplitude scale.
  15508. It accepts the following values:
  15509. @table @samp
  15510. @item lin
  15511. Linear scale.
  15512. @item sqrt
  15513. Square root scale.
  15514. @item cbrt
  15515. Cubic root scale.
  15516. @item log
  15517. Logarithmic scale.
  15518. @end table
  15519. Default is @code{log}.
  15520. @item fscale
  15521. Set frequency scale.
  15522. It accepts the following values:
  15523. @table @samp
  15524. @item lin
  15525. Linear scale.
  15526. @item log
  15527. Logarithmic scale.
  15528. @item rlog
  15529. Reverse logarithmic scale.
  15530. @end table
  15531. Default is @code{lin}.
  15532. @item win_size
  15533. Set window size.
  15534. It accepts the following values:
  15535. @table @samp
  15536. @item w16
  15537. @item w32
  15538. @item w64
  15539. @item w128
  15540. @item w256
  15541. @item w512
  15542. @item w1024
  15543. @item w2048
  15544. @item w4096
  15545. @item w8192
  15546. @item w16384
  15547. @item w32768
  15548. @item w65536
  15549. @end table
  15550. Default is @code{w2048}
  15551. @item win_func
  15552. Set windowing function.
  15553. It accepts the following values:
  15554. @table @samp
  15555. @item rect
  15556. @item bartlett
  15557. @item hanning
  15558. @item hamming
  15559. @item blackman
  15560. @item welch
  15561. @item flattop
  15562. @item bharris
  15563. @item bnuttall
  15564. @item bhann
  15565. @item sine
  15566. @item nuttall
  15567. @item lanczos
  15568. @item gauss
  15569. @item tukey
  15570. @item dolph
  15571. @item cauchy
  15572. @item parzen
  15573. @item poisson
  15574. @end table
  15575. Default is @code{hanning}.
  15576. @item overlap
  15577. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15578. which means optimal overlap for selected window function will be picked.
  15579. @item averaging
  15580. Set time averaging. Setting this to 0 will display current maximal peaks.
  15581. Default is @code{1}, which means time averaging is disabled.
  15582. @item colors
  15583. Specify list of colors separated by space or by '|' which will be used to
  15584. draw channel frequencies. Unrecognized or missing colors will be replaced
  15585. by white color.
  15586. @item cmode
  15587. Set channel display mode.
  15588. It accepts the following values:
  15589. @table @samp
  15590. @item combined
  15591. @item separate
  15592. @end table
  15593. Default is @code{combined}.
  15594. @item minamp
  15595. Set minimum amplitude used in @code{log} amplitude scaler.
  15596. @end table
  15597. @anchor{showspectrum}
  15598. @section showspectrum
  15599. Convert input audio to a video output, representing the audio frequency
  15600. spectrum.
  15601. The filter accepts the following options:
  15602. @table @option
  15603. @item size, s
  15604. Specify the video size for the output. For the syntax of this option, check the
  15605. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15606. Default value is @code{640x512}.
  15607. @item slide
  15608. Specify how the spectrum should slide along the window.
  15609. It accepts the following values:
  15610. @table @samp
  15611. @item replace
  15612. the samples start again on the left when they reach the right
  15613. @item scroll
  15614. the samples scroll from right to left
  15615. @item fullframe
  15616. frames are only produced when the samples reach the right
  15617. @item rscroll
  15618. the samples scroll from left to right
  15619. @end table
  15620. Default value is @code{replace}.
  15621. @item mode
  15622. Specify display mode.
  15623. It accepts the following values:
  15624. @table @samp
  15625. @item combined
  15626. all channels are displayed in the same row
  15627. @item separate
  15628. all channels are displayed in separate rows
  15629. @end table
  15630. Default value is @samp{combined}.
  15631. @item color
  15632. Specify display color mode.
  15633. It accepts the following values:
  15634. @table @samp
  15635. @item channel
  15636. each channel is displayed in a separate color
  15637. @item intensity
  15638. each channel is displayed using the same color scheme
  15639. @item rainbow
  15640. each channel is displayed using the rainbow color scheme
  15641. @item moreland
  15642. each channel is displayed using the moreland color scheme
  15643. @item nebulae
  15644. each channel is displayed using the nebulae color scheme
  15645. @item fire
  15646. each channel is displayed using the fire color scheme
  15647. @item fiery
  15648. each channel is displayed using the fiery color scheme
  15649. @item fruit
  15650. each channel is displayed using the fruit color scheme
  15651. @item cool
  15652. each channel is displayed using the cool color scheme
  15653. @end table
  15654. Default value is @samp{channel}.
  15655. @item scale
  15656. Specify scale used for calculating intensity color values.
  15657. It accepts the following values:
  15658. @table @samp
  15659. @item lin
  15660. linear
  15661. @item sqrt
  15662. square root, default
  15663. @item cbrt
  15664. cubic root
  15665. @item log
  15666. logarithmic
  15667. @item 4thrt
  15668. 4th root
  15669. @item 5thrt
  15670. 5th root
  15671. @end table
  15672. Default value is @samp{sqrt}.
  15673. @item saturation
  15674. Set saturation modifier for displayed colors. Negative values provide
  15675. alternative color scheme. @code{0} is no saturation at all.
  15676. Saturation must be in [-10.0, 10.0] range.
  15677. Default value is @code{1}.
  15678. @item win_func
  15679. Set window function.
  15680. It accepts the following values:
  15681. @table @samp
  15682. @item rect
  15683. @item bartlett
  15684. @item hann
  15685. @item hanning
  15686. @item hamming
  15687. @item blackman
  15688. @item welch
  15689. @item flattop
  15690. @item bharris
  15691. @item bnuttall
  15692. @item bhann
  15693. @item sine
  15694. @item nuttall
  15695. @item lanczos
  15696. @item gauss
  15697. @item tukey
  15698. @item dolph
  15699. @item cauchy
  15700. @item parzen
  15701. @item poisson
  15702. @end table
  15703. Default value is @code{hann}.
  15704. @item orientation
  15705. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15706. @code{horizontal}. Default is @code{vertical}.
  15707. @item overlap
  15708. Set ratio of overlap window. Default value is @code{0}.
  15709. When value is @code{1} overlap is set to recommended size for specific
  15710. window function currently used.
  15711. @item gain
  15712. Set scale gain for calculating intensity color values.
  15713. Default value is @code{1}.
  15714. @item data
  15715. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15716. @item rotation
  15717. Set color rotation, must be in [-1.0, 1.0] range.
  15718. Default value is @code{0}.
  15719. @end table
  15720. The usage is very similar to the showwaves filter; see the examples in that
  15721. section.
  15722. @subsection Examples
  15723. @itemize
  15724. @item
  15725. Large window with logarithmic color scaling:
  15726. @example
  15727. showspectrum=s=1280x480:scale=log
  15728. @end example
  15729. @item
  15730. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15731. @example
  15732. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15733. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15734. @end example
  15735. @end itemize
  15736. @section showspectrumpic
  15737. Convert input audio to a single video frame, representing the audio frequency
  15738. spectrum.
  15739. The filter accepts the following options:
  15740. @table @option
  15741. @item size, s
  15742. Specify the video size for the output. For the syntax of this option, check the
  15743. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15744. Default value is @code{4096x2048}.
  15745. @item mode
  15746. Specify display mode.
  15747. It accepts the following values:
  15748. @table @samp
  15749. @item combined
  15750. all channels are displayed in the same row
  15751. @item separate
  15752. all channels are displayed in separate rows
  15753. @end table
  15754. Default value is @samp{combined}.
  15755. @item color
  15756. Specify display color mode.
  15757. It accepts the following values:
  15758. @table @samp
  15759. @item channel
  15760. each channel is displayed in a separate color
  15761. @item intensity
  15762. each channel is displayed using the same color scheme
  15763. @item rainbow
  15764. each channel is displayed using the rainbow color scheme
  15765. @item moreland
  15766. each channel is displayed using the moreland color scheme
  15767. @item nebulae
  15768. each channel is displayed using the nebulae color scheme
  15769. @item fire
  15770. each channel is displayed using the fire color scheme
  15771. @item fiery
  15772. each channel is displayed using the fiery color scheme
  15773. @item fruit
  15774. each channel is displayed using the fruit color scheme
  15775. @item cool
  15776. each channel is displayed using the cool color scheme
  15777. @end table
  15778. Default value is @samp{intensity}.
  15779. @item scale
  15780. Specify scale used for calculating intensity color values.
  15781. It accepts the following values:
  15782. @table @samp
  15783. @item lin
  15784. linear
  15785. @item sqrt
  15786. square root, default
  15787. @item cbrt
  15788. cubic root
  15789. @item log
  15790. logarithmic
  15791. @item 4thrt
  15792. 4th root
  15793. @item 5thrt
  15794. 5th root
  15795. @end table
  15796. Default value is @samp{log}.
  15797. @item saturation
  15798. Set saturation modifier for displayed colors. Negative values provide
  15799. alternative color scheme. @code{0} is no saturation at all.
  15800. Saturation must be in [-10.0, 10.0] range.
  15801. Default value is @code{1}.
  15802. @item win_func
  15803. Set window function.
  15804. It accepts the following values:
  15805. @table @samp
  15806. @item rect
  15807. @item bartlett
  15808. @item hann
  15809. @item hanning
  15810. @item hamming
  15811. @item blackman
  15812. @item welch
  15813. @item flattop
  15814. @item bharris
  15815. @item bnuttall
  15816. @item bhann
  15817. @item sine
  15818. @item nuttall
  15819. @item lanczos
  15820. @item gauss
  15821. @item tukey
  15822. @item dolph
  15823. @item cauchy
  15824. @item parzen
  15825. @item poisson
  15826. @end table
  15827. Default value is @code{hann}.
  15828. @item orientation
  15829. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15830. @code{horizontal}. Default is @code{vertical}.
  15831. @item gain
  15832. Set scale gain for calculating intensity color values.
  15833. Default value is @code{1}.
  15834. @item legend
  15835. Draw time and frequency axes and legends. Default is enabled.
  15836. @item rotation
  15837. Set color rotation, must be in [-1.0, 1.0] range.
  15838. Default value is @code{0}.
  15839. @end table
  15840. @subsection Examples
  15841. @itemize
  15842. @item
  15843. Extract an audio spectrogram of a whole audio track
  15844. in a 1024x1024 picture using @command{ffmpeg}:
  15845. @example
  15846. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15847. @end example
  15848. @end itemize
  15849. @section showvolume
  15850. Convert input audio volume to a video output.
  15851. The filter accepts the following options:
  15852. @table @option
  15853. @item rate, r
  15854. Set video rate.
  15855. @item b
  15856. Set border width, allowed range is [0, 5]. Default is 1.
  15857. @item w
  15858. Set channel width, allowed range is [80, 8192]. Default is 400.
  15859. @item h
  15860. Set channel height, allowed range is [1, 900]. Default is 20.
  15861. @item f
  15862. Set fade, allowed range is [0, 1]. Default is 0.95.
  15863. @item c
  15864. Set volume color expression.
  15865. The expression can use the following variables:
  15866. @table @option
  15867. @item VOLUME
  15868. Current max volume of channel in dB.
  15869. @item PEAK
  15870. Current peak.
  15871. @item CHANNEL
  15872. Current channel number, starting from 0.
  15873. @end table
  15874. @item t
  15875. If set, displays channel names. Default is enabled.
  15876. @item v
  15877. If set, displays volume values. Default is enabled.
  15878. @item o
  15879. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15880. default is @code{h}.
  15881. @item s
  15882. Set step size, allowed range is [0, 5]. Default is 0, which means
  15883. step is disabled.
  15884. @item p
  15885. Set background opacity, allowed range is [0, 1]. Default is 0.
  15886. @item m
  15887. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15888. default is @code{p}.
  15889. @item ds
  15890. Set display scale, can be linear: @code{lin} or log: @code{log},
  15891. default is @code{lin}.
  15892. @item dm
  15893. In second.
  15894. If set to > 0., display a line for the max level
  15895. in the previous seconds.
  15896. default is disabled: @code{0.}
  15897. @item dmc
  15898. The color of the max line. Use when @code{dm} option is set to > 0.
  15899. default is: @code{orange}
  15900. @end table
  15901. @section showwaves
  15902. Convert input audio to a video output, representing the samples waves.
  15903. The filter accepts the following options:
  15904. @table @option
  15905. @item size, s
  15906. Specify the video size for the output. For the syntax of this option, check the
  15907. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15908. Default value is @code{600x240}.
  15909. @item mode
  15910. Set display mode.
  15911. Available values are:
  15912. @table @samp
  15913. @item point
  15914. Draw a point for each sample.
  15915. @item line
  15916. Draw a vertical line for each sample.
  15917. @item p2p
  15918. Draw a point for each sample and a line between them.
  15919. @item cline
  15920. Draw a centered vertical line for each sample.
  15921. @end table
  15922. Default value is @code{point}.
  15923. @item n
  15924. Set the number of samples which are printed on the same column. A
  15925. larger value will decrease the frame rate. Must be a positive
  15926. integer. This option can be set only if the value for @var{rate}
  15927. is not explicitly specified.
  15928. @item rate, r
  15929. Set the (approximate) output frame rate. This is done by setting the
  15930. option @var{n}. Default value is "25".
  15931. @item split_channels
  15932. Set if channels should be drawn separately or overlap. Default value is 0.
  15933. @item colors
  15934. Set colors separated by '|' which are going to be used for drawing of each channel.
  15935. @item scale
  15936. Set amplitude scale.
  15937. Available values are:
  15938. @table @samp
  15939. @item lin
  15940. Linear.
  15941. @item log
  15942. Logarithmic.
  15943. @item sqrt
  15944. Square root.
  15945. @item cbrt
  15946. Cubic root.
  15947. @end table
  15948. Default is linear.
  15949. @item draw
  15950. Set the draw mode. This is mostly useful to set for high @var{n}.
  15951. Available values are:
  15952. @table @samp
  15953. @item scale
  15954. Scale pixel values for each drawn sample.
  15955. @item full
  15956. Draw every sample directly.
  15957. @end table
  15958. Default value is @code{scale}.
  15959. @end table
  15960. @subsection Examples
  15961. @itemize
  15962. @item
  15963. Output the input file audio and the corresponding video representation
  15964. at the same time:
  15965. @example
  15966. amovie=a.mp3,asplit[out0],showwaves[out1]
  15967. @end example
  15968. @item
  15969. Create a synthetic signal and show it with showwaves, forcing a
  15970. frame rate of 30 frames per second:
  15971. @example
  15972. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15973. @end example
  15974. @end itemize
  15975. @section showwavespic
  15976. Convert input audio to a single video frame, representing the samples waves.
  15977. The filter accepts the following options:
  15978. @table @option
  15979. @item size, s
  15980. Specify the video size for the output. For the syntax of this option, check the
  15981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15982. Default value is @code{600x240}.
  15983. @item split_channels
  15984. Set if channels should be drawn separately or overlap. Default value is 0.
  15985. @item colors
  15986. Set colors separated by '|' which are going to be used for drawing of each channel.
  15987. @item scale
  15988. Set amplitude scale.
  15989. Available values are:
  15990. @table @samp
  15991. @item lin
  15992. Linear.
  15993. @item log
  15994. Logarithmic.
  15995. @item sqrt
  15996. Square root.
  15997. @item cbrt
  15998. Cubic root.
  15999. @end table
  16000. Default is linear.
  16001. @end table
  16002. @subsection Examples
  16003. @itemize
  16004. @item
  16005. Extract a channel split representation of the wave form of a whole audio track
  16006. in a 1024x800 picture using @command{ffmpeg}:
  16007. @example
  16008. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  16009. @end example
  16010. @end itemize
  16011. @section sidedata, asidedata
  16012. Delete frame side data, or select frames based on it.
  16013. This filter accepts the following options:
  16014. @table @option
  16015. @item mode
  16016. Set mode of operation of the filter.
  16017. Can be one of the following:
  16018. @table @samp
  16019. @item select
  16020. Select every frame with side data of @code{type}.
  16021. @item delete
  16022. Delete side data of @code{type}. If @code{type} is not set, delete all side
  16023. data in the frame.
  16024. @end table
  16025. @item type
  16026. Set side data type used with all modes. Must be set for @code{select} mode. For
  16027. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  16028. in @file{libavutil/frame.h}. For example, to choose
  16029. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  16030. @end table
  16031. @section spectrumsynth
  16032. Sythesize audio from 2 input video spectrums, first input stream represents
  16033. magnitude across time and second represents phase across time.
  16034. The filter will transform from frequency domain as displayed in videos back
  16035. to time domain as presented in audio output.
  16036. This filter is primarily created for reversing processed @ref{showspectrum}
  16037. filter outputs, but can synthesize sound from other spectrograms too.
  16038. But in such case results are going to be poor if the phase data is not
  16039. available, because in such cases phase data need to be recreated, usually
  16040. its just recreated from random noise.
  16041. For best results use gray only output (@code{channel} color mode in
  16042. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  16043. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  16044. @code{data} option. Inputs videos should generally use @code{fullframe}
  16045. slide mode as that saves resources needed for decoding video.
  16046. The filter accepts the following options:
  16047. @table @option
  16048. @item sample_rate
  16049. Specify sample rate of output audio, the sample rate of audio from which
  16050. spectrum was generated may differ.
  16051. @item channels
  16052. Set number of channels represented in input video spectrums.
  16053. @item scale
  16054. Set scale which was used when generating magnitude input spectrum.
  16055. Can be @code{lin} or @code{log}. Default is @code{log}.
  16056. @item slide
  16057. Set slide which was used when generating inputs spectrums.
  16058. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  16059. Default is @code{fullframe}.
  16060. @item win_func
  16061. Set window function used for resynthesis.
  16062. @item overlap
  16063. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16064. which means optimal overlap for selected window function will be picked.
  16065. @item orientation
  16066. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  16067. Default is @code{vertical}.
  16068. @end table
  16069. @subsection Examples
  16070. @itemize
  16071. @item
  16072. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  16073. then resynthesize videos back to audio with spectrumsynth:
  16074. @example
  16075. 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
  16076. 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
  16077. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  16078. @end example
  16079. @end itemize
  16080. @section split, asplit
  16081. Split input into several identical outputs.
  16082. @code{asplit} works with audio input, @code{split} with video.
  16083. The filter accepts a single parameter which specifies the number of outputs. If
  16084. unspecified, it defaults to 2.
  16085. @subsection Examples
  16086. @itemize
  16087. @item
  16088. Create two separate outputs from the same input:
  16089. @example
  16090. [in] split [out0][out1]
  16091. @end example
  16092. @item
  16093. To create 3 or more outputs, you need to specify the number of
  16094. outputs, like in:
  16095. @example
  16096. [in] asplit=3 [out0][out1][out2]
  16097. @end example
  16098. @item
  16099. Create two separate outputs from the same input, one cropped and
  16100. one padded:
  16101. @example
  16102. [in] split [splitout1][splitout2];
  16103. [splitout1] crop=100:100:0:0 [cropout];
  16104. [splitout2] pad=200:200:100:100 [padout];
  16105. @end example
  16106. @item
  16107. Create 5 copies of the input audio with @command{ffmpeg}:
  16108. @example
  16109. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  16110. @end example
  16111. @end itemize
  16112. @section zmq, azmq
  16113. Receive commands sent through a libzmq client, and forward them to
  16114. filters in the filtergraph.
  16115. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  16116. must be inserted between two video filters, @code{azmq} between two
  16117. audio filters. Both are capable to send messages to any filter type.
  16118. To enable these filters you need to install the libzmq library and
  16119. headers and configure FFmpeg with @code{--enable-libzmq}.
  16120. For more information about libzmq see:
  16121. @url{http://www.zeromq.org/}
  16122. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  16123. receives messages sent through a network interface defined by the
  16124. @option{bind_address} (or the abbreviation "@option{b}") option.
  16125. Default value of this option is @file{tcp://localhost:5555}. You may
  16126. want to alter this value to your needs, but do not forget to escape any
  16127. ':' signs (see @ref{filtergraph escaping}).
  16128. The received message must be in the form:
  16129. @example
  16130. @var{TARGET} @var{COMMAND} [@var{ARG}]
  16131. @end example
  16132. @var{TARGET} specifies the target of the command, usually the name of
  16133. the filter class or a specific filter instance name. The default
  16134. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  16135. but you can override this by using the @samp{filter_name@@id} syntax
  16136. (see @ref{Filtergraph syntax}).
  16137. @var{COMMAND} specifies the name of the command for the target filter.
  16138. @var{ARG} is optional and specifies the optional argument list for the
  16139. given @var{COMMAND}.
  16140. Upon reception, the message is processed and the corresponding command
  16141. is injected into the filtergraph. Depending on the result, the filter
  16142. will send a reply to the client, adopting the format:
  16143. @example
  16144. @var{ERROR_CODE} @var{ERROR_REASON}
  16145. @var{MESSAGE}
  16146. @end example
  16147. @var{MESSAGE} is optional.
  16148. @subsection Examples
  16149. Look at @file{tools/zmqsend} for an example of a zmq client which can
  16150. be used to send commands processed by these filters.
  16151. Consider the following filtergraph generated by @command{ffplay}.
  16152. In this example the last overlay filter has an instance name. All other
  16153. filters will have default instance names.
  16154. @example
  16155. ffplay -dumpgraph 1 -f lavfi "
  16156. color=s=100x100:c=red [l];
  16157. color=s=100x100:c=blue [r];
  16158. nullsrc=s=200x100, zmq [bg];
  16159. [bg][l] overlay [bg+l];
  16160. [bg+l][r] overlay@@my=x=100 "
  16161. @end example
  16162. To change the color of the left side of the video, the following
  16163. command can be used:
  16164. @example
  16165. echo Parsed_color_0 c yellow | tools/zmqsend
  16166. @end example
  16167. To change the right side:
  16168. @example
  16169. echo Parsed_color_1 c pink | tools/zmqsend
  16170. @end example
  16171. To change the position of the right side:
  16172. @example
  16173. echo overlay@@my x 150 | tools/zmqsend
  16174. @end example
  16175. @c man end MULTIMEDIA FILTERS
  16176. @chapter Multimedia Sources
  16177. @c man begin MULTIMEDIA SOURCES
  16178. Below is a description of the currently available multimedia sources.
  16179. @section amovie
  16180. This is the same as @ref{movie} source, except it selects an audio
  16181. stream by default.
  16182. @anchor{movie}
  16183. @section movie
  16184. Read audio and/or video stream(s) from a movie container.
  16185. It accepts the following parameters:
  16186. @table @option
  16187. @item filename
  16188. The name of the resource to read (not necessarily a file; it can also be a
  16189. device or a stream accessed through some protocol).
  16190. @item format_name, f
  16191. Specifies the format assumed for the movie to read, and can be either
  16192. the name of a container or an input device. If not specified, the
  16193. format is guessed from @var{movie_name} or by probing.
  16194. @item seek_point, sp
  16195. Specifies the seek point in seconds. The frames will be output
  16196. starting from this seek point. The parameter is evaluated with
  16197. @code{av_strtod}, so the numerical value may be suffixed by an IS
  16198. postfix. The default value is "0".
  16199. @item streams, s
  16200. Specifies the streams to read. Several streams can be specified,
  16201. separated by "+". The source will then have as many outputs, in the
  16202. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16203. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16204. respectively the default (best suited) video and audio stream. Default
  16205. is "dv", or "da" if the filter is called as "amovie".
  16206. @item stream_index, si
  16207. Specifies the index of the video stream to read. If the value is -1,
  16208. the most suitable video stream will be automatically selected. The default
  16209. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16210. audio instead of video.
  16211. @item loop
  16212. Specifies how many times to read the stream in sequence.
  16213. If the value is 0, the stream will be looped infinitely.
  16214. Default value is "1".
  16215. Note that when the movie is looped the source timestamps are not
  16216. changed, so it will generate non monotonically increasing timestamps.
  16217. @item discontinuity
  16218. Specifies the time difference between frames above which the point is
  16219. considered a timestamp discontinuity which is removed by adjusting the later
  16220. timestamps.
  16221. @end table
  16222. It allows overlaying a second video on top of the main input of
  16223. a filtergraph, as shown in this graph:
  16224. @example
  16225. input -----------> deltapts0 --> overlay --> output
  16226. ^
  16227. |
  16228. movie --> scale--> deltapts1 -------+
  16229. @end example
  16230. @subsection Examples
  16231. @itemize
  16232. @item
  16233. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16234. on top of the input labelled "in":
  16235. @example
  16236. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16237. [in] setpts=PTS-STARTPTS [main];
  16238. [main][over] overlay=16:16 [out]
  16239. @end example
  16240. @item
  16241. Read from a video4linux2 device, and overlay it on top of the input
  16242. labelled "in":
  16243. @example
  16244. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16245. [in] setpts=PTS-STARTPTS [main];
  16246. [main][over] overlay=16:16 [out]
  16247. @end example
  16248. @item
  16249. Read the first video stream and the audio stream with id 0x81 from
  16250. dvd.vob; the video is connected to the pad named "video" and the audio is
  16251. connected to the pad named "audio":
  16252. @example
  16253. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16254. @end example
  16255. @end itemize
  16256. @subsection Commands
  16257. Both movie and amovie support the following commands:
  16258. @table @option
  16259. @item seek
  16260. Perform seek using "av_seek_frame".
  16261. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16262. @itemize
  16263. @item
  16264. @var{stream_index}: If stream_index is -1, a default
  16265. stream is selected, and @var{timestamp} is automatically converted
  16266. from AV_TIME_BASE units to the stream specific time_base.
  16267. @item
  16268. @var{timestamp}: Timestamp in AVStream.time_base units
  16269. or, if no stream is specified, in AV_TIME_BASE units.
  16270. @item
  16271. @var{flags}: Flags which select direction and seeking mode.
  16272. @end itemize
  16273. @item get_duration
  16274. Get movie duration in AV_TIME_BASE units.
  16275. @end table
  16276. @c man end MULTIMEDIA SOURCES