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.

20406 lines
540KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @anchor{afir}
  735. @section afir
  736. Apply an arbitrary Frequency Impulse Response filter.
  737. This filter is designed for applying long FIR filters,
  738. up to 30 seconds long.
  739. It can be used as component for digital crossover filters,
  740. room equalization, cross talk cancellation, wavefield synthesis,
  741. auralization, ambiophonics and ambisonics.
  742. This filter uses second stream as FIR coefficients.
  743. If second stream holds single channel, it will be used
  744. for all input channels in first stream, otherwise
  745. number of channels in second stream must be same as
  746. number of channels in first stream.
  747. It accepts the following parameters:
  748. @table @option
  749. @item dry
  750. Set dry gain. This sets input gain.
  751. @item wet
  752. Set wet gain. This sets final output gain.
  753. @item length
  754. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  755. @item again
  756. Enable applying gain measured from power of IR.
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  762. @example
  763. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  764. @end example
  765. @end itemize
  766. @anchor{aformat}
  767. @section aformat
  768. Set output format constraints for the input audio. The framework will
  769. negotiate the most appropriate format to minimize conversions.
  770. It accepts the following parameters:
  771. @table @option
  772. @item sample_fmts
  773. A '|'-separated list of requested sample formats.
  774. @item sample_rates
  775. A '|'-separated list of requested sample rates.
  776. @item channel_layouts
  777. A '|'-separated list of requested channel layouts.
  778. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  779. for the required syntax.
  780. @end table
  781. If a parameter is omitted, all values are allowed.
  782. Force the output to either unsigned 8-bit or signed 16-bit stereo
  783. @example
  784. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  785. @end example
  786. @section agate
  787. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  788. processing reduces disturbing noise between useful signals.
  789. Gating is done by detecting the volume below a chosen level @var{threshold}
  790. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  791. floor is set via @var{range}. Because an exact manipulation of the signal
  792. would cause distortion of the waveform the reduction can be levelled over
  793. time. This is done by setting @var{attack} and @var{release}.
  794. @var{attack} determines how long the signal has to fall below the threshold
  795. before any reduction will occur and @var{release} sets the time the signal
  796. has to rise above the threshold to reduce the reduction again.
  797. Shorter signals than the chosen attack time will be left untouched.
  798. @table @option
  799. @item level_in
  800. Set input level before filtering.
  801. Default is 1. Allowed range is from 0.015625 to 64.
  802. @item range
  803. Set the level of gain reduction when the signal is below the threshold.
  804. Default is 0.06125. Allowed range is from 0 to 1.
  805. @item threshold
  806. If a signal rises above this level the gain reduction is released.
  807. Default is 0.125. Allowed range is from 0 to 1.
  808. @item ratio
  809. Set a ratio by which the signal is reduced.
  810. Default is 2. Allowed range is from 1 to 9000.
  811. @item attack
  812. Amount of milliseconds the signal has to rise above the threshold before gain
  813. reduction stops.
  814. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  815. @item release
  816. Amount of milliseconds the signal has to fall below the threshold before the
  817. reduction is increased again. Default is 250 milliseconds.
  818. Allowed range is from 0.01 to 9000.
  819. @item makeup
  820. Set amount of amplification of signal after processing.
  821. Default is 1. Allowed range is from 1 to 64.
  822. @item knee
  823. Curve the sharp knee around the threshold to enter gain reduction more softly.
  824. Default is 2.828427125. Allowed range is from 1 to 8.
  825. @item detection
  826. Choose if exact signal should be taken for detection or an RMS like one.
  827. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  828. @item link
  829. Choose if the average level between all channels or the louder channel affects
  830. the reduction.
  831. Default is @code{average}. Can be @code{average} or @code{maximum}.
  832. @end table
  833. @section aiir
  834. Apply an arbitrary Infinite Impulse Response filter.
  835. It accepts the following parameters:
  836. @table @option
  837. @item z
  838. Set numerator/zeros coefficients.
  839. @item p
  840. Set denominator/poles coefficients.
  841. @item k
  842. Set channels gains.
  843. @item dry_gain
  844. Set input gain.
  845. @item wet_gain
  846. Set output gain.
  847. @item f
  848. Set coefficients format.
  849. @table @samp
  850. @item tf
  851. transfer function
  852. @item zp
  853. Z-plane zeros/poles, cartesian (default)
  854. @item pr
  855. Z-plane zeros/poles, polar radians
  856. @item pd
  857. Z-plane zeros/poles, polar degrees
  858. @end table
  859. @item r
  860. Set kind of processing.
  861. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  862. @item e
  863. Set filtering precision.
  864. @table @samp
  865. @item dbl
  866. double-precision floating-point (default)
  867. @item flt
  868. single-precision floating-point
  869. @item i32
  870. 32-bit integers
  871. @item i16
  872. 16-bit integers
  873. @end table
  874. @end table
  875. Coefficients in @code{tf} format are separated by spaces and are in ascending
  876. order.
  877. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  878. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  879. imaginary unit.
  880. Different coefficients and gains can be provided for every channel, in such case
  881. use '|' to separate coefficients or gains. Last provided coefficients will be
  882. used for all remaining channels.
  883. @subsection Examples
  884. @itemize
  885. @item
  886. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  887. @example
  888. 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
  889. @end example
  890. @item
  891. Same as above but in @code{zp} format:
  892. @example
  893. 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
  894. @end example
  895. @end itemize
  896. @section alimiter
  897. The limiter prevents an input signal from rising over a desired threshold.
  898. This limiter uses lookahead technology to prevent your signal from distorting.
  899. It means that there is a small delay after the signal is processed. Keep in mind
  900. that the delay it produces is the attack time you set.
  901. The filter accepts the following options:
  902. @table @option
  903. @item level_in
  904. Set input gain. Default is 1.
  905. @item level_out
  906. Set output gain. Default is 1.
  907. @item limit
  908. Don't let signals above this level pass the limiter. Default is 1.
  909. @item attack
  910. The limiter will reach its attenuation level in this amount of time in
  911. milliseconds. Default is 5 milliseconds.
  912. @item release
  913. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  914. Default is 50 milliseconds.
  915. @item asc
  916. When gain reduction is always needed ASC takes care of releasing to an
  917. average reduction level rather than reaching a reduction of 0 in the release
  918. time.
  919. @item asc_level
  920. Select how much the release time is affected by ASC, 0 means nearly no changes
  921. in release time while 1 produces higher release times.
  922. @item level
  923. Auto level output signal. Default is enabled.
  924. This normalizes audio back to 0dB if enabled.
  925. @end table
  926. Depending on picked setting it is recommended to upsample input 2x or 4x times
  927. with @ref{aresample} before applying this filter.
  928. @section allpass
  929. Apply a two-pole all-pass filter with central frequency (in Hz)
  930. @var{frequency}, and filter-width @var{width}.
  931. An all-pass filter changes the audio's frequency to phase relationship
  932. without changing its frequency to amplitude relationship.
  933. The filter accepts the following options:
  934. @table @option
  935. @item frequency, f
  936. Set frequency in Hz.
  937. @item width_type, t
  938. Set method to specify band-width of filter.
  939. @table @option
  940. @item h
  941. Hz
  942. @item q
  943. Q-Factor
  944. @item o
  945. octave
  946. @item s
  947. slope
  948. @item k
  949. kHz
  950. @end table
  951. @item width, w
  952. Specify the band-width of a filter in width_type units.
  953. @item channels, c
  954. Specify which channels to filter, by default all available are filtered.
  955. @end table
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item frequency, f
  960. Change allpass frequency.
  961. Syntax for the command is : "@var{frequency}"
  962. @item width_type, t
  963. Change allpass width_type.
  964. Syntax for the command is : "@var{width_type}"
  965. @item width, w
  966. Change allpass width.
  967. Syntax for the command is : "@var{width}"
  968. @end table
  969. @section aloop
  970. Loop audio samples.
  971. The filter accepts the following options:
  972. @table @option
  973. @item loop
  974. Set the number of loops. Setting this value to -1 will result in infinite loops.
  975. Default is 0.
  976. @item size
  977. Set maximal number of samples. Default is 0.
  978. @item start
  979. Set first sample of loop. Default is 0.
  980. @end table
  981. @anchor{amerge}
  982. @section amerge
  983. Merge two or more audio streams into a single multi-channel stream.
  984. The filter accepts the following options:
  985. @table @option
  986. @item inputs
  987. Set the number of inputs. Default is 2.
  988. @end table
  989. If the channel layouts of the inputs are disjoint, and therefore compatible,
  990. the channel layout of the output will be set accordingly and the channels
  991. will be reordered as necessary. If the channel layouts of the inputs are not
  992. disjoint, the output will have all the channels of the first input then all
  993. the channels of the second input, in that order, and the channel layout of
  994. the output will be the default value corresponding to the total number of
  995. channels.
  996. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  997. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  998. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  999. first input, b1 is the first channel of the second input).
  1000. On the other hand, if both input are in stereo, the output channels will be
  1001. in the default order: a1, a2, b1, b2, and the channel layout will be
  1002. arbitrarily set to 4.0, which may or may not be the expected value.
  1003. All inputs must have the same sample rate, and format.
  1004. If inputs do not have the same duration, the output will stop with the
  1005. shortest.
  1006. @subsection Examples
  1007. @itemize
  1008. @item
  1009. Merge two mono files into a stereo stream:
  1010. @example
  1011. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1012. @end example
  1013. @item
  1014. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1015. @example
  1016. 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
  1017. @end example
  1018. @end itemize
  1019. @section amix
  1020. Mixes multiple audio inputs into a single output.
  1021. Note that this filter only supports float samples (the @var{amerge}
  1022. and @var{pan} audio filters support many formats). If the @var{amix}
  1023. input has integer samples then @ref{aresample} will be automatically
  1024. inserted to perform the conversion to float samples.
  1025. For example
  1026. @example
  1027. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1028. @end example
  1029. will mix 3 input audio streams to a single output with the same duration as the
  1030. first input and a dropout transition time of 3 seconds.
  1031. It accepts the following parameters:
  1032. @table @option
  1033. @item inputs
  1034. The number of inputs. If unspecified, it defaults to 2.
  1035. @item duration
  1036. How to determine the end-of-stream.
  1037. @table @option
  1038. @item longest
  1039. The duration of the longest input. (default)
  1040. @item shortest
  1041. The duration of the shortest input.
  1042. @item first
  1043. The duration of the first input.
  1044. @end table
  1045. @item dropout_transition
  1046. The transition time, in seconds, for volume renormalization when an input
  1047. stream ends. The default value is 2 seconds.
  1048. @end table
  1049. @section anequalizer
  1050. High-order parametric multiband equalizer for each channel.
  1051. It accepts the following parameters:
  1052. @table @option
  1053. @item params
  1054. This option string is in format:
  1055. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1056. Each equalizer band is separated by '|'.
  1057. @table @option
  1058. @item chn
  1059. Set channel number to which equalization will be applied.
  1060. If input doesn't have that channel the entry is ignored.
  1061. @item f
  1062. Set central frequency for band.
  1063. If input doesn't have that frequency the entry is ignored.
  1064. @item w
  1065. Set band width in hertz.
  1066. @item g
  1067. Set band gain in dB.
  1068. @item t
  1069. Set filter type for band, optional, can be:
  1070. @table @samp
  1071. @item 0
  1072. Butterworth, this is default.
  1073. @item 1
  1074. Chebyshev type 1.
  1075. @item 2
  1076. Chebyshev type 2.
  1077. @end table
  1078. @end table
  1079. @item curves
  1080. With this option activated frequency response of anequalizer is displayed
  1081. in video stream.
  1082. @item size
  1083. Set video stream size. Only useful if curves option is activated.
  1084. @item mgain
  1085. Set max gain that will be displayed. Only useful if curves option is activated.
  1086. Setting this to a reasonable value makes it possible to display gain which is derived from
  1087. neighbour bands which are too close to each other and thus produce higher gain
  1088. when both are activated.
  1089. @item fscale
  1090. Set frequency scale used to draw frequency response in video output.
  1091. Can be linear or logarithmic. Default is logarithmic.
  1092. @item colors
  1093. Set color for each channel curve which is going to be displayed in video stream.
  1094. This is list of color names separated by space or by '|'.
  1095. Unrecognised or missing colors will be replaced by white color.
  1096. @end table
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1101. for first 2 channels using Chebyshev type 1 filter:
  1102. @example
  1103. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1104. @end example
  1105. @end itemize
  1106. @subsection Commands
  1107. This filter supports the following commands:
  1108. @table @option
  1109. @item change
  1110. Alter existing filter parameters.
  1111. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1112. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1113. error is returned.
  1114. @var{freq} set new frequency parameter.
  1115. @var{width} set new width parameter in herz.
  1116. @var{gain} set new gain parameter in dB.
  1117. Full filter invocation with asendcmd may look like this:
  1118. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1119. @end table
  1120. @section anull
  1121. Pass the audio source unchanged to the output.
  1122. @section apad
  1123. Pad the end of an audio stream with silence.
  1124. This can be used together with @command{ffmpeg} @option{-shortest} to
  1125. extend audio streams to the same length as the video stream.
  1126. A description of the accepted options follows.
  1127. @table @option
  1128. @item packet_size
  1129. Set silence packet size. Default value is 4096.
  1130. @item pad_len
  1131. Set the number of samples of silence to add to the end. After the
  1132. value is reached, the stream is terminated. This option is mutually
  1133. exclusive with @option{whole_len}.
  1134. @item whole_len
  1135. Set the minimum total number of samples in the output audio stream. If
  1136. the value is longer than the input audio length, silence is added to
  1137. the end, until the value is reached. This option is mutually exclusive
  1138. with @option{pad_len}.
  1139. @end table
  1140. If neither the @option{pad_len} nor the @option{whole_len} option is
  1141. set, the filter will add silence to the end of the input stream
  1142. indefinitely.
  1143. @subsection Examples
  1144. @itemize
  1145. @item
  1146. Add 1024 samples of silence to the end of the input:
  1147. @example
  1148. apad=pad_len=1024
  1149. @end example
  1150. @item
  1151. Make sure the audio output will contain at least 10000 samples, pad
  1152. the input with silence if required:
  1153. @example
  1154. apad=whole_len=10000
  1155. @end example
  1156. @item
  1157. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1158. video stream will always result the shortest and will be converted
  1159. until the end in the output file when using the @option{shortest}
  1160. option:
  1161. @example
  1162. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1163. @end example
  1164. @end itemize
  1165. @section aphaser
  1166. Add a phasing effect to the input audio.
  1167. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1168. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1169. A description of the accepted parameters follows.
  1170. @table @option
  1171. @item in_gain
  1172. Set input gain. Default is 0.4.
  1173. @item out_gain
  1174. Set output gain. Default is 0.74
  1175. @item delay
  1176. Set delay in milliseconds. Default is 3.0.
  1177. @item decay
  1178. Set decay. Default is 0.4.
  1179. @item speed
  1180. Set modulation speed in Hz. Default is 0.5.
  1181. @item type
  1182. Set modulation type. Default is triangular.
  1183. It accepts the following values:
  1184. @table @samp
  1185. @item triangular, t
  1186. @item sinusoidal, s
  1187. @end table
  1188. @end table
  1189. @section apulsator
  1190. Audio pulsator is something between an autopanner and a tremolo.
  1191. But it can produce funny stereo effects as well. Pulsator changes the volume
  1192. of the left and right channel based on a LFO (low frequency oscillator) with
  1193. different waveforms and shifted phases.
  1194. This filter have the ability to define an offset between left and right
  1195. channel. An offset of 0 means that both LFO shapes match each other.
  1196. The left and right channel are altered equally - a conventional tremolo.
  1197. An offset of 50% means that the shape of the right channel is exactly shifted
  1198. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1199. an autopanner. At 1 both curves match again. Every setting in between moves the
  1200. phase shift gapless between all stages and produces some "bypassing" sounds with
  1201. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1202. the 0.5) the faster the signal passes from the left to the right speaker.
  1203. The filter accepts the following options:
  1204. @table @option
  1205. @item level_in
  1206. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1207. @item level_out
  1208. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1209. @item mode
  1210. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1211. sawup or sawdown. Default is sine.
  1212. @item amount
  1213. Set modulation. Define how much of original signal is affected by the LFO.
  1214. @item offset_l
  1215. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1216. @item offset_r
  1217. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1218. @item width
  1219. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1220. @item timing
  1221. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1222. @item bpm
  1223. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1224. is set to bpm.
  1225. @item ms
  1226. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1227. is set to ms.
  1228. @item hz
  1229. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1230. if timing is set to hz.
  1231. @end table
  1232. @anchor{aresample}
  1233. @section aresample
  1234. Resample the input audio to the specified parameters, using the
  1235. libswresample library. If none are specified then the filter will
  1236. automatically convert between its input and output.
  1237. This filter is also able to stretch/squeeze the audio data to make it match
  1238. the timestamps or to inject silence / cut out audio to make it match the
  1239. timestamps, do a combination of both or do neither.
  1240. The filter accepts the syntax
  1241. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1242. expresses a sample rate and @var{resampler_options} is a list of
  1243. @var{key}=@var{value} pairs, separated by ":". See the
  1244. @ref{Resampler Options,,"Resampler Options" section in the
  1245. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1246. for the complete list of supported options.
  1247. @subsection Examples
  1248. @itemize
  1249. @item
  1250. Resample the input audio to 44100Hz:
  1251. @example
  1252. aresample=44100
  1253. @end example
  1254. @item
  1255. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1256. samples per second compensation:
  1257. @example
  1258. aresample=async=1000
  1259. @end example
  1260. @end itemize
  1261. @section areverse
  1262. Reverse an audio clip.
  1263. Warning: This filter requires memory to buffer the entire clip, so trimming
  1264. is suggested.
  1265. @subsection Examples
  1266. @itemize
  1267. @item
  1268. Take the first 5 seconds of a clip, and reverse it.
  1269. @example
  1270. atrim=end=5,areverse
  1271. @end example
  1272. @end itemize
  1273. @section asetnsamples
  1274. Set the number of samples per each output audio frame.
  1275. The last output packet may contain a different number of samples, as
  1276. the filter will flush all the remaining samples when the input audio
  1277. signals its end.
  1278. The filter accepts the following options:
  1279. @table @option
  1280. @item nb_out_samples, n
  1281. Set the number of frames per each output audio frame. The number is
  1282. intended as the number of samples @emph{per each channel}.
  1283. Default value is 1024.
  1284. @item pad, p
  1285. If set to 1, the filter will pad the last audio frame with zeroes, so
  1286. that the last frame will contain the same number of samples as the
  1287. previous ones. Default value is 1.
  1288. @end table
  1289. For example, to set the number of per-frame samples to 1234 and
  1290. disable padding for the last frame, use:
  1291. @example
  1292. asetnsamples=n=1234:p=0
  1293. @end example
  1294. @section asetrate
  1295. Set the sample rate without altering the PCM data.
  1296. This will result in a change of speed and pitch.
  1297. The filter accepts the following options:
  1298. @table @option
  1299. @item sample_rate, r
  1300. Set the output sample rate. Default is 44100 Hz.
  1301. @end table
  1302. @section ashowinfo
  1303. Show a line containing various information for each input audio frame.
  1304. The input audio is not modified.
  1305. The shown line contains a sequence of key/value pairs of the form
  1306. @var{key}:@var{value}.
  1307. The following values are shown in the output:
  1308. @table @option
  1309. @item n
  1310. The (sequential) number of the input frame, starting from 0.
  1311. @item pts
  1312. The presentation timestamp of the input frame, in time base units; the time base
  1313. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1314. @item pts_time
  1315. The presentation timestamp of the input frame in seconds.
  1316. @item pos
  1317. position of the frame in the input stream, -1 if this information in
  1318. unavailable and/or meaningless (for example in case of synthetic audio)
  1319. @item fmt
  1320. The sample format.
  1321. @item chlayout
  1322. The channel layout.
  1323. @item rate
  1324. The sample rate for the audio frame.
  1325. @item nb_samples
  1326. The number of samples (per channel) in the frame.
  1327. @item checksum
  1328. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1329. audio, the data is treated as if all the planes were concatenated.
  1330. @item plane_checksums
  1331. A list of Adler-32 checksums for each data plane.
  1332. @end table
  1333. @anchor{astats}
  1334. @section astats
  1335. Display time domain statistical information about the audio channels.
  1336. Statistics are calculated and displayed for each audio channel and,
  1337. where applicable, an overall figure is also given.
  1338. It accepts the following option:
  1339. @table @option
  1340. @item length
  1341. Short window length in seconds, used for peak and trough RMS measurement.
  1342. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1343. @item metadata
  1344. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1345. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1346. disabled.
  1347. Available keys for each channel are:
  1348. DC_offset
  1349. Min_level
  1350. Max_level
  1351. Min_difference
  1352. Max_difference
  1353. Mean_difference
  1354. RMS_difference
  1355. Peak_level
  1356. RMS_peak
  1357. RMS_trough
  1358. Crest_factor
  1359. Flat_factor
  1360. Peak_count
  1361. Bit_depth
  1362. Dynamic_range
  1363. and for Overall:
  1364. DC_offset
  1365. Min_level
  1366. Max_level
  1367. Min_difference
  1368. Max_difference
  1369. Mean_difference
  1370. RMS_difference
  1371. Peak_level
  1372. RMS_level
  1373. RMS_peak
  1374. RMS_trough
  1375. Flat_factor
  1376. Peak_count
  1377. Bit_depth
  1378. Number_of_samples
  1379. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1380. this @code{lavfi.astats.Overall.Peak_count}.
  1381. For description what each key means read below.
  1382. @item reset
  1383. Set number of frame after which stats are going to be recalculated.
  1384. Default is disabled.
  1385. @end table
  1386. A description of each shown parameter follows:
  1387. @table @option
  1388. @item DC offset
  1389. Mean amplitude displacement from zero.
  1390. @item Min level
  1391. Minimal sample level.
  1392. @item Max level
  1393. Maximal sample level.
  1394. @item Min difference
  1395. Minimal difference between two consecutive samples.
  1396. @item Max difference
  1397. Maximal difference between two consecutive samples.
  1398. @item Mean difference
  1399. Mean difference between two consecutive samples.
  1400. The average of each difference between two consecutive samples.
  1401. @item RMS difference
  1402. Root Mean Square difference between two consecutive samples.
  1403. @item Peak level dB
  1404. @item RMS level dB
  1405. Standard peak and RMS level measured in dBFS.
  1406. @item RMS peak dB
  1407. @item RMS trough dB
  1408. Peak and trough values for RMS level measured over a short window.
  1409. @item Crest factor
  1410. Standard ratio of peak to RMS level (note: not in dB).
  1411. @item Flat factor
  1412. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1413. (i.e. either @var{Min level} or @var{Max level}).
  1414. @item Peak count
  1415. Number of occasions (not the number of samples) that the signal attained either
  1416. @var{Min level} or @var{Max level}.
  1417. @item Bit depth
  1418. Overall bit depth of audio. Number of bits used for each sample.
  1419. @item Dynamic range
  1420. Measured dynamic range of audio in dB.
  1421. @end table
  1422. @section atempo
  1423. Adjust audio tempo.
  1424. The filter accepts exactly one parameter, the audio tempo. If not
  1425. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1426. be in the [0.5, 2.0] range.
  1427. @subsection Examples
  1428. @itemize
  1429. @item
  1430. Slow down audio to 80% tempo:
  1431. @example
  1432. atempo=0.8
  1433. @end example
  1434. @item
  1435. To speed up audio to 125% tempo:
  1436. @example
  1437. atempo=1.25
  1438. @end example
  1439. @end itemize
  1440. @section atrim
  1441. Trim the input so that the output contains one continuous subpart of the input.
  1442. It accepts the following parameters:
  1443. @table @option
  1444. @item start
  1445. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1446. sample with the timestamp @var{start} will be the first sample in the output.
  1447. @item end
  1448. Specify time of the first audio sample that will be dropped, i.e. the
  1449. audio sample immediately preceding the one with the timestamp @var{end} will be
  1450. the last sample in the output.
  1451. @item start_pts
  1452. Same as @var{start}, except this option sets the start timestamp in samples
  1453. instead of seconds.
  1454. @item end_pts
  1455. Same as @var{end}, except this option sets the end timestamp in samples instead
  1456. of seconds.
  1457. @item duration
  1458. The maximum duration of the output in seconds.
  1459. @item start_sample
  1460. The number of the first sample that should be output.
  1461. @item end_sample
  1462. The number of the first sample that should be dropped.
  1463. @end table
  1464. @option{start}, @option{end}, and @option{duration} are expressed as time
  1465. duration specifications; see
  1466. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1467. Note that the first two sets of the start/end options and the @option{duration}
  1468. option look at the frame timestamp, while the _sample options simply count the
  1469. samples that pass through the filter. So start/end_pts and start/end_sample will
  1470. give different results when the timestamps are wrong, inexact or do not start at
  1471. zero. Also note that this filter does not modify the timestamps. If you wish
  1472. to have the output timestamps start at zero, insert the asetpts filter after the
  1473. atrim filter.
  1474. If multiple start or end options are set, this filter tries to be greedy and
  1475. keep all samples that match at least one of the specified constraints. To keep
  1476. only the part that matches all the constraints at once, chain multiple atrim
  1477. filters.
  1478. The defaults are such that all the input is kept. So it is possible to set e.g.
  1479. just the end values to keep everything before the specified time.
  1480. Examples:
  1481. @itemize
  1482. @item
  1483. Drop everything except the second minute of input:
  1484. @example
  1485. ffmpeg -i INPUT -af atrim=60:120
  1486. @end example
  1487. @item
  1488. Keep only the first 1000 samples:
  1489. @example
  1490. ffmpeg -i INPUT -af atrim=end_sample=1000
  1491. @end example
  1492. @end itemize
  1493. @section bandpass
  1494. Apply a two-pole Butterworth band-pass filter with central
  1495. frequency @var{frequency}, and (3dB-point) band-width width.
  1496. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1497. instead of the default: constant 0dB peak gain.
  1498. The filter roll off at 6dB per octave (20dB per decade).
  1499. The filter accepts the following options:
  1500. @table @option
  1501. @item frequency, f
  1502. Set the filter's central frequency. Default is @code{3000}.
  1503. @item csg
  1504. Constant skirt gain if set to 1. Defaults to 0.
  1505. @item width_type, t
  1506. Set method to specify band-width of filter.
  1507. @table @option
  1508. @item h
  1509. Hz
  1510. @item q
  1511. Q-Factor
  1512. @item o
  1513. octave
  1514. @item s
  1515. slope
  1516. @item k
  1517. kHz
  1518. @end table
  1519. @item width, w
  1520. Specify the band-width of a filter in width_type units.
  1521. @item channels, c
  1522. Specify which channels to filter, by default all available are filtered.
  1523. @end table
  1524. @subsection Commands
  1525. This filter supports the following commands:
  1526. @table @option
  1527. @item frequency, f
  1528. Change bandpass frequency.
  1529. Syntax for the command is : "@var{frequency}"
  1530. @item width_type, t
  1531. Change bandpass width_type.
  1532. Syntax for the command is : "@var{width_type}"
  1533. @item width, w
  1534. Change bandpass width.
  1535. Syntax for the command is : "@var{width}"
  1536. @end table
  1537. @section bandreject
  1538. Apply a two-pole Butterworth band-reject filter with central
  1539. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1540. The filter roll off at 6dB per octave (20dB per decade).
  1541. The filter accepts the following options:
  1542. @table @option
  1543. @item frequency, f
  1544. Set the filter's central frequency. Default is @code{3000}.
  1545. @item width_type, t
  1546. Set method to specify band-width of filter.
  1547. @table @option
  1548. @item h
  1549. Hz
  1550. @item q
  1551. Q-Factor
  1552. @item o
  1553. octave
  1554. @item s
  1555. slope
  1556. @item k
  1557. kHz
  1558. @end table
  1559. @item width, w
  1560. Specify the band-width of a filter in width_type units.
  1561. @item channels, c
  1562. Specify which channels to filter, by default all available are filtered.
  1563. @end table
  1564. @subsection Commands
  1565. This filter supports the following commands:
  1566. @table @option
  1567. @item frequency, f
  1568. Change bandreject frequency.
  1569. Syntax for the command is : "@var{frequency}"
  1570. @item width_type, t
  1571. Change bandreject width_type.
  1572. Syntax for the command is : "@var{width_type}"
  1573. @item width, w
  1574. Change bandreject width.
  1575. Syntax for the command is : "@var{width}"
  1576. @end table
  1577. @section bass
  1578. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1579. shelving filter with a response similar to that of a standard
  1580. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1581. The filter accepts the following options:
  1582. @table @option
  1583. @item gain, g
  1584. Give the gain at 0 Hz. Its useful range is about -20
  1585. (for a large cut) to +20 (for a large boost).
  1586. Beware of clipping when using a positive gain.
  1587. @item frequency, f
  1588. Set the filter's central frequency and so can be used
  1589. to extend or reduce the frequency range to be boosted or cut.
  1590. The default value is @code{100} Hz.
  1591. @item width_type, t
  1592. Set method to specify band-width of filter.
  1593. @table @option
  1594. @item h
  1595. Hz
  1596. @item q
  1597. Q-Factor
  1598. @item o
  1599. octave
  1600. @item s
  1601. slope
  1602. @item k
  1603. kHz
  1604. @end table
  1605. @item width, w
  1606. Determine how steep is the filter's shelf transition.
  1607. @item channels, c
  1608. Specify which channels to filter, by default all available are filtered.
  1609. @end table
  1610. @subsection Commands
  1611. This filter supports the following commands:
  1612. @table @option
  1613. @item frequency, f
  1614. Change bass frequency.
  1615. Syntax for the command is : "@var{frequency}"
  1616. @item width_type, t
  1617. Change bass width_type.
  1618. Syntax for the command is : "@var{width_type}"
  1619. @item width, w
  1620. Change bass width.
  1621. Syntax for the command is : "@var{width}"
  1622. @item gain, g
  1623. Change bass gain.
  1624. Syntax for the command is : "@var{gain}"
  1625. @end table
  1626. @section biquad
  1627. Apply a biquad IIR filter with the given coefficients.
  1628. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1629. are the numerator and denominator coefficients respectively.
  1630. and @var{channels}, @var{c} specify which channels to filter, by default all
  1631. available are filtered.
  1632. @subsection Commands
  1633. This filter supports the following commands:
  1634. @table @option
  1635. @item a0
  1636. @item a1
  1637. @item a2
  1638. @item b0
  1639. @item b1
  1640. @item b2
  1641. Change biquad parameter.
  1642. Syntax for the command is : "@var{value}"
  1643. @end table
  1644. @section bs2b
  1645. Bauer stereo to binaural transformation, which improves headphone listening of
  1646. stereo audio records.
  1647. To enable compilation of this filter you need to configure FFmpeg with
  1648. @code{--enable-libbs2b}.
  1649. It accepts the following parameters:
  1650. @table @option
  1651. @item profile
  1652. Pre-defined crossfeed level.
  1653. @table @option
  1654. @item default
  1655. Default level (fcut=700, feed=50).
  1656. @item cmoy
  1657. Chu Moy circuit (fcut=700, feed=60).
  1658. @item jmeier
  1659. Jan Meier circuit (fcut=650, feed=95).
  1660. @end table
  1661. @item fcut
  1662. Cut frequency (in Hz).
  1663. @item feed
  1664. Feed level (in Hz).
  1665. @end table
  1666. @section channelmap
  1667. Remap input channels to new locations.
  1668. It accepts the following parameters:
  1669. @table @option
  1670. @item map
  1671. Map channels from input to output. The argument is a '|'-separated list of
  1672. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1673. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1674. channel (e.g. FL for front left) or its index in the input channel layout.
  1675. @var{out_channel} is the name of the output channel or its index in the output
  1676. channel layout. If @var{out_channel} is not given then it is implicitly an
  1677. index, starting with zero and increasing by one for each mapping.
  1678. @item channel_layout
  1679. The channel layout of the output stream.
  1680. @end table
  1681. If no mapping is present, the filter will implicitly map input channels to
  1682. output channels, preserving indices.
  1683. For example, assuming a 5.1+downmix input MOV file,
  1684. @example
  1685. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1686. @end example
  1687. will create an output WAV file tagged as stereo from the downmix channels of
  1688. the input.
  1689. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1690. @example
  1691. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1692. @end example
  1693. @section channelsplit
  1694. Split each channel from an input audio stream into a separate output stream.
  1695. It accepts the following parameters:
  1696. @table @option
  1697. @item channel_layout
  1698. The channel layout of the input stream. The default is "stereo".
  1699. @end table
  1700. For example, assuming a stereo input MP3 file,
  1701. @example
  1702. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1703. @end example
  1704. will create an output Matroska file with two audio streams, one containing only
  1705. the left channel and the other the right channel.
  1706. Split a 5.1 WAV file into per-channel files:
  1707. @example
  1708. ffmpeg -i in.wav -filter_complex
  1709. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1710. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1711. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1712. side_right.wav
  1713. @end example
  1714. @section chorus
  1715. Add a chorus effect to the audio.
  1716. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1717. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1718. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1719. The modulation depth defines the range the modulated delay is played before or after
  1720. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1721. sound tuned around the original one, like in a chorus where some vocals are slightly
  1722. off key.
  1723. It accepts the following parameters:
  1724. @table @option
  1725. @item in_gain
  1726. Set input gain. Default is 0.4.
  1727. @item out_gain
  1728. Set output gain. Default is 0.4.
  1729. @item delays
  1730. Set delays. A typical delay is around 40ms to 60ms.
  1731. @item decays
  1732. Set decays.
  1733. @item speeds
  1734. Set speeds.
  1735. @item depths
  1736. Set depths.
  1737. @end table
  1738. @subsection Examples
  1739. @itemize
  1740. @item
  1741. A single delay:
  1742. @example
  1743. chorus=0.7:0.9:55:0.4:0.25:2
  1744. @end example
  1745. @item
  1746. Two delays:
  1747. @example
  1748. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1749. @end example
  1750. @item
  1751. Fuller sounding chorus with three delays:
  1752. @example
  1753. 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
  1754. @end example
  1755. @end itemize
  1756. @section compand
  1757. Compress or expand the audio's dynamic range.
  1758. It accepts the following parameters:
  1759. @table @option
  1760. @item attacks
  1761. @item decays
  1762. A list of times in seconds for each channel over which the instantaneous level
  1763. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1764. increase of volume and @var{decays} refers to decrease of volume. For most
  1765. situations, the attack time (response to the audio getting louder) should be
  1766. shorter than the decay time, because the human ear is more sensitive to sudden
  1767. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1768. a typical value for decay is 0.8 seconds.
  1769. If specified number of attacks & decays is lower than number of channels, the last
  1770. set attack/decay will be used for all remaining channels.
  1771. @item points
  1772. A list of points for the transfer function, specified in dB relative to the
  1773. maximum possible signal amplitude. Each key points list must be defined using
  1774. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1775. @code{x0/y0 x1/y1 x2/y2 ....}
  1776. The input values must be in strictly increasing order but the transfer function
  1777. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1778. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1779. function are @code{-70/-70|-60/-20|1/0}.
  1780. @item soft-knee
  1781. Set the curve radius in dB for all joints. It defaults to 0.01.
  1782. @item gain
  1783. Set the additional gain in dB to be applied at all points on the transfer
  1784. function. This allows for easy adjustment of the overall gain.
  1785. It defaults to 0.
  1786. @item volume
  1787. Set an initial volume, in dB, to be assumed for each channel when filtering
  1788. starts. This permits the user to supply a nominal level initially, so that, for
  1789. example, a very large gain is not applied to initial signal levels before the
  1790. companding has begun to operate. A typical value for audio which is initially
  1791. quiet is -90 dB. It defaults to 0.
  1792. @item delay
  1793. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1794. delayed before being fed to the volume adjuster. Specifying a delay
  1795. approximately equal to the attack/decay times allows the filter to effectively
  1796. operate in predictive rather than reactive mode. It defaults to 0.
  1797. @end table
  1798. @subsection Examples
  1799. @itemize
  1800. @item
  1801. Make music with both quiet and loud passages suitable for listening to in a
  1802. noisy environment:
  1803. @example
  1804. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1805. @end example
  1806. Another example for audio with whisper and explosion parts:
  1807. @example
  1808. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1809. @end example
  1810. @item
  1811. A noise gate for when the noise is at a lower level than the signal:
  1812. @example
  1813. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1814. @end example
  1815. @item
  1816. Here is another noise gate, this time for when the noise is at a higher level
  1817. than the signal (making it, in some ways, similar to squelch):
  1818. @example
  1819. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1820. @end example
  1821. @item
  1822. 2:1 compression starting at -6dB:
  1823. @example
  1824. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1825. @end example
  1826. @item
  1827. 2:1 compression starting at -9dB:
  1828. @example
  1829. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1830. @end example
  1831. @item
  1832. 2:1 compression starting at -12dB:
  1833. @example
  1834. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1835. @end example
  1836. @item
  1837. 2:1 compression starting at -18dB:
  1838. @example
  1839. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1840. @end example
  1841. @item
  1842. 3:1 compression starting at -15dB:
  1843. @example
  1844. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1845. @end example
  1846. @item
  1847. Compressor/Gate:
  1848. @example
  1849. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1850. @end example
  1851. @item
  1852. Expander:
  1853. @example
  1854. 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
  1855. @end example
  1856. @item
  1857. Hard limiter at -6dB:
  1858. @example
  1859. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1860. @end example
  1861. @item
  1862. Hard limiter at -12dB:
  1863. @example
  1864. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1865. @end example
  1866. @item
  1867. Hard noise gate at -35 dB:
  1868. @example
  1869. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1870. @end example
  1871. @item
  1872. Soft limiter:
  1873. @example
  1874. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1875. @end example
  1876. @end itemize
  1877. @section compensationdelay
  1878. Compensation Delay Line is a metric based delay to compensate differing
  1879. positions of microphones or speakers.
  1880. For example, you have recorded guitar with two microphones placed in
  1881. different location. Because the front of sound wave has fixed speed in
  1882. normal conditions, the phasing of microphones can vary and depends on
  1883. their location and interposition. The best sound mix can be achieved when
  1884. these microphones are in phase (synchronized). Note that distance of
  1885. ~30 cm between microphones makes one microphone to capture signal in
  1886. antiphase to another microphone. That makes the final mix sounding moody.
  1887. This filter helps to solve phasing problems by adding different delays
  1888. to each microphone track and make them synchronized.
  1889. The best result can be reached when you take one track as base and
  1890. synchronize other tracks one by one with it.
  1891. Remember that synchronization/delay tolerance depends on sample rate, too.
  1892. Higher sample rates will give more tolerance.
  1893. It accepts the following parameters:
  1894. @table @option
  1895. @item mm
  1896. Set millimeters distance. This is compensation distance for fine tuning.
  1897. Default is 0.
  1898. @item cm
  1899. Set cm distance. This is compensation distance for tightening distance setup.
  1900. Default is 0.
  1901. @item m
  1902. Set meters distance. This is compensation distance for hard distance setup.
  1903. Default is 0.
  1904. @item dry
  1905. Set dry amount. Amount of unprocessed (dry) signal.
  1906. Default is 0.
  1907. @item wet
  1908. Set wet amount. Amount of processed (wet) signal.
  1909. Default is 1.
  1910. @item temp
  1911. Set temperature degree in Celsius. This is the temperature of the environment.
  1912. Default is 20.
  1913. @end table
  1914. @section crossfeed
  1915. Apply headphone crossfeed filter.
  1916. Crossfeed is the process of blending the left and right channels of stereo
  1917. audio recording.
  1918. It is mainly used to reduce extreme stereo separation of low frequencies.
  1919. The intent is to produce more speaker like sound to the listener.
  1920. The filter accepts the following options:
  1921. @table @option
  1922. @item strength
  1923. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1924. This sets gain of low shelf filter for side part of stereo image.
  1925. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1926. @item range
  1927. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1928. This sets cut off frequency of low shelf filter. Default is cut off near
  1929. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1930. @item level_in
  1931. Set input gain. Default is 0.9.
  1932. @item level_out
  1933. Set output gain. Default is 1.
  1934. @end table
  1935. @section crystalizer
  1936. Simple algorithm to expand audio dynamic range.
  1937. The filter accepts the following options:
  1938. @table @option
  1939. @item i
  1940. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1941. (unchanged sound) to 10.0 (maximum effect).
  1942. @item c
  1943. Enable clipping. By default is enabled.
  1944. @end table
  1945. @section dcshift
  1946. Apply a DC shift to the audio.
  1947. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1948. in the recording chain) from the audio. The effect of a DC offset is reduced
  1949. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1950. a signal has a DC offset.
  1951. @table @option
  1952. @item shift
  1953. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1954. the audio.
  1955. @item limitergain
  1956. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1957. used to prevent clipping.
  1958. @end table
  1959. @section drmeter
  1960. Measure audio dynamic range.
  1961. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1962. is found in transition material. And anything less that 8 have very poor dynamics
  1963. and is very compressed.
  1964. The filter accepts the following options:
  1965. @table @option
  1966. @item length
  1967. Set window length in seconds used to split audio into segments of equal length.
  1968. Default is 3 seconds.
  1969. @end table
  1970. @section dynaudnorm
  1971. Dynamic Audio Normalizer.
  1972. This filter applies a certain amount of gain to the input audio in order
  1973. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1974. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1975. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1976. This allows for applying extra gain to the "quiet" sections of the audio
  1977. while avoiding distortions or clipping the "loud" sections. In other words:
  1978. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1979. sections, in the sense that the volume of each section is brought to the
  1980. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1981. this goal *without* applying "dynamic range compressing". It will retain 100%
  1982. of the dynamic range *within* each section of the audio file.
  1983. @table @option
  1984. @item f
  1985. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1986. Default is 500 milliseconds.
  1987. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1988. referred to as frames. This is required, because a peak magnitude has no
  1989. meaning for just a single sample value. Instead, we need to determine the
  1990. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1991. normalizer would simply use the peak magnitude of the complete file, the
  1992. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1993. frame. The length of a frame is specified in milliseconds. By default, the
  1994. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1995. been found to give good results with most files.
  1996. Note that the exact frame length, in number of samples, will be determined
  1997. automatically, based on the sampling rate of the individual input audio file.
  1998. @item g
  1999. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2000. number. Default is 31.
  2001. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2002. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2003. is specified in frames, centered around the current frame. For the sake of
  2004. simplicity, this must be an odd number. Consequently, the default value of 31
  2005. takes into account the current frame, as well as the 15 preceding frames and
  2006. the 15 subsequent frames. Using a larger window results in a stronger
  2007. smoothing effect and thus in less gain variation, i.e. slower gain
  2008. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2009. effect and thus in more gain variation, i.e. faster gain adaptation.
  2010. In other words, the more you increase this value, the more the Dynamic Audio
  2011. Normalizer will behave like a "traditional" normalization filter. On the
  2012. contrary, the more you decrease this value, the more the Dynamic Audio
  2013. Normalizer will behave like a dynamic range compressor.
  2014. @item p
  2015. Set the target peak value. This specifies the highest permissible magnitude
  2016. level for the normalized audio input. This filter will try to approach the
  2017. target peak magnitude as closely as possible, but at the same time it also
  2018. makes sure that the normalized signal will never exceed the peak magnitude.
  2019. A frame's maximum local gain factor is imposed directly by the target peak
  2020. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2021. It is not recommended to go above this value.
  2022. @item m
  2023. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2024. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2025. factor for each input frame, i.e. the maximum gain factor that does not
  2026. result in clipping or distortion. The maximum gain factor is determined by
  2027. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2028. additionally bounds the frame's maximum gain factor by a predetermined
  2029. (global) maximum gain factor. This is done in order to avoid excessive gain
  2030. factors in "silent" or almost silent frames. By default, the maximum gain
  2031. factor is 10.0, For most inputs the default value should be sufficient and
  2032. it usually is not recommended to increase this value. Though, for input
  2033. with an extremely low overall volume level, it may be necessary to allow even
  2034. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2035. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2036. Instead, a "sigmoid" threshold function will be applied. This way, the
  2037. gain factors will smoothly approach the threshold value, but never exceed that
  2038. value.
  2039. @item r
  2040. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2041. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2042. This means that the maximum local gain factor for each frame is defined
  2043. (only) by the frame's highest magnitude sample. This way, the samples can
  2044. be amplified as much as possible without exceeding the maximum signal
  2045. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2046. Normalizer can also take into account the frame's root mean square,
  2047. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2048. determine the power of a time-varying signal. It is therefore considered
  2049. that the RMS is a better approximation of the "perceived loudness" than
  2050. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2051. frames to a constant RMS value, a uniform "perceived loudness" can be
  2052. established. If a target RMS value has been specified, a frame's local gain
  2053. factor is defined as the factor that would result in exactly that RMS value.
  2054. Note, however, that the maximum local gain factor is still restricted by the
  2055. frame's highest magnitude sample, in order to prevent clipping.
  2056. @item n
  2057. Enable channels coupling. By default is enabled.
  2058. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2059. amount. This means the same gain factor will be applied to all channels, i.e.
  2060. the maximum possible gain factor is determined by the "loudest" channel.
  2061. However, in some recordings, it may happen that the volume of the different
  2062. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2063. In this case, this option can be used to disable the channel coupling. This way,
  2064. the gain factor will be determined independently for each channel, depending
  2065. only on the individual channel's highest magnitude sample. This allows for
  2066. harmonizing the volume of the different channels.
  2067. @item c
  2068. Enable DC bias correction. By default is disabled.
  2069. An audio signal (in the time domain) is a sequence of sample values.
  2070. In the Dynamic Audio Normalizer these sample values are represented in the
  2071. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2072. audio signal, or "waveform", should be centered around the zero point.
  2073. That means if we calculate the mean value of all samples in a file, or in a
  2074. single frame, then the result should be 0.0 or at least very close to that
  2075. value. If, however, there is a significant deviation of the mean value from
  2076. 0.0, in either positive or negative direction, this is referred to as a
  2077. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2078. Audio Normalizer provides optional DC bias correction.
  2079. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2080. the mean value, or "DC correction" offset, of each input frame and subtract
  2081. that value from all of the frame's sample values which ensures those samples
  2082. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2083. boundaries, the DC correction offset values will be interpolated smoothly
  2084. between neighbouring frames.
  2085. @item b
  2086. Enable alternative boundary mode. By default is disabled.
  2087. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2088. around each frame. This includes the preceding frames as well as the
  2089. subsequent frames. However, for the "boundary" frames, located at the very
  2090. beginning and at the very end of the audio file, not all neighbouring
  2091. frames are available. In particular, for the first few frames in the audio
  2092. file, the preceding frames are not known. And, similarly, for the last few
  2093. frames in the audio file, the subsequent frames are not known. Thus, the
  2094. question arises which gain factors should be assumed for the missing frames
  2095. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2096. to deal with this situation. The default boundary mode assumes a gain factor
  2097. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2098. "fade out" at the beginning and at the end of the input, respectively.
  2099. @item s
  2100. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2101. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2102. compression. This means that signal peaks will not be pruned and thus the
  2103. full dynamic range will be retained within each local neighbourhood. However,
  2104. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2105. normalization algorithm with a more "traditional" compression.
  2106. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2107. (thresholding) function. If (and only if) the compression feature is enabled,
  2108. all input frames will be processed by a soft knee thresholding function prior
  2109. to the actual normalization process. Put simply, the thresholding function is
  2110. going to prune all samples whose magnitude exceeds a certain threshold value.
  2111. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2112. value. Instead, the threshold value will be adjusted for each individual
  2113. frame.
  2114. In general, smaller parameters result in stronger compression, and vice versa.
  2115. Values below 3.0 are not recommended, because audible distortion may appear.
  2116. @end table
  2117. @section earwax
  2118. Make audio easier to listen to on headphones.
  2119. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2120. so that when listened to on headphones the stereo image is moved from
  2121. inside your head (standard for headphones) to outside and in front of
  2122. the listener (standard for speakers).
  2123. Ported from SoX.
  2124. @section equalizer
  2125. Apply a two-pole peaking equalisation (EQ) filter. With this
  2126. filter, the signal-level at and around a selected frequency can
  2127. be increased or decreased, whilst (unlike bandpass and bandreject
  2128. filters) that at all other frequencies is unchanged.
  2129. In order to produce complex equalisation curves, this filter can
  2130. be given several times, each with a different central frequency.
  2131. The filter accepts the following options:
  2132. @table @option
  2133. @item frequency, f
  2134. Set the filter's central frequency in Hz.
  2135. @item width_type, t
  2136. Set method to specify band-width of filter.
  2137. @table @option
  2138. @item h
  2139. Hz
  2140. @item q
  2141. Q-Factor
  2142. @item o
  2143. octave
  2144. @item s
  2145. slope
  2146. @item k
  2147. kHz
  2148. @end table
  2149. @item width, w
  2150. Specify the band-width of a filter in width_type units.
  2151. @item gain, g
  2152. Set the required gain or attenuation in dB.
  2153. Beware of clipping when using a positive gain.
  2154. @item channels, c
  2155. Specify which channels to filter, by default all available are filtered.
  2156. @end table
  2157. @subsection Examples
  2158. @itemize
  2159. @item
  2160. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2161. @example
  2162. equalizer=f=1000:t=h:width=200:g=-10
  2163. @end example
  2164. @item
  2165. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2166. @example
  2167. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2168. @end example
  2169. @end itemize
  2170. @subsection Commands
  2171. This filter supports the following commands:
  2172. @table @option
  2173. @item frequency, f
  2174. Change equalizer frequency.
  2175. Syntax for the command is : "@var{frequency}"
  2176. @item width_type, t
  2177. Change equalizer width_type.
  2178. Syntax for the command is : "@var{width_type}"
  2179. @item width, w
  2180. Change equalizer width.
  2181. Syntax for the command is : "@var{width}"
  2182. @item gain, g
  2183. Change equalizer gain.
  2184. Syntax for the command is : "@var{gain}"
  2185. @end table
  2186. @section extrastereo
  2187. Linearly increases the difference between left and right channels which
  2188. adds some sort of "live" effect to playback.
  2189. The filter accepts the following options:
  2190. @table @option
  2191. @item m
  2192. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2193. (average of both channels), with 1.0 sound will be unchanged, with
  2194. -1.0 left and right channels will be swapped.
  2195. @item c
  2196. Enable clipping. By default is enabled.
  2197. @end table
  2198. @section firequalizer
  2199. Apply FIR Equalization using arbitrary frequency response.
  2200. The filter accepts the following option:
  2201. @table @option
  2202. @item gain
  2203. Set gain curve equation (in dB). The expression can contain variables:
  2204. @table @option
  2205. @item f
  2206. the evaluated frequency
  2207. @item sr
  2208. sample rate
  2209. @item ch
  2210. channel number, set to 0 when multichannels evaluation is disabled
  2211. @item chid
  2212. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2213. multichannels evaluation is disabled
  2214. @item chs
  2215. number of channels
  2216. @item chlayout
  2217. channel_layout, see libavutil/channel_layout.h
  2218. @end table
  2219. and functions:
  2220. @table @option
  2221. @item gain_interpolate(f)
  2222. interpolate gain on frequency f based on gain_entry
  2223. @item cubic_interpolate(f)
  2224. same as gain_interpolate, but smoother
  2225. @end table
  2226. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2227. @item gain_entry
  2228. Set gain entry for gain_interpolate function. The expression can
  2229. contain functions:
  2230. @table @option
  2231. @item entry(f, g)
  2232. store gain entry at frequency f with value g
  2233. @end table
  2234. This option is also available as command.
  2235. @item delay
  2236. Set filter delay in seconds. Higher value means more accurate.
  2237. Default is @code{0.01}.
  2238. @item accuracy
  2239. Set filter accuracy in Hz. Lower value means more accurate.
  2240. Default is @code{5}.
  2241. @item wfunc
  2242. Set window function. Acceptable values are:
  2243. @table @option
  2244. @item rectangular
  2245. rectangular window, useful when gain curve is already smooth
  2246. @item hann
  2247. hann window (default)
  2248. @item hamming
  2249. hamming window
  2250. @item blackman
  2251. blackman window
  2252. @item nuttall3
  2253. 3-terms continuous 1st derivative nuttall window
  2254. @item mnuttall3
  2255. minimum 3-terms discontinuous nuttall window
  2256. @item nuttall
  2257. 4-terms continuous 1st derivative nuttall window
  2258. @item bnuttall
  2259. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2260. @item bharris
  2261. blackman-harris window
  2262. @item tukey
  2263. tukey window
  2264. @end table
  2265. @item fixed
  2266. If enabled, use fixed number of audio samples. This improves speed when
  2267. filtering with large delay. Default is disabled.
  2268. @item multi
  2269. Enable multichannels evaluation on gain. Default is disabled.
  2270. @item zero_phase
  2271. Enable zero phase mode by subtracting timestamp to compensate delay.
  2272. Default is disabled.
  2273. @item scale
  2274. Set scale used by gain. Acceptable values are:
  2275. @table @option
  2276. @item linlin
  2277. linear frequency, linear gain
  2278. @item linlog
  2279. linear frequency, logarithmic (in dB) gain (default)
  2280. @item loglin
  2281. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2282. @item loglog
  2283. logarithmic frequency, logarithmic gain
  2284. @end table
  2285. @item dumpfile
  2286. Set file for dumping, suitable for gnuplot.
  2287. @item dumpscale
  2288. Set scale for dumpfile. Acceptable values are same with scale option.
  2289. Default is linlog.
  2290. @item fft2
  2291. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2292. Default is disabled.
  2293. @item min_phase
  2294. Enable minimum phase impulse response. Default is disabled.
  2295. @end table
  2296. @subsection Examples
  2297. @itemize
  2298. @item
  2299. lowpass at 1000 Hz:
  2300. @example
  2301. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2302. @end example
  2303. @item
  2304. lowpass at 1000 Hz with gain_entry:
  2305. @example
  2306. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2307. @end example
  2308. @item
  2309. custom equalization:
  2310. @example
  2311. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2312. @end example
  2313. @item
  2314. higher delay with zero phase to compensate delay:
  2315. @example
  2316. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2317. @end example
  2318. @item
  2319. lowpass on left channel, highpass on right channel:
  2320. @example
  2321. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2322. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2323. @end example
  2324. @end itemize
  2325. @section flanger
  2326. Apply a flanging effect to the audio.
  2327. The filter accepts the following options:
  2328. @table @option
  2329. @item delay
  2330. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2331. @item depth
  2332. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2333. @item regen
  2334. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2335. Default value is 0.
  2336. @item width
  2337. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2338. Default value is 71.
  2339. @item speed
  2340. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2341. @item shape
  2342. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2343. Default value is @var{sinusoidal}.
  2344. @item phase
  2345. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2346. Default value is 25.
  2347. @item interp
  2348. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2349. Default is @var{linear}.
  2350. @end table
  2351. @section haas
  2352. Apply Haas effect to audio.
  2353. Note that this makes most sense to apply on mono signals.
  2354. With this filter applied to mono signals it give some directionality and
  2355. stretches its stereo image.
  2356. The filter accepts the following options:
  2357. @table @option
  2358. @item level_in
  2359. Set input level. By default is @var{1}, or 0dB
  2360. @item level_out
  2361. Set output level. By default is @var{1}, or 0dB.
  2362. @item side_gain
  2363. Set gain applied to side part of signal. By default is @var{1}.
  2364. @item middle_source
  2365. Set kind of middle source. Can be one of the following:
  2366. @table @samp
  2367. @item left
  2368. Pick left channel.
  2369. @item right
  2370. Pick right channel.
  2371. @item mid
  2372. Pick middle part signal of stereo image.
  2373. @item side
  2374. Pick side part signal of stereo image.
  2375. @end table
  2376. @item middle_phase
  2377. Change middle phase. By default is disabled.
  2378. @item left_delay
  2379. Set left channel delay. By default is @var{2.05} milliseconds.
  2380. @item left_balance
  2381. Set left channel balance. By default is @var{-1}.
  2382. @item left_gain
  2383. Set left channel gain. By default is @var{1}.
  2384. @item left_phase
  2385. Change left phase. By default is disabled.
  2386. @item right_delay
  2387. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2388. @item right_balance
  2389. Set right channel balance. By default is @var{1}.
  2390. @item right_gain
  2391. Set right channel gain. By default is @var{1}.
  2392. @item right_phase
  2393. Change right phase. By default is enabled.
  2394. @end table
  2395. @section hdcd
  2396. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2397. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2398. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2399. of HDCD, and detects the Transient Filter flag.
  2400. @example
  2401. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2402. @end example
  2403. When using the filter with wav, note the default encoding for wav is 16-bit,
  2404. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2405. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2406. @example
  2407. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2408. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2409. @end example
  2410. The filter accepts the following options:
  2411. @table @option
  2412. @item disable_autoconvert
  2413. Disable any automatic format conversion or resampling in the filter graph.
  2414. @item process_stereo
  2415. Process the stereo channels together. If target_gain does not match between
  2416. channels, consider it invalid and use the last valid target_gain.
  2417. @item cdt_ms
  2418. Set the code detect timer period in ms.
  2419. @item force_pe
  2420. Always extend peaks above -3dBFS even if PE isn't signaled.
  2421. @item analyze_mode
  2422. Replace audio with a solid tone and adjust the amplitude to signal some
  2423. specific aspect of the decoding process. The output file can be loaded in
  2424. an audio editor alongside the original to aid analysis.
  2425. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2426. Modes are:
  2427. @table @samp
  2428. @item 0, off
  2429. Disabled
  2430. @item 1, lle
  2431. Gain adjustment level at each sample
  2432. @item 2, pe
  2433. Samples where peak extend occurs
  2434. @item 3, cdt
  2435. Samples where the code detect timer is active
  2436. @item 4, tgm
  2437. Samples where the target gain does not match between channels
  2438. @end table
  2439. @end table
  2440. @section headphone
  2441. Apply head-related transfer functions (HRTFs) to create virtual
  2442. loudspeakers around the user for binaural listening via headphones.
  2443. The HRIRs are provided via additional streams, for each channel
  2444. one stereo input stream is needed.
  2445. The filter accepts the following options:
  2446. @table @option
  2447. @item map
  2448. Set mapping of input streams for convolution.
  2449. The argument is a '|'-separated list of channel names in order as they
  2450. are given as additional stream inputs for filter.
  2451. This also specify number of input streams. Number of input streams
  2452. must be not less than number of channels in first stream plus one.
  2453. @item gain
  2454. Set gain applied to audio. Value is in dB. Default is 0.
  2455. @item type
  2456. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2457. processing audio in time domain which is slow.
  2458. @var{freq} is processing audio in frequency domain which is fast.
  2459. Default is @var{freq}.
  2460. @item lfe
  2461. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2462. @end table
  2463. @subsection Examples
  2464. @itemize
  2465. @item
  2466. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2467. each amovie filter use stereo file with IR coefficients as input.
  2468. The files give coefficients for each position of virtual loudspeaker:
  2469. @example
  2470. 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"
  2471. output.wav
  2472. @end example
  2473. @end itemize
  2474. @section highpass
  2475. Apply a high-pass filter with 3dB point frequency.
  2476. The filter can be either single-pole, or double-pole (the default).
  2477. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2478. The filter accepts the following options:
  2479. @table @option
  2480. @item frequency, f
  2481. Set frequency in Hz. Default is 3000.
  2482. @item poles, p
  2483. Set number of poles. Default is 2.
  2484. @item width_type, t
  2485. Set method to specify band-width of filter.
  2486. @table @option
  2487. @item h
  2488. Hz
  2489. @item q
  2490. Q-Factor
  2491. @item o
  2492. octave
  2493. @item s
  2494. slope
  2495. @item k
  2496. kHz
  2497. @end table
  2498. @item width, w
  2499. Specify the band-width of a filter in width_type units.
  2500. Applies only to double-pole filter.
  2501. The default is 0.707q and gives a Butterworth response.
  2502. @item channels, c
  2503. Specify which channels to filter, by default all available are filtered.
  2504. @end table
  2505. @subsection Commands
  2506. This filter supports the following commands:
  2507. @table @option
  2508. @item frequency, f
  2509. Change highpass frequency.
  2510. Syntax for the command is : "@var{frequency}"
  2511. @item width_type, t
  2512. Change highpass width_type.
  2513. Syntax for the command is : "@var{width_type}"
  2514. @item width, w
  2515. Change highpass width.
  2516. Syntax for the command is : "@var{width}"
  2517. @end table
  2518. @section join
  2519. Join multiple input streams into one multi-channel stream.
  2520. It accepts the following parameters:
  2521. @table @option
  2522. @item inputs
  2523. The number of input streams. It defaults to 2.
  2524. @item channel_layout
  2525. The desired output channel layout. It defaults to stereo.
  2526. @item map
  2527. Map channels from inputs to output. The argument is a '|'-separated list of
  2528. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2529. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2530. can be either the name of the input channel (e.g. FL for front left) or its
  2531. index in the specified input stream. @var{out_channel} is the name of the output
  2532. channel.
  2533. @end table
  2534. The filter will attempt to guess the mappings when they are not specified
  2535. explicitly. It does so by first trying to find an unused matching input channel
  2536. and if that fails it picks the first unused input channel.
  2537. Join 3 inputs (with properly set channel layouts):
  2538. @example
  2539. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2540. @end example
  2541. Build a 5.1 output from 6 single-channel streams:
  2542. @example
  2543. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2544. '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'
  2545. out
  2546. @end example
  2547. @section ladspa
  2548. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2549. To enable compilation of this filter you need to configure FFmpeg with
  2550. @code{--enable-ladspa}.
  2551. @table @option
  2552. @item file, f
  2553. Specifies the name of LADSPA plugin library to load. If the environment
  2554. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2555. each one of the directories specified by the colon separated list in
  2556. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2557. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2558. @file{/usr/lib/ladspa/}.
  2559. @item plugin, p
  2560. Specifies the plugin within the library. Some libraries contain only
  2561. one plugin, but others contain many of them. If this is not set filter
  2562. will list all available plugins within the specified library.
  2563. @item controls, c
  2564. Set the '|' separated list of controls which are zero or more floating point
  2565. values that determine the behavior of the loaded plugin (for example delay,
  2566. threshold or gain).
  2567. Controls need to be defined using the following syntax:
  2568. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2569. @var{valuei} is the value set on the @var{i}-th control.
  2570. Alternatively they can be also defined using the following syntax:
  2571. @var{value0}|@var{value1}|@var{value2}|..., where
  2572. @var{valuei} is the value set on the @var{i}-th control.
  2573. If @option{controls} is set to @code{help}, all available controls and
  2574. their valid ranges are printed.
  2575. @item sample_rate, s
  2576. Specify the sample rate, default to 44100. Only used if plugin have
  2577. zero inputs.
  2578. @item nb_samples, n
  2579. Set the number of samples per channel per each output frame, default
  2580. is 1024. Only used if plugin have zero inputs.
  2581. @item duration, d
  2582. Set the minimum duration of the sourced audio. See
  2583. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2584. for the accepted syntax.
  2585. Note that the resulting duration may be greater than the specified duration,
  2586. as the generated audio is always cut at the end of a complete frame.
  2587. If not specified, or the expressed duration is negative, the audio is
  2588. supposed to be generated forever.
  2589. Only used if plugin have zero inputs.
  2590. @end table
  2591. @subsection Examples
  2592. @itemize
  2593. @item
  2594. List all available plugins within amp (LADSPA example plugin) library:
  2595. @example
  2596. ladspa=file=amp
  2597. @end example
  2598. @item
  2599. List all available controls and their valid ranges for @code{vcf_notch}
  2600. plugin from @code{VCF} library:
  2601. @example
  2602. ladspa=f=vcf:p=vcf_notch:c=help
  2603. @end example
  2604. @item
  2605. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2606. plugin library:
  2607. @example
  2608. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2609. @end example
  2610. @item
  2611. Add reverberation to the audio using TAP-plugins
  2612. (Tom's Audio Processing plugins):
  2613. @example
  2614. ladspa=file=tap_reverb:tap_reverb
  2615. @end example
  2616. @item
  2617. Generate white noise, with 0.2 amplitude:
  2618. @example
  2619. ladspa=file=cmt:noise_source_white:c=c0=.2
  2620. @end example
  2621. @item
  2622. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2623. @code{C* Audio Plugin Suite} (CAPS) library:
  2624. @example
  2625. ladspa=file=caps:Click:c=c1=20'
  2626. @end example
  2627. @item
  2628. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2629. @example
  2630. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2631. @end example
  2632. @item
  2633. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2634. @code{SWH Plugins} collection:
  2635. @example
  2636. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2637. @end example
  2638. @item
  2639. Attenuate low frequencies using Multiband EQ from Steve Harris
  2640. @code{SWH Plugins} collection:
  2641. @example
  2642. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2643. @end example
  2644. @item
  2645. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2646. (CAPS) library:
  2647. @example
  2648. ladspa=caps:Narrower
  2649. @end example
  2650. @item
  2651. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2652. @example
  2653. ladspa=caps:White:.2
  2654. @end example
  2655. @item
  2656. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2657. @example
  2658. ladspa=caps:Fractal:c=c1=1
  2659. @end example
  2660. @item
  2661. Dynamic volume normalization using @code{VLevel} plugin:
  2662. @example
  2663. ladspa=vlevel-ladspa:vlevel_mono
  2664. @end example
  2665. @end itemize
  2666. @subsection Commands
  2667. This filter supports the following commands:
  2668. @table @option
  2669. @item cN
  2670. Modify the @var{N}-th control value.
  2671. If the specified value is not valid, it is ignored and prior one is kept.
  2672. @end table
  2673. @section loudnorm
  2674. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2675. Support for both single pass (livestreams, files) and double pass (files) modes.
  2676. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2677. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2678. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2679. The filter accepts the following options:
  2680. @table @option
  2681. @item I, i
  2682. Set integrated loudness target.
  2683. Range is -70.0 - -5.0. Default value is -24.0.
  2684. @item LRA, lra
  2685. Set loudness range target.
  2686. Range is 1.0 - 20.0. Default value is 7.0.
  2687. @item TP, tp
  2688. Set maximum true peak.
  2689. Range is -9.0 - +0.0. Default value is -2.0.
  2690. @item measured_I, measured_i
  2691. Measured IL of input file.
  2692. Range is -99.0 - +0.0.
  2693. @item measured_LRA, measured_lra
  2694. Measured LRA of input file.
  2695. Range is 0.0 - 99.0.
  2696. @item measured_TP, measured_tp
  2697. Measured true peak of input file.
  2698. Range is -99.0 - +99.0.
  2699. @item measured_thresh
  2700. Measured threshold of input file.
  2701. Range is -99.0 - +0.0.
  2702. @item offset
  2703. Set offset gain. Gain is applied before the true-peak limiter.
  2704. Range is -99.0 - +99.0. Default is +0.0.
  2705. @item linear
  2706. Normalize linearly if possible.
  2707. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2708. to be specified in order to use this mode.
  2709. Options are true or false. Default is true.
  2710. @item dual_mono
  2711. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2712. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2713. If set to @code{true}, this option will compensate for this effect.
  2714. Multi-channel input files are not affected by this option.
  2715. Options are true or false. Default is false.
  2716. @item print_format
  2717. Set print format for stats. Options are summary, json, or none.
  2718. Default value is none.
  2719. @end table
  2720. @section lowpass
  2721. Apply a low-pass filter with 3dB point frequency.
  2722. The filter can be either single-pole or double-pole (the default).
  2723. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2724. The filter accepts the following options:
  2725. @table @option
  2726. @item frequency, f
  2727. Set frequency in Hz. Default is 500.
  2728. @item poles, p
  2729. Set number of poles. Default is 2.
  2730. @item width_type, t
  2731. Set method to specify band-width of filter.
  2732. @table @option
  2733. @item h
  2734. Hz
  2735. @item q
  2736. Q-Factor
  2737. @item o
  2738. octave
  2739. @item s
  2740. slope
  2741. @item k
  2742. kHz
  2743. @end table
  2744. @item width, w
  2745. Specify the band-width of a filter in width_type units.
  2746. Applies only to double-pole filter.
  2747. The default is 0.707q and gives a Butterworth response.
  2748. @item channels, c
  2749. Specify which channels to filter, by default all available are filtered.
  2750. @end table
  2751. @subsection Examples
  2752. @itemize
  2753. @item
  2754. Lowpass only LFE channel, it LFE is not present it does nothing:
  2755. @example
  2756. lowpass=c=LFE
  2757. @end example
  2758. @end itemize
  2759. @subsection Commands
  2760. This filter supports the following commands:
  2761. @table @option
  2762. @item frequency, f
  2763. Change lowpass frequency.
  2764. Syntax for the command is : "@var{frequency}"
  2765. @item width_type, t
  2766. Change lowpass width_type.
  2767. Syntax for the command is : "@var{width_type}"
  2768. @item width, w
  2769. Change lowpass width.
  2770. Syntax for the command is : "@var{width}"
  2771. @end table
  2772. @section lv2
  2773. Load a LV2 (LADSPA Version 2) plugin.
  2774. To enable compilation of this filter you need to configure FFmpeg with
  2775. @code{--enable-lv2}.
  2776. @table @option
  2777. @item plugin, p
  2778. Specifies the plugin URI. You may need to escape ':'.
  2779. @item controls, c
  2780. Set the '|' separated list of controls which are zero or more floating point
  2781. values that determine the behavior of the loaded plugin (for example delay,
  2782. threshold or gain).
  2783. If @option{controls} is set to @code{help}, all available controls and
  2784. their valid ranges are printed.
  2785. @item sample_rate, s
  2786. Specify the sample rate, default to 44100. Only used if plugin have
  2787. zero inputs.
  2788. @item nb_samples, n
  2789. Set the number of samples per channel per each output frame, default
  2790. is 1024. Only used if plugin have zero inputs.
  2791. @item duration, d
  2792. Set the minimum duration of the sourced audio. See
  2793. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2794. for the accepted syntax.
  2795. Note that the resulting duration may be greater than the specified duration,
  2796. as the generated audio is always cut at the end of a complete frame.
  2797. If not specified, or the expressed duration is negative, the audio is
  2798. supposed to be generated forever.
  2799. Only used if plugin have zero inputs.
  2800. @end table
  2801. @subsection Examples
  2802. @itemize
  2803. @item
  2804. Apply bass enhancer plugin from Calf:
  2805. @example
  2806. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2807. @end example
  2808. @item
  2809. Apply bass vinyl plugin from Calf:
  2810. @example
  2811. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2812. @end example
  2813. @item
  2814. Apply bit crusher plugin from ArtyFX:
  2815. @example
  2816. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2817. @end example
  2818. @end itemize
  2819. @section mcompand
  2820. Multiband Compress or expand the audio's dynamic range.
  2821. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2822. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2823. response when absent compander action.
  2824. It accepts the following parameters:
  2825. @table @option
  2826. @item args
  2827. This option syntax is:
  2828. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2829. For explanation of each item refer to compand filter documentation.
  2830. @end table
  2831. @anchor{pan}
  2832. @section pan
  2833. Mix channels with specific gain levels. The filter accepts the output
  2834. channel layout followed by a set of channels definitions.
  2835. This filter is also designed to efficiently remap the channels of an audio
  2836. stream.
  2837. The filter accepts parameters of the form:
  2838. "@var{l}|@var{outdef}|@var{outdef}|..."
  2839. @table @option
  2840. @item l
  2841. output channel layout or number of channels
  2842. @item outdef
  2843. output channel specification, of the form:
  2844. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2845. @item out_name
  2846. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2847. number (c0, c1, etc.)
  2848. @item gain
  2849. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2850. @item in_name
  2851. input channel to use, see out_name for details; it is not possible to mix
  2852. named and numbered input channels
  2853. @end table
  2854. If the `=' in a channel specification is replaced by `<', then the gains for
  2855. that specification will be renormalized so that the total is 1, thus
  2856. avoiding clipping noise.
  2857. @subsection Mixing examples
  2858. For example, if you want to down-mix from stereo to mono, but with a bigger
  2859. factor for the left channel:
  2860. @example
  2861. pan=1c|c0=0.9*c0+0.1*c1
  2862. @end example
  2863. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2864. 7-channels surround:
  2865. @example
  2866. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2867. @end example
  2868. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2869. that should be preferred (see "-ac" option) unless you have very specific
  2870. needs.
  2871. @subsection Remapping examples
  2872. The channel remapping will be effective if, and only if:
  2873. @itemize
  2874. @item gain coefficients are zeroes or ones,
  2875. @item only one input per channel output,
  2876. @end itemize
  2877. If all these conditions are satisfied, the filter will notify the user ("Pure
  2878. channel mapping detected"), and use an optimized and lossless method to do the
  2879. remapping.
  2880. For example, if you have a 5.1 source and want a stereo audio stream by
  2881. dropping the extra channels:
  2882. @example
  2883. pan="stereo| c0=FL | c1=FR"
  2884. @end example
  2885. Given the same source, you can also switch front left and front right channels
  2886. and keep the input channel layout:
  2887. @example
  2888. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2889. @end example
  2890. If the input is a stereo audio stream, you can mute the front left channel (and
  2891. still keep the stereo channel layout) with:
  2892. @example
  2893. pan="stereo|c1=c1"
  2894. @end example
  2895. Still with a stereo audio stream input, you can copy the right channel in both
  2896. front left and right:
  2897. @example
  2898. pan="stereo| c0=FR | c1=FR"
  2899. @end example
  2900. @section replaygain
  2901. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2902. outputs it unchanged.
  2903. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2904. @section resample
  2905. Convert the audio sample format, sample rate and channel layout. It is
  2906. not meant to be used directly.
  2907. @section rubberband
  2908. Apply time-stretching and pitch-shifting with librubberband.
  2909. The filter accepts the following options:
  2910. @table @option
  2911. @item tempo
  2912. Set tempo scale factor.
  2913. @item pitch
  2914. Set pitch scale factor.
  2915. @item transients
  2916. Set transients detector.
  2917. Possible values are:
  2918. @table @var
  2919. @item crisp
  2920. @item mixed
  2921. @item smooth
  2922. @end table
  2923. @item detector
  2924. Set detector.
  2925. Possible values are:
  2926. @table @var
  2927. @item compound
  2928. @item percussive
  2929. @item soft
  2930. @end table
  2931. @item phase
  2932. Set phase.
  2933. Possible values are:
  2934. @table @var
  2935. @item laminar
  2936. @item independent
  2937. @end table
  2938. @item window
  2939. Set processing window size.
  2940. Possible values are:
  2941. @table @var
  2942. @item standard
  2943. @item short
  2944. @item long
  2945. @end table
  2946. @item smoothing
  2947. Set smoothing.
  2948. Possible values are:
  2949. @table @var
  2950. @item off
  2951. @item on
  2952. @end table
  2953. @item formant
  2954. Enable formant preservation when shift pitching.
  2955. Possible values are:
  2956. @table @var
  2957. @item shifted
  2958. @item preserved
  2959. @end table
  2960. @item pitchq
  2961. Set pitch quality.
  2962. Possible values are:
  2963. @table @var
  2964. @item quality
  2965. @item speed
  2966. @item consistency
  2967. @end table
  2968. @item channels
  2969. Set channels.
  2970. Possible values are:
  2971. @table @var
  2972. @item apart
  2973. @item together
  2974. @end table
  2975. @end table
  2976. @section sidechaincompress
  2977. This filter acts like normal compressor but has the ability to compress
  2978. detected signal using second input signal.
  2979. It needs two input streams and returns one output stream.
  2980. First input stream will be processed depending on second stream signal.
  2981. The filtered signal then can be filtered with other filters in later stages of
  2982. processing. See @ref{pan} and @ref{amerge} filter.
  2983. The filter accepts the following options:
  2984. @table @option
  2985. @item level_in
  2986. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2987. @item threshold
  2988. If a signal of second stream raises above this level it will affect the gain
  2989. reduction of first stream.
  2990. By default is 0.125. Range is between 0.00097563 and 1.
  2991. @item ratio
  2992. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2993. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2994. Default is 2. Range is between 1 and 20.
  2995. @item attack
  2996. Amount of milliseconds the signal has to rise above the threshold before gain
  2997. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2998. @item release
  2999. Amount of milliseconds the signal has to fall below the threshold before
  3000. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3001. @item makeup
  3002. Set the amount by how much signal will be amplified after processing.
  3003. Default is 1. Range is from 1 to 64.
  3004. @item knee
  3005. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3006. Default is 2.82843. Range is between 1 and 8.
  3007. @item link
  3008. Choose if the @code{average} level between all channels of side-chain stream
  3009. or the louder(@code{maximum}) channel of side-chain stream affects the
  3010. reduction. Default is @code{average}.
  3011. @item detection
  3012. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3013. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3014. @item level_sc
  3015. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3016. @item mix
  3017. How much to use compressed signal in output. Default is 1.
  3018. Range is between 0 and 1.
  3019. @end table
  3020. @subsection Examples
  3021. @itemize
  3022. @item
  3023. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3024. depending on the signal of 2nd input and later compressed signal to be
  3025. merged with 2nd input:
  3026. @example
  3027. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3028. @end example
  3029. @end itemize
  3030. @section sidechaingate
  3031. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3032. filter the detected signal before sending it to the gain reduction stage.
  3033. Normally a gate uses the full range signal to detect a level above the
  3034. threshold.
  3035. For example: If you cut all lower frequencies from your sidechain signal
  3036. the gate will decrease the volume of your track only if not enough highs
  3037. appear. With this technique you are able to reduce the resonation of a
  3038. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3039. guitar.
  3040. It needs two input streams and returns one output stream.
  3041. First input stream will be processed depending on second stream signal.
  3042. The filter accepts the following options:
  3043. @table @option
  3044. @item level_in
  3045. Set input level before filtering.
  3046. Default is 1. Allowed range is from 0.015625 to 64.
  3047. @item range
  3048. Set the level of gain reduction when the signal is below the threshold.
  3049. Default is 0.06125. Allowed range is from 0 to 1.
  3050. @item threshold
  3051. If a signal rises above this level the gain reduction is released.
  3052. Default is 0.125. Allowed range is from 0 to 1.
  3053. @item ratio
  3054. Set a ratio about which the signal is reduced.
  3055. Default is 2. Allowed range is from 1 to 9000.
  3056. @item attack
  3057. Amount of milliseconds the signal has to rise above the threshold before gain
  3058. reduction stops.
  3059. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3060. @item release
  3061. Amount of milliseconds the signal has to fall below the threshold before the
  3062. reduction is increased again. Default is 250 milliseconds.
  3063. Allowed range is from 0.01 to 9000.
  3064. @item makeup
  3065. Set amount of amplification of signal after processing.
  3066. Default is 1. Allowed range is from 1 to 64.
  3067. @item knee
  3068. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3069. Default is 2.828427125. Allowed range is from 1 to 8.
  3070. @item detection
  3071. Choose if exact signal should be taken for detection or an RMS like one.
  3072. Default is rms. Can be peak or rms.
  3073. @item link
  3074. Choose if the average level between all channels or the louder channel affects
  3075. the reduction.
  3076. Default is average. Can be average or maximum.
  3077. @item level_sc
  3078. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3079. @end table
  3080. @section silencedetect
  3081. Detect silence in an audio stream.
  3082. This filter logs a message when it detects that the input audio volume is less
  3083. or equal to a noise tolerance value for a duration greater or equal to the
  3084. minimum detected noise duration.
  3085. The printed times and duration are expressed in seconds.
  3086. The filter accepts the following options:
  3087. @table @option
  3088. @item duration, d
  3089. Set silence duration until notification (default is 2 seconds).
  3090. @item noise, n
  3091. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3092. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3093. @end table
  3094. @subsection Examples
  3095. @itemize
  3096. @item
  3097. Detect 5 seconds of silence with -50dB noise tolerance:
  3098. @example
  3099. silencedetect=n=-50dB:d=5
  3100. @end example
  3101. @item
  3102. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3103. tolerance in @file{silence.mp3}:
  3104. @example
  3105. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3106. @end example
  3107. @end itemize
  3108. @section silenceremove
  3109. Remove silence from the beginning, middle or end of the audio.
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item start_periods
  3113. This value is used to indicate if audio should be trimmed at beginning of
  3114. the audio. A value of zero indicates no silence should be trimmed from the
  3115. beginning. When specifying a non-zero value, it trims audio up until it
  3116. finds non-silence. Normally, when trimming silence from beginning of audio
  3117. the @var{start_periods} will be @code{1} but it can be increased to higher
  3118. values to trim all audio up to specific count of non-silence periods.
  3119. Default value is @code{0}.
  3120. @item start_duration
  3121. Specify the amount of time that non-silence must be detected before it stops
  3122. trimming audio. By increasing the duration, bursts of noises can be treated
  3123. as silence and trimmed off. Default value is @code{0}.
  3124. @item start_threshold
  3125. This indicates what sample value should be treated as silence. For digital
  3126. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3127. you may wish to increase the value to account for background noise.
  3128. Can be specified in dB (in case "dB" is appended to the specified value)
  3129. or amplitude ratio. Default value is @code{0}.
  3130. @item stop_periods
  3131. Set the count for trimming silence from the end of audio.
  3132. To remove silence from the middle of a file, specify a @var{stop_periods}
  3133. that is negative. This value is then treated as a positive value and is
  3134. used to indicate the effect should restart processing as specified by
  3135. @var{start_periods}, making it suitable for removing periods of silence
  3136. in the middle of the audio.
  3137. Default value is @code{0}.
  3138. @item stop_duration
  3139. Specify a duration of silence that must exist before audio is not copied any
  3140. more. By specifying a higher duration, silence that is wanted can be left in
  3141. the audio.
  3142. Default value is @code{0}.
  3143. @item stop_threshold
  3144. This is the same as @option{start_threshold} but for trimming silence from
  3145. the end of audio.
  3146. Can be specified in dB (in case "dB" is appended to the specified value)
  3147. or amplitude ratio. Default value is @code{0}.
  3148. @item leave_silence
  3149. This indicates that @var{stop_duration} length of audio should be left intact
  3150. at the beginning of each period of silence.
  3151. For example, if you want to remove long pauses between words but do not want
  3152. to remove the pauses completely. Default value is @code{0}.
  3153. @item detection
  3154. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3155. and works better with digital silence which is exactly 0.
  3156. Default value is @code{rms}.
  3157. @item window
  3158. Set ratio used to calculate size of window for detecting silence.
  3159. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3160. @end table
  3161. @subsection Examples
  3162. @itemize
  3163. @item
  3164. The following example shows how this filter can be used to start a recording
  3165. that does not contain the delay at the start which usually occurs between
  3166. pressing the record button and the start of the performance:
  3167. @example
  3168. silenceremove=1:5:0.02
  3169. @end example
  3170. @item
  3171. Trim all silence encountered from beginning to end where there is more than 1
  3172. second of silence in audio:
  3173. @example
  3174. silenceremove=0:0:0:-1:1:-90dB
  3175. @end example
  3176. @end itemize
  3177. @section sofalizer
  3178. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3179. loudspeakers around the user for binaural listening via headphones (audio
  3180. formats up to 9 channels supported).
  3181. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3182. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3183. Austrian Academy of Sciences.
  3184. To enable compilation of this filter you need to configure FFmpeg with
  3185. @code{--enable-libmysofa}.
  3186. The filter accepts the following options:
  3187. @table @option
  3188. @item sofa
  3189. Set the SOFA file used for rendering.
  3190. @item gain
  3191. Set gain applied to audio. Value is in dB. Default is 0.
  3192. @item rotation
  3193. Set rotation of virtual loudspeakers in deg. Default is 0.
  3194. @item elevation
  3195. Set elevation of virtual speakers in deg. Default is 0.
  3196. @item radius
  3197. Set distance in meters between loudspeakers and the listener with near-field
  3198. HRTFs. Default is 1.
  3199. @item type
  3200. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3201. processing audio in time domain which is slow.
  3202. @var{freq} is processing audio in frequency domain which is fast.
  3203. Default is @var{freq}.
  3204. @item speakers
  3205. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3206. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3207. Each virtual loudspeaker is described with short channel name following with
  3208. azimuth and elevation in degrees.
  3209. Each virtual loudspeaker description is separated by '|'.
  3210. For example to override front left and front right channel positions use:
  3211. 'speakers=FL 45 15|FR 345 15'.
  3212. Descriptions with unrecognised channel names are ignored.
  3213. @item lfegain
  3214. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3215. @end table
  3216. @subsection Examples
  3217. @itemize
  3218. @item
  3219. Using ClubFritz6 sofa file:
  3220. @example
  3221. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3222. @end example
  3223. @item
  3224. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3225. @example
  3226. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3227. @end example
  3228. @item
  3229. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3230. and also with custom gain:
  3231. @example
  3232. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3233. @end example
  3234. @end itemize
  3235. @section stereotools
  3236. This filter has some handy utilities to manage stereo signals, for converting
  3237. M/S stereo recordings to L/R signal while having control over the parameters
  3238. or spreading the stereo image of master track.
  3239. The filter accepts the following options:
  3240. @table @option
  3241. @item level_in
  3242. Set input level before filtering for both channels. Defaults is 1.
  3243. Allowed range is from 0.015625 to 64.
  3244. @item level_out
  3245. Set output level after filtering for both channels. Defaults is 1.
  3246. Allowed range is from 0.015625 to 64.
  3247. @item balance_in
  3248. Set input balance between both channels. Default is 0.
  3249. Allowed range is from -1 to 1.
  3250. @item balance_out
  3251. Set output balance between both channels. Default is 0.
  3252. Allowed range is from -1 to 1.
  3253. @item softclip
  3254. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3255. clipping. Disabled by default.
  3256. @item mutel
  3257. Mute the left channel. Disabled by default.
  3258. @item muter
  3259. Mute the right channel. Disabled by default.
  3260. @item phasel
  3261. Change the phase of the left channel. Disabled by default.
  3262. @item phaser
  3263. Change the phase of the right channel. Disabled by default.
  3264. @item mode
  3265. Set stereo mode. Available values are:
  3266. @table @samp
  3267. @item lr>lr
  3268. Left/Right to Left/Right, this is default.
  3269. @item lr>ms
  3270. Left/Right to Mid/Side.
  3271. @item ms>lr
  3272. Mid/Side to Left/Right.
  3273. @item lr>ll
  3274. Left/Right to Left/Left.
  3275. @item lr>rr
  3276. Left/Right to Right/Right.
  3277. @item lr>l+r
  3278. Left/Right to Left + Right.
  3279. @item lr>rl
  3280. Left/Right to Right/Left.
  3281. @item ms>ll
  3282. Mid/Side to Left/Left.
  3283. @item ms>rr
  3284. Mid/Side to Right/Right.
  3285. @end table
  3286. @item slev
  3287. Set level of side signal. Default is 1.
  3288. Allowed range is from 0.015625 to 64.
  3289. @item sbal
  3290. Set balance of side signal. Default is 0.
  3291. Allowed range is from -1 to 1.
  3292. @item mlev
  3293. Set level of the middle signal. Default is 1.
  3294. Allowed range is from 0.015625 to 64.
  3295. @item mpan
  3296. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3297. @item base
  3298. Set stereo base between mono and inversed channels. Default is 0.
  3299. Allowed range is from -1 to 1.
  3300. @item delay
  3301. Set delay in milliseconds how much to delay left from right channel and
  3302. vice versa. Default is 0. Allowed range is from -20 to 20.
  3303. @item sclevel
  3304. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3305. @item phase
  3306. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3307. @item bmode_in, bmode_out
  3308. Set balance mode for balance_in/balance_out option.
  3309. Can be one of the following:
  3310. @table @samp
  3311. @item balance
  3312. Classic balance mode. Attenuate one channel at time.
  3313. Gain is raised up to 1.
  3314. @item amplitude
  3315. Similar as classic mode above but gain is raised up to 2.
  3316. @item power
  3317. Equal power distribution, from -6dB to +6dB range.
  3318. @end table
  3319. @end table
  3320. @subsection Examples
  3321. @itemize
  3322. @item
  3323. Apply karaoke like effect:
  3324. @example
  3325. stereotools=mlev=0.015625
  3326. @end example
  3327. @item
  3328. Convert M/S signal to L/R:
  3329. @example
  3330. "stereotools=mode=ms>lr"
  3331. @end example
  3332. @end itemize
  3333. @section stereowiden
  3334. This filter enhance the stereo effect by suppressing signal common to both
  3335. channels and by delaying the signal of left into right and vice versa,
  3336. thereby widening the stereo effect.
  3337. The filter accepts the following options:
  3338. @table @option
  3339. @item delay
  3340. Time in milliseconds of the delay of left signal into right and vice versa.
  3341. Default is 20 milliseconds.
  3342. @item feedback
  3343. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3344. effect of left signal in right output and vice versa which gives widening
  3345. effect. Default is 0.3.
  3346. @item crossfeed
  3347. Cross feed of left into right with inverted phase. This helps in suppressing
  3348. the mono. If the value is 1 it will cancel all the signal common to both
  3349. channels. Default is 0.3.
  3350. @item drymix
  3351. Set level of input signal of original channel. Default is 0.8.
  3352. @end table
  3353. @section superequalizer
  3354. Apply 18 band equalizer.
  3355. The filter accepts the following options:
  3356. @table @option
  3357. @item 1b
  3358. Set 65Hz band gain.
  3359. @item 2b
  3360. Set 92Hz band gain.
  3361. @item 3b
  3362. Set 131Hz band gain.
  3363. @item 4b
  3364. Set 185Hz band gain.
  3365. @item 5b
  3366. Set 262Hz band gain.
  3367. @item 6b
  3368. Set 370Hz band gain.
  3369. @item 7b
  3370. Set 523Hz band gain.
  3371. @item 8b
  3372. Set 740Hz band gain.
  3373. @item 9b
  3374. Set 1047Hz band gain.
  3375. @item 10b
  3376. Set 1480Hz band gain.
  3377. @item 11b
  3378. Set 2093Hz band gain.
  3379. @item 12b
  3380. Set 2960Hz band gain.
  3381. @item 13b
  3382. Set 4186Hz band gain.
  3383. @item 14b
  3384. Set 5920Hz band gain.
  3385. @item 15b
  3386. Set 8372Hz band gain.
  3387. @item 16b
  3388. Set 11840Hz band gain.
  3389. @item 17b
  3390. Set 16744Hz band gain.
  3391. @item 18b
  3392. Set 20000Hz band gain.
  3393. @end table
  3394. @section surround
  3395. Apply audio surround upmix filter.
  3396. This filter allows to produce multichannel output from audio stream.
  3397. The filter accepts the following options:
  3398. @table @option
  3399. @item chl_out
  3400. Set output channel layout. By default, this is @var{5.1}.
  3401. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3402. for the required syntax.
  3403. @item chl_in
  3404. Set input channel layout. By default, this is @var{stereo}.
  3405. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3406. for the required syntax.
  3407. @item level_in
  3408. Set input volume level. By default, this is @var{1}.
  3409. @item level_out
  3410. Set output volume level. By default, this is @var{1}.
  3411. @item lfe
  3412. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3413. @item lfe_low
  3414. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3415. @item lfe_high
  3416. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3417. @item fc_in
  3418. Set front center input volume. By default, this is @var{1}.
  3419. @item fc_out
  3420. Set front center output volume. By default, this is @var{1}.
  3421. @item lfe_in
  3422. Set LFE input volume. By default, this is @var{1}.
  3423. @item lfe_out
  3424. Set LFE output volume. By default, this is @var{1}.
  3425. @end table
  3426. @section treble
  3427. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3428. shelving filter with a response similar to that of a standard
  3429. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3430. The filter accepts the following options:
  3431. @table @option
  3432. @item gain, g
  3433. Give the gain at whichever is the lower of ~22 kHz and the
  3434. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3435. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3436. @item frequency, f
  3437. Set the filter's central frequency and so can be used
  3438. to extend or reduce the frequency range to be boosted or cut.
  3439. The default value is @code{3000} Hz.
  3440. @item width_type, t
  3441. Set method to specify band-width of filter.
  3442. @table @option
  3443. @item h
  3444. Hz
  3445. @item q
  3446. Q-Factor
  3447. @item o
  3448. octave
  3449. @item s
  3450. slope
  3451. @item k
  3452. kHz
  3453. @end table
  3454. @item width, w
  3455. Determine how steep is the filter's shelf transition.
  3456. @item channels, c
  3457. Specify which channels to filter, by default all available are filtered.
  3458. @end table
  3459. @subsection Commands
  3460. This filter supports the following commands:
  3461. @table @option
  3462. @item frequency, f
  3463. Change treble frequency.
  3464. Syntax for the command is : "@var{frequency}"
  3465. @item width_type, t
  3466. Change treble width_type.
  3467. Syntax for the command is : "@var{width_type}"
  3468. @item width, w
  3469. Change treble width.
  3470. Syntax for the command is : "@var{width}"
  3471. @item gain, g
  3472. Change treble gain.
  3473. Syntax for the command is : "@var{gain}"
  3474. @end table
  3475. @section tremolo
  3476. Sinusoidal amplitude modulation.
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item f
  3480. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3481. (20 Hz or lower) will result in a tremolo effect.
  3482. This filter may also be used as a ring modulator by specifying
  3483. a modulation frequency higher than 20 Hz.
  3484. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3485. @item d
  3486. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3487. Default value is 0.5.
  3488. @end table
  3489. @section vibrato
  3490. Sinusoidal phase modulation.
  3491. The filter accepts the following options:
  3492. @table @option
  3493. @item f
  3494. Modulation frequency in Hertz.
  3495. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3496. @item d
  3497. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3498. Default value is 0.5.
  3499. @end table
  3500. @section volume
  3501. Adjust the input audio volume.
  3502. It accepts the following parameters:
  3503. @table @option
  3504. @item volume
  3505. Set audio volume expression.
  3506. Output values are clipped to the maximum value.
  3507. The output audio volume is given by the relation:
  3508. @example
  3509. @var{output_volume} = @var{volume} * @var{input_volume}
  3510. @end example
  3511. The default value for @var{volume} is "1.0".
  3512. @item precision
  3513. This parameter represents the mathematical precision.
  3514. It determines which input sample formats will be allowed, which affects the
  3515. precision of the volume scaling.
  3516. @table @option
  3517. @item fixed
  3518. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3519. @item float
  3520. 32-bit floating-point; this limits input sample format to FLT. (default)
  3521. @item double
  3522. 64-bit floating-point; this limits input sample format to DBL.
  3523. @end table
  3524. @item replaygain
  3525. Choose the behaviour on encountering ReplayGain side data in input frames.
  3526. @table @option
  3527. @item drop
  3528. Remove ReplayGain side data, ignoring its contents (the default).
  3529. @item ignore
  3530. Ignore ReplayGain side data, but leave it in the frame.
  3531. @item track
  3532. Prefer the track gain, if present.
  3533. @item album
  3534. Prefer the album gain, if present.
  3535. @end table
  3536. @item replaygain_preamp
  3537. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3538. Default value for @var{replaygain_preamp} is 0.0.
  3539. @item eval
  3540. Set when the volume expression is evaluated.
  3541. It accepts the following values:
  3542. @table @samp
  3543. @item once
  3544. only evaluate expression once during the filter initialization, or
  3545. when the @samp{volume} command is sent
  3546. @item frame
  3547. evaluate expression for each incoming frame
  3548. @end table
  3549. Default value is @samp{once}.
  3550. @end table
  3551. The volume expression can contain the following parameters.
  3552. @table @option
  3553. @item n
  3554. frame number (starting at zero)
  3555. @item nb_channels
  3556. number of channels
  3557. @item nb_consumed_samples
  3558. number of samples consumed by the filter
  3559. @item nb_samples
  3560. number of samples in the current frame
  3561. @item pos
  3562. original frame position in the file
  3563. @item pts
  3564. frame PTS
  3565. @item sample_rate
  3566. sample rate
  3567. @item startpts
  3568. PTS at start of stream
  3569. @item startt
  3570. time at start of stream
  3571. @item t
  3572. frame time
  3573. @item tb
  3574. timestamp timebase
  3575. @item volume
  3576. last set volume value
  3577. @end table
  3578. Note that when @option{eval} is set to @samp{once} only the
  3579. @var{sample_rate} and @var{tb} variables are available, all other
  3580. variables will evaluate to NAN.
  3581. @subsection Commands
  3582. This filter supports the following commands:
  3583. @table @option
  3584. @item volume
  3585. Modify the volume expression.
  3586. The command accepts the same syntax of the corresponding option.
  3587. If the specified expression is not valid, it is kept at its current
  3588. value.
  3589. @item replaygain_noclip
  3590. Prevent clipping by limiting the gain applied.
  3591. Default value for @var{replaygain_noclip} is 1.
  3592. @end table
  3593. @subsection Examples
  3594. @itemize
  3595. @item
  3596. Halve the input audio volume:
  3597. @example
  3598. volume=volume=0.5
  3599. volume=volume=1/2
  3600. volume=volume=-6.0206dB
  3601. @end example
  3602. In all the above example the named key for @option{volume} can be
  3603. omitted, for example like in:
  3604. @example
  3605. volume=0.5
  3606. @end example
  3607. @item
  3608. Increase input audio power by 6 decibels using fixed-point precision:
  3609. @example
  3610. volume=volume=6dB:precision=fixed
  3611. @end example
  3612. @item
  3613. Fade volume after time 10 with an annihilation period of 5 seconds:
  3614. @example
  3615. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3616. @end example
  3617. @end itemize
  3618. @section volumedetect
  3619. Detect the volume of the input video.
  3620. The filter has no parameters. The input is not modified. Statistics about
  3621. the volume will be printed in the log when the input stream end is reached.
  3622. In particular it will show the mean volume (root mean square), maximum
  3623. volume (on a per-sample basis), and the beginning of a histogram of the
  3624. registered volume values (from the maximum value to a cumulated 1/1000 of
  3625. the samples).
  3626. All volumes are in decibels relative to the maximum PCM value.
  3627. @subsection Examples
  3628. Here is an excerpt of the output:
  3629. @example
  3630. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3631. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3632. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3633. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3634. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3635. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3636. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3637. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3638. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3639. @end example
  3640. It means that:
  3641. @itemize
  3642. @item
  3643. The mean square energy is approximately -27 dB, or 10^-2.7.
  3644. @item
  3645. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3646. @item
  3647. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3648. @end itemize
  3649. In other words, raising the volume by +4 dB does not cause any clipping,
  3650. raising it by +5 dB causes clipping for 6 samples, etc.
  3651. @c man end AUDIO FILTERS
  3652. @chapter Audio Sources
  3653. @c man begin AUDIO SOURCES
  3654. Below is a description of the currently available audio sources.
  3655. @section abuffer
  3656. Buffer audio frames, and make them available to the filter chain.
  3657. This source is mainly intended for a programmatic use, in particular
  3658. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3659. It accepts the following parameters:
  3660. @table @option
  3661. @item time_base
  3662. The timebase which will be used for timestamps of submitted frames. It must be
  3663. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3664. @item sample_rate
  3665. The sample rate of the incoming audio buffers.
  3666. @item sample_fmt
  3667. The sample format of the incoming audio buffers.
  3668. Either a sample format name or its corresponding integer representation from
  3669. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3670. @item channel_layout
  3671. The channel layout of the incoming audio buffers.
  3672. Either a channel layout name from channel_layout_map in
  3673. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3674. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3675. @item channels
  3676. The number of channels of the incoming audio buffers.
  3677. If both @var{channels} and @var{channel_layout} are specified, then they
  3678. must be consistent.
  3679. @end table
  3680. @subsection Examples
  3681. @example
  3682. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3683. @end example
  3684. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3685. Since the sample format with name "s16p" corresponds to the number
  3686. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3687. equivalent to:
  3688. @example
  3689. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3690. @end example
  3691. @section aevalsrc
  3692. Generate an audio signal specified by an expression.
  3693. This source accepts in input one or more expressions (one for each
  3694. channel), which are evaluated and used to generate a corresponding
  3695. audio signal.
  3696. This source accepts the following options:
  3697. @table @option
  3698. @item exprs
  3699. Set the '|'-separated expressions list for each separate channel. In case the
  3700. @option{channel_layout} option is not specified, the selected channel layout
  3701. depends on the number of provided expressions. Otherwise the last
  3702. specified expression is applied to the remaining output channels.
  3703. @item channel_layout, c
  3704. Set the channel layout. The number of channels in the specified layout
  3705. must be equal to the number of specified expressions.
  3706. @item duration, d
  3707. Set the minimum duration of the sourced audio. See
  3708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3709. for the accepted syntax.
  3710. Note that the resulting duration may be greater than the specified
  3711. duration, as the generated audio is always cut at the end of a
  3712. complete frame.
  3713. If not specified, or the expressed duration is negative, the audio is
  3714. supposed to be generated forever.
  3715. @item nb_samples, n
  3716. Set the number of samples per channel per each output frame,
  3717. default to 1024.
  3718. @item sample_rate, s
  3719. Specify the sample rate, default to 44100.
  3720. @end table
  3721. Each expression in @var{exprs} can contain the following constants:
  3722. @table @option
  3723. @item n
  3724. number of the evaluated sample, starting from 0
  3725. @item t
  3726. time of the evaluated sample expressed in seconds, starting from 0
  3727. @item s
  3728. sample rate
  3729. @end table
  3730. @subsection Examples
  3731. @itemize
  3732. @item
  3733. Generate silence:
  3734. @example
  3735. aevalsrc=0
  3736. @end example
  3737. @item
  3738. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3739. 8000 Hz:
  3740. @example
  3741. aevalsrc="sin(440*2*PI*t):s=8000"
  3742. @end example
  3743. @item
  3744. Generate a two channels signal, specify the channel layout (Front
  3745. Center + Back Center) explicitly:
  3746. @example
  3747. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3748. @end example
  3749. @item
  3750. Generate white noise:
  3751. @example
  3752. aevalsrc="-2+random(0)"
  3753. @end example
  3754. @item
  3755. Generate an amplitude modulated signal:
  3756. @example
  3757. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3758. @end example
  3759. @item
  3760. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3761. @example
  3762. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3763. @end example
  3764. @end itemize
  3765. @section anullsrc
  3766. The null audio source, return unprocessed audio frames. It is mainly useful
  3767. as a template and to be employed in analysis / debugging tools, or as
  3768. the source for filters which ignore the input data (for example the sox
  3769. synth filter).
  3770. This source accepts the following options:
  3771. @table @option
  3772. @item channel_layout, cl
  3773. Specifies the channel layout, and can be either an integer or a string
  3774. representing a channel layout. The default value of @var{channel_layout}
  3775. is "stereo".
  3776. Check the channel_layout_map definition in
  3777. @file{libavutil/channel_layout.c} for the mapping between strings and
  3778. channel layout values.
  3779. @item sample_rate, r
  3780. Specifies the sample rate, and defaults to 44100.
  3781. @item nb_samples, n
  3782. Set the number of samples per requested frames.
  3783. @end table
  3784. @subsection Examples
  3785. @itemize
  3786. @item
  3787. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3788. @example
  3789. anullsrc=r=48000:cl=4
  3790. @end example
  3791. @item
  3792. Do the same operation with a more obvious syntax:
  3793. @example
  3794. anullsrc=r=48000:cl=mono
  3795. @end example
  3796. @end itemize
  3797. All the parameters need to be explicitly defined.
  3798. @section flite
  3799. Synthesize a voice utterance using the libflite library.
  3800. To enable compilation of this filter you need to configure FFmpeg with
  3801. @code{--enable-libflite}.
  3802. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item list_voices
  3806. If set to 1, list the names of the available voices and exit
  3807. immediately. Default value is 0.
  3808. @item nb_samples, n
  3809. Set the maximum number of samples per frame. Default value is 512.
  3810. @item textfile
  3811. Set the filename containing the text to speak.
  3812. @item text
  3813. Set the text to speak.
  3814. @item voice, v
  3815. Set the voice to use for the speech synthesis. Default value is
  3816. @code{kal}. See also the @var{list_voices} option.
  3817. @end table
  3818. @subsection Examples
  3819. @itemize
  3820. @item
  3821. Read from file @file{speech.txt}, and synthesize the text using the
  3822. standard flite voice:
  3823. @example
  3824. flite=textfile=speech.txt
  3825. @end example
  3826. @item
  3827. Read the specified text selecting the @code{slt} voice:
  3828. @example
  3829. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3830. @end example
  3831. @item
  3832. Input text to ffmpeg:
  3833. @example
  3834. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3835. @end example
  3836. @item
  3837. Make @file{ffplay} speak the specified text, using @code{flite} and
  3838. the @code{lavfi} device:
  3839. @example
  3840. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3841. @end example
  3842. @end itemize
  3843. For more information about libflite, check:
  3844. @url{http://www.festvox.org/flite/}
  3845. @section anoisesrc
  3846. Generate a noise audio signal.
  3847. The filter accepts the following options:
  3848. @table @option
  3849. @item sample_rate, r
  3850. Specify the sample rate. Default value is 48000 Hz.
  3851. @item amplitude, a
  3852. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3853. is 1.0.
  3854. @item duration, d
  3855. Specify the duration of the generated audio stream. Not specifying this option
  3856. results in noise with an infinite length.
  3857. @item color, colour, c
  3858. Specify the color of noise. Available noise colors are white, pink, brown,
  3859. blue and violet. Default color is white.
  3860. @item seed, s
  3861. Specify a value used to seed the PRNG.
  3862. @item nb_samples, n
  3863. Set the number of samples per each output frame, default is 1024.
  3864. @end table
  3865. @subsection Examples
  3866. @itemize
  3867. @item
  3868. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3869. @example
  3870. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3871. @end example
  3872. @end itemize
  3873. @section hilbert
  3874. Generate odd-tap Hilbert transform FIR coefficients.
  3875. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3876. the signal by 90 degrees.
  3877. This is used in many matrix coding schemes and for analytic signal generation.
  3878. The process is often written as a multiplication by i (or j), the imaginary unit.
  3879. The filter accepts the following options:
  3880. @table @option
  3881. @item sample_rate, s
  3882. Set sample rate, default is 44100.
  3883. @item taps, t
  3884. Set length of FIR filter, default is 22051.
  3885. @item nb_samples, n
  3886. Set number of samples per each frame.
  3887. @item win_func, w
  3888. Set window function to be used when generating FIR coefficients.
  3889. @end table
  3890. @section sine
  3891. Generate an audio signal made of a sine wave with amplitude 1/8.
  3892. The audio signal is bit-exact.
  3893. The filter accepts the following options:
  3894. @table @option
  3895. @item frequency, f
  3896. Set the carrier frequency. Default is 440 Hz.
  3897. @item beep_factor, b
  3898. Enable a periodic beep every second with frequency @var{beep_factor} times
  3899. the carrier frequency. Default is 0, meaning the beep is disabled.
  3900. @item sample_rate, r
  3901. Specify the sample rate, default is 44100.
  3902. @item duration, d
  3903. Specify the duration of the generated audio stream.
  3904. @item samples_per_frame
  3905. Set the number of samples per output frame.
  3906. The expression can contain the following constants:
  3907. @table @option
  3908. @item n
  3909. The (sequential) number of the output audio frame, starting from 0.
  3910. @item pts
  3911. The PTS (Presentation TimeStamp) of the output audio frame,
  3912. expressed in @var{TB} units.
  3913. @item t
  3914. The PTS of the output audio frame, expressed in seconds.
  3915. @item TB
  3916. The timebase of the output audio frames.
  3917. @end table
  3918. Default is @code{1024}.
  3919. @end table
  3920. @subsection Examples
  3921. @itemize
  3922. @item
  3923. Generate a simple 440 Hz sine wave:
  3924. @example
  3925. sine
  3926. @end example
  3927. @item
  3928. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3929. @example
  3930. sine=220:4:d=5
  3931. sine=f=220:b=4:d=5
  3932. sine=frequency=220:beep_factor=4:duration=5
  3933. @end example
  3934. @item
  3935. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3936. pattern:
  3937. @example
  3938. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3939. @end example
  3940. @end itemize
  3941. @c man end AUDIO SOURCES
  3942. @chapter Audio Sinks
  3943. @c man begin AUDIO SINKS
  3944. Below is a description of the currently available audio sinks.
  3945. @section abuffersink
  3946. Buffer audio frames, and make them available to the end of filter chain.
  3947. This sink is mainly intended for programmatic use, in particular
  3948. through the interface defined in @file{libavfilter/buffersink.h}
  3949. or the options system.
  3950. It accepts a pointer to an AVABufferSinkContext structure, which
  3951. defines the incoming buffers' formats, to be passed as the opaque
  3952. parameter to @code{avfilter_init_filter} for initialization.
  3953. @section anullsink
  3954. Null audio sink; do absolutely nothing with the input audio. It is
  3955. mainly useful as a template and for use in analysis / debugging
  3956. tools.
  3957. @c man end AUDIO SINKS
  3958. @chapter Video Filters
  3959. @c man begin VIDEO FILTERS
  3960. When you configure your FFmpeg build, you can disable any of the
  3961. existing filters using @code{--disable-filters}.
  3962. The configure output will show the video filters included in your
  3963. build.
  3964. Below is a description of the currently available video filters.
  3965. @section alphaextract
  3966. Extract the alpha component from the input as a grayscale video. This
  3967. is especially useful with the @var{alphamerge} filter.
  3968. @section alphamerge
  3969. Add or replace the alpha component of the primary input with the
  3970. grayscale value of a second input. This is intended for use with
  3971. @var{alphaextract} to allow the transmission or storage of frame
  3972. sequences that have alpha in a format that doesn't support an alpha
  3973. channel.
  3974. For example, to reconstruct full frames from a normal YUV-encoded video
  3975. and a separate video created with @var{alphaextract}, you might use:
  3976. @example
  3977. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3978. @end example
  3979. Since this filter is designed for reconstruction, it operates on frame
  3980. sequences without considering timestamps, and terminates when either
  3981. input reaches end of stream. This will cause problems if your encoding
  3982. pipeline drops frames. If you're trying to apply an image as an
  3983. overlay to a video stream, consider the @var{overlay} filter instead.
  3984. @section ass
  3985. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3986. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3987. Substation Alpha) subtitles files.
  3988. This filter accepts the following option in addition to the common options from
  3989. the @ref{subtitles} filter:
  3990. @table @option
  3991. @item shaping
  3992. Set the shaping engine
  3993. Available values are:
  3994. @table @samp
  3995. @item auto
  3996. The default libass shaping engine, which is the best available.
  3997. @item simple
  3998. Fast, font-agnostic shaper that can do only substitutions
  3999. @item complex
  4000. Slower shaper using OpenType for substitutions and positioning
  4001. @end table
  4002. The default is @code{auto}.
  4003. @end table
  4004. @section atadenoise
  4005. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4006. The filter accepts the following options:
  4007. @table @option
  4008. @item 0a
  4009. Set threshold A for 1st plane. Default is 0.02.
  4010. Valid range is 0 to 0.3.
  4011. @item 0b
  4012. Set threshold B for 1st plane. Default is 0.04.
  4013. Valid range is 0 to 5.
  4014. @item 1a
  4015. Set threshold A for 2nd plane. Default is 0.02.
  4016. Valid range is 0 to 0.3.
  4017. @item 1b
  4018. Set threshold B for 2nd plane. Default is 0.04.
  4019. Valid range is 0 to 5.
  4020. @item 2a
  4021. Set threshold A for 3rd plane. Default is 0.02.
  4022. Valid range is 0 to 0.3.
  4023. @item 2b
  4024. Set threshold B for 3rd plane. Default is 0.04.
  4025. Valid range is 0 to 5.
  4026. Threshold A is designed to react on abrupt changes in the input signal and
  4027. threshold B is designed to react on continuous changes in the input signal.
  4028. @item s
  4029. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4030. number in range [5, 129].
  4031. @item p
  4032. Set what planes of frame filter will use for averaging. Default is all.
  4033. @end table
  4034. @section avgblur
  4035. Apply average blur filter.
  4036. The filter accepts the following options:
  4037. @table @option
  4038. @item sizeX
  4039. Set horizontal kernel size.
  4040. @item planes
  4041. Set which planes to filter. By default all planes are filtered.
  4042. @item sizeY
  4043. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4044. Default is @code{0}.
  4045. @end table
  4046. @section bbox
  4047. Compute the bounding box for the non-black pixels in the input frame
  4048. luminance plane.
  4049. This filter computes the bounding box containing all the pixels with a
  4050. luminance value greater than the minimum allowed value.
  4051. The parameters describing the bounding box are printed on the filter
  4052. log.
  4053. The filter accepts the following option:
  4054. @table @option
  4055. @item min_val
  4056. Set the minimal luminance value. Default is @code{16}.
  4057. @end table
  4058. @section bitplanenoise
  4059. Show and measure bit plane noise.
  4060. The filter accepts the following options:
  4061. @table @option
  4062. @item bitplane
  4063. Set which plane to analyze. Default is @code{1}.
  4064. @item filter
  4065. Filter out noisy pixels from @code{bitplane} set above.
  4066. Default is disabled.
  4067. @end table
  4068. @section blackdetect
  4069. Detect video intervals that are (almost) completely black. Can be
  4070. useful to detect chapter transitions, commercials, or invalid
  4071. recordings. Output lines contains the time for the start, end and
  4072. duration of the detected black interval expressed in seconds.
  4073. In order to display the output lines, you need to set the loglevel at
  4074. least to the AV_LOG_INFO value.
  4075. The filter accepts the following options:
  4076. @table @option
  4077. @item black_min_duration, d
  4078. Set the minimum detected black duration expressed in seconds. It must
  4079. be a non-negative floating point number.
  4080. Default value is 2.0.
  4081. @item picture_black_ratio_th, pic_th
  4082. Set the threshold for considering a picture "black".
  4083. Express the minimum value for the ratio:
  4084. @example
  4085. @var{nb_black_pixels} / @var{nb_pixels}
  4086. @end example
  4087. for which a picture is considered black.
  4088. Default value is 0.98.
  4089. @item pixel_black_th, pix_th
  4090. Set the threshold for considering a pixel "black".
  4091. The threshold expresses the maximum pixel luminance value for which a
  4092. pixel is considered "black". The provided value is scaled according to
  4093. the following equation:
  4094. @example
  4095. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4096. @end example
  4097. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4098. the input video format, the range is [0-255] for YUV full-range
  4099. formats and [16-235] for YUV non full-range formats.
  4100. Default value is 0.10.
  4101. @end table
  4102. The following example sets the maximum pixel threshold to the minimum
  4103. value, and detects only black intervals of 2 or more seconds:
  4104. @example
  4105. blackdetect=d=2:pix_th=0.00
  4106. @end example
  4107. @section blackframe
  4108. Detect frames that are (almost) completely black. Can be useful to
  4109. detect chapter transitions or commercials. Output lines consist of
  4110. the frame number of the detected frame, the percentage of blackness,
  4111. the position in the file if known or -1 and the timestamp in seconds.
  4112. In order to display the output lines, you need to set the loglevel at
  4113. least to the AV_LOG_INFO value.
  4114. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4115. The value represents the percentage of pixels in the picture that
  4116. are below the threshold value.
  4117. It accepts the following parameters:
  4118. @table @option
  4119. @item amount
  4120. The percentage of the pixels that have to be below the threshold; it defaults to
  4121. @code{98}.
  4122. @item threshold, thresh
  4123. The threshold below which a pixel value is considered black; it defaults to
  4124. @code{32}.
  4125. @end table
  4126. @section blend, tblend
  4127. Blend two video frames into each other.
  4128. The @code{blend} filter takes two input streams and outputs one
  4129. stream, the first input is the "top" layer and second input is
  4130. "bottom" layer. By default, the output terminates when the longest input terminates.
  4131. The @code{tblend} (time blend) filter takes two consecutive frames
  4132. from one single stream, and outputs the result obtained by blending
  4133. the new frame on top of the old frame.
  4134. A description of the accepted options follows.
  4135. @table @option
  4136. @item c0_mode
  4137. @item c1_mode
  4138. @item c2_mode
  4139. @item c3_mode
  4140. @item all_mode
  4141. Set blend mode for specific pixel component or all pixel components in case
  4142. of @var{all_mode}. Default value is @code{normal}.
  4143. Available values for component modes are:
  4144. @table @samp
  4145. @item addition
  4146. @item grainmerge
  4147. @item and
  4148. @item average
  4149. @item burn
  4150. @item darken
  4151. @item difference
  4152. @item grainextract
  4153. @item divide
  4154. @item dodge
  4155. @item freeze
  4156. @item exclusion
  4157. @item extremity
  4158. @item glow
  4159. @item hardlight
  4160. @item hardmix
  4161. @item heat
  4162. @item lighten
  4163. @item linearlight
  4164. @item multiply
  4165. @item multiply128
  4166. @item negation
  4167. @item normal
  4168. @item or
  4169. @item overlay
  4170. @item phoenix
  4171. @item pinlight
  4172. @item reflect
  4173. @item screen
  4174. @item softlight
  4175. @item subtract
  4176. @item vividlight
  4177. @item xor
  4178. @end table
  4179. @item c0_opacity
  4180. @item c1_opacity
  4181. @item c2_opacity
  4182. @item c3_opacity
  4183. @item all_opacity
  4184. Set blend opacity for specific pixel component or all pixel components in case
  4185. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4186. @item c0_expr
  4187. @item c1_expr
  4188. @item c2_expr
  4189. @item c3_expr
  4190. @item all_expr
  4191. Set blend expression for specific pixel component or all pixel components in case
  4192. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4193. The expressions can use the following variables:
  4194. @table @option
  4195. @item N
  4196. The sequential number of the filtered frame, starting from @code{0}.
  4197. @item X
  4198. @item Y
  4199. the coordinates of the current sample
  4200. @item W
  4201. @item H
  4202. the width and height of currently filtered plane
  4203. @item SW
  4204. @item SH
  4205. Width and height scale depending on the currently filtered plane. It is the
  4206. ratio between the corresponding luma plane number of pixels and the current
  4207. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4208. @code{0.5,0.5} for chroma planes.
  4209. @item T
  4210. Time of the current frame, expressed in seconds.
  4211. @item TOP, A
  4212. Value of pixel component at current location for first video frame (top layer).
  4213. @item BOTTOM, B
  4214. Value of pixel component at current location for second video frame (bottom layer).
  4215. @end table
  4216. @end table
  4217. The @code{blend} filter also supports the @ref{framesync} options.
  4218. @subsection Examples
  4219. @itemize
  4220. @item
  4221. Apply transition from bottom layer to top layer in first 10 seconds:
  4222. @example
  4223. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4224. @end example
  4225. @item
  4226. Apply linear horizontal transition from top layer to bottom layer:
  4227. @example
  4228. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4229. @end example
  4230. @item
  4231. Apply 1x1 checkerboard effect:
  4232. @example
  4233. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4234. @end example
  4235. @item
  4236. Apply uncover left effect:
  4237. @example
  4238. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4239. @end example
  4240. @item
  4241. Apply uncover down effect:
  4242. @example
  4243. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4244. @end example
  4245. @item
  4246. Apply uncover up-left effect:
  4247. @example
  4248. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4249. @end example
  4250. @item
  4251. Split diagonally video and shows top and bottom layer on each side:
  4252. @example
  4253. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4254. @end example
  4255. @item
  4256. Display differences between the current and the previous frame:
  4257. @example
  4258. tblend=all_mode=grainextract
  4259. @end example
  4260. @end itemize
  4261. @section boxblur
  4262. Apply a boxblur algorithm to the input video.
  4263. It accepts the following parameters:
  4264. @table @option
  4265. @item luma_radius, lr
  4266. @item luma_power, lp
  4267. @item chroma_radius, cr
  4268. @item chroma_power, cp
  4269. @item alpha_radius, ar
  4270. @item alpha_power, ap
  4271. @end table
  4272. A description of the accepted options follows.
  4273. @table @option
  4274. @item luma_radius, lr
  4275. @item chroma_radius, cr
  4276. @item alpha_radius, ar
  4277. Set an expression for the box radius in pixels used for blurring the
  4278. corresponding input plane.
  4279. The radius value must be a non-negative number, and must not be
  4280. greater than the value of the expression @code{min(w,h)/2} for the
  4281. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4282. planes.
  4283. Default value for @option{luma_radius} is "2". If not specified,
  4284. @option{chroma_radius} and @option{alpha_radius} default to the
  4285. corresponding value set for @option{luma_radius}.
  4286. The expressions can contain the following constants:
  4287. @table @option
  4288. @item w
  4289. @item h
  4290. The input width and height in pixels.
  4291. @item cw
  4292. @item ch
  4293. The input chroma image width and height in pixels.
  4294. @item hsub
  4295. @item vsub
  4296. The horizontal and vertical chroma subsample values. For example, for the
  4297. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4298. @end table
  4299. @item luma_power, lp
  4300. @item chroma_power, cp
  4301. @item alpha_power, ap
  4302. Specify how many times the boxblur filter is applied to the
  4303. corresponding plane.
  4304. Default value for @option{luma_power} is 2. If not specified,
  4305. @option{chroma_power} and @option{alpha_power} default to the
  4306. corresponding value set for @option{luma_power}.
  4307. A value of 0 will disable the effect.
  4308. @end table
  4309. @subsection Examples
  4310. @itemize
  4311. @item
  4312. Apply a boxblur filter with the luma, chroma, and alpha radii
  4313. set to 2:
  4314. @example
  4315. boxblur=luma_radius=2:luma_power=1
  4316. boxblur=2:1
  4317. @end example
  4318. @item
  4319. Set the luma radius to 2, and alpha and chroma radius to 0:
  4320. @example
  4321. boxblur=2:1:cr=0:ar=0
  4322. @end example
  4323. @item
  4324. Set the luma and chroma radii to a fraction of the video dimension:
  4325. @example
  4326. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4327. @end example
  4328. @end itemize
  4329. @section bwdif
  4330. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4331. Deinterlacing Filter").
  4332. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4333. interpolation algorithms.
  4334. It accepts the following parameters:
  4335. @table @option
  4336. @item mode
  4337. The interlacing mode to adopt. It accepts one of the following values:
  4338. @table @option
  4339. @item 0, send_frame
  4340. Output one frame for each frame.
  4341. @item 1, send_field
  4342. Output one frame for each field.
  4343. @end table
  4344. The default value is @code{send_field}.
  4345. @item parity
  4346. The picture field parity assumed for the input interlaced video. It accepts one
  4347. of the following values:
  4348. @table @option
  4349. @item 0, tff
  4350. Assume the top field is first.
  4351. @item 1, bff
  4352. Assume the bottom field is first.
  4353. @item -1, auto
  4354. Enable automatic detection of field parity.
  4355. @end table
  4356. The default value is @code{auto}.
  4357. If the interlacing is unknown or the decoder does not export this information,
  4358. top field first will be assumed.
  4359. @item deint
  4360. Specify which frames to deinterlace. Accept one of the following
  4361. values:
  4362. @table @option
  4363. @item 0, all
  4364. Deinterlace all frames.
  4365. @item 1, interlaced
  4366. Only deinterlace frames marked as interlaced.
  4367. @end table
  4368. The default value is @code{all}.
  4369. @end table
  4370. @section chromakey
  4371. YUV colorspace color/chroma keying.
  4372. The filter accepts the following options:
  4373. @table @option
  4374. @item color
  4375. The color which will be replaced with transparency.
  4376. @item similarity
  4377. Similarity percentage with the key color.
  4378. 0.01 matches only the exact key color, while 1.0 matches everything.
  4379. @item blend
  4380. Blend percentage.
  4381. 0.0 makes pixels either fully transparent, or not transparent at all.
  4382. Higher values result in semi-transparent pixels, with a higher transparency
  4383. the more similar the pixels color is to the key color.
  4384. @item yuv
  4385. Signals that the color passed is already in YUV instead of RGB.
  4386. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4387. This can be used to pass exact YUV values as hexadecimal numbers.
  4388. @end table
  4389. @subsection Examples
  4390. @itemize
  4391. @item
  4392. Make every green pixel in the input image transparent:
  4393. @example
  4394. ffmpeg -i input.png -vf chromakey=green out.png
  4395. @end example
  4396. @item
  4397. Overlay a greenscreen-video on top of a static black background.
  4398. @example
  4399. 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
  4400. @end example
  4401. @end itemize
  4402. @section ciescope
  4403. Display CIE color diagram with pixels overlaid onto it.
  4404. The filter accepts the following options:
  4405. @table @option
  4406. @item system
  4407. Set color system.
  4408. @table @samp
  4409. @item ntsc, 470m
  4410. @item ebu, 470bg
  4411. @item smpte
  4412. @item 240m
  4413. @item apple
  4414. @item widergb
  4415. @item cie1931
  4416. @item rec709, hdtv
  4417. @item uhdtv, rec2020
  4418. @end table
  4419. @item cie
  4420. Set CIE system.
  4421. @table @samp
  4422. @item xyy
  4423. @item ucs
  4424. @item luv
  4425. @end table
  4426. @item gamuts
  4427. Set what gamuts to draw.
  4428. See @code{system} option for available values.
  4429. @item size, s
  4430. Set ciescope size, by default set to 512.
  4431. @item intensity, i
  4432. Set intensity used to map input pixel values to CIE diagram.
  4433. @item contrast
  4434. Set contrast used to draw tongue colors that are out of active color system gamut.
  4435. @item corrgamma
  4436. Correct gamma displayed on scope, by default enabled.
  4437. @item showwhite
  4438. Show white point on CIE diagram, by default disabled.
  4439. @item gamma
  4440. Set input gamma. Used only with XYZ input color space.
  4441. @end table
  4442. @section codecview
  4443. Visualize information exported by some codecs.
  4444. Some codecs can export information through frames using side-data or other
  4445. means. For example, some MPEG based codecs export motion vectors through the
  4446. @var{export_mvs} flag in the codec @option{flags2} option.
  4447. The filter accepts the following option:
  4448. @table @option
  4449. @item mv
  4450. Set motion vectors to visualize.
  4451. Available flags for @var{mv} are:
  4452. @table @samp
  4453. @item pf
  4454. forward predicted MVs of P-frames
  4455. @item bf
  4456. forward predicted MVs of B-frames
  4457. @item bb
  4458. backward predicted MVs of B-frames
  4459. @end table
  4460. @item qp
  4461. Display quantization parameters using the chroma planes.
  4462. @item mv_type, mvt
  4463. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4464. Available flags for @var{mv_type} are:
  4465. @table @samp
  4466. @item fp
  4467. forward predicted MVs
  4468. @item bp
  4469. backward predicted MVs
  4470. @end table
  4471. @item frame_type, ft
  4472. Set frame type to visualize motion vectors of.
  4473. Available flags for @var{frame_type} are:
  4474. @table @samp
  4475. @item if
  4476. intra-coded frames (I-frames)
  4477. @item pf
  4478. predicted frames (P-frames)
  4479. @item bf
  4480. bi-directionally predicted frames (B-frames)
  4481. @end table
  4482. @end table
  4483. @subsection Examples
  4484. @itemize
  4485. @item
  4486. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4487. @example
  4488. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4489. @end example
  4490. @item
  4491. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4492. @example
  4493. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4494. @end example
  4495. @end itemize
  4496. @section colorbalance
  4497. Modify intensity of primary colors (red, green and blue) of input frames.
  4498. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4499. regions for the red-cyan, green-magenta or blue-yellow balance.
  4500. A positive adjustment value shifts the balance towards the primary color, a negative
  4501. value towards the complementary color.
  4502. The filter accepts the following options:
  4503. @table @option
  4504. @item rs
  4505. @item gs
  4506. @item bs
  4507. Adjust red, green and blue shadows (darkest pixels).
  4508. @item rm
  4509. @item gm
  4510. @item bm
  4511. Adjust red, green and blue midtones (medium pixels).
  4512. @item rh
  4513. @item gh
  4514. @item bh
  4515. Adjust red, green and blue highlights (brightest pixels).
  4516. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4517. @end table
  4518. @subsection Examples
  4519. @itemize
  4520. @item
  4521. Add red color cast to shadows:
  4522. @example
  4523. colorbalance=rs=.3
  4524. @end example
  4525. @end itemize
  4526. @section colorkey
  4527. RGB colorspace color keying.
  4528. The filter accepts the following options:
  4529. @table @option
  4530. @item color
  4531. The color which will be replaced with transparency.
  4532. @item similarity
  4533. Similarity percentage with the key color.
  4534. 0.01 matches only the exact key color, while 1.0 matches everything.
  4535. @item blend
  4536. Blend percentage.
  4537. 0.0 makes pixels either fully transparent, or not transparent at all.
  4538. Higher values result in semi-transparent pixels, with a higher transparency
  4539. the more similar the pixels color is to the key color.
  4540. @end table
  4541. @subsection Examples
  4542. @itemize
  4543. @item
  4544. Make every green pixel in the input image transparent:
  4545. @example
  4546. ffmpeg -i input.png -vf colorkey=green out.png
  4547. @end example
  4548. @item
  4549. Overlay a greenscreen-video on top of a static background image.
  4550. @example
  4551. 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
  4552. @end example
  4553. @end itemize
  4554. @section colorlevels
  4555. Adjust video input frames using levels.
  4556. The filter accepts the following options:
  4557. @table @option
  4558. @item rimin
  4559. @item gimin
  4560. @item bimin
  4561. @item aimin
  4562. Adjust red, green, blue and alpha input black point.
  4563. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4564. @item rimax
  4565. @item gimax
  4566. @item bimax
  4567. @item aimax
  4568. Adjust red, green, blue and alpha input white point.
  4569. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4570. Input levels are used to lighten highlights (bright tones), darken shadows
  4571. (dark tones), change the balance of bright and dark tones.
  4572. @item romin
  4573. @item gomin
  4574. @item bomin
  4575. @item aomin
  4576. Adjust red, green, blue and alpha output black point.
  4577. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4578. @item romax
  4579. @item gomax
  4580. @item bomax
  4581. @item aomax
  4582. Adjust red, green, blue and alpha output white point.
  4583. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4584. Output levels allows manual selection of a constrained output level range.
  4585. @end table
  4586. @subsection Examples
  4587. @itemize
  4588. @item
  4589. Make video output darker:
  4590. @example
  4591. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4592. @end example
  4593. @item
  4594. Increase contrast:
  4595. @example
  4596. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4597. @end example
  4598. @item
  4599. Make video output lighter:
  4600. @example
  4601. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4602. @end example
  4603. @item
  4604. Increase brightness:
  4605. @example
  4606. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4607. @end example
  4608. @end itemize
  4609. @section colorchannelmixer
  4610. Adjust video input frames by re-mixing color channels.
  4611. This filter modifies a color channel by adding the values associated to
  4612. the other channels of the same pixels. For example if the value to
  4613. modify is red, the output value will be:
  4614. @example
  4615. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4616. @end example
  4617. The filter accepts the following options:
  4618. @table @option
  4619. @item rr
  4620. @item rg
  4621. @item rb
  4622. @item ra
  4623. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4624. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4625. @item gr
  4626. @item gg
  4627. @item gb
  4628. @item ga
  4629. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4630. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4631. @item br
  4632. @item bg
  4633. @item bb
  4634. @item ba
  4635. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4636. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4637. @item ar
  4638. @item ag
  4639. @item ab
  4640. @item aa
  4641. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4642. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4643. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4644. @end table
  4645. @subsection Examples
  4646. @itemize
  4647. @item
  4648. Convert source to grayscale:
  4649. @example
  4650. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4651. @end example
  4652. @item
  4653. Simulate sepia tones:
  4654. @example
  4655. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4656. @end example
  4657. @end itemize
  4658. @section colormatrix
  4659. Convert color matrix.
  4660. The filter accepts the following options:
  4661. @table @option
  4662. @item src
  4663. @item dst
  4664. Specify the source and destination color matrix. Both values must be
  4665. specified.
  4666. The accepted values are:
  4667. @table @samp
  4668. @item bt709
  4669. BT.709
  4670. @item fcc
  4671. FCC
  4672. @item bt601
  4673. BT.601
  4674. @item bt470
  4675. BT.470
  4676. @item bt470bg
  4677. BT.470BG
  4678. @item smpte170m
  4679. SMPTE-170M
  4680. @item smpte240m
  4681. SMPTE-240M
  4682. @item bt2020
  4683. BT.2020
  4684. @end table
  4685. @end table
  4686. For example to convert from BT.601 to SMPTE-240M, use the command:
  4687. @example
  4688. colormatrix=bt601:smpte240m
  4689. @end example
  4690. @section colorspace
  4691. Convert colorspace, transfer characteristics or color primaries.
  4692. Input video needs to have an even size.
  4693. The filter accepts the following options:
  4694. @table @option
  4695. @anchor{all}
  4696. @item all
  4697. Specify all color properties at once.
  4698. The accepted values are:
  4699. @table @samp
  4700. @item bt470m
  4701. BT.470M
  4702. @item bt470bg
  4703. BT.470BG
  4704. @item bt601-6-525
  4705. BT.601-6 525
  4706. @item bt601-6-625
  4707. BT.601-6 625
  4708. @item bt709
  4709. BT.709
  4710. @item smpte170m
  4711. SMPTE-170M
  4712. @item smpte240m
  4713. SMPTE-240M
  4714. @item bt2020
  4715. BT.2020
  4716. @end table
  4717. @anchor{space}
  4718. @item space
  4719. Specify output colorspace.
  4720. The accepted values are:
  4721. @table @samp
  4722. @item bt709
  4723. BT.709
  4724. @item fcc
  4725. FCC
  4726. @item bt470bg
  4727. BT.470BG or BT.601-6 625
  4728. @item smpte170m
  4729. SMPTE-170M or BT.601-6 525
  4730. @item smpte240m
  4731. SMPTE-240M
  4732. @item ycgco
  4733. YCgCo
  4734. @item bt2020ncl
  4735. BT.2020 with non-constant luminance
  4736. @end table
  4737. @anchor{trc}
  4738. @item trc
  4739. Specify output transfer characteristics.
  4740. The accepted values are:
  4741. @table @samp
  4742. @item bt709
  4743. BT.709
  4744. @item bt470m
  4745. BT.470M
  4746. @item bt470bg
  4747. BT.470BG
  4748. @item gamma22
  4749. Constant gamma of 2.2
  4750. @item gamma28
  4751. Constant gamma of 2.8
  4752. @item smpte170m
  4753. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4754. @item smpte240m
  4755. SMPTE-240M
  4756. @item srgb
  4757. SRGB
  4758. @item iec61966-2-1
  4759. iec61966-2-1
  4760. @item iec61966-2-4
  4761. iec61966-2-4
  4762. @item xvycc
  4763. xvycc
  4764. @item bt2020-10
  4765. BT.2020 for 10-bits content
  4766. @item bt2020-12
  4767. BT.2020 for 12-bits content
  4768. @end table
  4769. @anchor{primaries}
  4770. @item primaries
  4771. Specify output color primaries.
  4772. The accepted values are:
  4773. @table @samp
  4774. @item bt709
  4775. BT.709
  4776. @item bt470m
  4777. BT.470M
  4778. @item bt470bg
  4779. BT.470BG or BT.601-6 625
  4780. @item smpte170m
  4781. SMPTE-170M or BT.601-6 525
  4782. @item smpte240m
  4783. SMPTE-240M
  4784. @item film
  4785. film
  4786. @item smpte431
  4787. SMPTE-431
  4788. @item smpte432
  4789. SMPTE-432
  4790. @item bt2020
  4791. BT.2020
  4792. @item jedec-p22
  4793. JEDEC P22 phosphors
  4794. @end table
  4795. @anchor{range}
  4796. @item range
  4797. Specify output color range.
  4798. The accepted values are:
  4799. @table @samp
  4800. @item tv
  4801. TV (restricted) range
  4802. @item mpeg
  4803. MPEG (restricted) range
  4804. @item pc
  4805. PC (full) range
  4806. @item jpeg
  4807. JPEG (full) range
  4808. @end table
  4809. @item format
  4810. Specify output color format.
  4811. The accepted values are:
  4812. @table @samp
  4813. @item yuv420p
  4814. YUV 4:2:0 planar 8-bits
  4815. @item yuv420p10
  4816. YUV 4:2:0 planar 10-bits
  4817. @item yuv420p12
  4818. YUV 4:2:0 planar 12-bits
  4819. @item yuv422p
  4820. YUV 4:2:2 planar 8-bits
  4821. @item yuv422p10
  4822. YUV 4:2:2 planar 10-bits
  4823. @item yuv422p12
  4824. YUV 4:2:2 planar 12-bits
  4825. @item yuv444p
  4826. YUV 4:4:4 planar 8-bits
  4827. @item yuv444p10
  4828. YUV 4:4:4 planar 10-bits
  4829. @item yuv444p12
  4830. YUV 4:4:4 planar 12-bits
  4831. @end table
  4832. @item fast
  4833. Do a fast conversion, which skips gamma/primary correction. This will take
  4834. significantly less CPU, but will be mathematically incorrect. To get output
  4835. compatible with that produced by the colormatrix filter, use fast=1.
  4836. @item dither
  4837. Specify dithering mode.
  4838. The accepted values are:
  4839. @table @samp
  4840. @item none
  4841. No dithering
  4842. @item fsb
  4843. Floyd-Steinberg dithering
  4844. @end table
  4845. @item wpadapt
  4846. Whitepoint adaptation mode.
  4847. The accepted values are:
  4848. @table @samp
  4849. @item bradford
  4850. Bradford whitepoint adaptation
  4851. @item vonkries
  4852. von Kries whitepoint adaptation
  4853. @item identity
  4854. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4855. @end table
  4856. @item iall
  4857. Override all input properties at once. Same accepted values as @ref{all}.
  4858. @item ispace
  4859. Override input colorspace. Same accepted values as @ref{space}.
  4860. @item iprimaries
  4861. Override input color primaries. Same accepted values as @ref{primaries}.
  4862. @item itrc
  4863. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4864. @item irange
  4865. Override input color range. Same accepted values as @ref{range}.
  4866. @end table
  4867. The filter converts the transfer characteristics, color space and color
  4868. primaries to the specified user values. The output value, if not specified,
  4869. is set to a default value based on the "all" property. If that property is
  4870. also not specified, the filter will log an error. The output color range and
  4871. format default to the same value as the input color range and format. The
  4872. input transfer characteristics, color space, color primaries and color range
  4873. should be set on the input data. If any of these are missing, the filter will
  4874. log an error and no conversion will take place.
  4875. For example to convert the input to SMPTE-240M, use the command:
  4876. @example
  4877. colorspace=smpte240m
  4878. @end example
  4879. @section convolution
  4880. Apply convolution 3x3, 5x5 or 7x7 filter.
  4881. The filter accepts the following options:
  4882. @table @option
  4883. @item 0m
  4884. @item 1m
  4885. @item 2m
  4886. @item 3m
  4887. Set matrix for each plane.
  4888. Matrix is sequence of 9, 25 or 49 signed integers.
  4889. @item 0rdiv
  4890. @item 1rdiv
  4891. @item 2rdiv
  4892. @item 3rdiv
  4893. Set multiplier for calculated value for each plane.
  4894. @item 0bias
  4895. @item 1bias
  4896. @item 2bias
  4897. @item 3bias
  4898. Set bias for each plane. This value is added to the result of the multiplication.
  4899. Useful for making the overall image brighter or darker. Default is 0.0.
  4900. @end table
  4901. @subsection Examples
  4902. @itemize
  4903. @item
  4904. Apply sharpen:
  4905. @example
  4906. 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"
  4907. @end example
  4908. @item
  4909. Apply blur:
  4910. @example
  4911. 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"
  4912. @end example
  4913. @item
  4914. Apply edge enhance:
  4915. @example
  4916. 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"
  4917. @end example
  4918. @item
  4919. Apply edge detect:
  4920. @example
  4921. 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"
  4922. @end example
  4923. @item
  4924. Apply laplacian edge detector which includes diagonals:
  4925. @example
  4926. 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"
  4927. @end example
  4928. @item
  4929. Apply emboss:
  4930. @example
  4931. 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"
  4932. @end example
  4933. @end itemize
  4934. @section convolve
  4935. Apply 2D convolution of video stream in frequency domain using second stream
  4936. as impulse.
  4937. The filter accepts the following options:
  4938. @table @option
  4939. @item planes
  4940. Set which planes to process.
  4941. @item impulse
  4942. Set which impulse video frames will be processed, can be @var{first}
  4943. or @var{all}. Default is @var{all}.
  4944. @end table
  4945. The @code{convolve} filter also supports the @ref{framesync} options.
  4946. @section copy
  4947. Copy the input video source unchanged to the output. This is mainly useful for
  4948. testing purposes.
  4949. @anchor{coreimage}
  4950. @section coreimage
  4951. Video filtering on GPU using Apple's CoreImage API on OSX.
  4952. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4953. processed by video hardware. However, software-based OpenGL implementations
  4954. exist which means there is no guarantee for hardware processing. It depends on
  4955. the respective OSX.
  4956. There are many filters and image generators provided by Apple that come with a
  4957. large variety of options. The filter has to be referenced by its name along
  4958. with its options.
  4959. The coreimage filter accepts the following options:
  4960. @table @option
  4961. @item list_filters
  4962. List all available filters and generators along with all their respective
  4963. options as well as possible minimum and maximum values along with the default
  4964. values.
  4965. @example
  4966. list_filters=true
  4967. @end example
  4968. @item filter
  4969. Specify all filters by their respective name and options.
  4970. Use @var{list_filters} to determine all valid filter names and options.
  4971. Numerical options are specified by a float value and are automatically clamped
  4972. to their respective value range. Vector and color options have to be specified
  4973. by a list of space separated float values. Character escaping has to be done.
  4974. A special option name @code{default} is available to use default options for a
  4975. filter.
  4976. It is required to specify either @code{default} or at least one of the filter options.
  4977. All omitted options are used with their default values.
  4978. The syntax of the filter string is as follows:
  4979. @example
  4980. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4981. @end example
  4982. @item output_rect
  4983. Specify a rectangle where the output of the filter chain is copied into the
  4984. input image. It is given by a list of space separated float values:
  4985. @example
  4986. output_rect=x\ y\ width\ height
  4987. @end example
  4988. If not given, the output rectangle equals the dimensions of the input image.
  4989. The output rectangle is automatically cropped at the borders of the input
  4990. image. Negative values are valid for each component.
  4991. @example
  4992. output_rect=25\ 25\ 100\ 100
  4993. @end example
  4994. @end table
  4995. Several filters can be chained for successive processing without GPU-HOST
  4996. transfers allowing for fast processing of complex filter chains.
  4997. Currently, only filters with zero (generators) or exactly one (filters) input
  4998. image and one output image are supported. Also, transition filters are not yet
  4999. usable as intended.
  5000. Some filters generate output images with additional padding depending on the
  5001. respective filter kernel. The padding is automatically removed to ensure the
  5002. filter output has the same size as the input image.
  5003. For image generators, the size of the output image is determined by the
  5004. previous output image of the filter chain or the input image of the whole
  5005. filterchain, respectively. The generators do not use the pixel information of
  5006. this image to generate their output. However, the generated output is
  5007. blended onto this image, resulting in partial or complete coverage of the
  5008. output image.
  5009. The @ref{coreimagesrc} video source can be used for generating input images
  5010. which are directly fed into the filter chain. By using it, providing input
  5011. images by another video source or an input video is not required.
  5012. @subsection Examples
  5013. @itemize
  5014. @item
  5015. List all filters available:
  5016. @example
  5017. coreimage=list_filters=true
  5018. @end example
  5019. @item
  5020. Use the CIBoxBlur filter with default options to blur an image:
  5021. @example
  5022. coreimage=filter=CIBoxBlur@@default
  5023. @end example
  5024. @item
  5025. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5026. its center at 100x100 and a radius of 50 pixels:
  5027. @example
  5028. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5029. @end example
  5030. @item
  5031. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5032. given as complete and escaped command-line for Apple's standard bash shell:
  5033. @example
  5034. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5035. @end example
  5036. @end itemize
  5037. @section crop
  5038. Crop the input video to given dimensions.
  5039. It accepts the following parameters:
  5040. @table @option
  5041. @item w, out_w
  5042. The width of the output video. It defaults to @code{iw}.
  5043. This expression is evaluated only once during the filter
  5044. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5045. @item h, out_h
  5046. The height of the output video. It defaults to @code{ih}.
  5047. This expression is evaluated only once during the filter
  5048. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5049. @item x
  5050. The horizontal position, in the input video, of the left edge of the output
  5051. video. It defaults to @code{(in_w-out_w)/2}.
  5052. This expression is evaluated per-frame.
  5053. @item y
  5054. The vertical position, in the input video, of the top edge of the output video.
  5055. It defaults to @code{(in_h-out_h)/2}.
  5056. This expression is evaluated per-frame.
  5057. @item keep_aspect
  5058. If set to 1 will force the output display aspect ratio
  5059. to be the same of the input, by changing the output sample aspect
  5060. ratio. It defaults to 0.
  5061. @item exact
  5062. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5063. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5064. It defaults to 0.
  5065. @end table
  5066. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5067. expressions containing the following constants:
  5068. @table @option
  5069. @item x
  5070. @item y
  5071. The computed values for @var{x} and @var{y}. They are evaluated for
  5072. each new frame.
  5073. @item in_w
  5074. @item in_h
  5075. The input width and height.
  5076. @item iw
  5077. @item ih
  5078. These are the same as @var{in_w} and @var{in_h}.
  5079. @item out_w
  5080. @item out_h
  5081. The output (cropped) width and height.
  5082. @item ow
  5083. @item oh
  5084. These are the same as @var{out_w} and @var{out_h}.
  5085. @item a
  5086. same as @var{iw} / @var{ih}
  5087. @item sar
  5088. input sample aspect ratio
  5089. @item dar
  5090. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5091. @item hsub
  5092. @item vsub
  5093. horizontal and vertical chroma subsample values. For example for the
  5094. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5095. @item n
  5096. The number of the input frame, starting from 0.
  5097. @item pos
  5098. the position in the file of the input frame, NAN if unknown
  5099. @item t
  5100. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5101. @end table
  5102. The expression for @var{out_w} may depend on the value of @var{out_h},
  5103. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5104. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5105. evaluated after @var{out_w} and @var{out_h}.
  5106. The @var{x} and @var{y} parameters specify the expressions for the
  5107. position of the top-left corner of the output (non-cropped) area. They
  5108. are evaluated for each frame. If the evaluated value is not valid, it
  5109. is approximated to the nearest valid value.
  5110. The expression for @var{x} may depend on @var{y}, and the expression
  5111. for @var{y} may depend on @var{x}.
  5112. @subsection Examples
  5113. @itemize
  5114. @item
  5115. Crop area with size 100x100 at position (12,34).
  5116. @example
  5117. crop=100:100:12:34
  5118. @end example
  5119. Using named options, the example above becomes:
  5120. @example
  5121. crop=w=100:h=100:x=12:y=34
  5122. @end example
  5123. @item
  5124. Crop the central input area with size 100x100:
  5125. @example
  5126. crop=100:100
  5127. @end example
  5128. @item
  5129. Crop the central input area with size 2/3 of the input video:
  5130. @example
  5131. crop=2/3*in_w:2/3*in_h
  5132. @end example
  5133. @item
  5134. Crop the input video central square:
  5135. @example
  5136. crop=out_w=in_h
  5137. crop=in_h
  5138. @end example
  5139. @item
  5140. Delimit the rectangle with the top-left corner placed at position
  5141. 100:100 and the right-bottom corner corresponding to the right-bottom
  5142. corner of the input image.
  5143. @example
  5144. crop=in_w-100:in_h-100:100:100
  5145. @end example
  5146. @item
  5147. Crop 10 pixels from the left and right borders, and 20 pixels from
  5148. the top and bottom borders
  5149. @example
  5150. crop=in_w-2*10:in_h-2*20
  5151. @end example
  5152. @item
  5153. Keep only the bottom right quarter of the input image:
  5154. @example
  5155. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5156. @end example
  5157. @item
  5158. Crop height for getting Greek harmony:
  5159. @example
  5160. crop=in_w:1/PHI*in_w
  5161. @end example
  5162. @item
  5163. Apply trembling effect:
  5164. @example
  5165. 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)
  5166. @end example
  5167. @item
  5168. Apply erratic camera effect depending on timestamp:
  5169. @example
  5170. 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)"
  5171. @end example
  5172. @item
  5173. Set x depending on the value of y:
  5174. @example
  5175. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5176. @end example
  5177. @end itemize
  5178. @subsection Commands
  5179. This filter supports the following commands:
  5180. @table @option
  5181. @item w, out_w
  5182. @item h, out_h
  5183. @item x
  5184. @item y
  5185. Set width/height of the output video and the horizontal/vertical position
  5186. in the input video.
  5187. The command accepts the same syntax of the corresponding option.
  5188. If the specified expression is not valid, it is kept at its current
  5189. value.
  5190. @end table
  5191. @section cropdetect
  5192. Auto-detect the crop size.
  5193. It calculates the necessary cropping parameters and prints the
  5194. recommended parameters via the logging system. The detected dimensions
  5195. correspond to the non-black area of the input video.
  5196. It accepts the following parameters:
  5197. @table @option
  5198. @item limit
  5199. Set higher black value threshold, which can be optionally specified
  5200. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5201. value greater to the set value is considered non-black. It defaults to 24.
  5202. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5203. on the bitdepth of the pixel format.
  5204. @item round
  5205. The value which the width/height should be divisible by. It defaults to
  5206. 16. The offset is automatically adjusted to center the video. Use 2 to
  5207. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5208. encoding to most video codecs.
  5209. @item reset_count, reset
  5210. Set the counter that determines after how many frames cropdetect will
  5211. reset the previously detected largest video area and start over to
  5212. detect the current optimal crop area. Default value is 0.
  5213. This can be useful when channel logos distort the video area. 0
  5214. indicates 'never reset', and returns the largest area encountered during
  5215. playback.
  5216. @end table
  5217. @anchor{curves}
  5218. @section curves
  5219. Apply color adjustments using curves.
  5220. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5221. component (red, green and blue) has its values defined by @var{N} key points
  5222. tied from each other using a smooth curve. The x-axis represents the pixel
  5223. values from the input frame, and the y-axis the new pixel values to be set for
  5224. the output frame.
  5225. By default, a component curve is defined by the two points @var{(0;0)} and
  5226. @var{(1;1)}. This creates a straight line where each original pixel value is
  5227. "adjusted" to its own value, which means no change to the image.
  5228. The filter allows you to redefine these two points and add some more. A new
  5229. curve (using a natural cubic spline interpolation) will be define to pass
  5230. smoothly through all these new coordinates. The new defined points needs to be
  5231. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5232. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5233. the vector spaces, the values will be clipped accordingly.
  5234. The filter accepts the following options:
  5235. @table @option
  5236. @item preset
  5237. Select one of the available color presets. This option can be used in addition
  5238. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5239. options takes priority on the preset values.
  5240. Available presets are:
  5241. @table @samp
  5242. @item none
  5243. @item color_negative
  5244. @item cross_process
  5245. @item darker
  5246. @item increase_contrast
  5247. @item lighter
  5248. @item linear_contrast
  5249. @item medium_contrast
  5250. @item negative
  5251. @item strong_contrast
  5252. @item vintage
  5253. @end table
  5254. Default is @code{none}.
  5255. @item master, m
  5256. Set the master key points. These points will define a second pass mapping. It
  5257. is sometimes called a "luminance" or "value" mapping. It can be used with
  5258. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5259. post-processing LUT.
  5260. @item red, r
  5261. Set the key points for the red component.
  5262. @item green, g
  5263. Set the key points for the green component.
  5264. @item blue, b
  5265. Set the key points for the blue component.
  5266. @item all
  5267. Set the key points for all components (not including master).
  5268. Can be used in addition to the other key points component
  5269. options. In this case, the unset component(s) will fallback on this
  5270. @option{all} setting.
  5271. @item psfile
  5272. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5273. @item plot
  5274. Save Gnuplot script of the curves in specified file.
  5275. @end table
  5276. To avoid some filtergraph syntax conflicts, each key points list need to be
  5277. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5278. @subsection Examples
  5279. @itemize
  5280. @item
  5281. Increase slightly the middle level of blue:
  5282. @example
  5283. curves=blue='0/0 0.5/0.58 1/1'
  5284. @end example
  5285. @item
  5286. Vintage effect:
  5287. @example
  5288. 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'
  5289. @end example
  5290. Here we obtain the following coordinates for each components:
  5291. @table @var
  5292. @item red
  5293. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5294. @item green
  5295. @code{(0;0) (0.50;0.48) (1;1)}
  5296. @item blue
  5297. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5298. @end table
  5299. @item
  5300. The previous example can also be achieved with the associated built-in preset:
  5301. @example
  5302. curves=preset=vintage
  5303. @end example
  5304. @item
  5305. Or simply:
  5306. @example
  5307. curves=vintage
  5308. @end example
  5309. @item
  5310. Use a Photoshop preset and redefine the points of the green component:
  5311. @example
  5312. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5313. @end example
  5314. @item
  5315. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5316. and @command{gnuplot}:
  5317. @example
  5318. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5319. gnuplot -p /tmp/curves.plt
  5320. @end example
  5321. @end itemize
  5322. @section datascope
  5323. Video data analysis filter.
  5324. This filter shows hexadecimal pixel values of part of video.
  5325. The filter accepts the following options:
  5326. @table @option
  5327. @item size, s
  5328. Set output video size.
  5329. @item x
  5330. Set x offset from where to pick pixels.
  5331. @item y
  5332. Set y offset from where to pick pixels.
  5333. @item mode
  5334. Set scope mode, can be one of the following:
  5335. @table @samp
  5336. @item mono
  5337. Draw hexadecimal pixel values with white color on black background.
  5338. @item color
  5339. Draw hexadecimal pixel values with input video pixel color on black
  5340. background.
  5341. @item color2
  5342. Draw hexadecimal pixel values on color background picked from input video,
  5343. the text color is picked in such way so its always visible.
  5344. @end table
  5345. @item axis
  5346. Draw rows and columns numbers on left and top of video.
  5347. @item opacity
  5348. Set background opacity.
  5349. @end table
  5350. @section dctdnoiz
  5351. Denoise frames using 2D DCT (frequency domain filtering).
  5352. This filter is not designed for real time.
  5353. The filter accepts the following options:
  5354. @table @option
  5355. @item sigma, s
  5356. Set the noise sigma constant.
  5357. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5358. coefficient (absolute value) below this threshold with be dropped.
  5359. If you need a more advanced filtering, see @option{expr}.
  5360. Default is @code{0}.
  5361. @item overlap
  5362. Set number overlapping pixels for each block. Since the filter can be slow, you
  5363. may want to reduce this value, at the cost of a less effective filter and the
  5364. risk of various artefacts.
  5365. If the overlapping value doesn't permit processing the whole input width or
  5366. height, a warning will be displayed and according borders won't be denoised.
  5367. Default value is @var{blocksize}-1, which is the best possible setting.
  5368. @item expr, e
  5369. Set the coefficient factor expression.
  5370. For each coefficient of a DCT block, this expression will be evaluated as a
  5371. multiplier value for the coefficient.
  5372. If this is option is set, the @option{sigma} option will be ignored.
  5373. The absolute value of the coefficient can be accessed through the @var{c}
  5374. variable.
  5375. @item n
  5376. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5377. @var{blocksize}, which is the width and height of the processed blocks.
  5378. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5379. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5380. on the speed processing. Also, a larger block size does not necessarily means a
  5381. better de-noising.
  5382. @end table
  5383. @subsection Examples
  5384. Apply a denoise with a @option{sigma} of @code{4.5}:
  5385. @example
  5386. dctdnoiz=4.5
  5387. @end example
  5388. The same operation can be achieved using the expression system:
  5389. @example
  5390. dctdnoiz=e='gte(c, 4.5*3)'
  5391. @end example
  5392. Violent denoise using a block size of @code{16x16}:
  5393. @example
  5394. dctdnoiz=15:n=4
  5395. @end example
  5396. @section deband
  5397. Remove banding artifacts from input video.
  5398. It works by replacing banded pixels with average value of referenced pixels.
  5399. The filter accepts the following options:
  5400. @table @option
  5401. @item 1thr
  5402. @item 2thr
  5403. @item 3thr
  5404. @item 4thr
  5405. Set banding detection threshold for each plane. Default is 0.02.
  5406. Valid range is 0.00003 to 0.5.
  5407. If difference between current pixel and reference pixel is less than threshold,
  5408. it will be considered as banded.
  5409. @item range, r
  5410. Banding detection range in pixels. Default is 16. If positive, random number
  5411. in range 0 to set value will be used. If negative, exact absolute value
  5412. will be used.
  5413. The range defines square of four pixels around current pixel.
  5414. @item direction, d
  5415. Set direction in radians from which four pixel will be compared. If positive,
  5416. random direction from 0 to set direction will be picked. If negative, exact of
  5417. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5418. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5419. column.
  5420. @item blur, b
  5421. If enabled, current pixel is compared with average value of all four
  5422. surrounding pixels. The default is enabled. If disabled current pixel is
  5423. compared with all four surrounding pixels. The pixel is considered banded
  5424. if only all four differences with surrounding pixels are less than threshold.
  5425. @item coupling, c
  5426. If enabled, current pixel is changed if and only if all pixel components are banded,
  5427. e.g. banding detection threshold is triggered for all color components.
  5428. The default is disabled.
  5429. @end table
  5430. @anchor{decimate}
  5431. @section decimate
  5432. Drop duplicated frames at regular intervals.
  5433. The filter accepts the following options:
  5434. @table @option
  5435. @item cycle
  5436. Set the number of frames from which one will be dropped. Setting this to
  5437. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5438. Default is @code{5}.
  5439. @item dupthresh
  5440. Set the threshold for duplicate detection. If the difference metric for a frame
  5441. is less than or equal to this value, then it is declared as duplicate. Default
  5442. is @code{1.1}
  5443. @item scthresh
  5444. Set scene change threshold. Default is @code{15}.
  5445. @item blockx
  5446. @item blocky
  5447. Set the size of the x and y-axis blocks used during metric calculations.
  5448. Larger blocks give better noise suppression, but also give worse detection of
  5449. small movements. Must be a power of two. Default is @code{32}.
  5450. @item ppsrc
  5451. Mark main input as a pre-processed input and activate clean source input
  5452. stream. This allows the input to be pre-processed with various filters to help
  5453. the metrics calculation while keeping the frame selection lossless. When set to
  5454. @code{1}, the first stream is for the pre-processed input, and the second
  5455. stream is the clean source from where the kept frames are chosen. Default is
  5456. @code{0}.
  5457. @item chroma
  5458. Set whether or not chroma is considered in the metric calculations. Default is
  5459. @code{1}.
  5460. @end table
  5461. @section deconvolve
  5462. Apply 2D deconvolution of video stream in frequency domain using second stream
  5463. as impulse.
  5464. The filter accepts the following options:
  5465. @table @option
  5466. @item planes
  5467. Set which planes to process.
  5468. @item impulse
  5469. Set which impulse video frames will be processed, can be @var{first}
  5470. or @var{all}. Default is @var{all}.
  5471. @item noise
  5472. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5473. and height are not same and not power of 2 or if stream prior to convolving
  5474. had noise.
  5475. @end table
  5476. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5477. @section deflate
  5478. Apply deflate effect to the video.
  5479. This filter replaces the pixel by the local(3x3) average by taking into account
  5480. only values lower than the pixel.
  5481. It accepts the following options:
  5482. @table @option
  5483. @item threshold0
  5484. @item threshold1
  5485. @item threshold2
  5486. @item threshold3
  5487. Limit the maximum change for each plane, default is 65535.
  5488. If 0, plane will remain unchanged.
  5489. @end table
  5490. @section deflicker
  5491. Remove temporal frame luminance variations.
  5492. It accepts the following options:
  5493. @table @option
  5494. @item size, s
  5495. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5496. @item mode, m
  5497. Set averaging mode to smooth temporal luminance variations.
  5498. Available values are:
  5499. @table @samp
  5500. @item am
  5501. Arithmetic mean
  5502. @item gm
  5503. Geometric mean
  5504. @item hm
  5505. Harmonic mean
  5506. @item qm
  5507. Quadratic mean
  5508. @item cm
  5509. Cubic mean
  5510. @item pm
  5511. Power mean
  5512. @item median
  5513. Median
  5514. @end table
  5515. @item bypass
  5516. Do not actually modify frame. Useful when one only wants metadata.
  5517. @end table
  5518. @section dejudder
  5519. Remove judder produced by partially interlaced telecined content.
  5520. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5521. source was partially telecined content then the output of @code{pullup,dejudder}
  5522. will have a variable frame rate. May change the recorded frame rate of the
  5523. container. Aside from that change, this filter will not affect constant frame
  5524. rate video.
  5525. The option available in this filter is:
  5526. @table @option
  5527. @item cycle
  5528. Specify the length of the window over which the judder repeats.
  5529. Accepts any integer greater than 1. Useful values are:
  5530. @table @samp
  5531. @item 4
  5532. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5533. @item 5
  5534. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5535. @item 20
  5536. If a mixture of the two.
  5537. @end table
  5538. The default is @samp{4}.
  5539. @end table
  5540. @section delogo
  5541. Suppress a TV station logo by a simple interpolation of the surrounding
  5542. pixels. Just set a rectangle covering the logo and watch it disappear
  5543. (and sometimes something even uglier appear - your mileage may vary).
  5544. It accepts the following parameters:
  5545. @table @option
  5546. @item x
  5547. @item y
  5548. Specify the top left corner coordinates of the logo. They must be
  5549. specified.
  5550. @item w
  5551. @item h
  5552. Specify the width and height of the logo to clear. They must be
  5553. specified.
  5554. @item band, t
  5555. Specify the thickness of the fuzzy edge of the rectangle (added to
  5556. @var{w} and @var{h}). The default value is 1. This option is
  5557. deprecated, setting higher values should no longer be necessary and
  5558. is not recommended.
  5559. @item show
  5560. When set to 1, a green rectangle is drawn on the screen to simplify
  5561. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5562. The default value is 0.
  5563. The rectangle is drawn on the outermost pixels which will be (partly)
  5564. replaced with interpolated values. The values of the next pixels
  5565. immediately outside this rectangle in each direction will be used to
  5566. compute the interpolated pixel values inside the rectangle.
  5567. @end table
  5568. @subsection Examples
  5569. @itemize
  5570. @item
  5571. Set a rectangle covering the area with top left corner coordinates 0,0
  5572. and size 100x77, and a band of size 10:
  5573. @example
  5574. delogo=x=0:y=0:w=100:h=77:band=10
  5575. @end example
  5576. @end itemize
  5577. @section deshake
  5578. Attempt to fix small changes in horizontal and/or vertical shift. This
  5579. filter helps remove camera shake from hand-holding a camera, bumping a
  5580. tripod, moving on a vehicle, etc.
  5581. The filter accepts the following options:
  5582. @table @option
  5583. @item x
  5584. @item y
  5585. @item w
  5586. @item h
  5587. Specify a rectangular area where to limit the search for motion
  5588. vectors.
  5589. If desired the search for motion vectors can be limited to a
  5590. rectangular area of the frame defined by its top left corner, width
  5591. and height. These parameters have the same meaning as the drawbox
  5592. filter which can be used to visualise the position of the bounding
  5593. box.
  5594. This is useful when simultaneous movement of subjects within the frame
  5595. might be confused for camera motion by the motion vector search.
  5596. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5597. then the full frame is used. This allows later options to be set
  5598. without specifying the bounding box for the motion vector search.
  5599. Default - search the whole frame.
  5600. @item rx
  5601. @item ry
  5602. Specify the maximum extent of movement in x and y directions in the
  5603. range 0-64 pixels. Default 16.
  5604. @item edge
  5605. Specify how to generate pixels to fill blanks at the edge of the
  5606. frame. Available values are:
  5607. @table @samp
  5608. @item blank, 0
  5609. Fill zeroes at blank locations
  5610. @item original, 1
  5611. Original image at blank locations
  5612. @item clamp, 2
  5613. Extruded edge value at blank locations
  5614. @item mirror, 3
  5615. Mirrored edge at blank locations
  5616. @end table
  5617. Default value is @samp{mirror}.
  5618. @item blocksize
  5619. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5620. default 8.
  5621. @item contrast
  5622. Specify the contrast threshold for blocks. Only blocks with more than
  5623. the specified contrast (difference between darkest and lightest
  5624. pixels) will be considered. Range 1-255, default 125.
  5625. @item search
  5626. Specify the search strategy. Available values are:
  5627. @table @samp
  5628. @item exhaustive, 0
  5629. Set exhaustive search
  5630. @item less, 1
  5631. Set less exhaustive search.
  5632. @end table
  5633. Default value is @samp{exhaustive}.
  5634. @item filename
  5635. If set then a detailed log of the motion search is written to the
  5636. specified file.
  5637. @end table
  5638. @section despill
  5639. Remove unwanted contamination of foreground colors, caused by reflected color of
  5640. greenscreen or bluescreen.
  5641. This filter accepts the following options:
  5642. @table @option
  5643. @item type
  5644. Set what type of despill to use.
  5645. @item mix
  5646. Set how spillmap will be generated.
  5647. @item expand
  5648. Set how much to get rid of still remaining spill.
  5649. @item red
  5650. Controls amount of red in spill area.
  5651. @item green
  5652. Controls amount of green in spill area.
  5653. Should be -1 for greenscreen.
  5654. @item blue
  5655. Controls amount of blue in spill area.
  5656. Should be -1 for bluescreen.
  5657. @item brightness
  5658. Controls brightness of spill area, preserving colors.
  5659. @item alpha
  5660. Modify alpha from generated spillmap.
  5661. @end table
  5662. @section detelecine
  5663. Apply an exact inverse of the telecine operation. It requires a predefined
  5664. pattern specified using the pattern option which must be the same as that passed
  5665. to the telecine filter.
  5666. This filter accepts the following options:
  5667. @table @option
  5668. @item first_field
  5669. @table @samp
  5670. @item top, t
  5671. top field first
  5672. @item bottom, b
  5673. bottom field first
  5674. The default value is @code{top}.
  5675. @end table
  5676. @item pattern
  5677. A string of numbers representing the pulldown pattern you wish to apply.
  5678. The default value is @code{23}.
  5679. @item start_frame
  5680. A number representing position of the first frame with respect to the telecine
  5681. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5682. @end table
  5683. @section dilation
  5684. Apply dilation effect to the video.
  5685. This filter replaces the pixel by the local(3x3) maximum.
  5686. It accepts the following options:
  5687. @table @option
  5688. @item threshold0
  5689. @item threshold1
  5690. @item threshold2
  5691. @item threshold3
  5692. Limit the maximum change for each plane, default is 65535.
  5693. If 0, plane will remain unchanged.
  5694. @item coordinates
  5695. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5696. pixels are used.
  5697. Flags to local 3x3 coordinates maps like this:
  5698. 1 2 3
  5699. 4 5
  5700. 6 7 8
  5701. @end table
  5702. @section displace
  5703. Displace pixels as indicated by second and third input stream.
  5704. It takes three input streams and outputs one stream, the first input is the
  5705. source, and second and third input are displacement maps.
  5706. The second input specifies how much to displace pixels along the
  5707. x-axis, while the third input specifies how much to displace pixels
  5708. along the y-axis.
  5709. If one of displacement map streams terminates, last frame from that
  5710. displacement map will be used.
  5711. Note that once generated, displacements maps can be reused over and over again.
  5712. A description of the accepted options follows.
  5713. @table @option
  5714. @item edge
  5715. Set displace behavior for pixels that are out of range.
  5716. Available values are:
  5717. @table @samp
  5718. @item blank
  5719. Missing pixels are replaced by black pixels.
  5720. @item smear
  5721. Adjacent pixels will spread out to replace missing pixels.
  5722. @item wrap
  5723. Out of range pixels are wrapped so they point to pixels of other side.
  5724. @item mirror
  5725. Out of range pixels will be replaced with mirrored pixels.
  5726. @end table
  5727. Default is @samp{smear}.
  5728. @end table
  5729. @subsection Examples
  5730. @itemize
  5731. @item
  5732. Add ripple effect to rgb input of video size hd720:
  5733. @example
  5734. 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
  5735. @end example
  5736. @item
  5737. Add wave effect to rgb input of video size hd720:
  5738. @example
  5739. 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
  5740. @end example
  5741. @end itemize
  5742. @section drawbox
  5743. Draw a colored box on the input image.
  5744. It accepts the following parameters:
  5745. @table @option
  5746. @item x
  5747. @item y
  5748. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5749. @item width, w
  5750. @item height, h
  5751. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5752. the input width and height. It defaults to 0.
  5753. @item color, c
  5754. Specify the color of the box to write. For the general syntax of this option,
  5755. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5756. value @code{invert} is used, the box edge color is the same as the
  5757. video with inverted luma.
  5758. @item thickness, t
  5759. The expression which sets the thickness of the box edge.
  5760. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5761. See below for the list of accepted constants.
  5762. @item replace
  5763. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5764. will overwrite the video's color and alpha pixels.
  5765. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5766. @end table
  5767. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5768. following constants:
  5769. @table @option
  5770. @item dar
  5771. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5772. @item hsub
  5773. @item vsub
  5774. horizontal and vertical chroma subsample values. For example for the
  5775. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5776. @item in_h, ih
  5777. @item in_w, iw
  5778. The input width and height.
  5779. @item sar
  5780. The input sample aspect ratio.
  5781. @item x
  5782. @item y
  5783. The x and y offset coordinates where the box is drawn.
  5784. @item w
  5785. @item h
  5786. The width and height of the drawn box.
  5787. @item t
  5788. The thickness of the drawn box.
  5789. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5790. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5791. @end table
  5792. @subsection Examples
  5793. @itemize
  5794. @item
  5795. Draw a black box around the edge of the input image:
  5796. @example
  5797. drawbox
  5798. @end example
  5799. @item
  5800. Draw a box with color red and an opacity of 50%:
  5801. @example
  5802. drawbox=10:20:200:60:red@@0.5
  5803. @end example
  5804. The previous example can be specified as:
  5805. @example
  5806. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5807. @end example
  5808. @item
  5809. Fill the box with pink color:
  5810. @example
  5811. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5812. @end example
  5813. @item
  5814. Draw a 2-pixel red 2.40:1 mask:
  5815. @example
  5816. 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
  5817. @end example
  5818. @end itemize
  5819. @section drawgrid
  5820. Draw a grid on the input image.
  5821. It accepts the following parameters:
  5822. @table @option
  5823. @item x
  5824. @item y
  5825. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5826. @item width, w
  5827. @item height, h
  5828. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5829. input width and height, respectively, minus @code{thickness}, so image gets
  5830. framed. Default to 0.
  5831. @item color, c
  5832. Specify the color of the grid. For the general syntax of this option,
  5833. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5834. value @code{invert} is used, the grid color is the same as the
  5835. video with inverted luma.
  5836. @item thickness, t
  5837. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5838. See below for the list of accepted constants.
  5839. @item replace
  5840. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5841. will overwrite the video's color and alpha pixels.
  5842. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5843. @end table
  5844. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5845. following constants:
  5846. @table @option
  5847. @item dar
  5848. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5849. @item hsub
  5850. @item vsub
  5851. horizontal and vertical chroma subsample values. For example for the
  5852. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5853. @item in_h, ih
  5854. @item in_w, iw
  5855. The input grid cell width and height.
  5856. @item sar
  5857. The input sample aspect ratio.
  5858. @item x
  5859. @item y
  5860. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5861. @item w
  5862. @item h
  5863. The width and height of the drawn cell.
  5864. @item t
  5865. The thickness of the drawn cell.
  5866. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5867. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5868. @end table
  5869. @subsection Examples
  5870. @itemize
  5871. @item
  5872. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5873. @example
  5874. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5875. @end example
  5876. @item
  5877. Draw a white 3x3 grid with an opacity of 50%:
  5878. @example
  5879. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5880. @end example
  5881. @end itemize
  5882. @anchor{drawtext}
  5883. @section drawtext
  5884. Draw a text string or text from a specified file on top of a video, using the
  5885. libfreetype library.
  5886. To enable compilation of this filter, you need to configure FFmpeg with
  5887. @code{--enable-libfreetype}.
  5888. To enable default font fallback and the @var{font} option you need to
  5889. configure FFmpeg with @code{--enable-libfontconfig}.
  5890. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5891. @code{--enable-libfribidi}.
  5892. @subsection Syntax
  5893. It accepts the following parameters:
  5894. @table @option
  5895. @item box
  5896. Used to draw a box around text using the background color.
  5897. The value must be either 1 (enable) or 0 (disable).
  5898. The default value of @var{box} is 0.
  5899. @item boxborderw
  5900. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5901. The default value of @var{boxborderw} is 0.
  5902. @item boxcolor
  5903. The color to be used for drawing box around text. For the syntax of this
  5904. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5905. The default value of @var{boxcolor} is "white".
  5906. @item line_spacing
  5907. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5908. The default value of @var{line_spacing} is 0.
  5909. @item borderw
  5910. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5911. The default value of @var{borderw} is 0.
  5912. @item bordercolor
  5913. Set the color to be used for drawing border around text. For the syntax of this
  5914. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5915. The default value of @var{bordercolor} is "black".
  5916. @item expansion
  5917. Select how the @var{text} is expanded. Can be either @code{none},
  5918. @code{strftime} (deprecated) or
  5919. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5920. below for details.
  5921. @item basetime
  5922. Set a start time for the count. Value is in microseconds. Only applied
  5923. in the deprecated strftime expansion mode. To emulate in normal expansion
  5924. mode use the @code{pts} function, supplying the start time (in seconds)
  5925. as the second argument.
  5926. @item fix_bounds
  5927. If true, check and fix text coords to avoid clipping.
  5928. @item fontcolor
  5929. The color to be used for drawing fonts. For the syntax of this option, check
  5930. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5931. The default value of @var{fontcolor} is "black".
  5932. @item fontcolor_expr
  5933. String which is expanded the same way as @var{text} to obtain dynamic
  5934. @var{fontcolor} value. By default this option has empty value and is not
  5935. processed. When this option is set, it overrides @var{fontcolor} option.
  5936. @item font
  5937. The font family to be used for drawing text. By default Sans.
  5938. @item fontfile
  5939. The font file to be used for drawing text. The path must be included.
  5940. This parameter is mandatory if the fontconfig support is disabled.
  5941. @item alpha
  5942. Draw the text applying alpha blending. The value can
  5943. be a number between 0.0 and 1.0.
  5944. The expression accepts the same variables @var{x, y} as well.
  5945. The default value is 1.
  5946. Please see @var{fontcolor_expr}.
  5947. @item fontsize
  5948. The font size to be used for drawing text.
  5949. The default value of @var{fontsize} is 16.
  5950. @item text_shaping
  5951. If set to 1, attempt to shape the text (for example, reverse the order of
  5952. right-to-left text and join Arabic characters) before drawing it.
  5953. Otherwise, just draw the text exactly as given.
  5954. By default 1 (if supported).
  5955. @item ft_load_flags
  5956. The flags to be used for loading the fonts.
  5957. The flags map the corresponding flags supported by libfreetype, and are
  5958. a combination of the following values:
  5959. @table @var
  5960. @item default
  5961. @item no_scale
  5962. @item no_hinting
  5963. @item render
  5964. @item no_bitmap
  5965. @item vertical_layout
  5966. @item force_autohint
  5967. @item crop_bitmap
  5968. @item pedantic
  5969. @item ignore_global_advance_width
  5970. @item no_recurse
  5971. @item ignore_transform
  5972. @item monochrome
  5973. @item linear_design
  5974. @item no_autohint
  5975. @end table
  5976. Default value is "default".
  5977. For more information consult the documentation for the FT_LOAD_*
  5978. libfreetype flags.
  5979. @item shadowcolor
  5980. The color to be used for drawing a shadow behind the drawn text. For the
  5981. syntax of this option, check the @ref{color syntax,,"Color" section in the
  5982. ffmpeg-utils manual,ffmpeg-utils}.
  5983. The default value of @var{shadowcolor} is "black".
  5984. @item shadowx
  5985. @item shadowy
  5986. The x and y offsets for the text shadow position with respect to the
  5987. position of the text. They can be either positive or negative
  5988. values. The default value for both is "0".
  5989. @item start_number
  5990. The starting frame number for the n/frame_num variable. The default value
  5991. is "0".
  5992. @item tabsize
  5993. The size in number of spaces to use for rendering the tab.
  5994. Default value is 4.
  5995. @item timecode
  5996. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5997. format. It can be used with or without text parameter. @var{timecode_rate}
  5998. option must be specified.
  5999. @item timecode_rate, rate, r
  6000. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6001. integer. Minimum value is "1".
  6002. Drop-frame timecode is supported for frame rates 30 & 60.
  6003. @item tc24hmax
  6004. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6005. Default is 0 (disabled).
  6006. @item text
  6007. The text string to be drawn. The text must be a sequence of UTF-8
  6008. encoded characters.
  6009. This parameter is mandatory if no file is specified with the parameter
  6010. @var{textfile}.
  6011. @item textfile
  6012. A text file containing text to be drawn. The text must be a sequence
  6013. of UTF-8 encoded characters.
  6014. This parameter is mandatory if no text string is specified with the
  6015. parameter @var{text}.
  6016. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6017. @item reload
  6018. If set to 1, the @var{textfile} will be reloaded before each frame.
  6019. Be sure to update it atomically, or it may be read partially, or even fail.
  6020. @item x
  6021. @item y
  6022. The expressions which specify the offsets where text will be drawn
  6023. within the video frame. They are relative to the top/left border of the
  6024. output image.
  6025. The default value of @var{x} and @var{y} is "0".
  6026. See below for the list of accepted constants and functions.
  6027. @end table
  6028. The parameters for @var{x} and @var{y} are expressions containing the
  6029. following constants and functions:
  6030. @table @option
  6031. @item dar
  6032. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6033. @item hsub
  6034. @item vsub
  6035. horizontal and vertical chroma subsample values. For example for the
  6036. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6037. @item line_h, lh
  6038. the height of each text line
  6039. @item main_h, h, H
  6040. the input height
  6041. @item main_w, w, W
  6042. the input width
  6043. @item max_glyph_a, ascent
  6044. the maximum distance from the baseline to the highest/upper grid
  6045. coordinate used to place a glyph outline point, for all the rendered
  6046. glyphs.
  6047. It is a positive value, due to the grid's orientation with the Y axis
  6048. upwards.
  6049. @item max_glyph_d, descent
  6050. the maximum distance from the baseline to the lowest grid coordinate
  6051. used to place a glyph outline point, for all the rendered glyphs.
  6052. This is a negative value, due to the grid's orientation, with the Y axis
  6053. upwards.
  6054. @item max_glyph_h
  6055. maximum glyph height, that is the maximum height for all the glyphs
  6056. contained in the rendered text, it is equivalent to @var{ascent} -
  6057. @var{descent}.
  6058. @item max_glyph_w
  6059. maximum glyph width, that is the maximum width for all the glyphs
  6060. contained in the rendered text
  6061. @item n
  6062. the number of input frame, starting from 0
  6063. @item rand(min, max)
  6064. return a random number included between @var{min} and @var{max}
  6065. @item sar
  6066. The input sample aspect ratio.
  6067. @item t
  6068. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6069. @item text_h, th
  6070. the height of the rendered text
  6071. @item text_w, tw
  6072. the width of the rendered text
  6073. @item x
  6074. @item y
  6075. the x and y offset coordinates where the text is drawn.
  6076. These parameters allow the @var{x} and @var{y} expressions to refer
  6077. each other, so you can for example specify @code{y=x/dar}.
  6078. @end table
  6079. @anchor{drawtext_expansion}
  6080. @subsection Text expansion
  6081. If @option{expansion} is set to @code{strftime},
  6082. the filter recognizes strftime() sequences in the provided text and
  6083. expands them accordingly. Check the documentation of strftime(). This
  6084. feature is deprecated.
  6085. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6086. If @option{expansion} is set to @code{normal} (which is the default),
  6087. the following expansion mechanism is used.
  6088. The backslash character @samp{\}, followed by any character, always expands to
  6089. the second character.
  6090. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6091. braces is a function name, possibly followed by arguments separated by ':'.
  6092. If the arguments contain special characters or delimiters (':' or '@}'),
  6093. they should be escaped.
  6094. Note that they probably must also be escaped as the value for the
  6095. @option{text} option in the filter argument string and as the filter
  6096. argument in the filtergraph description, and possibly also for the shell,
  6097. that makes up to four levels of escaping; using a text file avoids these
  6098. problems.
  6099. The following functions are available:
  6100. @table @command
  6101. @item expr, e
  6102. The expression evaluation result.
  6103. It must take one argument specifying the expression to be evaluated,
  6104. which accepts the same constants and functions as the @var{x} and
  6105. @var{y} values. Note that not all constants should be used, for
  6106. example the text size is not known when evaluating the expression, so
  6107. the constants @var{text_w} and @var{text_h} will have an undefined
  6108. value.
  6109. @item expr_int_format, eif
  6110. Evaluate the expression's value and output as formatted integer.
  6111. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6112. The second argument specifies the output format. Allowed values are @samp{x},
  6113. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6114. @code{printf} function.
  6115. The third parameter is optional and sets the number of positions taken by the output.
  6116. It can be used to add padding with zeros from the left.
  6117. @item gmtime
  6118. The time at which the filter is running, expressed in UTC.
  6119. It can accept an argument: a strftime() format string.
  6120. @item localtime
  6121. The time at which the filter is running, expressed in the local time zone.
  6122. It can accept an argument: a strftime() format string.
  6123. @item metadata
  6124. Frame metadata. Takes one or two arguments.
  6125. The first argument is mandatory and specifies the metadata key.
  6126. The second argument is optional and specifies a default value, used when the
  6127. metadata key is not found or empty.
  6128. @item n, frame_num
  6129. The frame number, starting from 0.
  6130. @item pict_type
  6131. A 1 character description of the current picture type.
  6132. @item pts
  6133. The timestamp of the current frame.
  6134. It can take up to three arguments.
  6135. The first argument is the format of the timestamp; it defaults to @code{flt}
  6136. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6137. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6138. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6139. @code{localtime} stands for the timestamp of the frame formatted as
  6140. local time zone time.
  6141. The second argument is an offset added to the timestamp.
  6142. If the format is set to @code{localtime} or @code{gmtime},
  6143. a third argument may be supplied: a strftime() format string.
  6144. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6145. @end table
  6146. @subsection Examples
  6147. @itemize
  6148. @item
  6149. Draw "Test Text" with font FreeSerif, using the default values for the
  6150. optional parameters.
  6151. @example
  6152. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6153. @end example
  6154. @item
  6155. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6156. and y=50 (counting from the top-left corner of the screen), text is
  6157. yellow with a red box around it. Both the text and the box have an
  6158. opacity of 20%.
  6159. @example
  6160. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6161. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6162. @end example
  6163. Note that the double quotes are not necessary if spaces are not used
  6164. within the parameter list.
  6165. @item
  6166. Show the text at the center of the video frame:
  6167. @example
  6168. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6169. @end example
  6170. @item
  6171. Show the text at a random position, switching to a new position every 30 seconds:
  6172. @example
  6173. 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)"
  6174. @end example
  6175. @item
  6176. Show a text line sliding from right to left in the last row of the video
  6177. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6178. with no newlines.
  6179. @example
  6180. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6181. @end example
  6182. @item
  6183. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6184. @example
  6185. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6186. @end example
  6187. @item
  6188. Draw a single green letter "g", at the center of the input video.
  6189. The glyph baseline is placed at half screen height.
  6190. @example
  6191. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6192. @end example
  6193. @item
  6194. Show text for 1 second every 3 seconds:
  6195. @example
  6196. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6197. @end example
  6198. @item
  6199. Use fontconfig to set the font. Note that the colons need to be escaped.
  6200. @example
  6201. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6202. @end example
  6203. @item
  6204. Print the date of a real-time encoding (see strftime(3)):
  6205. @example
  6206. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6207. @end example
  6208. @item
  6209. Show text fading in and out (appearing/disappearing):
  6210. @example
  6211. #!/bin/sh
  6212. DS=1.0 # display start
  6213. DE=10.0 # display end
  6214. FID=1.5 # fade in duration
  6215. FOD=5 # fade out duration
  6216. 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 @}"
  6217. @end example
  6218. @item
  6219. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6220. and the @option{fontsize} value are included in the @option{y} offset.
  6221. @example
  6222. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6223. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6224. @end example
  6225. @end itemize
  6226. For more information about libfreetype, check:
  6227. @url{http://www.freetype.org/}.
  6228. For more information about fontconfig, check:
  6229. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6230. For more information about libfribidi, check:
  6231. @url{http://fribidi.org/}.
  6232. @section edgedetect
  6233. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6234. The filter accepts the following options:
  6235. @table @option
  6236. @item low
  6237. @item high
  6238. Set low and high threshold values used by the Canny thresholding
  6239. algorithm.
  6240. The high threshold selects the "strong" edge pixels, which are then
  6241. connected through 8-connectivity with the "weak" edge pixels selected
  6242. by the low threshold.
  6243. @var{low} and @var{high} threshold values must be chosen in the range
  6244. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6245. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6246. is @code{50/255}.
  6247. @item mode
  6248. Define the drawing mode.
  6249. @table @samp
  6250. @item wires
  6251. Draw white/gray wires on black background.
  6252. @item colormix
  6253. Mix the colors to create a paint/cartoon effect.
  6254. @end table
  6255. Default value is @var{wires}.
  6256. @end table
  6257. @subsection Examples
  6258. @itemize
  6259. @item
  6260. Standard edge detection with custom values for the hysteresis thresholding:
  6261. @example
  6262. edgedetect=low=0.1:high=0.4
  6263. @end example
  6264. @item
  6265. Painting effect without thresholding:
  6266. @example
  6267. edgedetect=mode=colormix:high=0
  6268. @end example
  6269. @end itemize
  6270. @section eq
  6271. Set brightness, contrast, saturation and approximate gamma adjustment.
  6272. The filter accepts the following options:
  6273. @table @option
  6274. @item contrast
  6275. Set the contrast expression. The value must be a float value in range
  6276. @code{-2.0} to @code{2.0}. The default value is "1".
  6277. @item brightness
  6278. Set the brightness expression. The value must be a float value in
  6279. range @code{-1.0} to @code{1.0}. The default value is "0".
  6280. @item saturation
  6281. Set the saturation expression. The value must be a float in
  6282. range @code{0.0} to @code{3.0}. The default value is "1".
  6283. @item gamma
  6284. Set the gamma expression. The value must be a float in range
  6285. @code{0.1} to @code{10.0}. The default value is "1".
  6286. @item gamma_r
  6287. Set the gamma expression for red. The value must be a float in
  6288. range @code{0.1} to @code{10.0}. The default value is "1".
  6289. @item gamma_g
  6290. Set the gamma expression for green. The value must be a float in range
  6291. @code{0.1} to @code{10.0}. The default value is "1".
  6292. @item gamma_b
  6293. Set the gamma expression for blue. The value must be a float in range
  6294. @code{0.1} to @code{10.0}. The default value is "1".
  6295. @item gamma_weight
  6296. Set the gamma weight expression. It can be used to reduce the effect
  6297. of a high gamma value on bright image areas, e.g. keep them from
  6298. getting overamplified and just plain white. The value must be a float
  6299. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6300. gamma correction all the way down while @code{1.0} leaves it at its
  6301. full strength. Default is "1".
  6302. @item eval
  6303. Set when the expressions for brightness, contrast, saturation and
  6304. gamma expressions are evaluated.
  6305. It accepts the following values:
  6306. @table @samp
  6307. @item init
  6308. only evaluate expressions once during the filter initialization or
  6309. when a command is processed
  6310. @item frame
  6311. evaluate expressions for each incoming frame
  6312. @end table
  6313. Default value is @samp{init}.
  6314. @end table
  6315. The expressions accept the following parameters:
  6316. @table @option
  6317. @item n
  6318. frame count of the input frame starting from 0
  6319. @item pos
  6320. byte position of the corresponding packet in the input file, NAN if
  6321. unspecified
  6322. @item r
  6323. frame rate of the input video, NAN if the input frame rate is unknown
  6324. @item t
  6325. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6326. @end table
  6327. @subsection Commands
  6328. The filter supports the following commands:
  6329. @table @option
  6330. @item contrast
  6331. Set the contrast expression.
  6332. @item brightness
  6333. Set the brightness expression.
  6334. @item saturation
  6335. Set the saturation expression.
  6336. @item gamma
  6337. Set the gamma expression.
  6338. @item gamma_r
  6339. Set the gamma_r expression.
  6340. @item gamma_g
  6341. Set gamma_g expression.
  6342. @item gamma_b
  6343. Set gamma_b expression.
  6344. @item gamma_weight
  6345. Set gamma_weight expression.
  6346. The command accepts the same syntax of the corresponding option.
  6347. If the specified expression is not valid, it is kept at its current
  6348. value.
  6349. @end table
  6350. @section erosion
  6351. Apply erosion effect to the video.
  6352. This filter replaces the pixel by the local(3x3) minimum.
  6353. It accepts the following options:
  6354. @table @option
  6355. @item threshold0
  6356. @item threshold1
  6357. @item threshold2
  6358. @item threshold3
  6359. Limit the maximum change for each plane, default is 65535.
  6360. If 0, plane will remain unchanged.
  6361. @item coordinates
  6362. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6363. pixels are used.
  6364. Flags to local 3x3 coordinates maps like this:
  6365. 1 2 3
  6366. 4 5
  6367. 6 7 8
  6368. @end table
  6369. @section extractplanes
  6370. Extract color channel components from input video stream into
  6371. separate grayscale video streams.
  6372. The filter accepts the following option:
  6373. @table @option
  6374. @item planes
  6375. Set plane(s) to extract.
  6376. Available values for planes are:
  6377. @table @samp
  6378. @item y
  6379. @item u
  6380. @item v
  6381. @item a
  6382. @item r
  6383. @item g
  6384. @item b
  6385. @end table
  6386. Choosing planes not available in the input will result in an error.
  6387. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6388. with @code{y}, @code{u}, @code{v} planes at same time.
  6389. @end table
  6390. @subsection Examples
  6391. @itemize
  6392. @item
  6393. Extract luma, u and v color channel component from input video frame
  6394. into 3 grayscale outputs:
  6395. @example
  6396. 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
  6397. @end example
  6398. @end itemize
  6399. @section elbg
  6400. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6401. For each input image, the filter will compute the optimal mapping from
  6402. the input to the output given the codebook length, that is the number
  6403. of distinct output colors.
  6404. This filter accepts the following options.
  6405. @table @option
  6406. @item codebook_length, l
  6407. Set codebook length. The value must be a positive integer, and
  6408. represents the number of distinct output colors. Default value is 256.
  6409. @item nb_steps, n
  6410. Set the maximum number of iterations to apply for computing the optimal
  6411. mapping. The higher the value the better the result and the higher the
  6412. computation time. Default value is 1.
  6413. @item seed, s
  6414. Set a random seed, must be an integer included between 0 and
  6415. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6416. will try to use a good random seed on a best effort basis.
  6417. @item pal8
  6418. Set pal8 output pixel format. This option does not work with codebook
  6419. length greater than 256.
  6420. @end table
  6421. @section entropy
  6422. Measure graylevel entropy in histogram of color channels of video frames.
  6423. It accepts the following parameters:
  6424. @table @option
  6425. @item mode
  6426. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6427. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6428. between neighbour histogram values.
  6429. @end table
  6430. @section fade
  6431. Apply a fade-in/out effect to the input video.
  6432. It accepts the following parameters:
  6433. @table @option
  6434. @item type, t
  6435. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6436. effect.
  6437. Default is @code{in}.
  6438. @item start_frame, s
  6439. Specify the number of the frame to start applying the fade
  6440. effect at. Default is 0.
  6441. @item nb_frames, n
  6442. The number of frames that the fade effect lasts. At the end of the
  6443. fade-in effect, the output video will have the same intensity as the input video.
  6444. At the end of the fade-out transition, the output video will be filled with the
  6445. selected @option{color}.
  6446. Default is 25.
  6447. @item alpha
  6448. If set to 1, fade only alpha channel, if one exists on the input.
  6449. Default value is 0.
  6450. @item start_time, st
  6451. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6452. effect. If both start_frame and start_time are specified, the fade will start at
  6453. whichever comes last. Default is 0.
  6454. @item duration, d
  6455. The number of seconds for which the fade effect has to last. At the end of the
  6456. fade-in effect the output video will have the same intensity as the input video,
  6457. at the end of the fade-out transition the output video will be filled with the
  6458. selected @option{color}.
  6459. If both duration and nb_frames are specified, duration is used. Default is 0
  6460. (nb_frames is used by default).
  6461. @item color, c
  6462. Specify the color of the fade. Default is "black".
  6463. @end table
  6464. @subsection Examples
  6465. @itemize
  6466. @item
  6467. Fade in the first 30 frames of video:
  6468. @example
  6469. fade=in:0:30
  6470. @end example
  6471. The command above is equivalent to:
  6472. @example
  6473. fade=t=in:s=0:n=30
  6474. @end example
  6475. @item
  6476. Fade out the last 45 frames of a 200-frame video:
  6477. @example
  6478. fade=out:155:45
  6479. fade=type=out:start_frame=155:nb_frames=45
  6480. @end example
  6481. @item
  6482. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6483. @example
  6484. fade=in:0:25, fade=out:975:25
  6485. @end example
  6486. @item
  6487. Make the first 5 frames yellow, then fade in from frame 5-24:
  6488. @example
  6489. fade=in:5:20:color=yellow
  6490. @end example
  6491. @item
  6492. Fade in alpha over first 25 frames of video:
  6493. @example
  6494. fade=in:0:25:alpha=1
  6495. @end example
  6496. @item
  6497. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6498. @example
  6499. fade=t=in:st=5.5:d=0.5
  6500. @end example
  6501. @end itemize
  6502. @section fftfilt
  6503. Apply arbitrary expressions to samples in frequency domain
  6504. @table @option
  6505. @item dc_Y
  6506. Adjust the dc value (gain) of the luma plane of the image. The filter
  6507. accepts an integer value in range @code{0} to @code{1000}. The default
  6508. value is set to @code{0}.
  6509. @item dc_U
  6510. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6511. filter accepts an integer value in range @code{0} to @code{1000}. The
  6512. default value is set to @code{0}.
  6513. @item dc_V
  6514. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6515. filter accepts an integer value in range @code{0} to @code{1000}. The
  6516. default value is set to @code{0}.
  6517. @item weight_Y
  6518. Set the frequency domain weight expression for the luma plane.
  6519. @item weight_U
  6520. Set the frequency domain weight expression for the 1st chroma plane.
  6521. @item weight_V
  6522. Set the frequency domain weight expression for the 2nd chroma plane.
  6523. @item eval
  6524. Set when the expressions are evaluated.
  6525. It accepts the following values:
  6526. @table @samp
  6527. @item init
  6528. Only evaluate expressions once during the filter initialization.
  6529. @item frame
  6530. Evaluate expressions for each incoming frame.
  6531. @end table
  6532. Default value is @samp{init}.
  6533. The filter accepts the following variables:
  6534. @item X
  6535. @item Y
  6536. The coordinates of the current sample.
  6537. @item W
  6538. @item H
  6539. The width and height of the image.
  6540. @item N
  6541. The number of input frame, starting from 0.
  6542. @end table
  6543. @subsection Examples
  6544. @itemize
  6545. @item
  6546. High-pass:
  6547. @example
  6548. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6549. @end example
  6550. @item
  6551. Low-pass:
  6552. @example
  6553. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6554. @end example
  6555. @item
  6556. Sharpen:
  6557. @example
  6558. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6559. @end example
  6560. @item
  6561. Blur:
  6562. @example
  6563. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6564. @end example
  6565. @end itemize
  6566. @section field
  6567. Extract a single field from an interlaced image using stride
  6568. arithmetic to avoid wasting CPU time. The output frames are marked as
  6569. non-interlaced.
  6570. The filter accepts the following options:
  6571. @table @option
  6572. @item type
  6573. Specify whether to extract the top (if the value is @code{0} or
  6574. @code{top}) or the bottom field (if the value is @code{1} or
  6575. @code{bottom}).
  6576. @end table
  6577. @section fieldhint
  6578. Create new frames by copying the top and bottom fields from surrounding frames
  6579. supplied as numbers by the hint file.
  6580. @table @option
  6581. @item hint
  6582. Set file containing hints: absolute/relative frame numbers.
  6583. There must be one line for each frame in a clip. Each line must contain two
  6584. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6585. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6586. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6587. for @code{relative} mode. First number tells from which frame to pick up top
  6588. field and second number tells from which frame to pick up bottom field.
  6589. If optionally followed by @code{+} output frame will be marked as interlaced,
  6590. else if followed by @code{-} output frame will be marked as progressive, else
  6591. it will be marked same as input frame.
  6592. If line starts with @code{#} or @code{;} that line is skipped.
  6593. @item mode
  6594. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6595. @end table
  6596. Example of first several lines of @code{hint} file for @code{relative} mode:
  6597. @example
  6598. 0,0 - # first frame
  6599. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6600. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6601. 1,0 -
  6602. 0,0 -
  6603. 0,0 -
  6604. 1,0 -
  6605. 1,0 -
  6606. 1,0 -
  6607. 0,0 -
  6608. 0,0 -
  6609. 1,0 -
  6610. 1,0 -
  6611. 1,0 -
  6612. 0,0 -
  6613. @end example
  6614. @section fieldmatch
  6615. Field matching filter for inverse telecine. It is meant to reconstruct the
  6616. progressive frames from a telecined stream. The filter does not drop duplicated
  6617. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6618. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6619. The separation of the field matching and the decimation is notably motivated by
  6620. the possibility of inserting a de-interlacing filter fallback between the two.
  6621. If the source has mixed telecined and real interlaced content,
  6622. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6623. But these remaining combed frames will be marked as interlaced, and thus can be
  6624. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6625. In addition to the various configuration options, @code{fieldmatch} can take an
  6626. optional second stream, activated through the @option{ppsrc} option. If
  6627. enabled, the frames reconstruction will be based on the fields and frames from
  6628. this second stream. This allows the first input to be pre-processed in order to
  6629. help the various algorithms of the filter, while keeping the output lossless
  6630. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6631. or brightness/contrast adjustments can help.
  6632. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6633. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6634. which @code{fieldmatch} is based on. While the semantic and usage are very
  6635. close, some behaviour and options names can differ.
  6636. The @ref{decimate} filter currently only works for constant frame rate input.
  6637. If your input has mixed telecined (30fps) and progressive content with a lower
  6638. framerate like 24fps use the following filterchain to produce the necessary cfr
  6639. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6640. The filter accepts the following options:
  6641. @table @option
  6642. @item order
  6643. Specify the assumed field order of the input stream. Available values are:
  6644. @table @samp
  6645. @item auto
  6646. Auto detect parity (use FFmpeg's internal parity value).
  6647. @item bff
  6648. Assume bottom field first.
  6649. @item tff
  6650. Assume top field first.
  6651. @end table
  6652. Note that it is sometimes recommended not to trust the parity announced by the
  6653. stream.
  6654. Default value is @var{auto}.
  6655. @item mode
  6656. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6657. sense that it won't risk creating jerkiness due to duplicate frames when
  6658. possible, but if there are bad edits or blended fields it will end up
  6659. outputting combed frames when a good match might actually exist. On the other
  6660. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6661. but will almost always find a good frame if there is one. The other values are
  6662. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6663. jerkiness and creating duplicate frames versus finding good matches in sections
  6664. with bad edits, orphaned fields, blended fields, etc.
  6665. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6666. Available values are:
  6667. @table @samp
  6668. @item pc
  6669. 2-way matching (p/c)
  6670. @item pc_n
  6671. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6672. @item pc_u
  6673. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6674. @item pc_n_ub
  6675. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6676. still combed (p/c + n + u/b)
  6677. @item pcn
  6678. 3-way matching (p/c/n)
  6679. @item pcn_ub
  6680. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6681. detected as combed (p/c/n + u/b)
  6682. @end table
  6683. The parenthesis at the end indicate the matches that would be used for that
  6684. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6685. @var{top}).
  6686. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6687. the slowest.
  6688. Default value is @var{pc_n}.
  6689. @item ppsrc
  6690. Mark the main input stream as a pre-processed input, and enable the secondary
  6691. input stream as the clean source to pick the fields from. See the filter
  6692. introduction for more details. It is similar to the @option{clip2} feature from
  6693. VFM/TFM.
  6694. Default value is @code{0} (disabled).
  6695. @item field
  6696. Set the field to match from. It is recommended to set this to the same value as
  6697. @option{order} unless you experience matching failures with that setting. In
  6698. certain circumstances changing the field that is used to match from can have a
  6699. large impact on matching performance. Available values are:
  6700. @table @samp
  6701. @item auto
  6702. Automatic (same value as @option{order}).
  6703. @item bottom
  6704. Match from the bottom field.
  6705. @item top
  6706. Match from the top field.
  6707. @end table
  6708. Default value is @var{auto}.
  6709. @item mchroma
  6710. Set whether or not chroma is included during the match comparisons. In most
  6711. cases it is recommended to leave this enabled. You should set this to @code{0}
  6712. only if your clip has bad chroma problems such as heavy rainbowing or other
  6713. artifacts. Setting this to @code{0} could also be used to speed things up at
  6714. the cost of some accuracy.
  6715. Default value is @code{1}.
  6716. @item y0
  6717. @item y1
  6718. These define an exclusion band which excludes the lines between @option{y0} and
  6719. @option{y1} from being included in the field matching decision. An exclusion
  6720. band can be used to ignore subtitles, a logo, or other things that may
  6721. interfere with the matching. @option{y0} sets the starting scan line and
  6722. @option{y1} sets the ending line; all lines in between @option{y0} and
  6723. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6724. @option{y0} and @option{y1} to the same value will disable the feature.
  6725. @option{y0} and @option{y1} defaults to @code{0}.
  6726. @item scthresh
  6727. Set the scene change detection threshold as a percentage of maximum change on
  6728. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6729. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6730. @option{scthresh} is @code{[0.0, 100.0]}.
  6731. Default value is @code{12.0}.
  6732. @item combmatch
  6733. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6734. account the combed scores of matches when deciding what match to use as the
  6735. final match. Available values are:
  6736. @table @samp
  6737. @item none
  6738. No final matching based on combed scores.
  6739. @item sc
  6740. Combed scores are only used when a scene change is detected.
  6741. @item full
  6742. Use combed scores all the time.
  6743. @end table
  6744. Default is @var{sc}.
  6745. @item combdbg
  6746. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6747. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6748. Available values are:
  6749. @table @samp
  6750. @item none
  6751. No forced calculation.
  6752. @item pcn
  6753. Force p/c/n calculations.
  6754. @item pcnub
  6755. Force p/c/n/u/b calculations.
  6756. @end table
  6757. Default value is @var{none}.
  6758. @item cthresh
  6759. This is the area combing threshold used for combed frame detection. This
  6760. essentially controls how "strong" or "visible" combing must be to be detected.
  6761. Larger values mean combing must be more visible and smaller values mean combing
  6762. can be less visible or strong and still be detected. Valid settings are from
  6763. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6764. be detected as combed). This is basically a pixel difference value. A good
  6765. range is @code{[8, 12]}.
  6766. Default value is @code{9}.
  6767. @item chroma
  6768. Sets whether or not chroma is considered in the combed frame decision. Only
  6769. disable this if your source has chroma problems (rainbowing, etc.) that are
  6770. causing problems for the combed frame detection with chroma enabled. Actually,
  6771. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6772. where there is chroma only combing in the source.
  6773. Default value is @code{0}.
  6774. @item blockx
  6775. @item blocky
  6776. Respectively set the x-axis and y-axis size of the window used during combed
  6777. frame detection. This has to do with the size of the area in which
  6778. @option{combpel} pixels are required to be detected as combed for a frame to be
  6779. declared combed. See the @option{combpel} parameter description for more info.
  6780. Possible values are any number that is a power of 2 starting at 4 and going up
  6781. to 512.
  6782. Default value is @code{16}.
  6783. @item combpel
  6784. The number of combed pixels inside any of the @option{blocky} by
  6785. @option{blockx} size blocks on the frame for the frame to be detected as
  6786. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6787. setting controls "how much" combing there must be in any localized area (a
  6788. window defined by the @option{blockx} and @option{blocky} settings) on the
  6789. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6790. which point no frames will ever be detected as combed). This setting is known
  6791. as @option{MI} in TFM/VFM vocabulary.
  6792. Default value is @code{80}.
  6793. @end table
  6794. @anchor{p/c/n/u/b meaning}
  6795. @subsection p/c/n/u/b meaning
  6796. @subsubsection p/c/n
  6797. We assume the following telecined stream:
  6798. @example
  6799. Top fields: 1 2 2 3 4
  6800. Bottom fields: 1 2 3 4 4
  6801. @end example
  6802. The numbers correspond to the progressive frame the fields relate to. Here, the
  6803. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6804. When @code{fieldmatch} is configured to run a matching from bottom
  6805. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6806. @example
  6807. Input stream:
  6808. T 1 2 2 3 4
  6809. B 1 2 3 4 4 <-- matching reference
  6810. Matches: c c n n c
  6811. Output stream:
  6812. T 1 2 3 4 4
  6813. B 1 2 3 4 4
  6814. @end example
  6815. As a result of the field matching, we can see that some frames get duplicated.
  6816. To perform a complete inverse telecine, you need to rely on a decimation filter
  6817. after this operation. See for instance the @ref{decimate} filter.
  6818. The same operation now matching from top fields (@option{field}=@var{top})
  6819. looks like this:
  6820. @example
  6821. Input stream:
  6822. T 1 2 2 3 4 <-- matching reference
  6823. B 1 2 3 4 4
  6824. Matches: c c p p c
  6825. Output stream:
  6826. T 1 2 2 3 4
  6827. B 1 2 2 3 4
  6828. @end example
  6829. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6830. basically, they refer to the frame and field of the opposite parity:
  6831. @itemize
  6832. @item @var{p} matches the field of the opposite parity in the previous frame
  6833. @item @var{c} matches the field of the opposite parity in the current frame
  6834. @item @var{n} matches the field of the opposite parity in the next frame
  6835. @end itemize
  6836. @subsubsection u/b
  6837. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6838. from the opposite parity flag. In the following examples, we assume that we are
  6839. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6840. 'x' is placed above and below each matched fields.
  6841. With bottom matching (@option{field}=@var{bottom}):
  6842. @example
  6843. Match: c p n b u
  6844. x x x x x
  6845. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6846. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6847. x x x x x
  6848. Output frames:
  6849. 2 1 2 2 2
  6850. 2 2 2 1 3
  6851. @end example
  6852. With top matching (@option{field}=@var{top}):
  6853. @example
  6854. Match: c p n b u
  6855. x x x x x
  6856. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6857. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6858. x x x x x
  6859. Output frames:
  6860. 2 2 2 1 2
  6861. 2 1 3 2 2
  6862. @end example
  6863. @subsection Examples
  6864. Simple IVTC of a top field first telecined stream:
  6865. @example
  6866. fieldmatch=order=tff:combmatch=none, decimate
  6867. @end example
  6868. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6869. @example
  6870. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6871. @end example
  6872. @section fieldorder
  6873. Transform the field order of the input video.
  6874. It accepts the following parameters:
  6875. @table @option
  6876. @item order
  6877. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6878. for bottom field first.
  6879. @end table
  6880. The default value is @samp{tff}.
  6881. The transformation is done by shifting the picture content up or down
  6882. by one line, and filling the remaining line with appropriate picture content.
  6883. This method is consistent with most broadcast field order converters.
  6884. If the input video is not flagged as being interlaced, or it is already
  6885. flagged as being of the required output field order, then this filter does
  6886. not alter the incoming video.
  6887. It is very useful when converting to or from PAL DV material,
  6888. which is bottom field first.
  6889. For example:
  6890. @example
  6891. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6892. @end example
  6893. @section fifo, afifo
  6894. Buffer input images and send them when they are requested.
  6895. It is mainly useful when auto-inserted by the libavfilter
  6896. framework.
  6897. It does not take parameters.
  6898. @section fillborders
  6899. Fill borders of the input video, without changing video stream dimensions.
  6900. Sometimes video can have garbage at the four edges and you may not want to
  6901. crop video input to keep size multiple of some number.
  6902. This filter accepts the following options:
  6903. @table @option
  6904. @item left
  6905. Number of pixels to fill from left border.
  6906. @item right
  6907. Number of pixels to fill from right border.
  6908. @item top
  6909. Number of pixels to fill from top border.
  6910. @item bottom
  6911. Number of pixels to fill from bottom border.
  6912. @item mode
  6913. Set fill mode.
  6914. It accepts the following values:
  6915. @table @samp
  6916. @item smear
  6917. fill pixels using outermost pixels
  6918. @item mirror
  6919. fill pixels using mirroring
  6920. @item fixed
  6921. fill pixels with constant value
  6922. @end table
  6923. Default is @var{smear}.
  6924. @item color
  6925. Set color for pixels in fixed mode. Default is @var{black}.
  6926. @end table
  6927. @section find_rect
  6928. Find a rectangular object
  6929. It accepts the following options:
  6930. @table @option
  6931. @item object
  6932. Filepath of the object image, needs to be in gray8.
  6933. @item threshold
  6934. Detection threshold, default is 0.5.
  6935. @item mipmaps
  6936. Number of mipmaps, default is 3.
  6937. @item xmin, ymin, xmax, ymax
  6938. Specifies the rectangle in which to search.
  6939. @end table
  6940. @subsection Examples
  6941. @itemize
  6942. @item
  6943. Generate a representative palette of a given video using @command{ffmpeg}:
  6944. @example
  6945. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6946. @end example
  6947. @end itemize
  6948. @section cover_rect
  6949. Cover a rectangular object
  6950. It accepts the following options:
  6951. @table @option
  6952. @item cover
  6953. Filepath of the optional cover image, needs to be in yuv420.
  6954. @item mode
  6955. Set covering mode.
  6956. It accepts the following values:
  6957. @table @samp
  6958. @item cover
  6959. cover it by the supplied image
  6960. @item blur
  6961. cover it by interpolating the surrounding pixels
  6962. @end table
  6963. Default value is @var{blur}.
  6964. @end table
  6965. @subsection Examples
  6966. @itemize
  6967. @item
  6968. Generate a representative palette of a given video using @command{ffmpeg}:
  6969. @example
  6970. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6971. @end example
  6972. @end itemize
  6973. @section floodfill
  6974. Flood area with values of same pixel components with another values.
  6975. It accepts the following options:
  6976. @table @option
  6977. @item x
  6978. Set pixel x coordinate.
  6979. @item y
  6980. Set pixel y coordinate.
  6981. @item s0
  6982. Set source #0 component value.
  6983. @item s1
  6984. Set source #1 component value.
  6985. @item s2
  6986. Set source #2 component value.
  6987. @item s3
  6988. Set source #3 component value.
  6989. @item d0
  6990. Set destination #0 component value.
  6991. @item d1
  6992. Set destination #1 component value.
  6993. @item d2
  6994. Set destination #2 component value.
  6995. @item d3
  6996. Set destination #3 component value.
  6997. @end table
  6998. @anchor{format}
  6999. @section format
  7000. Convert the input video to one of the specified pixel formats.
  7001. Libavfilter will try to pick one that is suitable as input to
  7002. the next filter.
  7003. It accepts the following parameters:
  7004. @table @option
  7005. @item pix_fmts
  7006. A '|'-separated list of pixel format names, such as
  7007. "pix_fmts=yuv420p|monow|rgb24".
  7008. @end table
  7009. @subsection Examples
  7010. @itemize
  7011. @item
  7012. Convert the input video to the @var{yuv420p} format
  7013. @example
  7014. format=pix_fmts=yuv420p
  7015. @end example
  7016. Convert the input video to any of the formats in the list
  7017. @example
  7018. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7019. @end example
  7020. @end itemize
  7021. @anchor{fps}
  7022. @section fps
  7023. Convert the video to specified constant frame rate by duplicating or dropping
  7024. frames as necessary.
  7025. It accepts the following parameters:
  7026. @table @option
  7027. @item fps
  7028. The desired output frame rate. The default is @code{25}.
  7029. @item start_time
  7030. Assume the first PTS should be the given value, in seconds. This allows for
  7031. padding/trimming at the start of stream. By default, no assumption is made
  7032. about the first frame's expected PTS, so no padding or trimming is done.
  7033. For example, this could be set to 0 to pad the beginning with duplicates of
  7034. the first frame if a video stream starts after the audio stream or to trim any
  7035. frames with a negative PTS.
  7036. @item round
  7037. Timestamp (PTS) rounding method.
  7038. Possible values are:
  7039. @table @option
  7040. @item zero
  7041. round towards 0
  7042. @item inf
  7043. round away from 0
  7044. @item down
  7045. round towards -infinity
  7046. @item up
  7047. round towards +infinity
  7048. @item near
  7049. round to nearest
  7050. @end table
  7051. The default is @code{near}.
  7052. @item eof_action
  7053. Action performed when reading the last frame.
  7054. Possible values are:
  7055. @table @option
  7056. @item round
  7057. Use same timestamp rounding method as used for other frames.
  7058. @item pass
  7059. Pass through last frame if input duration has not been reached yet.
  7060. @end table
  7061. The default is @code{round}.
  7062. @end table
  7063. Alternatively, the options can be specified as a flat string:
  7064. @var{fps}[:@var{start_time}[:@var{round}]].
  7065. See also the @ref{setpts} filter.
  7066. @subsection Examples
  7067. @itemize
  7068. @item
  7069. A typical usage in order to set the fps to 25:
  7070. @example
  7071. fps=fps=25
  7072. @end example
  7073. @item
  7074. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7075. @example
  7076. fps=fps=film:round=near
  7077. @end example
  7078. @end itemize
  7079. @section framepack
  7080. Pack two different video streams into a stereoscopic video, setting proper
  7081. metadata on supported codecs. The two views should have the same size and
  7082. framerate and processing will stop when the shorter video ends. Please note
  7083. that you may conveniently adjust view properties with the @ref{scale} and
  7084. @ref{fps} filters.
  7085. It accepts the following parameters:
  7086. @table @option
  7087. @item format
  7088. The desired packing format. Supported values are:
  7089. @table @option
  7090. @item sbs
  7091. The views are next to each other (default).
  7092. @item tab
  7093. The views are on top of each other.
  7094. @item lines
  7095. The views are packed by line.
  7096. @item columns
  7097. The views are packed by column.
  7098. @item frameseq
  7099. The views are temporally interleaved.
  7100. @end table
  7101. @end table
  7102. Some examples:
  7103. @example
  7104. # Convert left and right views into a frame-sequential video
  7105. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7106. # Convert views into a side-by-side video with the same output resolution as the input
  7107. 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
  7108. @end example
  7109. @section framerate
  7110. Change the frame rate by interpolating new video output frames from the source
  7111. frames.
  7112. This filter is not designed to function correctly with interlaced media. If
  7113. you wish to change the frame rate of interlaced media then you are required
  7114. to deinterlace before this filter and re-interlace after this filter.
  7115. A description of the accepted options follows.
  7116. @table @option
  7117. @item fps
  7118. Specify the output frames per second. This option can also be specified
  7119. as a value alone. The default is @code{50}.
  7120. @item interp_start
  7121. Specify the start of a range where the output frame will be created as a
  7122. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7123. the default is @code{15}.
  7124. @item interp_end
  7125. Specify the end of a range where the output frame will be created as a
  7126. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7127. the default is @code{240}.
  7128. @item scene
  7129. Specify the level at which a scene change is detected as a value between
  7130. 0 and 100 to indicate a new scene; a low value reflects a low
  7131. probability for the current frame to introduce a new scene, while a higher
  7132. value means the current frame is more likely to be one.
  7133. The default is @code{8.2}.
  7134. @item flags
  7135. Specify flags influencing the filter process.
  7136. Available value for @var{flags} is:
  7137. @table @option
  7138. @item scene_change_detect, scd
  7139. Enable scene change detection using the value of the option @var{scene}.
  7140. This flag is enabled by default.
  7141. @end table
  7142. @end table
  7143. @section framestep
  7144. Select one frame every N-th frame.
  7145. This filter accepts the following option:
  7146. @table @option
  7147. @item step
  7148. Select frame after every @code{step} frames.
  7149. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7150. @end table
  7151. @anchor{frei0r}
  7152. @section frei0r
  7153. Apply a frei0r effect to the input video.
  7154. To enable the compilation of this filter, you need to install the frei0r
  7155. header and configure FFmpeg with @code{--enable-frei0r}.
  7156. It accepts the following parameters:
  7157. @table @option
  7158. @item filter_name
  7159. The name of the frei0r effect to load. If the environment variable
  7160. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7161. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7162. Otherwise, the standard frei0r paths are searched, in this order:
  7163. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7164. @file{/usr/lib/frei0r-1/}.
  7165. @item filter_params
  7166. A '|'-separated list of parameters to pass to the frei0r effect.
  7167. @end table
  7168. A frei0r effect parameter can be a boolean (its value is either
  7169. "y" or "n"), a double, a color (specified as
  7170. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7171. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7172. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7173. a position (specified as @var{X}/@var{Y}, where
  7174. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7175. The number and types of parameters depend on the loaded effect. If an
  7176. effect parameter is not specified, the default value is set.
  7177. @subsection Examples
  7178. @itemize
  7179. @item
  7180. Apply the distort0r effect, setting the first two double parameters:
  7181. @example
  7182. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7183. @end example
  7184. @item
  7185. Apply the colordistance effect, taking a color as the first parameter:
  7186. @example
  7187. frei0r=colordistance:0.2/0.3/0.4
  7188. frei0r=colordistance:violet
  7189. frei0r=colordistance:0x112233
  7190. @end example
  7191. @item
  7192. Apply the perspective effect, specifying the top left and top right image
  7193. positions:
  7194. @example
  7195. frei0r=perspective:0.2/0.2|0.8/0.2
  7196. @end example
  7197. @end itemize
  7198. For more information, see
  7199. @url{http://frei0r.dyne.org}
  7200. @section fspp
  7201. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7202. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7203. processing filter, one of them is performed once per block, not per pixel.
  7204. This allows for much higher speed.
  7205. The filter accepts the following options:
  7206. @table @option
  7207. @item quality
  7208. Set quality. This option defines the number of levels for averaging. It accepts
  7209. an integer in the range 4-5. Default value is @code{4}.
  7210. @item qp
  7211. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7212. If not set, the filter will use the QP from the video stream (if available).
  7213. @item strength
  7214. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7215. more details but also more artifacts, while higher values make the image smoother
  7216. but also blurrier. Default value is @code{0} − PSNR optimal.
  7217. @item use_bframe_qp
  7218. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7219. option may cause flicker since the B-Frames have often larger QP. Default is
  7220. @code{0} (not enabled).
  7221. @end table
  7222. @section gblur
  7223. Apply Gaussian blur filter.
  7224. The filter accepts the following options:
  7225. @table @option
  7226. @item sigma
  7227. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7228. @item steps
  7229. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7230. @item planes
  7231. Set which planes to filter. By default all planes are filtered.
  7232. @item sigmaV
  7233. Set vertical sigma, if negative it will be same as @code{sigma}.
  7234. Default is @code{-1}.
  7235. @end table
  7236. @section geq
  7237. The filter accepts the following options:
  7238. @table @option
  7239. @item lum_expr, lum
  7240. Set the luminance expression.
  7241. @item cb_expr, cb
  7242. Set the chrominance blue expression.
  7243. @item cr_expr, cr
  7244. Set the chrominance red expression.
  7245. @item alpha_expr, a
  7246. Set the alpha expression.
  7247. @item red_expr, r
  7248. Set the red expression.
  7249. @item green_expr, g
  7250. Set the green expression.
  7251. @item blue_expr, b
  7252. Set the blue expression.
  7253. @end table
  7254. The colorspace is selected according to the specified options. If one
  7255. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7256. options is specified, the filter will automatically select a YCbCr
  7257. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7258. @option{blue_expr} options is specified, it will select an RGB
  7259. colorspace.
  7260. If one of the chrominance expression is not defined, it falls back on the other
  7261. one. If no alpha expression is specified it will evaluate to opaque value.
  7262. If none of chrominance expressions are specified, they will evaluate
  7263. to the luminance expression.
  7264. The expressions can use the following variables and functions:
  7265. @table @option
  7266. @item N
  7267. The sequential number of the filtered frame, starting from @code{0}.
  7268. @item X
  7269. @item Y
  7270. The coordinates of the current sample.
  7271. @item W
  7272. @item H
  7273. The width and height of the image.
  7274. @item SW
  7275. @item SH
  7276. Width and height scale depending on the currently filtered plane. It is the
  7277. ratio between the corresponding luma plane number of pixels and the current
  7278. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7279. @code{0.5,0.5} for chroma planes.
  7280. @item T
  7281. Time of the current frame, expressed in seconds.
  7282. @item p(x, y)
  7283. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7284. plane.
  7285. @item lum(x, y)
  7286. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7287. plane.
  7288. @item cb(x, y)
  7289. Return the value of the pixel at location (@var{x},@var{y}) of the
  7290. blue-difference chroma plane. Return 0 if there is no such plane.
  7291. @item cr(x, y)
  7292. Return the value of the pixel at location (@var{x},@var{y}) of the
  7293. red-difference chroma plane. Return 0 if there is no such plane.
  7294. @item r(x, y)
  7295. @item g(x, y)
  7296. @item b(x, y)
  7297. Return the value of the pixel at location (@var{x},@var{y}) of the
  7298. red/green/blue component. Return 0 if there is no such component.
  7299. @item alpha(x, y)
  7300. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7301. plane. Return 0 if there is no such plane.
  7302. @end table
  7303. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7304. automatically clipped to the closer edge.
  7305. @subsection Examples
  7306. @itemize
  7307. @item
  7308. Flip the image horizontally:
  7309. @example
  7310. geq=p(W-X\,Y)
  7311. @end example
  7312. @item
  7313. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7314. wavelength of 100 pixels:
  7315. @example
  7316. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7317. @end example
  7318. @item
  7319. Generate a fancy enigmatic moving light:
  7320. @example
  7321. 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
  7322. @end example
  7323. @item
  7324. Generate a quick emboss effect:
  7325. @example
  7326. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7327. @end example
  7328. @item
  7329. Modify RGB components depending on pixel position:
  7330. @example
  7331. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7332. @end example
  7333. @item
  7334. Create a radial gradient that is the same size as the input (also see
  7335. the @ref{vignette} filter):
  7336. @example
  7337. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7338. @end example
  7339. @end itemize
  7340. @section gradfun
  7341. Fix the banding artifacts that are sometimes introduced into nearly flat
  7342. regions by truncation to 8-bit color depth.
  7343. Interpolate the gradients that should go where the bands are, and
  7344. dither them.
  7345. It is designed for playback only. Do not use it prior to
  7346. lossy compression, because compression tends to lose the dither and
  7347. bring back the bands.
  7348. It accepts the following parameters:
  7349. @table @option
  7350. @item strength
  7351. The maximum amount by which the filter will change any one pixel. This is also
  7352. the threshold for detecting nearly flat regions. Acceptable values range from
  7353. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7354. valid range.
  7355. @item radius
  7356. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7357. gradients, but also prevents the filter from modifying the pixels near detailed
  7358. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7359. values will be clipped to the valid range.
  7360. @end table
  7361. Alternatively, the options can be specified as a flat string:
  7362. @var{strength}[:@var{radius}]
  7363. @subsection Examples
  7364. @itemize
  7365. @item
  7366. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7367. @example
  7368. gradfun=3.5:8
  7369. @end example
  7370. @item
  7371. Specify radius, omitting the strength (which will fall-back to the default
  7372. value):
  7373. @example
  7374. gradfun=radius=8
  7375. @end example
  7376. @end itemize
  7377. @anchor{haldclut}
  7378. @section haldclut
  7379. Apply a Hald CLUT to a video stream.
  7380. First input is the video stream to process, and second one is the Hald CLUT.
  7381. The Hald CLUT input can be a simple picture or a complete video stream.
  7382. The filter accepts the following options:
  7383. @table @option
  7384. @item shortest
  7385. Force termination when the shortest input terminates. Default is @code{0}.
  7386. @item repeatlast
  7387. Continue applying the last CLUT after the end of the stream. A value of
  7388. @code{0} disable the filter after the last frame of the CLUT is reached.
  7389. Default is @code{1}.
  7390. @end table
  7391. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7392. filters share the same internals).
  7393. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7394. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7395. @subsection Workflow examples
  7396. @subsubsection Hald CLUT video stream
  7397. Generate an identity Hald CLUT stream altered with various effects:
  7398. @example
  7399. 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
  7400. @end example
  7401. Note: make sure you use a lossless codec.
  7402. Then use it with @code{haldclut} to apply it on some random stream:
  7403. @example
  7404. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7405. @end example
  7406. The Hald CLUT will be applied to the 10 first seconds (duration of
  7407. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7408. to the remaining frames of the @code{mandelbrot} stream.
  7409. @subsubsection Hald CLUT with preview
  7410. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7411. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7412. biggest possible square starting at the top left of the picture. The remaining
  7413. padding pixels (bottom or right) will be ignored. This area can be used to add
  7414. a preview of the Hald CLUT.
  7415. Typically, the following generated Hald CLUT will be supported by the
  7416. @code{haldclut} filter:
  7417. @example
  7418. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7419. pad=iw+320 [padded_clut];
  7420. smptebars=s=320x256, split [a][b];
  7421. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7422. [main][b] overlay=W-320" -frames:v 1 clut.png
  7423. @end example
  7424. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7425. bars are displayed on the right-top, and below the same color bars processed by
  7426. the color changes.
  7427. Then, the effect of this Hald CLUT can be visualized with:
  7428. @example
  7429. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7430. @end example
  7431. @section hflip
  7432. Flip the input video horizontally.
  7433. For example, to horizontally flip the input video with @command{ffmpeg}:
  7434. @example
  7435. ffmpeg -i in.avi -vf "hflip" out.avi
  7436. @end example
  7437. @section histeq
  7438. This filter applies a global color histogram equalization on a
  7439. per-frame basis.
  7440. It can be used to correct video that has a compressed range of pixel
  7441. intensities. The filter redistributes the pixel intensities to
  7442. equalize their distribution across the intensity range. It may be
  7443. viewed as an "automatically adjusting contrast filter". This filter is
  7444. useful only for correcting degraded or poorly captured source
  7445. video.
  7446. The filter accepts the following options:
  7447. @table @option
  7448. @item strength
  7449. Determine the amount of equalization to be applied. As the strength
  7450. is reduced, the distribution of pixel intensities more-and-more
  7451. approaches that of the input frame. The value must be a float number
  7452. in the range [0,1] and defaults to 0.200.
  7453. @item intensity
  7454. Set the maximum intensity that can generated and scale the output
  7455. values appropriately. The strength should be set as desired and then
  7456. the intensity can be limited if needed to avoid washing-out. The value
  7457. must be a float number in the range [0,1] and defaults to 0.210.
  7458. @item antibanding
  7459. Set the antibanding level. If enabled the filter will randomly vary
  7460. the luminance of output pixels by a small amount to avoid banding of
  7461. the histogram. Possible values are @code{none}, @code{weak} or
  7462. @code{strong}. It defaults to @code{none}.
  7463. @end table
  7464. @section histogram
  7465. Compute and draw a color distribution histogram for the input video.
  7466. The computed histogram is a representation of the color component
  7467. distribution in an image.
  7468. Standard histogram displays the color components distribution in an image.
  7469. Displays color graph for each color component. Shows distribution of
  7470. the Y, U, V, A or R, G, B components, depending on input format, in the
  7471. current frame. Below each graph a color component scale meter is shown.
  7472. The filter accepts the following options:
  7473. @table @option
  7474. @item level_height
  7475. Set height of level. Default value is @code{200}.
  7476. Allowed range is [50, 2048].
  7477. @item scale_height
  7478. Set height of color scale. Default value is @code{12}.
  7479. Allowed range is [0, 40].
  7480. @item display_mode
  7481. Set display mode.
  7482. It accepts the following values:
  7483. @table @samp
  7484. @item stack
  7485. Per color component graphs are placed below each other.
  7486. @item parade
  7487. Per color component graphs are placed side by side.
  7488. @item overlay
  7489. Presents information identical to that in the @code{parade}, except
  7490. that the graphs representing color components are superimposed directly
  7491. over one another.
  7492. @end table
  7493. Default is @code{stack}.
  7494. @item levels_mode
  7495. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7496. Default is @code{linear}.
  7497. @item components
  7498. Set what color components to display.
  7499. Default is @code{7}.
  7500. @item fgopacity
  7501. Set foreground opacity. Default is @code{0.7}.
  7502. @item bgopacity
  7503. Set background opacity. Default is @code{0.5}.
  7504. @end table
  7505. @subsection Examples
  7506. @itemize
  7507. @item
  7508. Calculate and draw histogram:
  7509. @example
  7510. ffplay -i input -vf histogram
  7511. @end example
  7512. @end itemize
  7513. @anchor{hqdn3d}
  7514. @section hqdn3d
  7515. This is a high precision/quality 3d denoise filter. It aims to reduce
  7516. image noise, producing smooth images and making still images really
  7517. still. It should enhance compressibility.
  7518. It accepts the following optional parameters:
  7519. @table @option
  7520. @item luma_spatial
  7521. A non-negative floating point number which specifies spatial luma strength.
  7522. It defaults to 4.0.
  7523. @item chroma_spatial
  7524. A non-negative floating point number which specifies spatial chroma strength.
  7525. It defaults to 3.0*@var{luma_spatial}/4.0.
  7526. @item luma_tmp
  7527. A floating point number which specifies luma temporal strength. It defaults to
  7528. 6.0*@var{luma_spatial}/4.0.
  7529. @item chroma_tmp
  7530. A floating point number which specifies chroma temporal strength. It defaults to
  7531. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7532. @end table
  7533. @section hwdownload
  7534. Download hardware frames to system memory.
  7535. The input must be in hardware frames, and the output a non-hardware format.
  7536. Not all formats will be supported on the output - it may be necessary to insert
  7537. an additional @option{format} filter immediately following in the graph to get
  7538. the output in a supported format.
  7539. @section hwmap
  7540. Map hardware frames to system memory or to another device.
  7541. This filter has several different modes of operation; which one is used depends
  7542. on the input and output formats:
  7543. @itemize
  7544. @item
  7545. Hardware frame input, normal frame output
  7546. Map the input frames to system memory and pass them to the output. If the
  7547. original hardware frame is later required (for example, after overlaying
  7548. something else on part of it), the @option{hwmap} filter can be used again
  7549. in the next mode to retrieve it.
  7550. @item
  7551. Normal frame input, hardware frame output
  7552. If the input is actually a software-mapped hardware frame, then unmap it -
  7553. that is, return the original hardware frame.
  7554. Otherwise, a device must be provided. Create new hardware surfaces on that
  7555. device for the output, then map them back to the software format at the input
  7556. and give those frames to the preceding filter. This will then act like the
  7557. @option{hwupload} filter, but may be able to avoid an additional copy when
  7558. the input is already in a compatible format.
  7559. @item
  7560. Hardware frame input and output
  7561. A device must be supplied for the output, either directly or with the
  7562. @option{derive_device} option. The input and output devices must be of
  7563. different types and compatible - the exact meaning of this is
  7564. system-dependent, but typically it means that they must refer to the same
  7565. underlying hardware context (for example, refer to the same graphics card).
  7566. If the input frames were originally created on the output device, then unmap
  7567. to retrieve the original frames.
  7568. Otherwise, map the frames to the output device - create new hardware frames
  7569. on the output corresponding to the frames on the input.
  7570. @end itemize
  7571. The following additional parameters are accepted:
  7572. @table @option
  7573. @item mode
  7574. Set the frame mapping mode. Some combination of:
  7575. @table @var
  7576. @item read
  7577. The mapped frame should be readable.
  7578. @item write
  7579. The mapped frame should be writeable.
  7580. @item overwrite
  7581. The mapping will always overwrite the entire frame.
  7582. This may improve performance in some cases, as the original contents of the
  7583. frame need not be loaded.
  7584. @item direct
  7585. The mapping must not involve any copying.
  7586. Indirect mappings to copies of frames are created in some cases where either
  7587. direct mapping is not possible or it would have unexpected properties.
  7588. Setting this flag ensures that the mapping is direct and will fail if that is
  7589. not possible.
  7590. @end table
  7591. Defaults to @var{read+write} if not specified.
  7592. @item derive_device @var{type}
  7593. Rather than using the device supplied at initialisation, instead derive a new
  7594. device of type @var{type} from the device the input frames exist on.
  7595. @item reverse
  7596. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7597. and map them back to the source. This may be necessary in some cases where
  7598. a mapping in one direction is required but only the opposite direction is
  7599. supported by the devices being used.
  7600. This option is dangerous - it may break the preceding filter in undefined
  7601. ways if there are any additional constraints on that filter's output.
  7602. Do not use it without fully understanding the implications of its use.
  7603. @end table
  7604. @section hwupload
  7605. Upload system memory frames to hardware surfaces.
  7606. The device to upload to must be supplied when the filter is initialised. If
  7607. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7608. option.
  7609. @anchor{hwupload_cuda}
  7610. @section hwupload_cuda
  7611. Upload system memory frames to a CUDA device.
  7612. It accepts the following optional parameters:
  7613. @table @option
  7614. @item device
  7615. The number of the CUDA device to use
  7616. @end table
  7617. @section hqx
  7618. Apply a high-quality magnification filter designed for pixel art. This filter
  7619. was originally created by Maxim Stepin.
  7620. It accepts the following option:
  7621. @table @option
  7622. @item n
  7623. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7624. @code{hq3x} and @code{4} for @code{hq4x}.
  7625. Default is @code{3}.
  7626. @end table
  7627. @section hstack
  7628. Stack input videos horizontally.
  7629. All streams must be of same pixel format and of same height.
  7630. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7631. to create same output.
  7632. The filter accept the following option:
  7633. @table @option
  7634. @item inputs
  7635. Set number of input streams. Default is 2.
  7636. @item shortest
  7637. If set to 1, force the output to terminate when the shortest input
  7638. terminates. Default value is 0.
  7639. @end table
  7640. @section hue
  7641. Modify the hue and/or the saturation of the input.
  7642. It accepts the following parameters:
  7643. @table @option
  7644. @item h
  7645. Specify the hue angle as a number of degrees. It accepts an expression,
  7646. and defaults to "0".
  7647. @item s
  7648. Specify the saturation in the [-10,10] range. It accepts an expression and
  7649. defaults to "1".
  7650. @item H
  7651. Specify the hue angle as a number of radians. It accepts an
  7652. expression, and defaults to "0".
  7653. @item b
  7654. Specify the brightness in the [-10,10] range. It accepts an expression and
  7655. defaults to "0".
  7656. @end table
  7657. @option{h} and @option{H} are mutually exclusive, and can't be
  7658. specified at the same time.
  7659. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7660. expressions containing the following constants:
  7661. @table @option
  7662. @item n
  7663. frame count of the input frame starting from 0
  7664. @item pts
  7665. presentation timestamp of the input frame expressed in time base units
  7666. @item r
  7667. frame rate of the input video, NAN if the input frame rate is unknown
  7668. @item t
  7669. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7670. @item tb
  7671. time base of the input video
  7672. @end table
  7673. @subsection Examples
  7674. @itemize
  7675. @item
  7676. Set the hue to 90 degrees and the saturation to 1.0:
  7677. @example
  7678. hue=h=90:s=1
  7679. @end example
  7680. @item
  7681. Same command but expressing the hue in radians:
  7682. @example
  7683. hue=H=PI/2:s=1
  7684. @end example
  7685. @item
  7686. Rotate hue and make the saturation swing between 0
  7687. and 2 over a period of 1 second:
  7688. @example
  7689. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7690. @end example
  7691. @item
  7692. Apply a 3 seconds saturation fade-in effect starting at 0:
  7693. @example
  7694. hue="s=min(t/3\,1)"
  7695. @end example
  7696. The general fade-in expression can be written as:
  7697. @example
  7698. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7699. @end example
  7700. @item
  7701. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7702. @example
  7703. hue="s=max(0\, min(1\, (8-t)/3))"
  7704. @end example
  7705. The general fade-out expression can be written as:
  7706. @example
  7707. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7708. @end example
  7709. @end itemize
  7710. @subsection Commands
  7711. This filter supports the following commands:
  7712. @table @option
  7713. @item b
  7714. @item s
  7715. @item h
  7716. @item H
  7717. Modify the hue and/or the saturation and/or brightness of the input video.
  7718. The command accepts the same syntax of the corresponding option.
  7719. If the specified expression is not valid, it is kept at its current
  7720. value.
  7721. @end table
  7722. @section hysteresis
  7723. Grow first stream into second stream by connecting components.
  7724. This makes it possible to build more robust edge masks.
  7725. This filter accepts the following options:
  7726. @table @option
  7727. @item planes
  7728. Set which planes will be processed as bitmap, unprocessed planes will be
  7729. copied from first stream.
  7730. By default value 0xf, all planes will be processed.
  7731. @item threshold
  7732. Set threshold which is used in filtering. If pixel component value is higher than
  7733. this value filter algorithm for connecting components is activated.
  7734. By default value is 0.
  7735. @end table
  7736. @section idet
  7737. Detect video interlacing type.
  7738. This filter tries to detect if the input frames are interlaced, progressive,
  7739. top or bottom field first. It will also try to detect fields that are
  7740. repeated between adjacent frames (a sign of telecine).
  7741. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7742. Multiple frame detection incorporates the classification history of previous frames.
  7743. The filter will log these metadata values:
  7744. @table @option
  7745. @item single.current_frame
  7746. Detected type of current frame using single-frame detection. One of:
  7747. ``tff'' (top field first), ``bff'' (bottom field first),
  7748. ``progressive'', or ``undetermined''
  7749. @item single.tff
  7750. Cumulative number of frames detected as top field first using single-frame detection.
  7751. @item multiple.tff
  7752. Cumulative number of frames detected as top field first using multiple-frame detection.
  7753. @item single.bff
  7754. Cumulative number of frames detected as bottom field first using single-frame detection.
  7755. @item multiple.current_frame
  7756. Detected type of current frame using multiple-frame detection. One of:
  7757. ``tff'' (top field first), ``bff'' (bottom field first),
  7758. ``progressive'', or ``undetermined''
  7759. @item multiple.bff
  7760. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7761. @item single.progressive
  7762. Cumulative number of frames detected as progressive using single-frame detection.
  7763. @item multiple.progressive
  7764. Cumulative number of frames detected as progressive using multiple-frame detection.
  7765. @item single.undetermined
  7766. Cumulative number of frames that could not be classified using single-frame detection.
  7767. @item multiple.undetermined
  7768. Cumulative number of frames that could not be classified using multiple-frame detection.
  7769. @item repeated.current_frame
  7770. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7771. @item repeated.neither
  7772. Cumulative number of frames with no repeated field.
  7773. @item repeated.top
  7774. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7775. @item repeated.bottom
  7776. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7777. @end table
  7778. The filter accepts the following options:
  7779. @table @option
  7780. @item intl_thres
  7781. Set interlacing threshold.
  7782. @item prog_thres
  7783. Set progressive threshold.
  7784. @item rep_thres
  7785. Threshold for repeated field detection.
  7786. @item half_life
  7787. Number of frames after which a given frame's contribution to the
  7788. statistics is halved (i.e., it contributes only 0.5 to its
  7789. classification). The default of 0 means that all frames seen are given
  7790. full weight of 1.0 forever.
  7791. @item analyze_interlaced_flag
  7792. When this is not 0 then idet will use the specified number of frames to determine
  7793. if the interlaced flag is accurate, it will not count undetermined frames.
  7794. If the flag is found to be accurate it will be used without any further
  7795. computations, if it is found to be inaccurate it will be cleared without any
  7796. further computations. This allows inserting the idet filter as a low computational
  7797. method to clean up the interlaced flag
  7798. @end table
  7799. @section il
  7800. Deinterleave or interleave fields.
  7801. This filter allows one to process interlaced images fields without
  7802. deinterlacing them. Deinterleaving splits the input frame into 2
  7803. fields (so called half pictures). Odd lines are moved to the top
  7804. half of the output image, even lines to the bottom half.
  7805. You can process (filter) them independently and then re-interleave them.
  7806. The filter accepts the following options:
  7807. @table @option
  7808. @item luma_mode, l
  7809. @item chroma_mode, c
  7810. @item alpha_mode, a
  7811. Available values for @var{luma_mode}, @var{chroma_mode} and
  7812. @var{alpha_mode} are:
  7813. @table @samp
  7814. @item none
  7815. Do nothing.
  7816. @item deinterleave, d
  7817. Deinterleave fields, placing one above the other.
  7818. @item interleave, i
  7819. Interleave fields. Reverse the effect of deinterleaving.
  7820. @end table
  7821. Default value is @code{none}.
  7822. @item luma_swap, ls
  7823. @item chroma_swap, cs
  7824. @item alpha_swap, as
  7825. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7826. @end table
  7827. @section inflate
  7828. Apply inflate effect to the video.
  7829. This filter replaces the pixel by the local(3x3) average by taking into account
  7830. only values higher than the pixel.
  7831. It accepts the following options:
  7832. @table @option
  7833. @item threshold0
  7834. @item threshold1
  7835. @item threshold2
  7836. @item threshold3
  7837. Limit the maximum change for each plane, default is 65535.
  7838. If 0, plane will remain unchanged.
  7839. @end table
  7840. @section interlace
  7841. Simple interlacing filter from progressive contents. This interleaves upper (or
  7842. lower) lines from odd frames with lower (or upper) lines from even frames,
  7843. halving the frame rate and preserving image height.
  7844. @example
  7845. Original Original New Frame
  7846. Frame 'j' Frame 'j+1' (tff)
  7847. ========== =========== ==================
  7848. Line 0 --------------------> Frame 'j' Line 0
  7849. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7850. Line 2 ---------------------> Frame 'j' Line 2
  7851. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7852. ... ... ...
  7853. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7854. @end example
  7855. It accepts the following optional parameters:
  7856. @table @option
  7857. @item scan
  7858. This determines whether the interlaced frame is taken from the even
  7859. (tff - default) or odd (bff) lines of the progressive frame.
  7860. @item lowpass
  7861. Vertical lowpass filter to avoid twitter interlacing and
  7862. reduce moire patterns.
  7863. @table @samp
  7864. @item 0, off
  7865. Disable vertical lowpass filter
  7866. @item 1, linear
  7867. Enable linear filter (default)
  7868. @item 2, complex
  7869. Enable complex filter. This will slightly less reduce twitter and moire
  7870. but better retain detail and subjective sharpness impression.
  7871. @end table
  7872. @end table
  7873. @section kerndeint
  7874. Deinterlace input video by applying Donald Graft's adaptive kernel
  7875. deinterling. Work on interlaced parts of a video to produce
  7876. progressive frames.
  7877. The description of the accepted parameters follows.
  7878. @table @option
  7879. @item thresh
  7880. Set the threshold which affects the filter's tolerance when
  7881. determining if a pixel line must be processed. It must be an integer
  7882. in the range [0,255] and defaults to 10. A value of 0 will result in
  7883. applying the process on every pixels.
  7884. @item map
  7885. Paint pixels exceeding the threshold value to white if set to 1.
  7886. Default is 0.
  7887. @item order
  7888. Set the fields order. Swap fields if set to 1, leave fields alone if
  7889. 0. Default is 0.
  7890. @item sharp
  7891. Enable additional sharpening if set to 1. Default is 0.
  7892. @item twoway
  7893. Enable twoway sharpening if set to 1. Default is 0.
  7894. @end table
  7895. @subsection Examples
  7896. @itemize
  7897. @item
  7898. Apply default values:
  7899. @example
  7900. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7901. @end example
  7902. @item
  7903. Enable additional sharpening:
  7904. @example
  7905. kerndeint=sharp=1
  7906. @end example
  7907. @item
  7908. Paint processed pixels in white:
  7909. @example
  7910. kerndeint=map=1
  7911. @end example
  7912. @end itemize
  7913. @section lenscorrection
  7914. Correct radial lens distortion
  7915. This filter can be used to correct for radial distortion as can result from the use
  7916. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7917. one can use tools available for example as part of opencv or simply trial-and-error.
  7918. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7919. and extract the k1 and k2 coefficients from the resulting matrix.
  7920. Note that effectively the same filter is available in the open-source tools Krita and
  7921. Digikam from the KDE project.
  7922. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7923. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7924. brightness distribution, so you may want to use both filters together in certain
  7925. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7926. be applied before or after lens correction.
  7927. @subsection Options
  7928. The filter accepts the following options:
  7929. @table @option
  7930. @item cx
  7931. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7932. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7933. width.
  7934. @item cy
  7935. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7936. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7937. height.
  7938. @item k1
  7939. Coefficient of the quadratic correction term. 0.5 means no correction.
  7940. @item k2
  7941. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7942. @end table
  7943. The formula that generates the correction is:
  7944. @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)
  7945. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7946. distances from the focal point in the source and target images, respectively.
  7947. @section libvmaf
  7948. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7949. score between two input videos.
  7950. The obtained VMAF score is printed through the logging system.
  7951. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7952. After installing the library it can be enabled using:
  7953. @code{./configure --enable-libvmaf}.
  7954. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7955. The filter has following options:
  7956. @table @option
  7957. @item model_path
  7958. Set the model path which is to be used for SVM.
  7959. Default value: @code{"vmaf_v0.6.1.pkl"}
  7960. @item log_path
  7961. Set the file path to be used to store logs.
  7962. @item log_fmt
  7963. Set the format of the log file (xml or json).
  7964. @item enable_transform
  7965. Enables transform for computing vmaf.
  7966. @item phone_model
  7967. Invokes the phone model which will generate VMAF scores higher than in the
  7968. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7969. @item psnr
  7970. Enables computing psnr along with vmaf.
  7971. @item ssim
  7972. Enables computing ssim along with vmaf.
  7973. @item ms_ssim
  7974. Enables computing ms_ssim along with vmaf.
  7975. @item pool
  7976. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7977. @end table
  7978. This filter also supports the @ref{framesync} options.
  7979. On the below examples the input file @file{main.mpg} being processed is
  7980. compared with the reference file @file{ref.mpg}.
  7981. @example
  7982. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7983. @end example
  7984. Example with options:
  7985. @example
  7986. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7987. @end example
  7988. @section limiter
  7989. Limits the pixel components values to the specified range [min, max].
  7990. The filter accepts the following options:
  7991. @table @option
  7992. @item min
  7993. Lower bound. Defaults to the lowest allowed value for the input.
  7994. @item max
  7995. Upper bound. Defaults to the highest allowed value for the input.
  7996. @item planes
  7997. Specify which planes will be processed. Defaults to all available.
  7998. @end table
  7999. @section loop
  8000. Loop video frames.
  8001. The filter accepts the following options:
  8002. @table @option
  8003. @item loop
  8004. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8005. Default is 0.
  8006. @item size
  8007. Set maximal size in number of frames. Default is 0.
  8008. @item start
  8009. Set first frame of loop. Default is 0.
  8010. @end table
  8011. @anchor{lut3d}
  8012. @section lut3d
  8013. Apply a 3D LUT to an input video.
  8014. The filter accepts the following options:
  8015. @table @option
  8016. @item file
  8017. Set the 3D LUT file name.
  8018. Currently supported formats:
  8019. @table @samp
  8020. @item 3dl
  8021. AfterEffects
  8022. @item cube
  8023. Iridas
  8024. @item dat
  8025. DaVinci
  8026. @item m3d
  8027. Pandora
  8028. @end table
  8029. @item interp
  8030. Select interpolation mode.
  8031. Available values are:
  8032. @table @samp
  8033. @item nearest
  8034. Use values from the nearest defined point.
  8035. @item trilinear
  8036. Interpolate values using the 8 points defining a cube.
  8037. @item tetrahedral
  8038. Interpolate values using a tetrahedron.
  8039. @end table
  8040. @end table
  8041. This filter also supports the @ref{framesync} options.
  8042. @section lumakey
  8043. Turn certain luma values into transparency.
  8044. The filter accepts the following options:
  8045. @table @option
  8046. @item threshold
  8047. Set the luma which will be used as base for transparency.
  8048. Default value is @code{0}.
  8049. @item tolerance
  8050. Set the range of luma values to be keyed out.
  8051. Default value is @code{0}.
  8052. @item softness
  8053. Set the range of softness. Default value is @code{0}.
  8054. Use this to control gradual transition from zero to full transparency.
  8055. @end table
  8056. @section lut, lutrgb, lutyuv
  8057. Compute a look-up table for binding each pixel component input value
  8058. to an output value, and apply it to the input video.
  8059. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8060. to an RGB input video.
  8061. These filters accept the following parameters:
  8062. @table @option
  8063. @item c0
  8064. set first pixel component expression
  8065. @item c1
  8066. set second pixel component expression
  8067. @item c2
  8068. set third pixel component expression
  8069. @item c3
  8070. set fourth pixel component expression, corresponds to the alpha component
  8071. @item r
  8072. set red component expression
  8073. @item g
  8074. set green component expression
  8075. @item b
  8076. set blue component expression
  8077. @item a
  8078. alpha component expression
  8079. @item y
  8080. set Y/luminance component expression
  8081. @item u
  8082. set U/Cb component expression
  8083. @item v
  8084. set V/Cr component expression
  8085. @end table
  8086. Each of them specifies the expression to use for computing the lookup table for
  8087. the corresponding pixel component values.
  8088. The exact component associated to each of the @var{c*} options depends on the
  8089. format in input.
  8090. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8091. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8092. The expressions can contain the following constants and functions:
  8093. @table @option
  8094. @item w
  8095. @item h
  8096. The input width and height.
  8097. @item val
  8098. The input value for the pixel component.
  8099. @item clipval
  8100. The input value, clipped to the @var{minval}-@var{maxval} range.
  8101. @item maxval
  8102. The maximum value for the pixel component.
  8103. @item minval
  8104. The minimum value for the pixel component.
  8105. @item negval
  8106. The negated value for the pixel component value, clipped to the
  8107. @var{minval}-@var{maxval} range; it corresponds to the expression
  8108. "maxval-clipval+minval".
  8109. @item clip(val)
  8110. The computed value in @var{val}, clipped to the
  8111. @var{minval}-@var{maxval} range.
  8112. @item gammaval(gamma)
  8113. The computed gamma correction value of the pixel component value,
  8114. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8115. expression
  8116. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8117. @end table
  8118. All expressions default to "val".
  8119. @subsection Examples
  8120. @itemize
  8121. @item
  8122. Negate input video:
  8123. @example
  8124. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8125. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8126. @end example
  8127. The above is the same as:
  8128. @example
  8129. lutrgb="r=negval:g=negval:b=negval"
  8130. lutyuv="y=negval:u=negval:v=negval"
  8131. @end example
  8132. @item
  8133. Negate luminance:
  8134. @example
  8135. lutyuv=y=negval
  8136. @end example
  8137. @item
  8138. Remove chroma components, turning the video into a graytone image:
  8139. @example
  8140. lutyuv="u=128:v=128"
  8141. @end example
  8142. @item
  8143. Apply a luma burning effect:
  8144. @example
  8145. lutyuv="y=2*val"
  8146. @end example
  8147. @item
  8148. Remove green and blue components:
  8149. @example
  8150. lutrgb="g=0:b=0"
  8151. @end example
  8152. @item
  8153. Set a constant alpha channel value on input:
  8154. @example
  8155. format=rgba,lutrgb=a="maxval-minval/2"
  8156. @end example
  8157. @item
  8158. Correct luminance gamma by a factor of 0.5:
  8159. @example
  8160. lutyuv=y=gammaval(0.5)
  8161. @end example
  8162. @item
  8163. Discard least significant bits of luma:
  8164. @example
  8165. lutyuv=y='bitand(val, 128+64+32)'
  8166. @end example
  8167. @item
  8168. Technicolor like effect:
  8169. @example
  8170. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8171. @end example
  8172. @end itemize
  8173. @section lut2, tlut2
  8174. The @code{lut2} filter takes two input streams and outputs one
  8175. stream.
  8176. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8177. from one single stream.
  8178. This filter accepts the following parameters:
  8179. @table @option
  8180. @item c0
  8181. set first pixel component expression
  8182. @item c1
  8183. set second pixel component expression
  8184. @item c2
  8185. set third pixel component expression
  8186. @item c3
  8187. set fourth pixel component expression, corresponds to the alpha component
  8188. @end table
  8189. Each of them specifies the expression to use for computing the lookup table for
  8190. the corresponding pixel component values.
  8191. The exact component associated to each of the @var{c*} options depends on the
  8192. format in inputs.
  8193. The expressions can contain the following constants:
  8194. @table @option
  8195. @item w
  8196. @item h
  8197. The input width and height.
  8198. @item x
  8199. The first input value for the pixel component.
  8200. @item y
  8201. The second input value for the pixel component.
  8202. @item bdx
  8203. The first input video bit depth.
  8204. @item bdy
  8205. The second input video bit depth.
  8206. @end table
  8207. All expressions default to "x".
  8208. @subsection Examples
  8209. @itemize
  8210. @item
  8211. Highlight differences between two RGB video streams:
  8212. @example
  8213. 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)'
  8214. @end example
  8215. @item
  8216. Highlight differences between two YUV video streams:
  8217. @example
  8218. 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)'
  8219. @end example
  8220. @item
  8221. Show max difference between two video streams:
  8222. @example
  8223. 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)))'
  8224. @end example
  8225. @end itemize
  8226. @section maskedclamp
  8227. Clamp the first input stream with the second input and third input stream.
  8228. Returns the value of first stream to be between second input
  8229. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8230. This filter accepts the following options:
  8231. @table @option
  8232. @item undershoot
  8233. Default value is @code{0}.
  8234. @item overshoot
  8235. Default value is @code{0}.
  8236. @item planes
  8237. Set which planes will be processed as bitmap, unprocessed planes will be
  8238. copied from first stream.
  8239. By default value 0xf, all planes will be processed.
  8240. @end table
  8241. @section maskedmerge
  8242. Merge the first input stream with the second input stream using per pixel
  8243. weights in the third input stream.
  8244. A value of 0 in the third stream pixel component means that pixel component
  8245. from first stream is returned unchanged, while maximum value (eg. 255 for
  8246. 8-bit videos) means that pixel component from second stream is returned
  8247. unchanged. Intermediate values define the amount of merging between both
  8248. input stream's pixel components.
  8249. This filter accepts the following options:
  8250. @table @option
  8251. @item planes
  8252. Set which planes will be processed as bitmap, unprocessed planes will be
  8253. copied from first stream.
  8254. By default value 0xf, all planes will be processed.
  8255. @end table
  8256. @section mcdeint
  8257. Apply motion-compensation deinterlacing.
  8258. It needs one field per frame as input and must thus be used together
  8259. with yadif=1/3 or equivalent.
  8260. This filter accepts the following options:
  8261. @table @option
  8262. @item mode
  8263. Set the deinterlacing mode.
  8264. It accepts one of the following values:
  8265. @table @samp
  8266. @item fast
  8267. @item medium
  8268. @item slow
  8269. use iterative motion estimation
  8270. @item extra_slow
  8271. like @samp{slow}, but use multiple reference frames.
  8272. @end table
  8273. Default value is @samp{fast}.
  8274. @item parity
  8275. Set the picture field parity assumed for the input video. It must be
  8276. one of the following values:
  8277. @table @samp
  8278. @item 0, tff
  8279. assume top field first
  8280. @item 1, bff
  8281. assume bottom field first
  8282. @end table
  8283. Default value is @samp{bff}.
  8284. @item qp
  8285. Set per-block quantization parameter (QP) used by the internal
  8286. encoder.
  8287. Higher values should result in a smoother motion vector field but less
  8288. optimal individual vectors. Default value is 1.
  8289. @end table
  8290. @section mergeplanes
  8291. Merge color channel components from several video streams.
  8292. The filter accepts up to 4 input streams, and merge selected input
  8293. planes to the output video.
  8294. This filter accepts the following options:
  8295. @table @option
  8296. @item mapping
  8297. Set input to output plane mapping. Default is @code{0}.
  8298. The mappings is specified as a bitmap. It should be specified as a
  8299. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8300. mapping for the first plane of the output stream. 'A' sets the number of
  8301. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8302. corresponding input to use (from 0 to 3). The rest of the mappings is
  8303. similar, 'Bb' describes the mapping for the output stream second
  8304. plane, 'Cc' describes the mapping for the output stream third plane and
  8305. 'Dd' describes the mapping for the output stream fourth plane.
  8306. @item format
  8307. Set output pixel format. Default is @code{yuva444p}.
  8308. @end table
  8309. @subsection Examples
  8310. @itemize
  8311. @item
  8312. Merge three gray video streams of same width and height into single video stream:
  8313. @example
  8314. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8315. @end example
  8316. @item
  8317. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8318. @example
  8319. [a0][a1]mergeplanes=0x00010210:yuva444p
  8320. @end example
  8321. @item
  8322. Swap Y and A plane in yuva444p stream:
  8323. @example
  8324. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8325. @end example
  8326. @item
  8327. Swap U and V plane in yuv420p stream:
  8328. @example
  8329. format=yuv420p,mergeplanes=0x000201:yuv420p
  8330. @end example
  8331. @item
  8332. Cast a rgb24 clip to yuv444p:
  8333. @example
  8334. format=rgb24,mergeplanes=0x000102:yuv444p
  8335. @end example
  8336. @end itemize
  8337. @section mestimate
  8338. Estimate and export motion vectors using block matching algorithms.
  8339. Motion vectors are stored in frame side data to be used by other filters.
  8340. This filter accepts the following options:
  8341. @table @option
  8342. @item method
  8343. Specify the motion estimation method. Accepts one of the following values:
  8344. @table @samp
  8345. @item esa
  8346. Exhaustive search algorithm.
  8347. @item tss
  8348. Three step search algorithm.
  8349. @item tdls
  8350. Two dimensional logarithmic search algorithm.
  8351. @item ntss
  8352. New three step search algorithm.
  8353. @item fss
  8354. Four step search algorithm.
  8355. @item ds
  8356. Diamond search algorithm.
  8357. @item hexbs
  8358. Hexagon-based search algorithm.
  8359. @item epzs
  8360. Enhanced predictive zonal search algorithm.
  8361. @item umh
  8362. Uneven multi-hexagon search algorithm.
  8363. @end table
  8364. Default value is @samp{esa}.
  8365. @item mb_size
  8366. Macroblock size. Default @code{16}.
  8367. @item search_param
  8368. Search parameter. Default @code{7}.
  8369. @end table
  8370. @section midequalizer
  8371. Apply Midway Image Equalization effect using two video streams.
  8372. Midway Image Equalization adjusts a pair of images to have the same
  8373. histogram, while maintaining their dynamics as much as possible. It's
  8374. useful for e.g. matching exposures from a pair of stereo cameras.
  8375. This filter has two inputs and one output, which must be of same pixel format, but
  8376. may be of different sizes. The output of filter is first input adjusted with
  8377. midway histogram of both inputs.
  8378. This filter accepts the following option:
  8379. @table @option
  8380. @item planes
  8381. Set which planes to process. Default is @code{15}, which is all available planes.
  8382. @end table
  8383. @section minterpolate
  8384. Convert the video to specified frame rate using motion interpolation.
  8385. This filter accepts the following options:
  8386. @table @option
  8387. @item fps
  8388. 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}.
  8389. @item mi_mode
  8390. Motion interpolation mode. Following values are accepted:
  8391. @table @samp
  8392. @item dup
  8393. Duplicate previous or next frame for interpolating new ones.
  8394. @item blend
  8395. Blend source frames. Interpolated frame is mean of previous and next frames.
  8396. @item mci
  8397. Motion compensated interpolation. Following options are effective when this mode is selected:
  8398. @table @samp
  8399. @item mc_mode
  8400. Motion compensation mode. Following values are accepted:
  8401. @table @samp
  8402. @item obmc
  8403. Overlapped block motion compensation.
  8404. @item aobmc
  8405. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8406. @end table
  8407. Default mode is @samp{obmc}.
  8408. @item me_mode
  8409. Motion estimation mode. Following values are accepted:
  8410. @table @samp
  8411. @item bidir
  8412. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8413. @item bilat
  8414. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8415. @end table
  8416. Default mode is @samp{bilat}.
  8417. @item me
  8418. The algorithm to be used for motion estimation. Following values are accepted:
  8419. @table @samp
  8420. @item esa
  8421. Exhaustive search algorithm.
  8422. @item tss
  8423. Three step search algorithm.
  8424. @item tdls
  8425. Two dimensional logarithmic search algorithm.
  8426. @item ntss
  8427. New three step search algorithm.
  8428. @item fss
  8429. Four step search algorithm.
  8430. @item ds
  8431. Diamond search algorithm.
  8432. @item hexbs
  8433. Hexagon-based search algorithm.
  8434. @item epzs
  8435. Enhanced predictive zonal search algorithm.
  8436. @item umh
  8437. Uneven multi-hexagon search algorithm.
  8438. @end table
  8439. Default algorithm is @samp{epzs}.
  8440. @item mb_size
  8441. Macroblock size. Default @code{16}.
  8442. @item search_param
  8443. Motion estimation search parameter. Default @code{32}.
  8444. @item vsbmc
  8445. 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).
  8446. @end table
  8447. @end table
  8448. @item scd
  8449. 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:
  8450. @table @samp
  8451. @item none
  8452. Disable scene change detection.
  8453. @item fdiff
  8454. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8455. @end table
  8456. Default method is @samp{fdiff}.
  8457. @item scd_threshold
  8458. Scene change detection threshold. Default is @code{5.0}.
  8459. @end table
  8460. @section mix
  8461. Mix several video input streams into one video stream.
  8462. A description of the accepted options follows.
  8463. @table @option
  8464. @item nb_inputs
  8465. The number of inputs. If unspecified, it defaults to 2.
  8466. @item weights
  8467. Specify weight of each input video stream as sequence.
  8468. Each weight is separated by space.
  8469. @item duration
  8470. Specify how end of stream is determined.
  8471. @table @samp
  8472. @item longest
  8473. The duration of the longest input. (default)
  8474. @item shortest
  8475. The duration of the shortest input.
  8476. @item first
  8477. The duration of the first input.
  8478. @end table
  8479. @end table
  8480. @section mpdecimate
  8481. Drop frames that do not differ greatly from the previous frame in
  8482. order to reduce frame rate.
  8483. The main use of this filter is for very-low-bitrate encoding
  8484. (e.g. streaming over dialup modem), but it could in theory be used for
  8485. fixing movies that were inverse-telecined incorrectly.
  8486. A description of the accepted options follows.
  8487. @table @option
  8488. @item max
  8489. Set the maximum number of consecutive frames which can be dropped (if
  8490. positive), or the minimum interval between dropped frames (if
  8491. negative). If the value is 0, the frame is dropped disregarding the
  8492. number of previous sequentially dropped frames.
  8493. Default value is 0.
  8494. @item hi
  8495. @item lo
  8496. @item frac
  8497. Set the dropping threshold values.
  8498. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8499. represent actual pixel value differences, so a threshold of 64
  8500. corresponds to 1 unit of difference for each pixel, or the same spread
  8501. out differently over the block.
  8502. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8503. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8504. meaning the whole image) differ by more than a threshold of @option{lo}.
  8505. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8506. 64*5, and default value for @option{frac} is 0.33.
  8507. @end table
  8508. @section negate
  8509. Negate input video.
  8510. It accepts an integer in input; if non-zero it negates the
  8511. alpha component (if available). The default value in input is 0.
  8512. @section nlmeans
  8513. Denoise frames using Non-Local Means algorithm.
  8514. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8515. context similarity is defined by comparing their surrounding patches of size
  8516. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8517. around the pixel.
  8518. Note that the research area defines centers for patches, which means some
  8519. patches will be made of pixels outside that research area.
  8520. The filter accepts the following options.
  8521. @table @option
  8522. @item s
  8523. Set denoising strength.
  8524. @item p
  8525. Set patch size.
  8526. @item pc
  8527. Same as @option{p} but for chroma planes.
  8528. The default value is @var{0} and means automatic.
  8529. @item r
  8530. Set research size.
  8531. @item rc
  8532. Same as @option{r} but for chroma planes.
  8533. The default value is @var{0} and means automatic.
  8534. @end table
  8535. @section nnedi
  8536. Deinterlace video using neural network edge directed interpolation.
  8537. This filter accepts the following options:
  8538. @table @option
  8539. @item weights
  8540. Mandatory option, without binary file filter can not work.
  8541. Currently file can be found here:
  8542. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8543. @item deint
  8544. Set which frames to deinterlace, by default it is @code{all}.
  8545. Can be @code{all} or @code{interlaced}.
  8546. @item field
  8547. Set mode of operation.
  8548. Can be one of the following:
  8549. @table @samp
  8550. @item af
  8551. Use frame flags, both fields.
  8552. @item a
  8553. Use frame flags, single field.
  8554. @item t
  8555. Use top field only.
  8556. @item b
  8557. Use bottom field only.
  8558. @item tf
  8559. Use both fields, top first.
  8560. @item bf
  8561. Use both fields, bottom first.
  8562. @end table
  8563. @item planes
  8564. Set which planes to process, by default filter process all frames.
  8565. @item nsize
  8566. Set size of local neighborhood around each pixel, used by the predictor neural
  8567. network.
  8568. Can be one of the following:
  8569. @table @samp
  8570. @item s8x6
  8571. @item s16x6
  8572. @item s32x6
  8573. @item s48x6
  8574. @item s8x4
  8575. @item s16x4
  8576. @item s32x4
  8577. @end table
  8578. @item nns
  8579. Set the number of neurons in predictor neural network.
  8580. Can be one of the following:
  8581. @table @samp
  8582. @item n16
  8583. @item n32
  8584. @item n64
  8585. @item n128
  8586. @item n256
  8587. @end table
  8588. @item qual
  8589. Controls the number of different neural network predictions that are blended
  8590. together to compute the final output value. Can be @code{fast}, default or
  8591. @code{slow}.
  8592. @item etype
  8593. Set which set of weights to use in the predictor.
  8594. Can be one of the following:
  8595. @table @samp
  8596. @item a
  8597. weights trained to minimize absolute error
  8598. @item s
  8599. weights trained to minimize squared error
  8600. @end table
  8601. @item pscrn
  8602. Controls whether or not the prescreener neural network is used to decide
  8603. which pixels should be processed by the predictor neural network and which
  8604. can be handled by simple cubic interpolation.
  8605. The prescreener is trained to know whether cubic interpolation will be
  8606. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8607. The computational complexity of the prescreener nn is much less than that of
  8608. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8609. using the prescreener generally results in much faster processing.
  8610. The prescreener is pretty accurate, so the difference between using it and not
  8611. using it is almost always unnoticeable.
  8612. Can be one of the following:
  8613. @table @samp
  8614. @item none
  8615. @item original
  8616. @item new
  8617. @end table
  8618. Default is @code{new}.
  8619. @item fapprox
  8620. Set various debugging flags.
  8621. @end table
  8622. @section noformat
  8623. Force libavfilter not to use any of the specified pixel formats for the
  8624. input to the next filter.
  8625. It accepts the following parameters:
  8626. @table @option
  8627. @item pix_fmts
  8628. A '|'-separated list of pixel format names, such as
  8629. pix_fmts=yuv420p|monow|rgb24".
  8630. @end table
  8631. @subsection Examples
  8632. @itemize
  8633. @item
  8634. Force libavfilter to use a format different from @var{yuv420p} for the
  8635. input to the vflip filter:
  8636. @example
  8637. noformat=pix_fmts=yuv420p,vflip
  8638. @end example
  8639. @item
  8640. Convert the input video to any of the formats not contained in the list:
  8641. @example
  8642. noformat=yuv420p|yuv444p|yuv410p
  8643. @end example
  8644. @end itemize
  8645. @section noise
  8646. Add noise on video input frame.
  8647. The filter accepts the following options:
  8648. @table @option
  8649. @item all_seed
  8650. @item c0_seed
  8651. @item c1_seed
  8652. @item c2_seed
  8653. @item c3_seed
  8654. Set noise seed for specific pixel component or all pixel components in case
  8655. of @var{all_seed}. Default value is @code{123457}.
  8656. @item all_strength, alls
  8657. @item c0_strength, c0s
  8658. @item c1_strength, c1s
  8659. @item c2_strength, c2s
  8660. @item c3_strength, c3s
  8661. Set noise strength for specific pixel component or all pixel components in case
  8662. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8663. @item all_flags, allf
  8664. @item c0_flags, c0f
  8665. @item c1_flags, c1f
  8666. @item c2_flags, c2f
  8667. @item c3_flags, c3f
  8668. Set pixel component flags or set flags for all components if @var{all_flags}.
  8669. Available values for component flags are:
  8670. @table @samp
  8671. @item a
  8672. averaged temporal noise (smoother)
  8673. @item p
  8674. mix random noise with a (semi)regular pattern
  8675. @item t
  8676. temporal noise (noise pattern changes between frames)
  8677. @item u
  8678. uniform noise (gaussian otherwise)
  8679. @end table
  8680. @end table
  8681. @subsection Examples
  8682. Add temporal and uniform noise to input video:
  8683. @example
  8684. noise=alls=20:allf=t+u
  8685. @end example
  8686. @section normalize
  8687. Normalize RGB video (aka histogram stretching, contrast stretching).
  8688. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8689. For each channel of each frame, the filter computes the input range and maps
  8690. it linearly to the user-specified output range. The output range defaults
  8691. to the full dynamic range from pure black to pure white.
  8692. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8693. changes in brightness) caused when small dark or bright objects enter or leave
  8694. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8695. video camera, and, like a video camera, it may cause a period of over- or
  8696. under-exposure of the video.
  8697. The R,G,B channels can be normalized independently, which may cause some
  8698. color shifting, or linked together as a single channel, which prevents
  8699. color shifting. Linked normalization preserves hue. Independent normalization
  8700. does not, so it can be used to remove some color casts. Independent and linked
  8701. normalization can be combined in any ratio.
  8702. The normalize filter accepts the following options:
  8703. @table @option
  8704. @item blackpt
  8705. @item whitept
  8706. Colors which define the output range. The minimum input value is mapped to
  8707. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8708. The defaults are black and white respectively. Specifying white for
  8709. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8710. normalized video. Shades of grey can be used to reduce the dynamic range
  8711. (contrast). Specifying saturated colors here can create some interesting
  8712. effects.
  8713. @item smoothing
  8714. The number of previous frames to use for temporal smoothing. The input range
  8715. of each channel is smoothed using a rolling average over the current frame
  8716. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8717. smoothing).
  8718. @item independence
  8719. Controls the ratio of independent (color shifting) channel normalization to
  8720. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8721. independent. Defaults to 1.0 (fully independent).
  8722. @item strength
  8723. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8724. expensive no-op. Defaults to 1.0 (full strength).
  8725. @end table
  8726. @subsection Examples
  8727. Stretch video contrast to use the full dynamic range, with no temporal
  8728. smoothing; may flicker depending on the source content:
  8729. @example
  8730. normalize=blackpt=black:whitept=white:smoothing=0
  8731. @end example
  8732. As above, but with 50 frames of temporal smoothing; flicker should be
  8733. reduced, depending on the source content:
  8734. @example
  8735. normalize=blackpt=black:whitept=white:smoothing=50
  8736. @end example
  8737. As above, but with hue-preserving linked channel normalization:
  8738. @example
  8739. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8740. @end example
  8741. As above, but with half strength:
  8742. @example
  8743. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8744. @end example
  8745. Map the darkest input color to red, the brightest input color to cyan:
  8746. @example
  8747. normalize=blackpt=red:whitept=cyan
  8748. @end example
  8749. @section null
  8750. Pass the video source unchanged to the output.
  8751. @section ocr
  8752. Optical Character Recognition
  8753. This filter uses Tesseract for optical character recognition.
  8754. It accepts the following options:
  8755. @table @option
  8756. @item datapath
  8757. Set datapath to tesseract data. Default is to use whatever was
  8758. set at installation.
  8759. @item language
  8760. Set language, default is "eng".
  8761. @item whitelist
  8762. Set character whitelist.
  8763. @item blacklist
  8764. Set character blacklist.
  8765. @end table
  8766. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8767. @section ocv
  8768. Apply a video transform using libopencv.
  8769. To enable this filter, install the libopencv library and headers and
  8770. configure FFmpeg with @code{--enable-libopencv}.
  8771. It accepts the following parameters:
  8772. @table @option
  8773. @item filter_name
  8774. The name of the libopencv filter to apply.
  8775. @item filter_params
  8776. The parameters to pass to the libopencv filter. If not specified, the default
  8777. values are assumed.
  8778. @end table
  8779. Refer to the official libopencv documentation for more precise
  8780. information:
  8781. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8782. Several libopencv filters are supported; see the following subsections.
  8783. @anchor{dilate}
  8784. @subsection dilate
  8785. Dilate an image by using a specific structuring element.
  8786. It corresponds to the libopencv function @code{cvDilate}.
  8787. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8788. @var{struct_el} represents a structuring element, and has the syntax:
  8789. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8790. @var{cols} and @var{rows} represent the number of columns and rows of
  8791. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8792. point, and @var{shape} the shape for the structuring element. @var{shape}
  8793. must be "rect", "cross", "ellipse", or "custom".
  8794. If the value for @var{shape} is "custom", it must be followed by a
  8795. string of the form "=@var{filename}". The file with name
  8796. @var{filename} is assumed to represent a binary image, with each
  8797. printable character corresponding to a bright pixel. When a custom
  8798. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8799. or columns and rows of the read file are assumed instead.
  8800. The default value for @var{struct_el} is "3x3+0x0/rect".
  8801. @var{nb_iterations} specifies the number of times the transform is
  8802. applied to the image, and defaults to 1.
  8803. Some examples:
  8804. @example
  8805. # Use the default values
  8806. ocv=dilate
  8807. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8808. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8809. # Read the shape from the file diamond.shape, iterating two times.
  8810. # The file diamond.shape may contain a pattern of characters like this
  8811. # *
  8812. # ***
  8813. # *****
  8814. # ***
  8815. # *
  8816. # The specified columns and rows are ignored
  8817. # but the anchor point coordinates are not
  8818. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8819. @end example
  8820. @subsection erode
  8821. Erode an image by using a specific structuring element.
  8822. It corresponds to the libopencv function @code{cvErode}.
  8823. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8824. with the same syntax and semantics as the @ref{dilate} filter.
  8825. @subsection smooth
  8826. Smooth the input video.
  8827. The filter takes the following parameters:
  8828. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8829. @var{type} is the type of smooth filter to apply, and must be one of
  8830. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8831. or "bilateral". The default value is "gaussian".
  8832. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8833. depend on the smooth type. @var{param1} and
  8834. @var{param2} accept integer positive values or 0. @var{param3} and
  8835. @var{param4} accept floating point values.
  8836. The default value for @var{param1} is 3. The default value for the
  8837. other parameters is 0.
  8838. These parameters correspond to the parameters assigned to the
  8839. libopencv function @code{cvSmooth}.
  8840. @section oscilloscope
  8841. 2D Video Oscilloscope.
  8842. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8843. It accepts the following parameters:
  8844. @table @option
  8845. @item x
  8846. Set scope center x position.
  8847. @item y
  8848. Set scope center y position.
  8849. @item s
  8850. Set scope size, relative to frame diagonal.
  8851. @item t
  8852. Set scope tilt/rotation.
  8853. @item o
  8854. Set trace opacity.
  8855. @item tx
  8856. Set trace center x position.
  8857. @item ty
  8858. Set trace center y position.
  8859. @item tw
  8860. Set trace width, relative to width of frame.
  8861. @item th
  8862. Set trace height, relative to height of frame.
  8863. @item c
  8864. Set which components to trace. By default it traces first three components.
  8865. @item g
  8866. Draw trace grid. By default is enabled.
  8867. @item st
  8868. Draw some statistics. By default is enabled.
  8869. @item sc
  8870. Draw scope. By default is enabled.
  8871. @end table
  8872. @subsection Examples
  8873. @itemize
  8874. @item
  8875. Inspect full first row of video frame.
  8876. @example
  8877. oscilloscope=x=0.5:y=0:s=1
  8878. @end example
  8879. @item
  8880. Inspect full last row of video frame.
  8881. @example
  8882. oscilloscope=x=0.5:y=1:s=1
  8883. @end example
  8884. @item
  8885. Inspect full 5th line of video frame of height 1080.
  8886. @example
  8887. oscilloscope=x=0.5:y=5/1080:s=1
  8888. @end example
  8889. @item
  8890. Inspect full last column of video frame.
  8891. @example
  8892. oscilloscope=x=1:y=0.5:s=1:t=1
  8893. @end example
  8894. @end itemize
  8895. @anchor{overlay}
  8896. @section overlay
  8897. Overlay one video on top of another.
  8898. It takes two inputs and has one output. The first input is the "main"
  8899. video on which the second input is overlaid.
  8900. It accepts the following parameters:
  8901. A description of the accepted options follows.
  8902. @table @option
  8903. @item x
  8904. @item y
  8905. Set the expression for the x and y coordinates of the overlaid video
  8906. on the main video. Default value is "0" for both expressions. In case
  8907. the expression is invalid, it is set to a huge value (meaning that the
  8908. overlay will not be displayed within the output visible area).
  8909. @item eof_action
  8910. See @ref{framesync}.
  8911. @item eval
  8912. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8913. It accepts the following values:
  8914. @table @samp
  8915. @item init
  8916. only evaluate expressions once during the filter initialization or
  8917. when a command is processed
  8918. @item frame
  8919. evaluate expressions for each incoming frame
  8920. @end table
  8921. Default value is @samp{frame}.
  8922. @item shortest
  8923. See @ref{framesync}.
  8924. @item format
  8925. Set the format for the output video.
  8926. It accepts the following values:
  8927. @table @samp
  8928. @item yuv420
  8929. force YUV420 output
  8930. @item yuv422
  8931. force YUV422 output
  8932. @item yuv444
  8933. force YUV444 output
  8934. @item rgb
  8935. force packed RGB output
  8936. @item gbrp
  8937. force planar RGB output
  8938. @item auto
  8939. automatically pick format
  8940. @end table
  8941. Default value is @samp{yuv420}.
  8942. @item repeatlast
  8943. See @ref{framesync}.
  8944. @item alpha
  8945. Set format of alpha of the overlaid video, it can be @var{straight} or
  8946. @var{premultiplied}. Default is @var{straight}.
  8947. @end table
  8948. The @option{x}, and @option{y} expressions can contain the following
  8949. parameters.
  8950. @table @option
  8951. @item main_w, W
  8952. @item main_h, H
  8953. The main input width and height.
  8954. @item overlay_w, w
  8955. @item overlay_h, h
  8956. The overlay input width and height.
  8957. @item x
  8958. @item y
  8959. The computed values for @var{x} and @var{y}. They are evaluated for
  8960. each new frame.
  8961. @item hsub
  8962. @item vsub
  8963. horizontal and vertical chroma subsample values of the output
  8964. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8965. @var{vsub} is 1.
  8966. @item n
  8967. the number of input frame, starting from 0
  8968. @item pos
  8969. the position in the file of the input frame, NAN if unknown
  8970. @item t
  8971. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8972. @end table
  8973. This filter also supports the @ref{framesync} options.
  8974. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8975. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8976. when @option{eval} is set to @samp{init}.
  8977. Be aware that frames are taken from each input video in timestamp
  8978. order, hence, if their initial timestamps differ, it is a good idea
  8979. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8980. have them begin in the same zero timestamp, as the example for
  8981. the @var{movie} filter does.
  8982. You can chain together more overlays but you should test the
  8983. efficiency of such approach.
  8984. @subsection Commands
  8985. This filter supports the following commands:
  8986. @table @option
  8987. @item x
  8988. @item y
  8989. Modify the x and y of the overlay input.
  8990. The command accepts the same syntax of the corresponding option.
  8991. If the specified expression is not valid, it is kept at its current
  8992. value.
  8993. @end table
  8994. @subsection Examples
  8995. @itemize
  8996. @item
  8997. Draw the overlay at 10 pixels from the bottom right corner of the main
  8998. video:
  8999. @example
  9000. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9001. @end example
  9002. Using named options the example above becomes:
  9003. @example
  9004. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9005. @end example
  9006. @item
  9007. Insert a transparent PNG logo in the bottom left corner of the input,
  9008. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9009. @example
  9010. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9011. @end example
  9012. @item
  9013. Insert 2 different transparent PNG logos (second logo on bottom
  9014. right corner) using the @command{ffmpeg} tool:
  9015. @example
  9016. 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
  9017. @end example
  9018. @item
  9019. Add a transparent color layer on top of the main video; @code{WxH}
  9020. must specify the size of the main input to the overlay filter:
  9021. @example
  9022. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9023. @end example
  9024. @item
  9025. Play an original video and a filtered version (here with the deshake
  9026. filter) side by side using the @command{ffplay} tool:
  9027. @example
  9028. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9029. @end example
  9030. The above command is the same as:
  9031. @example
  9032. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9033. @end example
  9034. @item
  9035. Make a sliding overlay appearing from the left to the right top part of the
  9036. screen starting since time 2:
  9037. @example
  9038. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9039. @end example
  9040. @item
  9041. Compose output by putting two input videos side to side:
  9042. @example
  9043. ffmpeg -i left.avi -i right.avi -filter_complex "
  9044. nullsrc=size=200x100 [background];
  9045. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9046. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9047. [background][left] overlay=shortest=1 [background+left];
  9048. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9049. "
  9050. @end example
  9051. @item
  9052. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9053. @example
  9054. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9055. -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]'
  9056. masked.avi
  9057. @end example
  9058. @item
  9059. Chain several overlays in cascade:
  9060. @example
  9061. nullsrc=s=200x200 [bg];
  9062. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9063. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9064. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9065. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9066. [in3] null, [mid2] overlay=100:100 [out0]
  9067. @end example
  9068. @end itemize
  9069. @section owdenoise
  9070. Apply Overcomplete Wavelet denoiser.
  9071. The filter accepts the following options:
  9072. @table @option
  9073. @item depth
  9074. Set depth.
  9075. Larger depth values will denoise lower frequency components more, but
  9076. slow down filtering.
  9077. Must be an int in the range 8-16, default is @code{8}.
  9078. @item luma_strength, ls
  9079. Set luma strength.
  9080. Must be a double value in the range 0-1000, default is @code{1.0}.
  9081. @item chroma_strength, cs
  9082. Set chroma strength.
  9083. Must be a double value in the range 0-1000, default is @code{1.0}.
  9084. @end table
  9085. @anchor{pad}
  9086. @section pad
  9087. Add paddings to the input image, and place the original input at the
  9088. provided @var{x}, @var{y} coordinates.
  9089. It accepts the following parameters:
  9090. @table @option
  9091. @item width, w
  9092. @item height, h
  9093. Specify an expression for the size of the output image with the
  9094. paddings added. If the value for @var{width} or @var{height} is 0, the
  9095. corresponding input size is used for the output.
  9096. The @var{width} expression can reference the value set by the
  9097. @var{height} expression, and vice versa.
  9098. The default value of @var{width} and @var{height} is 0.
  9099. @item x
  9100. @item y
  9101. Specify the offsets to place the input image at within the padded area,
  9102. with respect to the top/left border of the output image.
  9103. The @var{x} expression can reference the value set by the @var{y}
  9104. expression, and vice versa.
  9105. The default value of @var{x} and @var{y} is 0.
  9106. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9107. so the input image is centered on the padded area.
  9108. @item color
  9109. Specify the color of the padded area. For the syntax of this option,
  9110. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9111. manual,ffmpeg-utils}.
  9112. The default value of @var{color} is "black".
  9113. @item eval
  9114. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9115. It accepts the following values:
  9116. @table @samp
  9117. @item init
  9118. Only evaluate expressions once during the filter initialization or when
  9119. a command is processed.
  9120. @item frame
  9121. Evaluate expressions for each incoming frame.
  9122. @end table
  9123. Default value is @samp{init}.
  9124. @item aspect
  9125. Pad to aspect instead to a resolution.
  9126. @end table
  9127. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9128. options are expressions containing the following constants:
  9129. @table @option
  9130. @item in_w
  9131. @item in_h
  9132. The input video width and height.
  9133. @item iw
  9134. @item ih
  9135. These are the same as @var{in_w} and @var{in_h}.
  9136. @item out_w
  9137. @item out_h
  9138. The output width and height (the size of the padded area), as
  9139. specified by the @var{width} and @var{height} expressions.
  9140. @item ow
  9141. @item oh
  9142. These are the same as @var{out_w} and @var{out_h}.
  9143. @item x
  9144. @item y
  9145. The x and y offsets as specified by the @var{x} and @var{y}
  9146. expressions, or NAN if not yet specified.
  9147. @item a
  9148. same as @var{iw} / @var{ih}
  9149. @item sar
  9150. input sample aspect ratio
  9151. @item dar
  9152. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9153. @item hsub
  9154. @item vsub
  9155. The horizontal and vertical chroma subsample values. For example for the
  9156. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9157. @end table
  9158. @subsection Examples
  9159. @itemize
  9160. @item
  9161. Add paddings with the color "violet" to the input video. The output video
  9162. size is 640x480, and the top-left corner of the input video is placed at
  9163. column 0, row 40
  9164. @example
  9165. pad=640:480:0:40:violet
  9166. @end example
  9167. The example above is equivalent to the following command:
  9168. @example
  9169. pad=width=640:height=480:x=0:y=40:color=violet
  9170. @end example
  9171. @item
  9172. Pad the input to get an output with dimensions increased by 3/2,
  9173. and put the input video at the center of the padded area:
  9174. @example
  9175. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9176. @end example
  9177. @item
  9178. Pad the input to get a squared output with size equal to the maximum
  9179. value between the input width and height, and put the input video at
  9180. the center of the padded area:
  9181. @example
  9182. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9183. @end example
  9184. @item
  9185. Pad the input to get a final w/h ratio of 16:9:
  9186. @example
  9187. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9188. @end example
  9189. @item
  9190. In case of anamorphic video, in order to set the output display aspect
  9191. correctly, it is necessary to use @var{sar} in the expression,
  9192. according to the relation:
  9193. @example
  9194. (ih * X / ih) * sar = output_dar
  9195. X = output_dar / sar
  9196. @end example
  9197. Thus the previous example needs to be modified to:
  9198. @example
  9199. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9200. @end example
  9201. @item
  9202. Double the output size and put the input video in the bottom-right
  9203. corner of the output padded area:
  9204. @example
  9205. pad="2*iw:2*ih:ow-iw:oh-ih"
  9206. @end example
  9207. @end itemize
  9208. @anchor{palettegen}
  9209. @section palettegen
  9210. Generate one palette for a whole video stream.
  9211. It accepts the following options:
  9212. @table @option
  9213. @item max_colors
  9214. Set the maximum number of colors to quantize in the palette.
  9215. Note: the palette will still contain 256 colors; the unused palette entries
  9216. will be black.
  9217. @item reserve_transparent
  9218. Create a palette of 255 colors maximum and reserve the last one for
  9219. transparency. Reserving the transparency color is useful for GIF optimization.
  9220. If not set, the maximum of colors in the palette will be 256. You probably want
  9221. to disable this option for a standalone image.
  9222. Set by default.
  9223. @item transparency_color
  9224. Set the color that will be used as background for transparency.
  9225. @item stats_mode
  9226. Set statistics mode.
  9227. It accepts the following values:
  9228. @table @samp
  9229. @item full
  9230. Compute full frame histograms.
  9231. @item diff
  9232. Compute histograms only for the part that differs from previous frame. This
  9233. might be relevant to give more importance to the moving part of your input if
  9234. the background is static.
  9235. @item single
  9236. Compute new histogram for each frame.
  9237. @end table
  9238. Default value is @var{full}.
  9239. @end table
  9240. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9241. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9242. color quantization of the palette. This information is also visible at
  9243. @var{info} logging level.
  9244. @subsection Examples
  9245. @itemize
  9246. @item
  9247. Generate a representative palette of a given video using @command{ffmpeg}:
  9248. @example
  9249. ffmpeg -i input.mkv -vf palettegen palette.png
  9250. @end example
  9251. @end itemize
  9252. @section paletteuse
  9253. Use a palette to downsample an input video stream.
  9254. The filter takes two inputs: one video stream and a palette. The palette must
  9255. be a 256 pixels image.
  9256. It accepts the following options:
  9257. @table @option
  9258. @item dither
  9259. Select dithering mode. Available algorithms are:
  9260. @table @samp
  9261. @item bayer
  9262. Ordered 8x8 bayer dithering (deterministic)
  9263. @item heckbert
  9264. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9265. Note: this dithering is sometimes considered "wrong" and is included as a
  9266. reference.
  9267. @item floyd_steinberg
  9268. Floyd and Steingberg dithering (error diffusion)
  9269. @item sierra2
  9270. Frankie Sierra dithering v2 (error diffusion)
  9271. @item sierra2_4a
  9272. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9273. @end table
  9274. Default is @var{sierra2_4a}.
  9275. @item bayer_scale
  9276. When @var{bayer} dithering is selected, this option defines the scale of the
  9277. pattern (how much the crosshatch pattern is visible). A low value means more
  9278. visible pattern for less banding, and higher value means less visible pattern
  9279. at the cost of more banding.
  9280. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9281. @item diff_mode
  9282. If set, define the zone to process
  9283. @table @samp
  9284. @item rectangle
  9285. Only the changing rectangle will be reprocessed. This is similar to GIF
  9286. cropping/offsetting compression mechanism. This option can be useful for speed
  9287. if only a part of the image is changing, and has use cases such as limiting the
  9288. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9289. moving scene (it leads to more deterministic output if the scene doesn't change
  9290. much, and as a result less moving noise and better GIF compression).
  9291. @end table
  9292. Default is @var{none}.
  9293. @item new
  9294. Take new palette for each output frame.
  9295. @item alpha_threshold
  9296. Sets the alpha threshold for transparency. Alpha values above this threshold
  9297. will be treated as completely opaque, and values below this threshold will be
  9298. treated as completely transparent.
  9299. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9300. @end table
  9301. @subsection Examples
  9302. @itemize
  9303. @item
  9304. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9305. using @command{ffmpeg}:
  9306. @example
  9307. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9308. @end example
  9309. @end itemize
  9310. @section perspective
  9311. Correct perspective of video not recorded perpendicular to the screen.
  9312. A description of the accepted parameters follows.
  9313. @table @option
  9314. @item x0
  9315. @item y0
  9316. @item x1
  9317. @item y1
  9318. @item x2
  9319. @item y2
  9320. @item x3
  9321. @item y3
  9322. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9323. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9324. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9325. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9326. then the corners of the source will be sent to the specified coordinates.
  9327. The expressions can use the following variables:
  9328. @table @option
  9329. @item W
  9330. @item H
  9331. the width and height of video frame.
  9332. @item in
  9333. Input frame count.
  9334. @item on
  9335. Output frame count.
  9336. @end table
  9337. @item interpolation
  9338. Set interpolation for perspective correction.
  9339. It accepts the following values:
  9340. @table @samp
  9341. @item linear
  9342. @item cubic
  9343. @end table
  9344. Default value is @samp{linear}.
  9345. @item sense
  9346. Set interpretation of coordinate options.
  9347. It accepts the following values:
  9348. @table @samp
  9349. @item 0, source
  9350. Send point in the source specified by the given coordinates to
  9351. the corners of the destination.
  9352. @item 1, destination
  9353. Send the corners of the source to the point in the destination specified
  9354. by the given coordinates.
  9355. Default value is @samp{source}.
  9356. @end table
  9357. @item eval
  9358. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9359. It accepts the following values:
  9360. @table @samp
  9361. @item init
  9362. only evaluate expressions once during the filter initialization or
  9363. when a command is processed
  9364. @item frame
  9365. evaluate expressions for each incoming frame
  9366. @end table
  9367. Default value is @samp{init}.
  9368. @end table
  9369. @section phase
  9370. Delay interlaced video by one field time so that the field order changes.
  9371. The intended use is to fix PAL movies that have been captured with the
  9372. opposite field order to the film-to-video transfer.
  9373. A description of the accepted parameters follows.
  9374. @table @option
  9375. @item mode
  9376. Set phase mode.
  9377. It accepts the following values:
  9378. @table @samp
  9379. @item t
  9380. Capture field order top-first, transfer bottom-first.
  9381. Filter will delay the bottom field.
  9382. @item b
  9383. Capture field order bottom-first, transfer top-first.
  9384. Filter will delay the top field.
  9385. @item p
  9386. Capture and transfer with the same field order. This mode only exists
  9387. for the documentation of the other options to refer to, but if you
  9388. actually select it, the filter will faithfully do nothing.
  9389. @item a
  9390. Capture field order determined automatically by field flags, transfer
  9391. opposite.
  9392. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9393. basis using field flags. If no field information is available,
  9394. then this works just like @samp{u}.
  9395. @item u
  9396. Capture unknown or varying, transfer opposite.
  9397. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9398. analyzing the images and selecting the alternative that produces best
  9399. match between the fields.
  9400. @item T
  9401. Capture top-first, transfer unknown or varying.
  9402. Filter selects among @samp{t} and @samp{p} using image analysis.
  9403. @item B
  9404. Capture bottom-first, transfer unknown or varying.
  9405. Filter selects among @samp{b} and @samp{p} using image analysis.
  9406. @item A
  9407. Capture determined by field flags, transfer unknown or varying.
  9408. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9409. image analysis. If no field information is available, then this works just
  9410. like @samp{U}. This is the default mode.
  9411. @item U
  9412. Both capture and transfer unknown or varying.
  9413. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9414. @end table
  9415. @end table
  9416. @section pixdesctest
  9417. Pixel format descriptor test filter, mainly useful for internal
  9418. testing. The output video should be equal to the input video.
  9419. For example:
  9420. @example
  9421. format=monow, pixdesctest
  9422. @end example
  9423. can be used to test the monowhite pixel format descriptor definition.
  9424. @section pixscope
  9425. Display sample values of color channels. Mainly useful for checking color
  9426. and levels. Minimum supported resolution is 640x480.
  9427. The filters accept the following options:
  9428. @table @option
  9429. @item x
  9430. Set scope X position, relative offset on X axis.
  9431. @item y
  9432. Set scope Y position, relative offset on Y axis.
  9433. @item w
  9434. Set scope width.
  9435. @item h
  9436. Set scope height.
  9437. @item o
  9438. Set window opacity. This window also holds statistics about pixel area.
  9439. @item wx
  9440. Set window X position, relative offset on X axis.
  9441. @item wy
  9442. Set window Y position, relative offset on Y axis.
  9443. @end table
  9444. @section pp
  9445. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9446. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9447. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9448. Each subfilter and some options have a short and a long name that can be used
  9449. interchangeably, i.e. dr/dering are the same.
  9450. The filters accept the following options:
  9451. @table @option
  9452. @item subfilters
  9453. Set postprocessing subfilters string.
  9454. @end table
  9455. All subfilters share common options to determine their scope:
  9456. @table @option
  9457. @item a/autoq
  9458. Honor the quality commands for this subfilter.
  9459. @item c/chrom
  9460. Do chrominance filtering, too (default).
  9461. @item y/nochrom
  9462. Do luminance filtering only (no chrominance).
  9463. @item n/noluma
  9464. Do chrominance filtering only (no luminance).
  9465. @end table
  9466. These options can be appended after the subfilter name, separated by a '|'.
  9467. Available subfilters are:
  9468. @table @option
  9469. @item hb/hdeblock[|difference[|flatness]]
  9470. Horizontal deblocking filter
  9471. @table @option
  9472. @item difference
  9473. Difference factor where higher values mean more deblocking (default: @code{32}).
  9474. @item flatness
  9475. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9476. @end table
  9477. @item vb/vdeblock[|difference[|flatness]]
  9478. Vertical deblocking filter
  9479. @table @option
  9480. @item difference
  9481. Difference factor where higher values mean more deblocking (default: @code{32}).
  9482. @item flatness
  9483. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9484. @end table
  9485. @item ha/hadeblock[|difference[|flatness]]
  9486. Accurate horizontal deblocking filter
  9487. @table @option
  9488. @item difference
  9489. Difference factor where higher values mean more deblocking (default: @code{32}).
  9490. @item flatness
  9491. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9492. @end table
  9493. @item va/vadeblock[|difference[|flatness]]
  9494. Accurate vertical deblocking filter
  9495. @table @option
  9496. @item difference
  9497. Difference factor where higher values mean more deblocking (default: @code{32}).
  9498. @item flatness
  9499. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9500. @end table
  9501. @end table
  9502. The horizontal and vertical deblocking filters share the difference and
  9503. flatness values so you cannot set different horizontal and vertical
  9504. thresholds.
  9505. @table @option
  9506. @item h1/x1hdeblock
  9507. Experimental horizontal deblocking filter
  9508. @item v1/x1vdeblock
  9509. Experimental vertical deblocking filter
  9510. @item dr/dering
  9511. Deringing filter
  9512. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9513. @table @option
  9514. @item threshold1
  9515. larger -> stronger filtering
  9516. @item threshold2
  9517. larger -> stronger filtering
  9518. @item threshold3
  9519. larger -> stronger filtering
  9520. @end table
  9521. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9522. @table @option
  9523. @item f/fullyrange
  9524. Stretch luminance to @code{0-255}.
  9525. @end table
  9526. @item lb/linblenddeint
  9527. Linear blend deinterlacing filter that deinterlaces the given block by
  9528. filtering all lines with a @code{(1 2 1)} filter.
  9529. @item li/linipoldeint
  9530. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9531. linearly interpolating every second line.
  9532. @item ci/cubicipoldeint
  9533. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9534. cubically interpolating every second line.
  9535. @item md/mediandeint
  9536. Median deinterlacing filter that deinterlaces the given block by applying a
  9537. median filter to every second line.
  9538. @item fd/ffmpegdeint
  9539. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9540. second line with a @code{(-1 4 2 4 -1)} filter.
  9541. @item l5/lowpass5
  9542. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9543. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9544. @item fq/forceQuant[|quantizer]
  9545. Overrides the quantizer table from the input with the constant quantizer you
  9546. specify.
  9547. @table @option
  9548. @item quantizer
  9549. Quantizer to use
  9550. @end table
  9551. @item de/default
  9552. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9553. @item fa/fast
  9554. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9555. @item ac
  9556. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9557. @end table
  9558. @subsection Examples
  9559. @itemize
  9560. @item
  9561. Apply horizontal and vertical deblocking, deringing and automatic
  9562. brightness/contrast:
  9563. @example
  9564. pp=hb/vb/dr/al
  9565. @end example
  9566. @item
  9567. Apply default filters without brightness/contrast correction:
  9568. @example
  9569. pp=de/-al
  9570. @end example
  9571. @item
  9572. Apply default filters and temporal denoiser:
  9573. @example
  9574. pp=default/tmpnoise|1|2|3
  9575. @end example
  9576. @item
  9577. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9578. automatically depending on available CPU time:
  9579. @example
  9580. pp=hb|y/vb|a
  9581. @end example
  9582. @end itemize
  9583. @section pp7
  9584. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9585. similar to spp = 6 with 7 point DCT, where only the center sample is
  9586. used after IDCT.
  9587. The filter accepts the following options:
  9588. @table @option
  9589. @item qp
  9590. Force a constant quantization parameter. It accepts an integer in range
  9591. 0 to 63. If not set, the filter will use the QP from the video stream
  9592. (if available).
  9593. @item mode
  9594. Set thresholding mode. Available modes are:
  9595. @table @samp
  9596. @item hard
  9597. Set hard thresholding.
  9598. @item soft
  9599. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9600. @item medium
  9601. Set medium thresholding (good results, default).
  9602. @end table
  9603. @end table
  9604. @section premultiply
  9605. Apply alpha premultiply effect to input video stream using first plane
  9606. of second stream as alpha.
  9607. Both streams must have same dimensions and same pixel format.
  9608. The filter accepts the following option:
  9609. @table @option
  9610. @item planes
  9611. Set which planes will be processed, unprocessed planes will be copied.
  9612. By default value 0xf, all planes will be processed.
  9613. @item inplace
  9614. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9615. @end table
  9616. @section prewitt
  9617. Apply prewitt operator to input video stream.
  9618. The filter accepts the following option:
  9619. @table @option
  9620. @item planes
  9621. Set which planes will be processed, unprocessed planes will be copied.
  9622. By default value 0xf, all planes will be processed.
  9623. @item scale
  9624. Set value which will be multiplied with filtered result.
  9625. @item delta
  9626. Set value which will be added to filtered result.
  9627. @end table
  9628. @anchor{program_opencl}
  9629. @section program_opencl
  9630. Filter video using an OpenCL program.
  9631. @table @option
  9632. @item source
  9633. OpenCL program source file.
  9634. @item kernel
  9635. Kernel name in program.
  9636. @item inputs
  9637. Number of inputs to the filter. Defaults to 1.
  9638. @item size, s
  9639. Size of output frames. Defaults to the same as the first input.
  9640. @end table
  9641. The program source file must contain a kernel function with the given name,
  9642. which will be run once for each plane of the output. Each run on a plane
  9643. gets enqueued as a separate 2D global NDRange with one work-item for each
  9644. pixel to be generated. The global ID offset for each work-item is therefore
  9645. the coordinates of a pixel in the destination image.
  9646. The kernel function needs to take the following arguments:
  9647. @itemize
  9648. @item
  9649. Destination image, @var{__write_only image2d_t}.
  9650. This image will become the output; the kernel should write all of it.
  9651. @item
  9652. Frame index, @var{unsigned int}.
  9653. This is a counter starting from zero and increasing by one for each frame.
  9654. @item
  9655. Source images, @var{__read_only image2d_t}.
  9656. These are the most recent images on each input. The kernel may read from
  9657. them to generate the output, but they can't be written to.
  9658. @end itemize
  9659. Example programs:
  9660. @itemize
  9661. @item
  9662. Copy the input to the output (output must be the same size as the input).
  9663. @verbatim
  9664. __kernel void copy(__write_only image2d_t destination,
  9665. unsigned int index,
  9666. __read_only image2d_t source)
  9667. {
  9668. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9669. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9670. float4 value = read_imagef(source, sampler, location);
  9671. write_imagef(destination, location, value);
  9672. }
  9673. @end verbatim
  9674. @item
  9675. Apply a simple transformation, rotating the input by an amount increasing
  9676. with the index counter. Pixel values are linearly interpolated by the
  9677. sampler, and the output need not have the same dimensions as the input.
  9678. @verbatim
  9679. __kernel void rotate_image(__write_only image2d_t dst,
  9680. unsigned int index,
  9681. __read_only image2d_t src)
  9682. {
  9683. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9684. CLK_FILTER_LINEAR);
  9685. float angle = (float)index / 100.0f;
  9686. float2 dst_dim = convert_float2(get_image_dim(dst));
  9687. float2 src_dim = convert_float2(get_image_dim(src));
  9688. float2 dst_cen = dst_dim / 2.0f;
  9689. float2 src_cen = src_dim / 2.0f;
  9690. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9691. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9692. float2 src_pos = {
  9693. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9694. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9695. };
  9696. src_pos = src_pos * src_dim / dst_dim;
  9697. float2 src_loc = src_pos + src_cen;
  9698. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9699. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9700. write_imagef(dst, dst_loc, 0.5f);
  9701. else
  9702. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9703. }
  9704. @end verbatim
  9705. @item
  9706. Blend two inputs together, with the amount of each input used varying
  9707. with the index counter.
  9708. @verbatim
  9709. __kernel void blend_images(__write_only image2d_t dst,
  9710. unsigned int index,
  9711. __read_only image2d_t src1,
  9712. __read_only image2d_t src2)
  9713. {
  9714. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9715. CLK_FILTER_LINEAR);
  9716. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9717. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9718. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9719. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9720. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9721. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9722. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9723. }
  9724. @end verbatim
  9725. @end itemize
  9726. @section pseudocolor
  9727. Alter frame colors in video with pseudocolors.
  9728. This filter accept the following options:
  9729. @table @option
  9730. @item c0
  9731. set pixel first component expression
  9732. @item c1
  9733. set pixel second component expression
  9734. @item c2
  9735. set pixel third component expression
  9736. @item c3
  9737. set pixel fourth component expression, corresponds to the alpha component
  9738. @item i
  9739. set component to use as base for altering colors
  9740. @end table
  9741. Each of them specifies the expression to use for computing the lookup table for
  9742. the corresponding pixel component values.
  9743. The expressions can contain the following constants and functions:
  9744. @table @option
  9745. @item w
  9746. @item h
  9747. The input width and height.
  9748. @item val
  9749. The input value for the pixel component.
  9750. @item ymin, umin, vmin, amin
  9751. The minimum allowed component value.
  9752. @item ymax, umax, vmax, amax
  9753. The maximum allowed component value.
  9754. @end table
  9755. All expressions default to "val".
  9756. @subsection Examples
  9757. @itemize
  9758. @item
  9759. Change too high luma values to gradient:
  9760. @example
  9761. 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'"
  9762. @end example
  9763. @end itemize
  9764. @section psnr
  9765. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9766. Ratio) between two input videos.
  9767. This filter takes in input two input videos, the first input is
  9768. considered the "main" source and is passed unchanged to the
  9769. output. The second input is used as a "reference" video for computing
  9770. the PSNR.
  9771. Both video inputs must have the same resolution and pixel format for
  9772. this filter to work correctly. Also it assumes that both inputs
  9773. have the same number of frames, which are compared one by one.
  9774. The obtained average PSNR is printed through the logging system.
  9775. The filter stores the accumulated MSE (mean squared error) of each
  9776. frame, and at the end of the processing it is averaged across all frames
  9777. equally, and the following formula is applied to obtain the PSNR:
  9778. @example
  9779. PSNR = 10*log10(MAX^2/MSE)
  9780. @end example
  9781. Where MAX is the average of the maximum values of each component of the
  9782. image.
  9783. The description of the accepted parameters follows.
  9784. @table @option
  9785. @item stats_file, f
  9786. If specified the filter will use the named file to save the PSNR of
  9787. each individual frame. When filename equals "-" the data is sent to
  9788. standard output.
  9789. @item stats_version
  9790. Specifies which version of the stats file format to use. Details of
  9791. each format are written below.
  9792. Default value is 1.
  9793. @item stats_add_max
  9794. Determines whether the max value is output to the stats log.
  9795. Default value is 0.
  9796. Requires stats_version >= 2. If this is set and stats_version < 2,
  9797. the filter will return an error.
  9798. @end table
  9799. This filter also supports the @ref{framesync} options.
  9800. The file printed if @var{stats_file} is selected, contains a sequence of
  9801. key/value pairs of the form @var{key}:@var{value} for each compared
  9802. couple of frames.
  9803. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9804. the list of per-frame-pair stats, with key value pairs following the frame
  9805. format with the following parameters:
  9806. @table @option
  9807. @item psnr_log_version
  9808. The version of the log file format. Will match @var{stats_version}.
  9809. @item fields
  9810. A comma separated list of the per-frame-pair parameters included in
  9811. the log.
  9812. @end table
  9813. A description of each shown per-frame-pair parameter follows:
  9814. @table @option
  9815. @item n
  9816. sequential number of the input frame, starting from 1
  9817. @item mse_avg
  9818. Mean Square Error pixel-by-pixel average difference of the compared
  9819. frames, averaged over all the image components.
  9820. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9821. Mean Square Error pixel-by-pixel average difference of the compared
  9822. frames for the component specified by the suffix.
  9823. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9824. Peak Signal to Noise ratio of the compared frames for the component
  9825. specified by the suffix.
  9826. @item max_avg, max_y, max_u, max_v
  9827. Maximum allowed value for each channel, and average over all
  9828. channels.
  9829. @end table
  9830. For example:
  9831. @example
  9832. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9833. [main][ref] psnr="stats_file=stats.log" [out]
  9834. @end example
  9835. On this example the input file being processed is compared with the
  9836. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9837. is stored in @file{stats.log}.
  9838. @anchor{pullup}
  9839. @section pullup
  9840. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9841. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9842. content.
  9843. The pullup filter is designed to take advantage of future context in making
  9844. its decisions. This filter is stateless in the sense that it does not lock
  9845. onto a pattern to follow, but it instead looks forward to the following
  9846. fields in order to identify matches and rebuild progressive frames.
  9847. To produce content with an even framerate, insert the fps filter after
  9848. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9849. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9850. The filter accepts the following options:
  9851. @table @option
  9852. @item jl
  9853. @item jr
  9854. @item jt
  9855. @item jb
  9856. These options set the amount of "junk" to ignore at the left, right, top, and
  9857. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9858. while top and bottom are in units of 2 lines.
  9859. The default is 8 pixels on each side.
  9860. @item sb
  9861. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9862. filter generating an occasional mismatched frame, but it may also cause an
  9863. excessive number of frames to be dropped during high motion sequences.
  9864. Conversely, setting it to -1 will make filter match fields more easily.
  9865. This may help processing of video where there is slight blurring between
  9866. the fields, but may also cause there to be interlaced frames in the output.
  9867. Default value is @code{0}.
  9868. @item mp
  9869. Set the metric plane to use. It accepts the following values:
  9870. @table @samp
  9871. @item l
  9872. Use luma plane.
  9873. @item u
  9874. Use chroma blue plane.
  9875. @item v
  9876. Use chroma red plane.
  9877. @end table
  9878. This option may be set to use chroma plane instead of the default luma plane
  9879. for doing filter's computations. This may improve accuracy on very clean
  9880. source material, but more likely will decrease accuracy, especially if there
  9881. is chroma noise (rainbow effect) or any grayscale video.
  9882. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9883. load and make pullup usable in realtime on slow machines.
  9884. @end table
  9885. For best results (without duplicated frames in the output file) it is
  9886. necessary to change the output frame rate. For example, to inverse
  9887. telecine NTSC input:
  9888. @example
  9889. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9890. @end example
  9891. @section qp
  9892. Change video quantization parameters (QP).
  9893. The filter accepts the following option:
  9894. @table @option
  9895. @item qp
  9896. Set expression for quantization parameter.
  9897. @end table
  9898. The expression is evaluated through the eval API and can contain, among others,
  9899. the following constants:
  9900. @table @var
  9901. @item known
  9902. 1 if index is not 129, 0 otherwise.
  9903. @item qp
  9904. Sequential index starting from -129 to 128.
  9905. @end table
  9906. @subsection Examples
  9907. @itemize
  9908. @item
  9909. Some equation like:
  9910. @example
  9911. qp=2+2*sin(PI*qp)
  9912. @end example
  9913. @end itemize
  9914. @section random
  9915. Flush video frames from internal cache of frames into a random order.
  9916. No frame is discarded.
  9917. Inspired by @ref{frei0r} nervous filter.
  9918. @table @option
  9919. @item frames
  9920. Set size in number of frames of internal cache, in range from @code{2} to
  9921. @code{512}. Default is @code{30}.
  9922. @item seed
  9923. Set seed for random number generator, must be an integer included between
  9924. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9925. less than @code{0}, the filter will try to use a good random seed on a
  9926. best effort basis.
  9927. @end table
  9928. @section readeia608
  9929. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9930. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9931. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9932. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9933. @table @option
  9934. @item lavfi.readeia608.X.cc
  9935. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9936. @item lavfi.readeia608.X.line
  9937. The number of the line on which the EIA-608 data was identified and read.
  9938. @end table
  9939. This filter accepts the following options:
  9940. @table @option
  9941. @item scan_min
  9942. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9943. @item scan_max
  9944. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9945. @item mac
  9946. Set minimal acceptable amplitude change for sync codes detection.
  9947. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9948. @item spw
  9949. Set the ratio of width reserved for sync code detection.
  9950. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9951. @item mhd
  9952. Set the max peaks height difference for sync code detection.
  9953. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9954. @item mpd
  9955. Set max peaks period difference for sync code detection.
  9956. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9957. @item msd
  9958. Set the first two max start code bits differences.
  9959. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9960. @item bhd
  9961. Set the minimum ratio of bits height compared to 3rd start code bit.
  9962. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9963. @item th_w
  9964. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9965. @item th_b
  9966. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9967. @item chp
  9968. Enable checking the parity bit. In the event of a parity error, the filter will output
  9969. @code{0x00} for that character. Default is false.
  9970. @end table
  9971. @subsection Examples
  9972. @itemize
  9973. @item
  9974. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9975. @example
  9976. 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
  9977. @end example
  9978. @end itemize
  9979. @section readvitc
  9980. Read vertical interval timecode (VITC) information from the top lines of a
  9981. video frame.
  9982. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9983. timecode value, if a valid timecode has been detected. Further metadata key
  9984. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9985. timecode data has been found or not.
  9986. This filter accepts the following options:
  9987. @table @option
  9988. @item scan_max
  9989. Set the maximum number of lines to scan for VITC data. If the value is set to
  9990. @code{-1} the full video frame is scanned. Default is @code{45}.
  9991. @item thr_b
  9992. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9993. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9994. @item thr_w
  9995. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9996. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9997. @end table
  9998. @subsection Examples
  9999. @itemize
  10000. @item
  10001. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10002. draw @code{--:--:--:--} as a placeholder:
  10003. @example
  10004. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10005. @end example
  10006. @end itemize
  10007. @section remap
  10008. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10009. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10010. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10011. value for pixel will be used for destination pixel.
  10012. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10013. will have Xmap/Ymap video stream dimensions.
  10014. Xmap and Ymap input video streams are 16bit depth, single channel.
  10015. @section removegrain
  10016. The removegrain filter is a spatial denoiser for progressive video.
  10017. @table @option
  10018. @item m0
  10019. Set mode for the first plane.
  10020. @item m1
  10021. Set mode for the second plane.
  10022. @item m2
  10023. Set mode for the third plane.
  10024. @item m3
  10025. Set mode for the fourth plane.
  10026. @end table
  10027. Range of mode is from 0 to 24. Description of each mode follows:
  10028. @table @var
  10029. @item 0
  10030. Leave input plane unchanged. Default.
  10031. @item 1
  10032. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10033. @item 2
  10034. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10035. @item 3
  10036. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10037. @item 4
  10038. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10039. This is equivalent to a median filter.
  10040. @item 5
  10041. Line-sensitive clipping giving the minimal change.
  10042. @item 6
  10043. Line-sensitive clipping, intermediate.
  10044. @item 7
  10045. Line-sensitive clipping, intermediate.
  10046. @item 8
  10047. Line-sensitive clipping, intermediate.
  10048. @item 9
  10049. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10050. @item 10
  10051. Replaces the target pixel with the closest neighbour.
  10052. @item 11
  10053. [1 2 1] horizontal and vertical kernel blur.
  10054. @item 12
  10055. Same as mode 11.
  10056. @item 13
  10057. Bob mode, interpolates top field from the line where the neighbours
  10058. pixels are the closest.
  10059. @item 14
  10060. Bob mode, interpolates bottom field from the line where the neighbours
  10061. pixels are the closest.
  10062. @item 15
  10063. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10064. interpolation formula.
  10065. @item 16
  10066. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10067. interpolation formula.
  10068. @item 17
  10069. Clips the pixel with the minimum and maximum of respectively the maximum and
  10070. minimum of each pair of opposite neighbour pixels.
  10071. @item 18
  10072. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10073. the current pixel is minimal.
  10074. @item 19
  10075. Replaces the pixel with the average of its 8 neighbours.
  10076. @item 20
  10077. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10078. @item 21
  10079. Clips pixels using the averages of opposite neighbour.
  10080. @item 22
  10081. Same as mode 21 but simpler and faster.
  10082. @item 23
  10083. Small edge and halo removal, but reputed useless.
  10084. @item 24
  10085. Similar as 23.
  10086. @end table
  10087. @section removelogo
  10088. Suppress a TV station logo, using an image file to determine which
  10089. pixels comprise the logo. It works by filling in the pixels that
  10090. comprise the logo with neighboring pixels.
  10091. The filter accepts the following options:
  10092. @table @option
  10093. @item filename, f
  10094. Set the filter bitmap file, which can be any image format supported by
  10095. libavformat. The width and height of the image file must match those of the
  10096. video stream being processed.
  10097. @end table
  10098. Pixels in the provided bitmap image with a value of zero are not
  10099. considered part of the logo, non-zero pixels are considered part of
  10100. the logo. If you use white (255) for the logo and black (0) for the
  10101. rest, you will be safe. For making the filter bitmap, it is
  10102. recommended to take a screen capture of a black frame with the logo
  10103. visible, and then using a threshold filter followed by the erode
  10104. filter once or twice.
  10105. If needed, little splotches can be fixed manually. Remember that if
  10106. logo pixels are not covered, the filter quality will be much
  10107. reduced. Marking too many pixels as part of the logo does not hurt as
  10108. much, but it will increase the amount of blurring needed to cover over
  10109. the image and will destroy more information than necessary, and extra
  10110. pixels will slow things down on a large logo.
  10111. @section repeatfields
  10112. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10113. fields based on its value.
  10114. @section reverse
  10115. Reverse a video clip.
  10116. Warning: This filter requires memory to buffer the entire clip, so trimming
  10117. is suggested.
  10118. @subsection Examples
  10119. @itemize
  10120. @item
  10121. Take the first 5 seconds of a clip, and reverse it.
  10122. @example
  10123. trim=end=5,reverse
  10124. @end example
  10125. @end itemize
  10126. @section roberts
  10127. Apply roberts cross operator to input video stream.
  10128. The filter accepts the following option:
  10129. @table @option
  10130. @item planes
  10131. Set which planes will be processed, unprocessed planes will be copied.
  10132. By default value 0xf, all planes will be processed.
  10133. @item scale
  10134. Set value which will be multiplied with filtered result.
  10135. @item delta
  10136. Set value which will be added to filtered result.
  10137. @end table
  10138. @section rotate
  10139. Rotate video by an arbitrary angle expressed in radians.
  10140. The filter accepts the following options:
  10141. A description of the optional parameters follows.
  10142. @table @option
  10143. @item angle, a
  10144. Set an expression for the angle by which to rotate the input video
  10145. clockwise, expressed as a number of radians. A negative value will
  10146. result in a counter-clockwise rotation. By default it is set to "0".
  10147. This expression is evaluated for each frame.
  10148. @item out_w, ow
  10149. Set the output width expression, default value is "iw".
  10150. This expression is evaluated just once during configuration.
  10151. @item out_h, oh
  10152. Set the output height expression, default value is "ih".
  10153. This expression is evaluated just once during configuration.
  10154. @item bilinear
  10155. Enable bilinear interpolation if set to 1, a value of 0 disables
  10156. it. Default value is 1.
  10157. @item fillcolor, c
  10158. Set the color used to fill the output area not covered by the rotated
  10159. image. For the general syntax of this option, check the
  10160. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10161. If the special value "none" is selected then no
  10162. background is printed (useful for example if the background is never shown).
  10163. Default value is "black".
  10164. @end table
  10165. The expressions for the angle and the output size can contain the
  10166. following constants and functions:
  10167. @table @option
  10168. @item n
  10169. sequential number of the input frame, starting from 0. It is always NAN
  10170. before the first frame is filtered.
  10171. @item t
  10172. time in seconds of the input frame, it is set to 0 when the filter is
  10173. configured. It is always NAN before the first frame is filtered.
  10174. @item hsub
  10175. @item vsub
  10176. horizontal and vertical chroma subsample values. For example for the
  10177. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10178. @item in_w, iw
  10179. @item in_h, ih
  10180. the input video width and height
  10181. @item out_w, ow
  10182. @item out_h, oh
  10183. the output width and height, that is the size of the padded area as
  10184. specified by the @var{width} and @var{height} expressions
  10185. @item rotw(a)
  10186. @item roth(a)
  10187. the minimal width/height required for completely containing the input
  10188. video rotated by @var{a} radians.
  10189. These are only available when computing the @option{out_w} and
  10190. @option{out_h} expressions.
  10191. @end table
  10192. @subsection Examples
  10193. @itemize
  10194. @item
  10195. Rotate the input by PI/6 radians clockwise:
  10196. @example
  10197. rotate=PI/6
  10198. @end example
  10199. @item
  10200. Rotate the input by PI/6 radians counter-clockwise:
  10201. @example
  10202. rotate=-PI/6
  10203. @end example
  10204. @item
  10205. Rotate the input by 45 degrees clockwise:
  10206. @example
  10207. rotate=45*PI/180
  10208. @end example
  10209. @item
  10210. Apply a constant rotation with period T, starting from an angle of PI/3:
  10211. @example
  10212. rotate=PI/3+2*PI*t/T
  10213. @end example
  10214. @item
  10215. Make the input video rotation oscillating with a period of T
  10216. seconds and an amplitude of A radians:
  10217. @example
  10218. rotate=A*sin(2*PI/T*t)
  10219. @end example
  10220. @item
  10221. Rotate the video, output size is chosen so that the whole rotating
  10222. input video is always completely contained in the output:
  10223. @example
  10224. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10225. @end example
  10226. @item
  10227. Rotate the video, reduce the output size so that no background is ever
  10228. shown:
  10229. @example
  10230. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10231. @end example
  10232. @end itemize
  10233. @subsection Commands
  10234. The filter supports the following commands:
  10235. @table @option
  10236. @item a, angle
  10237. Set the angle expression.
  10238. The command accepts the same syntax of the corresponding option.
  10239. If the specified expression is not valid, it is kept at its current
  10240. value.
  10241. @end table
  10242. @section sab
  10243. Apply Shape Adaptive Blur.
  10244. The filter accepts the following options:
  10245. @table @option
  10246. @item luma_radius, lr
  10247. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10248. value is 1.0. A greater value will result in a more blurred image, and
  10249. in slower processing.
  10250. @item luma_pre_filter_radius, lpfr
  10251. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10252. value is 1.0.
  10253. @item luma_strength, ls
  10254. Set luma maximum difference between pixels to still be considered, must
  10255. be a value in the 0.1-100.0 range, default value is 1.0.
  10256. @item chroma_radius, cr
  10257. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10258. greater value will result in a more blurred image, and in slower
  10259. processing.
  10260. @item chroma_pre_filter_radius, cpfr
  10261. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10262. @item chroma_strength, cs
  10263. Set chroma maximum difference between pixels to still be considered,
  10264. must be a value in the -0.9-100.0 range.
  10265. @end table
  10266. Each chroma option value, if not explicitly specified, is set to the
  10267. corresponding luma option value.
  10268. @anchor{scale}
  10269. @section scale
  10270. Scale (resize) the input video, using the libswscale library.
  10271. The scale filter forces the output display aspect ratio to be the same
  10272. of the input, by changing the output sample aspect ratio.
  10273. If the input image format is different from the format requested by
  10274. the next filter, the scale filter will convert the input to the
  10275. requested format.
  10276. @subsection Options
  10277. The filter accepts the following options, or any of the options
  10278. supported by the libswscale scaler.
  10279. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10280. the complete list of scaler options.
  10281. @table @option
  10282. @item width, w
  10283. @item height, h
  10284. Set the output video dimension expression. Default value is the input
  10285. dimension.
  10286. If the @var{width} or @var{w} value is 0, the input width is used for
  10287. the output. If the @var{height} or @var{h} value is 0, the input height
  10288. is used for the output.
  10289. If one and only one of the values is -n with n >= 1, the scale filter
  10290. will use a value that maintains the aspect ratio of the input image,
  10291. calculated from the other specified dimension. After that it will,
  10292. however, make sure that the calculated dimension is divisible by n and
  10293. adjust the value if necessary.
  10294. If both values are -n with n >= 1, the behavior will be identical to
  10295. both values being set to 0 as previously detailed.
  10296. See below for the list of accepted constants for use in the dimension
  10297. expression.
  10298. @item eval
  10299. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10300. @table @samp
  10301. @item init
  10302. Only evaluate expressions once during the filter initialization or when a command is processed.
  10303. @item frame
  10304. Evaluate expressions for each incoming frame.
  10305. @end table
  10306. Default value is @samp{init}.
  10307. @item interl
  10308. Set the interlacing mode. It accepts the following values:
  10309. @table @samp
  10310. @item 1
  10311. Force interlaced aware scaling.
  10312. @item 0
  10313. Do not apply interlaced scaling.
  10314. @item -1
  10315. Select interlaced aware scaling depending on whether the source frames
  10316. are flagged as interlaced or not.
  10317. @end table
  10318. Default value is @samp{0}.
  10319. @item flags
  10320. Set libswscale scaling flags. See
  10321. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10322. complete list of values. If not explicitly specified the filter applies
  10323. the default flags.
  10324. @item param0, param1
  10325. Set libswscale input parameters for scaling algorithms that need them. See
  10326. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10327. complete documentation. If not explicitly specified the filter applies
  10328. empty parameters.
  10329. @item size, s
  10330. Set the video size. For the syntax of this option, check the
  10331. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10332. @item in_color_matrix
  10333. @item out_color_matrix
  10334. Set in/output YCbCr color space type.
  10335. This allows the autodetected value to be overridden as well as allows forcing
  10336. a specific value used for the output and encoder.
  10337. If not specified, the color space type depends on the pixel format.
  10338. Possible values:
  10339. @table @samp
  10340. @item auto
  10341. Choose automatically.
  10342. @item bt709
  10343. Format conforming to International Telecommunication Union (ITU)
  10344. Recommendation BT.709.
  10345. @item fcc
  10346. Set color space conforming to the United States Federal Communications
  10347. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10348. @item bt601
  10349. Set color space conforming to:
  10350. @itemize
  10351. @item
  10352. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10353. @item
  10354. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10355. @item
  10356. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10357. @end itemize
  10358. @item smpte240m
  10359. Set color space conforming to SMPTE ST 240:1999.
  10360. @end table
  10361. @item in_range
  10362. @item out_range
  10363. Set in/output YCbCr sample range.
  10364. This allows the autodetected value to be overridden as well as allows forcing
  10365. a specific value used for the output and encoder. If not specified, the
  10366. range depends on the pixel format. Possible values:
  10367. @table @samp
  10368. @item auto/unknown
  10369. Choose automatically.
  10370. @item jpeg/full/pc
  10371. Set full range (0-255 in case of 8-bit luma).
  10372. @item mpeg/limited/tv
  10373. Set "MPEG" range (16-235 in case of 8-bit luma).
  10374. @end table
  10375. @item force_original_aspect_ratio
  10376. Enable decreasing or increasing output video width or height if necessary to
  10377. keep the original aspect ratio. Possible values:
  10378. @table @samp
  10379. @item disable
  10380. Scale the video as specified and disable this feature.
  10381. @item decrease
  10382. The output video dimensions will automatically be decreased if needed.
  10383. @item increase
  10384. The output video dimensions will automatically be increased if needed.
  10385. @end table
  10386. One useful instance of this option is that when you know a specific device's
  10387. maximum allowed resolution, you can use this to limit the output video to
  10388. that, while retaining the aspect ratio. For example, device A allows
  10389. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10390. decrease) and specifying 1280x720 to the command line makes the output
  10391. 1280x533.
  10392. Please note that this is a different thing than specifying -1 for @option{w}
  10393. or @option{h}, you still need to specify the output resolution for this option
  10394. to work.
  10395. @end table
  10396. The values of the @option{w} and @option{h} options are expressions
  10397. containing the following constants:
  10398. @table @var
  10399. @item in_w
  10400. @item in_h
  10401. The input width and height
  10402. @item iw
  10403. @item ih
  10404. These are the same as @var{in_w} and @var{in_h}.
  10405. @item out_w
  10406. @item out_h
  10407. The output (scaled) width and height
  10408. @item ow
  10409. @item oh
  10410. These are the same as @var{out_w} and @var{out_h}
  10411. @item a
  10412. The same as @var{iw} / @var{ih}
  10413. @item sar
  10414. input sample aspect ratio
  10415. @item dar
  10416. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10417. @item hsub
  10418. @item vsub
  10419. horizontal and vertical input chroma subsample values. For example for the
  10420. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10421. @item ohsub
  10422. @item ovsub
  10423. horizontal and vertical output chroma subsample values. For example for the
  10424. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10425. @end table
  10426. @subsection Examples
  10427. @itemize
  10428. @item
  10429. Scale the input video to a size of 200x100
  10430. @example
  10431. scale=w=200:h=100
  10432. @end example
  10433. This is equivalent to:
  10434. @example
  10435. scale=200:100
  10436. @end example
  10437. or:
  10438. @example
  10439. scale=200x100
  10440. @end example
  10441. @item
  10442. Specify a size abbreviation for the output size:
  10443. @example
  10444. scale=qcif
  10445. @end example
  10446. which can also be written as:
  10447. @example
  10448. scale=size=qcif
  10449. @end example
  10450. @item
  10451. Scale the input to 2x:
  10452. @example
  10453. scale=w=2*iw:h=2*ih
  10454. @end example
  10455. @item
  10456. The above is the same as:
  10457. @example
  10458. scale=2*in_w:2*in_h
  10459. @end example
  10460. @item
  10461. Scale the input to 2x with forced interlaced scaling:
  10462. @example
  10463. scale=2*iw:2*ih:interl=1
  10464. @end example
  10465. @item
  10466. Scale the input to half size:
  10467. @example
  10468. scale=w=iw/2:h=ih/2
  10469. @end example
  10470. @item
  10471. Increase the width, and set the height to the same size:
  10472. @example
  10473. scale=3/2*iw:ow
  10474. @end example
  10475. @item
  10476. Seek Greek harmony:
  10477. @example
  10478. scale=iw:1/PHI*iw
  10479. scale=ih*PHI:ih
  10480. @end example
  10481. @item
  10482. Increase the height, and set the width to 3/2 of the height:
  10483. @example
  10484. scale=w=3/2*oh:h=3/5*ih
  10485. @end example
  10486. @item
  10487. Increase the size, making the size a multiple of the chroma
  10488. subsample values:
  10489. @example
  10490. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10491. @end example
  10492. @item
  10493. Increase the width to a maximum of 500 pixels,
  10494. keeping the same aspect ratio as the input:
  10495. @example
  10496. scale=w='min(500\, iw*3/2):h=-1'
  10497. @end example
  10498. @item
  10499. Make pixels square by combining scale and setsar:
  10500. @example
  10501. scale='trunc(ih*dar):ih',setsar=1/1
  10502. @end example
  10503. @item
  10504. Make pixels square by combining scale and setsar,
  10505. making sure the resulting resolution is even (required by some codecs):
  10506. @example
  10507. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10508. @end example
  10509. @end itemize
  10510. @subsection Commands
  10511. This filter supports the following commands:
  10512. @table @option
  10513. @item width, w
  10514. @item height, h
  10515. Set the output video dimension expression.
  10516. The command accepts the same syntax of the corresponding option.
  10517. If the specified expression is not valid, it is kept at its current
  10518. value.
  10519. @end table
  10520. @section scale_npp
  10521. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10522. format conversion on CUDA video frames. Setting the output width and height
  10523. works in the same way as for the @var{scale} filter.
  10524. The following additional options are accepted:
  10525. @table @option
  10526. @item format
  10527. The pixel format of the output CUDA frames. If set to the string "same" (the
  10528. default), the input format will be kept. Note that automatic format negotiation
  10529. and conversion is not yet supported for hardware frames
  10530. @item interp_algo
  10531. The interpolation algorithm used for resizing. One of the following:
  10532. @table @option
  10533. @item nn
  10534. Nearest neighbour.
  10535. @item linear
  10536. @item cubic
  10537. @item cubic2p_bspline
  10538. 2-parameter cubic (B=1, C=0)
  10539. @item cubic2p_catmullrom
  10540. 2-parameter cubic (B=0, C=1/2)
  10541. @item cubic2p_b05c03
  10542. 2-parameter cubic (B=1/2, C=3/10)
  10543. @item super
  10544. Supersampling
  10545. @item lanczos
  10546. @end table
  10547. @end table
  10548. @section scale2ref
  10549. Scale (resize) the input video, based on a reference video.
  10550. See the scale filter for available options, scale2ref supports the same but
  10551. uses the reference video instead of the main input as basis. scale2ref also
  10552. supports the following additional constants for the @option{w} and
  10553. @option{h} options:
  10554. @table @var
  10555. @item main_w
  10556. @item main_h
  10557. The main input video's width and height
  10558. @item main_a
  10559. The same as @var{main_w} / @var{main_h}
  10560. @item main_sar
  10561. The main input video's sample aspect ratio
  10562. @item main_dar, mdar
  10563. The main input video's display aspect ratio. Calculated from
  10564. @code{(main_w / main_h) * main_sar}.
  10565. @item main_hsub
  10566. @item main_vsub
  10567. The main input video's horizontal and vertical chroma subsample values.
  10568. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10569. is 1.
  10570. @end table
  10571. @subsection Examples
  10572. @itemize
  10573. @item
  10574. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10575. @example
  10576. 'scale2ref[b][a];[a][b]overlay'
  10577. @end example
  10578. @end itemize
  10579. @anchor{selectivecolor}
  10580. @section selectivecolor
  10581. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10582. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10583. by the "purity" of the color (that is, how saturated it already is).
  10584. This filter is similar to the Adobe Photoshop Selective Color tool.
  10585. The filter accepts the following options:
  10586. @table @option
  10587. @item correction_method
  10588. Select color correction method.
  10589. Available values are:
  10590. @table @samp
  10591. @item absolute
  10592. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10593. component value).
  10594. @item relative
  10595. Specified adjustments are relative to the original component value.
  10596. @end table
  10597. Default is @code{absolute}.
  10598. @item reds
  10599. Adjustments for red pixels (pixels where the red component is the maximum)
  10600. @item yellows
  10601. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10602. @item greens
  10603. Adjustments for green pixels (pixels where the green component is the maximum)
  10604. @item cyans
  10605. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10606. @item blues
  10607. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10608. @item magentas
  10609. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10610. @item whites
  10611. Adjustments for white pixels (pixels where all components are greater than 128)
  10612. @item neutrals
  10613. Adjustments for all pixels except pure black and pure white
  10614. @item blacks
  10615. Adjustments for black pixels (pixels where all components are lesser than 128)
  10616. @item psfile
  10617. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10618. @end table
  10619. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10620. 4 space separated floating point adjustment values in the [-1,1] range,
  10621. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10622. pixels of its range.
  10623. @subsection Examples
  10624. @itemize
  10625. @item
  10626. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10627. increase magenta by 27% in blue areas:
  10628. @example
  10629. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10630. @end example
  10631. @item
  10632. Use a Photoshop selective color preset:
  10633. @example
  10634. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10635. @end example
  10636. @end itemize
  10637. @anchor{separatefields}
  10638. @section separatefields
  10639. The @code{separatefields} takes a frame-based video input and splits
  10640. each frame into its components fields, producing a new half height clip
  10641. with twice the frame rate and twice the frame count.
  10642. This filter use field-dominance information in frame to decide which
  10643. of each pair of fields to place first in the output.
  10644. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10645. @section setdar, setsar
  10646. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10647. output video.
  10648. This is done by changing the specified Sample (aka Pixel) Aspect
  10649. Ratio, according to the following equation:
  10650. @example
  10651. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10652. @end example
  10653. Keep in mind that the @code{setdar} filter does not modify the pixel
  10654. dimensions of the video frame. Also, the display aspect ratio set by
  10655. this filter may be changed by later filters in the filterchain,
  10656. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10657. applied.
  10658. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10659. the filter output video.
  10660. Note that as a consequence of the application of this filter, the
  10661. output display aspect ratio will change according to the equation
  10662. above.
  10663. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10664. filter may be changed by later filters in the filterchain, e.g. if
  10665. another "setsar" or a "setdar" filter is applied.
  10666. It accepts the following parameters:
  10667. @table @option
  10668. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10669. Set the aspect ratio used by the filter.
  10670. The parameter can be a floating point number string, an expression, or
  10671. a string of the form @var{num}:@var{den}, where @var{num} and
  10672. @var{den} are the numerator and denominator of the aspect ratio. If
  10673. the parameter is not specified, it is assumed the value "0".
  10674. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10675. should be escaped.
  10676. @item max
  10677. Set the maximum integer value to use for expressing numerator and
  10678. denominator when reducing the expressed aspect ratio to a rational.
  10679. Default value is @code{100}.
  10680. @end table
  10681. The parameter @var{sar} is an expression containing
  10682. the following constants:
  10683. @table @option
  10684. @item E, PI, PHI
  10685. These are approximated values for the mathematical constants e
  10686. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10687. @item w, h
  10688. The input width and height.
  10689. @item a
  10690. These are the same as @var{w} / @var{h}.
  10691. @item sar
  10692. The input sample aspect ratio.
  10693. @item dar
  10694. The input display aspect ratio. It is the same as
  10695. (@var{w} / @var{h}) * @var{sar}.
  10696. @item hsub, vsub
  10697. Horizontal and vertical chroma subsample values. For example, for the
  10698. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10699. @end table
  10700. @subsection Examples
  10701. @itemize
  10702. @item
  10703. To change the display aspect ratio to 16:9, specify one of the following:
  10704. @example
  10705. setdar=dar=1.77777
  10706. setdar=dar=16/9
  10707. @end example
  10708. @item
  10709. To change the sample aspect ratio to 10:11, specify:
  10710. @example
  10711. setsar=sar=10/11
  10712. @end example
  10713. @item
  10714. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10715. 1000 in the aspect ratio reduction, use the command:
  10716. @example
  10717. setdar=ratio=16/9:max=1000
  10718. @end example
  10719. @end itemize
  10720. @anchor{setfield}
  10721. @section setfield
  10722. Force field for the output video frame.
  10723. The @code{setfield} filter marks the interlace type field for the
  10724. output frames. It does not change the input frame, but only sets the
  10725. corresponding property, which affects how the frame is treated by
  10726. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10727. The filter accepts the following options:
  10728. @table @option
  10729. @item mode
  10730. Available values are:
  10731. @table @samp
  10732. @item auto
  10733. Keep the same field property.
  10734. @item bff
  10735. Mark the frame as bottom-field-first.
  10736. @item tff
  10737. Mark the frame as top-field-first.
  10738. @item prog
  10739. Mark the frame as progressive.
  10740. @end table
  10741. @end table
  10742. @section showinfo
  10743. Show a line containing various information for each input video frame.
  10744. The input video is not modified.
  10745. The shown line contains a sequence of key/value pairs of the form
  10746. @var{key}:@var{value}.
  10747. The following values are shown in the output:
  10748. @table @option
  10749. @item n
  10750. The (sequential) number of the input frame, starting from 0.
  10751. @item pts
  10752. The Presentation TimeStamp of the input frame, expressed as a number of
  10753. time base units. The time base unit depends on the filter input pad.
  10754. @item pts_time
  10755. The Presentation TimeStamp of the input frame, expressed as a number of
  10756. seconds.
  10757. @item pos
  10758. The position of the frame in the input stream, or -1 if this information is
  10759. unavailable and/or meaningless (for example in case of synthetic video).
  10760. @item fmt
  10761. The pixel format name.
  10762. @item sar
  10763. The sample aspect ratio of the input frame, expressed in the form
  10764. @var{num}/@var{den}.
  10765. @item s
  10766. The size of the input frame. For the syntax of this option, check the
  10767. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10768. @item i
  10769. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10770. for bottom field first).
  10771. @item iskey
  10772. This is 1 if the frame is a key frame, 0 otherwise.
  10773. @item type
  10774. The picture type of the input frame ("I" for an I-frame, "P" for a
  10775. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10776. Also refer to the documentation of the @code{AVPictureType} enum and of
  10777. the @code{av_get_picture_type_char} function defined in
  10778. @file{libavutil/avutil.h}.
  10779. @item checksum
  10780. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10781. @item plane_checksum
  10782. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10783. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10784. @end table
  10785. @section showpalette
  10786. Displays the 256 colors palette of each frame. This filter is only relevant for
  10787. @var{pal8} pixel format frames.
  10788. It accepts the following option:
  10789. @table @option
  10790. @item s
  10791. Set the size of the box used to represent one palette color entry. Default is
  10792. @code{30} (for a @code{30x30} pixel box).
  10793. @end table
  10794. @section shuffleframes
  10795. Reorder and/or duplicate and/or drop video frames.
  10796. It accepts the following parameters:
  10797. @table @option
  10798. @item mapping
  10799. Set the destination indexes of input frames.
  10800. This is space or '|' separated list of indexes that maps input frames to output
  10801. frames. Number of indexes also sets maximal value that each index may have.
  10802. '-1' index have special meaning and that is to drop frame.
  10803. @end table
  10804. The first frame has the index 0. The default is to keep the input unchanged.
  10805. @subsection Examples
  10806. @itemize
  10807. @item
  10808. Swap second and third frame of every three frames of the input:
  10809. @example
  10810. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10811. @end example
  10812. @item
  10813. Swap 10th and 1st frame of every ten frames of the input:
  10814. @example
  10815. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10816. @end example
  10817. @end itemize
  10818. @section shuffleplanes
  10819. Reorder and/or duplicate video planes.
  10820. It accepts the following parameters:
  10821. @table @option
  10822. @item map0
  10823. The index of the input plane to be used as the first output plane.
  10824. @item map1
  10825. The index of the input plane to be used as the second output plane.
  10826. @item map2
  10827. The index of the input plane to be used as the third output plane.
  10828. @item map3
  10829. The index of the input plane to be used as the fourth output plane.
  10830. @end table
  10831. The first plane has the index 0. The default is to keep the input unchanged.
  10832. @subsection Examples
  10833. @itemize
  10834. @item
  10835. Swap the second and third planes of the input:
  10836. @example
  10837. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10838. @end example
  10839. @end itemize
  10840. @anchor{signalstats}
  10841. @section signalstats
  10842. Evaluate various visual metrics that assist in determining issues associated
  10843. with the digitization of analog video media.
  10844. By default the filter will log these metadata values:
  10845. @table @option
  10846. @item YMIN
  10847. Display the minimal Y value contained within the input frame. Expressed in
  10848. range of [0-255].
  10849. @item YLOW
  10850. Display the Y value at the 10% percentile within the input frame. Expressed in
  10851. range of [0-255].
  10852. @item YAVG
  10853. Display the average Y value within the input frame. Expressed in range of
  10854. [0-255].
  10855. @item YHIGH
  10856. Display the Y value at the 90% percentile within the input frame. Expressed in
  10857. range of [0-255].
  10858. @item YMAX
  10859. Display the maximum Y value contained within the input frame. Expressed in
  10860. range of [0-255].
  10861. @item UMIN
  10862. Display the minimal U value contained within the input frame. Expressed in
  10863. range of [0-255].
  10864. @item ULOW
  10865. Display the U value at the 10% percentile within the input frame. Expressed in
  10866. range of [0-255].
  10867. @item UAVG
  10868. Display the average U value within the input frame. Expressed in range of
  10869. [0-255].
  10870. @item UHIGH
  10871. Display the U value at the 90% percentile within the input frame. Expressed in
  10872. range of [0-255].
  10873. @item UMAX
  10874. Display the maximum U value contained within the input frame. Expressed in
  10875. range of [0-255].
  10876. @item VMIN
  10877. Display the minimal V value contained within the input frame. Expressed in
  10878. range of [0-255].
  10879. @item VLOW
  10880. Display the V value at the 10% percentile within the input frame. Expressed in
  10881. range of [0-255].
  10882. @item VAVG
  10883. Display the average V value within the input frame. Expressed in range of
  10884. [0-255].
  10885. @item VHIGH
  10886. Display the V value at the 90% percentile within the input frame. Expressed in
  10887. range of [0-255].
  10888. @item VMAX
  10889. Display the maximum V value contained within the input frame. Expressed in
  10890. range of [0-255].
  10891. @item SATMIN
  10892. Display the minimal saturation value contained within the input frame.
  10893. Expressed in range of [0-~181.02].
  10894. @item SATLOW
  10895. Display the saturation value at the 10% percentile within the input frame.
  10896. Expressed in range of [0-~181.02].
  10897. @item SATAVG
  10898. Display the average saturation value within the input frame. Expressed in range
  10899. of [0-~181.02].
  10900. @item SATHIGH
  10901. Display the saturation value at the 90% percentile within the input frame.
  10902. Expressed in range of [0-~181.02].
  10903. @item SATMAX
  10904. Display the maximum saturation value contained within the input frame.
  10905. Expressed in range of [0-~181.02].
  10906. @item HUEMED
  10907. Display the median value for hue within the input frame. Expressed in range of
  10908. [0-360].
  10909. @item HUEAVG
  10910. Display the average value for hue within the input frame. Expressed in range of
  10911. [0-360].
  10912. @item YDIF
  10913. Display the average of sample value difference between all values of the Y
  10914. plane in the current frame and corresponding values of the previous input frame.
  10915. Expressed in range of [0-255].
  10916. @item UDIF
  10917. Display the average of sample value difference between all values of the U
  10918. plane in the current frame and corresponding values of the previous input frame.
  10919. Expressed in range of [0-255].
  10920. @item VDIF
  10921. Display the average of sample value difference between all values of the V
  10922. plane in the current frame and corresponding values of the previous input frame.
  10923. Expressed in range of [0-255].
  10924. @item YBITDEPTH
  10925. Display bit depth of Y plane in current frame.
  10926. Expressed in range of [0-16].
  10927. @item UBITDEPTH
  10928. Display bit depth of U plane in current frame.
  10929. Expressed in range of [0-16].
  10930. @item VBITDEPTH
  10931. Display bit depth of V plane in current frame.
  10932. Expressed in range of [0-16].
  10933. @end table
  10934. The filter accepts the following options:
  10935. @table @option
  10936. @item stat
  10937. @item out
  10938. @option{stat} specify an additional form of image analysis.
  10939. @option{out} output video with the specified type of pixel highlighted.
  10940. Both options accept the following values:
  10941. @table @samp
  10942. @item tout
  10943. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10944. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10945. include the results of video dropouts, head clogs, or tape tracking issues.
  10946. @item vrep
  10947. Identify @var{vertical line repetition}. Vertical line repetition includes
  10948. similar rows of pixels within a frame. In born-digital video vertical line
  10949. repetition is common, but this pattern is uncommon in video digitized from an
  10950. analog source. When it occurs in video that results from the digitization of an
  10951. analog source it can indicate concealment from a dropout compensator.
  10952. @item brng
  10953. Identify pixels that fall outside of legal broadcast range.
  10954. @end table
  10955. @item color, c
  10956. Set the highlight color for the @option{out} option. The default color is
  10957. yellow.
  10958. @end table
  10959. @subsection Examples
  10960. @itemize
  10961. @item
  10962. Output data of various video metrics:
  10963. @example
  10964. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10965. @end example
  10966. @item
  10967. Output specific data about the minimum and maximum values of the Y plane per frame:
  10968. @example
  10969. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10970. @end example
  10971. @item
  10972. Playback video while highlighting pixels that are outside of broadcast range in red.
  10973. @example
  10974. ffplay example.mov -vf signalstats="out=brng:color=red"
  10975. @end example
  10976. @item
  10977. Playback video with signalstats metadata drawn over the frame.
  10978. @example
  10979. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10980. @end example
  10981. The contents of signalstat_drawtext.txt used in the command are:
  10982. @example
  10983. time %@{pts:hms@}
  10984. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10985. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10986. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10987. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10988. @end example
  10989. @end itemize
  10990. @anchor{signature}
  10991. @section signature
  10992. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10993. input. In this case the matching between the inputs can be calculated additionally.
  10994. The filter always passes through the first input. The signature of each stream can
  10995. be written into a file.
  10996. It accepts the following options:
  10997. @table @option
  10998. @item detectmode
  10999. Enable or disable the matching process.
  11000. Available values are:
  11001. @table @samp
  11002. @item off
  11003. Disable the calculation of a matching (default).
  11004. @item full
  11005. Calculate the matching for the whole video and output whether the whole video
  11006. matches or only parts.
  11007. @item fast
  11008. Calculate only until a matching is found or the video ends. Should be faster in
  11009. some cases.
  11010. @end table
  11011. @item nb_inputs
  11012. Set the number of inputs. The option value must be a non negative integer.
  11013. Default value is 1.
  11014. @item filename
  11015. Set the path to which the output is written. If there is more than one input,
  11016. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11017. integer), that will be replaced with the input number. If no filename is
  11018. specified, no output will be written. This is the default.
  11019. @item format
  11020. Choose the output format.
  11021. Available values are:
  11022. @table @samp
  11023. @item binary
  11024. Use the specified binary representation (default).
  11025. @item xml
  11026. Use the specified xml representation.
  11027. @end table
  11028. @item th_d
  11029. Set threshold to detect one word as similar. The option value must be an integer
  11030. greater than zero. The default value is 9000.
  11031. @item th_dc
  11032. Set threshold to detect all words as similar. The option value must be an integer
  11033. greater than zero. The default value is 60000.
  11034. @item th_xh
  11035. Set threshold to detect frames as similar. The option value must be an integer
  11036. greater than zero. The default value is 116.
  11037. @item th_di
  11038. Set the minimum length of a sequence in frames to recognize it as matching
  11039. sequence. The option value must be a non negative integer value.
  11040. The default value is 0.
  11041. @item th_it
  11042. Set the minimum relation, that matching frames to all frames must have.
  11043. The option value must be a double value between 0 and 1. The default value is 0.5.
  11044. @end table
  11045. @subsection Examples
  11046. @itemize
  11047. @item
  11048. To calculate the signature of an input video and store it in signature.bin:
  11049. @example
  11050. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11051. @end example
  11052. @item
  11053. To detect whether two videos match and store the signatures in XML format in
  11054. signature0.xml and signature1.xml:
  11055. @example
  11056. 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 -
  11057. @end example
  11058. @end itemize
  11059. @anchor{smartblur}
  11060. @section smartblur
  11061. Blur the input video without impacting the outlines.
  11062. It accepts the following options:
  11063. @table @option
  11064. @item luma_radius, lr
  11065. Set the luma radius. The option value must be a float number in
  11066. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11067. used to blur the image (slower if larger). Default value is 1.0.
  11068. @item luma_strength, ls
  11069. Set the luma strength. The option value must be a float number
  11070. in the range [-1.0,1.0] that configures the blurring. A value included
  11071. in [0.0,1.0] will blur the image whereas a value included in
  11072. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11073. @item luma_threshold, lt
  11074. Set the luma threshold used as a coefficient to determine
  11075. whether a pixel should be blurred or not. The option value must be an
  11076. integer in the range [-30,30]. A value of 0 will filter all the image,
  11077. a value included in [0,30] will filter flat areas and a value included
  11078. in [-30,0] will filter edges. Default value is 0.
  11079. @item chroma_radius, cr
  11080. Set the chroma radius. The option value must be a float number in
  11081. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11082. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11083. @item chroma_strength, cs
  11084. Set the chroma strength. The option value must be a float number
  11085. in the range [-1.0,1.0] that configures the blurring. A value included
  11086. in [0.0,1.0] will blur the image whereas a value included in
  11087. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11088. @item chroma_threshold, ct
  11089. Set the chroma threshold used as a coefficient to determine
  11090. whether a pixel should be blurred or not. The option value must be an
  11091. integer in the range [-30,30]. A value of 0 will filter all the image,
  11092. a value included in [0,30] will filter flat areas and a value included
  11093. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11094. @end table
  11095. If a chroma option is not explicitly set, the corresponding luma value
  11096. is set.
  11097. @section ssim
  11098. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11099. This filter takes in input two input videos, the first input is
  11100. considered the "main" source and is passed unchanged to the
  11101. output. The second input is used as a "reference" video for computing
  11102. the SSIM.
  11103. Both video inputs must have the same resolution and pixel format for
  11104. this filter to work correctly. Also it assumes that both inputs
  11105. have the same number of frames, which are compared one by one.
  11106. The filter stores the calculated SSIM of each frame.
  11107. The description of the accepted parameters follows.
  11108. @table @option
  11109. @item stats_file, f
  11110. If specified the filter will use the named file to save the SSIM of
  11111. each individual frame. When filename equals "-" the data is sent to
  11112. standard output.
  11113. @end table
  11114. The file printed if @var{stats_file} is selected, contains a sequence of
  11115. key/value pairs of the form @var{key}:@var{value} for each compared
  11116. couple of frames.
  11117. A description of each shown parameter follows:
  11118. @table @option
  11119. @item n
  11120. sequential number of the input frame, starting from 1
  11121. @item Y, U, V, R, G, B
  11122. SSIM of the compared frames for the component specified by the suffix.
  11123. @item All
  11124. SSIM of the compared frames for the whole frame.
  11125. @item dB
  11126. Same as above but in dB representation.
  11127. @end table
  11128. This filter also supports the @ref{framesync} options.
  11129. For example:
  11130. @example
  11131. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11132. [main][ref] ssim="stats_file=stats.log" [out]
  11133. @end example
  11134. On this example the input file being processed is compared with the
  11135. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11136. is stored in @file{stats.log}.
  11137. Another example with both psnr and ssim at same time:
  11138. @example
  11139. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11140. @end example
  11141. @section stereo3d
  11142. Convert between different stereoscopic image formats.
  11143. The filters accept the following options:
  11144. @table @option
  11145. @item in
  11146. Set stereoscopic image format of input.
  11147. Available values for input image formats are:
  11148. @table @samp
  11149. @item sbsl
  11150. side by side parallel (left eye left, right eye right)
  11151. @item sbsr
  11152. side by side crosseye (right eye left, left eye right)
  11153. @item sbs2l
  11154. side by side parallel with half width resolution
  11155. (left eye left, right eye right)
  11156. @item sbs2r
  11157. side by side crosseye with half width resolution
  11158. (right eye left, left eye right)
  11159. @item abl
  11160. above-below (left eye above, right eye below)
  11161. @item abr
  11162. above-below (right eye above, left eye below)
  11163. @item ab2l
  11164. above-below with half height resolution
  11165. (left eye above, right eye below)
  11166. @item ab2r
  11167. above-below with half height resolution
  11168. (right eye above, left eye below)
  11169. @item al
  11170. alternating frames (left eye first, right eye second)
  11171. @item ar
  11172. alternating frames (right eye first, left eye second)
  11173. @item irl
  11174. interleaved rows (left eye has top row, right eye starts on next row)
  11175. @item irr
  11176. interleaved rows (right eye has top row, left eye starts on next row)
  11177. @item icl
  11178. interleaved columns, left eye first
  11179. @item icr
  11180. interleaved columns, right eye first
  11181. Default value is @samp{sbsl}.
  11182. @end table
  11183. @item out
  11184. Set stereoscopic image format of output.
  11185. @table @samp
  11186. @item sbsl
  11187. side by side parallel (left eye left, right eye right)
  11188. @item sbsr
  11189. side by side crosseye (right eye left, left eye right)
  11190. @item sbs2l
  11191. side by side parallel with half width resolution
  11192. (left eye left, right eye right)
  11193. @item sbs2r
  11194. side by side crosseye with half width resolution
  11195. (right eye left, left eye right)
  11196. @item abl
  11197. above-below (left eye above, right eye below)
  11198. @item abr
  11199. above-below (right eye above, left eye below)
  11200. @item ab2l
  11201. above-below with half height resolution
  11202. (left eye above, right eye below)
  11203. @item ab2r
  11204. above-below with half height resolution
  11205. (right eye above, left eye below)
  11206. @item al
  11207. alternating frames (left eye first, right eye second)
  11208. @item ar
  11209. alternating frames (right eye first, left eye second)
  11210. @item irl
  11211. interleaved rows (left eye has top row, right eye starts on next row)
  11212. @item irr
  11213. interleaved rows (right eye has top row, left eye starts on next row)
  11214. @item arbg
  11215. anaglyph red/blue gray
  11216. (red filter on left eye, blue filter on right eye)
  11217. @item argg
  11218. anaglyph red/green gray
  11219. (red filter on left eye, green filter on right eye)
  11220. @item arcg
  11221. anaglyph red/cyan gray
  11222. (red filter on left eye, cyan filter on right eye)
  11223. @item arch
  11224. anaglyph red/cyan half colored
  11225. (red filter on left eye, cyan filter on right eye)
  11226. @item arcc
  11227. anaglyph red/cyan color
  11228. (red filter on left eye, cyan filter on right eye)
  11229. @item arcd
  11230. anaglyph red/cyan color optimized with the least squares projection of dubois
  11231. (red filter on left eye, cyan filter on right eye)
  11232. @item agmg
  11233. anaglyph green/magenta gray
  11234. (green filter on left eye, magenta filter on right eye)
  11235. @item agmh
  11236. anaglyph green/magenta half colored
  11237. (green filter on left eye, magenta filter on right eye)
  11238. @item agmc
  11239. anaglyph green/magenta colored
  11240. (green filter on left eye, magenta filter on right eye)
  11241. @item agmd
  11242. anaglyph green/magenta color optimized with the least squares projection of dubois
  11243. (green filter on left eye, magenta filter on right eye)
  11244. @item aybg
  11245. anaglyph yellow/blue gray
  11246. (yellow filter on left eye, blue filter on right eye)
  11247. @item aybh
  11248. anaglyph yellow/blue half colored
  11249. (yellow filter on left eye, blue filter on right eye)
  11250. @item aybc
  11251. anaglyph yellow/blue colored
  11252. (yellow filter on left eye, blue filter on right eye)
  11253. @item aybd
  11254. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11255. (yellow filter on left eye, blue filter on right eye)
  11256. @item ml
  11257. mono output (left eye only)
  11258. @item mr
  11259. mono output (right eye only)
  11260. @item chl
  11261. checkerboard, left eye first
  11262. @item chr
  11263. checkerboard, right eye first
  11264. @item icl
  11265. interleaved columns, left eye first
  11266. @item icr
  11267. interleaved columns, right eye first
  11268. @item hdmi
  11269. HDMI frame pack
  11270. @end table
  11271. Default value is @samp{arcd}.
  11272. @end table
  11273. @subsection Examples
  11274. @itemize
  11275. @item
  11276. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11277. @example
  11278. stereo3d=sbsl:aybd
  11279. @end example
  11280. @item
  11281. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11282. @example
  11283. stereo3d=abl:sbsr
  11284. @end example
  11285. @end itemize
  11286. @section streamselect, astreamselect
  11287. Select video or audio streams.
  11288. The filter accepts the following options:
  11289. @table @option
  11290. @item inputs
  11291. Set number of inputs. Default is 2.
  11292. @item map
  11293. Set input indexes to remap to outputs.
  11294. @end table
  11295. @subsection Commands
  11296. The @code{streamselect} and @code{astreamselect} filter supports the following
  11297. commands:
  11298. @table @option
  11299. @item map
  11300. Set input indexes to remap to outputs.
  11301. @end table
  11302. @subsection Examples
  11303. @itemize
  11304. @item
  11305. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11306. @example
  11307. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11308. @end example
  11309. @item
  11310. Same as above, but for audio:
  11311. @example
  11312. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11313. @end example
  11314. @end itemize
  11315. @section sobel
  11316. Apply sobel operator to input video stream.
  11317. The filter accepts the following option:
  11318. @table @option
  11319. @item planes
  11320. Set which planes will be processed, unprocessed planes will be copied.
  11321. By default value 0xf, all planes will be processed.
  11322. @item scale
  11323. Set value which will be multiplied with filtered result.
  11324. @item delta
  11325. Set value which will be added to filtered result.
  11326. @end table
  11327. @anchor{spp}
  11328. @section spp
  11329. Apply a simple postprocessing filter that compresses and decompresses the image
  11330. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11331. and average the results.
  11332. The filter accepts the following options:
  11333. @table @option
  11334. @item quality
  11335. Set quality. This option defines the number of levels for averaging. It accepts
  11336. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11337. effect. A value of @code{6} means the higher quality. For each increment of
  11338. that value the speed drops by a factor of approximately 2. Default value is
  11339. @code{3}.
  11340. @item qp
  11341. Force a constant quantization parameter. If not set, the filter will use the QP
  11342. from the video stream (if available).
  11343. @item mode
  11344. Set thresholding mode. Available modes are:
  11345. @table @samp
  11346. @item hard
  11347. Set hard thresholding (default).
  11348. @item soft
  11349. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11350. @end table
  11351. @item use_bframe_qp
  11352. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11353. option may cause flicker since the B-Frames have often larger QP. Default is
  11354. @code{0} (not enabled).
  11355. @end table
  11356. @anchor{subtitles}
  11357. @section subtitles
  11358. Draw subtitles on top of input video using the libass library.
  11359. To enable compilation of this filter you need to configure FFmpeg with
  11360. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11361. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11362. Alpha) subtitles format.
  11363. The filter accepts the following options:
  11364. @table @option
  11365. @item filename, f
  11366. Set the filename of the subtitle file to read. It must be specified.
  11367. @item original_size
  11368. Specify the size of the original video, the video for which the ASS file
  11369. was composed. For the syntax of this option, check the
  11370. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11371. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11372. correctly scale the fonts if the aspect ratio has been changed.
  11373. @item fontsdir
  11374. Set a directory path containing fonts that can be used by the filter.
  11375. These fonts will be used in addition to whatever the font provider uses.
  11376. @item alpha
  11377. Process alpha channel, by default alpha channel is untouched.
  11378. @item charenc
  11379. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11380. useful if not UTF-8.
  11381. @item stream_index, si
  11382. Set subtitles stream index. @code{subtitles} filter only.
  11383. @item force_style
  11384. Override default style or script info parameters of the subtitles. It accepts a
  11385. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11386. @end table
  11387. If the first key is not specified, it is assumed that the first value
  11388. specifies the @option{filename}.
  11389. For example, to render the file @file{sub.srt} on top of the input
  11390. video, use the command:
  11391. @example
  11392. subtitles=sub.srt
  11393. @end example
  11394. which is equivalent to:
  11395. @example
  11396. subtitles=filename=sub.srt
  11397. @end example
  11398. To render the default subtitles stream from file @file{video.mkv}, use:
  11399. @example
  11400. subtitles=video.mkv
  11401. @end example
  11402. To render the second subtitles stream from that file, use:
  11403. @example
  11404. subtitles=video.mkv:si=1
  11405. @end example
  11406. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11407. @code{DejaVu Serif}, use:
  11408. @example
  11409. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11410. @end example
  11411. @section super2xsai
  11412. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11413. Interpolate) pixel art scaling algorithm.
  11414. Useful for enlarging pixel art images without reducing sharpness.
  11415. @section swaprect
  11416. Swap two rectangular objects in video.
  11417. This filter accepts the following options:
  11418. @table @option
  11419. @item w
  11420. Set object width.
  11421. @item h
  11422. Set object height.
  11423. @item x1
  11424. Set 1st rect x coordinate.
  11425. @item y1
  11426. Set 1st rect y coordinate.
  11427. @item x2
  11428. Set 2nd rect x coordinate.
  11429. @item y2
  11430. Set 2nd rect y coordinate.
  11431. All expressions are evaluated once for each frame.
  11432. @end table
  11433. The all options are expressions containing the following constants:
  11434. @table @option
  11435. @item w
  11436. @item h
  11437. The input width and height.
  11438. @item a
  11439. same as @var{w} / @var{h}
  11440. @item sar
  11441. input sample aspect ratio
  11442. @item dar
  11443. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11444. @item n
  11445. The number of the input frame, starting from 0.
  11446. @item t
  11447. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11448. @item pos
  11449. the position in the file of the input frame, NAN if unknown
  11450. @end table
  11451. @section swapuv
  11452. Swap U & V plane.
  11453. @section telecine
  11454. Apply telecine process to the video.
  11455. This filter accepts the following options:
  11456. @table @option
  11457. @item first_field
  11458. @table @samp
  11459. @item top, t
  11460. top field first
  11461. @item bottom, b
  11462. bottom field first
  11463. The default value is @code{top}.
  11464. @end table
  11465. @item pattern
  11466. A string of numbers representing the pulldown pattern you wish to apply.
  11467. The default value is @code{23}.
  11468. @end table
  11469. @example
  11470. Some typical patterns:
  11471. NTSC output (30i):
  11472. 27.5p: 32222
  11473. 24p: 23 (classic)
  11474. 24p: 2332 (preferred)
  11475. 20p: 33
  11476. 18p: 334
  11477. 16p: 3444
  11478. PAL output (25i):
  11479. 27.5p: 12222
  11480. 24p: 222222222223 ("Euro pulldown")
  11481. 16.67p: 33
  11482. 16p: 33333334
  11483. @end example
  11484. @section threshold
  11485. Apply threshold effect to video stream.
  11486. This filter needs four video streams to perform thresholding.
  11487. First stream is stream we are filtering.
  11488. Second stream is holding threshold values, third stream is holding min values,
  11489. and last, fourth stream is holding max values.
  11490. The filter accepts the following option:
  11491. @table @option
  11492. @item planes
  11493. Set which planes will be processed, unprocessed planes will be copied.
  11494. By default value 0xf, all planes will be processed.
  11495. @end table
  11496. For example if first stream pixel's component value is less then threshold value
  11497. of pixel component from 2nd threshold stream, third stream value will picked,
  11498. otherwise fourth stream pixel component value will be picked.
  11499. Using color source filter one can perform various types of thresholding:
  11500. @subsection Examples
  11501. @itemize
  11502. @item
  11503. Binary threshold, using gray color as threshold:
  11504. @example
  11505. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11506. @end example
  11507. @item
  11508. Inverted binary threshold, using gray color as threshold:
  11509. @example
  11510. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11511. @end example
  11512. @item
  11513. Truncate binary threshold, using gray color as threshold:
  11514. @example
  11515. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11516. @end example
  11517. @item
  11518. Threshold to zero, using gray color as threshold:
  11519. @example
  11520. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11521. @end example
  11522. @item
  11523. Inverted threshold to zero, using gray color as threshold:
  11524. @example
  11525. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11526. @end example
  11527. @end itemize
  11528. @section thumbnail
  11529. Select the most representative frame in a given sequence of consecutive frames.
  11530. The filter accepts the following options:
  11531. @table @option
  11532. @item n
  11533. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11534. will pick one of them, and then handle the next batch of @var{n} frames until
  11535. the end. Default is @code{100}.
  11536. @end table
  11537. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11538. value will result in a higher memory usage, so a high value is not recommended.
  11539. @subsection Examples
  11540. @itemize
  11541. @item
  11542. Extract one picture each 50 frames:
  11543. @example
  11544. thumbnail=50
  11545. @end example
  11546. @item
  11547. Complete example of a thumbnail creation with @command{ffmpeg}:
  11548. @example
  11549. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11550. @end example
  11551. @end itemize
  11552. @section tile
  11553. Tile several successive frames together.
  11554. The filter accepts the following options:
  11555. @table @option
  11556. @item layout
  11557. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11558. this option, check the
  11559. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11560. @item nb_frames
  11561. Set the maximum number of frames to render in the given area. It must be less
  11562. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11563. the area will be used.
  11564. @item margin
  11565. Set the outer border margin in pixels.
  11566. @item padding
  11567. Set the inner border thickness (i.e. the number of pixels between frames). For
  11568. more advanced padding options (such as having different values for the edges),
  11569. refer to the pad video filter.
  11570. @item color
  11571. Specify the color of the unused area. For the syntax of this option, check the
  11572. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11573. The default value of @var{color} is "black".
  11574. @item overlap
  11575. Set the number of frames to overlap when tiling several successive frames together.
  11576. The value must be between @code{0} and @var{nb_frames - 1}.
  11577. @item init_padding
  11578. Set the number of frames to initially be empty before displaying first output frame.
  11579. This controls how soon will one get first output frame.
  11580. The value must be between @code{0} and @var{nb_frames - 1}.
  11581. @end table
  11582. @subsection Examples
  11583. @itemize
  11584. @item
  11585. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11586. @example
  11587. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11588. @end example
  11589. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11590. duplicating each output frame to accommodate the originally detected frame
  11591. rate.
  11592. @item
  11593. Display @code{5} pictures in an area of @code{3x2} frames,
  11594. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11595. mixed flat and named options:
  11596. @example
  11597. tile=3x2:nb_frames=5:padding=7:margin=2
  11598. @end example
  11599. @end itemize
  11600. @section tinterlace
  11601. Perform various types of temporal field interlacing.
  11602. Frames are counted starting from 1, so the first input frame is
  11603. considered odd.
  11604. The filter accepts the following options:
  11605. @table @option
  11606. @item mode
  11607. Specify the mode of the interlacing. This option can also be specified
  11608. as a value alone. See below for a list of values for this option.
  11609. Available values are:
  11610. @table @samp
  11611. @item merge, 0
  11612. Move odd frames into the upper field, even into the lower field,
  11613. generating a double height frame at half frame rate.
  11614. @example
  11615. ------> time
  11616. Input:
  11617. Frame 1 Frame 2 Frame 3 Frame 4
  11618. 11111 22222 33333 44444
  11619. 11111 22222 33333 44444
  11620. 11111 22222 33333 44444
  11621. 11111 22222 33333 44444
  11622. Output:
  11623. 11111 33333
  11624. 22222 44444
  11625. 11111 33333
  11626. 22222 44444
  11627. 11111 33333
  11628. 22222 44444
  11629. 11111 33333
  11630. 22222 44444
  11631. @end example
  11632. @item drop_even, 1
  11633. Only output odd frames, even frames are dropped, generating a frame with
  11634. unchanged height at half frame rate.
  11635. @example
  11636. ------> time
  11637. Input:
  11638. Frame 1 Frame 2 Frame 3 Frame 4
  11639. 11111 22222 33333 44444
  11640. 11111 22222 33333 44444
  11641. 11111 22222 33333 44444
  11642. 11111 22222 33333 44444
  11643. Output:
  11644. 11111 33333
  11645. 11111 33333
  11646. 11111 33333
  11647. 11111 33333
  11648. @end example
  11649. @item drop_odd, 2
  11650. Only output even frames, odd frames are dropped, generating a frame with
  11651. unchanged height at half frame rate.
  11652. @example
  11653. ------> time
  11654. Input:
  11655. Frame 1 Frame 2 Frame 3 Frame 4
  11656. 11111 22222 33333 44444
  11657. 11111 22222 33333 44444
  11658. 11111 22222 33333 44444
  11659. 11111 22222 33333 44444
  11660. Output:
  11661. 22222 44444
  11662. 22222 44444
  11663. 22222 44444
  11664. 22222 44444
  11665. @end example
  11666. @item pad, 3
  11667. Expand each frame to full height, but pad alternate lines with black,
  11668. generating a frame with double height at the same input frame rate.
  11669. @example
  11670. ------> time
  11671. Input:
  11672. Frame 1 Frame 2 Frame 3 Frame 4
  11673. 11111 22222 33333 44444
  11674. 11111 22222 33333 44444
  11675. 11111 22222 33333 44444
  11676. 11111 22222 33333 44444
  11677. Output:
  11678. 11111 ..... 33333 .....
  11679. ..... 22222 ..... 44444
  11680. 11111 ..... 33333 .....
  11681. ..... 22222 ..... 44444
  11682. 11111 ..... 33333 .....
  11683. ..... 22222 ..... 44444
  11684. 11111 ..... 33333 .....
  11685. ..... 22222 ..... 44444
  11686. @end example
  11687. @item interleave_top, 4
  11688. Interleave the upper field from odd frames with the lower field from
  11689. even frames, generating a frame with unchanged height at half frame rate.
  11690. @example
  11691. ------> time
  11692. Input:
  11693. Frame 1 Frame 2 Frame 3 Frame 4
  11694. 11111<- 22222 33333<- 44444
  11695. 11111 22222<- 33333 44444<-
  11696. 11111<- 22222 33333<- 44444
  11697. 11111 22222<- 33333 44444<-
  11698. Output:
  11699. 11111 33333
  11700. 22222 44444
  11701. 11111 33333
  11702. 22222 44444
  11703. @end example
  11704. @item interleave_bottom, 5
  11705. Interleave the lower field from odd frames with the upper field from
  11706. even frames, generating a frame with unchanged height at half frame rate.
  11707. @example
  11708. ------> time
  11709. Input:
  11710. Frame 1 Frame 2 Frame 3 Frame 4
  11711. 11111 22222<- 33333 44444<-
  11712. 11111<- 22222 33333<- 44444
  11713. 11111 22222<- 33333 44444<-
  11714. 11111<- 22222 33333<- 44444
  11715. Output:
  11716. 22222 44444
  11717. 11111 33333
  11718. 22222 44444
  11719. 11111 33333
  11720. @end example
  11721. @item interlacex2, 6
  11722. Double frame rate with unchanged height. Frames are inserted each
  11723. containing the second temporal field from the previous input frame and
  11724. the first temporal field from the next input frame. This mode relies on
  11725. the top_field_first flag. Useful for interlaced video displays with no
  11726. field synchronisation.
  11727. @example
  11728. ------> time
  11729. Input:
  11730. Frame 1 Frame 2 Frame 3 Frame 4
  11731. 11111 22222 33333 44444
  11732. 11111 22222 33333 44444
  11733. 11111 22222 33333 44444
  11734. 11111 22222 33333 44444
  11735. Output:
  11736. 11111 22222 22222 33333 33333 44444 44444
  11737. 11111 11111 22222 22222 33333 33333 44444
  11738. 11111 22222 22222 33333 33333 44444 44444
  11739. 11111 11111 22222 22222 33333 33333 44444
  11740. @end example
  11741. @item mergex2, 7
  11742. Move odd frames into the upper field, even into the lower field,
  11743. generating a double height frame at same frame rate.
  11744. @example
  11745. ------> time
  11746. Input:
  11747. Frame 1 Frame 2 Frame 3 Frame 4
  11748. 11111 22222 33333 44444
  11749. 11111 22222 33333 44444
  11750. 11111 22222 33333 44444
  11751. 11111 22222 33333 44444
  11752. Output:
  11753. 11111 33333 33333 55555
  11754. 22222 22222 44444 44444
  11755. 11111 33333 33333 55555
  11756. 22222 22222 44444 44444
  11757. 11111 33333 33333 55555
  11758. 22222 22222 44444 44444
  11759. 11111 33333 33333 55555
  11760. 22222 22222 44444 44444
  11761. @end example
  11762. @end table
  11763. Numeric values are deprecated but are accepted for backward
  11764. compatibility reasons.
  11765. Default mode is @code{merge}.
  11766. @item flags
  11767. Specify flags influencing the filter process.
  11768. Available value for @var{flags} is:
  11769. @table @option
  11770. @item low_pass_filter, vlfp
  11771. Enable linear vertical low-pass filtering in the filter.
  11772. Vertical low-pass filtering is required when creating an interlaced
  11773. destination from a progressive source which contains high-frequency
  11774. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11775. patterning.
  11776. @item complex_filter, cvlfp
  11777. Enable complex vertical low-pass filtering.
  11778. This will slightly less reduce interlace 'twitter' and Moire
  11779. patterning but better retain detail and subjective sharpness impression.
  11780. @end table
  11781. Vertical low-pass filtering can only be enabled for @option{mode}
  11782. @var{interleave_top} and @var{interleave_bottom}.
  11783. @end table
  11784. @section tonemap
  11785. Tone map colors from different dynamic ranges.
  11786. This filter expects data in single precision floating point, as it needs to
  11787. operate on (and can output) out-of-range values. Another filter, such as
  11788. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11789. The tonemapping algorithms implemented only work on linear light, so input
  11790. data should be linearized beforehand (and possibly correctly tagged).
  11791. @example
  11792. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11793. @end example
  11794. @subsection Options
  11795. The filter accepts the following options.
  11796. @table @option
  11797. @item tonemap
  11798. Set the tone map algorithm to use.
  11799. Possible values are:
  11800. @table @var
  11801. @item none
  11802. Do not apply any tone map, only desaturate overbright pixels.
  11803. @item clip
  11804. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11805. in-range values, while distorting out-of-range values.
  11806. @item linear
  11807. Stretch the entire reference gamut to a linear multiple of the display.
  11808. @item gamma
  11809. Fit a logarithmic transfer between the tone curves.
  11810. @item reinhard
  11811. Preserve overall image brightness with a simple curve, using nonlinear
  11812. contrast, which results in flattening details and degrading color accuracy.
  11813. @item hable
  11814. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11815. of slightly darkening everything. Use it when detail preservation is more
  11816. important than color and brightness accuracy.
  11817. @item mobius
  11818. Smoothly map out-of-range values, while retaining contrast and colors for
  11819. in-range material as much as possible. Use it when color accuracy is more
  11820. important than detail preservation.
  11821. @end table
  11822. Default is none.
  11823. @item param
  11824. Tune the tone mapping algorithm.
  11825. This affects the following algorithms:
  11826. @table @var
  11827. @item none
  11828. Ignored.
  11829. @item linear
  11830. Specifies the scale factor to use while stretching.
  11831. Default to 1.0.
  11832. @item gamma
  11833. Specifies the exponent of the function.
  11834. Default to 1.8.
  11835. @item clip
  11836. Specify an extra linear coefficient to multiply into the signal before clipping.
  11837. Default to 1.0.
  11838. @item reinhard
  11839. Specify the local contrast coefficient at the display peak.
  11840. Default to 0.5, which means that in-gamut values will be about half as bright
  11841. as when clipping.
  11842. @item hable
  11843. Ignored.
  11844. @item mobius
  11845. Specify the transition point from linear to mobius transform. Every value
  11846. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11847. more accurate the result will be, at the cost of losing bright details.
  11848. Default to 0.3, which due to the steep initial slope still preserves in-range
  11849. colors fairly accurately.
  11850. @end table
  11851. @item desat
  11852. Apply desaturation for highlights that exceed this level of brightness. The
  11853. higher the parameter, the more color information will be preserved. This
  11854. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11855. (smoothly) turning into white instead. This makes images feel more natural,
  11856. at the cost of reducing information about out-of-range colors.
  11857. The default of 2.0 is somewhat conservative and will mostly just apply to
  11858. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11859. This option works only if the input frame has a supported color tag.
  11860. @item peak
  11861. Override signal/nominal/reference peak with this value. Useful when the
  11862. embedded peak information in display metadata is not reliable or when tone
  11863. mapping from a lower range to a higher range.
  11864. @end table
  11865. @section transpose
  11866. Transpose rows with columns in the input video and optionally flip it.
  11867. It accepts the following parameters:
  11868. @table @option
  11869. @item dir
  11870. Specify the transposition direction.
  11871. Can assume the following values:
  11872. @table @samp
  11873. @item 0, 4, cclock_flip
  11874. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11875. @example
  11876. L.R L.l
  11877. . . -> . .
  11878. l.r R.r
  11879. @end example
  11880. @item 1, 5, clock
  11881. Rotate by 90 degrees clockwise, that is:
  11882. @example
  11883. L.R l.L
  11884. . . -> . .
  11885. l.r r.R
  11886. @end example
  11887. @item 2, 6, cclock
  11888. Rotate by 90 degrees counterclockwise, that is:
  11889. @example
  11890. L.R R.r
  11891. . . -> . .
  11892. l.r L.l
  11893. @end example
  11894. @item 3, 7, clock_flip
  11895. Rotate by 90 degrees clockwise and vertically flip, that is:
  11896. @example
  11897. L.R r.R
  11898. . . -> . .
  11899. l.r l.L
  11900. @end example
  11901. @end table
  11902. For values between 4-7, the transposition is only done if the input
  11903. video geometry is portrait and not landscape. These values are
  11904. deprecated, the @code{passthrough} option should be used instead.
  11905. Numerical values are deprecated, and should be dropped in favor of
  11906. symbolic constants.
  11907. @item passthrough
  11908. Do not apply the transposition if the input geometry matches the one
  11909. specified by the specified value. It accepts the following values:
  11910. @table @samp
  11911. @item none
  11912. Always apply transposition.
  11913. @item portrait
  11914. Preserve portrait geometry (when @var{height} >= @var{width}).
  11915. @item landscape
  11916. Preserve landscape geometry (when @var{width} >= @var{height}).
  11917. @end table
  11918. Default value is @code{none}.
  11919. @end table
  11920. For example to rotate by 90 degrees clockwise and preserve portrait
  11921. layout:
  11922. @example
  11923. transpose=dir=1:passthrough=portrait
  11924. @end example
  11925. The command above can also be specified as:
  11926. @example
  11927. transpose=1:portrait
  11928. @end example
  11929. @section trim
  11930. Trim the input so that the output contains one continuous subpart of the input.
  11931. It accepts the following parameters:
  11932. @table @option
  11933. @item start
  11934. Specify the time of the start of the kept section, i.e. the frame with the
  11935. timestamp @var{start} will be the first frame in the output.
  11936. @item end
  11937. Specify the time of the first frame that will be dropped, i.e. the frame
  11938. immediately preceding the one with the timestamp @var{end} will be the last
  11939. frame in the output.
  11940. @item start_pts
  11941. This is the same as @var{start}, except this option sets the start timestamp
  11942. in timebase units instead of seconds.
  11943. @item end_pts
  11944. This is the same as @var{end}, except this option sets the end timestamp
  11945. in timebase units instead of seconds.
  11946. @item duration
  11947. The maximum duration of the output in seconds.
  11948. @item start_frame
  11949. The number of the first frame that should be passed to the output.
  11950. @item end_frame
  11951. The number of the first frame that should be dropped.
  11952. @end table
  11953. @option{start}, @option{end}, and @option{duration} are expressed as time
  11954. duration specifications; see
  11955. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11956. for the accepted syntax.
  11957. Note that the first two sets of the start/end options and the @option{duration}
  11958. option look at the frame timestamp, while the _frame variants simply count the
  11959. frames that pass through the filter. Also note that this filter does not modify
  11960. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11961. setpts filter after the trim filter.
  11962. If multiple start or end options are set, this filter tries to be greedy and
  11963. keep all the frames that match at least one of the specified constraints. To keep
  11964. only the part that matches all the constraints at once, chain multiple trim
  11965. filters.
  11966. The defaults are such that all the input is kept. So it is possible to set e.g.
  11967. just the end values to keep everything before the specified time.
  11968. Examples:
  11969. @itemize
  11970. @item
  11971. Drop everything except the second minute of input:
  11972. @example
  11973. ffmpeg -i INPUT -vf trim=60:120
  11974. @end example
  11975. @item
  11976. Keep only the first second:
  11977. @example
  11978. ffmpeg -i INPUT -vf trim=duration=1
  11979. @end example
  11980. @end itemize
  11981. @section unpremultiply
  11982. Apply alpha unpremultiply effect to input video stream using first plane
  11983. of second stream as alpha.
  11984. Both streams must have same dimensions and same pixel format.
  11985. The filter accepts the following option:
  11986. @table @option
  11987. @item planes
  11988. Set which planes will be processed, unprocessed planes will be copied.
  11989. By default value 0xf, all planes will be processed.
  11990. If the format has 1 or 2 components, then luma is bit 0.
  11991. If the format has 3 or 4 components:
  11992. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11993. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11994. If present, the alpha channel is always the last bit.
  11995. @item inplace
  11996. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11997. @end table
  11998. @anchor{unsharp}
  11999. @section unsharp
  12000. Sharpen or blur the input video.
  12001. It accepts the following parameters:
  12002. @table @option
  12003. @item luma_msize_x, lx
  12004. Set the luma matrix horizontal size. It must be an odd integer between
  12005. 3 and 23. The default value is 5.
  12006. @item luma_msize_y, ly
  12007. Set the luma matrix vertical size. It must be an odd integer between 3
  12008. and 23. The default value is 5.
  12009. @item luma_amount, la
  12010. Set the luma effect strength. It must be a floating point number, reasonable
  12011. values lay between -1.5 and 1.5.
  12012. Negative values will blur the input video, while positive values will
  12013. sharpen it, a value of zero will disable the effect.
  12014. Default value is 1.0.
  12015. @item chroma_msize_x, cx
  12016. Set the chroma matrix horizontal size. It must be an odd integer
  12017. between 3 and 23. The default value is 5.
  12018. @item chroma_msize_y, cy
  12019. Set the chroma matrix vertical size. It must be an odd integer
  12020. between 3 and 23. The default value is 5.
  12021. @item chroma_amount, ca
  12022. Set the chroma effect strength. It must be a floating point number, reasonable
  12023. values lay between -1.5 and 1.5.
  12024. Negative values will blur the input video, while positive values will
  12025. sharpen it, a value of zero will disable the effect.
  12026. Default value is 0.0.
  12027. @end table
  12028. All parameters are optional and default to the equivalent of the
  12029. string '5:5:1.0:5:5:0.0'.
  12030. @subsection Examples
  12031. @itemize
  12032. @item
  12033. Apply strong luma sharpen effect:
  12034. @example
  12035. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12036. @end example
  12037. @item
  12038. Apply a strong blur of both luma and chroma parameters:
  12039. @example
  12040. unsharp=7:7:-2:7:7:-2
  12041. @end example
  12042. @end itemize
  12043. @section uspp
  12044. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12045. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12046. shifts and average the results.
  12047. The way this differs from the behavior of spp is that uspp actually encodes &
  12048. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12049. DCT similar to MJPEG.
  12050. The filter accepts the following options:
  12051. @table @option
  12052. @item quality
  12053. Set quality. This option defines the number of levels for averaging. It accepts
  12054. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12055. effect. A value of @code{8} means the higher quality. For each increment of
  12056. that value the speed drops by a factor of approximately 2. Default value is
  12057. @code{3}.
  12058. @item qp
  12059. Force a constant quantization parameter. If not set, the filter will use the QP
  12060. from the video stream (if available).
  12061. @end table
  12062. @section vaguedenoiser
  12063. Apply a wavelet based denoiser.
  12064. It transforms each frame from the video input into the wavelet domain,
  12065. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12066. the obtained coefficients. It does an inverse wavelet transform after.
  12067. Due to wavelet properties, it should give a nice smoothed result, and
  12068. reduced noise, without blurring picture features.
  12069. This filter accepts the following options:
  12070. @table @option
  12071. @item threshold
  12072. The filtering strength. The higher, the more filtered the video will be.
  12073. Hard thresholding can use a higher threshold than soft thresholding
  12074. before the video looks overfiltered. Default value is 2.
  12075. @item method
  12076. The filtering method the filter will use.
  12077. It accepts the following values:
  12078. @table @samp
  12079. @item hard
  12080. All values under the threshold will be zeroed.
  12081. @item soft
  12082. All values under the threshold will be zeroed. All values above will be
  12083. reduced by the threshold.
  12084. @item garrote
  12085. Scales or nullifies coefficients - intermediary between (more) soft and
  12086. (less) hard thresholding.
  12087. @end table
  12088. Default is garrote.
  12089. @item nsteps
  12090. Number of times, the wavelet will decompose the picture. Picture can't
  12091. be decomposed beyond a particular point (typically, 8 for a 640x480
  12092. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12093. @item percent
  12094. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12095. @item planes
  12096. A list of the planes to process. By default all planes are processed.
  12097. @end table
  12098. @section vectorscope
  12099. Display 2 color component values in the two dimensional graph (which is called
  12100. a vectorscope).
  12101. This filter accepts the following options:
  12102. @table @option
  12103. @item mode, m
  12104. Set vectorscope mode.
  12105. It accepts the following values:
  12106. @table @samp
  12107. @item gray
  12108. Gray values are displayed on graph, higher brightness means more pixels have
  12109. same component color value on location in graph. This is the default mode.
  12110. @item color
  12111. Gray values are displayed on graph. Surrounding pixels values which are not
  12112. present in video frame are drawn in gradient of 2 color components which are
  12113. set by option @code{x} and @code{y}. The 3rd color component is static.
  12114. @item color2
  12115. Actual color components values present in video frame are displayed on graph.
  12116. @item color3
  12117. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12118. on graph increases value of another color component, which is luminance by
  12119. default values of @code{x} and @code{y}.
  12120. @item color4
  12121. Actual colors present in video frame are displayed on graph. If two different
  12122. colors map to same position on graph then color with higher value of component
  12123. not present in graph is picked.
  12124. @item color5
  12125. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12126. component picked from radial gradient.
  12127. @end table
  12128. @item x
  12129. Set which color component will be represented on X-axis. Default is @code{1}.
  12130. @item y
  12131. Set which color component will be represented on Y-axis. Default is @code{2}.
  12132. @item intensity, i
  12133. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12134. of color component which represents frequency of (X, Y) location in graph.
  12135. @item envelope, e
  12136. @table @samp
  12137. @item none
  12138. No envelope, this is default.
  12139. @item instant
  12140. Instant envelope, even darkest single pixel will be clearly highlighted.
  12141. @item peak
  12142. Hold maximum and minimum values presented in graph over time. This way you
  12143. can still spot out of range values without constantly looking at vectorscope.
  12144. @item peak+instant
  12145. Peak and instant envelope combined together.
  12146. @end table
  12147. @item graticule, g
  12148. Set what kind of graticule to draw.
  12149. @table @samp
  12150. @item none
  12151. @item green
  12152. @item color
  12153. @end table
  12154. @item opacity, o
  12155. Set graticule opacity.
  12156. @item flags, f
  12157. Set graticule flags.
  12158. @table @samp
  12159. @item white
  12160. Draw graticule for white point.
  12161. @item black
  12162. Draw graticule for black point.
  12163. @item name
  12164. Draw color points short names.
  12165. @end table
  12166. @item bgopacity, b
  12167. Set background opacity.
  12168. @item lthreshold, l
  12169. Set low threshold for color component not represented on X or Y axis.
  12170. Values lower than this value will be ignored. Default is 0.
  12171. Note this value is multiplied with actual max possible value one pixel component
  12172. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12173. is 0.1 * 255 = 25.
  12174. @item hthreshold, h
  12175. Set high threshold for color component not represented on X or Y axis.
  12176. Values higher than this value will be ignored. Default is 1.
  12177. Note this value is multiplied with actual max possible value one pixel component
  12178. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12179. is 0.9 * 255 = 230.
  12180. @item colorspace, c
  12181. Set what kind of colorspace to use when drawing graticule.
  12182. @table @samp
  12183. @item auto
  12184. @item 601
  12185. @item 709
  12186. @end table
  12187. Default is auto.
  12188. @end table
  12189. @anchor{vidstabdetect}
  12190. @section vidstabdetect
  12191. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12192. @ref{vidstabtransform} for pass 2.
  12193. This filter generates a file with relative translation and rotation
  12194. transform information about subsequent frames, which is then used by
  12195. the @ref{vidstabtransform} filter.
  12196. To enable compilation of this filter you need to configure FFmpeg with
  12197. @code{--enable-libvidstab}.
  12198. This filter accepts the following options:
  12199. @table @option
  12200. @item result
  12201. Set the path to the file used to write the transforms information.
  12202. Default value is @file{transforms.trf}.
  12203. @item shakiness
  12204. Set how shaky the video is and how quick the camera is. It accepts an
  12205. integer in the range 1-10, a value of 1 means little shakiness, a
  12206. value of 10 means strong shakiness. Default value is 5.
  12207. @item accuracy
  12208. Set the accuracy of the detection process. It must be a value in the
  12209. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12210. accuracy. Default value is 15.
  12211. @item stepsize
  12212. Set stepsize of the search process. The region around minimum is
  12213. scanned with 1 pixel resolution. Default value is 6.
  12214. @item mincontrast
  12215. Set minimum contrast. Below this value a local measurement field is
  12216. discarded. Must be a floating point value in the range 0-1. Default
  12217. value is 0.3.
  12218. @item tripod
  12219. Set reference frame number for tripod mode.
  12220. If enabled, the motion of the frames is compared to a reference frame
  12221. in the filtered stream, identified by the specified number. The idea
  12222. is to compensate all movements in a more-or-less static scene and keep
  12223. the camera view absolutely still.
  12224. If set to 0, it is disabled. The frames are counted starting from 1.
  12225. @item show
  12226. Show fields and transforms in the resulting frames. It accepts an
  12227. integer in the range 0-2. Default value is 0, which disables any
  12228. visualization.
  12229. @end table
  12230. @subsection Examples
  12231. @itemize
  12232. @item
  12233. Use default values:
  12234. @example
  12235. vidstabdetect
  12236. @end example
  12237. @item
  12238. Analyze strongly shaky movie and put the results in file
  12239. @file{mytransforms.trf}:
  12240. @example
  12241. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12242. @end example
  12243. @item
  12244. Visualize the result of internal transformations in the resulting
  12245. video:
  12246. @example
  12247. vidstabdetect=show=1
  12248. @end example
  12249. @item
  12250. Analyze a video with medium shakiness using @command{ffmpeg}:
  12251. @example
  12252. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12253. @end example
  12254. @end itemize
  12255. @anchor{vidstabtransform}
  12256. @section vidstabtransform
  12257. Video stabilization/deshaking: pass 2 of 2,
  12258. see @ref{vidstabdetect} for pass 1.
  12259. Read a file with transform information for each frame and
  12260. apply/compensate them. Together with the @ref{vidstabdetect}
  12261. filter this can be used to deshake videos. See also
  12262. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12263. the @ref{unsharp} filter, see below.
  12264. To enable compilation of this filter you need to configure FFmpeg with
  12265. @code{--enable-libvidstab}.
  12266. @subsection Options
  12267. @table @option
  12268. @item input
  12269. Set path to the file used to read the transforms. Default value is
  12270. @file{transforms.trf}.
  12271. @item smoothing
  12272. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12273. camera movements. Default value is 10.
  12274. For example a number of 10 means that 21 frames are used (10 in the
  12275. past and 10 in the future) to smoothen the motion in the video. A
  12276. larger value leads to a smoother video, but limits the acceleration of
  12277. the camera (pan/tilt movements). 0 is a special case where a static
  12278. camera is simulated.
  12279. @item optalgo
  12280. Set the camera path optimization algorithm.
  12281. Accepted values are:
  12282. @table @samp
  12283. @item gauss
  12284. gaussian kernel low-pass filter on camera motion (default)
  12285. @item avg
  12286. averaging on transformations
  12287. @end table
  12288. @item maxshift
  12289. Set maximal number of pixels to translate frames. Default value is -1,
  12290. meaning no limit.
  12291. @item maxangle
  12292. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12293. value is -1, meaning no limit.
  12294. @item crop
  12295. Specify how to deal with borders that may be visible due to movement
  12296. compensation.
  12297. Available values are:
  12298. @table @samp
  12299. @item keep
  12300. keep image information from previous frame (default)
  12301. @item black
  12302. fill the border black
  12303. @end table
  12304. @item invert
  12305. Invert transforms if set to 1. Default value is 0.
  12306. @item relative
  12307. Consider transforms as relative to previous frame if set to 1,
  12308. absolute if set to 0. Default value is 0.
  12309. @item zoom
  12310. Set percentage to zoom. A positive value will result in a zoom-in
  12311. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12312. zoom).
  12313. @item optzoom
  12314. Set optimal zooming to avoid borders.
  12315. Accepted values are:
  12316. @table @samp
  12317. @item 0
  12318. disabled
  12319. @item 1
  12320. optimal static zoom value is determined (only very strong movements
  12321. will lead to visible borders) (default)
  12322. @item 2
  12323. optimal adaptive zoom value is determined (no borders will be
  12324. visible), see @option{zoomspeed}
  12325. @end table
  12326. Note that the value given at zoom is added to the one calculated here.
  12327. @item zoomspeed
  12328. Set percent to zoom maximally each frame (enabled when
  12329. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12330. 0.25.
  12331. @item interpol
  12332. Specify type of interpolation.
  12333. Available values are:
  12334. @table @samp
  12335. @item no
  12336. no interpolation
  12337. @item linear
  12338. linear only horizontal
  12339. @item bilinear
  12340. linear in both directions (default)
  12341. @item bicubic
  12342. cubic in both directions (slow)
  12343. @end table
  12344. @item tripod
  12345. Enable virtual tripod mode if set to 1, which is equivalent to
  12346. @code{relative=0:smoothing=0}. Default value is 0.
  12347. Use also @code{tripod} option of @ref{vidstabdetect}.
  12348. @item debug
  12349. Increase log verbosity if set to 1. Also the detected global motions
  12350. are written to the temporary file @file{global_motions.trf}. Default
  12351. value is 0.
  12352. @end table
  12353. @subsection Examples
  12354. @itemize
  12355. @item
  12356. Use @command{ffmpeg} for a typical stabilization with default values:
  12357. @example
  12358. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12359. @end example
  12360. Note the use of the @ref{unsharp} filter which is always recommended.
  12361. @item
  12362. Zoom in a bit more and load transform data from a given file:
  12363. @example
  12364. vidstabtransform=zoom=5:input="mytransforms.trf"
  12365. @end example
  12366. @item
  12367. Smoothen the video even more:
  12368. @example
  12369. vidstabtransform=smoothing=30
  12370. @end example
  12371. @end itemize
  12372. @section vflip
  12373. Flip the input video vertically.
  12374. For example, to vertically flip a video with @command{ffmpeg}:
  12375. @example
  12376. ffmpeg -i in.avi -vf "vflip" out.avi
  12377. @end example
  12378. @anchor{vignette}
  12379. @section vignette
  12380. Make or reverse a natural vignetting effect.
  12381. The filter accepts the following options:
  12382. @table @option
  12383. @item angle, a
  12384. Set lens angle expression as a number of radians.
  12385. The value is clipped in the @code{[0,PI/2]} range.
  12386. Default value: @code{"PI/5"}
  12387. @item x0
  12388. @item y0
  12389. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12390. by default.
  12391. @item mode
  12392. Set forward/backward mode.
  12393. Available modes are:
  12394. @table @samp
  12395. @item forward
  12396. The larger the distance from the central point, the darker the image becomes.
  12397. @item backward
  12398. The larger the distance from the central point, the brighter the image becomes.
  12399. This can be used to reverse a vignette effect, though there is no automatic
  12400. detection to extract the lens @option{angle} and other settings (yet). It can
  12401. also be used to create a burning effect.
  12402. @end table
  12403. Default value is @samp{forward}.
  12404. @item eval
  12405. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12406. It accepts the following values:
  12407. @table @samp
  12408. @item init
  12409. Evaluate expressions only once during the filter initialization.
  12410. @item frame
  12411. Evaluate expressions for each incoming frame. This is way slower than the
  12412. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12413. allows advanced dynamic expressions.
  12414. @end table
  12415. Default value is @samp{init}.
  12416. @item dither
  12417. Set dithering to reduce the circular banding effects. Default is @code{1}
  12418. (enabled).
  12419. @item aspect
  12420. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12421. Setting this value to the SAR of the input will make a rectangular vignetting
  12422. following the dimensions of the video.
  12423. Default is @code{1/1}.
  12424. @end table
  12425. @subsection Expressions
  12426. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12427. following parameters.
  12428. @table @option
  12429. @item w
  12430. @item h
  12431. input width and height
  12432. @item n
  12433. the number of input frame, starting from 0
  12434. @item pts
  12435. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12436. @var{TB} units, NAN if undefined
  12437. @item r
  12438. frame rate of the input video, NAN if the input frame rate is unknown
  12439. @item t
  12440. the PTS (Presentation TimeStamp) of the filtered video frame,
  12441. expressed in seconds, NAN if undefined
  12442. @item tb
  12443. time base of the input video
  12444. @end table
  12445. @subsection Examples
  12446. @itemize
  12447. @item
  12448. Apply simple strong vignetting effect:
  12449. @example
  12450. vignette=PI/4
  12451. @end example
  12452. @item
  12453. Make a flickering vignetting:
  12454. @example
  12455. vignette='PI/4+random(1)*PI/50':eval=frame
  12456. @end example
  12457. @end itemize
  12458. @section vmafmotion
  12459. Obtain the average vmaf motion score of a video.
  12460. It is one of the component filters of VMAF.
  12461. The obtained average motion score is printed through the logging system.
  12462. In the below example the input file @file{ref.mpg} is being processed and score
  12463. is computed.
  12464. @example
  12465. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12466. @end example
  12467. @section vstack
  12468. Stack input videos vertically.
  12469. All streams must be of same pixel format and of same width.
  12470. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12471. to create same output.
  12472. The filter accept the following option:
  12473. @table @option
  12474. @item inputs
  12475. Set number of input streams. Default is 2.
  12476. @item shortest
  12477. If set to 1, force the output to terminate when the shortest input
  12478. terminates. Default value is 0.
  12479. @end table
  12480. @section w3fdif
  12481. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12482. Deinterlacing Filter").
  12483. Based on the process described by Martin Weston for BBC R&D, and
  12484. implemented based on the de-interlace algorithm written by Jim
  12485. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12486. uses filter coefficients calculated by BBC R&D.
  12487. There are two sets of filter coefficients, so called "simple":
  12488. and "complex". Which set of filter coefficients is used can
  12489. be set by passing an optional parameter:
  12490. @table @option
  12491. @item filter
  12492. Set the interlacing filter coefficients. Accepts one of the following values:
  12493. @table @samp
  12494. @item simple
  12495. Simple filter coefficient set.
  12496. @item complex
  12497. More-complex filter coefficient set.
  12498. @end table
  12499. Default value is @samp{complex}.
  12500. @item deint
  12501. Specify which frames to deinterlace. Accept one of the following values:
  12502. @table @samp
  12503. @item all
  12504. Deinterlace all frames,
  12505. @item interlaced
  12506. Only deinterlace frames marked as interlaced.
  12507. @end table
  12508. Default value is @samp{all}.
  12509. @end table
  12510. @section waveform
  12511. Video waveform monitor.
  12512. The waveform monitor plots color component intensity. By default luminance
  12513. only. Each column of the waveform corresponds to a column of pixels in the
  12514. source video.
  12515. It accepts the following options:
  12516. @table @option
  12517. @item mode, m
  12518. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12519. In row mode, the graph on the left side represents color component value 0 and
  12520. the right side represents value = 255. In column mode, the top side represents
  12521. color component value = 0 and bottom side represents value = 255.
  12522. @item intensity, i
  12523. Set intensity. Smaller values are useful to find out how many values of the same
  12524. luminance are distributed across input rows/columns.
  12525. Default value is @code{0.04}. Allowed range is [0, 1].
  12526. @item mirror, r
  12527. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12528. In mirrored mode, higher values will be represented on the left
  12529. side for @code{row} mode and at the top for @code{column} mode. Default is
  12530. @code{1} (mirrored).
  12531. @item display, d
  12532. Set display mode.
  12533. It accepts the following values:
  12534. @table @samp
  12535. @item overlay
  12536. Presents information identical to that in the @code{parade}, except
  12537. that the graphs representing color components are superimposed directly
  12538. over one another.
  12539. This display mode makes it easier to spot relative differences or similarities
  12540. in overlapping areas of the color components that are supposed to be identical,
  12541. such as neutral whites, grays, or blacks.
  12542. @item stack
  12543. Display separate graph for the color components side by side in
  12544. @code{row} mode or one below the other in @code{column} mode.
  12545. @item parade
  12546. Display separate graph for the color components side by side in
  12547. @code{column} mode or one below the other in @code{row} mode.
  12548. Using this display mode makes it easy to spot color casts in the highlights
  12549. and shadows of an image, by comparing the contours of the top and the bottom
  12550. graphs of each waveform. Since whites, grays, and blacks are characterized
  12551. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12552. should display three waveforms of roughly equal width/height. If not, the
  12553. correction is easy to perform by making level adjustments the three waveforms.
  12554. @end table
  12555. Default is @code{stack}.
  12556. @item components, c
  12557. Set which color components to display. Default is 1, which means only luminance
  12558. or red color component if input is in RGB colorspace. If is set for example to
  12559. 7 it will display all 3 (if) available color components.
  12560. @item envelope, e
  12561. @table @samp
  12562. @item none
  12563. No envelope, this is default.
  12564. @item instant
  12565. Instant envelope, minimum and maximum values presented in graph will be easily
  12566. visible even with small @code{step} value.
  12567. @item peak
  12568. Hold minimum and maximum values presented in graph across time. This way you
  12569. can still spot out of range values without constantly looking at waveforms.
  12570. @item peak+instant
  12571. Peak and instant envelope combined together.
  12572. @end table
  12573. @item filter, f
  12574. @table @samp
  12575. @item lowpass
  12576. No filtering, this is default.
  12577. @item flat
  12578. Luma and chroma combined together.
  12579. @item aflat
  12580. Similar as above, but shows difference between blue and red chroma.
  12581. @item chroma
  12582. Displays only chroma.
  12583. @item color
  12584. Displays actual color value on waveform.
  12585. @item acolor
  12586. Similar as above, but with luma showing frequency of chroma values.
  12587. @end table
  12588. @item graticule, g
  12589. Set which graticule to display.
  12590. @table @samp
  12591. @item none
  12592. Do not display graticule.
  12593. @item green
  12594. Display green graticule showing legal broadcast ranges.
  12595. @end table
  12596. @item opacity, o
  12597. Set graticule opacity.
  12598. @item flags, fl
  12599. Set graticule flags.
  12600. @table @samp
  12601. @item numbers
  12602. Draw numbers above lines. By default enabled.
  12603. @item dots
  12604. Draw dots instead of lines.
  12605. @end table
  12606. @item scale, s
  12607. Set scale used for displaying graticule.
  12608. @table @samp
  12609. @item digital
  12610. @item millivolts
  12611. @item ire
  12612. @end table
  12613. Default is digital.
  12614. @item bgopacity, b
  12615. Set background opacity.
  12616. @end table
  12617. @section weave, doubleweave
  12618. The @code{weave} takes a field-based video input and join
  12619. each two sequential fields into single frame, producing a new double
  12620. height clip with half the frame rate and half the frame count.
  12621. The @code{doubleweave} works same as @code{weave} but without
  12622. halving frame rate and frame count.
  12623. It accepts the following option:
  12624. @table @option
  12625. @item first_field
  12626. Set first field. Available values are:
  12627. @table @samp
  12628. @item top, t
  12629. Set the frame as top-field-first.
  12630. @item bottom, b
  12631. Set the frame as bottom-field-first.
  12632. @end table
  12633. @end table
  12634. @subsection Examples
  12635. @itemize
  12636. @item
  12637. Interlace video using @ref{select} and @ref{separatefields} filter:
  12638. @example
  12639. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12640. @end example
  12641. @end itemize
  12642. @section xbr
  12643. Apply the xBR high-quality magnification filter which is designed for pixel
  12644. art. It follows a set of edge-detection rules, see
  12645. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12646. It accepts the following option:
  12647. @table @option
  12648. @item n
  12649. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12650. @code{3xBR} and @code{4} for @code{4xBR}.
  12651. Default is @code{3}.
  12652. @end table
  12653. @anchor{yadif}
  12654. @section yadif
  12655. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12656. filter").
  12657. It accepts the following parameters:
  12658. @table @option
  12659. @item mode
  12660. The interlacing mode to adopt. It accepts one of the following values:
  12661. @table @option
  12662. @item 0, send_frame
  12663. Output one frame for each frame.
  12664. @item 1, send_field
  12665. Output one frame for each field.
  12666. @item 2, send_frame_nospatial
  12667. Like @code{send_frame}, but it skips the spatial interlacing check.
  12668. @item 3, send_field_nospatial
  12669. Like @code{send_field}, but it skips the spatial interlacing check.
  12670. @end table
  12671. The default value is @code{send_frame}.
  12672. @item parity
  12673. The picture field parity assumed for the input interlaced video. It accepts one
  12674. of the following values:
  12675. @table @option
  12676. @item 0, tff
  12677. Assume the top field is first.
  12678. @item 1, bff
  12679. Assume the bottom field is first.
  12680. @item -1, auto
  12681. Enable automatic detection of field parity.
  12682. @end table
  12683. The default value is @code{auto}.
  12684. If the interlacing is unknown or the decoder does not export this information,
  12685. top field first will be assumed.
  12686. @item deint
  12687. Specify which frames to deinterlace. Accept one of the following
  12688. values:
  12689. @table @option
  12690. @item 0, all
  12691. Deinterlace all frames.
  12692. @item 1, interlaced
  12693. Only deinterlace frames marked as interlaced.
  12694. @end table
  12695. The default value is @code{all}.
  12696. @end table
  12697. @section zoompan
  12698. Apply Zoom & Pan effect.
  12699. This filter accepts the following options:
  12700. @table @option
  12701. @item zoom, z
  12702. Set the zoom expression. Default is 1.
  12703. @item x
  12704. @item y
  12705. Set the x and y expression. Default is 0.
  12706. @item d
  12707. Set the duration expression in number of frames.
  12708. This sets for how many number of frames effect will last for
  12709. single input image.
  12710. @item s
  12711. Set the output image size, default is 'hd720'.
  12712. @item fps
  12713. Set the output frame rate, default is '25'.
  12714. @end table
  12715. Each expression can contain the following constants:
  12716. @table @option
  12717. @item in_w, iw
  12718. Input width.
  12719. @item in_h, ih
  12720. Input height.
  12721. @item out_w, ow
  12722. Output width.
  12723. @item out_h, oh
  12724. Output height.
  12725. @item in
  12726. Input frame count.
  12727. @item on
  12728. Output frame count.
  12729. @item x
  12730. @item y
  12731. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12732. for current input frame.
  12733. @item px
  12734. @item py
  12735. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12736. not yet such frame (first input frame).
  12737. @item zoom
  12738. Last calculated zoom from 'z' expression for current input frame.
  12739. @item pzoom
  12740. Last calculated zoom of last output frame of previous input frame.
  12741. @item duration
  12742. Number of output frames for current input frame. Calculated from 'd' expression
  12743. for each input frame.
  12744. @item pduration
  12745. number of output frames created for previous input frame
  12746. @item a
  12747. Rational number: input width / input height
  12748. @item sar
  12749. sample aspect ratio
  12750. @item dar
  12751. display aspect ratio
  12752. @end table
  12753. @subsection Examples
  12754. @itemize
  12755. @item
  12756. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12757. @example
  12758. 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
  12759. @end example
  12760. @item
  12761. Zoom-in up to 1.5 and pan always at center of picture:
  12762. @example
  12763. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12764. @end example
  12765. @item
  12766. Same as above but without pausing:
  12767. @example
  12768. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12769. @end example
  12770. @end itemize
  12771. @anchor{zscale}
  12772. @section zscale
  12773. Scale (resize) the input video, using the z.lib library:
  12774. https://github.com/sekrit-twc/zimg.
  12775. The zscale filter forces the output display aspect ratio to be the same
  12776. as the input, by changing the output sample aspect ratio.
  12777. If the input image format is different from the format requested by
  12778. the next filter, the zscale filter will convert the input to the
  12779. requested format.
  12780. @subsection Options
  12781. The filter accepts the following options.
  12782. @table @option
  12783. @item width, w
  12784. @item height, h
  12785. Set the output video dimension expression. Default value is the input
  12786. dimension.
  12787. If the @var{width} or @var{w} value is 0, the input width is used for
  12788. the output. If the @var{height} or @var{h} value is 0, the input height
  12789. is used for the output.
  12790. If one and only one of the values is -n with n >= 1, the zscale filter
  12791. will use a value that maintains the aspect ratio of the input image,
  12792. calculated from the other specified dimension. After that it will,
  12793. however, make sure that the calculated dimension is divisible by n and
  12794. adjust the value if necessary.
  12795. If both values are -n with n >= 1, the behavior will be identical to
  12796. both values being set to 0 as previously detailed.
  12797. See below for the list of accepted constants for use in the dimension
  12798. expression.
  12799. @item size, s
  12800. Set the video size. For the syntax of this option, check the
  12801. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12802. @item dither, d
  12803. Set the dither type.
  12804. Possible values are:
  12805. @table @var
  12806. @item none
  12807. @item ordered
  12808. @item random
  12809. @item error_diffusion
  12810. @end table
  12811. Default is none.
  12812. @item filter, f
  12813. Set the resize filter type.
  12814. Possible values are:
  12815. @table @var
  12816. @item point
  12817. @item bilinear
  12818. @item bicubic
  12819. @item spline16
  12820. @item spline36
  12821. @item lanczos
  12822. @end table
  12823. Default is bilinear.
  12824. @item range, r
  12825. Set the color range.
  12826. Possible values are:
  12827. @table @var
  12828. @item input
  12829. @item limited
  12830. @item full
  12831. @end table
  12832. Default is same as input.
  12833. @item primaries, p
  12834. Set the color primaries.
  12835. Possible values are:
  12836. @table @var
  12837. @item input
  12838. @item 709
  12839. @item unspecified
  12840. @item 170m
  12841. @item 240m
  12842. @item 2020
  12843. @end table
  12844. Default is same as input.
  12845. @item transfer, t
  12846. Set the transfer characteristics.
  12847. Possible values are:
  12848. @table @var
  12849. @item input
  12850. @item 709
  12851. @item unspecified
  12852. @item 601
  12853. @item linear
  12854. @item 2020_10
  12855. @item 2020_12
  12856. @item smpte2084
  12857. @item iec61966-2-1
  12858. @item arib-std-b67
  12859. @end table
  12860. Default is same as input.
  12861. @item matrix, m
  12862. Set the colorspace matrix.
  12863. Possible value are:
  12864. @table @var
  12865. @item input
  12866. @item 709
  12867. @item unspecified
  12868. @item 470bg
  12869. @item 170m
  12870. @item 2020_ncl
  12871. @item 2020_cl
  12872. @end table
  12873. Default is same as input.
  12874. @item rangein, rin
  12875. Set the input color range.
  12876. Possible values are:
  12877. @table @var
  12878. @item input
  12879. @item limited
  12880. @item full
  12881. @end table
  12882. Default is same as input.
  12883. @item primariesin, pin
  12884. Set the input color primaries.
  12885. Possible values are:
  12886. @table @var
  12887. @item input
  12888. @item 709
  12889. @item unspecified
  12890. @item 170m
  12891. @item 240m
  12892. @item 2020
  12893. @end table
  12894. Default is same as input.
  12895. @item transferin, tin
  12896. Set the input transfer characteristics.
  12897. Possible values are:
  12898. @table @var
  12899. @item input
  12900. @item 709
  12901. @item unspecified
  12902. @item 601
  12903. @item linear
  12904. @item 2020_10
  12905. @item 2020_12
  12906. @end table
  12907. Default is same as input.
  12908. @item matrixin, min
  12909. Set the input colorspace matrix.
  12910. Possible value are:
  12911. @table @var
  12912. @item input
  12913. @item 709
  12914. @item unspecified
  12915. @item 470bg
  12916. @item 170m
  12917. @item 2020_ncl
  12918. @item 2020_cl
  12919. @end table
  12920. @item chromal, c
  12921. Set the output chroma location.
  12922. Possible values are:
  12923. @table @var
  12924. @item input
  12925. @item left
  12926. @item center
  12927. @item topleft
  12928. @item top
  12929. @item bottomleft
  12930. @item bottom
  12931. @end table
  12932. @item chromalin, cin
  12933. Set the input chroma location.
  12934. Possible values are:
  12935. @table @var
  12936. @item input
  12937. @item left
  12938. @item center
  12939. @item topleft
  12940. @item top
  12941. @item bottomleft
  12942. @item bottom
  12943. @end table
  12944. @item npl
  12945. Set the nominal peak luminance.
  12946. @end table
  12947. The values of the @option{w} and @option{h} options are expressions
  12948. containing the following constants:
  12949. @table @var
  12950. @item in_w
  12951. @item in_h
  12952. The input width and height
  12953. @item iw
  12954. @item ih
  12955. These are the same as @var{in_w} and @var{in_h}.
  12956. @item out_w
  12957. @item out_h
  12958. The output (scaled) width and height
  12959. @item ow
  12960. @item oh
  12961. These are the same as @var{out_w} and @var{out_h}
  12962. @item a
  12963. The same as @var{iw} / @var{ih}
  12964. @item sar
  12965. input sample aspect ratio
  12966. @item dar
  12967. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12968. @item hsub
  12969. @item vsub
  12970. horizontal and vertical input chroma subsample values. For example for the
  12971. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12972. @item ohsub
  12973. @item ovsub
  12974. horizontal and vertical output chroma subsample values. For example for the
  12975. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12976. @end table
  12977. @table @option
  12978. @end table
  12979. @c man end VIDEO FILTERS
  12980. @chapter Video Sources
  12981. @c man begin VIDEO SOURCES
  12982. Below is a description of the currently available video sources.
  12983. @section buffer
  12984. Buffer video frames, and make them available to the filter chain.
  12985. This source is mainly intended for a programmatic use, in particular
  12986. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12987. It accepts the following parameters:
  12988. @table @option
  12989. @item video_size
  12990. Specify the size (width and height) of the buffered video frames. For the
  12991. syntax of this option, check the
  12992. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12993. @item width
  12994. The input video width.
  12995. @item height
  12996. The input video height.
  12997. @item pix_fmt
  12998. A string representing the pixel format of the buffered video frames.
  12999. It may be a number corresponding to a pixel format, or a pixel format
  13000. name.
  13001. @item time_base
  13002. Specify the timebase assumed by the timestamps of the buffered frames.
  13003. @item frame_rate
  13004. Specify the frame rate expected for the video stream.
  13005. @item pixel_aspect, sar
  13006. The sample (pixel) aspect ratio of the input video.
  13007. @item sws_param
  13008. Specify the optional parameters to be used for the scale filter which
  13009. is automatically inserted when an input change is detected in the
  13010. input size or format.
  13011. @item hw_frames_ctx
  13012. When using a hardware pixel format, this should be a reference to an
  13013. AVHWFramesContext describing input frames.
  13014. @end table
  13015. For example:
  13016. @example
  13017. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13018. @end example
  13019. will instruct the source to accept video frames with size 320x240 and
  13020. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13021. square pixels (1:1 sample aspect ratio).
  13022. Since the pixel format with name "yuv410p" corresponds to the number 6
  13023. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13024. this example corresponds to:
  13025. @example
  13026. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13027. @end example
  13028. Alternatively, the options can be specified as a flat string, but this
  13029. syntax is deprecated:
  13030. @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}]
  13031. @section cellauto
  13032. Create a pattern generated by an elementary cellular automaton.
  13033. The initial state of the cellular automaton can be defined through the
  13034. @option{filename} and @option{pattern} options. If such options are
  13035. not specified an initial state is created randomly.
  13036. At each new frame a new row in the video is filled with the result of
  13037. the cellular automaton next generation. The behavior when the whole
  13038. frame is filled is defined by the @option{scroll} option.
  13039. This source accepts the following options:
  13040. @table @option
  13041. @item filename, f
  13042. Read the initial cellular automaton state, i.e. the starting row, from
  13043. the specified file.
  13044. In the file, each non-whitespace character is considered an alive
  13045. cell, a newline will terminate the row, and further characters in the
  13046. file will be ignored.
  13047. @item pattern, p
  13048. Read the initial cellular automaton state, i.e. the starting row, from
  13049. the specified string.
  13050. Each non-whitespace character in the string is considered an alive
  13051. cell, a newline will terminate the row, and further characters in the
  13052. string will be ignored.
  13053. @item rate, r
  13054. Set the video rate, that is the number of frames generated per second.
  13055. Default is 25.
  13056. @item random_fill_ratio, ratio
  13057. Set the random fill ratio for the initial cellular automaton row. It
  13058. is a floating point number value ranging from 0 to 1, defaults to
  13059. 1/PHI.
  13060. This option is ignored when a file or a pattern is specified.
  13061. @item random_seed, seed
  13062. Set the seed for filling randomly the initial row, must be an integer
  13063. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13064. set to -1, the filter will try to use a good random seed on a best
  13065. effort basis.
  13066. @item rule
  13067. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13068. Default value is 110.
  13069. @item size, s
  13070. Set the size of the output video. For the syntax of this option, check the
  13071. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13072. If @option{filename} or @option{pattern} is specified, the size is set
  13073. by default to the width of the specified initial state row, and the
  13074. height is set to @var{width} * PHI.
  13075. If @option{size} is set, it must contain the width of the specified
  13076. pattern string, and the specified pattern will be centered in the
  13077. larger row.
  13078. If a filename or a pattern string is not specified, the size value
  13079. defaults to "320x518" (used for a randomly generated initial state).
  13080. @item scroll
  13081. If set to 1, scroll the output upward when all the rows in the output
  13082. have been already filled. If set to 0, the new generated row will be
  13083. written over the top row just after the bottom row is filled.
  13084. Defaults to 1.
  13085. @item start_full, full
  13086. If set to 1, completely fill the output with generated rows before
  13087. outputting the first frame.
  13088. This is the default behavior, for disabling set the value to 0.
  13089. @item stitch
  13090. If set to 1, stitch the left and right row edges together.
  13091. This is the default behavior, for disabling set the value to 0.
  13092. @end table
  13093. @subsection Examples
  13094. @itemize
  13095. @item
  13096. Read the initial state from @file{pattern}, and specify an output of
  13097. size 200x400.
  13098. @example
  13099. cellauto=f=pattern:s=200x400
  13100. @end example
  13101. @item
  13102. Generate a random initial row with a width of 200 cells, with a fill
  13103. ratio of 2/3:
  13104. @example
  13105. cellauto=ratio=2/3:s=200x200
  13106. @end example
  13107. @item
  13108. Create a pattern generated by rule 18 starting by a single alive cell
  13109. centered on an initial row with width 100:
  13110. @example
  13111. cellauto=p=@@:s=100x400:full=0:rule=18
  13112. @end example
  13113. @item
  13114. Specify a more elaborated initial pattern:
  13115. @example
  13116. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13117. @end example
  13118. @end itemize
  13119. @anchor{coreimagesrc}
  13120. @section coreimagesrc
  13121. Video source generated on GPU using Apple's CoreImage API on OSX.
  13122. This video source is a specialized version of the @ref{coreimage} video filter.
  13123. Use a core image generator at the beginning of the applied filterchain to
  13124. generate the content.
  13125. The coreimagesrc video source accepts the following options:
  13126. @table @option
  13127. @item list_generators
  13128. List all available generators along with all their respective options as well as
  13129. possible minimum and maximum values along with the default values.
  13130. @example
  13131. list_generators=true
  13132. @end example
  13133. @item size, s
  13134. Specify the size of the sourced video. For the syntax of this option, check the
  13135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13136. The default value is @code{320x240}.
  13137. @item rate, r
  13138. Specify the frame rate of the sourced video, as the number of frames
  13139. generated per second. It has to be a string in the format
  13140. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13141. number or a valid video frame rate abbreviation. The default value is
  13142. "25".
  13143. @item sar
  13144. Set the sample aspect ratio of the sourced video.
  13145. @item duration, d
  13146. Set the duration of the sourced video. See
  13147. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13148. for the accepted syntax.
  13149. If not specified, or the expressed duration is negative, the video is
  13150. supposed to be generated forever.
  13151. @end table
  13152. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13153. A complete filterchain can be used for further processing of the
  13154. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13155. and examples for details.
  13156. @subsection Examples
  13157. @itemize
  13158. @item
  13159. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13160. given as complete and escaped command-line for Apple's standard bash shell:
  13161. @example
  13162. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13163. @end example
  13164. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13165. need for a nullsrc video source.
  13166. @end itemize
  13167. @section mandelbrot
  13168. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13169. point specified with @var{start_x} and @var{start_y}.
  13170. This source accepts the following options:
  13171. @table @option
  13172. @item end_pts
  13173. Set the terminal pts value. Default value is 400.
  13174. @item end_scale
  13175. Set the terminal scale value.
  13176. Must be a floating point value. Default value is 0.3.
  13177. @item inner
  13178. Set the inner coloring mode, that is the algorithm used to draw the
  13179. Mandelbrot fractal internal region.
  13180. It shall assume one of the following values:
  13181. @table @option
  13182. @item black
  13183. Set black mode.
  13184. @item convergence
  13185. Show time until convergence.
  13186. @item mincol
  13187. Set color based on point closest to the origin of the iterations.
  13188. @item period
  13189. Set period mode.
  13190. @end table
  13191. Default value is @var{mincol}.
  13192. @item bailout
  13193. Set the bailout value. Default value is 10.0.
  13194. @item maxiter
  13195. Set the maximum of iterations performed by the rendering
  13196. algorithm. Default value is 7189.
  13197. @item outer
  13198. Set outer coloring mode.
  13199. It shall assume one of following values:
  13200. @table @option
  13201. @item iteration_count
  13202. Set iteration cound mode.
  13203. @item normalized_iteration_count
  13204. set normalized iteration count mode.
  13205. @end table
  13206. Default value is @var{normalized_iteration_count}.
  13207. @item rate, r
  13208. Set frame rate, expressed as number of frames per second. Default
  13209. value is "25".
  13210. @item size, s
  13211. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13212. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13213. @item start_scale
  13214. Set the initial scale value. Default value is 3.0.
  13215. @item start_x
  13216. Set the initial x position. Must be a floating point value between
  13217. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13218. @item start_y
  13219. Set the initial y position. Must be a floating point value between
  13220. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13221. @end table
  13222. @section mptestsrc
  13223. Generate various test patterns, as generated by the MPlayer test filter.
  13224. The size of the generated video is fixed, and is 256x256.
  13225. This source is useful in particular for testing encoding features.
  13226. This source accepts the following options:
  13227. @table @option
  13228. @item rate, r
  13229. Specify the frame rate of the sourced video, as the number of frames
  13230. generated per second. It has to be a string in the format
  13231. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13232. number or a valid video frame rate abbreviation. The default value is
  13233. "25".
  13234. @item duration, d
  13235. Set the duration of the sourced video. See
  13236. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13237. for the accepted syntax.
  13238. If not specified, or the expressed duration is negative, the video is
  13239. supposed to be generated forever.
  13240. @item test, t
  13241. Set the number or the name of the test to perform. Supported tests are:
  13242. @table @option
  13243. @item dc_luma
  13244. @item dc_chroma
  13245. @item freq_luma
  13246. @item freq_chroma
  13247. @item amp_luma
  13248. @item amp_chroma
  13249. @item cbp
  13250. @item mv
  13251. @item ring1
  13252. @item ring2
  13253. @item all
  13254. @end table
  13255. Default value is "all", which will cycle through the list of all tests.
  13256. @end table
  13257. Some examples:
  13258. @example
  13259. mptestsrc=t=dc_luma
  13260. @end example
  13261. will generate a "dc_luma" test pattern.
  13262. @section frei0r_src
  13263. Provide a frei0r source.
  13264. To enable compilation of this filter you need to install the frei0r
  13265. header and configure FFmpeg with @code{--enable-frei0r}.
  13266. This source accepts the following parameters:
  13267. @table @option
  13268. @item size
  13269. The size of the video to generate. For the syntax of this option, check the
  13270. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13271. @item framerate
  13272. The framerate of the generated video. It may be a string of the form
  13273. @var{num}/@var{den} or a frame rate abbreviation.
  13274. @item filter_name
  13275. The name to the frei0r source to load. For more information regarding frei0r and
  13276. how to set the parameters, read the @ref{frei0r} section in the video filters
  13277. documentation.
  13278. @item filter_params
  13279. A '|'-separated list of parameters to pass to the frei0r source.
  13280. @end table
  13281. For example, to generate a frei0r partik0l source with size 200x200
  13282. and frame rate 10 which is overlaid on the overlay filter main input:
  13283. @example
  13284. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13285. @end example
  13286. @section life
  13287. Generate a life pattern.
  13288. This source is based on a generalization of John Conway's life game.
  13289. The sourced input represents a life grid, each pixel represents a cell
  13290. which can be in one of two possible states, alive or dead. Every cell
  13291. interacts with its eight neighbours, which are the cells that are
  13292. horizontally, vertically, or diagonally adjacent.
  13293. At each interaction the grid evolves according to the adopted rule,
  13294. which specifies the number of neighbor alive cells which will make a
  13295. cell stay alive or born. The @option{rule} option allows one to specify
  13296. the rule to adopt.
  13297. This source accepts the following options:
  13298. @table @option
  13299. @item filename, f
  13300. Set the file from which to read the initial grid state. In the file,
  13301. each non-whitespace character is considered an alive cell, and newline
  13302. is used to delimit the end of each row.
  13303. If this option is not specified, the initial grid is generated
  13304. randomly.
  13305. @item rate, r
  13306. Set the video rate, that is the number of frames generated per second.
  13307. Default is 25.
  13308. @item random_fill_ratio, ratio
  13309. Set the random fill ratio for the initial random grid. It is a
  13310. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13311. It is ignored when a file is specified.
  13312. @item random_seed, seed
  13313. Set the seed for filling the initial random grid, must be an integer
  13314. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13315. set to -1, the filter will try to use a good random seed on a best
  13316. effort basis.
  13317. @item rule
  13318. Set the life rule.
  13319. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13320. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13321. @var{NS} specifies the number of alive neighbor cells which make a
  13322. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13323. which make a dead cell to become alive (i.e. to "born").
  13324. "s" and "b" can be used in place of "S" and "B", respectively.
  13325. Alternatively a rule can be specified by an 18-bits integer. The 9
  13326. high order bits are used to encode the next cell state if it is alive
  13327. for each number of neighbor alive cells, the low order bits specify
  13328. the rule for "borning" new cells. Higher order bits encode for an
  13329. higher number of neighbor cells.
  13330. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13331. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13332. Default value is "S23/B3", which is the original Conway's game of life
  13333. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13334. cells, and will born a new cell if there are three alive cells around
  13335. a dead cell.
  13336. @item size, s
  13337. Set the size of the output video. For the syntax of this option, check the
  13338. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13339. If @option{filename} is specified, the size is set by default to the
  13340. same size of the input file. If @option{size} is set, it must contain
  13341. the size specified in the input file, and the initial grid defined in
  13342. that file is centered in the larger resulting area.
  13343. If a filename is not specified, the size value defaults to "320x240"
  13344. (used for a randomly generated initial grid).
  13345. @item stitch
  13346. If set to 1, stitch the left and right grid edges together, and the
  13347. top and bottom edges also. Defaults to 1.
  13348. @item mold
  13349. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13350. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13351. value from 0 to 255.
  13352. @item life_color
  13353. Set the color of living (or new born) cells.
  13354. @item death_color
  13355. Set the color of dead cells. If @option{mold} is set, this is the first color
  13356. used to represent a dead cell.
  13357. @item mold_color
  13358. Set mold color, for definitely dead and moldy cells.
  13359. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13360. ffmpeg-utils manual,ffmpeg-utils}.
  13361. @end table
  13362. @subsection Examples
  13363. @itemize
  13364. @item
  13365. Read a grid from @file{pattern}, and center it on a grid of size
  13366. 300x300 pixels:
  13367. @example
  13368. life=f=pattern:s=300x300
  13369. @end example
  13370. @item
  13371. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13372. @example
  13373. life=ratio=2/3:s=200x200
  13374. @end example
  13375. @item
  13376. Specify a custom rule for evolving a randomly generated grid:
  13377. @example
  13378. life=rule=S14/B34
  13379. @end example
  13380. @item
  13381. Full example with slow death effect (mold) using @command{ffplay}:
  13382. @example
  13383. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13384. @end example
  13385. @end itemize
  13386. @anchor{allrgb}
  13387. @anchor{allyuv}
  13388. @anchor{color}
  13389. @anchor{haldclutsrc}
  13390. @anchor{nullsrc}
  13391. @anchor{rgbtestsrc}
  13392. @anchor{smptebars}
  13393. @anchor{smptehdbars}
  13394. @anchor{testsrc}
  13395. @anchor{testsrc2}
  13396. @anchor{yuvtestsrc}
  13397. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13398. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13399. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13400. The @code{color} source provides an uniformly colored input.
  13401. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13402. @ref{haldclut} filter.
  13403. The @code{nullsrc} source returns unprocessed video frames. It is
  13404. mainly useful to be employed in analysis / debugging tools, or as the
  13405. source for filters which ignore the input data.
  13406. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13407. detecting RGB vs BGR issues. You should see a red, green and blue
  13408. stripe from top to bottom.
  13409. The @code{smptebars} source generates a color bars pattern, based on
  13410. the SMPTE Engineering Guideline EG 1-1990.
  13411. The @code{smptehdbars} source generates a color bars pattern, based on
  13412. the SMPTE RP 219-2002.
  13413. The @code{testsrc} source generates a test video pattern, showing a
  13414. color pattern, a scrolling gradient and a timestamp. This is mainly
  13415. intended for testing purposes.
  13416. The @code{testsrc2} source is similar to testsrc, but supports more
  13417. pixel formats instead of just @code{rgb24}. This allows using it as an
  13418. input for other tests without requiring a format conversion.
  13419. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13420. see a y, cb and cr stripe from top to bottom.
  13421. The sources accept the following parameters:
  13422. @table @option
  13423. @item level
  13424. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13425. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13426. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13427. coded on a @code{1/(N*N)} scale.
  13428. @item color, c
  13429. Specify the color of the source, only available in the @code{color}
  13430. source. For the syntax of this option, check the
  13431. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13432. @item size, s
  13433. Specify the size of the sourced video. For the syntax of this option, check the
  13434. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13435. The default value is @code{320x240}.
  13436. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13437. @code{haldclutsrc} filters.
  13438. @item rate, r
  13439. Specify the frame rate of the sourced video, as the number of frames
  13440. generated per second. It has to be a string in the format
  13441. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13442. number or a valid video frame rate abbreviation. The default value is
  13443. "25".
  13444. @item duration, d
  13445. Set the duration of the sourced video. See
  13446. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13447. for the accepted syntax.
  13448. If not specified, or the expressed duration is negative, the video is
  13449. supposed to be generated forever.
  13450. @item sar
  13451. Set the sample aspect ratio of the sourced video.
  13452. @item alpha
  13453. Specify the alpha (opacity) of the background, only available in the
  13454. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13455. 255 (fully opaque, the default).
  13456. @item decimals, n
  13457. Set the number of decimals to show in the timestamp, only available in the
  13458. @code{testsrc} source.
  13459. The displayed timestamp value will correspond to the original
  13460. timestamp value multiplied by the power of 10 of the specified
  13461. value. Default value is 0.
  13462. @end table
  13463. @subsection Examples
  13464. @itemize
  13465. @item
  13466. Generate a video with a duration of 5.3 seconds, with size
  13467. 176x144 and a frame rate of 10 frames per second:
  13468. @example
  13469. testsrc=duration=5.3:size=qcif:rate=10
  13470. @end example
  13471. @item
  13472. The following graph description will generate a red source
  13473. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13474. frames per second:
  13475. @example
  13476. color=c=red@@0.2:s=qcif:r=10
  13477. @end example
  13478. @item
  13479. If the input content is to be ignored, @code{nullsrc} can be used. The
  13480. following command generates noise in the luminance plane by employing
  13481. the @code{geq} filter:
  13482. @example
  13483. nullsrc=s=256x256, geq=random(1)*255:128:128
  13484. @end example
  13485. @end itemize
  13486. @subsection Commands
  13487. The @code{color} source supports the following commands:
  13488. @table @option
  13489. @item c, color
  13490. Set the color of the created image. Accepts the same syntax of the
  13491. corresponding @option{color} option.
  13492. @end table
  13493. @section openclsrc
  13494. Generate video using an OpenCL program.
  13495. @table @option
  13496. @item source
  13497. OpenCL program source file.
  13498. @item kernel
  13499. Kernel name in program.
  13500. @item size, s
  13501. Size of frames to generate. This must be set.
  13502. @item format
  13503. Pixel format to use for the generated frames. This must be set.
  13504. @item rate, r
  13505. Number of frames generated every second. Default value is '25'.
  13506. @end table
  13507. For details of how the program loading works, see the @ref{program_opencl}
  13508. filter.
  13509. Example programs:
  13510. @itemize
  13511. @item
  13512. Generate a colour ramp by setting pixel values from the position of the pixel
  13513. in the output image. (Note that this will work with all pixel formats, but
  13514. the generated output will not be the same.)
  13515. @verbatim
  13516. __kernel void ramp(__write_only image2d_t dst,
  13517. unsigned int index)
  13518. {
  13519. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13520. float4 val;
  13521. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13522. write_imagef(dst, loc, val);
  13523. }
  13524. @end verbatim
  13525. @item
  13526. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13527. @verbatim
  13528. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13529. unsigned int index)
  13530. {
  13531. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13532. float4 value = 0.0f;
  13533. int x = loc.x + index;
  13534. int y = loc.y + index;
  13535. while (x > 0 || y > 0) {
  13536. if (x % 3 == 1 && y % 3 == 1) {
  13537. value = 1.0f;
  13538. break;
  13539. }
  13540. x /= 3;
  13541. y /= 3;
  13542. }
  13543. write_imagef(dst, loc, value);
  13544. }
  13545. @end verbatim
  13546. @end itemize
  13547. @c man end VIDEO SOURCES
  13548. @chapter Video Sinks
  13549. @c man begin VIDEO SINKS
  13550. Below is a description of the currently available video sinks.
  13551. @section buffersink
  13552. Buffer video frames, and make them available to the end of the filter
  13553. graph.
  13554. This sink is mainly intended for programmatic use, in particular
  13555. through the interface defined in @file{libavfilter/buffersink.h}
  13556. or the options system.
  13557. It accepts a pointer to an AVBufferSinkContext structure, which
  13558. defines the incoming buffers' formats, to be passed as the opaque
  13559. parameter to @code{avfilter_init_filter} for initialization.
  13560. @section nullsink
  13561. Null video sink: do absolutely nothing with the input video. It is
  13562. mainly useful as a template and for use in analysis / debugging
  13563. tools.
  13564. @c man end VIDEO SINKS
  13565. @chapter Multimedia Filters
  13566. @c man begin MULTIMEDIA FILTERS
  13567. Below is a description of the currently available multimedia filters.
  13568. @section abitscope
  13569. Convert input audio to a video output, displaying the audio bit scope.
  13570. The filter accepts the following options:
  13571. @table @option
  13572. @item rate, r
  13573. Set frame rate, expressed as number of frames per second. Default
  13574. value is "25".
  13575. @item size, s
  13576. Specify the video size for the output. For the syntax of this option, check the
  13577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13578. Default value is @code{1024x256}.
  13579. @item colors
  13580. Specify list of colors separated by space or by '|' which will be used to
  13581. draw channels. Unrecognized or missing colors will be replaced
  13582. by white color.
  13583. @end table
  13584. @section ahistogram
  13585. Convert input audio to a video output, displaying the volume histogram.
  13586. The filter accepts the following options:
  13587. @table @option
  13588. @item dmode
  13589. Specify how histogram is calculated.
  13590. It accepts the following values:
  13591. @table @samp
  13592. @item single
  13593. Use single histogram for all channels.
  13594. @item separate
  13595. Use separate histogram for each channel.
  13596. @end table
  13597. Default is @code{single}.
  13598. @item rate, r
  13599. Set frame rate, expressed as number of frames per second. Default
  13600. value is "25".
  13601. @item size, s
  13602. Specify the video size for the output. For the syntax of this option, check the
  13603. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13604. Default value is @code{hd720}.
  13605. @item scale
  13606. Set display scale.
  13607. It accepts the following values:
  13608. @table @samp
  13609. @item log
  13610. logarithmic
  13611. @item sqrt
  13612. square root
  13613. @item cbrt
  13614. cubic root
  13615. @item lin
  13616. linear
  13617. @item rlog
  13618. reverse logarithmic
  13619. @end table
  13620. Default is @code{log}.
  13621. @item ascale
  13622. Set amplitude scale.
  13623. It accepts the following values:
  13624. @table @samp
  13625. @item log
  13626. logarithmic
  13627. @item lin
  13628. linear
  13629. @end table
  13630. Default is @code{log}.
  13631. @item acount
  13632. Set how much frames to accumulate in histogram.
  13633. Defauls is 1. Setting this to -1 accumulates all frames.
  13634. @item rheight
  13635. Set histogram ratio of window height.
  13636. @item slide
  13637. Set sonogram sliding.
  13638. It accepts the following values:
  13639. @table @samp
  13640. @item replace
  13641. replace old rows with new ones.
  13642. @item scroll
  13643. scroll from top to bottom.
  13644. @end table
  13645. Default is @code{replace}.
  13646. @end table
  13647. @section aphasemeter
  13648. Convert input audio to a video output, displaying the audio phase.
  13649. The filter accepts the following options:
  13650. @table @option
  13651. @item rate, r
  13652. Set the output frame rate. Default value is @code{25}.
  13653. @item size, s
  13654. Set the video size for the output. For the syntax of this option, check the
  13655. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13656. Default value is @code{800x400}.
  13657. @item rc
  13658. @item gc
  13659. @item bc
  13660. Specify the red, green, blue contrast. Default values are @code{2},
  13661. @code{7} and @code{1}.
  13662. Allowed range is @code{[0, 255]}.
  13663. @item mpc
  13664. Set color which will be used for drawing median phase. If color is
  13665. @code{none} which is default, no median phase value will be drawn.
  13666. @item video
  13667. Enable video output. Default is enabled.
  13668. @end table
  13669. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13670. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13671. The @code{-1} means left and right channels are completely out of phase and
  13672. @code{1} means channels are in phase.
  13673. @section avectorscope
  13674. Convert input audio to a video output, representing the audio vector
  13675. scope.
  13676. The filter is used to measure the difference between channels of stereo
  13677. audio stream. A monoaural signal, consisting of identical left and right
  13678. signal, results in straight vertical line. Any stereo separation is visible
  13679. as a deviation from this line, creating a Lissajous figure.
  13680. If the straight (or deviation from it) but horizontal line appears this
  13681. indicates that the left and right channels are out of phase.
  13682. The filter accepts the following options:
  13683. @table @option
  13684. @item mode, m
  13685. Set the vectorscope mode.
  13686. Available values are:
  13687. @table @samp
  13688. @item lissajous
  13689. Lissajous rotated by 45 degrees.
  13690. @item lissajous_xy
  13691. Same as above but not rotated.
  13692. @item polar
  13693. Shape resembling half of circle.
  13694. @end table
  13695. Default value is @samp{lissajous}.
  13696. @item size, s
  13697. Set the video size for the output. For the syntax of this option, check the
  13698. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13699. Default value is @code{400x400}.
  13700. @item rate, r
  13701. Set the output frame rate. Default value is @code{25}.
  13702. @item rc
  13703. @item gc
  13704. @item bc
  13705. @item ac
  13706. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13707. @code{160}, @code{80} and @code{255}.
  13708. Allowed range is @code{[0, 255]}.
  13709. @item rf
  13710. @item gf
  13711. @item bf
  13712. @item af
  13713. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13714. @code{10}, @code{5} and @code{5}.
  13715. Allowed range is @code{[0, 255]}.
  13716. @item zoom
  13717. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13718. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13719. @item draw
  13720. Set the vectorscope drawing mode.
  13721. Available values are:
  13722. @table @samp
  13723. @item dot
  13724. Draw dot for each sample.
  13725. @item line
  13726. Draw line between previous and current sample.
  13727. @end table
  13728. Default value is @samp{dot}.
  13729. @item scale
  13730. Specify amplitude scale of audio samples.
  13731. Available values are:
  13732. @table @samp
  13733. @item lin
  13734. Linear.
  13735. @item sqrt
  13736. Square root.
  13737. @item cbrt
  13738. Cubic root.
  13739. @item log
  13740. Logarithmic.
  13741. @end table
  13742. @item swap
  13743. Swap left channel axis with right channel axis.
  13744. @item mirror
  13745. Mirror axis.
  13746. @table @samp
  13747. @item none
  13748. No mirror.
  13749. @item x
  13750. Mirror only x axis.
  13751. @item y
  13752. Mirror only y axis.
  13753. @item xy
  13754. Mirror both axis.
  13755. @end table
  13756. @end table
  13757. @subsection Examples
  13758. @itemize
  13759. @item
  13760. Complete example using @command{ffplay}:
  13761. @example
  13762. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13763. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13764. @end example
  13765. @end itemize
  13766. @section bench, abench
  13767. Benchmark part of a filtergraph.
  13768. The filter accepts the following options:
  13769. @table @option
  13770. @item action
  13771. Start or stop a timer.
  13772. Available values are:
  13773. @table @samp
  13774. @item start
  13775. Get the current time, set it as frame metadata (using the key
  13776. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13777. @item stop
  13778. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13779. the input frame metadata to get the time difference. Time difference, average,
  13780. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13781. @code{min}) are then printed. The timestamps are expressed in seconds.
  13782. @end table
  13783. @end table
  13784. @subsection Examples
  13785. @itemize
  13786. @item
  13787. Benchmark @ref{selectivecolor} filter:
  13788. @example
  13789. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13790. @end example
  13791. @end itemize
  13792. @section concat
  13793. Concatenate audio and video streams, joining them together one after the
  13794. other.
  13795. The filter works on segments of synchronized video and audio streams. All
  13796. segments must have the same number of streams of each type, and that will
  13797. also be the number of streams at output.
  13798. The filter accepts the following options:
  13799. @table @option
  13800. @item n
  13801. Set the number of segments. Default is 2.
  13802. @item v
  13803. Set the number of output video streams, that is also the number of video
  13804. streams in each segment. Default is 1.
  13805. @item a
  13806. Set the number of output audio streams, that is also the number of audio
  13807. streams in each segment. Default is 0.
  13808. @item unsafe
  13809. Activate unsafe mode: do not fail if segments have a different format.
  13810. @end table
  13811. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13812. @var{a} audio outputs.
  13813. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13814. segment, in the same order as the outputs, then the inputs for the second
  13815. segment, etc.
  13816. Related streams do not always have exactly the same duration, for various
  13817. reasons including codec frame size or sloppy authoring. For that reason,
  13818. related synchronized streams (e.g. a video and its audio track) should be
  13819. concatenated at once. The concat filter will use the duration of the longest
  13820. stream in each segment (except the last one), and if necessary pad shorter
  13821. audio streams with silence.
  13822. For this filter to work correctly, all segments must start at timestamp 0.
  13823. All corresponding streams must have the same parameters in all segments; the
  13824. filtering system will automatically select a common pixel format for video
  13825. streams, and a common sample format, sample rate and channel layout for
  13826. audio streams, but other settings, such as resolution, must be converted
  13827. explicitly by the user.
  13828. Different frame rates are acceptable but will result in variable frame rate
  13829. at output; be sure to configure the output file to handle it.
  13830. @subsection Examples
  13831. @itemize
  13832. @item
  13833. Concatenate an opening, an episode and an ending, all in bilingual version
  13834. (video in stream 0, audio in streams 1 and 2):
  13835. @example
  13836. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13837. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13838. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13839. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13840. @end example
  13841. @item
  13842. Concatenate two parts, handling audio and video separately, using the
  13843. (a)movie sources, and adjusting the resolution:
  13844. @example
  13845. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13846. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13847. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13848. @end example
  13849. Note that a desync will happen at the stitch if the audio and video streams
  13850. do not have exactly the same duration in the first file.
  13851. @end itemize
  13852. @subsection Commands
  13853. This filter supports the following commands:
  13854. @table @option
  13855. @item next
  13856. Close the current segment and step to the next one
  13857. @end table
  13858. @section drawgraph, adrawgraph
  13859. Draw a graph using input video or audio metadata.
  13860. It accepts the following parameters:
  13861. @table @option
  13862. @item m1
  13863. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13864. @item fg1
  13865. Set 1st foreground color expression.
  13866. @item m2
  13867. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13868. @item fg2
  13869. Set 2nd foreground color expression.
  13870. @item m3
  13871. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13872. @item fg3
  13873. Set 3rd foreground color expression.
  13874. @item m4
  13875. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13876. @item fg4
  13877. Set 4th foreground color expression.
  13878. @item min
  13879. Set minimal value of metadata value.
  13880. @item max
  13881. Set maximal value of metadata value.
  13882. @item bg
  13883. Set graph background color. Default is white.
  13884. @item mode
  13885. Set graph mode.
  13886. Available values for mode is:
  13887. @table @samp
  13888. @item bar
  13889. @item dot
  13890. @item line
  13891. @end table
  13892. Default is @code{line}.
  13893. @item slide
  13894. Set slide mode.
  13895. Available values for slide is:
  13896. @table @samp
  13897. @item frame
  13898. Draw new frame when right border is reached.
  13899. @item replace
  13900. Replace old columns with new ones.
  13901. @item scroll
  13902. Scroll from right to left.
  13903. @item rscroll
  13904. Scroll from left to right.
  13905. @item picture
  13906. Draw single picture.
  13907. @end table
  13908. Default is @code{frame}.
  13909. @item size
  13910. Set size of graph video. For the syntax of this option, check the
  13911. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13912. The default value is @code{900x256}.
  13913. The foreground color expressions can use the following variables:
  13914. @table @option
  13915. @item MIN
  13916. Minimal value of metadata value.
  13917. @item MAX
  13918. Maximal value of metadata value.
  13919. @item VAL
  13920. Current metadata key value.
  13921. @end table
  13922. The color is defined as 0xAABBGGRR.
  13923. @end table
  13924. Example using metadata from @ref{signalstats} filter:
  13925. @example
  13926. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13927. @end example
  13928. Example using metadata from @ref{ebur128} filter:
  13929. @example
  13930. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13931. @end example
  13932. @anchor{ebur128}
  13933. @section ebur128
  13934. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13935. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13936. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13937. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13938. The filter also has a video output (see the @var{video} option) with a real
  13939. time graph to observe the loudness evolution. The graphic contains the logged
  13940. message mentioned above, so it is not printed anymore when this option is set,
  13941. unless the verbose logging is set. The main graphing area contains the
  13942. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13943. the momentary loudness (400 milliseconds).
  13944. More information about the Loudness Recommendation EBU R128 on
  13945. @url{http://tech.ebu.ch/loudness}.
  13946. The filter accepts the following options:
  13947. @table @option
  13948. @item video
  13949. Activate the video output. The audio stream is passed unchanged whether this
  13950. option is set or no. The video stream will be the first output stream if
  13951. activated. Default is @code{0}.
  13952. @item size
  13953. Set the video size. This option is for video only. For the syntax of this
  13954. option, check the
  13955. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13956. Default and minimum resolution is @code{640x480}.
  13957. @item meter
  13958. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13959. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13960. other integer value between this range is allowed.
  13961. @item metadata
  13962. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13963. into 100ms output frames, each of them containing various loudness information
  13964. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13965. Default is @code{0}.
  13966. @item framelog
  13967. Force the frame logging level.
  13968. Available values are:
  13969. @table @samp
  13970. @item info
  13971. information logging level
  13972. @item verbose
  13973. verbose logging level
  13974. @end table
  13975. By default, the logging level is set to @var{info}. If the @option{video} or
  13976. the @option{metadata} options are set, it switches to @var{verbose}.
  13977. @item peak
  13978. Set peak mode(s).
  13979. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13980. values are:
  13981. @table @samp
  13982. @item none
  13983. Disable any peak mode (default).
  13984. @item sample
  13985. Enable sample-peak mode.
  13986. Simple peak mode looking for the higher sample value. It logs a message
  13987. for sample-peak (identified by @code{SPK}).
  13988. @item true
  13989. Enable true-peak mode.
  13990. If enabled, the peak lookup is done on an over-sampled version of the input
  13991. stream for better peak accuracy. It logs a message for true-peak.
  13992. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13993. This mode requires a build with @code{libswresample}.
  13994. @end table
  13995. @item dualmono
  13996. Treat mono input files as "dual mono". If a mono file is intended for playback
  13997. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13998. If set to @code{true}, this option will compensate for this effect.
  13999. Multi-channel input files are not affected by this option.
  14000. @item panlaw
  14001. Set a specific pan law to be used for the measurement of dual mono files.
  14002. This parameter is optional, and has a default value of -3.01dB.
  14003. @end table
  14004. @subsection Examples
  14005. @itemize
  14006. @item
  14007. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14008. @example
  14009. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14010. @end example
  14011. @item
  14012. Run an analysis with @command{ffmpeg}:
  14013. @example
  14014. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14015. @end example
  14016. @end itemize
  14017. @section interleave, ainterleave
  14018. Temporally interleave frames from several inputs.
  14019. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14020. These filters read frames from several inputs and send the oldest
  14021. queued frame to the output.
  14022. Input streams must have well defined, monotonically increasing frame
  14023. timestamp values.
  14024. In order to submit one frame to output, these filters need to enqueue
  14025. at least one frame for each input, so they cannot work in case one
  14026. input is not yet terminated and will not receive incoming frames.
  14027. For example consider the case when one input is a @code{select} filter
  14028. which always drops input frames. The @code{interleave} filter will keep
  14029. reading from that input, but it will never be able to send new frames
  14030. to output until the input sends an end-of-stream signal.
  14031. Also, depending on inputs synchronization, the filters will drop
  14032. frames in case one input receives more frames than the other ones, and
  14033. the queue is already filled.
  14034. These filters accept the following options:
  14035. @table @option
  14036. @item nb_inputs, n
  14037. Set the number of different inputs, it is 2 by default.
  14038. @end table
  14039. @subsection Examples
  14040. @itemize
  14041. @item
  14042. Interleave frames belonging to different streams using @command{ffmpeg}:
  14043. @example
  14044. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14045. @end example
  14046. @item
  14047. Add flickering blur effect:
  14048. @example
  14049. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14050. @end example
  14051. @end itemize
  14052. @section metadata, ametadata
  14053. Manipulate frame metadata.
  14054. This filter accepts the following options:
  14055. @table @option
  14056. @item mode
  14057. Set mode of operation of the filter.
  14058. Can be one of the following:
  14059. @table @samp
  14060. @item select
  14061. If both @code{value} and @code{key} is set, select frames
  14062. which have such metadata. If only @code{key} is set, select
  14063. every frame that has such key in metadata.
  14064. @item add
  14065. Add new metadata @code{key} and @code{value}. If key is already available
  14066. do nothing.
  14067. @item modify
  14068. Modify value of already present key.
  14069. @item delete
  14070. If @code{value} is set, delete only keys that have such value.
  14071. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14072. the frame.
  14073. @item print
  14074. Print key and its value if metadata was found. If @code{key} is not set print all
  14075. metadata values available in frame.
  14076. @end table
  14077. @item key
  14078. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14079. @item value
  14080. Set metadata value which will be used. This option is mandatory for
  14081. @code{modify} and @code{add} mode.
  14082. @item function
  14083. Which function to use when comparing metadata value and @code{value}.
  14084. Can be one of following:
  14085. @table @samp
  14086. @item same_str
  14087. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14088. @item starts_with
  14089. Values are interpreted as strings, returns true if metadata value starts with
  14090. the @code{value} option string.
  14091. @item less
  14092. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14093. @item equal
  14094. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14095. @item greater
  14096. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14097. @item expr
  14098. Values are interpreted as floats, returns true if expression from option @code{expr}
  14099. evaluates to true.
  14100. @end table
  14101. @item expr
  14102. Set expression which is used when @code{function} is set to @code{expr}.
  14103. The expression is evaluated through the eval API and can contain the following
  14104. constants:
  14105. @table @option
  14106. @item VALUE1
  14107. Float representation of @code{value} from metadata key.
  14108. @item VALUE2
  14109. Float representation of @code{value} as supplied by user in @code{value} option.
  14110. @end table
  14111. @item file
  14112. If specified in @code{print} mode, output is written to the named file. Instead of
  14113. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14114. for standard output. If @code{file} option is not set, output is written to the log
  14115. with AV_LOG_INFO loglevel.
  14116. @end table
  14117. @subsection Examples
  14118. @itemize
  14119. @item
  14120. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14121. between 0 and 1.
  14122. @example
  14123. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14124. @end example
  14125. @item
  14126. Print silencedetect output to file @file{metadata.txt}.
  14127. @example
  14128. silencedetect,ametadata=mode=print:file=metadata.txt
  14129. @end example
  14130. @item
  14131. Direct all metadata to a pipe with file descriptor 4.
  14132. @example
  14133. metadata=mode=print:file='pipe\:4'
  14134. @end example
  14135. @end itemize
  14136. @section perms, aperms
  14137. Set read/write permissions for the output frames.
  14138. These filters are mainly aimed at developers to test direct path in the
  14139. following filter in the filtergraph.
  14140. The filters accept the following options:
  14141. @table @option
  14142. @item mode
  14143. Select the permissions mode.
  14144. It accepts the following values:
  14145. @table @samp
  14146. @item none
  14147. Do nothing. This is the default.
  14148. @item ro
  14149. Set all the output frames read-only.
  14150. @item rw
  14151. Set all the output frames directly writable.
  14152. @item toggle
  14153. Make the frame read-only if writable, and writable if read-only.
  14154. @item random
  14155. Set each output frame read-only or writable randomly.
  14156. @end table
  14157. @item seed
  14158. Set the seed for the @var{random} mode, must be an integer included between
  14159. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14160. @code{-1}, the filter will try to use a good random seed on a best effort
  14161. basis.
  14162. @end table
  14163. Note: in case of auto-inserted filter between the permission filter and the
  14164. following one, the permission might not be received as expected in that
  14165. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14166. perms/aperms filter can avoid this problem.
  14167. @section realtime, arealtime
  14168. Slow down filtering to match real time approximately.
  14169. These filters will pause the filtering for a variable amount of time to
  14170. match the output rate with the input timestamps.
  14171. They are similar to the @option{re} option to @code{ffmpeg}.
  14172. They accept the following options:
  14173. @table @option
  14174. @item limit
  14175. Time limit for the pauses. Any pause longer than that will be considered
  14176. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14177. @end table
  14178. @anchor{select}
  14179. @section select, aselect
  14180. Select frames to pass in output.
  14181. This filter accepts the following options:
  14182. @table @option
  14183. @item expr, e
  14184. Set expression, which is evaluated for each input frame.
  14185. If the expression is evaluated to zero, the frame is discarded.
  14186. If the evaluation result is negative or NaN, the frame is sent to the
  14187. first output; otherwise it is sent to the output with index
  14188. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14189. For example a value of @code{1.2} corresponds to the output with index
  14190. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14191. @item outputs, n
  14192. Set the number of outputs. The output to which to send the selected
  14193. frame is based on the result of the evaluation. Default value is 1.
  14194. @end table
  14195. The expression can contain the following constants:
  14196. @table @option
  14197. @item n
  14198. The (sequential) number of the filtered frame, starting from 0.
  14199. @item selected_n
  14200. The (sequential) number of the selected frame, starting from 0.
  14201. @item prev_selected_n
  14202. The sequential number of the last selected frame. It's NAN if undefined.
  14203. @item TB
  14204. The timebase of the input timestamps.
  14205. @item pts
  14206. The PTS (Presentation TimeStamp) of the filtered video frame,
  14207. expressed in @var{TB} units. It's NAN if undefined.
  14208. @item t
  14209. The PTS of the filtered video frame,
  14210. expressed in seconds. It's NAN if undefined.
  14211. @item prev_pts
  14212. The PTS of the previously filtered video frame. It's NAN if undefined.
  14213. @item prev_selected_pts
  14214. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14215. @item prev_selected_t
  14216. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14217. @item start_pts
  14218. The PTS of the first video frame in the video. It's NAN if undefined.
  14219. @item start_t
  14220. The time of the first video frame in the video. It's NAN if undefined.
  14221. @item pict_type @emph{(video only)}
  14222. The type of the filtered frame. It can assume one of the following
  14223. values:
  14224. @table @option
  14225. @item I
  14226. @item P
  14227. @item B
  14228. @item S
  14229. @item SI
  14230. @item SP
  14231. @item BI
  14232. @end table
  14233. @item interlace_type @emph{(video only)}
  14234. The frame interlace type. It can assume one of the following values:
  14235. @table @option
  14236. @item PROGRESSIVE
  14237. The frame is progressive (not interlaced).
  14238. @item TOPFIRST
  14239. The frame is top-field-first.
  14240. @item BOTTOMFIRST
  14241. The frame is bottom-field-first.
  14242. @end table
  14243. @item consumed_sample_n @emph{(audio only)}
  14244. the number of selected samples before the current frame
  14245. @item samples_n @emph{(audio only)}
  14246. the number of samples in the current frame
  14247. @item sample_rate @emph{(audio only)}
  14248. the input sample rate
  14249. @item key
  14250. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14251. @item pos
  14252. the position in the file of the filtered frame, -1 if the information
  14253. is not available (e.g. for synthetic video)
  14254. @item scene @emph{(video only)}
  14255. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14256. probability for the current frame to introduce a new scene, while a higher
  14257. value means the current frame is more likely to be one (see the example below)
  14258. @item concatdec_select
  14259. The concat demuxer can select only part of a concat input file by setting an
  14260. inpoint and an outpoint, but the output packets may not be entirely contained
  14261. in the selected interval. By using this variable, it is possible to skip frames
  14262. generated by the concat demuxer which are not exactly contained in the selected
  14263. interval.
  14264. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14265. and the @var{lavf.concat.duration} packet metadata values which are also
  14266. present in the decoded frames.
  14267. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14268. start_time and either the duration metadata is missing or the frame pts is less
  14269. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14270. missing.
  14271. That basically means that an input frame is selected if its pts is within the
  14272. interval set by the concat demuxer.
  14273. @end table
  14274. The default value of the select expression is "1".
  14275. @subsection Examples
  14276. @itemize
  14277. @item
  14278. Select all frames in input:
  14279. @example
  14280. select
  14281. @end example
  14282. The example above is the same as:
  14283. @example
  14284. select=1
  14285. @end example
  14286. @item
  14287. Skip all frames:
  14288. @example
  14289. select=0
  14290. @end example
  14291. @item
  14292. Select only I-frames:
  14293. @example
  14294. select='eq(pict_type\,I)'
  14295. @end example
  14296. @item
  14297. Select one frame every 100:
  14298. @example
  14299. select='not(mod(n\,100))'
  14300. @end example
  14301. @item
  14302. Select only frames contained in the 10-20 time interval:
  14303. @example
  14304. select=between(t\,10\,20)
  14305. @end example
  14306. @item
  14307. Select only I-frames contained in the 10-20 time interval:
  14308. @example
  14309. select=between(t\,10\,20)*eq(pict_type\,I)
  14310. @end example
  14311. @item
  14312. Select frames with a minimum distance of 10 seconds:
  14313. @example
  14314. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14315. @end example
  14316. @item
  14317. Use aselect to select only audio frames with samples number > 100:
  14318. @example
  14319. aselect='gt(samples_n\,100)'
  14320. @end example
  14321. @item
  14322. Create a mosaic of the first scenes:
  14323. @example
  14324. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14325. @end example
  14326. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14327. choice.
  14328. @item
  14329. Send even and odd frames to separate outputs, and compose them:
  14330. @example
  14331. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14332. @end example
  14333. @item
  14334. Select useful frames from an ffconcat file which is using inpoints and
  14335. outpoints but where the source files are not intra frame only.
  14336. @example
  14337. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14338. @end example
  14339. @end itemize
  14340. @section sendcmd, asendcmd
  14341. Send commands to filters in the filtergraph.
  14342. These filters read commands to be sent to other filters in the
  14343. filtergraph.
  14344. @code{sendcmd} must be inserted between two video filters,
  14345. @code{asendcmd} must be inserted between two audio filters, but apart
  14346. from that they act the same way.
  14347. The specification of commands can be provided in the filter arguments
  14348. with the @var{commands} option, or in a file specified by the
  14349. @var{filename} option.
  14350. These filters accept the following options:
  14351. @table @option
  14352. @item commands, c
  14353. Set the commands to be read and sent to the other filters.
  14354. @item filename, f
  14355. Set the filename of the commands to be read and sent to the other
  14356. filters.
  14357. @end table
  14358. @subsection Commands syntax
  14359. A commands description consists of a sequence of interval
  14360. specifications, comprising a list of commands to be executed when a
  14361. particular event related to that interval occurs. The occurring event
  14362. is typically the current frame time entering or leaving a given time
  14363. interval.
  14364. An interval is specified by the following syntax:
  14365. @example
  14366. @var{START}[-@var{END}] @var{COMMANDS};
  14367. @end example
  14368. The time interval is specified by the @var{START} and @var{END} times.
  14369. @var{END} is optional and defaults to the maximum time.
  14370. The current frame time is considered within the specified interval if
  14371. it is included in the interval [@var{START}, @var{END}), that is when
  14372. the time is greater or equal to @var{START} and is lesser than
  14373. @var{END}.
  14374. @var{COMMANDS} consists of a sequence of one or more command
  14375. specifications, separated by ",", relating to that interval. The
  14376. syntax of a command specification is given by:
  14377. @example
  14378. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14379. @end example
  14380. @var{FLAGS} is optional and specifies the type of events relating to
  14381. the time interval which enable sending the specified command, and must
  14382. be a non-null sequence of identifier flags separated by "+" or "|" and
  14383. enclosed between "[" and "]".
  14384. The following flags are recognized:
  14385. @table @option
  14386. @item enter
  14387. The command is sent when the current frame timestamp enters the
  14388. specified interval. In other words, the command is sent when the
  14389. previous frame timestamp was not in the given interval, and the
  14390. current is.
  14391. @item leave
  14392. The command is sent when the current frame timestamp leaves the
  14393. specified interval. In other words, the command is sent when the
  14394. previous frame timestamp was in the given interval, and the
  14395. current is not.
  14396. @end table
  14397. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14398. assumed.
  14399. @var{TARGET} specifies the target of the command, usually the name of
  14400. the filter class or a specific filter instance name.
  14401. @var{COMMAND} specifies the name of the command for the target filter.
  14402. @var{ARG} is optional and specifies the optional list of argument for
  14403. the given @var{COMMAND}.
  14404. Between one interval specification and another, whitespaces, or
  14405. sequences of characters starting with @code{#} until the end of line,
  14406. are ignored and can be used to annotate comments.
  14407. A simplified BNF description of the commands specification syntax
  14408. follows:
  14409. @example
  14410. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14411. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14412. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14413. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14414. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14415. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14416. @end example
  14417. @subsection Examples
  14418. @itemize
  14419. @item
  14420. Specify audio tempo change at second 4:
  14421. @example
  14422. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14423. @end example
  14424. @item
  14425. Target a specific filter instance:
  14426. @example
  14427. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14428. @end example
  14429. @item
  14430. Specify a list of drawtext and hue commands in a file.
  14431. @example
  14432. # show text in the interval 5-10
  14433. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14434. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14435. # desaturate the image in the interval 15-20
  14436. 15.0-20.0 [enter] hue s 0,
  14437. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14438. [leave] hue s 1,
  14439. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14440. # apply an exponential saturation fade-out effect, starting from time 25
  14441. 25 [enter] hue s exp(25-t)
  14442. @end example
  14443. A filtergraph allowing to read and process the above command list
  14444. stored in a file @file{test.cmd}, can be specified with:
  14445. @example
  14446. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14447. @end example
  14448. @end itemize
  14449. @anchor{setpts}
  14450. @section setpts, asetpts
  14451. Change the PTS (presentation timestamp) of the input frames.
  14452. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14453. This filter accepts the following options:
  14454. @table @option
  14455. @item expr
  14456. The expression which is evaluated for each frame to construct its timestamp.
  14457. @end table
  14458. The expression is evaluated through the eval API and can contain the following
  14459. constants:
  14460. @table @option
  14461. @item FRAME_RATE
  14462. frame rate, only defined for constant frame-rate video
  14463. @item PTS
  14464. The presentation timestamp in input
  14465. @item N
  14466. The count of the input frame for video or the number of consumed samples,
  14467. not including the current frame for audio, starting from 0.
  14468. @item NB_CONSUMED_SAMPLES
  14469. The number of consumed samples, not including the current frame (only
  14470. audio)
  14471. @item NB_SAMPLES, S
  14472. The number of samples in the current frame (only audio)
  14473. @item SAMPLE_RATE, SR
  14474. The audio sample rate.
  14475. @item STARTPTS
  14476. The PTS of the first frame.
  14477. @item STARTT
  14478. the time in seconds of the first frame
  14479. @item INTERLACED
  14480. State whether the current frame is interlaced.
  14481. @item T
  14482. the time in seconds of the current frame
  14483. @item POS
  14484. original position in the file of the frame, or undefined if undefined
  14485. for the current frame
  14486. @item PREV_INPTS
  14487. The previous input PTS.
  14488. @item PREV_INT
  14489. previous input time in seconds
  14490. @item PREV_OUTPTS
  14491. The previous output PTS.
  14492. @item PREV_OUTT
  14493. previous output time in seconds
  14494. @item RTCTIME
  14495. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14496. instead.
  14497. @item RTCSTART
  14498. The wallclock (RTC) time at the start of the movie in microseconds.
  14499. @item TB
  14500. The timebase of the input timestamps.
  14501. @end table
  14502. @subsection Examples
  14503. @itemize
  14504. @item
  14505. Start counting PTS from zero
  14506. @example
  14507. setpts=PTS-STARTPTS
  14508. @end example
  14509. @item
  14510. Apply fast motion effect:
  14511. @example
  14512. setpts=0.5*PTS
  14513. @end example
  14514. @item
  14515. Apply slow motion effect:
  14516. @example
  14517. setpts=2.0*PTS
  14518. @end example
  14519. @item
  14520. Set fixed rate of 25 frames per second:
  14521. @example
  14522. setpts=N/(25*TB)
  14523. @end example
  14524. @item
  14525. Set fixed rate 25 fps with some jitter:
  14526. @example
  14527. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14528. @end example
  14529. @item
  14530. Apply an offset of 10 seconds to the input PTS:
  14531. @example
  14532. setpts=PTS+10/TB
  14533. @end example
  14534. @item
  14535. Generate timestamps from a "live source" and rebase onto the current timebase:
  14536. @example
  14537. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14538. @end example
  14539. @item
  14540. Generate timestamps by counting samples:
  14541. @example
  14542. asetpts=N/SR/TB
  14543. @end example
  14544. @end itemize
  14545. @section setrange
  14546. Force color range for the output video frame.
  14547. The @code{setrange} filter marks the color range property for the
  14548. output frames. It does not change the input frame, but only sets the
  14549. corresponding property, which affects how the frame is treated by
  14550. following filters.
  14551. The filter accepts the following options:
  14552. @table @option
  14553. @item range
  14554. Available values are:
  14555. @table @samp
  14556. @item auto
  14557. Keep the same color range property.
  14558. @item unspecified, unknown
  14559. Set the color range as unspecified.
  14560. @item limited, tv, mpeg
  14561. Set the color range as limited.
  14562. @item full, pc, jpeg
  14563. Set the color range as full.
  14564. @end table
  14565. @end table
  14566. @section settb, asettb
  14567. Set the timebase to use for the output frames timestamps.
  14568. It is mainly useful for testing timebase configuration.
  14569. It accepts the following parameters:
  14570. @table @option
  14571. @item expr, tb
  14572. The expression which is evaluated into the output timebase.
  14573. @end table
  14574. The value for @option{tb} is an arithmetic expression representing a
  14575. rational. The expression can contain the constants "AVTB" (the default
  14576. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14577. audio only). Default value is "intb".
  14578. @subsection Examples
  14579. @itemize
  14580. @item
  14581. Set the timebase to 1/25:
  14582. @example
  14583. settb=expr=1/25
  14584. @end example
  14585. @item
  14586. Set the timebase to 1/10:
  14587. @example
  14588. settb=expr=0.1
  14589. @end example
  14590. @item
  14591. Set the timebase to 1001/1000:
  14592. @example
  14593. settb=1+0.001
  14594. @end example
  14595. @item
  14596. Set the timebase to 2*intb:
  14597. @example
  14598. settb=2*intb
  14599. @end example
  14600. @item
  14601. Set the default timebase value:
  14602. @example
  14603. settb=AVTB
  14604. @end example
  14605. @end itemize
  14606. @section showcqt
  14607. Convert input audio to a video output representing frequency spectrum
  14608. logarithmically using Brown-Puckette constant Q transform algorithm with
  14609. direct frequency domain coefficient calculation (but the transform itself
  14610. is not really constant Q, instead the Q factor is actually variable/clamped),
  14611. with musical tone scale, from E0 to D#10.
  14612. The filter accepts the following options:
  14613. @table @option
  14614. @item size, s
  14615. Specify the video size for the output. It must be even. For the syntax of this option,
  14616. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14617. Default value is @code{1920x1080}.
  14618. @item fps, rate, r
  14619. Set the output frame rate. Default value is @code{25}.
  14620. @item bar_h
  14621. Set the bargraph height. It must be even. Default value is @code{-1} which
  14622. computes the bargraph height automatically.
  14623. @item axis_h
  14624. Set the axis height. It must be even. Default value is @code{-1} which computes
  14625. the axis height automatically.
  14626. @item sono_h
  14627. Set the sonogram height. It must be even. Default value is @code{-1} which
  14628. computes the sonogram height automatically.
  14629. @item fullhd
  14630. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14631. instead. Default value is @code{1}.
  14632. @item sono_v, volume
  14633. Specify the sonogram volume expression. It can contain variables:
  14634. @table @option
  14635. @item bar_v
  14636. the @var{bar_v} evaluated expression
  14637. @item frequency, freq, f
  14638. the frequency where it is evaluated
  14639. @item timeclamp, tc
  14640. the value of @var{timeclamp} option
  14641. @end table
  14642. and functions:
  14643. @table @option
  14644. @item a_weighting(f)
  14645. A-weighting of equal loudness
  14646. @item b_weighting(f)
  14647. B-weighting of equal loudness
  14648. @item c_weighting(f)
  14649. C-weighting of equal loudness.
  14650. @end table
  14651. Default value is @code{16}.
  14652. @item bar_v, volume2
  14653. Specify the bargraph volume expression. It can contain variables:
  14654. @table @option
  14655. @item sono_v
  14656. the @var{sono_v} evaluated expression
  14657. @item frequency, freq, f
  14658. the frequency where it is evaluated
  14659. @item timeclamp, tc
  14660. the value of @var{timeclamp} option
  14661. @end table
  14662. and functions:
  14663. @table @option
  14664. @item a_weighting(f)
  14665. A-weighting of equal loudness
  14666. @item b_weighting(f)
  14667. B-weighting of equal loudness
  14668. @item c_weighting(f)
  14669. C-weighting of equal loudness.
  14670. @end table
  14671. Default value is @code{sono_v}.
  14672. @item sono_g, gamma
  14673. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14674. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14675. Acceptable range is @code{[1, 7]}.
  14676. @item bar_g, gamma2
  14677. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14678. @code{[1, 7]}.
  14679. @item bar_t
  14680. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14681. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14682. @item timeclamp, tc
  14683. Specify the transform timeclamp. At low frequency, there is trade-off between
  14684. accuracy in time domain and frequency domain. If timeclamp is lower,
  14685. event in time domain is represented more accurately (such as fast bass drum),
  14686. otherwise event in frequency domain is represented more accurately
  14687. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14688. @item attack
  14689. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14690. limits future samples by applying asymmetric windowing in time domain, useful
  14691. when low latency is required. Accepted range is @code{[0, 1]}.
  14692. @item basefreq
  14693. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14694. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14695. @item endfreq
  14696. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14697. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14698. @item coeffclamp
  14699. This option is deprecated and ignored.
  14700. @item tlength
  14701. Specify the transform length in time domain. Use this option to control accuracy
  14702. trade-off between time domain and frequency domain at every frequency sample.
  14703. It can contain variables:
  14704. @table @option
  14705. @item frequency, freq, f
  14706. the frequency where it is evaluated
  14707. @item timeclamp, tc
  14708. the value of @var{timeclamp} option.
  14709. @end table
  14710. Default value is @code{384*tc/(384+tc*f)}.
  14711. @item count
  14712. Specify the transform count for every video frame. Default value is @code{6}.
  14713. Acceptable range is @code{[1, 30]}.
  14714. @item fcount
  14715. Specify the transform count for every single pixel. Default value is @code{0},
  14716. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14717. @item fontfile
  14718. Specify font file for use with freetype to draw the axis. If not specified,
  14719. use embedded font. Note that drawing with font file or embedded font is not
  14720. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14721. option instead.
  14722. @item font
  14723. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14724. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14725. @item fontcolor
  14726. Specify font color expression. This is arithmetic expression that should return
  14727. integer value 0xRRGGBB. It can contain variables:
  14728. @table @option
  14729. @item frequency, freq, f
  14730. the frequency where it is evaluated
  14731. @item timeclamp, tc
  14732. the value of @var{timeclamp} option
  14733. @end table
  14734. and functions:
  14735. @table @option
  14736. @item midi(f)
  14737. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14738. @item r(x), g(x), b(x)
  14739. red, green, and blue value of intensity x.
  14740. @end table
  14741. Default value is @code{st(0, (midi(f)-59.5)/12);
  14742. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14743. r(1-ld(1)) + b(ld(1))}.
  14744. @item axisfile
  14745. Specify image file to draw the axis. This option override @var{fontfile} and
  14746. @var{fontcolor} option.
  14747. @item axis, text
  14748. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14749. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14750. Default value is @code{1}.
  14751. @item csp
  14752. Set colorspace. The accepted values are:
  14753. @table @samp
  14754. @item unspecified
  14755. Unspecified (default)
  14756. @item bt709
  14757. BT.709
  14758. @item fcc
  14759. FCC
  14760. @item bt470bg
  14761. BT.470BG or BT.601-6 625
  14762. @item smpte170m
  14763. SMPTE-170M or BT.601-6 525
  14764. @item smpte240m
  14765. SMPTE-240M
  14766. @item bt2020ncl
  14767. BT.2020 with non-constant luminance
  14768. @end table
  14769. @item cscheme
  14770. Set spectrogram color scheme. This is list of floating point values with format
  14771. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14772. The default is @code{1|0.5|0|0|0.5|1}.
  14773. @end table
  14774. @subsection Examples
  14775. @itemize
  14776. @item
  14777. Playing audio while showing the spectrum:
  14778. @example
  14779. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14780. @end example
  14781. @item
  14782. Same as above, but with frame rate 30 fps:
  14783. @example
  14784. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14785. @end example
  14786. @item
  14787. Playing at 1280x720:
  14788. @example
  14789. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14790. @end example
  14791. @item
  14792. Disable sonogram display:
  14793. @example
  14794. sono_h=0
  14795. @end example
  14796. @item
  14797. A1 and its harmonics: A1, A2, (near)E3, A3:
  14798. @example
  14799. 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),
  14800. asplit[a][out1]; [a] showcqt [out0]'
  14801. @end example
  14802. @item
  14803. Same as above, but with more accuracy in frequency domain:
  14804. @example
  14805. 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),
  14806. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14807. @end example
  14808. @item
  14809. Custom volume:
  14810. @example
  14811. bar_v=10:sono_v=bar_v*a_weighting(f)
  14812. @end example
  14813. @item
  14814. Custom gamma, now spectrum is linear to the amplitude.
  14815. @example
  14816. bar_g=2:sono_g=2
  14817. @end example
  14818. @item
  14819. Custom tlength equation:
  14820. @example
  14821. 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)))'
  14822. @end example
  14823. @item
  14824. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14825. @example
  14826. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14827. @end example
  14828. @item
  14829. Custom font using fontconfig:
  14830. @example
  14831. font='Courier New,Monospace,mono|bold'
  14832. @end example
  14833. @item
  14834. Custom frequency range with custom axis using image file:
  14835. @example
  14836. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14837. @end example
  14838. @end itemize
  14839. @section showfreqs
  14840. Convert input audio to video output representing the audio power spectrum.
  14841. Audio amplitude is on Y-axis while frequency is on X-axis.
  14842. The filter accepts the following options:
  14843. @table @option
  14844. @item size, s
  14845. Specify size of video. For the syntax of this option, check the
  14846. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14847. Default is @code{1024x512}.
  14848. @item mode
  14849. Set display mode.
  14850. This set how each frequency bin will be represented.
  14851. It accepts the following values:
  14852. @table @samp
  14853. @item line
  14854. @item bar
  14855. @item dot
  14856. @end table
  14857. Default is @code{bar}.
  14858. @item ascale
  14859. Set amplitude scale.
  14860. It accepts the following values:
  14861. @table @samp
  14862. @item lin
  14863. Linear scale.
  14864. @item sqrt
  14865. Square root scale.
  14866. @item cbrt
  14867. Cubic root scale.
  14868. @item log
  14869. Logarithmic scale.
  14870. @end table
  14871. Default is @code{log}.
  14872. @item fscale
  14873. Set frequency scale.
  14874. It accepts the following values:
  14875. @table @samp
  14876. @item lin
  14877. Linear scale.
  14878. @item log
  14879. Logarithmic scale.
  14880. @item rlog
  14881. Reverse logarithmic scale.
  14882. @end table
  14883. Default is @code{lin}.
  14884. @item win_size
  14885. Set window size.
  14886. It accepts the following values:
  14887. @table @samp
  14888. @item w16
  14889. @item w32
  14890. @item w64
  14891. @item w128
  14892. @item w256
  14893. @item w512
  14894. @item w1024
  14895. @item w2048
  14896. @item w4096
  14897. @item w8192
  14898. @item w16384
  14899. @item w32768
  14900. @item w65536
  14901. @end table
  14902. Default is @code{w2048}
  14903. @item win_func
  14904. Set windowing function.
  14905. It accepts the following values:
  14906. @table @samp
  14907. @item rect
  14908. @item bartlett
  14909. @item hanning
  14910. @item hamming
  14911. @item blackman
  14912. @item welch
  14913. @item flattop
  14914. @item bharris
  14915. @item bnuttall
  14916. @item bhann
  14917. @item sine
  14918. @item nuttall
  14919. @item lanczos
  14920. @item gauss
  14921. @item tukey
  14922. @item dolph
  14923. @item cauchy
  14924. @item parzen
  14925. @item poisson
  14926. @end table
  14927. Default is @code{hanning}.
  14928. @item overlap
  14929. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14930. which means optimal overlap for selected window function will be picked.
  14931. @item averaging
  14932. Set time averaging. Setting this to 0 will display current maximal peaks.
  14933. Default is @code{1}, which means time averaging is disabled.
  14934. @item colors
  14935. Specify list of colors separated by space or by '|' which will be used to
  14936. draw channel frequencies. Unrecognized or missing colors will be replaced
  14937. by white color.
  14938. @item cmode
  14939. Set channel display mode.
  14940. It accepts the following values:
  14941. @table @samp
  14942. @item combined
  14943. @item separate
  14944. @end table
  14945. Default is @code{combined}.
  14946. @item minamp
  14947. Set minimum amplitude used in @code{log} amplitude scaler.
  14948. @end table
  14949. @anchor{showspectrum}
  14950. @section showspectrum
  14951. Convert input audio to a video output, representing the audio frequency
  14952. spectrum.
  14953. The filter accepts the following options:
  14954. @table @option
  14955. @item size, s
  14956. Specify the video size for the output. For the syntax of this option, check the
  14957. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14958. Default value is @code{640x512}.
  14959. @item slide
  14960. Specify how the spectrum should slide along the window.
  14961. It accepts the following values:
  14962. @table @samp
  14963. @item replace
  14964. the samples start again on the left when they reach the right
  14965. @item scroll
  14966. the samples scroll from right to left
  14967. @item fullframe
  14968. frames are only produced when the samples reach the right
  14969. @item rscroll
  14970. the samples scroll from left to right
  14971. @end table
  14972. Default value is @code{replace}.
  14973. @item mode
  14974. Specify display mode.
  14975. It accepts the following values:
  14976. @table @samp
  14977. @item combined
  14978. all channels are displayed in the same row
  14979. @item separate
  14980. all channels are displayed in separate rows
  14981. @end table
  14982. Default value is @samp{combined}.
  14983. @item color
  14984. Specify display color mode.
  14985. It accepts the following values:
  14986. @table @samp
  14987. @item channel
  14988. each channel is displayed in a separate color
  14989. @item intensity
  14990. each channel is displayed using the same color scheme
  14991. @item rainbow
  14992. each channel is displayed using the rainbow color scheme
  14993. @item moreland
  14994. each channel is displayed using the moreland color scheme
  14995. @item nebulae
  14996. each channel is displayed using the nebulae color scheme
  14997. @item fire
  14998. each channel is displayed using the fire color scheme
  14999. @item fiery
  15000. each channel is displayed using the fiery color scheme
  15001. @item fruit
  15002. each channel is displayed using the fruit color scheme
  15003. @item cool
  15004. each channel is displayed using the cool color scheme
  15005. @end table
  15006. Default value is @samp{channel}.
  15007. @item scale
  15008. Specify scale used for calculating intensity color values.
  15009. It accepts the following values:
  15010. @table @samp
  15011. @item lin
  15012. linear
  15013. @item sqrt
  15014. square root, default
  15015. @item cbrt
  15016. cubic root
  15017. @item log
  15018. logarithmic
  15019. @item 4thrt
  15020. 4th root
  15021. @item 5thrt
  15022. 5th root
  15023. @end table
  15024. Default value is @samp{sqrt}.
  15025. @item saturation
  15026. Set saturation modifier for displayed colors. Negative values provide
  15027. alternative color scheme. @code{0} is no saturation at all.
  15028. Saturation must be in [-10.0, 10.0] range.
  15029. Default value is @code{1}.
  15030. @item win_func
  15031. Set window function.
  15032. It accepts the following values:
  15033. @table @samp
  15034. @item rect
  15035. @item bartlett
  15036. @item hann
  15037. @item hanning
  15038. @item hamming
  15039. @item blackman
  15040. @item welch
  15041. @item flattop
  15042. @item bharris
  15043. @item bnuttall
  15044. @item bhann
  15045. @item sine
  15046. @item nuttall
  15047. @item lanczos
  15048. @item gauss
  15049. @item tukey
  15050. @item dolph
  15051. @item cauchy
  15052. @item parzen
  15053. @item poisson
  15054. @end table
  15055. Default value is @code{hann}.
  15056. @item orientation
  15057. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15058. @code{horizontal}. Default is @code{vertical}.
  15059. @item overlap
  15060. Set ratio of overlap window. Default value is @code{0}.
  15061. When value is @code{1} overlap is set to recommended size for specific
  15062. window function currently used.
  15063. @item gain
  15064. Set scale gain for calculating intensity color values.
  15065. Default value is @code{1}.
  15066. @item data
  15067. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15068. @item rotation
  15069. Set color rotation, must be in [-1.0, 1.0] range.
  15070. Default value is @code{0}.
  15071. @end table
  15072. The usage is very similar to the showwaves filter; see the examples in that
  15073. section.
  15074. @subsection Examples
  15075. @itemize
  15076. @item
  15077. Large window with logarithmic color scaling:
  15078. @example
  15079. showspectrum=s=1280x480:scale=log
  15080. @end example
  15081. @item
  15082. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15083. @example
  15084. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15085. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15086. @end example
  15087. @end itemize
  15088. @section showspectrumpic
  15089. Convert input audio to a single video frame, representing the audio frequency
  15090. spectrum.
  15091. The filter accepts the following options:
  15092. @table @option
  15093. @item size, s
  15094. Specify the video size for the output. For the syntax of this option, check the
  15095. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15096. Default value is @code{4096x2048}.
  15097. @item mode
  15098. Specify display mode.
  15099. It accepts the following values:
  15100. @table @samp
  15101. @item combined
  15102. all channels are displayed in the same row
  15103. @item separate
  15104. all channels are displayed in separate rows
  15105. @end table
  15106. Default value is @samp{combined}.
  15107. @item color
  15108. Specify display color mode.
  15109. It accepts the following values:
  15110. @table @samp
  15111. @item channel
  15112. each channel is displayed in a separate color
  15113. @item intensity
  15114. each channel is displayed using the same color scheme
  15115. @item rainbow
  15116. each channel is displayed using the rainbow color scheme
  15117. @item moreland
  15118. each channel is displayed using the moreland color scheme
  15119. @item nebulae
  15120. each channel is displayed using the nebulae color scheme
  15121. @item fire
  15122. each channel is displayed using the fire color scheme
  15123. @item fiery
  15124. each channel is displayed using the fiery color scheme
  15125. @item fruit
  15126. each channel is displayed using the fruit color scheme
  15127. @item cool
  15128. each channel is displayed using the cool color scheme
  15129. @end table
  15130. Default value is @samp{intensity}.
  15131. @item scale
  15132. Specify scale used for calculating intensity color values.
  15133. It accepts the following values:
  15134. @table @samp
  15135. @item lin
  15136. linear
  15137. @item sqrt
  15138. square root, default
  15139. @item cbrt
  15140. cubic root
  15141. @item log
  15142. logarithmic
  15143. @item 4thrt
  15144. 4th root
  15145. @item 5thrt
  15146. 5th root
  15147. @end table
  15148. Default value is @samp{log}.
  15149. @item saturation
  15150. Set saturation modifier for displayed colors. Negative values provide
  15151. alternative color scheme. @code{0} is no saturation at all.
  15152. Saturation must be in [-10.0, 10.0] range.
  15153. Default value is @code{1}.
  15154. @item win_func
  15155. Set window function.
  15156. It accepts the following values:
  15157. @table @samp
  15158. @item rect
  15159. @item bartlett
  15160. @item hann
  15161. @item hanning
  15162. @item hamming
  15163. @item blackman
  15164. @item welch
  15165. @item flattop
  15166. @item bharris
  15167. @item bnuttall
  15168. @item bhann
  15169. @item sine
  15170. @item nuttall
  15171. @item lanczos
  15172. @item gauss
  15173. @item tukey
  15174. @item dolph
  15175. @item cauchy
  15176. @item parzen
  15177. @item poisson
  15178. @end table
  15179. Default value is @code{hann}.
  15180. @item orientation
  15181. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15182. @code{horizontal}. Default is @code{vertical}.
  15183. @item gain
  15184. Set scale gain for calculating intensity color values.
  15185. Default value is @code{1}.
  15186. @item legend
  15187. Draw time and frequency axes and legends. Default is enabled.
  15188. @item rotation
  15189. Set color rotation, must be in [-1.0, 1.0] range.
  15190. Default value is @code{0}.
  15191. @end table
  15192. @subsection Examples
  15193. @itemize
  15194. @item
  15195. Extract an audio spectrogram of a whole audio track
  15196. in a 1024x1024 picture using @command{ffmpeg}:
  15197. @example
  15198. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15199. @end example
  15200. @end itemize
  15201. @section showvolume
  15202. Convert input audio volume to a video output.
  15203. The filter accepts the following options:
  15204. @table @option
  15205. @item rate, r
  15206. Set video rate.
  15207. @item b
  15208. Set border width, allowed range is [0, 5]. Default is 1.
  15209. @item w
  15210. Set channel width, allowed range is [80, 8192]. Default is 400.
  15211. @item h
  15212. Set channel height, allowed range is [1, 900]. Default is 20.
  15213. @item f
  15214. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  15215. @item c
  15216. Set volume color expression.
  15217. The expression can use the following variables:
  15218. @table @option
  15219. @item VOLUME
  15220. Current max volume of channel in dB.
  15221. @item PEAK
  15222. Current peak.
  15223. @item CHANNEL
  15224. Current channel number, starting from 0.
  15225. @end table
  15226. @item t
  15227. If set, displays channel names. Default is enabled.
  15228. @item v
  15229. If set, displays volume values. Default is enabled.
  15230. @item o
  15231. Set orientation, can be @code{horizontal} or @code{vertical},
  15232. default is @code{horizontal}.
  15233. @item s
  15234. Set step size, allowed range s [0, 5]. Default is 0, which means
  15235. step is disabled.
  15236. @end table
  15237. @section showwaves
  15238. Convert input audio to a video output, representing the samples waves.
  15239. The filter accepts the following options:
  15240. @table @option
  15241. @item size, s
  15242. Specify the video size for the output. For the syntax of this option, check the
  15243. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15244. Default value is @code{600x240}.
  15245. @item mode
  15246. Set display mode.
  15247. Available values are:
  15248. @table @samp
  15249. @item point
  15250. Draw a point for each sample.
  15251. @item line
  15252. Draw a vertical line for each sample.
  15253. @item p2p
  15254. Draw a point for each sample and a line between them.
  15255. @item cline
  15256. Draw a centered vertical line for each sample.
  15257. @end table
  15258. Default value is @code{point}.
  15259. @item n
  15260. Set the number of samples which are printed on the same column. A
  15261. larger value will decrease the frame rate. Must be a positive
  15262. integer. This option can be set only if the value for @var{rate}
  15263. is not explicitly specified.
  15264. @item rate, r
  15265. Set the (approximate) output frame rate. This is done by setting the
  15266. option @var{n}. Default value is "25".
  15267. @item split_channels
  15268. Set if channels should be drawn separately or overlap. Default value is 0.
  15269. @item colors
  15270. Set colors separated by '|' which are going to be used for drawing of each channel.
  15271. @item scale
  15272. Set amplitude scale.
  15273. Available values are:
  15274. @table @samp
  15275. @item lin
  15276. Linear.
  15277. @item log
  15278. Logarithmic.
  15279. @item sqrt
  15280. Square root.
  15281. @item cbrt
  15282. Cubic root.
  15283. @end table
  15284. Default is linear.
  15285. @end table
  15286. @subsection Examples
  15287. @itemize
  15288. @item
  15289. Output the input file audio and the corresponding video representation
  15290. at the same time:
  15291. @example
  15292. amovie=a.mp3,asplit[out0],showwaves[out1]
  15293. @end example
  15294. @item
  15295. Create a synthetic signal and show it with showwaves, forcing a
  15296. frame rate of 30 frames per second:
  15297. @example
  15298. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15299. @end example
  15300. @end itemize
  15301. @section showwavespic
  15302. Convert input audio to a single video frame, representing the samples waves.
  15303. The filter accepts the following options:
  15304. @table @option
  15305. @item size, s
  15306. Specify the video size for the output. For the syntax of this option, check the
  15307. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15308. Default value is @code{600x240}.
  15309. @item split_channels
  15310. Set if channels should be drawn separately or overlap. Default value is 0.
  15311. @item colors
  15312. Set colors separated by '|' which are going to be used for drawing of each channel.
  15313. @item scale
  15314. Set amplitude scale.
  15315. Available values are:
  15316. @table @samp
  15317. @item lin
  15318. Linear.
  15319. @item log
  15320. Logarithmic.
  15321. @item sqrt
  15322. Square root.
  15323. @item cbrt
  15324. Cubic root.
  15325. @end table
  15326. Default is linear.
  15327. @end table
  15328. @subsection Examples
  15329. @itemize
  15330. @item
  15331. Extract a channel split representation of the wave form of a whole audio track
  15332. in a 1024x800 picture using @command{ffmpeg}:
  15333. @example
  15334. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15335. @end example
  15336. @end itemize
  15337. @section sidedata, asidedata
  15338. Delete frame side data, or select frames based on it.
  15339. This filter accepts the following options:
  15340. @table @option
  15341. @item mode
  15342. Set mode of operation of the filter.
  15343. Can be one of the following:
  15344. @table @samp
  15345. @item select
  15346. Select every frame with side data of @code{type}.
  15347. @item delete
  15348. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15349. data in the frame.
  15350. @end table
  15351. @item type
  15352. Set side data type used with all modes. Must be set for @code{select} mode. For
  15353. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15354. in @file{libavutil/frame.h}. For example, to choose
  15355. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15356. @end table
  15357. @section spectrumsynth
  15358. Sythesize audio from 2 input video spectrums, first input stream represents
  15359. magnitude across time and second represents phase across time.
  15360. The filter will transform from frequency domain as displayed in videos back
  15361. to time domain as presented in audio output.
  15362. This filter is primarily created for reversing processed @ref{showspectrum}
  15363. filter outputs, but can synthesize sound from other spectrograms too.
  15364. But in such case results are going to be poor if the phase data is not
  15365. available, because in such cases phase data need to be recreated, usually
  15366. its just recreated from random noise.
  15367. For best results use gray only output (@code{channel} color mode in
  15368. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15369. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15370. @code{data} option. Inputs videos should generally use @code{fullframe}
  15371. slide mode as that saves resources needed for decoding video.
  15372. The filter accepts the following options:
  15373. @table @option
  15374. @item sample_rate
  15375. Specify sample rate of output audio, the sample rate of audio from which
  15376. spectrum was generated may differ.
  15377. @item channels
  15378. Set number of channels represented in input video spectrums.
  15379. @item scale
  15380. Set scale which was used when generating magnitude input spectrum.
  15381. Can be @code{lin} or @code{log}. Default is @code{log}.
  15382. @item slide
  15383. Set slide which was used when generating inputs spectrums.
  15384. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15385. Default is @code{fullframe}.
  15386. @item win_func
  15387. Set window function used for resynthesis.
  15388. @item overlap
  15389. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15390. which means optimal overlap for selected window function will be picked.
  15391. @item orientation
  15392. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15393. Default is @code{vertical}.
  15394. @end table
  15395. @subsection Examples
  15396. @itemize
  15397. @item
  15398. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15399. then resynthesize videos back to audio with spectrumsynth:
  15400. @example
  15401. 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
  15402. 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
  15403. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15404. @end example
  15405. @end itemize
  15406. @section split, asplit
  15407. Split input into several identical outputs.
  15408. @code{asplit} works with audio input, @code{split} with video.
  15409. The filter accepts a single parameter which specifies the number of outputs. If
  15410. unspecified, it defaults to 2.
  15411. @subsection Examples
  15412. @itemize
  15413. @item
  15414. Create two separate outputs from the same input:
  15415. @example
  15416. [in] split [out0][out1]
  15417. @end example
  15418. @item
  15419. To create 3 or more outputs, you need to specify the number of
  15420. outputs, like in:
  15421. @example
  15422. [in] asplit=3 [out0][out1][out2]
  15423. @end example
  15424. @item
  15425. Create two separate outputs from the same input, one cropped and
  15426. one padded:
  15427. @example
  15428. [in] split [splitout1][splitout2];
  15429. [splitout1] crop=100:100:0:0 [cropout];
  15430. [splitout2] pad=200:200:100:100 [padout];
  15431. @end example
  15432. @item
  15433. Create 5 copies of the input audio with @command{ffmpeg}:
  15434. @example
  15435. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15436. @end example
  15437. @end itemize
  15438. @section zmq, azmq
  15439. Receive commands sent through a libzmq client, and forward them to
  15440. filters in the filtergraph.
  15441. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15442. must be inserted between two video filters, @code{azmq} between two
  15443. audio filters.
  15444. To enable these filters you need to install the libzmq library and
  15445. headers and configure FFmpeg with @code{--enable-libzmq}.
  15446. For more information about libzmq see:
  15447. @url{http://www.zeromq.org/}
  15448. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15449. receives messages sent through a network interface defined by the
  15450. @option{bind_address} option.
  15451. The received message must be in the form:
  15452. @example
  15453. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15454. @end example
  15455. @var{TARGET} specifies the target of the command, usually the name of
  15456. the filter class or a specific filter instance name.
  15457. @var{COMMAND} specifies the name of the command for the target filter.
  15458. @var{ARG} is optional and specifies the optional argument list for the
  15459. given @var{COMMAND}.
  15460. Upon reception, the message is processed and the corresponding command
  15461. is injected into the filtergraph. Depending on the result, the filter
  15462. will send a reply to the client, adopting the format:
  15463. @example
  15464. @var{ERROR_CODE} @var{ERROR_REASON}
  15465. @var{MESSAGE}
  15466. @end example
  15467. @var{MESSAGE} is optional.
  15468. @subsection Examples
  15469. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15470. be used to send commands processed by these filters.
  15471. Consider the following filtergraph generated by @command{ffplay}
  15472. @example
  15473. ffplay -dumpgraph 1 -f lavfi "
  15474. color=s=100x100:c=red [l];
  15475. color=s=100x100:c=blue [r];
  15476. nullsrc=s=200x100, zmq [bg];
  15477. [bg][l] overlay [bg+l];
  15478. [bg+l][r] overlay=x=100 "
  15479. @end example
  15480. To change the color of the left side of the video, the following
  15481. command can be used:
  15482. @example
  15483. echo Parsed_color_0 c yellow | tools/zmqsend
  15484. @end example
  15485. To change the right side:
  15486. @example
  15487. echo Parsed_color_1 c pink | tools/zmqsend
  15488. @end example
  15489. @c man end MULTIMEDIA FILTERS
  15490. @chapter Multimedia Sources
  15491. @c man begin MULTIMEDIA SOURCES
  15492. Below is a description of the currently available multimedia sources.
  15493. @section amovie
  15494. This is the same as @ref{movie} source, except it selects an audio
  15495. stream by default.
  15496. @anchor{movie}
  15497. @section movie
  15498. Read audio and/or video stream(s) from a movie container.
  15499. It accepts the following parameters:
  15500. @table @option
  15501. @item filename
  15502. The name of the resource to read (not necessarily a file; it can also be a
  15503. device or a stream accessed through some protocol).
  15504. @item format_name, f
  15505. Specifies the format assumed for the movie to read, and can be either
  15506. the name of a container or an input device. If not specified, the
  15507. format is guessed from @var{movie_name} or by probing.
  15508. @item seek_point, sp
  15509. Specifies the seek point in seconds. The frames will be output
  15510. starting from this seek point. The parameter is evaluated with
  15511. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15512. postfix. The default value is "0".
  15513. @item streams, s
  15514. Specifies the streams to read. Several streams can be specified,
  15515. separated by "+". The source will then have as many outputs, in the
  15516. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15517. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15518. respectively the default (best suited) video and audio stream. Default
  15519. is "dv", or "da" if the filter is called as "amovie".
  15520. @item stream_index, si
  15521. Specifies the index of the video stream to read. If the value is -1,
  15522. the most suitable video stream will be automatically selected. The default
  15523. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15524. audio instead of video.
  15525. @item loop
  15526. Specifies how many times to read the stream in sequence.
  15527. If the value is 0, the stream will be looped infinitely.
  15528. Default value is "1".
  15529. Note that when the movie is looped the source timestamps are not
  15530. changed, so it will generate non monotonically increasing timestamps.
  15531. @item discontinuity
  15532. Specifies the time difference between frames above which the point is
  15533. considered a timestamp discontinuity which is removed by adjusting the later
  15534. timestamps.
  15535. @end table
  15536. It allows overlaying a second video on top of the main input of
  15537. a filtergraph, as shown in this graph:
  15538. @example
  15539. input -----------> deltapts0 --> overlay --> output
  15540. ^
  15541. |
  15542. movie --> scale--> deltapts1 -------+
  15543. @end example
  15544. @subsection Examples
  15545. @itemize
  15546. @item
  15547. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15548. on top of the input labelled "in":
  15549. @example
  15550. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15551. [in] setpts=PTS-STARTPTS [main];
  15552. [main][over] overlay=16:16 [out]
  15553. @end example
  15554. @item
  15555. Read from a video4linux2 device, and overlay it on top of the input
  15556. labelled "in":
  15557. @example
  15558. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15559. [in] setpts=PTS-STARTPTS [main];
  15560. [main][over] overlay=16:16 [out]
  15561. @end example
  15562. @item
  15563. Read the first video stream and the audio stream with id 0x81 from
  15564. dvd.vob; the video is connected to the pad named "video" and the audio is
  15565. connected to the pad named "audio":
  15566. @example
  15567. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15568. @end example
  15569. @end itemize
  15570. @subsection Commands
  15571. Both movie and amovie support the following commands:
  15572. @table @option
  15573. @item seek
  15574. Perform seek using "av_seek_frame".
  15575. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15576. @itemize
  15577. @item
  15578. @var{stream_index}: If stream_index is -1, a default
  15579. stream is selected, and @var{timestamp} is automatically converted
  15580. from AV_TIME_BASE units to the stream specific time_base.
  15581. @item
  15582. @var{timestamp}: Timestamp in AVStream.time_base units
  15583. or, if no stream is specified, in AV_TIME_BASE units.
  15584. @item
  15585. @var{flags}: Flags which select direction and seeking mode.
  15586. @end itemize
  15587. @item get_duration
  15588. Get movie duration in AV_TIME_BASE units.
  15589. @end table
  15590. @c man end MULTIMEDIA SOURCES