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.

19523 lines
518KB

  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 acopy
  345. Copy the input audio source unchanged to the output. This is mainly useful for
  346. testing purposes.
  347. @section acrossfade
  348. Apply cross fade from one input audio stream to another input audio stream.
  349. The cross fade is applied for specified duration near the end of first stream.
  350. The filter accepts the following options:
  351. @table @option
  352. @item nb_samples, ns
  353. Specify the number of samples for which the cross fade effect has to last.
  354. At the end of the cross fade effect the first input audio will be completely
  355. silent. Default is 44100.
  356. @item duration, d
  357. Specify the duration of the cross fade effect. See
  358. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  359. for the accepted syntax.
  360. By default the duration is determined by @var{nb_samples}.
  361. If set this option is used instead of @var{nb_samples}.
  362. @item overlap, o
  363. Should first stream end overlap with second stream start. Default is enabled.
  364. @item curve1
  365. Set curve for cross fade transition for first stream.
  366. @item curve2
  367. Set curve for cross fade transition for second stream.
  368. For description of available curve types see @ref{afade} filter description.
  369. @end table
  370. @subsection Examples
  371. @itemize
  372. @item
  373. Cross fade from one input to another:
  374. @example
  375. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  376. @end example
  377. @item
  378. Cross fade from one input to another but without overlapping:
  379. @example
  380. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  381. @end example
  382. @end itemize
  383. @section acrusher
  384. Reduce audio bit resolution.
  385. This filter is bit crusher with enhanced functionality. A bit crusher
  386. is used to audibly reduce number of bits an audio signal is sampled
  387. with. This doesn't change the bit depth at all, it just produces the
  388. effect. Material reduced in bit depth sounds more harsh and "digital".
  389. This filter is able to even round to continuous values instead of discrete
  390. bit depths.
  391. Additionally it has a D/C offset which results in different crushing of
  392. the lower and the upper half of the signal.
  393. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  394. Another feature of this filter is the logarithmic mode.
  395. This setting switches from linear distances between bits to logarithmic ones.
  396. The result is a much more "natural" sounding crusher which doesn't gate low
  397. signals for example. The human ear has a logarithmic perception, too
  398. so this kind of crushing is much more pleasant.
  399. Logarithmic crushing is also able to get anti-aliased.
  400. The filter accepts the following options:
  401. @table @option
  402. @item level_in
  403. Set level in.
  404. @item level_out
  405. Set level out.
  406. @item bits
  407. Set bit reduction.
  408. @item mix
  409. Set mixing amount.
  410. @item mode
  411. Can be linear: @code{lin} or logarithmic: @code{log}.
  412. @item dc
  413. Set DC.
  414. @item aa
  415. Set anti-aliasing.
  416. @item samples
  417. Set sample reduction.
  418. @item lfo
  419. Enable LFO. By default disabled.
  420. @item lforange
  421. Set LFO range.
  422. @item lforate
  423. Set LFO rate.
  424. @end table
  425. @section adelay
  426. Delay one or more audio channels.
  427. Samples in delayed channel are filled with silence.
  428. The filter accepts the following option:
  429. @table @option
  430. @item delays
  431. Set list of delays in milliseconds for each channel separated by '|'.
  432. Unused delays will be silently ignored. If number of given delays is
  433. smaller than number of channels all remaining channels will not be delayed.
  434. If you want to delay exact number of samples, append 'S' to number.
  435. @end table
  436. @subsection Examples
  437. @itemize
  438. @item
  439. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  440. the second channel (and any other channels that may be present) unchanged.
  441. @example
  442. adelay=1500|0|500
  443. @end example
  444. @item
  445. Delay second channel by 500 samples, the third channel by 700 samples and leave
  446. the first channel (and any other channels that may be present) unchanged.
  447. @example
  448. adelay=0|500S|700S
  449. @end example
  450. @end itemize
  451. @section aecho
  452. Apply echoing to the input audio.
  453. Echoes are reflected sound and can occur naturally amongst mountains
  454. (and sometimes large buildings) when talking or shouting; digital echo
  455. effects emulate this behaviour and are often used to help fill out the
  456. sound of a single instrument or vocal. The time difference between the
  457. original signal and the reflection is the @code{delay}, and the
  458. loudness of the reflected signal is the @code{decay}.
  459. Multiple echoes can have different delays and decays.
  460. A description of the accepted parameters follows.
  461. @table @option
  462. @item in_gain
  463. Set input gain of reflected signal. Default is @code{0.6}.
  464. @item out_gain
  465. Set output gain of reflected signal. Default is @code{0.3}.
  466. @item delays
  467. Set list of time intervals in milliseconds between original signal and reflections
  468. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  469. Default is @code{1000}.
  470. @item decays
  471. Set list of loudness of reflected signals separated by '|'.
  472. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  473. Default is @code{0.5}.
  474. @end table
  475. @subsection Examples
  476. @itemize
  477. @item
  478. Make it sound as if there are twice as many instruments as are actually playing:
  479. @example
  480. aecho=0.8:0.88:60:0.4
  481. @end example
  482. @item
  483. If delay is very short, then it sound like a (metallic) robot playing music:
  484. @example
  485. aecho=0.8:0.88:6:0.4
  486. @end example
  487. @item
  488. A longer delay will sound like an open air concert in the mountains:
  489. @example
  490. aecho=0.8:0.9:1000:0.3
  491. @end example
  492. @item
  493. Same as above but with one more mountain:
  494. @example
  495. aecho=0.8:0.9:1000|1800:0.3|0.25
  496. @end example
  497. @end itemize
  498. @section aemphasis
  499. Audio emphasis filter creates or restores material directly taken from LPs or
  500. emphased CDs with different filter curves. E.g. to store music on vinyl the
  501. signal has to be altered by a filter first to even out the disadvantages of
  502. this recording medium.
  503. Once the material is played back the inverse filter has to be applied to
  504. restore the distortion of the frequency response.
  505. The filter accepts the following options:
  506. @table @option
  507. @item level_in
  508. Set input gain.
  509. @item level_out
  510. Set output gain.
  511. @item mode
  512. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  513. use @code{production} mode. Default is @code{reproduction} mode.
  514. @item type
  515. Set filter type. Selects medium. Can be one of the following:
  516. @table @option
  517. @item col
  518. select Columbia.
  519. @item emi
  520. select EMI.
  521. @item bsi
  522. select BSI (78RPM).
  523. @item riaa
  524. select RIAA.
  525. @item cd
  526. select Compact Disc (CD).
  527. @item 50fm
  528. select 50µs (FM).
  529. @item 75fm
  530. select 75µs (FM).
  531. @item 50kf
  532. select 50µs (FM-KF).
  533. @item 75kf
  534. select 75µs (FM-KF).
  535. @end table
  536. @end table
  537. @section aeval
  538. Modify an audio signal according to the specified expressions.
  539. This filter accepts one or more expressions (one for each channel),
  540. which are evaluated and used to modify a corresponding audio signal.
  541. It accepts the following parameters:
  542. @table @option
  543. @item exprs
  544. Set the '|'-separated expressions list for each separate channel. If
  545. the number of input channels is greater than the number of
  546. expressions, the last specified expression is used for the remaining
  547. output channels.
  548. @item channel_layout, c
  549. Set output channel layout. If not specified, the channel layout is
  550. specified by the number of expressions. If set to @samp{same}, it will
  551. use by default the same input channel layout.
  552. @end table
  553. Each expression in @var{exprs} can contain the following constants and functions:
  554. @table @option
  555. @item ch
  556. channel number of the current expression
  557. @item n
  558. number of the evaluated sample, starting from 0
  559. @item s
  560. sample rate
  561. @item t
  562. time of the evaluated sample expressed in seconds
  563. @item nb_in_channels
  564. @item nb_out_channels
  565. input and output number of channels
  566. @item val(CH)
  567. the value of input channel with number @var{CH}
  568. @end table
  569. Note: this filter is slow. For faster processing you should use a
  570. dedicated filter.
  571. @subsection Examples
  572. @itemize
  573. @item
  574. Half volume:
  575. @example
  576. aeval=val(ch)/2:c=same
  577. @end example
  578. @item
  579. Invert phase of the second channel:
  580. @example
  581. aeval=val(0)|-val(1)
  582. @end example
  583. @end itemize
  584. @anchor{afade}
  585. @section afade
  586. Apply fade-in/out effect to input audio.
  587. A description of the accepted parameters follows.
  588. @table @option
  589. @item type, t
  590. Specify the effect type, can be either @code{in} for fade-in, or
  591. @code{out} for a fade-out effect. Default is @code{in}.
  592. @item start_sample, ss
  593. Specify the number of the start sample for starting to apply the fade
  594. effect. Default is 0.
  595. @item nb_samples, ns
  596. Specify the number of samples for which the fade effect has to last. At
  597. the end of the fade-in effect the output audio will have the same
  598. volume as the input audio, at the end of the fade-out transition
  599. the output audio will be silence. Default is 44100.
  600. @item start_time, st
  601. Specify the start time of the fade effect. Default is 0.
  602. The value must be specified as a time duration; see
  603. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  604. for the accepted syntax.
  605. If set this option is used instead of @var{start_sample}.
  606. @item duration, d
  607. Specify the duration of the fade effect. See
  608. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  609. for the accepted syntax.
  610. At the end of the fade-in effect the output audio will have the same
  611. volume as the input audio, at the end of the fade-out transition
  612. the output audio will be silence.
  613. By default the duration is determined by @var{nb_samples}.
  614. If set this option is used instead of @var{nb_samples}.
  615. @item curve
  616. Set curve for fade transition.
  617. It accepts the following values:
  618. @table @option
  619. @item tri
  620. select triangular, linear slope (default)
  621. @item qsin
  622. select quarter of sine wave
  623. @item hsin
  624. select half of sine wave
  625. @item esin
  626. select exponential sine wave
  627. @item log
  628. select logarithmic
  629. @item ipar
  630. select inverted parabola
  631. @item qua
  632. select quadratic
  633. @item cub
  634. select cubic
  635. @item squ
  636. select square root
  637. @item cbr
  638. select cubic root
  639. @item par
  640. select parabola
  641. @item exp
  642. select exponential
  643. @item iqsin
  644. select inverted quarter of sine wave
  645. @item ihsin
  646. select inverted half of sine wave
  647. @item dese
  648. select double-exponential seat
  649. @item desi
  650. select double-exponential sigmoid
  651. @end table
  652. @end table
  653. @subsection Examples
  654. @itemize
  655. @item
  656. Fade in first 15 seconds of audio:
  657. @example
  658. afade=t=in:ss=0:d=15
  659. @end example
  660. @item
  661. Fade out last 25 seconds of a 900 seconds audio:
  662. @example
  663. afade=t=out:st=875:d=25
  664. @end example
  665. @end itemize
  666. @section afftfilt
  667. Apply arbitrary expressions to samples in frequency domain.
  668. @table @option
  669. @item real
  670. Set frequency domain real expression for each separate channel separated
  671. by '|'. Default is "1".
  672. If the number of input channels is greater than the number of
  673. expressions, the last specified expression is used for the remaining
  674. output channels.
  675. @item imag
  676. Set frequency domain imaginary expression for each separate channel
  677. separated by '|'. If not set, @var{real} option is used.
  678. Each expression in @var{real} and @var{imag} can contain the following
  679. constants:
  680. @table @option
  681. @item sr
  682. sample rate
  683. @item b
  684. current frequency bin number
  685. @item nb
  686. number of available bins
  687. @item ch
  688. channel number of the current expression
  689. @item chs
  690. number of channels
  691. @item pts
  692. current frame pts
  693. @end table
  694. @item win_size
  695. Set window size.
  696. It accepts the following values:
  697. @table @samp
  698. @item w16
  699. @item w32
  700. @item w64
  701. @item w128
  702. @item w256
  703. @item w512
  704. @item w1024
  705. @item w2048
  706. @item w4096
  707. @item w8192
  708. @item w16384
  709. @item w32768
  710. @item w65536
  711. @end table
  712. Default is @code{w4096}
  713. @item win_func
  714. Set window function. Default is @code{hann}.
  715. @item overlap
  716. Set window overlap. If set to 1, the recommended overlap for selected
  717. window function will be picked. Default is @code{0.75}.
  718. @end table
  719. @subsection Examples
  720. @itemize
  721. @item
  722. Leave almost only low frequencies in audio:
  723. @example
  724. afftfilt="1-clip((b/nb)*b,0,1)"
  725. @end example
  726. @end itemize
  727. @section afir
  728. Apply an arbitrary Frequency Impulse Response filter.
  729. This filter is designed for applying long FIR filters,
  730. up to 30 seconds long.
  731. It can be used as component for digital crossover filters,
  732. room equalization, cross talk cancellation, wavefield synthesis,
  733. auralization, ambiophonics and ambisonics.
  734. This filter uses second stream as FIR coefficients.
  735. If second stream holds single channel, it will be used
  736. for all input channels in first stream, otherwise
  737. number of channels in second stream must be same as
  738. number of channels in first stream.
  739. It accepts the following parameters:
  740. @table @option
  741. @item dry
  742. Set dry gain. This sets input gain.
  743. @item wet
  744. Set wet gain. This sets final output gain.
  745. @item length
  746. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  747. @item again
  748. Enable applying gain measured from power of IR.
  749. @end table
  750. @subsection Examples
  751. @itemize
  752. @item
  753. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  754. @example
  755. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  756. @end example
  757. @end itemize
  758. @anchor{aformat}
  759. @section aformat
  760. Set output format constraints for the input audio. The framework will
  761. negotiate the most appropriate format to minimize conversions.
  762. It accepts the following parameters:
  763. @table @option
  764. @item sample_fmts
  765. A '|'-separated list of requested sample formats.
  766. @item sample_rates
  767. A '|'-separated list of requested sample rates.
  768. @item channel_layouts
  769. A '|'-separated list of requested channel layouts.
  770. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  771. for the required syntax.
  772. @end table
  773. If a parameter is omitted, all values are allowed.
  774. Force the output to either unsigned 8-bit or signed 16-bit stereo
  775. @example
  776. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  777. @end example
  778. @section agate
  779. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  780. processing reduces disturbing noise between useful signals.
  781. Gating is done by detecting the volume below a chosen level @var{threshold}
  782. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  783. floor is set via @var{range}. Because an exact manipulation of the signal
  784. would cause distortion of the waveform the reduction can be levelled over
  785. time. This is done by setting @var{attack} and @var{release}.
  786. @var{attack} determines how long the signal has to fall below the threshold
  787. before any reduction will occur and @var{release} sets the time the signal
  788. has to rise above the threshold to reduce the reduction again.
  789. Shorter signals than the chosen attack time will be left untouched.
  790. @table @option
  791. @item level_in
  792. Set input level before filtering.
  793. Default is 1. Allowed range is from 0.015625 to 64.
  794. @item range
  795. Set the level of gain reduction when the signal is below the threshold.
  796. Default is 0.06125. Allowed range is from 0 to 1.
  797. @item threshold
  798. If a signal rises above this level the gain reduction is released.
  799. Default is 0.125. Allowed range is from 0 to 1.
  800. @item ratio
  801. Set a ratio by which the signal is reduced.
  802. Default is 2. Allowed range is from 1 to 9000.
  803. @item attack
  804. Amount of milliseconds the signal has to rise above the threshold before gain
  805. reduction stops.
  806. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  807. @item release
  808. Amount of milliseconds the signal has to fall below the threshold before the
  809. reduction is increased again. Default is 250 milliseconds.
  810. Allowed range is from 0.01 to 9000.
  811. @item makeup
  812. Set amount of amplification of signal after processing.
  813. Default is 1. Allowed range is from 1 to 64.
  814. @item knee
  815. Curve the sharp knee around the threshold to enter gain reduction more softly.
  816. Default is 2.828427125. Allowed range is from 1 to 8.
  817. @item detection
  818. Choose if exact signal should be taken for detection or an RMS like one.
  819. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  820. @item link
  821. Choose if the average level between all channels or the louder channel affects
  822. the reduction.
  823. Default is @code{average}. Can be @code{average} or @code{maximum}.
  824. @end table
  825. @section alimiter
  826. The limiter prevents an input signal from rising over a desired threshold.
  827. This limiter uses lookahead technology to prevent your signal from distorting.
  828. It means that there is a small delay after the signal is processed. Keep in mind
  829. that the delay it produces is the attack time you set.
  830. The filter accepts the following options:
  831. @table @option
  832. @item level_in
  833. Set input gain. Default is 1.
  834. @item level_out
  835. Set output gain. Default is 1.
  836. @item limit
  837. Don't let signals above this level pass the limiter. Default is 1.
  838. @item attack
  839. The limiter will reach its attenuation level in this amount of time in
  840. milliseconds. Default is 5 milliseconds.
  841. @item release
  842. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  843. Default is 50 milliseconds.
  844. @item asc
  845. When gain reduction is always needed ASC takes care of releasing to an
  846. average reduction level rather than reaching a reduction of 0 in the release
  847. time.
  848. @item asc_level
  849. Select how much the release time is affected by ASC, 0 means nearly no changes
  850. in release time while 1 produces higher release times.
  851. @item level
  852. Auto level output signal. Default is enabled.
  853. This normalizes audio back to 0dB if enabled.
  854. @end table
  855. Depending on picked setting it is recommended to upsample input 2x or 4x times
  856. with @ref{aresample} before applying this filter.
  857. @section allpass
  858. Apply a two-pole all-pass filter with central frequency (in Hz)
  859. @var{frequency}, and filter-width @var{width}.
  860. An all-pass filter changes the audio's frequency to phase relationship
  861. without changing its frequency to amplitude relationship.
  862. The filter accepts the following options:
  863. @table @option
  864. @item frequency, f
  865. Set frequency in Hz.
  866. @item width_type, t
  867. Set method to specify band-width of filter.
  868. @table @option
  869. @item h
  870. Hz
  871. @item q
  872. Q-Factor
  873. @item o
  874. octave
  875. @item s
  876. slope
  877. @end table
  878. @item width, w
  879. Specify the band-width of a filter in width_type units.
  880. @item channels, c
  881. Specify which channels to filter, by default all available are filtered.
  882. @end table
  883. @section aloop
  884. Loop audio samples.
  885. The filter accepts the following options:
  886. @table @option
  887. @item loop
  888. Set the number of loops.
  889. @item size
  890. Set maximal number of samples.
  891. @item start
  892. Set first sample of loop.
  893. @end table
  894. @anchor{amerge}
  895. @section amerge
  896. Merge two or more audio streams into a single multi-channel stream.
  897. The filter accepts the following options:
  898. @table @option
  899. @item inputs
  900. Set the number of inputs. Default is 2.
  901. @end table
  902. If the channel layouts of the inputs are disjoint, and therefore compatible,
  903. the channel layout of the output will be set accordingly and the channels
  904. will be reordered as necessary. If the channel layouts of the inputs are not
  905. disjoint, the output will have all the channels of the first input then all
  906. the channels of the second input, in that order, and the channel layout of
  907. the output will be the default value corresponding to the total number of
  908. channels.
  909. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  910. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  911. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  912. first input, b1 is the first channel of the second input).
  913. On the other hand, if both input are in stereo, the output channels will be
  914. in the default order: a1, a2, b1, b2, and the channel layout will be
  915. arbitrarily set to 4.0, which may or may not be the expected value.
  916. All inputs must have the same sample rate, and format.
  917. If inputs do not have the same duration, the output will stop with the
  918. shortest.
  919. @subsection Examples
  920. @itemize
  921. @item
  922. Merge two mono files into a stereo stream:
  923. @example
  924. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  925. @end example
  926. @item
  927. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  928. @example
  929. 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
  930. @end example
  931. @end itemize
  932. @section amix
  933. Mixes multiple audio inputs into a single output.
  934. Note that this filter only supports float samples (the @var{amerge}
  935. and @var{pan} audio filters support many formats). If the @var{amix}
  936. input has integer samples then @ref{aresample} will be automatically
  937. inserted to perform the conversion to float samples.
  938. For example
  939. @example
  940. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  941. @end example
  942. will mix 3 input audio streams to a single output with the same duration as the
  943. first input and a dropout transition time of 3 seconds.
  944. It accepts the following parameters:
  945. @table @option
  946. @item inputs
  947. The number of inputs. If unspecified, it defaults to 2.
  948. @item duration
  949. How to determine the end-of-stream.
  950. @table @option
  951. @item longest
  952. The duration of the longest input. (default)
  953. @item shortest
  954. The duration of the shortest input.
  955. @item first
  956. The duration of the first input.
  957. @end table
  958. @item dropout_transition
  959. The transition time, in seconds, for volume renormalization when an input
  960. stream ends. The default value is 2 seconds.
  961. @end table
  962. @section anequalizer
  963. High-order parametric multiband equalizer for each channel.
  964. It accepts the following parameters:
  965. @table @option
  966. @item params
  967. This option string is in format:
  968. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  969. Each equalizer band is separated by '|'.
  970. @table @option
  971. @item chn
  972. Set channel number to which equalization will be applied.
  973. If input doesn't have that channel the entry is ignored.
  974. @item f
  975. Set central frequency for band.
  976. If input doesn't have that frequency the entry is ignored.
  977. @item w
  978. Set band width in hertz.
  979. @item g
  980. Set band gain in dB.
  981. @item t
  982. Set filter type for band, optional, can be:
  983. @table @samp
  984. @item 0
  985. Butterworth, this is default.
  986. @item 1
  987. Chebyshev type 1.
  988. @item 2
  989. Chebyshev type 2.
  990. @end table
  991. @end table
  992. @item curves
  993. With this option activated frequency response of anequalizer is displayed
  994. in video stream.
  995. @item size
  996. Set video stream size. Only useful if curves option is activated.
  997. @item mgain
  998. Set max gain that will be displayed. Only useful if curves option is activated.
  999. Setting this to a reasonable value makes it possible to display gain which is derived from
  1000. neighbour bands which are too close to each other and thus produce higher gain
  1001. when both are activated.
  1002. @item fscale
  1003. Set frequency scale used to draw frequency response in video output.
  1004. Can be linear or logarithmic. Default is logarithmic.
  1005. @item colors
  1006. Set color for each channel curve which is going to be displayed in video stream.
  1007. This is list of color names separated by space or by '|'.
  1008. Unrecognised or missing colors will be replaced by white color.
  1009. @end table
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1014. for first 2 channels using Chebyshev type 1 filter:
  1015. @example
  1016. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1017. @end example
  1018. @end itemize
  1019. @subsection Commands
  1020. This filter supports the following commands:
  1021. @table @option
  1022. @item change
  1023. Alter existing filter parameters.
  1024. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1025. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1026. error is returned.
  1027. @var{freq} set new frequency parameter.
  1028. @var{width} set new width parameter in herz.
  1029. @var{gain} set new gain parameter in dB.
  1030. Full filter invocation with asendcmd may look like this:
  1031. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1032. @end table
  1033. @section anull
  1034. Pass the audio source unchanged to the output.
  1035. @section apad
  1036. Pad the end of an audio stream with silence.
  1037. This can be used together with @command{ffmpeg} @option{-shortest} to
  1038. extend audio streams to the same length as the video stream.
  1039. A description of the accepted options follows.
  1040. @table @option
  1041. @item packet_size
  1042. Set silence packet size. Default value is 4096.
  1043. @item pad_len
  1044. Set the number of samples of silence to add to the end. After the
  1045. value is reached, the stream is terminated. This option is mutually
  1046. exclusive with @option{whole_len}.
  1047. @item whole_len
  1048. Set the minimum total number of samples in the output audio stream. If
  1049. the value is longer than the input audio length, silence is added to
  1050. the end, until the value is reached. This option is mutually exclusive
  1051. with @option{pad_len}.
  1052. @end table
  1053. If neither the @option{pad_len} nor the @option{whole_len} option is
  1054. set, the filter will add silence to the end of the input stream
  1055. indefinitely.
  1056. @subsection Examples
  1057. @itemize
  1058. @item
  1059. Add 1024 samples of silence to the end of the input:
  1060. @example
  1061. apad=pad_len=1024
  1062. @end example
  1063. @item
  1064. Make sure the audio output will contain at least 10000 samples, pad
  1065. the input with silence if required:
  1066. @example
  1067. apad=whole_len=10000
  1068. @end example
  1069. @item
  1070. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1071. video stream will always result the shortest and will be converted
  1072. until the end in the output file when using the @option{shortest}
  1073. option:
  1074. @example
  1075. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1076. @end example
  1077. @end itemize
  1078. @section aphaser
  1079. Add a phasing effect to the input audio.
  1080. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1081. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1082. A description of the accepted parameters follows.
  1083. @table @option
  1084. @item in_gain
  1085. Set input gain. Default is 0.4.
  1086. @item out_gain
  1087. Set output gain. Default is 0.74
  1088. @item delay
  1089. Set delay in milliseconds. Default is 3.0.
  1090. @item decay
  1091. Set decay. Default is 0.4.
  1092. @item speed
  1093. Set modulation speed in Hz. Default is 0.5.
  1094. @item type
  1095. Set modulation type. Default is triangular.
  1096. It accepts the following values:
  1097. @table @samp
  1098. @item triangular, t
  1099. @item sinusoidal, s
  1100. @end table
  1101. @end table
  1102. @section apulsator
  1103. Audio pulsator is something between an autopanner and a tremolo.
  1104. But it can produce funny stereo effects as well. Pulsator changes the volume
  1105. of the left and right channel based on a LFO (low frequency oscillator) with
  1106. different waveforms and shifted phases.
  1107. This filter have the ability to define an offset between left and right
  1108. channel. An offset of 0 means that both LFO shapes match each other.
  1109. The left and right channel are altered equally - a conventional tremolo.
  1110. An offset of 50% means that the shape of the right channel is exactly shifted
  1111. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1112. an autopanner. At 1 both curves match again. Every setting in between moves the
  1113. phase shift gapless between all stages and produces some "bypassing" sounds with
  1114. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1115. the 0.5) the faster the signal passes from the left to the right speaker.
  1116. The filter accepts the following options:
  1117. @table @option
  1118. @item level_in
  1119. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1120. @item level_out
  1121. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1122. @item mode
  1123. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1124. sawup or sawdown. Default is sine.
  1125. @item amount
  1126. Set modulation. Define how much of original signal is affected by the LFO.
  1127. @item offset_l
  1128. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1129. @item offset_r
  1130. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1131. @item width
  1132. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1133. @item timing
  1134. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1135. @item bpm
  1136. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1137. is set to bpm.
  1138. @item ms
  1139. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1140. is set to ms.
  1141. @item hz
  1142. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1143. if timing is set to hz.
  1144. @end table
  1145. @anchor{aresample}
  1146. @section aresample
  1147. Resample the input audio to the specified parameters, using the
  1148. libswresample library. If none are specified then the filter will
  1149. automatically convert between its input and output.
  1150. This filter is also able to stretch/squeeze the audio data to make it match
  1151. the timestamps or to inject silence / cut out audio to make it match the
  1152. timestamps, do a combination of both or do neither.
  1153. The filter accepts the syntax
  1154. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1155. expresses a sample rate and @var{resampler_options} is a list of
  1156. @var{key}=@var{value} pairs, separated by ":". See the
  1157. @ref{Resampler Options,,the "Resampler Options" section in the
  1158. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1159. for the complete list of supported options.
  1160. @subsection Examples
  1161. @itemize
  1162. @item
  1163. Resample the input audio to 44100Hz:
  1164. @example
  1165. aresample=44100
  1166. @end example
  1167. @item
  1168. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1169. samples per second compensation:
  1170. @example
  1171. aresample=async=1000
  1172. @end example
  1173. @end itemize
  1174. @section areverse
  1175. Reverse an audio clip.
  1176. Warning: This filter requires memory to buffer the entire clip, so trimming
  1177. is suggested.
  1178. @subsection Examples
  1179. @itemize
  1180. @item
  1181. Take the first 5 seconds of a clip, and reverse it.
  1182. @example
  1183. atrim=end=5,areverse
  1184. @end example
  1185. @end itemize
  1186. @section asetnsamples
  1187. Set the number of samples per each output audio frame.
  1188. The last output packet may contain a different number of samples, as
  1189. the filter will flush all the remaining samples when the input audio
  1190. signals its end.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item nb_out_samples, n
  1194. Set the number of frames per each output audio frame. The number is
  1195. intended as the number of samples @emph{per each channel}.
  1196. Default value is 1024.
  1197. @item pad, p
  1198. If set to 1, the filter will pad the last audio frame with zeroes, so
  1199. that the last frame will contain the same number of samples as the
  1200. previous ones. Default value is 1.
  1201. @end table
  1202. For example, to set the number of per-frame samples to 1234 and
  1203. disable padding for the last frame, use:
  1204. @example
  1205. asetnsamples=n=1234:p=0
  1206. @end example
  1207. @section asetrate
  1208. Set the sample rate without altering the PCM data.
  1209. This will result in a change of speed and pitch.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item sample_rate, r
  1213. Set the output sample rate. Default is 44100 Hz.
  1214. @end table
  1215. @section ashowinfo
  1216. Show a line containing various information for each input audio frame.
  1217. The input audio is not modified.
  1218. The shown line contains a sequence of key/value pairs of the form
  1219. @var{key}:@var{value}.
  1220. The following values are shown in the output:
  1221. @table @option
  1222. @item n
  1223. The (sequential) number of the input frame, starting from 0.
  1224. @item pts
  1225. The presentation timestamp of the input frame, in time base units; the time base
  1226. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1227. @item pts_time
  1228. The presentation timestamp of the input frame in seconds.
  1229. @item pos
  1230. position of the frame in the input stream, -1 if this information in
  1231. unavailable and/or meaningless (for example in case of synthetic audio)
  1232. @item fmt
  1233. The sample format.
  1234. @item chlayout
  1235. The channel layout.
  1236. @item rate
  1237. The sample rate for the audio frame.
  1238. @item nb_samples
  1239. The number of samples (per channel) in the frame.
  1240. @item checksum
  1241. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1242. audio, the data is treated as if all the planes were concatenated.
  1243. @item plane_checksums
  1244. A list of Adler-32 checksums for each data plane.
  1245. @end table
  1246. @anchor{astats}
  1247. @section astats
  1248. Display time domain statistical information about the audio channels.
  1249. Statistics are calculated and displayed for each audio channel and,
  1250. where applicable, an overall figure is also given.
  1251. It accepts the following option:
  1252. @table @option
  1253. @item length
  1254. Short window length in seconds, used for peak and trough RMS measurement.
  1255. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1256. @item metadata
  1257. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1258. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1259. disabled.
  1260. Available keys for each channel are:
  1261. DC_offset
  1262. Min_level
  1263. Max_level
  1264. Min_difference
  1265. Max_difference
  1266. Mean_difference
  1267. RMS_difference
  1268. Peak_level
  1269. RMS_peak
  1270. RMS_trough
  1271. Crest_factor
  1272. Flat_factor
  1273. Peak_count
  1274. Bit_depth
  1275. Dynamic_range
  1276. and for Overall:
  1277. DC_offset
  1278. Min_level
  1279. Max_level
  1280. Min_difference
  1281. Max_difference
  1282. Mean_difference
  1283. RMS_difference
  1284. Peak_level
  1285. RMS_level
  1286. RMS_peak
  1287. RMS_trough
  1288. Flat_factor
  1289. Peak_count
  1290. Bit_depth
  1291. Number_of_samples
  1292. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1293. this @code{lavfi.astats.Overall.Peak_count}.
  1294. For description what each key means read below.
  1295. @item reset
  1296. Set number of frame after which stats are going to be recalculated.
  1297. Default is disabled.
  1298. @end table
  1299. A description of each shown parameter follows:
  1300. @table @option
  1301. @item DC offset
  1302. Mean amplitude displacement from zero.
  1303. @item Min level
  1304. Minimal sample level.
  1305. @item Max level
  1306. Maximal sample level.
  1307. @item Min difference
  1308. Minimal difference between two consecutive samples.
  1309. @item Max difference
  1310. Maximal difference between two consecutive samples.
  1311. @item Mean difference
  1312. Mean difference between two consecutive samples.
  1313. The average of each difference between two consecutive samples.
  1314. @item RMS difference
  1315. Root Mean Square difference between two consecutive samples.
  1316. @item Peak level dB
  1317. @item RMS level dB
  1318. Standard peak and RMS level measured in dBFS.
  1319. @item RMS peak dB
  1320. @item RMS trough dB
  1321. Peak and trough values for RMS level measured over a short window.
  1322. @item Crest factor
  1323. Standard ratio of peak to RMS level (note: not in dB).
  1324. @item Flat factor
  1325. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1326. (i.e. either @var{Min level} or @var{Max level}).
  1327. @item Peak count
  1328. Number of occasions (not the number of samples) that the signal attained either
  1329. @var{Min level} or @var{Max level}.
  1330. @item Bit depth
  1331. Overall bit depth of audio. Number of bits used for each sample.
  1332. @item Dynamic range
  1333. Measured dynamic range of audio in dB.
  1334. @end table
  1335. @section atempo
  1336. Adjust audio tempo.
  1337. The filter accepts exactly one parameter, the audio tempo. If not
  1338. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1339. be in the [0.5, 2.0] range.
  1340. @subsection Examples
  1341. @itemize
  1342. @item
  1343. Slow down audio to 80% tempo:
  1344. @example
  1345. atempo=0.8
  1346. @end example
  1347. @item
  1348. To speed up audio to 125% tempo:
  1349. @example
  1350. atempo=1.25
  1351. @end example
  1352. @end itemize
  1353. @section atrim
  1354. Trim the input so that the output contains one continuous subpart of the input.
  1355. It accepts the following parameters:
  1356. @table @option
  1357. @item start
  1358. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1359. sample with the timestamp @var{start} will be the first sample in the output.
  1360. @item end
  1361. Specify time of the first audio sample that will be dropped, i.e. the
  1362. audio sample immediately preceding the one with the timestamp @var{end} will be
  1363. the last sample in the output.
  1364. @item start_pts
  1365. Same as @var{start}, except this option sets the start timestamp in samples
  1366. instead of seconds.
  1367. @item end_pts
  1368. Same as @var{end}, except this option sets the end timestamp in samples instead
  1369. of seconds.
  1370. @item duration
  1371. The maximum duration of the output in seconds.
  1372. @item start_sample
  1373. The number of the first sample that should be output.
  1374. @item end_sample
  1375. The number of the first sample that should be dropped.
  1376. @end table
  1377. @option{start}, @option{end}, and @option{duration} are expressed as time
  1378. duration specifications; see
  1379. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1380. Note that the first two sets of the start/end options and the @option{duration}
  1381. option look at the frame timestamp, while the _sample options simply count the
  1382. samples that pass through the filter. So start/end_pts and start/end_sample will
  1383. give different results when the timestamps are wrong, inexact or do not start at
  1384. zero. Also note that this filter does not modify the timestamps. If you wish
  1385. to have the output timestamps start at zero, insert the asetpts filter after the
  1386. atrim filter.
  1387. If multiple start or end options are set, this filter tries to be greedy and
  1388. keep all samples that match at least one of the specified constraints. To keep
  1389. only the part that matches all the constraints at once, chain multiple atrim
  1390. filters.
  1391. The defaults are such that all the input is kept. So it is possible to set e.g.
  1392. just the end values to keep everything before the specified time.
  1393. Examples:
  1394. @itemize
  1395. @item
  1396. Drop everything except the second minute of input:
  1397. @example
  1398. ffmpeg -i INPUT -af atrim=60:120
  1399. @end example
  1400. @item
  1401. Keep only the first 1000 samples:
  1402. @example
  1403. ffmpeg -i INPUT -af atrim=end_sample=1000
  1404. @end example
  1405. @end itemize
  1406. @section bandpass
  1407. Apply a two-pole Butterworth band-pass filter with central
  1408. frequency @var{frequency}, and (3dB-point) band-width width.
  1409. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1410. instead of the default: constant 0dB peak gain.
  1411. The filter roll off at 6dB per octave (20dB per decade).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item frequency, f
  1415. Set the filter's central frequency. Default is @code{3000}.
  1416. @item csg
  1417. Constant skirt gain if set to 1. Defaults to 0.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bandreject
  1436. Apply a two-pole Butterworth band-reject filter with central
  1437. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1438. The filter roll off at 6dB per octave (20dB per decade).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item frequency, f
  1442. Set the filter's central frequency. Default is @code{3000}.
  1443. @item width_type, t
  1444. Set method to specify band-width of filter.
  1445. @table @option
  1446. @item h
  1447. Hz
  1448. @item q
  1449. Q-Factor
  1450. @item o
  1451. octave
  1452. @item s
  1453. slope
  1454. @end table
  1455. @item width, w
  1456. Specify the band-width of a filter in width_type units.
  1457. @item channels, c
  1458. Specify which channels to filter, by default all available are filtered.
  1459. @end table
  1460. @section bass
  1461. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1462. shelving filter with a response similar to that of a standard
  1463. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1464. The filter accepts the following options:
  1465. @table @option
  1466. @item gain, g
  1467. Give the gain at 0 Hz. Its useful range is about -20
  1468. (for a large cut) to +20 (for a large boost).
  1469. Beware of clipping when using a positive gain.
  1470. @item frequency, f
  1471. Set the filter's central frequency and so can be used
  1472. to extend or reduce the frequency range to be boosted or cut.
  1473. The default value is @code{100} Hz.
  1474. @item width_type, t
  1475. Set method to specify band-width of filter.
  1476. @table @option
  1477. @item h
  1478. Hz
  1479. @item q
  1480. Q-Factor
  1481. @item o
  1482. octave
  1483. @item s
  1484. slope
  1485. @end table
  1486. @item width, w
  1487. Determine how steep is the filter's shelf transition.
  1488. @item channels, c
  1489. Specify which channels to filter, by default all available are filtered.
  1490. @end table
  1491. @section biquad
  1492. Apply a biquad IIR filter with the given coefficients.
  1493. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1494. are the numerator and denominator coefficients respectively.
  1495. and @var{channels}, @var{c} specify which channels to filter, by default all
  1496. available are filtered.
  1497. @section bs2b
  1498. Bauer stereo to binaural transformation, which improves headphone listening of
  1499. stereo audio records.
  1500. To enable compilation of this filter you need to configure FFmpeg with
  1501. @code{--enable-libbs2b}.
  1502. It accepts the following parameters:
  1503. @table @option
  1504. @item profile
  1505. Pre-defined crossfeed level.
  1506. @table @option
  1507. @item default
  1508. Default level (fcut=700, feed=50).
  1509. @item cmoy
  1510. Chu Moy circuit (fcut=700, feed=60).
  1511. @item jmeier
  1512. Jan Meier circuit (fcut=650, feed=95).
  1513. @end table
  1514. @item fcut
  1515. Cut frequency (in Hz).
  1516. @item feed
  1517. Feed level (in Hz).
  1518. @end table
  1519. @section channelmap
  1520. Remap input channels to new locations.
  1521. It accepts the following parameters:
  1522. @table @option
  1523. @item map
  1524. Map channels from input to output. The argument is a '|'-separated list of
  1525. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1526. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1527. channel (e.g. FL for front left) or its index in the input channel layout.
  1528. @var{out_channel} is the name of the output channel or its index in the output
  1529. channel layout. If @var{out_channel} is not given then it is implicitly an
  1530. index, starting with zero and increasing by one for each mapping.
  1531. @item channel_layout
  1532. The channel layout of the output stream.
  1533. @end table
  1534. If no mapping is present, the filter will implicitly map input channels to
  1535. output channels, preserving indices.
  1536. For example, assuming a 5.1+downmix input MOV file,
  1537. @example
  1538. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1539. @end example
  1540. will create an output WAV file tagged as stereo from the downmix channels of
  1541. the input.
  1542. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1543. @example
  1544. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1545. @end example
  1546. @section channelsplit
  1547. Split each channel from an input audio stream into a separate output stream.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item channel_layout
  1551. The channel layout of the input stream. The default is "stereo".
  1552. @end table
  1553. For example, assuming a stereo input MP3 file,
  1554. @example
  1555. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1556. @end example
  1557. will create an output Matroska file with two audio streams, one containing only
  1558. the left channel and the other the right channel.
  1559. Split a 5.1 WAV file into per-channel files:
  1560. @example
  1561. ffmpeg -i in.wav -filter_complex
  1562. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1563. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1564. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1565. side_right.wav
  1566. @end example
  1567. @section chorus
  1568. Add a chorus effect to the audio.
  1569. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1570. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1571. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1572. The modulation depth defines the range the modulated delay is played before or after
  1573. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1574. sound tuned around the original one, like in a chorus where some vocals are slightly
  1575. off key.
  1576. It accepts the following parameters:
  1577. @table @option
  1578. @item in_gain
  1579. Set input gain. Default is 0.4.
  1580. @item out_gain
  1581. Set output gain. Default is 0.4.
  1582. @item delays
  1583. Set delays. A typical delay is around 40ms to 60ms.
  1584. @item decays
  1585. Set decays.
  1586. @item speeds
  1587. Set speeds.
  1588. @item depths
  1589. Set depths.
  1590. @end table
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. A single delay:
  1595. @example
  1596. chorus=0.7:0.9:55:0.4:0.25:2
  1597. @end example
  1598. @item
  1599. Two delays:
  1600. @example
  1601. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1602. @end example
  1603. @item
  1604. Fuller sounding chorus with three delays:
  1605. @example
  1606. 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
  1607. @end example
  1608. @end itemize
  1609. @section compand
  1610. Compress or expand the audio's dynamic range.
  1611. It accepts the following parameters:
  1612. @table @option
  1613. @item attacks
  1614. @item decays
  1615. A list of times in seconds for each channel over which the instantaneous level
  1616. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1617. increase of volume and @var{decays} refers to decrease of volume. For most
  1618. situations, the attack time (response to the audio getting louder) should be
  1619. shorter than the decay time, because the human ear is more sensitive to sudden
  1620. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1621. a typical value for decay is 0.8 seconds.
  1622. If specified number of attacks & decays is lower than number of channels, the last
  1623. set attack/decay will be used for all remaining channels.
  1624. @item points
  1625. A list of points for the transfer function, specified in dB relative to the
  1626. maximum possible signal amplitude. Each key points list must be defined using
  1627. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1628. @code{x0/y0 x1/y1 x2/y2 ....}
  1629. The input values must be in strictly increasing order but the transfer function
  1630. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1631. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1632. function are @code{-70/-70|-60/-20|1/0}.
  1633. @item soft-knee
  1634. Set the curve radius in dB for all joints. It defaults to 0.01.
  1635. @item gain
  1636. Set the additional gain in dB to be applied at all points on the transfer
  1637. function. This allows for easy adjustment of the overall gain.
  1638. It defaults to 0.
  1639. @item volume
  1640. Set an initial volume, in dB, to be assumed for each channel when filtering
  1641. starts. This permits the user to supply a nominal level initially, so that, for
  1642. example, a very large gain is not applied to initial signal levels before the
  1643. companding has begun to operate. A typical value for audio which is initially
  1644. quiet is -90 dB. It defaults to 0.
  1645. @item delay
  1646. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1647. delayed before being fed to the volume adjuster. Specifying a delay
  1648. approximately equal to the attack/decay times allows the filter to effectively
  1649. operate in predictive rather than reactive mode. It defaults to 0.
  1650. @end table
  1651. @subsection Examples
  1652. @itemize
  1653. @item
  1654. Make music with both quiet and loud passages suitable for listening to in a
  1655. noisy environment:
  1656. @example
  1657. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1658. @end example
  1659. Another example for audio with whisper and explosion parts:
  1660. @example
  1661. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1662. @end example
  1663. @item
  1664. A noise gate for when the noise is at a lower level than the signal:
  1665. @example
  1666. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1667. @end example
  1668. @item
  1669. Here is another noise gate, this time for when the noise is at a higher level
  1670. than the signal (making it, in some ways, similar to squelch):
  1671. @example
  1672. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1673. @end example
  1674. @item
  1675. 2:1 compression starting at -6dB:
  1676. @example
  1677. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1678. @end example
  1679. @item
  1680. 2:1 compression starting at -9dB:
  1681. @example
  1682. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1683. @end example
  1684. @item
  1685. 2:1 compression starting at -12dB:
  1686. @example
  1687. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1688. @end example
  1689. @item
  1690. 2:1 compression starting at -18dB:
  1691. @example
  1692. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1693. @end example
  1694. @item
  1695. 3:1 compression starting at -15dB:
  1696. @example
  1697. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1698. @end example
  1699. @item
  1700. Compressor/Gate:
  1701. @example
  1702. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1703. @end example
  1704. @item
  1705. Expander:
  1706. @example
  1707. 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
  1708. @end example
  1709. @item
  1710. Hard limiter at -6dB:
  1711. @example
  1712. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1713. @end example
  1714. @item
  1715. Hard limiter at -12dB:
  1716. @example
  1717. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1718. @end example
  1719. @item
  1720. Hard noise gate at -35 dB:
  1721. @example
  1722. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1723. @end example
  1724. @item
  1725. Soft limiter:
  1726. @example
  1727. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1728. @end example
  1729. @end itemize
  1730. @section compensationdelay
  1731. Compensation Delay Line is a metric based delay to compensate differing
  1732. positions of microphones or speakers.
  1733. For example, you have recorded guitar with two microphones placed in
  1734. different location. Because the front of sound wave has fixed speed in
  1735. normal conditions, the phasing of microphones can vary and depends on
  1736. their location and interposition. The best sound mix can be achieved when
  1737. these microphones are in phase (synchronized). Note that distance of
  1738. ~30 cm between microphones makes one microphone to capture signal in
  1739. antiphase to another microphone. That makes the final mix sounding moody.
  1740. This filter helps to solve phasing problems by adding different delays
  1741. to each microphone track and make them synchronized.
  1742. The best result can be reached when you take one track as base and
  1743. synchronize other tracks one by one with it.
  1744. Remember that synchronization/delay tolerance depends on sample rate, too.
  1745. Higher sample rates will give more tolerance.
  1746. It accepts the following parameters:
  1747. @table @option
  1748. @item mm
  1749. Set millimeters distance. This is compensation distance for fine tuning.
  1750. Default is 0.
  1751. @item cm
  1752. Set cm distance. This is compensation distance for tightening distance setup.
  1753. Default is 0.
  1754. @item m
  1755. Set meters distance. This is compensation distance for hard distance setup.
  1756. Default is 0.
  1757. @item dry
  1758. Set dry amount. Amount of unprocessed (dry) signal.
  1759. Default is 0.
  1760. @item wet
  1761. Set wet amount. Amount of processed (wet) signal.
  1762. Default is 1.
  1763. @item temp
  1764. Set temperature degree in Celsius. This is the temperature of the environment.
  1765. Default is 20.
  1766. @end table
  1767. @section crossfeed
  1768. Apply headphone crossfeed filter.
  1769. Crossfeed is the process of blending the left and right channels of stereo
  1770. audio recording.
  1771. It is mainly used to reduce extreme stereo separation of low frequencies.
  1772. The intent is to produce more speaker like sound to the listener.
  1773. The filter accepts the following options:
  1774. @table @option
  1775. @item strength
  1776. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1777. This sets gain of low shelf filter for side part of stereo image.
  1778. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1779. @item range
  1780. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1781. This sets cut off frequency of low shelf filter. Default is cut off near
  1782. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1783. @item level_in
  1784. Set input gain. Default is 0.9.
  1785. @item level_out
  1786. Set output gain. Default is 1.
  1787. @end table
  1788. @section crystalizer
  1789. Simple algorithm to expand audio dynamic range.
  1790. The filter accepts the following options:
  1791. @table @option
  1792. @item i
  1793. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1794. (unchanged sound) to 10.0 (maximum effect).
  1795. @item c
  1796. Enable clipping. By default is enabled.
  1797. @end table
  1798. @section dcshift
  1799. Apply a DC shift to the audio.
  1800. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1801. in the recording chain) from the audio. The effect of a DC offset is reduced
  1802. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1803. a signal has a DC offset.
  1804. @table @option
  1805. @item shift
  1806. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1807. the audio.
  1808. @item limitergain
  1809. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1810. used to prevent clipping.
  1811. @end table
  1812. @section dynaudnorm
  1813. Dynamic Audio Normalizer.
  1814. This filter applies a certain amount of gain to the input audio in order
  1815. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1816. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1817. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1818. This allows for applying extra gain to the "quiet" sections of the audio
  1819. while avoiding distortions or clipping the "loud" sections. In other words:
  1820. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1821. sections, in the sense that the volume of each section is brought to the
  1822. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1823. this goal *without* applying "dynamic range compressing". It will retain 100%
  1824. of the dynamic range *within* each section of the audio file.
  1825. @table @option
  1826. @item f
  1827. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1828. Default is 500 milliseconds.
  1829. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1830. referred to as frames. This is required, because a peak magnitude has no
  1831. meaning for just a single sample value. Instead, we need to determine the
  1832. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1833. normalizer would simply use the peak magnitude of the complete file, the
  1834. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1835. frame. The length of a frame is specified in milliseconds. By default, the
  1836. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1837. been found to give good results with most files.
  1838. Note that the exact frame length, in number of samples, will be determined
  1839. automatically, based on the sampling rate of the individual input audio file.
  1840. @item g
  1841. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1842. number. Default is 31.
  1843. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1844. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1845. is specified in frames, centered around the current frame. For the sake of
  1846. simplicity, this must be an odd number. Consequently, the default value of 31
  1847. takes into account the current frame, as well as the 15 preceding frames and
  1848. the 15 subsequent frames. Using a larger window results in a stronger
  1849. smoothing effect and thus in less gain variation, i.e. slower gain
  1850. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1851. effect and thus in more gain variation, i.e. faster gain adaptation.
  1852. In other words, the more you increase this value, the more the Dynamic Audio
  1853. Normalizer will behave like a "traditional" normalization filter. On the
  1854. contrary, the more you decrease this value, the more the Dynamic Audio
  1855. Normalizer will behave like a dynamic range compressor.
  1856. @item p
  1857. Set the target peak value. This specifies the highest permissible magnitude
  1858. level for the normalized audio input. This filter will try to approach the
  1859. target peak magnitude as closely as possible, but at the same time it also
  1860. makes sure that the normalized signal will never exceed the peak magnitude.
  1861. A frame's maximum local gain factor is imposed directly by the target peak
  1862. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1863. It is not recommended to go above this value.
  1864. @item m
  1865. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1866. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1867. factor for each input frame, i.e. the maximum gain factor that does not
  1868. result in clipping or distortion. The maximum gain factor is determined by
  1869. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1870. additionally bounds the frame's maximum gain factor by a predetermined
  1871. (global) maximum gain factor. This is done in order to avoid excessive gain
  1872. factors in "silent" or almost silent frames. By default, the maximum gain
  1873. factor is 10.0, For most inputs the default value should be sufficient and
  1874. it usually is not recommended to increase this value. Though, for input
  1875. with an extremely low overall volume level, it may be necessary to allow even
  1876. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1877. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1878. Instead, a "sigmoid" threshold function will be applied. This way, the
  1879. gain factors will smoothly approach the threshold value, but never exceed that
  1880. value.
  1881. @item r
  1882. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1883. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1884. This means that the maximum local gain factor for each frame is defined
  1885. (only) by the frame's highest magnitude sample. This way, the samples can
  1886. be amplified as much as possible without exceeding the maximum signal
  1887. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1888. Normalizer can also take into account the frame's root mean square,
  1889. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1890. determine the power of a time-varying signal. It is therefore considered
  1891. that the RMS is a better approximation of the "perceived loudness" than
  1892. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1893. frames to a constant RMS value, a uniform "perceived loudness" can be
  1894. established. If a target RMS value has been specified, a frame's local gain
  1895. factor is defined as the factor that would result in exactly that RMS value.
  1896. Note, however, that the maximum local gain factor is still restricted by the
  1897. frame's highest magnitude sample, in order to prevent clipping.
  1898. @item n
  1899. Enable channels coupling. By default is enabled.
  1900. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1901. amount. This means the same gain factor will be applied to all channels, i.e.
  1902. the maximum possible gain factor is determined by the "loudest" channel.
  1903. However, in some recordings, it may happen that the volume of the different
  1904. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1905. In this case, this option can be used to disable the channel coupling. This way,
  1906. the gain factor will be determined independently for each channel, depending
  1907. only on the individual channel's highest magnitude sample. This allows for
  1908. harmonizing the volume of the different channels.
  1909. @item c
  1910. Enable DC bias correction. By default is disabled.
  1911. An audio signal (in the time domain) is a sequence of sample values.
  1912. In the Dynamic Audio Normalizer these sample values are represented in the
  1913. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1914. audio signal, or "waveform", should be centered around the zero point.
  1915. That means if we calculate the mean value of all samples in a file, or in a
  1916. single frame, then the result should be 0.0 or at least very close to that
  1917. value. If, however, there is a significant deviation of the mean value from
  1918. 0.0, in either positive or negative direction, this is referred to as a
  1919. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1920. Audio Normalizer provides optional DC bias correction.
  1921. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1922. the mean value, or "DC correction" offset, of each input frame and subtract
  1923. that value from all of the frame's sample values which ensures those samples
  1924. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1925. boundaries, the DC correction offset values will be interpolated smoothly
  1926. between neighbouring frames.
  1927. @item b
  1928. Enable alternative boundary mode. By default is disabled.
  1929. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1930. around each frame. This includes the preceding frames as well as the
  1931. subsequent frames. However, for the "boundary" frames, located at the very
  1932. beginning and at the very end of the audio file, not all neighbouring
  1933. frames are available. In particular, for the first few frames in the audio
  1934. file, the preceding frames are not known. And, similarly, for the last few
  1935. frames in the audio file, the subsequent frames are not known. Thus, the
  1936. question arises which gain factors should be assumed for the missing frames
  1937. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1938. to deal with this situation. The default boundary mode assumes a gain factor
  1939. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1940. "fade out" at the beginning and at the end of the input, respectively.
  1941. @item s
  1942. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1943. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1944. compression. This means that signal peaks will not be pruned and thus the
  1945. full dynamic range will be retained within each local neighbourhood. However,
  1946. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1947. normalization algorithm with a more "traditional" compression.
  1948. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1949. (thresholding) function. If (and only if) the compression feature is enabled,
  1950. all input frames will be processed by a soft knee thresholding function prior
  1951. to the actual normalization process. Put simply, the thresholding function is
  1952. going to prune all samples whose magnitude exceeds a certain threshold value.
  1953. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1954. value. Instead, the threshold value will be adjusted for each individual
  1955. frame.
  1956. In general, smaller parameters result in stronger compression, and vice versa.
  1957. Values below 3.0 are not recommended, because audible distortion may appear.
  1958. @end table
  1959. @section earwax
  1960. Make audio easier to listen to on headphones.
  1961. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1962. so that when listened to on headphones the stereo image is moved from
  1963. inside your head (standard for headphones) to outside and in front of
  1964. the listener (standard for speakers).
  1965. Ported from SoX.
  1966. @section equalizer
  1967. Apply a two-pole peaking equalisation (EQ) filter. With this
  1968. filter, the signal-level at and around a selected frequency can
  1969. be increased or decreased, whilst (unlike bandpass and bandreject
  1970. filters) that at all other frequencies is unchanged.
  1971. In order to produce complex equalisation curves, this filter can
  1972. be given several times, each with a different central frequency.
  1973. The filter accepts the following options:
  1974. @table @option
  1975. @item frequency, f
  1976. Set the filter's central frequency in Hz.
  1977. @item width_type, t
  1978. Set method to specify band-width of filter.
  1979. @table @option
  1980. @item h
  1981. Hz
  1982. @item q
  1983. Q-Factor
  1984. @item o
  1985. octave
  1986. @item s
  1987. slope
  1988. @end table
  1989. @item width, w
  1990. Specify the band-width of a filter in width_type units.
  1991. @item gain, g
  1992. Set the required gain or attenuation in dB.
  1993. Beware of clipping when using a positive gain.
  1994. @item channels, c
  1995. Specify which channels to filter, by default all available are filtered.
  1996. @end table
  1997. @subsection Examples
  1998. @itemize
  1999. @item
  2000. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2001. @example
  2002. equalizer=f=1000:t=h:width=200:g=-10
  2003. @end example
  2004. @item
  2005. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2006. @example
  2007. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2008. @end example
  2009. @end itemize
  2010. @section extrastereo
  2011. Linearly increases the difference between left and right channels which
  2012. adds some sort of "live" effect to playback.
  2013. The filter accepts the following options:
  2014. @table @option
  2015. @item m
  2016. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2017. (average of both channels), with 1.0 sound will be unchanged, with
  2018. -1.0 left and right channels will be swapped.
  2019. @item c
  2020. Enable clipping. By default is enabled.
  2021. @end table
  2022. @section firequalizer
  2023. Apply FIR Equalization using arbitrary frequency response.
  2024. The filter accepts the following option:
  2025. @table @option
  2026. @item gain
  2027. Set gain curve equation (in dB). The expression can contain variables:
  2028. @table @option
  2029. @item f
  2030. the evaluated frequency
  2031. @item sr
  2032. sample rate
  2033. @item ch
  2034. channel number, set to 0 when multichannels evaluation is disabled
  2035. @item chid
  2036. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2037. multichannels evaluation is disabled
  2038. @item chs
  2039. number of channels
  2040. @item chlayout
  2041. channel_layout, see libavutil/channel_layout.h
  2042. @end table
  2043. and functions:
  2044. @table @option
  2045. @item gain_interpolate(f)
  2046. interpolate gain on frequency f based on gain_entry
  2047. @item cubic_interpolate(f)
  2048. same as gain_interpolate, but smoother
  2049. @end table
  2050. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2051. @item gain_entry
  2052. Set gain entry for gain_interpolate function. The expression can
  2053. contain functions:
  2054. @table @option
  2055. @item entry(f, g)
  2056. store gain entry at frequency f with value g
  2057. @end table
  2058. This option is also available as command.
  2059. @item delay
  2060. Set filter delay in seconds. Higher value means more accurate.
  2061. Default is @code{0.01}.
  2062. @item accuracy
  2063. Set filter accuracy in Hz. Lower value means more accurate.
  2064. Default is @code{5}.
  2065. @item wfunc
  2066. Set window function. Acceptable values are:
  2067. @table @option
  2068. @item rectangular
  2069. rectangular window, useful when gain curve is already smooth
  2070. @item hann
  2071. hann window (default)
  2072. @item hamming
  2073. hamming window
  2074. @item blackman
  2075. blackman window
  2076. @item nuttall3
  2077. 3-terms continuous 1st derivative nuttall window
  2078. @item mnuttall3
  2079. minimum 3-terms discontinuous nuttall window
  2080. @item nuttall
  2081. 4-terms continuous 1st derivative nuttall window
  2082. @item bnuttall
  2083. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2084. @item bharris
  2085. blackman-harris window
  2086. @item tukey
  2087. tukey window
  2088. @end table
  2089. @item fixed
  2090. If enabled, use fixed number of audio samples. This improves speed when
  2091. filtering with large delay. Default is disabled.
  2092. @item multi
  2093. Enable multichannels evaluation on gain. Default is disabled.
  2094. @item zero_phase
  2095. Enable zero phase mode by subtracting timestamp to compensate delay.
  2096. Default is disabled.
  2097. @item scale
  2098. Set scale used by gain. Acceptable values are:
  2099. @table @option
  2100. @item linlin
  2101. linear frequency, linear gain
  2102. @item linlog
  2103. linear frequency, logarithmic (in dB) gain (default)
  2104. @item loglin
  2105. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2106. @item loglog
  2107. logarithmic frequency, logarithmic gain
  2108. @end table
  2109. @item dumpfile
  2110. Set file for dumping, suitable for gnuplot.
  2111. @item dumpscale
  2112. Set scale for dumpfile. Acceptable values are same with scale option.
  2113. Default is linlog.
  2114. @item fft2
  2115. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2116. Default is disabled.
  2117. @item min_phase
  2118. Enable minimum phase impulse response. Default is disabled.
  2119. @end table
  2120. @subsection Examples
  2121. @itemize
  2122. @item
  2123. lowpass at 1000 Hz:
  2124. @example
  2125. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2126. @end example
  2127. @item
  2128. lowpass at 1000 Hz with gain_entry:
  2129. @example
  2130. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2131. @end example
  2132. @item
  2133. custom equalization:
  2134. @example
  2135. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2136. @end example
  2137. @item
  2138. higher delay with zero phase to compensate delay:
  2139. @example
  2140. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2141. @end example
  2142. @item
  2143. lowpass on left channel, highpass on right channel:
  2144. @example
  2145. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2146. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2147. @end example
  2148. @end itemize
  2149. @section flanger
  2150. Apply a flanging effect to the audio.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item delay
  2154. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2155. @item depth
  2156. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2157. @item regen
  2158. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2159. Default value is 0.
  2160. @item width
  2161. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2162. Default value is 71.
  2163. @item speed
  2164. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2165. @item shape
  2166. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2167. Default value is @var{sinusoidal}.
  2168. @item phase
  2169. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2170. Default value is 25.
  2171. @item interp
  2172. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2173. Default is @var{linear}.
  2174. @end table
  2175. @section haas
  2176. Apply Haas effect to audio.
  2177. Note that this makes most sense to apply on mono signals.
  2178. With this filter applied to mono signals it give some directionality and
  2179. stretches its stereo image.
  2180. The filter accepts the following options:
  2181. @table @option
  2182. @item level_in
  2183. Set input level. By default is @var{1}, or 0dB
  2184. @item level_out
  2185. Set output level. By default is @var{1}, or 0dB.
  2186. @item side_gain
  2187. Set gain applied to side part of signal. By default is @var{1}.
  2188. @item middle_source
  2189. Set kind of middle source. Can be one of the following:
  2190. @table @samp
  2191. @item left
  2192. Pick left channel.
  2193. @item right
  2194. Pick right channel.
  2195. @item mid
  2196. Pick middle part signal of stereo image.
  2197. @item side
  2198. Pick side part signal of stereo image.
  2199. @end table
  2200. @item middle_phase
  2201. Change middle phase. By default is disabled.
  2202. @item left_delay
  2203. Set left channel delay. By default is @var{2.05} milliseconds.
  2204. @item left_balance
  2205. Set left channel balance. By default is @var{-1}.
  2206. @item left_gain
  2207. Set left channel gain. By default is @var{1}.
  2208. @item left_phase
  2209. Change left phase. By default is disabled.
  2210. @item right_delay
  2211. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2212. @item right_balance
  2213. Set right channel balance. By default is @var{1}.
  2214. @item right_gain
  2215. Set right channel gain. By default is @var{1}.
  2216. @item right_phase
  2217. Change right phase. By default is enabled.
  2218. @end table
  2219. @section hdcd
  2220. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2221. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2222. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2223. of HDCD, and detects the Transient Filter flag.
  2224. @example
  2225. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2226. @end example
  2227. When using the filter with wav, note the default encoding for wav is 16-bit,
  2228. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2229. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2230. @example
  2231. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2232. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2233. @end example
  2234. The filter accepts the following options:
  2235. @table @option
  2236. @item disable_autoconvert
  2237. Disable any automatic format conversion or resampling in the filter graph.
  2238. @item process_stereo
  2239. Process the stereo channels together. If target_gain does not match between
  2240. channels, consider it invalid and use the last valid target_gain.
  2241. @item cdt_ms
  2242. Set the code detect timer period in ms.
  2243. @item force_pe
  2244. Always extend peaks above -3dBFS even if PE isn't signaled.
  2245. @item analyze_mode
  2246. Replace audio with a solid tone and adjust the amplitude to signal some
  2247. specific aspect of the decoding process. The output file can be loaded in
  2248. an audio editor alongside the original to aid analysis.
  2249. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2250. Modes are:
  2251. @table @samp
  2252. @item 0, off
  2253. Disabled
  2254. @item 1, lle
  2255. Gain adjustment level at each sample
  2256. @item 2, pe
  2257. Samples where peak extend occurs
  2258. @item 3, cdt
  2259. Samples where the code detect timer is active
  2260. @item 4, tgm
  2261. Samples where the target gain does not match between channels
  2262. @end table
  2263. @end table
  2264. @section headphone
  2265. Apply head-related transfer functions (HRTFs) to create virtual
  2266. loudspeakers around the user for binaural listening via headphones.
  2267. The HRIRs are provided via additional streams, for each channel
  2268. one stereo input stream is needed.
  2269. The filter accepts the following options:
  2270. @table @option
  2271. @item map
  2272. Set mapping of input streams for convolution.
  2273. The argument is a '|'-separated list of channel names in order as they
  2274. are given as additional stream inputs for filter.
  2275. This also specify number of input streams. Number of input streams
  2276. must be not less than number of channels in first stream plus one.
  2277. @item gain
  2278. Set gain applied to audio. Value is in dB. Default is 0.
  2279. @item type
  2280. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2281. processing audio in time domain which is slow.
  2282. @var{freq} is processing audio in frequency domain which is fast.
  2283. Default is @var{freq}.
  2284. @item lfe
  2285. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2286. @end table
  2287. @subsection Examples
  2288. @itemize
  2289. @item
  2290. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2291. each amovie filter use stereo file with IR coefficients as input.
  2292. The files give coefficients for each position of virtual loudspeaker:
  2293. @example
  2294. 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"
  2295. output.wav
  2296. @end example
  2297. @end itemize
  2298. @section highpass
  2299. Apply a high-pass filter with 3dB point frequency.
  2300. The filter can be either single-pole, or double-pole (the default).
  2301. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2302. The filter accepts the following options:
  2303. @table @option
  2304. @item frequency, f
  2305. Set frequency in Hz. Default is 3000.
  2306. @item poles, p
  2307. Set number of poles. Default is 2.
  2308. @item width_type, t
  2309. Set method to specify band-width of filter.
  2310. @table @option
  2311. @item h
  2312. Hz
  2313. @item q
  2314. Q-Factor
  2315. @item o
  2316. octave
  2317. @item s
  2318. slope
  2319. @end table
  2320. @item width, w
  2321. Specify the band-width of a filter in width_type units.
  2322. Applies only to double-pole filter.
  2323. The default is 0.707q and gives a Butterworth response.
  2324. @item channels, c
  2325. Specify which channels to filter, by default all available are filtered.
  2326. @end table
  2327. @section join
  2328. Join multiple input streams into one multi-channel stream.
  2329. It accepts the following parameters:
  2330. @table @option
  2331. @item inputs
  2332. The number of input streams. It defaults to 2.
  2333. @item channel_layout
  2334. The desired output channel layout. It defaults to stereo.
  2335. @item map
  2336. Map channels from inputs to output. The argument is a '|'-separated list of
  2337. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2338. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2339. can be either the name of the input channel (e.g. FL for front left) or its
  2340. index in the specified input stream. @var{out_channel} is the name of the output
  2341. channel.
  2342. @end table
  2343. The filter will attempt to guess the mappings when they are not specified
  2344. explicitly. It does so by first trying to find an unused matching input channel
  2345. and if that fails it picks the first unused input channel.
  2346. Join 3 inputs (with properly set channel layouts):
  2347. @example
  2348. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2349. @end example
  2350. Build a 5.1 output from 6 single-channel streams:
  2351. @example
  2352. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2353. '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'
  2354. out
  2355. @end example
  2356. @section ladspa
  2357. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2358. To enable compilation of this filter you need to configure FFmpeg with
  2359. @code{--enable-ladspa}.
  2360. @table @option
  2361. @item file, f
  2362. Specifies the name of LADSPA plugin library to load. If the environment
  2363. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2364. each one of the directories specified by the colon separated list in
  2365. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2366. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2367. @file{/usr/lib/ladspa/}.
  2368. @item plugin, p
  2369. Specifies the plugin within the library. Some libraries contain only
  2370. one plugin, but others contain many of them. If this is not set filter
  2371. will list all available plugins within the specified library.
  2372. @item controls, c
  2373. Set the '|' separated list of controls which are zero or more floating point
  2374. values that determine the behavior of the loaded plugin (for example delay,
  2375. threshold or gain).
  2376. Controls need to be defined using the following syntax:
  2377. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2378. @var{valuei} is the value set on the @var{i}-th control.
  2379. Alternatively they can be also defined using the following syntax:
  2380. @var{value0}|@var{value1}|@var{value2}|..., where
  2381. @var{valuei} is the value set on the @var{i}-th control.
  2382. If @option{controls} is set to @code{help}, all available controls and
  2383. their valid ranges are printed.
  2384. @item sample_rate, s
  2385. Specify the sample rate, default to 44100. Only used if plugin have
  2386. zero inputs.
  2387. @item nb_samples, n
  2388. Set the number of samples per channel per each output frame, default
  2389. is 1024. Only used if plugin have zero inputs.
  2390. @item duration, d
  2391. Set the minimum duration of the sourced audio. See
  2392. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2393. for the accepted syntax.
  2394. Note that the resulting duration may be greater than the specified duration,
  2395. as the generated audio is always cut at the end of a complete frame.
  2396. If not specified, or the expressed duration is negative, the audio is
  2397. supposed to be generated forever.
  2398. Only used if plugin have zero inputs.
  2399. @end table
  2400. @subsection Examples
  2401. @itemize
  2402. @item
  2403. List all available plugins within amp (LADSPA example plugin) library:
  2404. @example
  2405. ladspa=file=amp
  2406. @end example
  2407. @item
  2408. List all available controls and their valid ranges for @code{vcf_notch}
  2409. plugin from @code{VCF} library:
  2410. @example
  2411. ladspa=f=vcf:p=vcf_notch:c=help
  2412. @end example
  2413. @item
  2414. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2415. plugin library:
  2416. @example
  2417. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2418. @end example
  2419. @item
  2420. Add reverberation to the audio using TAP-plugins
  2421. (Tom's Audio Processing plugins):
  2422. @example
  2423. ladspa=file=tap_reverb:tap_reverb
  2424. @end example
  2425. @item
  2426. Generate white noise, with 0.2 amplitude:
  2427. @example
  2428. ladspa=file=cmt:noise_source_white:c=c0=.2
  2429. @end example
  2430. @item
  2431. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2432. @code{C* Audio Plugin Suite} (CAPS) library:
  2433. @example
  2434. ladspa=file=caps:Click:c=c1=20'
  2435. @end example
  2436. @item
  2437. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2438. @example
  2439. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2440. @end example
  2441. @item
  2442. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2443. @code{SWH Plugins} collection:
  2444. @example
  2445. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2446. @end example
  2447. @item
  2448. Attenuate low frequencies using Multiband EQ from Steve Harris
  2449. @code{SWH Plugins} collection:
  2450. @example
  2451. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2452. @end example
  2453. @item
  2454. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2455. (CAPS) library:
  2456. @example
  2457. ladspa=caps:Narrower
  2458. @end example
  2459. @item
  2460. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2461. @example
  2462. ladspa=caps:White:.2
  2463. @end example
  2464. @item
  2465. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2466. @example
  2467. ladspa=caps:Fractal:c=c1=1
  2468. @end example
  2469. @item
  2470. Dynamic volume normalization using @code{VLevel} plugin:
  2471. @example
  2472. ladspa=vlevel-ladspa:vlevel_mono
  2473. @end example
  2474. @end itemize
  2475. @subsection Commands
  2476. This filter supports the following commands:
  2477. @table @option
  2478. @item cN
  2479. Modify the @var{N}-th control value.
  2480. If the specified value is not valid, it is ignored and prior one is kept.
  2481. @end table
  2482. @section loudnorm
  2483. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2484. Support for both single pass (livestreams, files) and double pass (files) modes.
  2485. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2486. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2487. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2488. The filter accepts the following options:
  2489. @table @option
  2490. @item I, i
  2491. Set integrated loudness target.
  2492. Range is -70.0 - -5.0. Default value is -24.0.
  2493. @item LRA, lra
  2494. Set loudness range target.
  2495. Range is 1.0 - 20.0. Default value is 7.0.
  2496. @item TP, tp
  2497. Set maximum true peak.
  2498. Range is -9.0 - +0.0. Default value is -2.0.
  2499. @item measured_I, measured_i
  2500. Measured IL of input file.
  2501. Range is -99.0 - +0.0.
  2502. @item measured_LRA, measured_lra
  2503. Measured LRA of input file.
  2504. Range is 0.0 - 99.0.
  2505. @item measured_TP, measured_tp
  2506. Measured true peak of input file.
  2507. Range is -99.0 - +99.0.
  2508. @item measured_thresh
  2509. Measured threshold of input file.
  2510. Range is -99.0 - +0.0.
  2511. @item offset
  2512. Set offset gain. Gain is applied before the true-peak limiter.
  2513. Range is -99.0 - +99.0. Default is +0.0.
  2514. @item linear
  2515. Normalize linearly if possible.
  2516. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2517. to be specified in order to use this mode.
  2518. Options are true or false. Default is true.
  2519. @item dual_mono
  2520. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2521. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2522. If set to @code{true}, this option will compensate for this effect.
  2523. Multi-channel input files are not affected by this option.
  2524. Options are true or false. Default is false.
  2525. @item print_format
  2526. Set print format for stats. Options are summary, json, or none.
  2527. Default value is none.
  2528. @end table
  2529. @section lowpass
  2530. Apply a low-pass filter with 3dB point frequency.
  2531. The filter can be either single-pole or double-pole (the default).
  2532. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2533. The filter accepts the following options:
  2534. @table @option
  2535. @item frequency, f
  2536. Set frequency in Hz. Default is 500.
  2537. @item poles, p
  2538. Set number of poles. Default is 2.
  2539. @item width_type, t
  2540. Set method to specify band-width of filter.
  2541. @table @option
  2542. @item h
  2543. Hz
  2544. @item q
  2545. Q-Factor
  2546. @item o
  2547. octave
  2548. @item s
  2549. slope
  2550. @end table
  2551. @item width, w
  2552. Specify the band-width of a filter in width_type units.
  2553. Applies only to double-pole filter.
  2554. The default is 0.707q and gives a Butterworth response.
  2555. @item channels, c
  2556. Specify which channels to filter, by default all available are filtered.
  2557. @end table
  2558. @subsection Examples
  2559. @itemize
  2560. @item
  2561. Lowpass only LFE channel, it LFE is not present it does nothing:
  2562. @example
  2563. lowpass=c=LFE
  2564. @end example
  2565. @end itemize
  2566. @anchor{pan}
  2567. @section pan
  2568. Mix channels with specific gain levels. The filter accepts the output
  2569. channel layout followed by a set of channels definitions.
  2570. This filter is also designed to efficiently remap the channels of an audio
  2571. stream.
  2572. The filter accepts parameters of the form:
  2573. "@var{l}|@var{outdef}|@var{outdef}|..."
  2574. @table @option
  2575. @item l
  2576. output channel layout or number of channels
  2577. @item outdef
  2578. output channel specification, of the form:
  2579. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2580. @item out_name
  2581. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2582. number (c0, c1, etc.)
  2583. @item gain
  2584. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2585. @item in_name
  2586. input channel to use, see out_name for details; it is not possible to mix
  2587. named and numbered input channels
  2588. @end table
  2589. If the `=' in a channel specification is replaced by `<', then the gains for
  2590. that specification will be renormalized so that the total is 1, thus
  2591. avoiding clipping noise.
  2592. @subsection Mixing examples
  2593. For example, if you want to down-mix from stereo to mono, but with a bigger
  2594. factor for the left channel:
  2595. @example
  2596. pan=1c|c0=0.9*c0+0.1*c1
  2597. @end example
  2598. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2599. 7-channels surround:
  2600. @example
  2601. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2602. @end example
  2603. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2604. that should be preferred (see "-ac" option) unless you have very specific
  2605. needs.
  2606. @subsection Remapping examples
  2607. The channel remapping will be effective if, and only if:
  2608. @itemize
  2609. @item gain coefficients are zeroes or ones,
  2610. @item only one input per channel output,
  2611. @end itemize
  2612. If all these conditions are satisfied, the filter will notify the user ("Pure
  2613. channel mapping detected"), and use an optimized and lossless method to do the
  2614. remapping.
  2615. For example, if you have a 5.1 source and want a stereo audio stream by
  2616. dropping the extra channels:
  2617. @example
  2618. pan="stereo| c0=FL | c1=FR"
  2619. @end example
  2620. Given the same source, you can also switch front left and front right channels
  2621. and keep the input channel layout:
  2622. @example
  2623. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2624. @end example
  2625. If the input is a stereo audio stream, you can mute the front left channel (and
  2626. still keep the stereo channel layout) with:
  2627. @example
  2628. pan="stereo|c1=c1"
  2629. @end example
  2630. Still with a stereo audio stream input, you can copy the right channel in both
  2631. front left and right:
  2632. @example
  2633. pan="stereo| c0=FR | c1=FR"
  2634. @end example
  2635. @section replaygain
  2636. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2637. outputs it unchanged.
  2638. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2639. @section resample
  2640. Convert the audio sample format, sample rate and channel layout. It is
  2641. not meant to be used directly.
  2642. @section rubberband
  2643. Apply time-stretching and pitch-shifting with librubberband.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item tempo
  2647. Set tempo scale factor.
  2648. @item pitch
  2649. Set pitch scale factor.
  2650. @item transients
  2651. Set transients detector.
  2652. Possible values are:
  2653. @table @var
  2654. @item crisp
  2655. @item mixed
  2656. @item smooth
  2657. @end table
  2658. @item detector
  2659. Set detector.
  2660. Possible values are:
  2661. @table @var
  2662. @item compound
  2663. @item percussive
  2664. @item soft
  2665. @end table
  2666. @item phase
  2667. Set phase.
  2668. Possible values are:
  2669. @table @var
  2670. @item laminar
  2671. @item independent
  2672. @end table
  2673. @item window
  2674. Set processing window size.
  2675. Possible values are:
  2676. @table @var
  2677. @item standard
  2678. @item short
  2679. @item long
  2680. @end table
  2681. @item smoothing
  2682. Set smoothing.
  2683. Possible values are:
  2684. @table @var
  2685. @item off
  2686. @item on
  2687. @end table
  2688. @item formant
  2689. Enable formant preservation when shift pitching.
  2690. Possible values are:
  2691. @table @var
  2692. @item shifted
  2693. @item preserved
  2694. @end table
  2695. @item pitchq
  2696. Set pitch quality.
  2697. Possible values are:
  2698. @table @var
  2699. @item quality
  2700. @item speed
  2701. @item consistency
  2702. @end table
  2703. @item channels
  2704. Set channels.
  2705. Possible values are:
  2706. @table @var
  2707. @item apart
  2708. @item together
  2709. @end table
  2710. @end table
  2711. @section sidechaincompress
  2712. This filter acts like normal compressor but has the ability to compress
  2713. detected signal using second input signal.
  2714. It needs two input streams and returns one output stream.
  2715. First input stream will be processed depending on second stream signal.
  2716. The filtered signal then can be filtered with other filters in later stages of
  2717. processing. See @ref{pan} and @ref{amerge} filter.
  2718. The filter accepts the following options:
  2719. @table @option
  2720. @item level_in
  2721. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2722. @item threshold
  2723. If a signal of second stream raises above this level it will affect the gain
  2724. reduction of first stream.
  2725. By default is 0.125. Range is between 0.00097563 and 1.
  2726. @item ratio
  2727. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2728. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2729. Default is 2. Range is between 1 and 20.
  2730. @item attack
  2731. Amount of milliseconds the signal has to rise above the threshold before gain
  2732. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2733. @item release
  2734. Amount of milliseconds the signal has to fall below the threshold before
  2735. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2736. @item makeup
  2737. Set the amount by how much signal will be amplified after processing.
  2738. Default is 1. Range is from 1 to 64.
  2739. @item knee
  2740. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2741. Default is 2.82843. Range is between 1 and 8.
  2742. @item link
  2743. Choose if the @code{average} level between all channels of side-chain stream
  2744. or the louder(@code{maximum}) channel of side-chain stream affects the
  2745. reduction. Default is @code{average}.
  2746. @item detection
  2747. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2748. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2749. @item level_sc
  2750. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2751. @item mix
  2752. How much to use compressed signal in output. Default is 1.
  2753. Range is between 0 and 1.
  2754. @end table
  2755. @subsection Examples
  2756. @itemize
  2757. @item
  2758. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2759. depending on the signal of 2nd input and later compressed signal to be
  2760. merged with 2nd input:
  2761. @example
  2762. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2763. @end example
  2764. @end itemize
  2765. @section sidechaingate
  2766. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2767. filter the detected signal before sending it to the gain reduction stage.
  2768. Normally a gate uses the full range signal to detect a level above the
  2769. threshold.
  2770. For example: If you cut all lower frequencies from your sidechain signal
  2771. the gate will decrease the volume of your track only if not enough highs
  2772. appear. With this technique you are able to reduce the resonation of a
  2773. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2774. guitar.
  2775. It needs two input streams and returns one output stream.
  2776. First input stream will be processed depending on second stream signal.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item level_in
  2780. Set input level before filtering.
  2781. Default is 1. Allowed range is from 0.015625 to 64.
  2782. @item range
  2783. Set the level of gain reduction when the signal is below the threshold.
  2784. Default is 0.06125. Allowed range is from 0 to 1.
  2785. @item threshold
  2786. If a signal rises above this level the gain reduction is released.
  2787. Default is 0.125. Allowed range is from 0 to 1.
  2788. @item ratio
  2789. Set a ratio about which the signal is reduced.
  2790. Default is 2. Allowed range is from 1 to 9000.
  2791. @item attack
  2792. Amount of milliseconds the signal has to rise above the threshold before gain
  2793. reduction stops.
  2794. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2795. @item release
  2796. Amount of milliseconds the signal has to fall below the threshold before the
  2797. reduction is increased again. Default is 250 milliseconds.
  2798. Allowed range is from 0.01 to 9000.
  2799. @item makeup
  2800. Set amount of amplification of signal after processing.
  2801. Default is 1. Allowed range is from 1 to 64.
  2802. @item knee
  2803. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2804. Default is 2.828427125. Allowed range is from 1 to 8.
  2805. @item detection
  2806. Choose if exact signal should be taken for detection or an RMS like one.
  2807. Default is rms. Can be peak or rms.
  2808. @item link
  2809. Choose if the average level between all channels or the louder channel affects
  2810. the reduction.
  2811. Default is average. Can be average or maximum.
  2812. @item level_sc
  2813. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2814. @end table
  2815. @section silencedetect
  2816. Detect silence in an audio stream.
  2817. This filter logs a message when it detects that the input audio volume is less
  2818. or equal to a noise tolerance value for a duration greater or equal to the
  2819. minimum detected noise duration.
  2820. The printed times and duration are expressed in seconds.
  2821. The filter accepts the following options:
  2822. @table @option
  2823. @item duration, d
  2824. Set silence duration until notification (default is 2 seconds).
  2825. @item noise, n
  2826. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2827. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2828. @end table
  2829. @subsection Examples
  2830. @itemize
  2831. @item
  2832. Detect 5 seconds of silence with -50dB noise tolerance:
  2833. @example
  2834. silencedetect=n=-50dB:d=5
  2835. @end example
  2836. @item
  2837. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2838. tolerance in @file{silence.mp3}:
  2839. @example
  2840. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2841. @end example
  2842. @end itemize
  2843. @section silenceremove
  2844. Remove silence from the beginning, middle or end of the audio.
  2845. The filter accepts the following options:
  2846. @table @option
  2847. @item start_periods
  2848. This value is used to indicate if audio should be trimmed at beginning of
  2849. the audio. A value of zero indicates no silence should be trimmed from the
  2850. beginning. When specifying a non-zero value, it trims audio up until it
  2851. finds non-silence. Normally, when trimming silence from beginning of audio
  2852. the @var{start_periods} will be @code{1} but it can be increased to higher
  2853. values to trim all audio up to specific count of non-silence periods.
  2854. Default value is @code{0}.
  2855. @item start_duration
  2856. Specify the amount of time that non-silence must be detected before it stops
  2857. trimming audio. By increasing the duration, bursts of noises can be treated
  2858. as silence and trimmed off. Default value is @code{0}.
  2859. @item start_threshold
  2860. This indicates what sample value should be treated as silence. For digital
  2861. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2862. you may wish to increase the value to account for background noise.
  2863. Can be specified in dB (in case "dB" is appended to the specified value)
  2864. or amplitude ratio. Default value is @code{0}.
  2865. @item stop_periods
  2866. Set the count for trimming silence from the end of audio.
  2867. To remove silence from the middle of a file, specify a @var{stop_periods}
  2868. that is negative. This value is then treated as a positive value and is
  2869. used to indicate the effect should restart processing as specified by
  2870. @var{start_periods}, making it suitable for removing periods of silence
  2871. in the middle of the audio.
  2872. Default value is @code{0}.
  2873. @item stop_duration
  2874. Specify a duration of silence that must exist before audio is not copied any
  2875. more. By specifying a higher duration, silence that is wanted can be left in
  2876. the audio.
  2877. Default value is @code{0}.
  2878. @item stop_threshold
  2879. This is the same as @option{start_threshold} but for trimming silence from
  2880. the end of audio.
  2881. Can be specified in dB (in case "dB" is appended to the specified value)
  2882. or amplitude ratio. Default value is @code{0}.
  2883. @item leave_silence
  2884. This indicates that @var{stop_duration} length of audio should be left intact
  2885. at the beginning of each period of silence.
  2886. For example, if you want to remove long pauses between words but do not want
  2887. to remove the pauses completely. Default value is @code{0}.
  2888. @item detection
  2889. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2890. and works better with digital silence which is exactly 0.
  2891. Default value is @code{rms}.
  2892. @item window
  2893. Set ratio used to calculate size of window for detecting silence.
  2894. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2895. @end table
  2896. @subsection Examples
  2897. @itemize
  2898. @item
  2899. The following example shows how this filter can be used to start a recording
  2900. that does not contain the delay at the start which usually occurs between
  2901. pressing the record button and the start of the performance:
  2902. @example
  2903. silenceremove=1:5:0.02
  2904. @end example
  2905. @item
  2906. Trim all silence encountered from beginning to end where there is more than 1
  2907. second of silence in audio:
  2908. @example
  2909. silenceremove=0:0:0:-1:1:-90dB
  2910. @end example
  2911. @end itemize
  2912. @section sofalizer
  2913. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2914. loudspeakers around the user for binaural listening via headphones (audio
  2915. formats up to 9 channels supported).
  2916. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2917. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2918. Austrian Academy of Sciences.
  2919. To enable compilation of this filter you need to configure FFmpeg with
  2920. @code{--enable-libmysofa}.
  2921. The filter accepts the following options:
  2922. @table @option
  2923. @item sofa
  2924. Set the SOFA file used for rendering.
  2925. @item gain
  2926. Set gain applied to audio. Value is in dB. Default is 0.
  2927. @item rotation
  2928. Set rotation of virtual loudspeakers in deg. Default is 0.
  2929. @item elevation
  2930. Set elevation of virtual speakers in deg. Default is 0.
  2931. @item radius
  2932. Set distance in meters between loudspeakers and the listener with near-field
  2933. HRTFs. Default is 1.
  2934. @item type
  2935. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2936. processing audio in time domain which is slow.
  2937. @var{freq} is processing audio in frequency domain which is fast.
  2938. Default is @var{freq}.
  2939. @item speakers
  2940. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2941. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2942. Each virtual loudspeaker is described with short channel name following with
  2943. azimuth and elevation in degrees.
  2944. Each virtual loudspeaker description is separated by '|'.
  2945. For example to override front left and front right channel positions use:
  2946. 'speakers=FL 45 15|FR 345 15'.
  2947. Descriptions with unrecognised channel names are ignored.
  2948. @item lfegain
  2949. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2950. @end table
  2951. @subsection Examples
  2952. @itemize
  2953. @item
  2954. Using ClubFritz6 sofa file:
  2955. @example
  2956. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2957. @end example
  2958. @item
  2959. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2960. @example
  2961. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2962. @end example
  2963. @item
  2964. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2965. and also with custom gain:
  2966. @example
  2967. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2968. @end example
  2969. @end itemize
  2970. @section stereotools
  2971. This filter has some handy utilities to manage stereo signals, for converting
  2972. M/S stereo recordings to L/R signal while having control over the parameters
  2973. or spreading the stereo image of master track.
  2974. The filter accepts the following options:
  2975. @table @option
  2976. @item level_in
  2977. Set input level before filtering for both channels. Defaults is 1.
  2978. Allowed range is from 0.015625 to 64.
  2979. @item level_out
  2980. Set output level after filtering for both channels. Defaults is 1.
  2981. Allowed range is from 0.015625 to 64.
  2982. @item balance_in
  2983. Set input balance between both channels. Default is 0.
  2984. Allowed range is from -1 to 1.
  2985. @item balance_out
  2986. Set output balance between both channels. Default is 0.
  2987. Allowed range is from -1 to 1.
  2988. @item softclip
  2989. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2990. clipping. Disabled by default.
  2991. @item mutel
  2992. Mute the left channel. Disabled by default.
  2993. @item muter
  2994. Mute the right channel. Disabled by default.
  2995. @item phasel
  2996. Change the phase of the left channel. Disabled by default.
  2997. @item phaser
  2998. Change the phase of the right channel. Disabled by default.
  2999. @item mode
  3000. Set stereo mode. Available values are:
  3001. @table @samp
  3002. @item lr>lr
  3003. Left/Right to Left/Right, this is default.
  3004. @item lr>ms
  3005. Left/Right to Mid/Side.
  3006. @item ms>lr
  3007. Mid/Side to Left/Right.
  3008. @item lr>ll
  3009. Left/Right to Left/Left.
  3010. @item lr>rr
  3011. Left/Right to Right/Right.
  3012. @item lr>l+r
  3013. Left/Right to Left + Right.
  3014. @item lr>rl
  3015. Left/Right to Right/Left.
  3016. @item ms>ll
  3017. Mid/Side to Left/Left.
  3018. @item ms>rr
  3019. Mid/Side to Right/Right.
  3020. @end table
  3021. @item slev
  3022. Set level of side signal. Default is 1.
  3023. Allowed range is from 0.015625 to 64.
  3024. @item sbal
  3025. Set balance of side signal. Default is 0.
  3026. Allowed range is from -1 to 1.
  3027. @item mlev
  3028. Set level of the middle signal. Default is 1.
  3029. Allowed range is from 0.015625 to 64.
  3030. @item mpan
  3031. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3032. @item base
  3033. Set stereo base between mono and inversed channels. Default is 0.
  3034. Allowed range is from -1 to 1.
  3035. @item delay
  3036. Set delay in milliseconds how much to delay left from right channel and
  3037. vice versa. Default is 0. Allowed range is from -20 to 20.
  3038. @item sclevel
  3039. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3040. @item phase
  3041. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3042. @item bmode_in, bmode_out
  3043. Set balance mode for balance_in/balance_out option.
  3044. Can be one of the following:
  3045. @table @samp
  3046. @item balance
  3047. Classic balance mode. Attenuate one channel at time.
  3048. Gain is raised up to 1.
  3049. @item amplitude
  3050. Similar as classic mode above but gain is raised up to 2.
  3051. @item power
  3052. Equal power distribution, from -6dB to +6dB range.
  3053. @end table
  3054. @end table
  3055. @subsection Examples
  3056. @itemize
  3057. @item
  3058. Apply karaoke like effect:
  3059. @example
  3060. stereotools=mlev=0.015625
  3061. @end example
  3062. @item
  3063. Convert M/S signal to L/R:
  3064. @example
  3065. "stereotools=mode=ms>lr"
  3066. @end example
  3067. @end itemize
  3068. @section stereowiden
  3069. This filter enhance the stereo effect by suppressing signal common to both
  3070. channels and by delaying the signal of left into right and vice versa,
  3071. thereby widening the stereo effect.
  3072. The filter accepts the following options:
  3073. @table @option
  3074. @item delay
  3075. Time in milliseconds of the delay of left signal into right and vice versa.
  3076. Default is 20 milliseconds.
  3077. @item feedback
  3078. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3079. effect of left signal in right output and vice versa which gives widening
  3080. effect. Default is 0.3.
  3081. @item crossfeed
  3082. Cross feed of left into right with inverted phase. This helps in suppressing
  3083. the mono. If the value is 1 it will cancel all the signal common to both
  3084. channels. Default is 0.3.
  3085. @item drymix
  3086. Set level of input signal of original channel. Default is 0.8.
  3087. @end table
  3088. @section superequalizer
  3089. Apply 18 band equalizer.
  3090. The filter accepts the following options:
  3091. @table @option
  3092. @item 1b
  3093. Set 65Hz band gain.
  3094. @item 2b
  3095. Set 92Hz band gain.
  3096. @item 3b
  3097. Set 131Hz band gain.
  3098. @item 4b
  3099. Set 185Hz band gain.
  3100. @item 5b
  3101. Set 262Hz band gain.
  3102. @item 6b
  3103. Set 370Hz band gain.
  3104. @item 7b
  3105. Set 523Hz band gain.
  3106. @item 8b
  3107. Set 740Hz band gain.
  3108. @item 9b
  3109. Set 1047Hz band gain.
  3110. @item 10b
  3111. Set 1480Hz band gain.
  3112. @item 11b
  3113. Set 2093Hz band gain.
  3114. @item 12b
  3115. Set 2960Hz band gain.
  3116. @item 13b
  3117. Set 4186Hz band gain.
  3118. @item 14b
  3119. Set 5920Hz band gain.
  3120. @item 15b
  3121. Set 8372Hz band gain.
  3122. @item 16b
  3123. Set 11840Hz band gain.
  3124. @item 17b
  3125. Set 16744Hz band gain.
  3126. @item 18b
  3127. Set 20000Hz band gain.
  3128. @end table
  3129. @section surround
  3130. Apply audio surround upmix filter.
  3131. This filter allows to produce multichannel output from audio stream.
  3132. The filter accepts the following options:
  3133. @table @option
  3134. @item chl_out
  3135. Set output channel layout. By default, this is @var{5.1}.
  3136. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3137. for the required syntax.
  3138. @item chl_in
  3139. Set input channel layout. By default, this is @var{stereo}.
  3140. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3141. for the required syntax.
  3142. @item level_in
  3143. Set input volume level. By default, this is @var{1}.
  3144. @item level_out
  3145. Set output volume level. By default, this is @var{1}.
  3146. @item lfe
  3147. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3148. @item lfe_low
  3149. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3150. @item lfe_high
  3151. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3152. @item fc_in
  3153. Set front center input volume. By default, this is @var{1}.
  3154. @item fc_out
  3155. Set front center output volume. By default, this is @var{1}.
  3156. @item lfe_in
  3157. Set LFE input volume. By default, this is @var{1}.
  3158. @item lfe_out
  3159. Set LFE output volume. By default, this is @var{1}.
  3160. @end table
  3161. @section treble
  3162. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3163. shelving filter with a response similar to that of a standard
  3164. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3165. The filter accepts the following options:
  3166. @table @option
  3167. @item gain, g
  3168. Give the gain at whichever is the lower of ~22 kHz and the
  3169. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3170. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3171. @item frequency, f
  3172. Set the filter's central frequency and so can be used
  3173. to extend or reduce the frequency range to be boosted or cut.
  3174. The default value is @code{3000} Hz.
  3175. @item width_type, t
  3176. Set method to specify band-width of filter.
  3177. @table @option
  3178. @item h
  3179. Hz
  3180. @item q
  3181. Q-Factor
  3182. @item o
  3183. octave
  3184. @item s
  3185. slope
  3186. @end table
  3187. @item width, w
  3188. Determine how steep is the filter's shelf transition.
  3189. @item channels, c
  3190. Specify which channels to filter, by default all available are filtered.
  3191. @end table
  3192. @section tremolo
  3193. Sinusoidal amplitude modulation.
  3194. The filter accepts the following options:
  3195. @table @option
  3196. @item f
  3197. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3198. (20 Hz or lower) will result in a tremolo effect.
  3199. This filter may also be used as a ring modulator by specifying
  3200. a modulation frequency higher than 20 Hz.
  3201. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3202. @item d
  3203. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3204. Default value is 0.5.
  3205. @end table
  3206. @section vibrato
  3207. Sinusoidal phase modulation.
  3208. The filter accepts the following options:
  3209. @table @option
  3210. @item f
  3211. Modulation frequency in Hertz.
  3212. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3213. @item d
  3214. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3215. Default value is 0.5.
  3216. @end table
  3217. @section volume
  3218. Adjust the input audio volume.
  3219. It accepts the following parameters:
  3220. @table @option
  3221. @item volume
  3222. Set audio volume expression.
  3223. Output values are clipped to the maximum value.
  3224. The output audio volume is given by the relation:
  3225. @example
  3226. @var{output_volume} = @var{volume} * @var{input_volume}
  3227. @end example
  3228. The default value for @var{volume} is "1.0".
  3229. @item precision
  3230. This parameter represents the mathematical precision.
  3231. It determines which input sample formats will be allowed, which affects the
  3232. precision of the volume scaling.
  3233. @table @option
  3234. @item fixed
  3235. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3236. @item float
  3237. 32-bit floating-point; this limits input sample format to FLT. (default)
  3238. @item double
  3239. 64-bit floating-point; this limits input sample format to DBL.
  3240. @end table
  3241. @item replaygain
  3242. Choose the behaviour on encountering ReplayGain side data in input frames.
  3243. @table @option
  3244. @item drop
  3245. Remove ReplayGain side data, ignoring its contents (the default).
  3246. @item ignore
  3247. Ignore ReplayGain side data, but leave it in the frame.
  3248. @item track
  3249. Prefer the track gain, if present.
  3250. @item album
  3251. Prefer the album gain, if present.
  3252. @end table
  3253. @item replaygain_preamp
  3254. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3255. Default value for @var{replaygain_preamp} is 0.0.
  3256. @item eval
  3257. Set when the volume expression is evaluated.
  3258. It accepts the following values:
  3259. @table @samp
  3260. @item once
  3261. only evaluate expression once during the filter initialization, or
  3262. when the @samp{volume} command is sent
  3263. @item frame
  3264. evaluate expression for each incoming frame
  3265. @end table
  3266. Default value is @samp{once}.
  3267. @end table
  3268. The volume expression can contain the following parameters.
  3269. @table @option
  3270. @item n
  3271. frame number (starting at zero)
  3272. @item nb_channels
  3273. number of channels
  3274. @item nb_consumed_samples
  3275. number of samples consumed by the filter
  3276. @item nb_samples
  3277. number of samples in the current frame
  3278. @item pos
  3279. original frame position in the file
  3280. @item pts
  3281. frame PTS
  3282. @item sample_rate
  3283. sample rate
  3284. @item startpts
  3285. PTS at start of stream
  3286. @item startt
  3287. time at start of stream
  3288. @item t
  3289. frame time
  3290. @item tb
  3291. timestamp timebase
  3292. @item volume
  3293. last set volume value
  3294. @end table
  3295. Note that when @option{eval} is set to @samp{once} only the
  3296. @var{sample_rate} and @var{tb} variables are available, all other
  3297. variables will evaluate to NAN.
  3298. @subsection Commands
  3299. This filter supports the following commands:
  3300. @table @option
  3301. @item volume
  3302. Modify the volume expression.
  3303. The command accepts the same syntax of the corresponding option.
  3304. If the specified expression is not valid, it is kept at its current
  3305. value.
  3306. @item replaygain_noclip
  3307. Prevent clipping by limiting the gain applied.
  3308. Default value for @var{replaygain_noclip} is 1.
  3309. @end table
  3310. @subsection Examples
  3311. @itemize
  3312. @item
  3313. Halve the input audio volume:
  3314. @example
  3315. volume=volume=0.5
  3316. volume=volume=1/2
  3317. volume=volume=-6.0206dB
  3318. @end example
  3319. In all the above example the named key for @option{volume} can be
  3320. omitted, for example like in:
  3321. @example
  3322. volume=0.5
  3323. @end example
  3324. @item
  3325. Increase input audio power by 6 decibels using fixed-point precision:
  3326. @example
  3327. volume=volume=6dB:precision=fixed
  3328. @end example
  3329. @item
  3330. Fade volume after time 10 with an annihilation period of 5 seconds:
  3331. @example
  3332. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3333. @end example
  3334. @end itemize
  3335. @section volumedetect
  3336. Detect the volume of the input video.
  3337. The filter has no parameters. The input is not modified. Statistics about
  3338. the volume will be printed in the log when the input stream end is reached.
  3339. In particular it will show the mean volume (root mean square), maximum
  3340. volume (on a per-sample basis), and the beginning of a histogram of the
  3341. registered volume values (from the maximum value to a cumulated 1/1000 of
  3342. the samples).
  3343. All volumes are in decibels relative to the maximum PCM value.
  3344. @subsection Examples
  3345. Here is an excerpt of the output:
  3346. @example
  3347. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3348. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3349. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3350. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3351. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3352. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3353. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3354. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3355. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3356. @end example
  3357. It means that:
  3358. @itemize
  3359. @item
  3360. The mean square energy is approximately -27 dB, or 10^-2.7.
  3361. @item
  3362. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3363. @item
  3364. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3365. @end itemize
  3366. In other words, raising the volume by +4 dB does not cause any clipping,
  3367. raising it by +5 dB causes clipping for 6 samples, etc.
  3368. @c man end AUDIO FILTERS
  3369. @chapter Audio Sources
  3370. @c man begin AUDIO SOURCES
  3371. Below is a description of the currently available audio sources.
  3372. @section abuffer
  3373. Buffer audio frames, and make them available to the filter chain.
  3374. This source is mainly intended for a programmatic use, in particular
  3375. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3376. It accepts the following parameters:
  3377. @table @option
  3378. @item time_base
  3379. The timebase which will be used for timestamps of submitted frames. It must be
  3380. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3381. @item sample_rate
  3382. The sample rate of the incoming audio buffers.
  3383. @item sample_fmt
  3384. The sample format of the incoming audio buffers.
  3385. Either a sample format name or its corresponding integer representation from
  3386. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3387. @item channel_layout
  3388. The channel layout of the incoming audio buffers.
  3389. Either a channel layout name from channel_layout_map in
  3390. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3391. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3392. @item channels
  3393. The number of channels of the incoming audio buffers.
  3394. If both @var{channels} and @var{channel_layout} are specified, then they
  3395. must be consistent.
  3396. @end table
  3397. @subsection Examples
  3398. @example
  3399. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3400. @end example
  3401. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3402. Since the sample format with name "s16p" corresponds to the number
  3403. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3404. equivalent to:
  3405. @example
  3406. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3407. @end example
  3408. @section aevalsrc
  3409. Generate an audio signal specified by an expression.
  3410. This source accepts in input one or more expressions (one for each
  3411. channel), which are evaluated and used to generate a corresponding
  3412. audio signal.
  3413. This source accepts the following options:
  3414. @table @option
  3415. @item exprs
  3416. Set the '|'-separated expressions list for each separate channel. In case the
  3417. @option{channel_layout} option is not specified, the selected channel layout
  3418. depends on the number of provided expressions. Otherwise the last
  3419. specified expression is applied to the remaining output channels.
  3420. @item channel_layout, c
  3421. Set the channel layout. The number of channels in the specified layout
  3422. must be equal to the number of specified expressions.
  3423. @item duration, d
  3424. Set the minimum duration of the sourced audio. See
  3425. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3426. for the accepted syntax.
  3427. Note that the resulting duration may be greater than the specified
  3428. duration, as the generated audio is always cut at the end of a
  3429. complete frame.
  3430. If not specified, or the expressed duration is negative, the audio is
  3431. supposed to be generated forever.
  3432. @item nb_samples, n
  3433. Set the number of samples per channel per each output frame,
  3434. default to 1024.
  3435. @item sample_rate, s
  3436. Specify the sample rate, default to 44100.
  3437. @end table
  3438. Each expression in @var{exprs} can contain the following constants:
  3439. @table @option
  3440. @item n
  3441. number of the evaluated sample, starting from 0
  3442. @item t
  3443. time of the evaluated sample expressed in seconds, starting from 0
  3444. @item s
  3445. sample rate
  3446. @end table
  3447. @subsection Examples
  3448. @itemize
  3449. @item
  3450. Generate silence:
  3451. @example
  3452. aevalsrc=0
  3453. @end example
  3454. @item
  3455. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3456. 8000 Hz:
  3457. @example
  3458. aevalsrc="sin(440*2*PI*t):s=8000"
  3459. @end example
  3460. @item
  3461. Generate a two channels signal, specify the channel layout (Front
  3462. Center + Back Center) explicitly:
  3463. @example
  3464. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3465. @end example
  3466. @item
  3467. Generate white noise:
  3468. @example
  3469. aevalsrc="-2+random(0)"
  3470. @end example
  3471. @item
  3472. Generate an amplitude modulated signal:
  3473. @example
  3474. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3475. @end example
  3476. @item
  3477. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3478. @example
  3479. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3480. @end example
  3481. @end itemize
  3482. @section anullsrc
  3483. The null audio source, return unprocessed audio frames. It is mainly useful
  3484. as a template and to be employed in analysis / debugging tools, or as
  3485. the source for filters which ignore the input data (for example the sox
  3486. synth filter).
  3487. This source accepts the following options:
  3488. @table @option
  3489. @item channel_layout, cl
  3490. Specifies the channel layout, and can be either an integer or a string
  3491. representing a channel layout. The default value of @var{channel_layout}
  3492. is "stereo".
  3493. Check the channel_layout_map definition in
  3494. @file{libavutil/channel_layout.c} for the mapping between strings and
  3495. channel layout values.
  3496. @item sample_rate, r
  3497. Specifies the sample rate, and defaults to 44100.
  3498. @item nb_samples, n
  3499. Set the number of samples per requested frames.
  3500. @end table
  3501. @subsection Examples
  3502. @itemize
  3503. @item
  3504. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3505. @example
  3506. anullsrc=r=48000:cl=4
  3507. @end example
  3508. @item
  3509. Do the same operation with a more obvious syntax:
  3510. @example
  3511. anullsrc=r=48000:cl=mono
  3512. @end example
  3513. @end itemize
  3514. All the parameters need to be explicitly defined.
  3515. @section flite
  3516. Synthesize a voice utterance using the libflite library.
  3517. To enable compilation of this filter you need to configure FFmpeg with
  3518. @code{--enable-libflite}.
  3519. Note that the flite library is not thread-safe.
  3520. The filter accepts the following options:
  3521. @table @option
  3522. @item list_voices
  3523. If set to 1, list the names of the available voices and exit
  3524. immediately. Default value is 0.
  3525. @item nb_samples, n
  3526. Set the maximum number of samples per frame. Default value is 512.
  3527. @item textfile
  3528. Set the filename containing the text to speak.
  3529. @item text
  3530. Set the text to speak.
  3531. @item voice, v
  3532. Set the voice to use for the speech synthesis. Default value is
  3533. @code{kal}. See also the @var{list_voices} option.
  3534. @end table
  3535. @subsection Examples
  3536. @itemize
  3537. @item
  3538. Read from file @file{speech.txt}, and synthesize the text using the
  3539. standard flite voice:
  3540. @example
  3541. flite=textfile=speech.txt
  3542. @end example
  3543. @item
  3544. Read the specified text selecting the @code{slt} voice:
  3545. @example
  3546. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3547. @end example
  3548. @item
  3549. Input text to ffmpeg:
  3550. @example
  3551. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3552. @end example
  3553. @item
  3554. Make @file{ffplay} speak the specified text, using @code{flite} and
  3555. the @code{lavfi} device:
  3556. @example
  3557. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3558. @end example
  3559. @end itemize
  3560. For more information about libflite, check:
  3561. @url{http://www.speech.cs.cmu.edu/flite/}
  3562. @section anoisesrc
  3563. Generate a noise audio signal.
  3564. The filter accepts the following options:
  3565. @table @option
  3566. @item sample_rate, r
  3567. Specify the sample rate. Default value is 48000 Hz.
  3568. @item amplitude, a
  3569. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3570. is 1.0.
  3571. @item duration, d
  3572. Specify the duration of the generated audio stream. Not specifying this option
  3573. results in noise with an infinite length.
  3574. @item color, colour, c
  3575. Specify the color of noise. Available noise colors are white, pink, brown,
  3576. blue and violet. Default color is white.
  3577. @item seed, s
  3578. Specify a value used to seed the PRNG.
  3579. @item nb_samples, n
  3580. Set the number of samples per each output frame, default is 1024.
  3581. @end table
  3582. @subsection Examples
  3583. @itemize
  3584. @item
  3585. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3586. @example
  3587. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3588. @end example
  3589. @end itemize
  3590. @section sine
  3591. Generate an audio signal made of a sine wave with amplitude 1/8.
  3592. The audio signal is bit-exact.
  3593. The filter accepts the following options:
  3594. @table @option
  3595. @item frequency, f
  3596. Set the carrier frequency. Default is 440 Hz.
  3597. @item beep_factor, b
  3598. Enable a periodic beep every second with frequency @var{beep_factor} times
  3599. the carrier frequency. Default is 0, meaning the beep is disabled.
  3600. @item sample_rate, r
  3601. Specify the sample rate, default is 44100.
  3602. @item duration, d
  3603. Specify the duration of the generated audio stream.
  3604. @item samples_per_frame
  3605. Set the number of samples per output frame.
  3606. The expression can contain the following constants:
  3607. @table @option
  3608. @item n
  3609. The (sequential) number of the output audio frame, starting from 0.
  3610. @item pts
  3611. The PTS (Presentation TimeStamp) of the output audio frame,
  3612. expressed in @var{TB} units.
  3613. @item t
  3614. The PTS of the output audio frame, expressed in seconds.
  3615. @item TB
  3616. The timebase of the output audio frames.
  3617. @end table
  3618. Default is @code{1024}.
  3619. @end table
  3620. @subsection Examples
  3621. @itemize
  3622. @item
  3623. Generate a simple 440 Hz sine wave:
  3624. @example
  3625. sine
  3626. @end example
  3627. @item
  3628. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3629. @example
  3630. sine=220:4:d=5
  3631. sine=f=220:b=4:d=5
  3632. sine=frequency=220:beep_factor=4:duration=5
  3633. @end example
  3634. @item
  3635. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3636. pattern:
  3637. @example
  3638. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3639. @end example
  3640. @end itemize
  3641. @c man end AUDIO SOURCES
  3642. @chapter Audio Sinks
  3643. @c man begin AUDIO SINKS
  3644. Below is a description of the currently available audio sinks.
  3645. @section abuffersink
  3646. Buffer audio frames, and make them available to the end of filter chain.
  3647. This sink is mainly intended for programmatic use, in particular
  3648. through the interface defined in @file{libavfilter/buffersink.h}
  3649. or the options system.
  3650. It accepts a pointer to an AVABufferSinkContext structure, which
  3651. defines the incoming buffers' formats, to be passed as the opaque
  3652. parameter to @code{avfilter_init_filter} for initialization.
  3653. @section anullsink
  3654. Null audio sink; do absolutely nothing with the input audio. It is
  3655. mainly useful as a template and for use in analysis / debugging
  3656. tools.
  3657. @c man end AUDIO SINKS
  3658. @chapter Video Filters
  3659. @c man begin VIDEO FILTERS
  3660. When you configure your FFmpeg build, you can disable any of the
  3661. existing filters using @code{--disable-filters}.
  3662. The configure output will show the video filters included in your
  3663. build.
  3664. Below is a description of the currently available video filters.
  3665. @section alphaextract
  3666. Extract the alpha component from the input as a grayscale video. This
  3667. is especially useful with the @var{alphamerge} filter.
  3668. @section alphamerge
  3669. Add or replace the alpha component of the primary input with the
  3670. grayscale value of a second input. This is intended for use with
  3671. @var{alphaextract} to allow the transmission or storage of frame
  3672. sequences that have alpha in a format that doesn't support an alpha
  3673. channel.
  3674. For example, to reconstruct full frames from a normal YUV-encoded video
  3675. and a separate video created with @var{alphaextract}, you might use:
  3676. @example
  3677. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3678. @end example
  3679. Since this filter is designed for reconstruction, it operates on frame
  3680. sequences without considering timestamps, and terminates when either
  3681. input reaches end of stream. This will cause problems if your encoding
  3682. pipeline drops frames. If you're trying to apply an image as an
  3683. overlay to a video stream, consider the @var{overlay} filter instead.
  3684. @section ass
  3685. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3686. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3687. Substation Alpha) subtitles files.
  3688. This filter accepts the following option in addition to the common options from
  3689. the @ref{subtitles} filter:
  3690. @table @option
  3691. @item shaping
  3692. Set the shaping engine
  3693. Available values are:
  3694. @table @samp
  3695. @item auto
  3696. The default libass shaping engine, which is the best available.
  3697. @item simple
  3698. Fast, font-agnostic shaper that can do only substitutions
  3699. @item complex
  3700. Slower shaper using OpenType for substitutions and positioning
  3701. @end table
  3702. The default is @code{auto}.
  3703. @end table
  3704. @section atadenoise
  3705. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3706. The filter accepts the following options:
  3707. @table @option
  3708. @item 0a
  3709. Set threshold A for 1st plane. Default is 0.02.
  3710. Valid range is 0 to 0.3.
  3711. @item 0b
  3712. Set threshold B for 1st plane. Default is 0.04.
  3713. Valid range is 0 to 5.
  3714. @item 1a
  3715. Set threshold A for 2nd plane. Default is 0.02.
  3716. Valid range is 0 to 0.3.
  3717. @item 1b
  3718. Set threshold B for 2nd plane. Default is 0.04.
  3719. Valid range is 0 to 5.
  3720. @item 2a
  3721. Set threshold A for 3rd plane. Default is 0.02.
  3722. Valid range is 0 to 0.3.
  3723. @item 2b
  3724. Set threshold B for 3rd plane. Default is 0.04.
  3725. Valid range is 0 to 5.
  3726. Threshold A is designed to react on abrupt changes in the input signal and
  3727. threshold B is designed to react on continuous changes in the input signal.
  3728. @item s
  3729. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3730. number in range [5, 129].
  3731. @item p
  3732. Set what planes of frame filter will use for averaging. Default is all.
  3733. @end table
  3734. @section avgblur
  3735. Apply average blur filter.
  3736. The filter accepts the following options:
  3737. @table @option
  3738. @item sizeX
  3739. Set horizontal kernel size.
  3740. @item planes
  3741. Set which planes to filter. By default all planes are filtered.
  3742. @item sizeY
  3743. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3744. Default is @code{0}.
  3745. @end table
  3746. @section bbox
  3747. Compute the bounding box for the non-black pixels in the input frame
  3748. luminance plane.
  3749. This filter computes the bounding box containing all the pixels with a
  3750. luminance value greater than the minimum allowed value.
  3751. The parameters describing the bounding box are printed on the filter
  3752. log.
  3753. The filter accepts the following option:
  3754. @table @option
  3755. @item min_val
  3756. Set the minimal luminance value. Default is @code{16}.
  3757. @end table
  3758. @section bitplanenoise
  3759. Show and measure bit plane noise.
  3760. The filter accepts the following options:
  3761. @table @option
  3762. @item bitplane
  3763. Set which plane to analyze. Default is @code{1}.
  3764. @item filter
  3765. Filter out noisy pixels from @code{bitplane} set above.
  3766. Default is disabled.
  3767. @end table
  3768. @section blackdetect
  3769. Detect video intervals that are (almost) completely black. Can be
  3770. useful to detect chapter transitions, commercials, or invalid
  3771. recordings. Output lines contains the time for the start, end and
  3772. duration of the detected black interval expressed in seconds.
  3773. In order to display the output lines, you need to set the loglevel at
  3774. least to the AV_LOG_INFO value.
  3775. The filter accepts the following options:
  3776. @table @option
  3777. @item black_min_duration, d
  3778. Set the minimum detected black duration expressed in seconds. It must
  3779. be a non-negative floating point number.
  3780. Default value is 2.0.
  3781. @item picture_black_ratio_th, pic_th
  3782. Set the threshold for considering a picture "black".
  3783. Express the minimum value for the ratio:
  3784. @example
  3785. @var{nb_black_pixels} / @var{nb_pixels}
  3786. @end example
  3787. for which a picture is considered black.
  3788. Default value is 0.98.
  3789. @item pixel_black_th, pix_th
  3790. Set the threshold for considering a pixel "black".
  3791. The threshold expresses the maximum pixel luminance value for which a
  3792. pixel is considered "black". The provided value is scaled according to
  3793. the following equation:
  3794. @example
  3795. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3796. @end example
  3797. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3798. the input video format, the range is [0-255] for YUV full-range
  3799. formats and [16-235] for YUV non full-range formats.
  3800. Default value is 0.10.
  3801. @end table
  3802. The following example sets the maximum pixel threshold to the minimum
  3803. value, and detects only black intervals of 2 or more seconds:
  3804. @example
  3805. blackdetect=d=2:pix_th=0.00
  3806. @end example
  3807. @section blackframe
  3808. Detect frames that are (almost) completely black. Can be useful to
  3809. detect chapter transitions or commercials. Output lines consist of
  3810. the frame number of the detected frame, the percentage of blackness,
  3811. the position in the file if known or -1 and the timestamp in seconds.
  3812. In order to display the output lines, you need to set the loglevel at
  3813. least to the AV_LOG_INFO value.
  3814. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3815. The value represents the percentage of pixels in the picture that
  3816. are below the threshold value.
  3817. It accepts the following parameters:
  3818. @table @option
  3819. @item amount
  3820. The percentage of the pixels that have to be below the threshold; it defaults to
  3821. @code{98}.
  3822. @item threshold, thresh
  3823. The threshold below which a pixel value is considered black; it defaults to
  3824. @code{32}.
  3825. @end table
  3826. @section blend, tblend
  3827. Blend two video frames into each other.
  3828. The @code{blend} filter takes two input streams and outputs one
  3829. stream, the first input is the "top" layer and second input is
  3830. "bottom" layer. By default, the output terminates when the longest input terminates.
  3831. The @code{tblend} (time blend) filter takes two consecutive frames
  3832. from one single stream, and outputs the result obtained by blending
  3833. the new frame on top of the old frame.
  3834. A description of the accepted options follows.
  3835. @table @option
  3836. @item c0_mode
  3837. @item c1_mode
  3838. @item c2_mode
  3839. @item c3_mode
  3840. @item all_mode
  3841. Set blend mode for specific pixel component or all pixel components in case
  3842. of @var{all_mode}. Default value is @code{normal}.
  3843. Available values for component modes are:
  3844. @table @samp
  3845. @item addition
  3846. @item grainmerge
  3847. @item and
  3848. @item average
  3849. @item burn
  3850. @item darken
  3851. @item difference
  3852. @item grainextract
  3853. @item divide
  3854. @item dodge
  3855. @item freeze
  3856. @item exclusion
  3857. @item extremity
  3858. @item glow
  3859. @item hardlight
  3860. @item hardmix
  3861. @item heat
  3862. @item lighten
  3863. @item linearlight
  3864. @item multiply
  3865. @item multiply128
  3866. @item negation
  3867. @item normal
  3868. @item or
  3869. @item overlay
  3870. @item phoenix
  3871. @item pinlight
  3872. @item reflect
  3873. @item screen
  3874. @item softlight
  3875. @item subtract
  3876. @item vividlight
  3877. @item xor
  3878. @end table
  3879. @item c0_opacity
  3880. @item c1_opacity
  3881. @item c2_opacity
  3882. @item c3_opacity
  3883. @item all_opacity
  3884. Set blend opacity for specific pixel component or all pixel components in case
  3885. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3886. @item c0_expr
  3887. @item c1_expr
  3888. @item c2_expr
  3889. @item c3_expr
  3890. @item all_expr
  3891. Set blend expression for specific pixel component or all pixel components in case
  3892. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3893. The expressions can use the following variables:
  3894. @table @option
  3895. @item N
  3896. The sequential number of the filtered frame, starting from @code{0}.
  3897. @item X
  3898. @item Y
  3899. the coordinates of the current sample
  3900. @item W
  3901. @item H
  3902. the width and height of currently filtered plane
  3903. @item SW
  3904. @item SH
  3905. Width and height scale depending on the currently filtered plane. It is the
  3906. ratio between the corresponding luma plane number of pixels and the current
  3907. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3908. @code{0.5,0.5} for chroma planes.
  3909. @item T
  3910. Time of the current frame, expressed in seconds.
  3911. @item TOP, A
  3912. Value of pixel component at current location for first video frame (top layer).
  3913. @item BOTTOM, B
  3914. Value of pixel component at current location for second video frame (bottom layer).
  3915. @end table
  3916. @end table
  3917. The @code{blend} filter also supports the @ref{framesync} options.
  3918. @subsection Examples
  3919. @itemize
  3920. @item
  3921. Apply transition from bottom layer to top layer in first 10 seconds:
  3922. @example
  3923. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3924. @end example
  3925. @item
  3926. Apply linear horizontal transition from top layer to bottom layer:
  3927. @example
  3928. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3929. @end example
  3930. @item
  3931. Apply 1x1 checkerboard effect:
  3932. @example
  3933. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3934. @end example
  3935. @item
  3936. Apply uncover left effect:
  3937. @example
  3938. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3939. @end example
  3940. @item
  3941. Apply uncover down effect:
  3942. @example
  3943. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3944. @end example
  3945. @item
  3946. Apply uncover up-left effect:
  3947. @example
  3948. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3949. @end example
  3950. @item
  3951. Split diagonally video and shows top and bottom layer on each side:
  3952. @example
  3953. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3954. @end example
  3955. @item
  3956. Display differences between the current and the previous frame:
  3957. @example
  3958. tblend=all_mode=grainextract
  3959. @end example
  3960. @end itemize
  3961. @section boxblur
  3962. Apply a boxblur algorithm to the input video.
  3963. It accepts the following parameters:
  3964. @table @option
  3965. @item luma_radius, lr
  3966. @item luma_power, lp
  3967. @item chroma_radius, cr
  3968. @item chroma_power, cp
  3969. @item alpha_radius, ar
  3970. @item alpha_power, ap
  3971. @end table
  3972. A description of the accepted options follows.
  3973. @table @option
  3974. @item luma_radius, lr
  3975. @item chroma_radius, cr
  3976. @item alpha_radius, ar
  3977. Set an expression for the box radius in pixels used for blurring the
  3978. corresponding input plane.
  3979. The radius value must be a non-negative number, and must not be
  3980. greater than the value of the expression @code{min(w,h)/2} for the
  3981. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3982. planes.
  3983. Default value for @option{luma_radius} is "2". If not specified,
  3984. @option{chroma_radius} and @option{alpha_radius} default to the
  3985. corresponding value set for @option{luma_radius}.
  3986. The expressions can contain the following constants:
  3987. @table @option
  3988. @item w
  3989. @item h
  3990. The input width and height in pixels.
  3991. @item cw
  3992. @item ch
  3993. The input chroma image width and height in pixels.
  3994. @item hsub
  3995. @item vsub
  3996. The horizontal and vertical chroma subsample values. For example, for the
  3997. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3998. @end table
  3999. @item luma_power, lp
  4000. @item chroma_power, cp
  4001. @item alpha_power, ap
  4002. Specify how many times the boxblur filter is applied to the
  4003. corresponding plane.
  4004. Default value for @option{luma_power} is 2. If not specified,
  4005. @option{chroma_power} and @option{alpha_power} default to the
  4006. corresponding value set for @option{luma_power}.
  4007. A value of 0 will disable the effect.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. Apply a boxblur filter with the luma, chroma, and alpha radii
  4013. set to 2:
  4014. @example
  4015. boxblur=luma_radius=2:luma_power=1
  4016. boxblur=2:1
  4017. @end example
  4018. @item
  4019. Set the luma radius to 2, and alpha and chroma radius to 0:
  4020. @example
  4021. boxblur=2:1:cr=0:ar=0
  4022. @end example
  4023. @item
  4024. Set the luma and chroma radii to a fraction of the video dimension:
  4025. @example
  4026. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4027. @end example
  4028. @end itemize
  4029. @section bwdif
  4030. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4031. Deinterlacing Filter").
  4032. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4033. interpolation algorithms.
  4034. It accepts the following parameters:
  4035. @table @option
  4036. @item mode
  4037. The interlacing mode to adopt. It accepts one of the following values:
  4038. @table @option
  4039. @item 0, send_frame
  4040. Output one frame for each frame.
  4041. @item 1, send_field
  4042. Output one frame for each field.
  4043. @end table
  4044. The default value is @code{send_field}.
  4045. @item parity
  4046. The picture field parity assumed for the input interlaced video. It accepts one
  4047. of the following values:
  4048. @table @option
  4049. @item 0, tff
  4050. Assume the top field is first.
  4051. @item 1, bff
  4052. Assume the bottom field is first.
  4053. @item -1, auto
  4054. Enable automatic detection of field parity.
  4055. @end table
  4056. The default value is @code{auto}.
  4057. If the interlacing is unknown or the decoder does not export this information,
  4058. top field first will be assumed.
  4059. @item deint
  4060. Specify which frames to deinterlace. Accept one of the following
  4061. values:
  4062. @table @option
  4063. @item 0, all
  4064. Deinterlace all frames.
  4065. @item 1, interlaced
  4066. Only deinterlace frames marked as interlaced.
  4067. @end table
  4068. The default value is @code{all}.
  4069. @end table
  4070. @section chromakey
  4071. YUV colorspace color/chroma keying.
  4072. The filter accepts the following options:
  4073. @table @option
  4074. @item color
  4075. The color which will be replaced with transparency.
  4076. @item similarity
  4077. Similarity percentage with the key color.
  4078. 0.01 matches only the exact key color, while 1.0 matches everything.
  4079. @item blend
  4080. Blend percentage.
  4081. 0.0 makes pixels either fully transparent, or not transparent at all.
  4082. Higher values result in semi-transparent pixels, with a higher transparency
  4083. the more similar the pixels color is to the key color.
  4084. @item yuv
  4085. Signals that the color passed is already in YUV instead of RGB.
  4086. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4087. This can be used to pass exact YUV values as hexadecimal numbers.
  4088. @end table
  4089. @subsection Examples
  4090. @itemize
  4091. @item
  4092. Make every green pixel in the input image transparent:
  4093. @example
  4094. ffmpeg -i input.png -vf chromakey=green out.png
  4095. @end example
  4096. @item
  4097. Overlay a greenscreen-video on top of a static black background.
  4098. @example
  4099. 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
  4100. @end example
  4101. @end itemize
  4102. @section ciescope
  4103. Display CIE color diagram with pixels overlaid onto it.
  4104. The filter accepts the following options:
  4105. @table @option
  4106. @item system
  4107. Set color system.
  4108. @table @samp
  4109. @item ntsc, 470m
  4110. @item ebu, 470bg
  4111. @item smpte
  4112. @item 240m
  4113. @item apple
  4114. @item widergb
  4115. @item cie1931
  4116. @item rec709, hdtv
  4117. @item uhdtv, rec2020
  4118. @end table
  4119. @item cie
  4120. Set CIE system.
  4121. @table @samp
  4122. @item xyy
  4123. @item ucs
  4124. @item luv
  4125. @end table
  4126. @item gamuts
  4127. Set what gamuts to draw.
  4128. See @code{system} option for available values.
  4129. @item size, s
  4130. Set ciescope size, by default set to 512.
  4131. @item intensity, i
  4132. Set intensity used to map input pixel values to CIE diagram.
  4133. @item contrast
  4134. Set contrast used to draw tongue colors that are out of active color system gamut.
  4135. @item corrgamma
  4136. Correct gamma displayed on scope, by default enabled.
  4137. @item showwhite
  4138. Show white point on CIE diagram, by default disabled.
  4139. @item gamma
  4140. Set input gamma. Used only with XYZ input color space.
  4141. @end table
  4142. @section codecview
  4143. Visualize information exported by some codecs.
  4144. Some codecs can export information through frames using side-data or other
  4145. means. For example, some MPEG based codecs export motion vectors through the
  4146. @var{export_mvs} flag in the codec @option{flags2} option.
  4147. The filter accepts the following option:
  4148. @table @option
  4149. @item mv
  4150. Set motion vectors to visualize.
  4151. Available flags for @var{mv} are:
  4152. @table @samp
  4153. @item pf
  4154. forward predicted MVs of P-frames
  4155. @item bf
  4156. forward predicted MVs of B-frames
  4157. @item bb
  4158. backward predicted MVs of B-frames
  4159. @end table
  4160. @item qp
  4161. Display quantization parameters using the chroma planes.
  4162. @item mv_type, mvt
  4163. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4164. Available flags for @var{mv_type} are:
  4165. @table @samp
  4166. @item fp
  4167. forward predicted MVs
  4168. @item bp
  4169. backward predicted MVs
  4170. @end table
  4171. @item frame_type, ft
  4172. Set frame type to visualize motion vectors of.
  4173. Available flags for @var{frame_type} are:
  4174. @table @samp
  4175. @item if
  4176. intra-coded frames (I-frames)
  4177. @item pf
  4178. predicted frames (P-frames)
  4179. @item bf
  4180. bi-directionally predicted frames (B-frames)
  4181. @end table
  4182. @end table
  4183. @subsection Examples
  4184. @itemize
  4185. @item
  4186. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4187. @example
  4188. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4189. @end example
  4190. @item
  4191. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4192. @example
  4193. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4194. @end example
  4195. @end itemize
  4196. @section colorbalance
  4197. Modify intensity of primary colors (red, green and blue) of input frames.
  4198. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4199. regions for the red-cyan, green-magenta or blue-yellow balance.
  4200. A positive adjustment value shifts the balance towards the primary color, a negative
  4201. value towards the complementary color.
  4202. The filter accepts the following options:
  4203. @table @option
  4204. @item rs
  4205. @item gs
  4206. @item bs
  4207. Adjust red, green and blue shadows (darkest pixels).
  4208. @item rm
  4209. @item gm
  4210. @item bm
  4211. Adjust red, green and blue midtones (medium pixels).
  4212. @item rh
  4213. @item gh
  4214. @item bh
  4215. Adjust red, green and blue highlights (brightest pixels).
  4216. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4217. @end table
  4218. @subsection Examples
  4219. @itemize
  4220. @item
  4221. Add red color cast to shadows:
  4222. @example
  4223. colorbalance=rs=.3
  4224. @end example
  4225. @end itemize
  4226. @section colorkey
  4227. RGB colorspace color keying.
  4228. The filter accepts the following options:
  4229. @table @option
  4230. @item color
  4231. The color which will be replaced with transparency.
  4232. @item similarity
  4233. Similarity percentage with the key color.
  4234. 0.01 matches only the exact key color, while 1.0 matches everything.
  4235. @item blend
  4236. Blend percentage.
  4237. 0.0 makes pixels either fully transparent, or not transparent at all.
  4238. Higher values result in semi-transparent pixels, with a higher transparency
  4239. the more similar the pixels color is to the key color.
  4240. @end table
  4241. @subsection Examples
  4242. @itemize
  4243. @item
  4244. Make every green pixel in the input image transparent:
  4245. @example
  4246. ffmpeg -i input.png -vf colorkey=green out.png
  4247. @end example
  4248. @item
  4249. Overlay a greenscreen-video on top of a static background image.
  4250. @example
  4251. 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
  4252. @end example
  4253. @end itemize
  4254. @section colorlevels
  4255. Adjust video input frames using levels.
  4256. The filter accepts the following options:
  4257. @table @option
  4258. @item rimin
  4259. @item gimin
  4260. @item bimin
  4261. @item aimin
  4262. Adjust red, green, blue and alpha input black point.
  4263. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4264. @item rimax
  4265. @item gimax
  4266. @item bimax
  4267. @item aimax
  4268. Adjust red, green, blue and alpha input white point.
  4269. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4270. Input levels are used to lighten highlights (bright tones), darken shadows
  4271. (dark tones), change the balance of bright and dark tones.
  4272. @item romin
  4273. @item gomin
  4274. @item bomin
  4275. @item aomin
  4276. Adjust red, green, blue and alpha output black point.
  4277. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4278. @item romax
  4279. @item gomax
  4280. @item bomax
  4281. @item aomax
  4282. Adjust red, green, blue and alpha output white point.
  4283. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4284. Output levels allows manual selection of a constrained output level range.
  4285. @end table
  4286. @subsection Examples
  4287. @itemize
  4288. @item
  4289. Make video output darker:
  4290. @example
  4291. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4292. @end example
  4293. @item
  4294. Increase contrast:
  4295. @example
  4296. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4297. @end example
  4298. @item
  4299. Make video output lighter:
  4300. @example
  4301. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4302. @end example
  4303. @item
  4304. Increase brightness:
  4305. @example
  4306. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4307. @end example
  4308. @end itemize
  4309. @section colorchannelmixer
  4310. Adjust video input frames by re-mixing color channels.
  4311. This filter modifies a color channel by adding the values associated to
  4312. the other channels of the same pixels. For example if the value to
  4313. modify is red, the output value will be:
  4314. @example
  4315. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4316. @end example
  4317. The filter accepts the following options:
  4318. @table @option
  4319. @item rr
  4320. @item rg
  4321. @item rb
  4322. @item ra
  4323. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4324. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4325. @item gr
  4326. @item gg
  4327. @item gb
  4328. @item ga
  4329. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4330. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4331. @item br
  4332. @item bg
  4333. @item bb
  4334. @item ba
  4335. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4336. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4337. @item ar
  4338. @item ag
  4339. @item ab
  4340. @item aa
  4341. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4342. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4343. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4344. @end table
  4345. @subsection Examples
  4346. @itemize
  4347. @item
  4348. Convert source to grayscale:
  4349. @example
  4350. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4351. @end example
  4352. @item
  4353. Simulate sepia tones:
  4354. @example
  4355. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4356. @end example
  4357. @end itemize
  4358. @section colormatrix
  4359. Convert color matrix.
  4360. The filter accepts the following options:
  4361. @table @option
  4362. @item src
  4363. @item dst
  4364. Specify the source and destination color matrix. Both values must be
  4365. specified.
  4366. The accepted values are:
  4367. @table @samp
  4368. @item bt709
  4369. BT.709
  4370. @item fcc
  4371. FCC
  4372. @item bt601
  4373. BT.601
  4374. @item bt470
  4375. BT.470
  4376. @item bt470bg
  4377. BT.470BG
  4378. @item smpte170m
  4379. SMPTE-170M
  4380. @item smpte240m
  4381. SMPTE-240M
  4382. @item bt2020
  4383. BT.2020
  4384. @end table
  4385. @end table
  4386. For example to convert from BT.601 to SMPTE-240M, use the command:
  4387. @example
  4388. colormatrix=bt601:smpte240m
  4389. @end example
  4390. @section colorspace
  4391. Convert colorspace, transfer characteristics or color primaries.
  4392. Input video needs to have an even size.
  4393. The filter accepts the following options:
  4394. @table @option
  4395. @anchor{all}
  4396. @item all
  4397. Specify all color properties at once.
  4398. The accepted values are:
  4399. @table @samp
  4400. @item bt470m
  4401. BT.470M
  4402. @item bt470bg
  4403. BT.470BG
  4404. @item bt601-6-525
  4405. BT.601-6 525
  4406. @item bt601-6-625
  4407. BT.601-6 625
  4408. @item bt709
  4409. BT.709
  4410. @item smpte170m
  4411. SMPTE-170M
  4412. @item smpte240m
  4413. SMPTE-240M
  4414. @item bt2020
  4415. BT.2020
  4416. @end table
  4417. @anchor{space}
  4418. @item space
  4419. Specify output colorspace.
  4420. The accepted values are:
  4421. @table @samp
  4422. @item bt709
  4423. BT.709
  4424. @item fcc
  4425. FCC
  4426. @item bt470bg
  4427. BT.470BG or BT.601-6 625
  4428. @item smpte170m
  4429. SMPTE-170M or BT.601-6 525
  4430. @item smpte240m
  4431. SMPTE-240M
  4432. @item ycgco
  4433. YCgCo
  4434. @item bt2020ncl
  4435. BT.2020 with non-constant luminance
  4436. @end table
  4437. @anchor{trc}
  4438. @item trc
  4439. Specify output transfer characteristics.
  4440. The accepted values are:
  4441. @table @samp
  4442. @item bt709
  4443. BT.709
  4444. @item bt470m
  4445. BT.470M
  4446. @item bt470bg
  4447. BT.470BG
  4448. @item gamma22
  4449. Constant gamma of 2.2
  4450. @item gamma28
  4451. Constant gamma of 2.8
  4452. @item smpte170m
  4453. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4454. @item smpte240m
  4455. SMPTE-240M
  4456. @item srgb
  4457. SRGB
  4458. @item iec61966-2-1
  4459. iec61966-2-1
  4460. @item iec61966-2-4
  4461. iec61966-2-4
  4462. @item xvycc
  4463. xvycc
  4464. @item bt2020-10
  4465. BT.2020 for 10-bits content
  4466. @item bt2020-12
  4467. BT.2020 for 12-bits content
  4468. @end table
  4469. @anchor{primaries}
  4470. @item primaries
  4471. Specify output color primaries.
  4472. The accepted values are:
  4473. @table @samp
  4474. @item bt709
  4475. BT.709
  4476. @item bt470m
  4477. BT.470M
  4478. @item bt470bg
  4479. BT.470BG or BT.601-6 625
  4480. @item smpte170m
  4481. SMPTE-170M or BT.601-6 525
  4482. @item smpte240m
  4483. SMPTE-240M
  4484. @item film
  4485. film
  4486. @item smpte431
  4487. SMPTE-431
  4488. @item smpte432
  4489. SMPTE-432
  4490. @item bt2020
  4491. BT.2020
  4492. @item jedec-p22
  4493. JEDEC P22 phosphors
  4494. @end table
  4495. @anchor{range}
  4496. @item range
  4497. Specify output color range.
  4498. The accepted values are:
  4499. @table @samp
  4500. @item tv
  4501. TV (restricted) range
  4502. @item mpeg
  4503. MPEG (restricted) range
  4504. @item pc
  4505. PC (full) range
  4506. @item jpeg
  4507. JPEG (full) range
  4508. @end table
  4509. @item format
  4510. Specify output color format.
  4511. The accepted values are:
  4512. @table @samp
  4513. @item yuv420p
  4514. YUV 4:2:0 planar 8-bits
  4515. @item yuv420p10
  4516. YUV 4:2:0 planar 10-bits
  4517. @item yuv420p12
  4518. YUV 4:2:0 planar 12-bits
  4519. @item yuv422p
  4520. YUV 4:2:2 planar 8-bits
  4521. @item yuv422p10
  4522. YUV 4:2:2 planar 10-bits
  4523. @item yuv422p12
  4524. YUV 4:2:2 planar 12-bits
  4525. @item yuv444p
  4526. YUV 4:4:4 planar 8-bits
  4527. @item yuv444p10
  4528. YUV 4:4:4 planar 10-bits
  4529. @item yuv444p12
  4530. YUV 4:4:4 planar 12-bits
  4531. @end table
  4532. @item fast
  4533. Do a fast conversion, which skips gamma/primary correction. This will take
  4534. significantly less CPU, but will be mathematically incorrect. To get output
  4535. compatible with that produced by the colormatrix filter, use fast=1.
  4536. @item dither
  4537. Specify dithering mode.
  4538. The accepted values are:
  4539. @table @samp
  4540. @item none
  4541. No dithering
  4542. @item fsb
  4543. Floyd-Steinberg dithering
  4544. @end table
  4545. @item wpadapt
  4546. Whitepoint adaptation mode.
  4547. The accepted values are:
  4548. @table @samp
  4549. @item bradford
  4550. Bradford whitepoint adaptation
  4551. @item vonkries
  4552. von Kries whitepoint adaptation
  4553. @item identity
  4554. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4555. @end table
  4556. @item iall
  4557. Override all input properties at once. Same accepted values as @ref{all}.
  4558. @item ispace
  4559. Override input colorspace. Same accepted values as @ref{space}.
  4560. @item iprimaries
  4561. Override input color primaries. Same accepted values as @ref{primaries}.
  4562. @item itrc
  4563. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4564. @item irange
  4565. Override input color range. Same accepted values as @ref{range}.
  4566. @end table
  4567. The filter converts the transfer characteristics, color space and color
  4568. primaries to the specified user values. The output value, if not specified,
  4569. is set to a default value based on the "all" property. If that property is
  4570. also not specified, the filter will log an error. The output color range and
  4571. format default to the same value as the input color range and format. The
  4572. input transfer characteristics, color space, color primaries and color range
  4573. should be set on the input data. If any of these are missing, the filter will
  4574. log an error and no conversion will take place.
  4575. For example to convert the input to SMPTE-240M, use the command:
  4576. @example
  4577. colorspace=smpte240m
  4578. @end example
  4579. @section convolution
  4580. Apply convolution 3x3 or 5x5 filter.
  4581. The filter accepts the following options:
  4582. @table @option
  4583. @item 0m
  4584. @item 1m
  4585. @item 2m
  4586. @item 3m
  4587. Set matrix for each plane.
  4588. Matrix is sequence of 9 or 25 signed integers.
  4589. @item 0rdiv
  4590. @item 1rdiv
  4591. @item 2rdiv
  4592. @item 3rdiv
  4593. Set multiplier for calculated value for each plane.
  4594. @item 0bias
  4595. @item 1bias
  4596. @item 2bias
  4597. @item 3bias
  4598. Set bias for each plane. This value is added to the result of the multiplication.
  4599. Useful for making the overall image brighter or darker. Default is 0.0.
  4600. @end table
  4601. @subsection Examples
  4602. @itemize
  4603. @item
  4604. Apply sharpen:
  4605. @example
  4606. 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"
  4607. @end example
  4608. @item
  4609. Apply blur:
  4610. @example
  4611. 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"
  4612. @end example
  4613. @item
  4614. Apply edge enhance:
  4615. @example
  4616. 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"
  4617. @end example
  4618. @item
  4619. Apply edge detect:
  4620. @example
  4621. 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"
  4622. @end example
  4623. @item
  4624. Apply laplacian edge detector which includes diagonals:
  4625. @example
  4626. 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"
  4627. @end example
  4628. @item
  4629. Apply emboss:
  4630. @example
  4631. 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"
  4632. @end example
  4633. @end itemize
  4634. @section convolve
  4635. Apply 2D convolution of video stream in frequency domain using second stream
  4636. as impulse.
  4637. The filter accepts the following options:
  4638. @table @option
  4639. @item planes
  4640. Set which planes to process.
  4641. @item impulse
  4642. Set which impulse video frames will be processed, can be @var{first}
  4643. or @var{all}. Default is @var{all}.
  4644. @end table
  4645. The @code{convolve} filter also supports the @ref{framesync} options.
  4646. @section copy
  4647. Copy the input video source unchanged to the output. This is mainly useful for
  4648. testing purposes.
  4649. @anchor{coreimage}
  4650. @section coreimage
  4651. Video filtering on GPU using Apple's CoreImage API on OSX.
  4652. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4653. processed by video hardware. However, software-based OpenGL implementations
  4654. exist which means there is no guarantee for hardware processing. It depends on
  4655. the respective OSX.
  4656. There are many filters and image generators provided by Apple that come with a
  4657. large variety of options. The filter has to be referenced by its name along
  4658. with its options.
  4659. The coreimage filter accepts the following options:
  4660. @table @option
  4661. @item list_filters
  4662. List all available filters and generators along with all their respective
  4663. options as well as possible minimum and maximum values along with the default
  4664. values.
  4665. @example
  4666. list_filters=true
  4667. @end example
  4668. @item filter
  4669. Specify all filters by their respective name and options.
  4670. Use @var{list_filters} to determine all valid filter names and options.
  4671. Numerical options are specified by a float value and are automatically clamped
  4672. to their respective value range. Vector and color options have to be specified
  4673. by a list of space separated float values. Character escaping has to be done.
  4674. A special option name @code{default} is available to use default options for a
  4675. filter.
  4676. It is required to specify either @code{default} or at least one of the filter options.
  4677. All omitted options are used with their default values.
  4678. The syntax of the filter string is as follows:
  4679. @example
  4680. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4681. @end example
  4682. @item output_rect
  4683. Specify a rectangle where the output of the filter chain is copied into the
  4684. input image. It is given by a list of space separated float values:
  4685. @example
  4686. output_rect=x\ y\ width\ height
  4687. @end example
  4688. If not given, the output rectangle equals the dimensions of the input image.
  4689. The output rectangle is automatically cropped at the borders of the input
  4690. image. Negative values are valid for each component.
  4691. @example
  4692. output_rect=25\ 25\ 100\ 100
  4693. @end example
  4694. @end table
  4695. Several filters can be chained for successive processing without GPU-HOST
  4696. transfers allowing for fast processing of complex filter chains.
  4697. Currently, only filters with zero (generators) or exactly one (filters) input
  4698. image and one output image are supported. Also, transition filters are not yet
  4699. usable as intended.
  4700. Some filters generate output images with additional padding depending on the
  4701. respective filter kernel. The padding is automatically removed to ensure the
  4702. filter output has the same size as the input image.
  4703. For image generators, the size of the output image is determined by the
  4704. previous output image of the filter chain or the input image of the whole
  4705. filterchain, respectively. The generators do not use the pixel information of
  4706. this image to generate their output. However, the generated output is
  4707. blended onto this image, resulting in partial or complete coverage of the
  4708. output image.
  4709. The @ref{coreimagesrc} video source can be used for generating input images
  4710. which are directly fed into the filter chain. By using it, providing input
  4711. images by another video source or an input video is not required.
  4712. @subsection Examples
  4713. @itemize
  4714. @item
  4715. List all filters available:
  4716. @example
  4717. coreimage=list_filters=true
  4718. @end example
  4719. @item
  4720. Use the CIBoxBlur filter with default options to blur an image:
  4721. @example
  4722. coreimage=filter=CIBoxBlur@@default
  4723. @end example
  4724. @item
  4725. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4726. its center at 100x100 and a radius of 50 pixels:
  4727. @example
  4728. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4729. @end example
  4730. @item
  4731. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4732. given as complete and escaped command-line for Apple's standard bash shell:
  4733. @example
  4734. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4735. @end example
  4736. @end itemize
  4737. @section crop
  4738. Crop the input video to given dimensions.
  4739. It accepts the following parameters:
  4740. @table @option
  4741. @item w, out_w
  4742. The width of the output video. It defaults to @code{iw}.
  4743. This expression is evaluated only once during the filter
  4744. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4745. @item h, out_h
  4746. The height of the output video. It defaults to @code{ih}.
  4747. This expression is evaluated only once during the filter
  4748. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4749. @item x
  4750. The horizontal position, in the input video, of the left edge of the output
  4751. video. It defaults to @code{(in_w-out_w)/2}.
  4752. This expression is evaluated per-frame.
  4753. @item y
  4754. The vertical position, in the input video, of the top edge of the output video.
  4755. It defaults to @code{(in_h-out_h)/2}.
  4756. This expression is evaluated per-frame.
  4757. @item keep_aspect
  4758. If set to 1 will force the output display aspect ratio
  4759. to be the same of the input, by changing the output sample aspect
  4760. ratio. It defaults to 0.
  4761. @item exact
  4762. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4763. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4764. It defaults to 0.
  4765. @end table
  4766. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4767. expressions containing the following constants:
  4768. @table @option
  4769. @item x
  4770. @item y
  4771. The computed values for @var{x} and @var{y}. They are evaluated for
  4772. each new frame.
  4773. @item in_w
  4774. @item in_h
  4775. The input width and height.
  4776. @item iw
  4777. @item ih
  4778. These are the same as @var{in_w} and @var{in_h}.
  4779. @item out_w
  4780. @item out_h
  4781. The output (cropped) width and height.
  4782. @item ow
  4783. @item oh
  4784. These are the same as @var{out_w} and @var{out_h}.
  4785. @item a
  4786. same as @var{iw} / @var{ih}
  4787. @item sar
  4788. input sample aspect ratio
  4789. @item dar
  4790. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4791. @item hsub
  4792. @item vsub
  4793. horizontal and vertical chroma subsample values. For example for the
  4794. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4795. @item n
  4796. The number of the input frame, starting from 0.
  4797. @item pos
  4798. the position in the file of the input frame, NAN if unknown
  4799. @item t
  4800. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4801. @end table
  4802. The expression for @var{out_w} may depend on the value of @var{out_h},
  4803. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4804. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4805. evaluated after @var{out_w} and @var{out_h}.
  4806. The @var{x} and @var{y} parameters specify the expressions for the
  4807. position of the top-left corner of the output (non-cropped) area. They
  4808. are evaluated for each frame. If the evaluated value is not valid, it
  4809. is approximated to the nearest valid value.
  4810. The expression for @var{x} may depend on @var{y}, and the expression
  4811. for @var{y} may depend on @var{x}.
  4812. @subsection Examples
  4813. @itemize
  4814. @item
  4815. Crop area with size 100x100 at position (12,34).
  4816. @example
  4817. crop=100:100:12:34
  4818. @end example
  4819. Using named options, the example above becomes:
  4820. @example
  4821. crop=w=100:h=100:x=12:y=34
  4822. @end example
  4823. @item
  4824. Crop the central input area with size 100x100:
  4825. @example
  4826. crop=100:100
  4827. @end example
  4828. @item
  4829. Crop the central input area with size 2/3 of the input video:
  4830. @example
  4831. crop=2/3*in_w:2/3*in_h
  4832. @end example
  4833. @item
  4834. Crop the input video central square:
  4835. @example
  4836. crop=out_w=in_h
  4837. crop=in_h
  4838. @end example
  4839. @item
  4840. Delimit the rectangle with the top-left corner placed at position
  4841. 100:100 and the right-bottom corner corresponding to the right-bottom
  4842. corner of the input image.
  4843. @example
  4844. crop=in_w-100:in_h-100:100:100
  4845. @end example
  4846. @item
  4847. Crop 10 pixels from the left and right borders, and 20 pixels from
  4848. the top and bottom borders
  4849. @example
  4850. crop=in_w-2*10:in_h-2*20
  4851. @end example
  4852. @item
  4853. Keep only the bottom right quarter of the input image:
  4854. @example
  4855. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4856. @end example
  4857. @item
  4858. Crop height for getting Greek harmony:
  4859. @example
  4860. crop=in_w:1/PHI*in_w
  4861. @end example
  4862. @item
  4863. Apply trembling effect:
  4864. @example
  4865. 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)
  4866. @end example
  4867. @item
  4868. Apply erratic camera effect depending on timestamp:
  4869. @example
  4870. 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)"
  4871. @end example
  4872. @item
  4873. Set x depending on the value of y:
  4874. @example
  4875. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4876. @end example
  4877. @end itemize
  4878. @subsection Commands
  4879. This filter supports the following commands:
  4880. @table @option
  4881. @item w, out_w
  4882. @item h, out_h
  4883. @item x
  4884. @item y
  4885. Set width/height of the output video and the horizontal/vertical position
  4886. in the input video.
  4887. The command accepts the same syntax of the corresponding option.
  4888. If the specified expression is not valid, it is kept at its current
  4889. value.
  4890. @end table
  4891. @section cropdetect
  4892. Auto-detect the crop size.
  4893. It calculates the necessary cropping parameters and prints the
  4894. recommended parameters via the logging system. The detected dimensions
  4895. correspond to the non-black area of the input video.
  4896. It accepts the following parameters:
  4897. @table @option
  4898. @item limit
  4899. Set higher black value threshold, which can be optionally specified
  4900. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4901. value greater to the set value is considered non-black. It defaults to 24.
  4902. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4903. on the bitdepth of the pixel format.
  4904. @item round
  4905. The value which the width/height should be divisible by. It defaults to
  4906. 16. The offset is automatically adjusted to center the video. Use 2 to
  4907. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4908. encoding to most video codecs.
  4909. @item reset_count, reset
  4910. Set the counter that determines after how many frames cropdetect will
  4911. reset the previously detected largest video area and start over to
  4912. detect the current optimal crop area. Default value is 0.
  4913. This can be useful when channel logos distort the video area. 0
  4914. indicates 'never reset', and returns the largest area encountered during
  4915. playback.
  4916. @end table
  4917. @anchor{curves}
  4918. @section curves
  4919. Apply color adjustments using curves.
  4920. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4921. component (red, green and blue) has its values defined by @var{N} key points
  4922. tied from each other using a smooth curve. The x-axis represents the pixel
  4923. values from the input frame, and the y-axis the new pixel values to be set for
  4924. the output frame.
  4925. By default, a component curve is defined by the two points @var{(0;0)} and
  4926. @var{(1;1)}. This creates a straight line where each original pixel value is
  4927. "adjusted" to its own value, which means no change to the image.
  4928. The filter allows you to redefine these two points and add some more. A new
  4929. curve (using a natural cubic spline interpolation) will be define to pass
  4930. smoothly through all these new coordinates. The new defined points needs to be
  4931. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4932. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4933. the vector spaces, the values will be clipped accordingly.
  4934. The filter accepts the following options:
  4935. @table @option
  4936. @item preset
  4937. Select one of the available color presets. This option can be used in addition
  4938. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4939. options takes priority on the preset values.
  4940. Available presets are:
  4941. @table @samp
  4942. @item none
  4943. @item color_negative
  4944. @item cross_process
  4945. @item darker
  4946. @item increase_contrast
  4947. @item lighter
  4948. @item linear_contrast
  4949. @item medium_contrast
  4950. @item negative
  4951. @item strong_contrast
  4952. @item vintage
  4953. @end table
  4954. Default is @code{none}.
  4955. @item master, m
  4956. Set the master key points. These points will define a second pass mapping. It
  4957. is sometimes called a "luminance" or "value" mapping. It can be used with
  4958. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4959. post-processing LUT.
  4960. @item red, r
  4961. Set the key points for the red component.
  4962. @item green, g
  4963. Set the key points for the green component.
  4964. @item blue, b
  4965. Set the key points for the blue component.
  4966. @item all
  4967. Set the key points for all components (not including master).
  4968. Can be used in addition to the other key points component
  4969. options. In this case, the unset component(s) will fallback on this
  4970. @option{all} setting.
  4971. @item psfile
  4972. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4973. @item plot
  4974. Save Gnuplot script of the curves in specified file.
  4975. @end table
  4976. To avoid some filtergraph syntax conflicts, each key points list need to be
  4977. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4978. @subsection Examples
  4979. @itemize
  4980. @item
  4981. Increase slightly the middle level of blue:
  4982. @example
  4983. curves=blue='0/0 0.5/0.58 1/1'
  4984. @end example
  4985. @item
  4986. Vintage effect:
  4987. @example
  4988. 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'
  4989. @end example
  4990. Here we obtain the following coordinates for each components:
  4991. @table @var
  4992. @item red
  4993. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4994. @item green
  4995. @code{(0;0) (0.50;0.48) (1;1)}
  4996. @item blue
  4997. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4998. @end table
  4999. @item
  5000. The previous example can also be achieved with the associated built-in preset:
  5001. @example
  5002. curves=preset=vintage
  5003. @end example
  5004. @item
  5005. Or simply:
  5006. @example
  5007. curves=vintage
  5008. @end example
  5009. @item
  5010. Use a Photoshop preset and redefine the points of the green component:
  5011. @example
  5012. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5013. @end example
  5014. @item
  5015. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5016. and @command{gnuplot}:
  5017. @example
  5018. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5019. gnuplot -p /tmp/curves.plt
  5020. @end example
  5021. @end itemize
  5022. @section datascope
  5023. Video data analysis filter.
  5024. This filter shows hexadecimal pixel values of part of video.
  5025. The filter accepts the following options:
  5026. @table @option
  5027. @item size, s
  5028. Set output video size.
  5029. @item x
  5030. Set x offset from where to pick pixels.
  5031. @item y
  5032. Set y offset from where to pick pixels.
  5033. @item mode
  5034. Set scope mode, can be one of the following:
  5035. @table @samp
  5036. @item mono
  5037. Draw hexadecimal pixel values with white color on black background.
  5038. @item color
  5039. Draw hexadecimal pixel values with input video pixel color on black
  5040. background.
  5041. @item color2
  5042. Draw hexadecimal pixel values on color background picked from input video,
  5043. the text color is picked in such way so its always visible.
  5044. @end table
  5045. @item axis
  5046. Draw rows and columns numbers on left and top of video.
  5047. @item opacity
  5048. Set background opacity.
  5049. @end table
  5050. @section dctdnoiz
  5051. Denoise frames using 2D DCT (frequency domain filtering).
  5052. This filter is not designed for real time.
  5053. The filter accepts the following options:
  5054. @table @option
  5055. @item sigma, s
  5056. Set the noise sigma constant.
  5057. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5058. coefficient (absolute value) below this threshold with be dropped.
  5059. If you need a more advanced filtering, see @option{expr}.
  5060. Default is @code{0}.
  5061. @item overlap
  5062. Set number overlapping pixels for each block. Since the filter can be slow, you
  5063. may want to reduce this value, at the cost of a less effective filter and the
  5064. risk of various artefacts.
  5065. If the overlapping value doesn't permit processing the whole input width or
  5066. height, a warning will be displayed and according borders won't be denoised.
  5067. Default value is @var{blocksize}-1, which is the best possible setting.
  5068. @item expr, e
  5069. Set the coefficient factor expression.
  5070. For each coefficient of a DCT block, this expression will be evaluated as a
  5071. multiplier value for the coefficient.
  5072. If this is option is set, the @option{sigma} option will be ignored.
  5073. The absolute value of the coefficient can be accessed through the @var{c}
  5074. variable.
  5075. @item n
  5076. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5077. @var{blocksize}, which is the width and height of the processed blocks.
  5078. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5079. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5080. on the speed processing. Also, a larger block size does not necessarily means a
  5081. better de-noising.
  5082. @end table
  5083. @subsection Examples
  5084. Apply a denoise with a @option{sigma} of @code{4.5}:
  5085. @example
  5086. dctdnoiz=4.5
  5087. @end example
  5088. The same operation can be achieved using the expression system:
  5089. @example
  5090. dctdnoiz=e='gte(c, 4.5*3)'
  5091. @end example
  5092. Violent denoise using a block size of @code{16x16}:
  5093. @example
  5094. dctdnoiz=15:n=4
  5095. @end example
  5096. @section deband
  5097. Remove banding artifacts from input video.
  5098. It works by replacing banded pixels with average value of referenced pixels.
  5099. The filter accepts the following options:
  5100. @table @option
  5101. @item 1thr
  5102. @item 2thr
  5103. @item 3thr
  5104. @item 4thr
  5105. Set banding detection threshold for each plane. Default is 0.02.
  5106. Valid range is 0.00003 to 0.5.
  5107. If difference between current pixel and reference pixel is less than threshold,
  5108. it will be considered as banded.
  5109. @item range, r
  5110. Banding detection range in pixels. Default is 16. If positive, random number
  5111. in range 0 to set value will be used. If negative, exact absolute value
  5112. will be used.
  5113. The range defines square of four pixels around current pixel.
  5114. @item direction, d
  5115. Set direction in radians from which four pixel will be compared. If positive,
  5116. random direction from 0 to set direction will be picked. If negative, exact of
  5117. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5118. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5119. column.
  5120. @item blur, b
  5121. If enabled, current pixel is compared with average value of all four
  5122. surrounding pixels. The default is enabled. If disabled current pixel is
  5123. compared with all four surrounding pixels. The pixel is considered banded
  5124. if only all four differences with surrounding pixels are less than threshold.
  5125. @item coupling, c
  5126. If enabled, current pixel is changed if and only if all pixel components are banded,
  5127. e.g. banding detection threshold is triggered for all color components.
  5128. The default is disabled.
  5129. @end table
  5130. @anchor{decimate}
  5131. @section decimate
  5132. Drop duplicated frames at regular intervals.
  5133. The filter accepts the following options:
  5134. @table @option
  5135. @item cycle
  5136. Set the number of frames from which one will be dropped. Setting this to
  5137. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5138. Default is @code{5}.
  5139. @item dupthresh
  5140. Set the threshold for duplicate detection. If the difference metric for a frame
  5141. is less than or equal to this value, then it is declared as duplicate. Default
  5142. is @code{1.1}
  5143. @item scthresh
  5144. Set scene change threshold. Default is @code{15}.
  5145. @item blockx
  5146. @item blocky
  5147. Set the size of the x and y-axis blocks used during metric calculations.
  5148. Larger blocks give better noise suppression, but also give worse detection of
  5149. small movements. Must be a power of two. Default is @code{32}.
  5150. @item ppsrc
  5151. Mark main input as a pre-processed input and activate clean source input
  5152. stream. This allows the input to be pre-processed with various filters to help
  5153. the metrics calculation while keeping the frame selection lossless. When set to
  5154. @code{1}, the first stream is for the pre-processed input, and the second
  5155. stream is the clean source from where the kept frames are chosen. Default is
  5156. @code{0}.
  5157. @item chroma
  5158. Set whether or not chroma is considered in the metric calculations. Default is
  5159. @code{1}.
  5160. @end table
  5161. @section deflate
  5162. Apply deflate effect to the video.
  5163. This filter replaces the pixel by the local(3x3) average by taking into account
  5164. only values lower than the pixel.
  5165. It accepts the following options:
  5166. @table @option
  5167. @item threshold0
  5168. @item threshold1
  5169. @item threshold2
  5170. @item threshold3
  5171. Limit the maximum change for each plane, default is 65535.
  5172. If 0, plane will remain unchanged.
  5173. @end table
  5174. @section deflicker
  5175. Remove temporal frame luminance variations.
  5176. It accepts the following options:
  5177. @table @option
  5178. @item size, s
  5179. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5180. @item mode, m
  5181. Set averaging mode to smooth temporal luminance variations.
  5182. Available values are:
  5183. @table @samp
  5184. @item am
  5185. Arithmetic mean
  5186. @item gm
  5187. Geometric mean
  5188. @item hm
  5189. Harmonic mean
  5190. @item qm
  5191. Quadratic mean
  5192. @item cm
  5193. Cubic mean
  5194. @item pm
  5195. Power mean
  5196. @item median
  5197. Median
  5198. @end table
  5199. @item bypass
  5200. Do not actually modify frame. Useful when one only wants metadata.
  5201. @end table
  5202. @section dejudder
  5203. Remove judder produced by partially interlaced telecined content.
  5204. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5205. source was partially telecined content then the output of @code{pullup,dejudder}
  5206. will have a variable frame rate. May change the recorded frame rate of the
  5207. container. Aside from that change, this filter will not affect constant frame
  5208. rate video.
  5209. The option available in this filter is:
  5210. @table @option
  5211. @item cycle
  5212. Specify the length of the window over which the judder repeats.
  5213. Accepts any integer greater than 1. Useful values are:
  5214. @table @samp
  5215. @item 4
  5216. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5217. @item 5
  5218. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5219. @item 20
  5220. If a mixture of the two.
  5221. @end table
  5222. The default is @samp{4}.
  5223. @end table
  5224. @section delogo
  5225. Suppress a TV station logo by a simple interpolation of the surrounding
  5226. pixels. Just set a rectangle covering the logo and watch it disappear
  5227. (and sometimes something even uglier appear - your mileage may vary).
  5228. It accepts the following parameters:
  5229. @table @option
  5230. @item x
  5231. @item y
  5232. Specify the top left corner coordinates of the logo. They must be
  5233. specified.
  5234. @item w
  5235. @item h
  5236. Specify the width and height of the logo to clear. They must be
  5237. specified.
  5238. @item band, t
  5239. Specify the thickness of the fuzzy edge of the rectangle (added to
  5240. @var{w} and @var{h}). The default value is 1. This option is
  5241. deprecated, setting higher values should no longer be necessary and
  5242. is not recommended.
  5243. @item show
  5244. When set to 1, a green rectangle is drawn on the screen to simplify
  5245. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5246. The default value is 0.
  5247. The rectangle is drawn on the outermost pixels which will be (partly)
  5248. replaced with interpolated values. The values of the next pixels
  5249. immediately outside this rectangle in each direction will be used to
  5250. compute the interpolated pixel values inside the rectangle.
  5251. @end table
  5252. @subsection Examples
  5253. @itemize
  5254. @item
  5255. Set a rectangle covering the area with top left corner coordinates 0,0
  5256. and size 100x77, and a band of size 10:
  5257. @example
  5258. delogo=x=0:y=0:w=100:h=77:band=10
  5259. @end example
  5260. @end itemize
  5261. @section deshake
  5262. Attempt to fix small changes in horizontal and/or vertical shift. This
  5263. filter helps remove camera shake from hand-holding a camera, bumping a
  5264. tripod, moving on a vehicle, etc.
  5265. The filter accepts the following options:
  5266. @table @option
  5267. @item x
  5268. @item y
  5269. @item w
  5270. @item h
  5271. Specify a rectangular area where to limit the search for motion
  5272. vectors.
  5273. If desired the search for motion vectors can be limited to a
  5274. rectangular area of the frame defined by its top left corner, width
  5275. and height. These parameters have the same meaning as the drawbox
  5276. filter which can be used to visualise the position of the bounding
  5277. box.
  5278. This is useful when simultaneous movement of subjects within the frame
  5279. might be confused for camera motion by the motion vector search.
  5280. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5281. then the full frame is used. This allows later options to be set
  5282. without specifying the bounding box for the motion vector search.
  5283. Default - search the whole frame.
  5284. @item rx
  5285. @item ry
  5286. Specify the maximum extent of movement in x and y directions in the
  5287. range 0-64 pixels. Default 16.
  5288. @item edge
  5289. Specify how to generate pixels to fill blanks at the edge of the
  5290. frame. Available values are:
  5291. @table @samp
  5292. @item blank, 0
  5293. Fill zeroes at blank locations
  5294. @item original, 1
  5295. Original image at blank locations
  5296. @item clamp, 2
  5297. Extruded edge value at blank locations
  5298. @item mirror, 3
  5299. Mirrored edge at blank locations
  5300. @end table
  5301. Default value is @samp{mirror}.
  5302. @item blocksize
  5303. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5304. default 8.
  5305. @item contrast
  5306. Specify the contrast threshold for blocks. Only blocks with more than
  5307. the specified contrast (difference between darkest and lightest
  5308. pixels) will be considered. Range 1-255, default 125.
  5309. @item search
  5310. Specify the search strategy. Available values are:
  5311. @table @samp
  5312. @item exhaustive, 0
  5313. Set exhaustive search
  5314. @item less, 1
  5315. Set less exhaustive search.
  5316. @end table
  5317. Default value is @samp{exhaustive}.
  5318. @item filename
  5319. If set then a detailed log of the motion search is written to the
  5320. specified file.
  5321. @item opencl
  5322. If set to 1, specify using OpenCL capabilities, only available if
  5323. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5324. @end table
  5325. @section despill
  5326. Remove unwanted contamination of foreground colors, caused by reflected color of
  5327. greenscreen or bluescreen.
  5328. This filter accepts the following options:
  5329. @table @option
  5330. @item type
  5331. Set what type of despill to use.
  5332. @item mix
  5333. Set how spillmap will be generated.
  5334. @item expand
  5335. Set how much to get rid of still remaining spill.
  5336. @item red
  5337. Controls amount of red in spill area.
  5338. @item green
  5339. Controls amount of green in spill area.
  5340. Should be -1 for greenscreen.
  5341. @item blue
  5342. Controls amount of blue in spill area.
  5343. Should be -1 for bluescreen.
  5344. @item brightness
  5345. Controls brightness of spill area, preserving colors.
  5346. @item alpha
  5347. Modify alpha from generated spillmap.
  5348. @end table
  5349. @section detelecine
  5350. Apply an exact inverse of the telecine operation. It requires a predefined
  5351. pattern specified using the pattern option which must be the same as that passed
  5352. to the telecine filter.
  5353. This filter accepts the following options:
  5354. @table @option
  5355. @item first_field
  5356. @table @samp
  5357. @item top, t
  5358. top field first
  5359. @item bottom, b
  5360. bottom field first
  5361. The default value is @code{top}.
  5362. @end table
  5363. @item pattern
  5364. A string of numbers representing the pulldown pattern you wish to apply.
  5365. The default value is @code{23}.
  5366. @item start_frame
  5367. A number representing position of the first frame with respect to the telecine
  5368. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5369. @end table
  5370. @section dilation
  5371. Apply dilation effect to the video.
  5372. This filter replaces the pixel by the local(3x3) maximum.
  5373. It accepts the following options:
  5374. @table @option
  5375. @item threshold0
  5376. @item threshold1
  5377. @item threshold2
  5378. @item threshold3
  5379. Limit the maximum change for each plane, default is 65535.
  5380. If 0, plane will remain unchanged.
  5381. @item coordinates
  5382. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5383. pixels are used.
  5384. Flags to local 3x3 coordinates maps like this:
  5385. 1 2 3
  5386. 4 5
  5387. 6 7 8
  5388. @end table
  5389. @section displace
  5390. Displace pixels as indicated by second and third input stream.
  5391. It takes three input streams and outputs one stream, the first input is the
  5392. source, and second and third input are displacement maps.
  5393. The second input specifies how much to displace pixels along the
  5394. x-axis, while the third input specifies how much to displace pixels
  5395. along the y-axis.
  5396. If one of displacement map streams terminates, last frame from that
  5397. displacement map will be used.
  5398. Note that once generated, displacements maps can be reused over and over again.
  5399. A description of the accepted options follows.
  5400. @table @option
  5401. @item edge
  5402. Set displace behavior for pixels that are out of range.
  5403. Available values are:
  5404. @table @samp
  5405. @item blank
  5406. Missing pixels are replaced by black pixels.
  5407. @item smear
  5408. Adjacent pixels will spread out to replace missing pixels.
  5409. @item wrap
  5410. Out of range pixels are wrapped so they point to pixels of other side.
  5411. @item mirror
  5412. Out of range pixels will be replaced with mirrored pixels.
  5413. @end table
  5414. Default is @samp{smear}.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Add ripple effect to rgb input of video size hd720:
  5420. @example
  5421. 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
  5422. @end example
  5423. @item
  5424. Add wave effect to rgb input of video size hd720:
  5425. @example
  5426. 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
  5427. @end example
  5428. @end itemize
  5429. @section drawbox
  5430. Draw a colored box on the input image.
  5431. It accepts the following parameters:
  5432. @table @option
  5433. @item x
  5434. @item y
  5435. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5436. @item width, w
  5437. @item height, h
  5438. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5439. the input width and height. It defaults to 0.
  5440. @item color, c
  5441. Specify the color of the box to write. For the general syntax of this option,
  5442. check the "Color" section in the ffmpeg-utils manual. If the special
  5443. value @code{invert} is used, the box edge color is the same as the
  5444. video with inverted luma.
  5445. @item thickness, t
  5446. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5447. See below for the list of accepted constants.
  5448. @end table
  5449. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5450. following constants:
  5451. @table @option
  5452. @item dar
  5453. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5454. @item hsub
  5455. @item vsub
  5456. horizontal and vertical chroma subsample values. For example for the
  5457. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5458. @item in_h, ih
  5459. @item in_w, iw
  5460. The input width and height.
  5461. @item sar
  5462. The input sample aspect ratio.
  5463. @item x
  5464. @item y
  5465. The x and y offset coordinates where the box is drawn.
  5466. @item w
  5467. @item h
  5468. The width and height of the drawn box.
  5469. @item t
  5470. The thickness of the drawn box.
  5471. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5472. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5473. @end table
  5474. @subsection Examples
  5475. @itemize
  5476. @item
  5477. Draw a black box around the edge of the input image:
  5478. @example
  5479. drawbox
  5480. @end example
  5481. @item
  5482. Draw a box with color red and an opacity of 50%:
  5483. @example
  5484. drawbox=10:20:200:60:red@@0.5
  5485. @end example
  5486. The previous example can be specified as:
  5487. @example
  5488. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5489. @end example
  5490. @item
  5491. Fill the box with pink color:
  5492. @example
  5493. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5494. @end example
  5495. @item
  5496. Draw a 2-pixel red 2.40:1 mask:
  5497. @example
  5498. 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
  5499. @end example
  5500. @end itemize
  5501. @section drawgrid
  5502. Draw a grid on the input image.
  5503. It accepts the following parameters:
  5504. @table @option
  5505. @item x
  5506. @item y
  5507. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5508. @item width, w
  5509. @item height, h
  5510. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5511. input width and height, respectively, minus @code{thickness}, so image gets
  5512. framed. Default to 0.
  5513. @item color, c
  5514. Specify the color of the grid. For the general syntax of this option,
  5515. check the "Color" section in the ffmpeg-utils manual. If the special
  5516. value @code{invert} is used, the grid color is the same as the
  5517. video with inverted luma.
  5518. @item thickness, t
  5519. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5520. See below for the list of accepted constants.
  5521. @end table
  5522. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5523. following constants:
  5524. @table @option
  5525. @item dar
  5526. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5527. @item hsub
  5528. @item vsub
  5529. horizontal and vertical chroma subsample values. For example for the
  5530. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5531. @item in_h, ih
  5532. @item in_w, iw
  5533. The input grid cell width and height.
  5534. @item sar
  5535. The input sample aspect ratio.
  5536. @item x
  5537. @item y
  5538. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5539. @item w
  5540. @item h
  5541. The width and height of the drawn cell.
  5542. @item t
  5543. The thickness of the drawn cell.
  5544. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5545. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5546. @end table
  5547. @subsection Examples
  5548. @itemize
  5549. @item
  5550. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5551. @example
  5552. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5553. @end example
  5554. @item
  5555. Draw a white 3x3 grid with an opacity of 50%:
  5556. @example
  5557. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5558. @end example
  5559. @end itemize
  5560. @anchor{drawtext}
  5561. @section drawtext
  5562. Draw a text string or text from a specified file on top of a video, using the
  5563. libfreetype library.
  5564. To enable compilation of this filter, you need to configure FFmpeg with
  5565. @code{--enable-libfreetype}.
  5566. To enable default font fallback and the @var{font} option you need to
  5567. configure FFmpeg with @code{--enable-libfontconfig}.
  5568. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5569. @code{--enable-libfribidi}.
  5570. @subsection Syntax
  5571. It accepts the following parameters:
  5572. @table @option
  5573. @item box
  5574. Used to draw a box around text using the background color.
  5575. The value must be either 1 (enable) or 0 (disable).
  5576. The default value of @var{box} is 0.
  5577. @item boxborderw
  5578. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5579. The default value of @var{boxborderw} is 0.
  5580. @item boxcolor
  5581. The color to be used for drawing box around text. For the syntax of this
  5582. option, check the "Color" section in the ffmpeg-utils manual.
  5583. The default value of @var{boxcolor} is "white".
  5584. @item line_spacing
  5585. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5586. The default value of @var{line_spacing} is 0.
  5587. @item borderw
  5588. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5589. The default value of @var{borderw} is 0.
  5590. @item bordercolor
  5591. Set the color to be used for drawing border around text. For the syntax of this
  5592. option, check the "Color" section in the ffmpeg-utils manual.
  5593. The default value of @var{bordercolor} is "black".
  5594. @item expansion
  5595. Select how the @var{text} is expanded. Can be either @code{none},
  5596. @code{strftime} (deprecated) or
  5597. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5598. below for details.
  5599. @item basetime
  5600. Set a start time for the count. Value is in microseconds. Only applied
  5601. in the deprecated strftime expansion mode. To emulate in normal expansion
  5602. mode use the @code{pts} function, supplying the start time (in seconds)
  5603. as the second argument.
  5604. @item fix_bounds
  5605. If true, check and fix text coords to avoid clipping.
  5606. @item fontcolor
  5607. The color to be used for drawing fonts. For the syntax of this option, check
  5608. the "Color" section in the ffmpeg-utils manual.
  5609. The default value of @var{fontcolor} is "black".
  5610. @item fontcolor_expr
  5611. String which is expanded the same way as @var{text} to obtain dynamic
  5612. @var{fontcolor} value. By default this option has empty value and is not
  5613. processed. When this option is set, it overrides @var{fontcolor} option.
  5614. @item font
  5615. The font family to be used for drawing text. By default Sans.
  5616. @item fontfile
  5617. The font file to be used for drawing text. The path must be included.
  5618. This parameter is mandatory if the fontconfig support is disabled.
  5619. @item alpha
  5620. Draw the text applying alpha blending. The value can
  5621. be a number between 0.0 and 1.0.
  5622. The expression accepts the same variables @var{x, y} as well.
  5623. The default value is 1.
  5624. Please see @var{fontcolor_expr}.
  5625. @item fontsize
  5626. The font size to be used for drawing text.
  5627. The default value of @var{fontsize} is 16.
  5628. @item text_shaping
  5629. If set to 1, attempt to shape the text (for example, reverse the order of
  5630. right-to-left text and join Arabic characters) before drawing it.
  5631. Otherwise, just draw the text exactly as given.
  5632. By default 1 (if supported).
  5633. @item ft_load_flags
  5634. The flags to be used for loading the fonts.
  5635. The flags map the corresponding flags supported by libfreetype, and are
  5636. a combination of the following values:
  5637. @table @var
  5638. @item default
  5639. @item no_scale
  5640. @item no_hinting
  5641. @item render
  5642. @item no_bitmap
  5643. @item vertical_layout
  5644. @item force_autohint
  5645. @item crop_bitmap
  5646. @item pedantic
  5647. @item ignore_global_advance_width
  5648. @item no_recurse
  5649. @item ignore_transform
  5650. @item monochrome
  5651. @item linear_design
  5652. @item no_autohint
  5653. @end table
  5654. Default value is "default".
  5655. For more information consult the documentation for the FT_LOAD_*
  5656. libfreetype flags.
  5657. @item shadowcolor
  5658. The color to be used for drawing a shadow behind the drawn text. For the
  5659. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5660. The default value of @var{shadowcolor} is "black".
  5661. @item shadowx
  5662. @item shadowy
  5663. The x and y offsets for the text shadow position with respect to the
  5664. position of the text. They can be either positive or negative
  5665. values. The default value for both is "0".
  5666. @item start_number
  5667. The starting frame number for the n/frame_num variable. The default value
  5668. is "0".
  5669. @item tabsize
  5670. The size in number of spaces to use for rendering the tab.
  5671. Default value is 4.
  5672. @item timecode
  5673. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5674. format. It can be used with or without text parameter. @var{timecode_rate}
  5675. option must be specified.
  5676. @item timecode_rate, rate, r
  5677. Set the timecode frame rate (timecode only).
  5678. @item tc24hmax
  5679. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5680. Default is 0 (disabled).
  5681. @item text
  5682. The text string to be drawn. The text must be a sequence of UTF-8
  5683. encoded characters.
  5684. This parameter is mandatory if no file is specified with the parameter
  5685. @var{textfile}.
  5686. @item textfile
  5687. A text file containing text to be drawn. The text must be a sequence
  5688. of UTF-8 encoded characters.
  5689. This parameter is mandatory if no text string is specified with the
  5690. parameter @var{text}.
  5691. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5692. @item reload
  5693. If set to 1, the @var{textfile} will be reloaded before each frame.
  5694. Be sure to update it atomically, or it may be read partially, or even fail.
  5695. @item x
  5696. @item y
  5697. The expressions which specify the offsets where text will be drawn
  5698. within the video frame. They are relative to the top/left border of the
  5699. output image.
  5700. The default value of @var{x} and @var{y} is "0".
  5701. See below for the list of accepted constants and functions.
  5702. @end table
  5703. The parameters for @var{x} and @var{y} are expressions containing the
  5704. following constants and functions:
  5705. @table @option
  5706. @item dar
  5707. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5708. @item hsub
  5709. @item vsub
  5710. horizontal and vertical chroma subsample values. For example for the
  5711. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5712. @item line_h, lh
  5713. the height of each text line
  5714. @item main_h, h, H
  5715. the input height
  5716. @item main_w, w, W
  5717. the input width
  5718. @item max_glyph_a, ascent
  5719. the maximum distance from the baseline to the highest/upper grid
  5720. coordinate used to place a glyph outline point, for all the rendered
  5721. glyphs.
  5722. It is a positive value, due to the grid's orientation with the Y axis
  5723. upwards.
  5724. @item max_glyph_d, descent
  5725. the maximum distance from the baseline to the lowest grid coordinate
  5726. used to place a glyph outline point, for all the rendered glyphs.
  5727. This is a negative value, due to the grid's orientation, with the Y axis
  5728. upwards.
  5729. @item max_glyph_h
  5730. maximum glyph height, that is the maximum height for all the glyphs
  5731. contained in the rendered text, it is equivalent to @var{ascent} -
  5732. @var{descent}.
  5733. @item max_glyph_w
  5734. maximum glyph width, that is the maximum width for all the glyphs
  5735. contained in the rendered text
  5736. @item n
  5737. the number of input frame, starting from 0
  5738. @item rand(min, max)
  5739. return a random number included between @var{min} and @var{max}
  5740. @item sar
  5741. The input sample aspect ratio.
  5742. @item t
  5743. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5744. @item text_h, th
  5745. the height of the rendered text
  5746. @item text_w, tw
  5747. the width of the rendered text
  5748. @item x
  5749. @item y
  5750. the x and y offset coordinates where the text is drawn.
  5751. These parameters allow the @var{x} and @var{y} expressions to refer
  5752. each other, so you can for example specify @code{y=x/dar}.
  5753. @end table
  5754. @anchor{drawtext_expansion}
  5755. @subsection Text expansion
  5756. If @option{expansion} is set to @code{strftime},
  5757. the filter recognizes strftime() sequences in the provided text and
  5758. expands them accordingly. Check the documentation of strftime(). This
  5759. feature is deprecated.
  5760. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5761. If @option{expansion} is set to @code{normal} (which is the default),
  5762. the following expansion mechanism is used.
  5763. The backslash character @samp{\}, followed by any character, always expands to
  5764. the second character.
  5765. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5766. braces is a function name, possibly followed by arguments separated by ':'.
  5767. If the arguments contain special characters or delimiters (':' or '@}'),
  5768. they should be escaped.
  5769. Note that they probably must also be escaped as the value for the
  5770. @option{text} option in the filter argument string and as the filter
  5771. argument in the filtergraph description, and possibly also for the shell,
  5772. that makes up to four levels of escaping; using a text file avoids these
  5773. problems.
  5774. The following functions are available:
  5775. @table @command
  5776. @item expr, e
  5777. The expression evaluation result.
  5778. It must take one argument specifying the expression to be evaluated,
  5779. which accepts the same constants and functions as the @var{x} and
  5780. @var{y} values. Note that not all constants should be used, for
  5781. example the text size is not known when evaluating the expression, so
  5782. the constants @var{text_w} and @var{text_h} will have an undefined
  5783. value.
  5784. @item expr_int_format, eif
  5785. Evaluate the expression's value and output as formatted integer.
  5786. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5787. The second argument specifies the output format. Allowed values are @samp{x},
  5788. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5789. @code{printf} function.
  5790. The third parameter is optional and sets the number of positions taken by the output.
  5791. It can be used to add padding with zeros from the left.
  5792. @item gmtime
  5793. The time at which the filter is running, expressed in UTC.
  5794. It can accept an argument: a strftime() format string.
  5795. @item localtime
  5796. The time at which the filter is running, expressed in the local time zone.
  5797. It can accept an argument: a strftime() format string.
  5798. @item metadata
  5799. Frame metadata. Takes one or two arguments.
  5800. The first argument is mandatory and specifies the metadata key.
  5801. The second argument is optional and specifies a default value, used when the
  5802. metadata key is not found or empty.
  5803. @item n, frame_num
  5804. The frame number, starting from 0.
  5805. @item pict_type
  5806. A 1 character description of the current picture type.
  5807. @item pts
  5808. The timestamp of the current frame.
  5809. It can take up to three arguments.
  5810. The first argument is the format of the timestamp; it defaults to @code{flt}
  5811. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5812. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5813. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5814. @code{localtime} stands for the timestamp of the frame formatted as
  5815. local time zone time.
  5816. The second argument is an offset added to the timestamp.
  5817. If the format is set to @code{localtime} or @code{gmtime},
  5818. a third argument may be supplied: a strftime() format string.
  5819. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5820. @end table
  5821. @subsection Examples
  5822. @itemize
  5823. @item
  5824. Draw "Test Text" with font FreeSerif, using the default values for the
  5825. optional parameters.
  5826. @example
  5827. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5828. @end example
  5829. @item
  5830. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5831. and y=50 (counting from the top-left corner of the screen), text is
  5832. yellow with a red box around it. Both the text and the box have an
  5833. opacity of 20%.
  5834. @example
  5835. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5836. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5837. @end example
  5838. Note that the double quotes are not necessary if spaces are not used
  5839. within the parameter list.
  5840. @item
  5841. Show the text at the center of the video frame:
  5842. @example
  5843. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5844. @end example
  5845. @item
  5846. Show the text at a random position, switching to a new position every 30 seconds:
  5847. @example
  5848. 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)"
  5849. @end example
  5850. @item
  5851. Show a text line sliding from right to left in the last row of the video
  5852. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5853. with no newlines.
  5854. @example
  5855. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5856. @end example
  5857. @item
  5858. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5859. @example
  5860. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5861. @end example
  5862. @item
  5863. Draw a single green letter "g", at the center of the input video.
  5864. The glyph baseline is placed at half screen height.
  5865. @example
  5866. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5867. @end example
  5868. @item
  5869. Show text for 1 second every 3 seconds:
  5870. @example
  5871. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5872. @end example
  5873. @item
  5874. Use fontconfig to set the font. Note that the colons need to be escaped.
  5875. @example
  5876. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5877. @end example
  5878. @item
  5879. Print the date of a real-time encoding (see strftime(3)):
  5880. @example
  5881. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5882. @end example
  5883. @item
  5884. Show text fading in and out (appearing/disappearing):
  5885. @example
  5886. #!/bin/sh
  5887. DS=1.0 # display start
  5888. DE=10.0 # display end
  5889. FID=1.5 # fade in duration
  5890. FOD=5 # fade out duration
  5891. 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 @}"
  5892. @end example
  5893. @item
  5894. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5895. and the @option{fontsize} value are included in the @option{y} offset.
  5896. @example
  5897. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5898. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5899. @end example
  5900. @end itemize
  5901. For more information about libfreetype, check:
  5902. @url{http://www.freetype.org/}.
  5903. For more information about fontconfig, check:
  5904. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5905. For more information about libfribidi, check:
  5906. @url{http://fribidi.org/}.
  5907. @section edgedetect
  5908. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5909. The filter accepts the following options:
  5910. @table @option
  5911. @item low
  5912. @item high
  5913. Set low and high threshold values used by the Canny thresholding
  5914. algorithm.
  5915. The high threshold selects the "strong" edge pixels, which are then
  5916. connected through 8-connectivity with the "weak" edge pixels selected
  5917. by the low threshold.
  5918. @var{low} and @var{high} threshold values must be chosen in the range
  5919. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5920. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5921. is @code{50/255}.
  5922. @item mode
  5923. Define the drawing mode.
  5924. @table @samp
  5925. @item wires
  5926. Draw white/gray wires on black background.
  5927. @item colormix
  5928. Mix the colors to create a paint/cartoon effect.
  5929. @end table
  5930. Default value is @var{wires}.
  5931. @end table
  5932. @subsection Examples
  5933. @itemize
  5934. @item
  5935. Standard edge detection with custom values for the hysteresis thresholding:
  5936. @example
  5937. edgedetect=low=0.1:high=0.4
  5938. @end example
  5939. @item
  5940. Painting effect without thresholding:
  5941. @example
  5942. edgedetect=mode=colormix:high=0
  5943. @end example
  5944. @end itemize
  5945. @section eq
  5946. Set brightness, contrast, saturation and approximate gamma adjustment.
  5947. The filter accepts the following options:
  5948. @table @option
  5949. @item contrast
  5950. Set the contrast expression. The value must be a float value in range
  5951. @code{-2.0} to @code{2.0}. The default value is "1".
  5952. @item brightness
  5953. Set the brightness expression. The value must be a float value in
  5954. range @code{-1.0} to @code{1.0}. The default value is "0".
  5955. @item saturation
  5956. Set the saturation expression. The value must be a float in
  5957. range @code{0.0} to @code{3.0}. The default value is "1".
  5958. @item gamma
  5959. Set the gamma expression. The value must be a float in range
  5960. @code{0.1} to @code{10.0}. The default value is "1".
  5961. @item gamma_r
  5962. Set the gamma expression for red. The value must be a float in
  5963. range @code{0.1} to @code{10.0}. The default value is "1".
  5964. @item gamma_g
  5965. Set the gamma expression for green. The value must be a float in range
  5966. @code{0.1} to @code{10.0}. The default value is "1".
  5967. @item gamma_b
  5968. Set the gamma expression for blue. The value must be a float in range
  5969. @code{0.1} to @code{10.0}. The default value is "1".
  5970. @item gamma_weight
  5971. Set the gamma weight expression. It can be used to reduce the effect
  5972. of a high gamma value on bright image areas, e.g. keep them from
  5973. getting overamplified and just plain white. The value must be a float
  5974. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5975. gamma correction all the way down while @code{1.0} leaves it at its
  5976. full strength. Default is "1".
  5977. @item eval
  5978. Set when the expressions for brightness, contrast, saturation and
  5979. gamma expressions are evaluated.
  5980. It accepts the following values:
  5981. @table @samp
  5982. @item init
  5983. only evaluate expressions once during the filter initialization or
  5984. when a command is processed
  5985. @item frame
  5986. evaluate expressions for each incoming frame
  5987. @end table
  5988. Default value is @samp{init}.
  5989. @end table
  5990. The expressions accept the following parameters:
  5991. @table @option
  5992. @item n
  5993. frame count of the input frame starting from 0
  5994. @item pos
  5995. byte position of the corresponding packet in the input file, NAN if
  5996. unspecified
  5997. @item r
  5998. frame rate of the input video, NAN if the input frame rate is unknown
  5999. @item t
  6000. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6001. @end table
  6002. @subsection Commands
  6003. The filter supports the following commands:
  6004. @table @option
  6005. @item contrast
  6006. Set the contrast expression.
  6007. @item brightness
  6008. Set the brightness expression.
  6009. @item saturation
  6010. Set the saturation expression.
  6011. @item gamma
  6012. Set the gamma expression.
  6013. @item gamma_r
  6014. Set the gamma_r expression.
  6015. @item gamma_g
  6016. Set gamma_g expression.
  6017. @item gamma_b
  6018. Set gamma_b expression.
  6019. @item gamma_weight
  6020. Set gamma_weight expression.
  6021. The command accepts the same syntax of the corresponding option.
  6022. If the specified expression is not valid, it is kept at its current
  6023. value.
  6024. @end table
  6025. @section erosion
  6026. Apply erosion effect to the video.
  6027. This filter replaces the pixel by the local(3x3) minimum.
  6028. It accepts the following options:
  6029. @table @option
  6030. @item threshold0
  6031. @item threshold1
  6032. @item threshold2
  6033. @item threshold3
  6034. Limit the maximum change for each plane, default is 65535.
  6035. If 0, plane will remain unchanged.
  6036. @item coordinates
  6037. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6038. pixels are used.
  6039. Flags to local 3x3 coordinates maps like this:
  6040. 1 2 3
  6041. 4 5
  6042. 6 7 8
  6043. @end table
  6044. @section extractplanes
  6045. Extract color channel components from input video stream into
  6046. separate grayscale video streams.
  6047. The filter accepts the following option:
  6048. @table @option
  6049. @item planes
  6050. Set plane(s) to extract.
  6051. Available values for planes are:
  6052. @table @samp
  6053. @item y
  6054. @item u
  6055. @item v
  6056. @item a
  6057. @item r
  6058. @item g
  6059. @item b
  6060. @end table
  6061. Choosing planes not available in the input will result in an error.
  6062. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6063. with @code{y}, @code{u}, @code{v} planes at same time.
  6064. @end table
  6065. @subsection Examples
  6066. @itemize
  6067. @item
  6068. Extract luma, u and v color channel component from input video frame
  6069. into 3 grayscale outputs:
  6070. @example
  6071. 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
  6072. @end example
  6073. @end itemize
  6074. @section elbg
  6075. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6076. For each input image, the filter will compute the optimal mapping from
  6077. the input to the output given the codebook length, that is the number
  6078. of distinct output colors.
  6079. This filter accepts the following options.
  6080. @table @option
  6081. @item codebook_length, l
  6082. Set codebook length. The value must be a positive integer, and
  6083. represents the number of distinct output colors. Default value is 256.
  6084. @item nb_steps, n
  6085. Set the maximum number of iterations to apply for computing the optimal
  6086. mapping. The higher the value the better the result and the higher the
  6087. computation time. Default value is 1.
  6088. @item seed, s
  6089. Set a random seed, must be an integer included between 0 and
  6090. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6091. will try to use a good random seed on a best effort basis.
  6092. @item pal8
  6093. Set pal8 output pixel format. This option does not work with codebook
  6094. length greater than 256.
  6095. @end table
  6096. @section fade
  6097. Apply a fade-in/out effect to the input video.
  6098. It accepts the following parameters:
  6099. @table @option
  6100. @item type, t
  6101. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6102. effect.
  6103. Default is @code{in}.
  6104. @item start_frame, s
  6105. Specify the number of the frame to start applying the fade
  6106. effect at. Default is 0.
  6107. @item nb_frames, n
  6108. The number of frames that the fade effect lasts. At the end of the
  6109. fade-in effect, the output video will have the same intensity as the input video.
  6110. At the end of the fade-out transition, the output video will be filled with the
  6111. selected @option{color}.
  6112. Default is 25.
  6113. @item alpha
  6114. If set to 1, fade only alpha channel, if one exists on the input.
  6115. Default value is 0.
  6116. @item start_time, st
  6117. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6118. effect. If both start_frame and start_time are specified, the fade will start at
  6119. whichever comes last. Default is 0.
  6120. @item duration, d
  6121. The number of seconds for which the fade effect has to last. At the end of the
  6122. fade-in effect the output video will have the same intensity as the input video,
  6123. at the end of the fade-out transition the output video will be filled with the
  6124. selected @option{color}.
  6125. If both duration and nb_frames are specified, duration is used. Default is 0
  6126. (nb_frames is used by default).
  6127. @item color, c
  6128. Specify the color of the fade. Default is "black".
  6129. @end table
  6130. @subsection Examples
  6131. @itemize
  6132. @item
  6133. Fade in the first 30 frames of video:
  6134. @example
  6135. fade=in:0:30
  6136. @end example
  6137. The command above is equivalent to:
  6138. @example
  6139. fade=t=in:s=0:n=30
  6140. @end example
  6141. @item
  6142. Fade out the last 45 frames of a 200-frame video:
  6143. @example
  6144. fade=out:155:45
  6145. fade=type=out:start_frame=155:nb_frames=45
  6146. @end example
  6147. @item
  6148. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6149. @example
  6150. fade=in:0:25, fade=out:975:25
  6151. @end example
  6152. @item
  6153. Make the first 5 frames yellow, then fade in from frame 5-24:
  6154. @example
  6155. fade=in:5:20:color=yellow
  6156. @end example
  6157. @item
  6158. Fade in alpha over first 25 frames of video:
  6159. @example
  6160. fade=in:0:25:alpha=1
  6161. @end example
  6162. @item
  6163. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6164. @example
  6165. fade=t=in:st=5.5:d=0.5
  6166. @end example
  6167. @end itemize
  6168. @section fftfilt
  6169. Apply arbitrary expressions to samples in frequency domain
  6170. @table @option
  6171. @item dc_Y
  6172. Adjust the dc value (gain) of the luma plane of the image. The filter
  6173. accepts an integer value in range @code{0} to @code{1000}. The default
  6174. value is set to @code{0}.
  6175. @item dc_U
  6176. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6177. filter accepts an integer value in range @code{0} to @code{1000}. The
  6178. default value is set to @code{0}.
  6179. @item dc_V
  6180. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6181. filter accepts an integer value in range @code{0} to @code{1000}. The
  6182. default value is set to @code{0}.
  6183. @item weight_Y
  6184. Set the frequency domain weight expression for the luma plane.
  6185. @item weight_U
  6186. Set the frequency domain weight expression for the 1st chroma plane.
  6187. @item weight_V
  6188. Set the frequency domain weight expression for the 2nd chroma plane.
  6189. @item eval
  6190. Set when the expressions are evaluated.
  6191. It accepts the following values:
  6192. @table @samp
  6193. @item init
  6194. Only evaluate expressions once during the filter initialization.
  6195. @item frame
  6196. Evaluate expressions for each incoming frame.
  6197. @end table
  6198. Default value is @samp{init}.
  6199. The filter accepts the following variables:
  6200. @item X
  6201. @item Y
  6202. The coordinates of the current sample.
  6203. @item W
  6204. @item H
  6205. The width and height of the image.
  6206. @item N
  6207. The number of input frame, starting from 0.
  6208. @end table
  6209. @subsection Examples
  6210. @itemize
  6211. @item
  6212. High-pass:
  6213. @example
  6214. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6215. @end example
  6216. @item
  6217. Low-pass:
  6218. @example
  6219. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6220. @end example
  6221. @item
  6222. Sharpen:
  6223. @example
  6224. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6225. @end example
  6226. @item
  6227. Blur:
  6228. @example
  6229. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6230. @end example
  6231. @end itemize
  6232. @section field
  6233. Extract a single field from an interlaced image using stride
  6234. arithmetic to avoid wasting CPU time. The output frames are marked as
  6235. non-interlaced.
  6236. The filter accepts the following options:
  6237. @table @option
  6238. @item type
  6239. Specify whether to extract the top (if the value is @code{0} or
  6240. @code{top}) or the bottom field (if the value is @code{1} or
  6241. @code{bottom}).
  6242. @end table
  6243. @section fieldhint
  6244. Create new frames by copying the top and bottom fields from surrounding frames
  6245. supplied as numbers by the hint file.
  6246. @table @option
  6247. @item hint
  6248. Set file containing hints: absolute/relative frame numbers.
  6249. There must be one line for each frame in a clip. Each line must contain two
  6250. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6251. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6252. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6253. for @code{relative} mode. First number tells from which frame to pick up top
  6254. field and second number tells from which frame to pick up bottom field.
  6255. If optionally followed by @code{+} output frame will be marked as interlaced,
  6256. else if followed by @code{-} output frame will be marked as progressive, else
  6257. it will be marked same as input frame.
  6258. If line starts with @code{#} or @code{;} that line is skipped.
  6259. @item mode
  6260. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6261. @end table
  6262. Example of first several lines of @code{hint} file for @code{relative} mode:
  6263. @example
  6264. 0,0 - # first frame
  6265. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6266. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6267. 1,0 -
  6268. 0,0 -
  6269. 0,0 -
  6270. 1,0 -
  6271. 1,0 -
  6272. 1,0 -
  6273. 0,0 -
  6274. 0,0 -
  6275. 1,0 -
  6276. 1,0 -
  6277. 1,0 -
  6278. 0,0 -
  6279. @end example
  6280. @section fieldmatch
  6281. Field matching filter for inverse telecine. It is meant to reconstruct the
  6282. progressive frames from a telecined stream. The filter does not drop duplicated
  6283. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6284. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6285. The separation of the field matching and the decimation is notably motivated by
  6286. the possibility of inserting a de-interlacing filter fallback between the two.
  6287. If the source has mixed telecined and real interlaced content,
  6288. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6289. But these remaining combed frames will be marked as interlaced, and thus can be
  6290. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6291. In addition to the various configuration options, @code{fieldmatch} can take an
  6292. optional second stream, activated through the @option{ppsrc} option. If
  6293. enabled, the frames reconstruction will be based on the fields and frames from
  6294. this second stream. This allows the first input to be pre-processed in order to
  6295. help the various algorithms of the filter, while keeping the output lossless
  6296. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6297. or brightness/contrast adjustments can help.
  6298. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6299. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6300. which @code{fieldmatch} is based on. While the semantic and usage are very
  6301. close, some behaviour and options names can differ.
  6302. The @ref{decimate} filter currently only works for constant frame rate input.
  6303. If your input has mixed telecined (30fps) and progressive content with a lower
  6304. framerate like 24fps use the following filterchain to produce the necessary cfr
  6305. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6306. The filter accepts the following options:
  6307. @table @option
  6308. @item order
  6309. Specify the assumed field order of the input stream. Available values are:
  6310. @table @samp
  6311. @item auto
  6312. Auto detect parity (use FFmpeg's internal parity value).
  6313. @item bff
  6314. Assume bottom field first.
  6315. @item tff
  6316. Assume top field first.
  6317. @end table
  6318. Note that it is sometimes recommended not to trust the parity announced by the
  6319. stream.
  6320. Default value is @var{auto}.
  6321. @item mode
  6322. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6323. sense that it won't risk creating jerkiness due to duplicate frames when
  6324. possible, but if there are bad edits or blended fields it will end up
  6325. outputting combed frames when a good match might actually exist. On the other
  6326. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6327. but will almost always find a good frame if there is one. The other values are
  6328. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6329. jerkiness and creating duplicate frames versus finding good matches in sections
  6330. with bad edits, orphaned fields, blended fields, etc.
  6331. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6332. Available values are:
  6333. @table @samp
  6334. @item pc
  6335. 2-way matching (p/c)
  6336. @item pc_n
  6337. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6338. @item pc_u
  6339. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6340. @item pc_n_ub
  6341. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6342. still combed (p/c + n + u/b)
  6343. @item pcn
  6344. 3-way matching (p/c/n)
  6345. @item pcn_ub
  6346. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6347. detected as combed (p/c/n + u/b)
  6348. @end table
  6349. The parenthesis at the end indicate the matches that would be used for that
  6350. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6351. @var{top}).
  6352. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6353. the slowest.
  6354. Default value is @var{pc_n}.
  6355. @item ppsrc
  6356. Mark the main input stream as a pre-processed input, and enable the secondary
  6357. input stream as the clean source to pick the fields from. See the filter
  6358. introduction for more details. It is similar to the @option{clip2} feature from
  6359. VFM/TFM.
  6360. Default value is @code{0} (disabled).
  6361. @item field
  6362. Set the field to match from. It is recommended to set this to the same value as
  6363. @option{order} unless you experience matching failures with that setting. In
  6364. certain circumstances changing the field that is used to match from can have a
  6365. large impact on matching performance. Available values are:
  6366. @table @samp
  6367. @item auto
  6368. Automatic (same value as @option{order}).
  6369. @item bottom
  6370. Match from the bottom field.
  6371. @item top
  6372. Match from the top field.
  6373. @end table
  6374. Default value is @var{auto}.
  6375. @item mchroma
  6376. Set whether or not chroma is included during the match comparisons. In most
  6377. cases it is recommended to leave this enabled. You should set this to @code{0}
  6378. only if your clip has bad chroma problems such as heavy rainbowing or other
  6379. artifacts. Setting this to @code{0} could also be used to speed things up at
  6380. the cost of some accuracy.
  6381. Default value is @code{1}.
  6382. @item y0
  6383. @item y1
  6384. These define an exclusion band which excludes the lines between @option{y0} and
  6385. @option{y1} from being included in the field matching decision. An exclusion
  6386. band can be used to ignore subtitles, a logo, or other things that may
  6387. interfere with the matching. @option{y0} sets the starting scan line and
  6388. @option{y1} sets the ending line; all lines in between @option{y0} and
  6389. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6390. @option{y0} and @option{y1} to the same value will disable the feature.
  6391. @option{y0} and @option{y1} defaults to @code{0}.
  6392. @item scthresh
  6393. Set the scene change detection threshold as a percentage of maximum change on
  6394. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6395. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6396. @option{scthresh} is @code{[0.0, 100.0]}.
  6397. Default value is @code{12.0}.
  6398. @item combmatch
  6399. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6400. account the combed scores of matches when deciding what match to use as the
  6401. final match. Available values are:
  6402. @table @samp
  6403. @item none
  6404. No final matching based on combed scores.
  6405. @item sc
  6406. Combed scores are only used when a scene change is detected.
  6407. @item full
  6408. Use combed scores all the time.
  6409. @end table
  6410. Default is @var{sc}.
  6411. @item combdbg
  6412. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6413. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6414. Available values are:
  6415. @table @samp
  6416. @item none
  6417. No forced calculation.
  6418. @item pcn
  6419. Force p/c/n calculations.
  6420. @item pcnub
  6421. Force p/c/n/u/b calculations.
  6422. @end table
  6423. Default value is @var{none}.
  6424. @item cthresh
  6425. This is the area combing threshold used for combed frame detection. This
  6426. essentially controls how "strong" or "visible" combing must be to be detected.
  6427. Larger values mean combing must be more visible and smaller values mean combing
  6428. can be less visible or strong and still be detected. Valid settings are from
  6429. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6430. be detected as combed). This is basically a pixel difference value. A good
  6431. range is @code{[8, 12]}.
  6432. Default value is @code{9}.
  6433. @item chroma
  6434. Sets whether or not chroma is considered in the combed frame decision. Only
  6435. disable this if your source has chroma problems (rainbowing, etc.) that are
  6436. causing problems for the combed frame detection with chroma enabled. Actually,
  6437. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6438. where there is chroma only combing in the source.
  6439. Default value is @code{0}.
  6440. @item blockx
  6441. @item blocky
  6442. Respectively set the x-axis and y-axis size of the window used during combed
  6443. frame detection. This has to do with the size of the area in which
  6444. @option{combpel} pixels are required to be detected as combed for a frame to be
  6445. declared combed. See the @option{combpel} parameter description for more info.
  6446. Possible values are any number that is a power of 2 starting at 4 and going up
  6447. to 512.
  6448. Default value is @code{16}.
  6449. @item combpel
  6450. The number of combed pixels inside any of the @option{blocky} by
  6451. @option{blockx} size blocks on the frame for the frame to be detected as
  6452. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6453. setting controls "how much" combing there must be in any localized area (a
  6454. window defined by the @option{blockx} and @option{blocky} settings) on the
  6455. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6456. which point no frames will ever be detected as combed). This setting is known
  6457. as @option{MI} in TFM/VFM vocabulary.
  6458. Default value is @code{80}.
  6459. @end table
  6460. @anchor{p/c/n/u/b meaning}
  6461. @subsection p/c/n/u/b meaning
  6462. @subsubsection p/c/n
  6463. We assume the following telecined stream:
  6464. @example
  6465. Top fields: 1 2 2 3 4
  6466. Bottom fields: 1 2 3 4 4
  6467. @end example
  6468. The numbers correspond to the progressive frame the fields relate to. Here, the
  6469. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6470. When @code{fieldmatch} is configured to run a matching from bottom
  6471. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6472. @example
  6473. Input stream:
  6474. T 1 2 2 3 4
  6475. B 1 2 3 4 4 <-- matching reference
  6476. Matches: c c n n c
  6477. Output stream:
  6478. T 1 2 3 4 4
  6479. B 1 2 3 4 4
  6480. @end example
  6481. As a result of the field matching, we can see that some frames get duplicated.
  6482. To perform a complete inverse telecine, you need to rely on a decimation filter
  6483. after this operation. See for instance the @ref{decimate} filter.
  6484. The same operation now matching from top fields (@option{field}=@var{top})
  6485. looks like this:
  6486. @example
  6487. Input stream:
  6488. T 1 2 2 3 4 <-- matching reference
  6489. B 1 2 3 4 4
  6490. Matches: c c p p c
  6491. Output stream:
  6492. T 1 2 2 3 4
  6493. B 1 2 2 3 4
  6494. @end example
  6495. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6496. basically, they refer to the frame and field of the opposite parity:
  6497. @itemize
  6498. @item @var{p} matches the field of the opposite parity in the previous frame
  6499. @item @var{c} matches the field of the opposite parity in the current frame
  6500. @item @var{n} matches the field of the opposite parity in the next frame
  6501. @end itemize
  6502. @subsubsection u/b
  6503. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6504. from the opposite parity flag. In the following examples, we assume that we are
  6505. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6506. 'x' is placed above and below each matched fields.
  6507. With bottom matching (@option{field}=@var{bottom}):
  6508. @example
  6509. Match: c p n b u
  6510. x x x x x
  6511. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6512. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6513. x x x x x
  6514. Output frames:
  6515. 2 1 2 2 2
  6516. 2 2 2 1 3
  6517. @end example
  6518. With top matching (@option{field}=@var{top}):
  6519. @example
  6520. Match: c p n b u
  6521. x x x x x
  6522. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6523. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6524. x x x x x
  6525. Output frames:
  6526. 2 2 2 1 2
  6527. 2 1 3 2 2
  6528. @end example
  6529. @subsection Examples
  6530. Simple IVTC of a top field first telecined stream:
  6531. @example
  6532. fieldmatch=order=tff:combmatch=none, decimate
  6533. @end example
  6534. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6535. @example
  6536. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6537. @end example
  6538. @section fieldorder
  6539. Transform the field order of the input video.
  6540. It accepts the following parameters:
  6541. @table @option
  6542. @item order
  6543. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6544. for bottom field first.
  6545. @end table
  6546. The default value is @samp{tff}.
  6547. The transformation is done by shifting the picture content up or down
  6548. by one line, and filling the remaining line with appropriate picture content.
  6549. This method is consistent with most broadcast field order converters.
  6550. If the input video is not flagged as being interlaced, or it is already
  6551. flagged as being of the required output field order, then this filter does
  6552. not alter the incoming video.
  6553. It is very useful when converting to or from PAL DV material,
  6554. which is bottom field first.
  6555. For example:
  6556. @example
  6557. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6558. @end example
  6559. @section fifo, afifo
  6560. Buffer input images and send them when they are requested.
  6561. It is mainly useful when auto-inserted by the libavfilter
  6562. framework.
  6563. It does not take parameters.
  6564. @section find_rect
  6565. Find a rectangular object
  6566. It accepts the following options:
  6567. @table @option
  6568. @item object
  6569. Filepath of the object image, needs to be in gray8.
  6570. @item threshold
  6571. Detection threshold, default is 0.5.
  6572. @item mipmaps
  6573. Number of mipmaps, default is 3.
  6574. @item xmin, ymin, xmax, ymax
  6575. Specifies the rectangle in which to search.
  6576. @end table
  6577. @subsection Examples
  6578. @itemize
  6579. @item
  6580. Generate a representative palette of a given video using @command{ffmpeg}:
  6581. @example
  6582. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6583. @end example
  6584. @end itemize
  6585. @section cover_rect
  6586. Cover a rectangular object
  6587. It accepts the following options:
  6588. @table @option
  6589. @item cover
  6590. Filepath of the optional cover image, needs to be in yuv420.
  6591. @item mode
  6592. Set covering mode.
  6593. It accepts the following values:
  6594. @table @samp
  6595. @item cover
  6596. cover it by the supplied image
  6597. @item blur
  6598. cover it by interpolating the surrounding pixels
  6599. @end table
  6600. Default value is @var{blur}.
  6601. @end table
  6602. @subsection Examples
  6603. @itemize
  6604. @item
  6605. Generate a representative palette of a given video using @command{ffmpeg}:
  6606. @example
  6607. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6608. @end example
  6609. @end itemize
  6610. @section floodfill
  6611. Flood area with values of same pixel components with another values.
  6612. It accepts the following options:
  6613. @table @option
  6614. @item x
  6615. Set pixel x coordinate.
  6616. @item y
  6617. Set pixel y coordinate.
  6618. @item s0
  6619. Set source #0 component value.
  6620. @item s1
  6621. Set source #1 component value.
  6622. @item s2
  6623. Set source #2 component value.
  6624. @item s3
  6625. Set source #3 component value.
  6626. @item d0
  6627. Set destination #0 component value.
  6628. @item d1
  6629. Set destination #1 component value.
  6630. @item d2
  6631. Set destination #2 component value.
  6632. @item d3
  6633. Set destination #3 component value.
  6634. @end table
  6635. @anchor{format}
  6636. @section format
  6637. Convert the input video to one of the specified pixel formats.
  6638. Libavfilter will try to pick one that is suitable as input to
  6639. the next filter.
  6640. It accepts the following parameters:
  6641. @table @option
  6642. @item pix_fmts
  6643. A '|'-separated list of pixel format names, such as
  6644. "pix_fmts=yuv420p|monow|rgb24".
  6645. @end table
  6646. @subsection Examples
  6647. @itemize
  6648. @item
  6649. Convert the input video to the @var{yuv420p} format
  6650. @example
  6651. format=pix_fmts=yuv420p
  6652. @end example
  6653. Convert the input video to any of the formats in the list
  6654. @example
  6655. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6656. @end example
  6657. @end itemize
  6658. @anchor{fps}
  6659. @section fps
  6660. Convert the video to specified constant frame rate by duplicating or dropping
  6661. frames as necessary.
  6662. It accepts the following parameters:
  6663. @table @option
  6664. @item fps
  6665. The desired output frame rate. The default is @code{25}.
  6666. @item start_time
  6667. Assume the first PTS should be the given value, in seconds. This allows for
  6668. padding/trimming at the start of stream. By default, no assumption is made
  6669. about the first frame's expected PTS, so no padding or trimming is done.
  6670. For example, this could be set to 0 to pad the beginning with duplicates of
  6671. the first frame if a video stream starts after the audio stream or to trim any
  6672. frames with a negative PTS.
  6673. @item round
  6674. Timestamp (PTS) rounding method.
  6675. Possible values are:
  6676. @table @option
  6677. @item zero
  6678. round towards 0
  6679. @item inf
  6680. round away from 0
  6681. @item down
  6682. round towards -infinity
  6683. @item up
  6684. round towards +infinity
  6685. @item near
  6686. round to nearest
  6687. @end table
  6688. The default is @code{near}.
  6689. @item eof_action
  6690. Action performed when reading the last frame.
  6691. Possible values are:
  6692. @table @option
  6693. @item round
  6694. Use same timestamp rounding method as used for other frames.
  6695. @item pass
  6696. Pass through last frame if input duration has not been reached yet.
  6697. @end table
  6698. The default is @code{round}.
  6699. @end table
  6700. Alternatively, the options can be specified as a flat string:
  6701. @var{fps}[:@var{start_time}[:@var{round}]].
  6702. See also the @ref{setpts} filter.
  6703. @subsection Examples
  6704. @itemize
  6705. @item
  6706. A typical usage in order to set the fps to 25:
  6707. @example
  6708. fps=fps=25
  6709. @end example
  6710. @item
  6711. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6712. @example
  6713. fps=fps=film:round=near
  6714. @end example
  6715. @end itemize
  6716. @section framepack
  6717. Pack two different video streams into a stereoscopic video, setting proper
  6718. metadata on supported codecs. The two views should have the same size and
  6719. framerate and processing will stop when the shorter video ends. Please note
  6720. that you may conveniently adjust view properties with the @ref{scale} and
  6721. @ref{fps} filters.
  6722. It accepts the following parameters:
  6723. @table @option
  6724. @item format
  6725. The desired packing format. Supported values are:
  6726. @table @option
  6727. @item sbs
  6728. The views are next to each other (default).
  6729. @item tab
  6730. The views are on top of each other.
  6731. @item lines
  6732. The views are packed by line.
  6733. @item columns
  6734. The views are packed by column.
  6735. @item frameseq
  6736. The views are temporally interleaved.
  6737. @end table
  6738. @end table
  6739. Some examples:
  6740. @example
  6741. # Convert left and right views into a frame-sequential video
  6742. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6743. # Convert views into a side-by-side video with the same output resolution as the input
  6744. 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
  6745. @end example
  6746. @section framerate
  6747. Change the frame rate by interpolating new video output frames from the source
  6748. frames.
  6749. This filter is not designed to function correctly with interlaced media. If
  6750. you wish to change the frame rate of interlaced media then you are required
  6751. to deinterlace before this filter and re-interlace after this filter.
  6752. A description of the accepted options follows.
  6753. @table @option
  6754. @item fps
  6755. Specify the output frames per second. This option can also be specified
  6756. as a value alone. The default is @code{50}.
  6757. @item interp_start
  6758. Specify the start of a range where the output frame will be created as a
  6759. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6760. the default is @code{15}.
  6761. @item interp_end
  6762. Specify the end of a range where the output frame will be created as a
  6763. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6764. the default is @code{240}.
  6765. @item scene
  6766. Specify the level at which a scene change is detected as a value between
  6767. 0 and 100 to indicate a new scene; a low value reflects a low
  6768. probability for the current frame to introduce a new scene, while a higher
  6769. value means the current frame is more likely to be one.
  6770. The default is @code{7}.
  6771. @item flags
  6772. Specify flags influencing the filter process.
  6773. Available value for @var{flags} is:
  6774. @table @option
  6775. @item scene_change_detect, scd
  6776. Enable scene change detection using the value of the option @var{scene}.
  6777. This flag is enabled by default.
  6778. @end table
  6779. @end table
  6780. @section framestep
  6781. Select one frame every N-th frame.
  6782. This filter accepts the following option:
  6783. @table @option
  6784. @item step
  6785. Select frame after every @code{step} frames.
  6786. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6787. @end table
  6788. @anchor{frei0r}
  6789. @section frei0r
  6790. Apply a frei0r effect to the input video.
  6791. To enable the compilation of this filter, you need to install the frei0r
  6792. header and configure FFmpeg with @code{--enable-frei0r}.
  6793. It accepts the following parameters:
  6794. @table @option
  6795. @item filter_name
  6796. The name of the frei0r effect to load. If the environment variable
  6797. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6798. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6799. Otherwise, the standard frei0r paths are searched, in this order:
  6800. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6801. @file{/usr/lib/frei0r-1/}.
  6802. @item filter_params
  6803. A '|'-separated list of parameters to pass to the frei0r effect.
  6804. @end table
  6805. A frei0r effect parameter can be a boolean (its value is either
  6806. "y" or "n"), a double, a color (specified as
  6807. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6808. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6809. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6810. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6811. The number and types of parameters depend on the loaded effect. If an
  6812. effect parameter is not specified, the default value is set.
  6813. @subsection Examples
  6814. @itemize
  6815. @item
  6816. Apply the distort0r effect, setting the first two double parameters:
  6817. @example
  6818. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6819. @end example
  6820. @item
  6821. Apply the colordistance effect, taking a color as the first parameter:
  6822. @example
  6823. frei0r=colordistance:0.2/0.3/0.4
  6824. frei0r=colordistance:violet
  6825. frei0r=colordistance:0x112233
  6826. @end example
  6827. @item
  6828. Apply the perspective effect, specifying the top left and top right image
  6829. positions:
  6830. @example
  6831. frei0r=perspective:0.2/0.2|0.8/0.2
  6832. @end example
  6833. @end itemize
  6834. For more information, see
  6835. @url{http://frei0r.dyne.org}
  6836. @section fspp
  6837. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6838. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6839. processing filter, one of them is performed once per block, not per pixel.
  6840. This allows for much higher speed.
  6841. The filter accepts the following options:
  6842. @table @option
  6843. @item quality
  6844. Set quality. This option defines the number of levels for averaging. It accepts
  6845. an integer in the range 4-5. Default value is @code{4}.
  6846. @item qp
  6847. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6848. If not set, the filter will use the QP from the video stream (if available).
  6849. @item strength
  6850. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6851. more details but also more artifacts, while higher values make the image smoother
  6852. but also blurrier. Default value is @code{0} − PSNR optimal.
  6853. @item use_bframe_qp
  6854. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6855. option may cause flicker since the B-Frames have often larger QP. Default is
  6856. @code{0} (not enabled).
  6857. @end table
  6858. @section gblur
  6859. Apply Gaussian blur filter.
  6860. The filter accepts the following options:
  6861. @table @option
  6862. @item sigma
  6863. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6864. @item steps
  6865. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6866. @item planes
  6867. Set which planes to filter. By default all planes are filtered.
  6868. @item sigmaV
  6869. Set vertical sigma, if negative it will be same as @code{sigma}.
  6870. Default is @code{-1}.
  6871. @end table
  6872. @section geq
  6873. The filter accepts the following options:
  6874. @table @option
  6875. @item lum_expr, lum
  6876. Set the luminance expression.
  6877. @item cb_expr, cb
  6878. Set the chrominance blue expression.
  6879. @item cr_expr, cr
  6880. Set the chrominance red expression.
  6881. @item alpha_expr, a
  6882. Set the alpha expression.
  6883. @item red_expr, r
  6884. Set the red expression.
  6885. @item green_expr, g
  6886. Set the green expression.
  6887. @item blue_expr, b
  6888. Set the blue expression.
  6889. @end table
  6890. The colorspace is selected according to the specified options. If one
  6891. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6892. options is specified, the filter will automatically select a YCbCr
  6893. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6894. @option{blue_expr} options is specified, it will select an RGB
  6895. colorspace.
  6896. If one of the chrominance expression is not defined, it falls back on the other
  6897. one. If no alpha expression is specified it will evaluate to opaque value.
  6898. If none of chrominance expressions are specified, they will evaluate
  6899. to the luminance expression.
  6900. The expressions can use the following variables and functions:
  6901. @table @option
  6902. @item N
  6903. The sequential number of the filtered frame, starting from @code{0}.
  6904. @item X
  6905. @item Y
  6906. The coordinates of the current sample.
  6907. @item W
  6908. @item H
  6909. The width and height of the image.
  6910. @item SW
  6911. @item SH
  6912. Width and height scale depending on the currently filtered plane. It is the
  6913. ratio between the corresponding luma plane number of pixels and the current
  6914. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6915. @code{0.5,0.5} for chroma planes.
  6916. @item T
  6917. Time of the current frame, expressed in seconds.
  6918. @item p(x, y)
  6919. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6920. plane.
  6921. @item lum(x, y)
  6922. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6923. plane.
  6924. @item cb(x, y)
  6925. Return the value of the pixel at location (@var{x},@var{y}) of the
  6926. blue-difference chroma plane. Return 0 if there is no such plane.
  6927. @item cr(x, y)
  6928. Return the value of the pixel at location (@var{x},@var{y}) of the
  6929. red-difference chroma plane. Return 0 if there is no such plane.
  6930. @item r(x, y)
  6931. @item g(x, y)
  6932. @item b(x, y)
  6933. Return the value of the pixel at location (@var{x},@var{y}) of the
  6934. red/green/blue component. Return 0 if there is no such component.
  6935. @item alpha(x, y)
  6936. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6937. plane. Return 0 if there is no such plane.
  6938. @end table
  6939. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6940. automatically clipped to the closer edge.
  6941. @subsection Examples
  6942. @itemize
  6943. @item
  6944. Flip the image horizontally:
  6945. @example
  6946. geq=p(W-X\,Y)
  6947. @end example
  6948. @item
  6949. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6950. wavelength of 100 pixels:
  6951. @example
  6952. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6953. @end example
  6954. @item
  6955. Generate a fancy enigmatic moving light:
  6956. @example
  6957. 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
  6958. @end example
  6959. @item
  6960. Generate a quick emboss effect:
  6961. @example
  6962. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6963. @end example
  6964. @item
  6965. Modify RGB components depending on pixel position:
  6966. @example
  6967. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6968. @end example
  6969. @item
  6970. Create a radial gradient that is the same size as the input (also see
  6971. the @ref{vignette} filter):
  6972. @example
  6973. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6974. @end example
  6975. @end itemize
  6976. @section gradfun
  6977. Fix the banding artifacts that are sometimes introduced into nearly flat
  6978. regions by truncation to 8-bit color depth.
  6979. Interpolate the gradients that should go where the bands are, and
  6980. dither them.
  6981. It is designed for playback only. Do not use it prior to
  6982. lossy compression, because compression tends to lose the dither and
  6983. bring back the bands.
  6984. It accepts the following parameters:
  6985. @table @option
  6986. @item strength
  6987. The maximum amount by which the filter will change any one pixel. This is also
  6988. the threshold for detecting nearly flat regions. Acceptable values range from
  6989. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6990. valid range.
  6991. @item radius
  6992. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6993. gradients, but also prevents the filter from modifying the pixels near detailed
  6994. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6995. values will be clipped to the valid range.
  6996. @end table
  6997. Alternatively, the options can be specified as a flat string:
  6998. @var{strength}[:@var{radius}]
  6999. @subsection Examples
  7000. @itemize
  7001. @item
  7002. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7003. @example
  7004. gradfun=3.5:8
  7005. @end example
  7006. @item
  7007. Specify radius, omitting the strength (which will fall-back to the default
  7008. value):
  7009. @example
  7010. gradfun=radius=8
  7011. @end example
  7012. @end itemize
  7013. @anchor{haldclut}
  7014. @section haldclut
  7015. Apply a Hald CLUT to a video stream.
  7016. First input is the video stream to process, and second one is the Hald CLUT.
  7017. The Hald CLUT input can be a simple picture or a complete video stream.
  7018. The filter accepts the following options:
  7019. @table @option
  7020. @item shortest
  7021. Force termination when the shortest input terminates. Default is @code{0}.
  7022. @item repeatlast
  7023. Continue applying the last CLUT after the end of the stream. A value of
  7024. @code{0} disable the filter after the last frame of the CLUT is reached.
  7025. Default is @code{1}.
  7026. @end table
  7027. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7028. filters share the same internals).
  7029. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7030. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7031. @subsection Workflow examples
  7032. @subsubsection Hald CLUT video stream
  7033. Generate an identity Hald CLUT stream altered with various effects:
  7034. @example
  7035. 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
  7036. @end example
  7037. Note: make sure you use a lossless codec.
  7038. Then use it with @code{haldclut} to apply it on some random stream:
  7039. @example
  7040. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7041. @end example
  7042. The Hald CLUT will be applied to the 10 first seconds (duration of
  7043. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7044. to the remaining frames of the @code{mandelbrot} stream.
  7045. @subsubsection Hald CLUT with preview
  7046. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7047. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7048. biggest possible square starting at the top left of the picture. The remaining
  7049. padding pixels (bottom or right) will be ignored. This area can be used to add
  7050. a preview of the Hald CLUT.
  7051. Typically, the following generated Hald CLUT will be supported by the
  7052. @code{haldclut} filter:
  7053. @example
  7054. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7055. pad=iw+320 [padded_clut];
  7056. smptebars=s=320x256, split [a][b];
  7057. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7058. [main][b] overlay=W-320" -frames:v 1 clut.png
  7059. @end example
  7060. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7061. bars are displayed on the right-top, and below the same color bars processed by
  7062. the color changes.
  7063. Then, the effect of this Hald CLUT can be visualized with:
  7064. @example
  7065. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7066. @end example
  7067. @section hflip
  7068. Flip the input video horizontally.
  7069. For example, to horizontally flip the input video with @command{ffmpeg}:
  7070. @example
  7071. ffmpeg -i in.avi -vf "hflip" out.avi
  7072. @end example
  7073. @section histeq
  7074. This filter applies a global color histogram equalization on a
  7075. per-frame basis.
  7076. It can be used to correct video that has a compressed range of pixel
  7077. intensities. The filter redistributes the pixel intensities to
  7078. equalize their distribution across the intensity range. It may be
  7079. viewed as an "automatically adjusting contrast filter". This filter is
  7080. useful only for correcting degraded or poorly captured source
  7081. video.
  7082. The filter accepts the following options:
  7083. @table @option
  7084. @item strength
  7085. Determine the amount of equalization to be applied. As the strength
  7086. is reduced, the distribution of pixel intensities more-and-more
  7087. approaches that of the input frame. The value must be a float number
  7088. in the range [0,1] and defaults to 0.200.
  7089. @item intensity
  7090. Set the maximum intensity that can generated and scale the output
  7091. values appropriately. The strength should be set as desired and then
  7092. the intensity can be limited if needed to avoid washing-out. The value
  7093. must be a float number in the range [0,1] and defaults to 0.210.
  7094. @item antibanding
  7095. Set the antibanding level. If enabled the filter will randomly vary
  7096. the luminance of output pixels by a small amount to avoid banding of
  7097. the histogram. Possible values are @code{none}, @code{weak} or
  7098. @code{strong}. It defaults to @code{none}.
  7099. @end table
  7100. @section histogram
  7101. Compute and draw a color distribution histogram for the input video.
  7102. The computed histogram is a representation of the color component
  7103. distribution in an image.
  7104. Standard histogram displays the color components distribution in an image.
  7105. Displays color graph for each color component. Shows distribution of
  7106. the Y, U, V, A or R, G, B components, depending on input format, in the
  7107. current frame. Below each graph a color component scale meter is shown.
  7108. The filter accepts the following options:
  7109. @table @option
  7110. @item level_height
  7111. Set height of level. Default value is @code{200}.
  7112. Allowed range is [50, 2048].
  7113. @item scale_height
  7114. Set height of color scale. Default value is @code{12}.
  7115. Allowed range is [0, 40].
  7116. @item display_mode
  7117. Set display mode.
  7118. It accepts the following values:
  7119. @table @samp
  7120. @item stack
  7121. Per color component graphs are placed below each other.
  7122. @item parade
  7123. Per color component graphs are placed side by side.
  7124. @item overlay
  7125. Presents information identical to that in the @code{parade}, except
  7126. that the graphs representing color components are superimposed directly
  7127. over one another.
  7128. @end table
  7129. Default is @code{stack}.
  7130. @item levels_mode
  7131. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7132. Default is @code{linear}.
  7133. @item components
  7134. Set what color components to display.
  7135. Default is @code{7}.
  7136. @item fgopacity
  7137. Set foreground opacity. Default is @code{0.7}.
  7138. @item bgopacity
  7139. Set background opacity. Default is @code{0.5}.
  7140. @end table
  7141. @subsection Examples
  7142. @itemize
  7143. @item
  7144. Calculate and draw histogram:
  7145. @example
  7146. ffplay -i input -vf histogram
  7147. @end example
  7148. @end itemize
  7149. @anchor{hqdn3d}
  7150. @section hqdn3d
  7151. This is a high precision/quality 3d denoise filter. It aims to reduce
  7152. image noise, producing smooth images and making still images really
  7153. still. It should enhance compressibility.
  7154. It accepts the following optional parameters:
  7155. @table @option
  7156. @item luma_spatial
  7157. A non-negative floating point number which specifies spatial luma strength.
  7158. It defaults to 4.0.
  7159. @item chroma_spatial
  7160. A non-negative floating point number which specifies spatial chroma strength.
  7161. It defaults to 3.0*@var{luma_spatial}/4.0.
  7162. @item luma_tmp
  7163. A floating point number which specifies luma temporal strength. It defaults to
  7164. 6.0*@var{luma_spatial}/4.0.
  7165. @item chroma_tmp
  7166. A floating point number which specifies chroma temporal strength. It defaults to
  7167. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7168. @end table
  7169. @section hwdownload
  7170. Download hardware frames to system memory.
  7171. The input must be in hardware frames, and the output a non-hardware format.
  7172. Not all formats will be supported on the output - it may be necessary to insert
  7173. an additional @option{format} filter immediately following in the graph to get
  7174. the output in a supported format.
  7175. @section hwmap
  7176. Map hardware frames to system memory or to another device.
  7177. This filter has several different modes of operation; which one is used depends
  7178. on the input and output formats:
  7179. @itemize
  7180. @item
  7181. Hardware frame input, normal frame output
  7182. Map the input frames to system memory and pass them to the output. If the
  7183. original hardware frame is later required (for example, after overlaying
  7184. something else on part of it), the @option{hwmap} filter can be used again
  7185. in the next mode to retrieve it.
  7186. @item
  7187. Normal frame input, hardware frame output
  7188. If the input is actually a software-mapped hardware frame, then unmap it -
  7189. that is, return the original hardware frame.
  7190. Otherwise, a device must be provided. Create new hardware surfaces on that
  7191. device for the output, then map them back to the software format at the input
  7192. and give those frames to the preceding filter. This will then act like the
  7193. @option{hwupload} filter, but may be able to avoid an additional copy when
  7194. the input is already in a compatible format.
  7195. @item
  7196. Hardware frame input and output
  7197. A device must be supplied for the output, either directly or with the
  7198. @option{derive_device} option. The input and output devices must be of
  7199. different types and compatible - the exact meaning of this is
  7200. system-dependent, but typically it means that they must refer to the same
  7201. underlying hardware context (for example, refer to the same graphics card).
  7202. If the input frames were originally created on the output device, then unmap
  7203. to retrieve the original frames.
  7204. Otherwise, map the frames to the output device - create new hardware frames
  7205. on the output corresponding to the frames on the input.
  7206. @end itemize
  7207. The following additional parameters are accepted:
  7208. @table @option
  7209. @item mode
  7210. Set the frame mapping mode. Some combination of:
  7211. @table @var
  7212. @item read
  7213. The mapped frame should be readable.
  7214. @item write
  7215. The mapped frame should be writeable.
  7216. @item overwrite
  7217. The mapping will always overwrite the entire frame.
  7218. This may improve performance in some cases, as the original contents of the
  7219. frame need not be loaded.
  7220. @item direct
  7221. The mapping must not involve any copying.
  7222. Indirect mappings to copies of frames are created in some cases where either
  7223. direct mapping is not possible or it would have unexpected properties.
  7224. Setting this flag ensures that the mapping is direct and will fail if that is
  7225. not possible.
  7226. @end table
  7227. Defaults to @var{read+write} if not specified.
  7228. @item derive_device @var{type}
  7229. Rather than using the device supplied at initialisation, instead derive a new
  7230. device of type @var{type} from the device the input frames exist on.
  7231. @item reverse
  7232. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7233. and map them back to the source. This may be necessary in some cases where
  7234. a mapping in one direction is required but only the opposite direction is
  7235. supported by the devices being used.
  7236. This option is dangerous - it may break the preceding filter in undefined
  7237. ways if there are any additional constraints on that filter's output.
  7238. Do not use it without fully understanding the implications of its use.
  7239. @end table
  7240. @section hwupload
  7241. Upload system memory frames to hardware surfaces.
  7242. The device to upload to must be supplied when the filter is initialised. If
  7243. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7244. option.
  7245. @anchor{hwupload_cuda}
  7246. @section hwupload_cuda
  7247. Upload system memory frames to a CUDA device.
  7248. It accepts the following optional parameters:
  7249. @table @option
  7250. @item device
  7251. The number of the CUDA device to use
  7252. @end table
  7253. @section hqx
  7254. Apply a high-quality magnification filter designed for pixel art. This filter
  7255. was originally created by Maxim Stepin.
  7256. It accepts the following option:
  7257. @table @option
  7258. @item n
  7259. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7260. @code{hq3x} and @code{4} for @code{hq4x}.
  7261. Default is @code{3}.
  7262. @end table
  7263. @section hstack
  7264. Stack input videos horizontally.
  7265. All streams must be of same pixel format and of same height.
  7266. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7267. to create same output.
  7268. The filter accept the following option:
  7269. @table @option
  7270. @item inputs
  7271. Set number of input streams. Default is 2.
  7272. @item shortest
  7273. If set to 1, force the output to terminate when the shortest input
  7274. terminates. Default value is 0.
  7275. @end table
  7276. @section hue
  7277. Modify the hue and/or the saturation of the input.
  7278. It accepts the following parameters:
  7279. @table @option
  7280. @item h
  7281. Specify the hue angle as a number of degrees. It accepts an expression,
  7282. and defaults to "0".
  7283. @item s
  7284. Specify the saturation in the [-10,10] range. It accepts an expression and
  7285. defaults to "1".
  7286. @item H
  7287. Specify the hue angle as a number of radians. It accepts an
  7288. expression, and defaults to "0".
  7289. @item b
  7290. Specify the brightness in the [-10,10] range. It accepts an expression and
  7291. defaults to "0".
  7292. @end table
  7293. @option{h} and @option{H} are mutually exclusive, and can't be
  7294. specified at the same time.
  7295. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7296. expressions containing the following constants:
  7297. @table @option
  7298. @item n
  7299. frame count of the input frame starting from 0
  7300. @item pts
  7301. presentation timestamp of the input frame expressed in time base units
  7302. @item r
  7303. frame rate of the input video, NAN if the input frame rate is unknown
  7304. @item t
  7305. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7306. @item tb
  7307. time base of the input video
  7308. @end table
  7309. @subsection Examples
  7310. @itemize
  7311. @item
  7312. Set the hue to 90 degrees and the saturation to 1.0:
  7313. @example
  7314. hue=h=90:s=1
  7315. @end example
  7316. @item
  7317. Same command but expressing the hue in radians:
  7318. @example
  7319. hue=H=PI/2:s=1
  7320. @end example
  7321. @item
  7322. Rotate hue and make the saturation swing between 0
  7323. and 2 over a period of 1 second:
  7324. @example
  7325. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7326. @end example
  7327. @item
  7328. Apply a 3 seconds saturation fade-in effect starting at 0:
  7329. @example
  7330. hue="s=min(t/3\,1)"
  7331. @end example
  7332. The general fade-in expression can be written as:
  7333. @example
  7334. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7335. @end example
  7336. @item
  7337. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7338. @example
  7339. hue="s=max(0\, min(1\, (8-t)/3))"
  7340. @end example
  7341. The general fade-out expression can be written as:
  7342. @example
  7343. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7344. @end example
  7345. @end itemize
  7346. @subsection Commands
  7347. This filter supports the following commands:
  7348. @table @option
  7349. @item b
  7350. @item s
  7351. @item h
  7352. @item H
  7353. Modify the hue and/or the saturation and/or brightness of the input video.
  7354. The command accepts the same syntax of the corresponding option.
  7355. If the specified expression is not valid, it is kept at its current
  7356. value.
  7357. @end table
  7358. @section hysteresis
  7359. Grow first stream into second stream by connecting components.
  7360. This makes it possible to build more robust edge masks.
  7361. This filter accepts the following options:
  7362. @table @option
  7363. @item planes
  7364. Set which planes will be processed as bitmap, unprocessed planes will be
  7365. copied from first stream.
  7366. By default value 0xf, all planes will be processed.
  7367. @item threshold
  7368. Set threshold which is used in filtering. If pixel component value is higher than
  7369. this value filter algorithm for connecting components is activated.
  7370. By default value is 0.
  7371. @end table
  7372. @section idet
  7373. Detect video interlacing type.
  7374. This filter tries to detect if the input frames are interlaced, progressive,
  7375. top or bottom field first. It will also try to detect fields that are
  7376. repeated between adjacent frames (a sign of telecine).
  7377. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7378. Multiple frame detection incorporates the classification history of previous frames.
  7379. The filter will log these metadata values:
  7380. @table @option
  7381. @item single.current_frame
  7382. Detected type of current frame using single-frame detection. One of:
  7383. ``tff'' (top field first), ``bff'' (bottom field first),
  7384. ``progressive'', or ``undetermined''
  7385. @item single.tff
  7386. Cumulative number of frames detected as top field first using single-frame detection.
  7387. @item multiple.tff
  7388. Cumulative number of frames detected as top field first using multiple-frame detection.
  7389. @item single.bff
  7390. Cumulative number of frames detected as bottom field first using single-frame detection.
  7391. @item multiple.current_frame
  7392. Detected type of current frame using multiple-frame detection. One of:
  7393. ``tff'' (top field first), ``bff'' (bottom field first),
  7394. ``progressive'', or ``undetermined''
  7395. @item multiple.bff
  7396. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7397. @item single.progressive
  7398. Cumulative number of frames detected as progressive using single-frame detection.
  7399. @item multiple.progressive
  7400. Cumulative number of frames detected as progressive using multiple-frame detection.
  7401. @item single.undetermined
  7402. Cumulative number of frames that could not be classified using single-frame detection.
  7403. @item multiple.undetermined
  7404. Cumulative number of frames that could not be classified using multiple-frame detection.
  7405. @item repeated.current_frame
  7406. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7407. @item repeated.neither
  7408. Cumulative number of frames with no repeated field.
  7409. @item repeated.top
  7410. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7411. @item repeated.bottom
  7412. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7413. @end table
  7414. The filter accepts the following options:
  7415. @table @option
  7416. @item intl_thres
  7417. Set interlacing threshold.
  7418. @item prog_thres
  7419. Set progressive threshold.
  7420. @item rep_thres
  7421. Threshold for repeated field detection.
  7422. @item half_life
  7423. Number of frames after which a given frame's contribution to the
  7424. statistics is halved (i.e., it contributes only 0.5 to its
  7425. classification). The default of 0 means that all frames seen are given
  7426. full weight of 1.0 forever.
  7427. @item analyze_interlaced_flag
  7428. When this is not 0 then idet will use the specified number of frames to determine
  7429. if the interlaced flag is accurate, it will not count undetermined frames.
  7430. If the flag is found to be accurate it will be used without any further
  7431. computations, if it is found to be inaccurate it will be cleared without any
  7432. further computations. This allows inserting the idet filter as a low computational
  7433. method to clean up the interlaced flag
  7434. @end table
  7435. @section il
  7436. Deinterleave or interleave fields.
  7437. This filter allows one to process interlaced images fields without
  7438. deinterlacing them. Deinterleaving splits the input frame into 2
  7439. fields (so called half pictures). Odd lines are moved to the top
  7440. half of the output image, even lines to the bottom half.
  7441. You can process (filter) them independently and then re-interleave them.
  7442. The filter accepts the following options:
  7443. @table @option
  7444. @item luma_mode, l
  7445. @item chroma_mode, c
  7446. @item alpha_mode, a
  7447. Available values for @var{luma_mode}, @var{chroma_mode} and
  7448. @var{alpha_mode} are:
  7449. @table @samp
  7450. @item none
  7451. Do nothing.
  7452. @item deinterleave, d
  7453. Deinterleave fields, placing one above the other.
  7454. @item interleave, i
  7455. Interleave fields. Reverse the effect of deinterleaving.
  7456. @end table
  7457. Default value is @code{none}.
  7458. @item luma_swap, ls
  7459. @item chroma_swap, cs
  7460. @item alpha_swap, as
  7461. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7462. @end table
  7463. @section inflate
  7464. Apply inflate effect to the video.
  7465. This filter replaces the pixel by the local(3x3) average by taking into account
  7466. only values higher than the pixel.
  7467. It accepts the following options:
  7468. @table @option
  7469. @item threshold0
  7470. @item threshold1
  7471. @item threshold2
  7472. @item threshold3
  7473. Limit the maximum change for each plane, default is 65535.
  7474. If 0, plane will remain unchanged.
  7475. @end table
  7476. @section interlace
  7477. Simple interlacing filter from progressive contents. This interleaves upper (or
  7478. lower) lines from odd frames with lower (or upper) lines from even frames,
  7479. halving the frame rate and preserving image height.
  7480. @example
  7481. Original Original New Frame
  7482. Frame 'j' Frame 'j+1' (tff)
  7483. ========== =========== ==================
  7484. Line 0 --------------------> Frame 'j' Line 0
  7485. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7486. Line 2 ---------------------> Frame 'j' Line 2
  7487. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7488. ... ... ...
  7489. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7490. @end example
  7491. It accepts the following optional parameters:
  7492. @table @option
  7493. @item scan
  7494. This determines whether the interlaced frame is taken from the even
  7495. (tff - default) or odd (bff) lines of the progressive frame.
  7496. @item lowpass
  7497. Vertical lowpass filter to avoid twitter interlacing and
  7498. reduce moire patterns.
  7499. @table @samp
  7500. @item 0, off
  7501. Disable vertical lowpass filter
  7502. @item 1, linear
  7503. Enable linear filter (default)
  7504. @item 2, complex
  7505. Enable complex filter. This will slightly less reduce twitter and moire
  7506. but better retain detail and subjective sharpness impression.
  7507. @end table
  7508. @end table
  7509. @section kerndeint
  7510. Deinterlace input video by applying Donald Graft's adaptive kernel
  7511. deinterling. Work on interlaced parts of a video to produce
  7512. progressive frames.
  7513. The description of the accepted parameters follows.
  7514. @table @option
  7515. @item thresh
  7516. Set the threshold which affects the filter's tolerance when
  7517. determining if a pixel line must be processed. It must be an integer
  7518. in the range [0,255] and defaults to 10. A value of 0 will result in
  7519. applying the process on every pixels.
  7520. @item map
  7521. Paint pixels exceeding the threshold value to white if set to 1.
  7522. Default is 0.
  7523. @item order
  7524. Set the fields order. Swap fields if set to 1, leave fields alone if
  7525. 0. Default is 0.
  7526. @item sharp
  7527. Enable additional sharpening if set to 1. Default is 0.
  7528. @item twoway
  7529. Enable twoway sharpening if set to 1. Default is 0.
  7530. @end table
  7531. @subsection Examples
  7532. @itemize
  7533. @item
  7534. Apply default values:
  7535. @example
  7536. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7537. @end example
  7538. @item
  7539. Enable additional sharpening:
  7540. @example
  7541. kerndeint=sharp=1
  7542. @end example
  7543. @item
  7544. Paint processed pixels in white:
  7545. @example
  7546. kerndeint=map=1
  7547. @end example
  7548. @end itemize
  7549. @section lenscorrection
  7550. Correct radial lens distortion
  7551. This filter can be used to correct for radial distortion as can result from the use
  7552. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7553. one can use tools available for example as part of opencv or simply trial-and-error.
  7554. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7555. and extract the k1 and k2 coefficients from the resulting matrix.
  7556. Note that effectively the same filter is available in the open-source tools Krita and
  7557. Digikam from the KDE project.
  7558. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7559. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7560. brightness distribution, so you may want to use both filters together in certain
  7561. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7562. be applied before or after lens correction.
  7563. @subsection Options
  7564. The filter accepts the following options:
  7565. @table @option
  7566. @item cx
  7567. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7568. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7569. width.
  7570. @item cy
  7571. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7572. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7573. height.
  7574. @item k1
  7575. Coefficient of the quadratic correction term. 0.5 means no correction.
  7576. @item k2
  7577. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7578. @end table
  7579. The formula that generates the correction is:
  7580. @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)
  7581. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7582. distances from the focal point in the source and target images, respectively.
  7583. @section libvmaf
  7584. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7585. score between two input videos.
  7586. This filter takes two input videos.
  7587. Both video inputs must have the same resolution and pixel format for
  7588. this filter to work correctly. Also it assumes that both inputs
  7589. have the same number of frames, which are compared one by one.
  7590. The obtained average VMAF score is printed through the logging system.
  7591. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7592. After installing the library it can be enabled using:
  7593. @code{./configure --enable-libvmaf}.
  7594. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7595. On the below examples the input file @file{main.mpg} being processed is
  7596. compared with the reference file @file{ref.mpg}.
  7597. The filter has following options:
  7598. @table @option
  7599. @item model_path
  7600. Set the model path which is to be used for SVM.
  7601. Default value: @code{"vmaf_v0.6.1.pkl"}
  7602. @item log_path
  7603. Set the file path to be used to store logs.
  7604. @item log_fmt
  7605. Set the format of the log file (xml or json).
  7606. @item enable_transform
  7607. Enables transform for computing vmaf.
  7608. @item phone_model
  7609. Invokes the phone model which will generate VMAF scores higher than in the
  7610. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7611. @item psnr
  7612. Enables computing psnr along with vmaf.
  7613. @item ssim
  7614. Enables computing ssim along with vmaf.
  7615. @item ms_ssim
  7616. Enables computing ms_ssim along with vmaf.
  7617. @item pool
  7618. Set the pool method to be used for computing vmaf.
  7619. @end table
  7620. This filter also supports the @ref{framesync} options.
  7621. For example:
  7622. @example
  7623. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7624. @end example
  7625. Example with options:
  7626. @example
  7627. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7628. @end example
  7629. @section limiter
  7630. Limits the pixel components values to the specified range [min, max].
  7631. The filter accepts the following options:
  7632. @table @option
  7633. @item min
  7634. Lower bound. Defaults to the lowest allowed value for the input.
  7635. @item max
  7636. Upper bound. Defaults to the highest allowed value for the input.
  7637. @item planes
  7638. Specify which planes will be processed. Defaults to all available.
  7639. @end table
  7640. @section loop
  7641. Loop video frames.
  7642. The filter accepts the following options:
  7643. @table @option
  7644. @item loop
  7645. Set the number of loops.
  7646. @item size
  7647. Set maximal size in number of frames.
  7648. @item start
  7649. Set first frame of loop.
  7650. @end table
  7651. @anchor{lut3d}
  7652. @section lut3d
  7653. Apply a 3D LUT to an input video.
  7654. The filter accepts the following options:
  7655. @table @option
  7656. @item file
  7657. Set the 3D LUT file name.
  7658. Currently supported formats:
  7659. @table @samp
  7660. @item 3dl
  7661. AfterEffects
  7662. @item cube
  7663. Iridas
  7664. @item dat
  7665. DaVinci
  7666. @item m3d
  7667. Pandora
  7668. @end table
  7669. @item interp
  7670. Select interpolation mode.
  7671. Available values are:
  7672. @table @samp
  7673. @item nearest
  7674. Use values from the nearest defined point.
  7675. @item trilinear
  7676. Interpolate values using the 8 points defining a cube.
  7677. @item tetrahedral
  7678. Interpolate values using a tetrahedron.
  7679. @end table
  7680. @end table
  7681. This filter also supports the @ref{framesync} options.
  7682. @section lumakey
  7683. Turn certain luma values into transparency.
  7684. The filter accepts the following options:
  7685. @table @option
  7686. @item threshold
  7687. Set the luma which will be used as base for transparency.
  7688. Default value is @code{0}.
  7689. @item tolerance
  7690. Set the range of luma values to be keyed out.
  7691. Default value is @code{0}.
  7692. @item softness
  7693. Set the range of softness. Default value is @code{0}.
  7694. Use this to control gradual transition from zero to full transparency.
  7695. @end table
  7696. @section lut, lutrgb, lutyuv
  7697. Compute a look-up table for binding each pixel component input value
  7698. to an output value, and apply it to the input video.
  7699. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7700. to an RGB input video.
  7701. These filters accept the following parameters:
  7702. @table @option
  7703. @item c0
  7704. set first pixel component expression
  7705. @item c1
  7706. set second pixel component expression
  7707. @item c2
  7708. set third pixel component expression
  7709. @item c3
  7710. set fourth pixel component expression, corresponds to the alpha component
  7711. @item r
  7712. set red component expression
  7713. @item g
  7714. set green component expression
  7715. @item b
  7716. set blue component expression
  7717. @item a
  7718. alpha component expression
  7719. @item y
  7720. set Y/luminance component expression
  7721. @item u
  7722. set U/Cb component expression
  7723. @item v
  7724. set V/Cr component expression
  7725. @end table
  7726. Each of them specifies the expression to use for computing the lookup table for
  7727. the corresponding pixel component values.
  7728. The exact component associated to each of the @var{c*} options depends on the
  7729. format in input.
  7730. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7731. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7732. The expressions can contain the following constants and functions:
  7733. @table @option
  7734. @item w
  7735. @item h
  7736. The input width and height.
  7737. @item val
  7738. The input value for the pixel component.
  7739. @item clipval
  7740. The input value, clipped to the @var{minval}-@var{maxval} range.
  7741. @item maxval
  7742. The maximum value for the pixel component.
  7743. @item minval
  7744. The minimum value for the pixel component.
  7745. @item negval
  7746. The negated value for the pixel component value, clipped to the
  7747. @var{minval}-@var{maxval} range; it corresponds to the expression
  7748. "maxval-clipval+minval".
  7749. @item clip(val)
  7750. The computed value in @var{val}, clipped to the
  7751. @var{minval}-@var{maxval} range.
  7752. @item gammaval(gamma)
  7753. The computed gamma correction value of the pixel component value,
  7754. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7755. expression
  7756. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7757. @end table
  7758. All expressions default to "val".
  7759. @subsection Examples
  7760. @itemize
  7761. @item
  7762. Negate input video:
  7763. @example
  7764. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7765. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7766. @end example
  7767. The above is the same as:
  7768. @example
  7769. lutrgb="r=negval:g=negval:b=negval"
  7770. lutyuv="y=negval:u=negval:v=negval"
  7771. @end example
  7772. @item
  7773. Negate luminance:
  7774. @example
  7775. lutyuv=y=negval
  7776. @end example
  7777. @item
  7778. Remove chroma components, turning the video into a graytone image:
  7779. @example
  7780. lutyuv="u=128:v=128"
  7781. @end example
  7782. @item
  7783. Apply a luma burning effect:
  7784. @example
  7785. lutyuv="y=2*val"
  7786. @end example
  7787. @item
  7788. Remove green and blue components:
  7789. @example
  7790. lutrgb="g=0:b=0"
  7791. @end example
  7792. @item
  7793. Set a constant alpha channel value on input:
  7794. @example
  7795. format=rgba,lutrgb=a="maxval-minval/2"
  7796. @end example
  7797. @item
  7798. Correct luminance gamma by a factor of 0.5:
  7799. @example
  7800. lutyuv=y=gammaval(0.5)
  7801. @end example
  7802. @item
  7803. Discard least significant bits of luma:
  7804. @example
  7805. lutyuv=y='bitand(val, 128+64+32)'
  7806. @end example
  7807. @item
  7808. Technicolor like effect:
  7809. @example
  7810. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7811. @end example
  7812. @end itemize
  7813. @section lut2, tlut2
  7814. The @code{lut2} filter takes two input streams and outputs one
  7815. stream.
  7816. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7817. from one single stream.
  7818. This filter accepts the following parameters:
  7819. @table @option
  7820. @item c0
  7821. set first pixel component expression
  7822. @item c1
  7823. set second pixel component expression
  7824. @item c2
  7825. set third pixel component expression
  7826. @item c3
  7827. set fourth pixel component expression, corresponds to the alpha component
  7828. @end table
  7829. Each of them specifies the expression to use for computing the lookup table for
  7830. the corresponding pixel component values.
  7831. The exact component associated to each of the @var{c*} options depends on the
  7832. format in inputs.
  7833. The expressions can contain the following constants:
  7834. @table @option
  7835. @item w
  7836. @item h
  7837. The input width and height.
  7838. @item x
  7839. The first input value for the pixel component.
  7840. @item y
  7841. The second input value for the pixel component.
  7842. @item bdx
  7843. The first input video bit depth.
  7844. @item bdy
  7845. The second input video bit depth.
  7846. @end table
  7847. All expressions default to "x".
  7848. @subsection Examples
  7849. @itemize
  7850. @item
  7851. Highlight differences between two RGB video streams:
  7852. @example
  7853. 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)'
  7854. @end example
  7855. @item
  7856. Highlight differences between two YUV video streams:
  7857. @example
  7858. 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)'
  7859. @end example
  7860. @item
  7861. Show max difference between two video streams:
  7862. @example
  7863. 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)))'
  7864. @end example
  7865. @end itemize
  7866. @section maskedclamp
  7867. Clamp the first input stream with the second input and third input stream.
  7868. Returns the value of first stream to be between second input
  7869. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7870. This filter accepts the following options:
  7871. @table @option
  7872. @item undershoot
  7873. Default value is @code{0}.
  7874. @item overshoot
  7875. Default value is @code{0}.
  7876. @item planes
  7877. Set which planes will be processed as bitmap, unprocessed planes will be
  7878. copied from first stream.
  7879. By default value 0xf, all planes will be processed.
  7880. @end table
  7881. @section maskedmerge
  7882. Merge the first input stream with the second input stream using per pixel
  7883. weights in the third input stream.
  7884. A value of 0 in the third stream pixel component means that pixel component
  7885. from first stream is returned unchanged, while maximum value (eg. 255 for
  7886. 8-bit videos) means that pixel component from second stream is returned
  7887. unchanged. Intermediate values define the amount of merging between both
  7888. input stream's pixel components.
  7889. This filter accepts the following options:
  7890. @table @option
  7891. @item planes
  7892. Set which planes will be processed as bitmap, unprocessed planes will be
  7893. copied from first stream.
  7894. By default value 0xf, all planes will be processed.
  7895. @end table
  7896. @section mcdeint
  7897. Apply motion-compensation deinterlacing.
  7898. It needs one field per frame as input and must thus be used together
  7899. with yadif=1/3 or equivalent.
  7900. This filter accepts the following options:
  7901. @table @option
  7902. @item mode
  7903. Set the deinterlacing mode.
  7904. It accepts one of the following values:
  7905. @table @samp
  7906. @item fast
  7907. @item medium
  7908. @item slow
  7909. use iterative motion estimation
  7910. @item extra_slow
  7911. like @samp{slow}, but use multiple reference frames.
  7912. @end table
  7913. Default value is @samp{fast}.
  7914. @item parity
  7915. Set the picture field parity assumed for the input video. It must be
  7916. one of the following values:
  7917. @table @samp
  7918. @item 0, tff
  7919. assume top field first
  7920. @item 1, bff
  7921. assume bottom field first
  7922. @end table
  7923. Default value is @samp{bff}.
  7924. @item qp
  7925. Set per-block quantization parameter (QP) used by the internal
  7926. encoder.
  7927. Higher values should result in a smoother motion vector field but less
  7928. optimal individual vectors. Default value is 1.
  7929. @end table
  7930. @section mergeplanes
  7931. Merge color channel components from several video streams.
  7932. The filter accepts up to 4 input streams, and merge selected input
  7933. planes to the output video.
  7934. This filter accepts the following options:
  7935. @table @option
  7936. @item mapping
  7937. Set input to output plane mapping. Default is @code{0}.
  7938. The mappings is specified as a bitmap. It should be specified as a
  7939. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7940. mapping for the first plane of the output stream. 'A' sets the number of
  7941. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7942. corresponding input to use (from 0 to 3). The rest of the mappings is
  7943. similar, 'Bb' describes the mapping for the output stream second
  7944. plane, 'Cc' describes the mapping for the output stream third plane and
  7945. 'Dd' describes the mapping for the output stream fourth plane.
  7946. @item format
  7947. Set output pixel format. Default is @code{yuva444p}.
  7948. @end table
  7949. @subsection Examples
  7950. @itemize
  7951. @item
  7952. Merge three gray video streams of same width and height into single video stream:
  7953. @example
  7954. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7955. @end example
  7956. @item
  7957. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7958. @example
  7959. [a0][a1]mergeplanes=0x00010210:yuva444p
  7960. @end example
  7961. @item
  7962. Swap Y and A plane in yuva444p stream:
  7963. @example
  7964. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7965. @end example
  7966. @item
  7967. Swap U and V plane in yuv420p stream:
  7968. @example
  7969. format=yuv420p,mergeplanes=0x000201:yuv420p
  7970. @end example
  7971. @item
  7972. Cast a rgb24 clip to yuv444p:
  7973. @example
  7974. format=rgb24,mergeplanes=0x000102:yuv444p
  7975. @end example
  7976. @end itemize
  7977. @section mestimate
  7978. Estimate and export motion vectors using block matching algorithms.
  7979. Motion vectors are stored in frame side data to be used by other filters.
  7980. This filter accepts the following options:
  7981. @table @option
  7982. @item method
  7983. Specify the motion estimation method. Accepts one of the following values:
  7984. @table @samp
  7985. @item esa
  7986. Exhaustive search algorithm.
  7987. @item tss
  7988. Three step search algorithm.
  7989. @item tdls
  7990. Two dimensional logarithmic search algorithm.
  7991. @item ntss
  7992. New three step search algorithm.
  7993. @item fss
  7994. Four step search algorithm.
  7995. @item ds
  7996. Diamond search algorithm.
  7997. @item hexbs
  7998. Hexagon-based search algorithm.
  7999. @item epzs
  8000. Enhanced predictive zonal search algorithm.
  8001. @item umh
  8002. Uneven multi-hexagon search algorithm.
  8003. @end table
  8004. Default value is @samp{esa}.
  8005. @item mb_size
  8006. Macroblock size. Default @code{16}.
  8007. @item search_param
  8008. Search parameter. Default @code{7}.
  8009. @end table
  8010. @section midequalizer
  8011. Apply Midway Image Equalization effect using two video streams.
  8012. Midway Image Equalization adjusts a pair of images to have the same
  8013. histogram, while maintaining their dynamics as much as possible. It's
  8014. useful for e.g. matching exposures from a pair of stereo cameras.
  8015. This filter has two inputs and one output, which must be of same pixel format, but
  8016. may be of different sizes. The output of filter is first input adjusted with
  8017. midway histogram of both inputs.
  8018. This filter accepts the following option:
  8019. @table @option
  8020. @item planes
  8021. Set which planes to process. Default is @code{15}, which is all available planes.
  8022. @end table
  8023. @section minterpolate
  8024. Convert the video to specified frame rate using motion interpolation.
  8025. This filter accepts the following options:
  8026. @table @option
  8027. @item fps
  8028. 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}.
  8029. @item mi_mode
  8030. Motion interpolation mode. Following values are accepted:
  8031. @table @samp
  8032. @item dup
  8033. Duplicate previous or next frame for interpolating new ones.
  8034. @item blend
  8035. Blend source frames. Interpolated frame is mean of previous and next frames.
  8036. @item mci
  8037. Motion compensated interpolation. Following options are effective when this mode is selected:
  8038. @table @samp
  8039. @item mc_mode
  8040. Motion compensation mode. Following values are accepted:
  8041. @table @samp
  8042. @item obmc
  8043. Overlapped block motion compensation.
  8044. @item aobmc
  8045. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8046. @end table
  8047. Default mode is @samp{obmc}.
  8048. @item me_mode
  8049. Motion estimation mode. Following values are accepted:
  8050. @table @samp
  8051. @item bidir
  8052. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8053. @item bilat
  8054. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8055. @end table
  8056. Default mode is @samp{bilat}.
  8057. @item me
  8058. The algorithm to be used for motion estimation. Following values are accepted:
  8059. @table @samp
  8060. @item esa
  8061. Exhaustive search algorithm.
  8062. @item tss
  8063. Three step search algorithm.
  8064. @item tdls
  8065. Two dimensional logarithmic search algorithm.
  8066. @item ntss
  8067. New three step search algorithm.
  8068. @item fss
  8069. Four step search algorithm.
  8070. @item ds
  8071. Diamond search algorithm.
  8072. @item hexbs
  8073. Hexagon-based search algorithm.
  8074. @item epzs
  8075. Enhanced predictive zonal search algorithm.
  8076. @item umh
  8077. Uneven multi-hexagon search algorithm.
  8078. @end table
  8079. Default algorithm is @samp{epzs}.
  8080. @item mb_size
  8081. Macroblock size. Default @code{16}.
  8082. @item search_param
  8083. Motion estimation search parameter. Default @code{32}.
  8084. @item vsbmc
  8085. 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).
  8086. @end table
  8087. @end table
  8088. @item scd
  8089. 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:
  8090. @table @samp
  8091. @item none
  8092. Disable scene change detection.
  8093. @item fdiff
  8094. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8095. @end table
  8096. Default method is @samp{fdiff}.
  8097. @item scd_threshold
  8098. Scene change detection threshold. Default is @code{5.0}.
  8099. @end table
  8100. @section mpdecimate
  8101. Drop frames that do not differ greatly from the previous frame in
  8102. order to reduce frame rate.
  8103. The main use of this filter is for very-low-bitrate encoding
  8104. (e.g. streaming over dialup modem), but it could in theory be used for
  8105. fixing movies that were inverse-telecined incorrectly.
  8106. A description of the accepted options follows.
  8107. @table @option
  8108. @item max
  8109. Set the maximum number of consecutive frames which can be dropped (if
  8110. positive), or the minimum interval between dropped frames (if
  8111. negative). If the value is 0, the frame is dropped disregarding the
  8112. number of previous sequentially dropped frames.
  8113. Default value is 0.
  8114. @item hi
  8115. @item lo
  8116. @item frac
  8117. Set the dropping threshold values.
  8118. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8119. represent actual pixel value differences, so a threshold of 64
  8120. corresponds to 1 unit of difference for each pixel, or the same spread
  8121. out differently over the block.
  8122. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8123. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8124. meaning the whole image) differ by more than a threshold of @option{lo}.
  8125. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8126. 64*5, and default value for @option{frac} is 0.33.
  8127. @end table
  8128. @section negate
  8129. Negate input video.
  8130. It accepts an integer in input; if non-zero it negates the
  8131. alpha component (if available). The default value in input is 0.
  8132. @section nlmeans
  8133. Denoise frames using Non-Local Means algorithm.
  8134. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8135. context similarity is defined by comparing their surrounding patches of size
  8136. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8137. around the pixel.
  8138. Note that the research area defines centers for patches, which means some
  8139. patches will be made of pixels outside that research area.
  8140. The filter accepts the following options.
  8141. @table @option
  8142. @item s
  8143. Set denoising strength.
  8144. @item p
  8145. Set patch size.
  8146. @item pc
  8147. Same as @option{p} but for chroma planes.
  8148. The default value is @var{0} and means automatic.
  8149. @item r
  8150. Set research size.
  8151. @item rc
  8152. Same as @option{r} but for chroma planes.
  8153. The default value is @var{0} and means automatic.
  8154. @end table
  8155. @section nnedi
  8156. Deinterlace video using neural network edge directed interpolation.
  8157. This filter accepts the following options:
  8158. @table @option
  8159. @item weights
  8160. Mandatory option, without binary file filter can not work.
  8161. Currently file can be found here:
  8162. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8163. @item deint
  8164. Set which frames to deinterlace, by default it is @code{all}.
  8165. Can be @code{all} or @code{interlaced}.
  8166. @item field
  8167. Set mode of operation.
  8168. Can be one of the following:
  8169. @table @samp
  8170. @item af
  8171. Use frame flags, both fields.
  8172. @item a
  8173. Use frame flags, single field.
  8174. @item t
  8175. Use top field only.
  8176. @item b
  8177. Use bottom field only.
  8178. @item tf
  8179. Use both fields, top first.
  8180. @item bf
  8181. Use both fields, bottom first.
  8182. @end table
  8183. @item planes
  8184. Set which planes to process, by default filter process all frames.
  8185. @item nsize
  8186. Set size of local neighborhood around each pixel, used by the predictor neural
  8187. network.
  8188. Can be one of the following:
  8189. @table @samp
  8190. @item s8x6
  8191. @item s16x6
  8192. @item s32x6
  8193. @item s48x6
  8194. @item s8x4
  8195. @item s16x4
  8196. @item s32x4
  8197. @end table
  8198. @item nns
  8199. Set the number of neurons in predictor neural network.
  8200. Can be one of the following:
  8201. @table @samp
  8202. @item n16
  8203. @item n32
  8204. @item n64
  8205. @item n128
  8206. @item n256
  8207. @end table
  8208. @item qual
  8209. Controls the number of different neural network predictions that are blended
  8210. together to compute the final output value. Can be @code{fast}, default or
  8211. @code{slow}.
  8212. @item etype
  8213. Set which set of weights to use in the predictor.
  8214. Can be one of the following:
  8215. @table @samp
  8216. @item a
  8217. weights trained to minimize absolute error
  8218. @item s
  8219. weights trained to minimize squared error
  8220. @end table
  8221. @item pscrn
  8222. Controls whether or not the prescreener neural network is used to decide
  8223. which pixels should be processed by the predictor neural network and which
  8224. can be handled by simple cubic interpolation.
  8225. The prescreener is trained to know whether cubic interpolation will be
  8226. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8227. The computational complexity of the prescreener nn is much less than that of
  8228. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8229. using the prescreener generally results in much faster processing.
  8230. The prescreener is pretty accurate, so the difference between using it and not
  8231. using it is almost always unnoticeable.
  8232. Can be one of the following:
  8233. @table @samp
  8234. @item none
  8235. @item original
  8236. @item new
  8237. @end table
  8238. Default is @code{new}.
  8239. @item fapprox
  8240. Set various debugging flags.
  8241. @end table
  8242. @section noformat
  8243. Force libavfilter not to use any of the specified pixel formats for the
  8244. input to the next filter.
  8245. It accepts the following parameters:
  8246. @table @option
  8247. @item pix_fmts
  8248. A '|'-separated list of pixel format names, such as
  8249. pix_fmts=yuv420p|monow|rgb24".
  8250. @end table
  8251. @subsection Examples
  8252. @itemize
  8253. @item
  8254. Force libavfilter to use a format different from @var{yuv420p} for the
  8255. input to the vflip filter:
  8256. @example
  8257. noformat=pix_fmts=yuv420p,vflip
  8258. @end example
  8259. @item
  8260. Convert the input video to any of the formats not contained in the list:
  8261. @example
  8262. noformat=yuv420p|yuv444p|yuv410p
  8263. @end example
  8264. @end itemize
  8265. @section noise
  8266. Add noise on video input frame.
  8267. The filter accepts the following options:
  8268. @table @option
  8269. @item all_seed
  8270. @item c0_seed
  8271. @item c1_seed
  8272. @item c2_seed
  8273. @item c3_seed
  8274. Set noise seed for specific pixel component or all pixel components in case
  8275. of @var{all_seed}. Default value is @code{123457}.
  8276. @item all_strength, alls
  8277. @item c0_strength, c0s
  8278. @item c1_strength, c1s
  8279. @item c2_strength, c2s
  8280. @item c3_strength, c3s
  8281. Set noise strength for specific pixel component or all pixel components in case
  8282. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8283. @item all_flags, allf
  8284. @item c0_flags, c0f
  8285. @item c1_flags, c1f
  8286. @item c2_flags, c2f
  8287. @item c3_flags, c3f
  8288. Set pixel component flags or set flags for all components if @var{all_flags}.
  8289. Available values for component flags are:
  8290. @table @samp
  8291. @item a
  8292. averaged temporal noise (smoother)
  8293. @item p
  8294. mix random noise with a (semi)regular pattern
  8295. @item t
  8296. temporal noise (noise pattern changes between frames)
  8297. @item u
  8298. uniform noise (gaussian otherwise)
  8299. @end table
  8300. @end table
  8301. @subsection Examples
  8302. Add temporal and uniform noise to input video:
  8303. @example
  8304. noise=alls=20:allf=t+u
  8305. @end example
  8306. @section null
  8307. Pass the video source unchanged to the output.
  8308. @section ocr
  8309. Optical Character Recognition
  8310. This filter uses Tesseract for optical character recognition.
  8311. It accepts the following options:
  8312. @table @option
  8313. @item datapath
  8314. Set datapath to tesseract data. Default is to use whatever was
  8315. set at installation.
  8316. @item language
  8317. Set language, default is "eng".
  8318. @item whitelist
  8319. Set character whitelist.
  8320. @item blacklist
  8321. Set character blacklist.
  8322. @end table
  8323. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8324. @section ocv
  8325. Apply a video transform using libopencv.
  8326. To enable this filter, install the libopencv library and headers and
  8327. configure FFmpeg with @code{--enable-libopencv}.
  8328. It accepts the following parameters:
  8329. @table @option
  8330. @item filter_name
  8331. The name of the libopencv filter to apply.
  8332. @item filter_params
  8333. The parameters to pass to the libopencv filter. If not specified, the default
  8334. values are assumed.
  8335. @end table
  8336. Refer to the official libopencv documentation for more precise
  8337. information:
  8338. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8339. Several libopencv filters are supported; see the following subsections.
  8340. @anchor{dilate}
  8341. @subsection dilate
  8342. Dilate an image by using a specific structuring element.
  8343. It corresponds to the libopencv function @code{cvDilate}.
  8344. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8345. @var{struct_el} represents a structuring element, and has the syntax:
  8346. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8347. @var{cols} and @var{rows} represent the number of columns and rows of
  8348. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8349. point, and @var{shape} the shape for the structuring element. @var{shape}
  8350. must be "rect", "cross", "ellipse", or "custom".
  8351. If the value for @var{shape} is "custom", it must be followed by a
  8352. string of the form "=@var{filename}". The file with name
  8353. @var{filename} is assumed to represent a binary image, with each
  8354. printable character corresponding to a bright pixel. When a custom
  8355. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8356. or columns and rows of the read file are assumed instead.
  8357. The default value for @var{struct_el} is "3x3+0x0/rect".
  8358. @var{nb_iterations} specifies the number of times the transform is
  8359. applied to the image, and defaults to 1.
  8360. Some examples:
  8361. @example
  8362. # Use the default values
  8363. ocv=dilate
  8364. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8365. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8366. # Read the shape from the file diamond.shape, iterating two times.
  8367. # The file diamond.shape may contain a pattern of characters like this
  8368. # *
  8369. # ***
  8370. # *****
  8371. # ***
  8372. # *
  8373. # The specified columns and rows are ignored
  8374. # but the anchor point coordinates are not
  8375. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8376. @end example
  8377. @subsection erode
  8378. Erode an image by using a specific structuring element.
  8379. It corresponds to the libopencv function @code{cvErode}.
  8380. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8381. with the same syntax and semantics as the @ref{dilate} filter.
  8382. @subsection smooth
  8383. Smooth the input video.
  8384. The filter takes the following parameters:
  8385. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8386. @var{type} is the type of smooth filter to apply, and must be one of
  8387. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8388. or "bilateral". The default value is "gaussian".
  8389. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8390. depend on the smooth type. @var{param1} and
  8391. @var{param2} accept integer positive values or 0. @var{param3} and
  8392. @var{param4} accept floating point values.
  8393. The default value for @var{param1} is 3. The default value for the
  8394. other parameters is 0.
  8395. These parameters correspond to the parameters assigned to the
  8396. libopencv function @code{cvSmooth}.
  8397. @section oscilloscope
  8398. 2D Video Oscilloscope.
  8399. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8400. It accepts the following parameters:
  8401. @table @option
  8402. @item x
  8403. Set scope center x position.
  8404. @item y
  8405. Set scope center y position.
  8406. @item s
  8407. Set scope size, relative to frame diagonal.
  8408. @item t
  8409. Set scope tilt/rotation.
  8410. @item o
  8411. Set trace opacity.
  8412. @item tx
  8413. Set trace center x position.
  8414. @item ty
  8415. Set trace center y position.
  8416. @item tw
  8417. Set trace width, relative to width of frame.
  8418. @item th
  8419. Set trace height, relative to height of frame.
  8420. @item c
  8421. Set which components to trace. By default it traces first three components.
  8422. @item g
  8423. Draw trace grid. By default is enabled.
  8424. @item st
  8425. Draw some statistics. By default is enabled.
  8426. @item sc
  8427. Draw scope. By default is enabled.
  8428. @end table
  8429. @subsection Examples
  8430. @itemize
  8431. @item
  8432. Inspect full first row of video frame.
  8433. @example
  8434. oscilloscope=x=0.5:y=0:s=1
  8435. @end example
  8436. @item
  8437. Inspect full last row of video frame.
  8438. @example
  8439. oscilloscope=x=0.5:y=1:s=1
  8440. @end example
  8441. @item
  8442. Inspect full 5th line of video frame of height 1080.
  8443. @example
  8444. oscilloscope=x=0.5:y=5/1080:s=1
  8445. @end example
  8446. @item
  8447. Inspect full last column of video frame.
  8448. @example
  8449. oscilloscope=x=1:y=0.5:s=1:t=1
  8450. @end example
  8451. @end itemize
  8452. @anchor{overlay}
  8453. @section overlay
  8454. Overlay one video on top of another.
  8455. It takes two inputs and has one output. The first input is the "main"
  8456. video on which the second input is overlaid.
  8457. It accepts the following parameters:
  8458. A description of the accepted options follows.
  8459. @table @option
  8460. @item x
  8461. @item y
  8462. Set the expression for the x and y coordinates of the overlaid video
  8463. on the main video. Default value is "0" for both expressions. In case
  8464. the expression is invalid, it is set to a huge value (meaning that the
  8465. overlay will not be displayed within the output visible area).
  8466. @item eof_action
  8467. See @ref{framesync}.
  8468. @item eval
  8469. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8470. It accepts the following values:
  8471. @table @samp
  8472. @item init
  8473. only evaluate expressions once during the filter initialization or
  8474. when a command is processed
  8475. @item frame
  8476. evaluate expressions for each incoming frame
  8477. @end table
  8478. Default value is @samp{frame}.
  8479. @item shortest
  8480. See @ref{framesync}.
  8481. @item format
  8482. Set the format for the output video.
  8483. It accepts the following values:
  8484. @table @samp
  8485. @item yuv420
  8486. force YUV420 output
  8487. @item yuv422
  8488. force YUV422 output
  8489. @item yuv444
  8490. force YUV444 output
  8491. @item rgb
  8492. force packed RGB output
  8493. @item gbrp
  8494. force planar RGB output
  8495. @item auto
  8496. automatically pick format
  8497. @end table
  8498. Default value is @samp{yuv420}.
  8499. @item repeatlast
  8500. See @ref{framesync}.
  8501. @end table
  8502. The @option{x}, and @option{y} expressions can contain the following
  8503. parameters.
  8504. @table @option
  8505. @item main_w, W
  8506. @item main_h, H
  8507. The main input width and height.
  8508. @item overlay_w, w
  8509. @item overlay_h, h
  8510. The overlay input width and height.
  8511. @item x
  8512. @item y
  8513. The computed values for @var{x} and @var{y}. They are evaluated for
  8514. each new frame.
  8515. @item hsub
  8516. @item vsub
  8517. horizontal and vertical chroma subsample values of the output
  8518. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8519. @var{vsub} is 1.
  8520. @item n
  8521. the number of input frame, starting from 0
  8522. @item pos
  8523. the position in the file of the input frame, NAN if unknown
  8524. @item t
  8525. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8526. @end table
  8527. This filter also supports the @ref{framesync} options.
  8528. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8529. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8530. when @option{eval} is set to @samp{init}.
  8531. Be aware that frames are taken from each input video in timestamp
  8532. order, hence, if their initial timestamps differ, it is a good idea
  8533. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8534. have them begin in the same zero timestamp, as the example for
  8535. the @var{movie} filter does.
  8536. You can chain together more overlays but you should test the
  8537. efficiency of such approach.
  8538. @subsection Commands
  8539. This filter supports the following commands:
  8540. @table @option
  8541. @item x
  8542. @item y
  8543. Modify the x and y of the overlay input.
  8544. The command accepts the same syntax of the corresponding option.
  8545. If the specified expression is not valid, it is kept at its current
  8546. value.
  8547. @end table
  8548. @subsection Examples
  8549. @itemize
  8550. @item
  8551. Draw the overlay at 10 pixels from the bottom right corner of the main
  8552. video:
  8553. @example
  8554. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8555. @end example
  8556. Using named options the example above becomes:
  8557. @example
  8558. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8559. @end example
  8560. @item
  8561. Insert a transparent PNG logo in the bottom left corner of the input,
  8562. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8563. @example
  8564. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8565. @end example
  8566. @item
  8567. Insert 2 different transparent PNG logos (second logo on bottom
  8568. right corner) using the @command{ffmpeg} tool:
  8569. @example
  8570. 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
  8571. @end example
  8572. @item
  8573. Add a transparent color layer on top of the main video; @code{WxH}
  8574. must specify the size of the main input to the overlay filter:
  8575. @example
  8576. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8577. @end example
  8578. @item
  8579. Play an original video and a filtered version (here with the deshake
  8580. filter) side by side using the @command{ffplay} tool:
  8581. @example
  8582. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8583. @end example
  8584. The above command is the same as:
  8585. @example
  8586. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8587. @end example
  8588. @item
  8589. Make a sliding overlay appearing from the left to the right top part of the
  8590. screen starting since time 2:
  8591. @example
  8592. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8593. @end example
  8594. @item
  8595. Compose output by putting two input videos side to side:
  8596. @example
  8597. ffmpeg -i left.avi -i right.avi -filter_complex "
  8598. nullsrc=size=200x100 [background];
  8599. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8600. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8601. [background][left] overlay=shortest=1 [background+left];
  8602. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8603. "
  8604. @end example
  8605. @item
  8606. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8607. @example
  8608. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8609. -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]'
  8610. masked.avi
  8611. @end example
  8612. @item
  8613. Chain several overlays in cascade:
  8614. @example
  8615. nullsrc=s=200x200 [bg];
  8616. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8617. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8618. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8619. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8620. [in3] null, [mid2] overlay=100:100 [out0]
  8621. @end example
  8622. @end itemize
  8623. @section owdenoise
  8624. Apply Overcomplete Wavelet denoiser.
  8625. The filter accepts the following options:
  8626. @table @option
  8627. @item depth
  8628. Set depth.
  8629. Larger depth values will denoise lower frequency components more, but
  8630. slow down filtering.
  8631. Must be an int in the range 8-16, default is @code{8}.
  8632. @item luma_strength, ls
  8633. Set luma strength.
  8634. Must be a double value in the range 0-1000, default is @code{1.0}.
  8635. @item chroma_strength, cs
  8636. Set chroma strength.
  8637. Must be a double value in the range 0-1000, default is @code{1.0}.
  8638. @end table
  8639. @anchor{pad}
  8640. @section pad
  8641. Add paddings to the input image, and place the original input at the
  8642. provided @var{x}, @var{y} coordinates.
  8643. It accepts the following parameters:
  8644. @table @option
  8645. @item width, w
  8646. @item height, h
  8647. Specify an expression for the size of the output image with the
  8648. paddings added. If the value for @var{width} or @var{height} is 0, the
  8649. corresponding input size is used for the output.
  8650. The @var{width} expression can reference the value set by the
  8651. @var{height} expression, and vice versa.
  8652. The default value of @var{width} and @var{height} is 0.
  8653. @item x
  8654. @item y
  8655. Specify the offsets to place the input image at within the padded area,
  8656. with respect to the top/left border of the output image.
  8657. The @var{x} expression can reference the value set by the @var{y}
  8658. expression, and vice versa.
  8659. The default value of @var{x} and @var{y} is 0.
  8660. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8661. so the input image is centered on the padded area.
  8662. @item color
  8663. Specify the color of the padded area. For the syntax of this option,
  8664. check the "Color" section in the ffmpeg-utils manual.
  8665. The default value of @var{color} is "black".
  8666. @item eval
  8667. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8668. It accepts the following values:
  8669. @table @samp
  8670. @item init
  8671. Only evaluate expressions once during the filter initialization or when
  8672. a command is processed.
  8673. @item frame
  8674. Evaluate expressions for each incoming frame.
  8675. @end table
  8676. Default value is @samp{init}.
  8677. @item aspect
  8678. Pad to aspect instead to a resolution.
  8679. @end table
  8680. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8681. options are expressions containing the following constants:
  8682. @table @option
  8683. @item in_w
  8684. @item in_h
  8685. The input video width and height.
  8686. @item iw
  8687. @item ih
  8688. These are the same as @var{in_w} and @var{in_h}.
  8689. @item out_w
  8690. @item out_h
  8691. The output width and height (the size of the padded area), as
  8692. specified by the @var{width} and @var{height} expressions.
  8693. @item ow
  8694. @item oh
  8695. These are the same as @var{out_w} and @var{out_h}.
  8696. @item x
  8697. @item y
  8698. The x and y offsets as specified by the @var{x} and @var{y}
  8699. expressions, or NAN if not yet specified.
  8700. @item a
  8701. same as @var{iw} / @var{ih}
  8702. @item sar
  8703. input sample aspect ratio
  8704. @item dar
  8705. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8706. @item hsub
  8707. @item vsub
  8708. The horizontal and vertical chroma subsample values. For example for the
  8709. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8710. @end table
  8711. @subsection Examples
  8712. @itemize
  8713. @item
  8714. Add paddings with the color "violet" to the input video. The output video
  8715. size is 640x480, and the top-left corner of the input video is placed at
  8716. column 0, row 40
  8717. @example
  8718. pad=640:480:0:40:violet
  8719. @end example
  8720. The example above is equivalent to the following command:
  8721. @example
  8722. pad=width=640:height=480:x=0:y=40:color=violet
  8723. @end example
  8724. @item
  8725. Pad the input to get an output with dimensions increased by 3/2,
  8726. and put the input video at the center of the padded area:
  8727. @example
  8728. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8729. @end example
  8730. @item
  8731. Pad the input to get a squared output with size equal to the maximum
  8732. value between the input width and height, and put the input video at
  8733. the center of the padded area:
  8734. @example
  8735. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8736. @end example
  8737. @item
  8738. Pad the input to get a final w/h ratio of 16:9:
  8739. @example
  8740. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8741. @end example
  8742. @item
  8743. In case of anamorphic video, in order to set the output display aspect
  8744. correctly, it is necessary to use @var{sar} in the expression,
  8745. according to the relation:
  8746. @example
  8747. (ih * X / ih) * sar = output_dar
  8748. X = output_dar / sar
  8749. @end example
  8750. Thus the previous example needs to be modified to:
  8751. @example
  8752. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8753. @end example
  8754. @item
  8755. Double the output size and put the input video in the bottom-right
  8756. corner of the output padded area:
  8757. @example
  8758. pad="2*iw:2*ih:ow-iw:oh-ih"
  8759. @end example
  8760. @end itemize
  8761. @anchor{palettegen}
  8762. @section palettegen
  8763. Generate one palette for a whole video stream.
  8764. It accepts the following options:
  8765. @table @option
  8766. @item max_colors
  8767. Set the maximum number of colors to quantize in the palette.
  8768. Note: the palette will still contain 256 colors; the unused palette entries
  8769. will be black.
  8770. @item reserve_transparent
  8771. Create a palette of 255 colors maximum and reserve the last one for
  8772. transparency. Reserving the transparency color is useful for GIF optimization.
  8773. If not set, the maximum of colors in the palette will be 256. You probably want
  8774. to disable this option for a standalone image.
  8775. Set by default.
  8776. @item stats_mode
  8777. Set statistics mode.
  8778. It accepts the following values:
  8779. @table @samp
  8780. @item full
  8781. Compute full frame histograms.
  8782. @item diff
  8783. Compute histograms only for the part that differs from previous frame. This
  8784. might be relevant to give more importance to the moving part of your input if
  8785. the background is static.
  8786. @item single
  8787. Compute new histogram for each frame.
  8788. @end table
  8789. Default value is @var{full}.
  8790. @end table
  8791. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8792. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8793. color quantization of the palette. This information is also visible at
  8794. @var{info} logging level.
  8795. @subsection Examples
  8796. @itemize
  8797. @item
  8798. Generate a representative palette of a given video using @command{ffmpeg}:
  8799. @example
  8800. ffmpeg -i input.mkv -vf palettegen palette.png
  8801. @end example
  8802. @end itemize
  8803. @section paletteuse
  8804. Use a palette to downsample an input video stream.
  8805. The filter takes two inputs: one video stream and a palette. The palette must
  8806. be a 256 pixels image.
  8807. It accepts the following options:
  8808. @table @option
  8809. @item dither
  8810. Select dithering mode. Available algorithms are:
  8811. @table @samp
  8812. @item bayer
  8813. Ordered 8x8 bayer dithering (deterministic)
  8814. @item heckbert
  8815. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8816. Note: this dithering is sometimes considered "wrong" and is included as a
  8817. reference.
  8818. @item floyd_steinberg
  8819. Floyd and Steingberg dithering (error diffusion)
  8820. @item sierra2
  8821. Frankie Sierra dithering v2 (error diffusion)
  8822. @item sierra2_4a
  8823. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8824. @end table
  8825. Default is @var{sierra2_4a}.
  8826. @item bayer_scale
  8827. When @var{bayer} dithering is selected, this option defines the scale of the
  8828. pattern (how much the crosshatch pattern is visible). A low value means more
  8829. visible pattern for less banding, and higher value means less visible pattern
  8830. at the cost of more banding.
  8831. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8832. @item diff_mode
  8833. If set, define the zone to process
  8834. @table @samp
  8835. @item rectangle
  8836. Only the changing rectangle will be reprocessed. This is similar to GIF
  8837. cropping/offsetting compression mechanism. This option can be useful for speed
  8838. if only a part of the image is changing, and has use cases such as limiting the
  8839. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8840. moving scene (it leads to more deterministic output if the scene doesn't change
  8841. much, and as a result less moving noise and better GIF compression).
  8842. @end table
  8843. Default is @var{none}.
  8844. @item new
  8845. Take new palette for each output frame.
  8846. @end table
  8847. @subsection Examples
  8848. @itemize
  8849. @item
  8850. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8851. using @command{ffmpeg}:
  8852. @example
  8853. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8854. @end example
  8855. @end itemize
  8856. @section perspective
  8857. Correct perspective of video not recorded perpendicular to the screen.
  8858. A description of the accepted parameters follows.
  8859. @table @option
  8860. @item x0
  8861. @item y0
  8862. @item x1
  8863. @item y1
  8864. @item x2
  8865. @item y2
  8866. @item x3
  8867. @item y3
  8868. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8869. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8870. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8871. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8872. then the corners of the source will be sent to the specified coordinates.
  8873. The expressions can use the following variables:
  8874. @table @option
  8875. @item W
  8876. @item H
  8877. the width and height of video frame.
  8878. @item in
  8879. Input frame count.
  8880. @item on
  8881. Output frame count.
  8882. @end table
  8883. @item interpolation
  8884. Set interpolation for perspective correction.
  8885. It accepts the following values:
  8886. @table @samp
  8887. @item linear
  8888. @item cubic
  8889. @end table
  8890. Default value is @samp{linear}.
  8891. @item sense
  8892. Set interpretation of coordinate options.
  8893. It accepts the following values:
  8894. @table @samp
  8895. @item 0, source
  8896. Send point in the source specified by the given coordinates to
  8897. the corners of the destination.
  8898. @item 1, destination
  8899. Send the corners of the source to the point in the destination specified
  8900. by the given coordinates.
  8901. Default value is @samp{source}.
  8902. @end table
  8903. @item eval
  8904. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8905. It accepts the following values:
  8906. @table @samp
  8907. @item init
  8908. only evaluate expressions once during the filter initialization or
  8909. when a command is processed
  8910. @item frame
  8911. evaluate expressions for each incoming frame
  8912. @end table
  8913. Default value is @samp{init}.
  8914. @end table
  8915. @section phase
  8916. Delay interlaced video by one field time so that the field order changes.
  8917. The intended use is to fix PAL movies that have been captured with the
  8918. opposite field order to the film-to-video transfer.
  8919. A description of the accepted parameters follows.
  8920. @table @option
  8921. @item mode
  8922. Set phase mode.
  8923. It accepts the following values:
  8924. @table @samp
  8925. @item t
  8926. Capture field order top-first, transfer bottom-first.
  8927. Filter will delay the bottom field.
  8928. @item b
  8929. Capture field order bottom-first, transfer top-first.
  8930. Filter will delay the top field.
  8931. @item p
  8932. Capture and transfer with the same field order. This mode only exists
  8933. for the documentation of the other options to refer to, but if you
  8934. actually select it, the filter will faithfully do nothing.
  8935. @item a
  8936. Capture field order determined automatically by field flags, transfer
  8937. opposite.
  8938. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8939. basis using field flags. If no field information is available,
  8940. then this works just like @samp{u}.
  8941. @item u
  8942. Capture unknown or varying, transfer opposite.
  8943. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8944. analyzing the images and selecting the alternative that produces best
  8945. match between the fields.
  8946. @item T
  8947. Capture top-first, transfer unknown or varying.
  8948. Filter selects among @samp{t} and @samp{p} using image analysis.
  8949. @item B
  8950. Capture bottom-first, transfer unknown or varying.
  8951. Filter selects among @samp{b} and @samp{p} using image analysis.
  8952. @item A
  8953. Capture determined by field flags, transfer unknown or varying.
  8954. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8955. image analysis. If no field information is available, then this works just
  8956. like @samp{U}. This is the default mode.
  8957. @item U
  8958. Both capture and transfer unknown or varying.
  8959. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8960. @end table
  8961. @end table
  8962. @section pixdesctest
  8963. Pixel format descriptor test filter, mainly useful for internal
  8964. testing. The output video should be equal to the input video.
  8965. For example:
  8966. @example
  8967. format=monow, pixdesctest
  8968. @end example
  8969. can be used to test the monowhite pixel format descriptor definition.
  8970. @section pixscope
  8971. Display sample values of color channels. Mainly useful for checking color
  8972. and levels. Minimum supported resolution is 640x480.
  8973. The filters accept the following options:
  8974. @table @option
  8975. @item x
  8976. Set scope X position, relative offset on X axis.
  8977. @item y
  8978. Set scope Y position, relative offset on Y axis.
  8979. @item w
  8980. Set scope width.
  8981. @item h
  8982. Set scope height.
  8983. @item o
  8984. Set window opacity. This window also holds statistics about pixel area.
  8985. @item wx
  8986. Set window X position, relative offset on X axis.
  8987. @item wy
  8988. Set window Y position, relative offset on Y axis.
  8989. @end table
  8990. @section pp
  8991. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8992. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8993. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8994. Each subfilter and some options have a short and a long name that can be used
  8995. interchangeably, i.e. dr/dering are the same.
  8996. The filters accept the following options:
  8997. @table @option
  8998. @item subfilters
  8999. Set postprocessing subfilters string.
  9000. @end table
  9001. All subfilters share common options to determine their scope:
  9002. @table @option
  9003. @item a/autoq
  9004. Honor the quality commands for this subfilter.
  9005. @item c/chrom
  9006. Do chrominance filtering, too (default).
  9007. @item y/nochrom
  9008. Do luminance filtering only (no chrominance).
  9009. @item n/noluma
  9010. Do chrominance filtering only (no luminance).
  9011. @end table
  9012. These options can be appended after the subfilter name, separated by a '|'.
  9013. Available subfilters are:
  9014. @table @option
  9015. @item hb/hdeblock[|difference[|flatness]]
  9016. Horizontal deblocking filter
  9017. @table @option
  9018. @item difference
  9019. Difference factor where higher values mean more deblocking (default: @code{32}).
  9020. @item flatness
  9021. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9022. @end table
  9023. @item vb/vdeblock[|difference[|flatness]]
  9024. Vertical deblocking filter
  9025. @table @option
  9026. @item difference
  9027. Difference factor where higher values mean more deblocking (default: @code{32}).
  9028. @item flatness
  9029. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9030. @end table
  9031. @item ha/hadeblock[|difference[|flatness]]
  9032. Accurate horizontal deblocking filter
  9033. @table @option
  9034. @item difference
  9035. Difference factor where higher values mean more deblocking (default: @code{32}).
  9036. @item flatness
  9037. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9038. @end table
  9039. @item va/vadeblock[|difference[|flatness]]
  9040. Accurate vertical deblocking filter
  9041. @table @option
  9042. @item difference
  9043. Difference factor where higher values mean more deblocking (default: @code{32}).
  9044. @item flatness
  9045. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9046. @end table
  9047. @end table
  9048. The horizontal and vertical deblocking filters share the difference and
  9049. flatness values so you cannot set different horizontal and vertical
  9050. thresholds.
  9051. @table @option
  9052. @item h1/x1hdeblock
  9053. Experimental horizontal deblocking filter
  9054. @item v1/x1vdeblock
  9055. Experimental vertical deblocking filter
  9056. @item dr/dering
  9057. Deringing filter
  9058. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9059. @table @option
  9060. @item threshold1
  9061. larger -> stronger filtering
  9062. @item threshold2
  9063. larger -> stronger filtering
  9064. @item threshold3
  9065. larger -> stronger filtering
  9066. @end table
  9067. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9068. @table @option
  9069. @item f/fullyrange
  9070. Stretch luminance to @code{0-255}.
  9071. @end table
  9072. @item lb/linblenddeint
  9073. Linear blend deinterlacing filter that deinterlaces the given block by
  9074. filtering all lines with a @code{(1 2 1)} filter.
  9075. @item li/linipoldeint
  9076. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9077. linearly interpolating every second line.
  9078. @item ci/cubicipoldeint
  9079. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9080. cubically interpolating every second line.
  9081. @item md/mediandeint
  9082. Median deinterlacing filter that deinterlaces the given block by applying a
  9083. median filter to every second line.
  9084. @item fd/ffmpegdeint
  9085. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9086. second line with a @code{(-1 4 2 4 -1)} filter.
  9087. @item l5/lowpass5
  9088. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9089. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9090. @item fq/forceQuant[|quantizer]
  9091. Overrides the quantizer table from the input with the constant quantizer you
  9092. specify.
  9093. @table @option
  9094. @item quantizer
  9095. Quantizer to use
  9096. @end table
  9097. @item de/default
  9098. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9099. @item fa/fast
  9100. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9101. @item ac
  9102. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9103. @end table
  9104. @subsection Examples
  9105. @itemize
  9106. @item
  9107. Apply horizontal and vertical deblocking, deringing and automatic
  9108. brightness/contrast:
  9109. @example
  9110. pp=hb/vb/dr/al
  9111. @end example
  9112. @item
  9113. Apply default filters without brightness/contrast correction:
  9114. @example
  9115. pp=de/-al
  9116. @end example
  9117. @item
  9118. Apply default filters and temporal denoiser:
  9119. @example
  9120. pp=default/tmpnoise|1|2|3
  9121. @end example
  9122. @item
  9123. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9124. automatically depending on available CPU time:
  9125. @example
  9126. pp=hb|y/vb|a
  9127. @end example
  9128. @end itemize
  9129. @section pp7
  9130. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9131. similar to spp = 6 with 7 point DCT, where only the center sample is
  9132. used after IDCT.
  9133. The filter accepts the following options:
  9134. @table @option
  9135. @item qp
  9136. Force a constant quantization parameter. It accepts an integer in range
  9137. 0 to 63. If not set, the filter will use the QP from the video stream
  9138. (if available).
  9139. @item mode
  9140. Set thresholding mode. Available modes are:
  9141. @table @samp
  9142. @item hard
  9143. Set hard thresholding.
  9144. @item soft
  9145. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9146. @item medium
  9147. Set medium thresholding (good results, default).
  9148. @end table
  9149. @end table
  9150. @section premultiply
  9151. Apply alpha premultiply effect to input video stream using first plane
  9152. of second stream as alpha.
  9153. Both streams must have same dimensions and same pixel format.
  9154. The filter accepts the following option:
  9155. @table @option
  9156. @item planes
  9157. Set which planes will be processed, unprocessed planes will be copied.
  9158. By default value 0xf, all planes will be processed.
  9159. @item inplace
  9160. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9161. @end table
  9162. @section prewitt
  9163. Apply prewitt operator to input video stream.
  9164. The filter accepts the following option:
  9165. @table @option
  9166. @item planes
  9167. Set which planes will be processed, unprocessed planes will be copied.
  9168. By default value 0xf, all planes will be processed.
  9169. @item scale
  9170. Set value which will be multiplied with filtered result.
  9171. @item delta
  9172. Set value which will be added to filtered result.
  9173. @end table
  9174. @section pseudocolor
  9175. Alter frame colors in video with pseudocolors.
  9176. This filter accept the following options:
  9177. @table @option
  9178. @item c0
  9179. set pixel first component expression
  9180. @item c1
  9181. set pixel second component expression
  9182. @item c2
  9183. set pixel third component expression
  9184. @item c3
  9185. set pixel fourth component expression, corresponds to the alpha component
  9186. @item i
  9187. set component to use as base for altering colors
  9188. @end table
  9189. Each of them specifies the expression to use for computing the lookup table for
  9190. the corresponding pixel component values.
  9191. The expressions can contain the following constants and functions:
  9192. @table @option
  9193. @item w
  9194. @item h
  9195. The input width and height.
  9196. @item val
  9197. The input value for the pixel component.
  9198. @item ymin, umin, vmin, amin
  9199. The minimum allowed component value.
  9200. @item ymax, umax, vmax, amax
  9201. The maximum allowed component value.
  9202. @end table
  9203. All expressions default to "val".
  9204. @subsection Examples
  9205. @itemize
  9206. @item
  9207. Change too high luma values to gradient:
  9208. @example
  9209. 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'"
  9210. @end example
  9211. @end itemize
  9212. @section psnr
  9213. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9214. Ratio) between two input videos.
  9215. This filter takes in input two input videos, the first input is
  9216. considered the "main" source and is passed unchanged to the
  9217. output. The second input is used as a "reference" video for computing
  9218. the PSNR.
  9219. Both video inputs must have the same resolution and pixel format for
  9220. this filter to work correctly. Also it assumes that both inputs
  9221. have the same number of frames, which are compared one by one.
  9222. The obtained average PSNR is printed through the logging system.
  9223. The filter stores the accumulated MSE (mean squared error) of each
  9224. frame, and at the end of the processing it is averaged across all frames
  9225. equally, and the following formula is applied to obtain the PSNR:
  9226. @example
  9227. PSNR = 10*log10(MAX^2/MSE)
  9228. @end example
  9229. Where MAX is the average of the maximum values of each component of the
  9230. image.
  9231. The description of the accepted parameters follows.
  9232. @table @option
  9233. @item stats_file, f
  9234. If specified the filter will use the named file to save the PSNR of
  9235. each individual frame. When filename equals "-" the data is sent to
  9236. standard output.
  9237. @item stats_version
  9238. Specifies which version of the stats file format to use. Details of
  9239. each format are written below.
  9240. Default value is 1.
  9241. @item stats_add_max
  9242. Determines whether the max value is output to the stats log.
  9243. Default value is 0.
  9244. Requires stats_version >= 2. If this is set and stats_version < 2,
  9245. the filter will return an error.
  9246. @end table
  9247. This filter also supports the @ref{framesync} options.
  9248. The file printed if @var{stats_file} is selected, contains a sequence of
  9249. key/value pairs of the form @var{key}:@var{value} for each compared
  9250. couple of frames.
  9251. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9252. the list of per-frame-pair stats, with key value pairs following the frame
  9253. format with the following parameters:
  9254. @table @option
  9255. @item psnr_log_version
  9256. The version of the log file format. Will match @var{stats_version}.
  9257. @item fields
  9258. A comma separated list of the per-frame-pair parameters included in
  9259. the log.
  9260. @end table
  9261. A description of each shown per-frame-pair parameter follows:
  9262. @table @option
  9263. @item n
  9264. sequential number of the input frame, starting from 1
  9265. @item mse_avg
  9266. Mean Square Error pixel-by-pixel average difference of the compared
  9267. frames, averaged over all the image components.
  9268. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9269. Mean Square Error pixel-by-pixel average difference of the compared
  9270. frames for the component specified by the suffix.
  9271. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9272. Peak Signal to Noise ratio of the compared frames for the component
  9273. specified by the suffix.
  9274. @item max_avg, max_y, max_u, max_v
  9275. Maximum allowed value for each channel, and average over all
  9276. channels.
  9277. @end table
  9278. For example:
  9279. @example
  9280. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9281. [main][ref] psnr="stats_file=stats.log" [out]
  9282. @end example
  9283. On this example the input file being processed is compared with the
  9284. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9285. is stored in @file{stats.log}.
  9286. @anchor{pullup}
  9287. @section pullup
  9288. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9289. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9290. content.
  9291. The pullup filter is designed to take advantage of future context in making
  9292. its decisions. This filter is stateless in the sense that it does not lock
  9293. onto a pattern to follow, but it instead looks forward to the following
  9294. fields in order to identify matches and rebuild progressive frames.
  9295. To produce content with an even framerate, insert the fps filter after
  9296. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9297. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9298. The filter accepts the following options:
  9299. @table @option
  9300. @item jl
  9301. @item jr
  9302. @item jt
  9303. @item jb
  9304. These options set the amount of "junk" to ignore at the left, right, top, and
  9305. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9306. while top and bottom are in units of 2 lines.
  9307. The default is 8 pixels on each side.
  9308. @item sb
  9309. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9310. filter generating an occasional mismatched frame, but it may also cause an
  9311. excessive number of frames to be dropped during high motion sequences.
  9312. Conversely, setting it to -1 will make filter match fields more easily.
  9313. This may help processing of video where there is slight blurring between
  9314. the fields, but may also cause there to be interlaced frames in the output.
  9315. Default value is @code{0}.
  9316. @item mp
  9317. Set the metric plane to use. It accepts the following values:
  9318. @table @samp
  9319. @item l
  9320. Use luma plane.
  9321. @item u
  9322. Use chroma blue plane.
  9323. @item v
  9324. Use chroma red plane.
  9325. @end table
  9326. This option may be set to use chroma plane instead of the default luma plane
  9327. for doing filter's computations. This may improve accuracy on very clean
  9328. source material, but more likely will decrease accuracy, especially if there
  9329. is chroma noise (rainbow effect) or any grayscale video.
  9330. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9331. load and make pullup usable in realtime on slow machines.
  9332. @end table
  9333. For best results (without duplicated frames in the output file) it is
  9334. necessary to change the output frame rate. For example, to inverse
  9335. telecine NTSC input:
  9336. @example
  9337. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9338. @end example
  9339. @section qp
  9340. Change video quantization parameters (QP).
  9341. The filter accepts the following option:
  9342. @table @option
  9343. @item qp
  9344. Set expression for quantization parameter.
  9345. @end table
  9346. The expression is evaluated through the eval API and can contain, among others,
  9347. the following constants:
  9348. @table @var
  9349. @item known
  9350. 1 if index is not 129, 0 otherwise.
  9351. @item qp
  9352. Sequential index starting from -129 to 128.
  9353. @end table
  9354. @subsection Examples
  9355. @itemize
  9356. @item
  9357. Some equation like:
  9358. @example
  9359. qp=2+2*sin(PI*qp)
  9360. @end example
  9361. @end itemize
  9362. @section random
  9363. Flush video frames from internal cache of frames into a random order.
  9364. No frame is discarded.
  9365. Inspired by @ref{frei0r} nervous filter.
  9366. @table @option
  9367. @item frames
  9368. Set size in number of frames of internal cache, in range from @code{2} to
  9369. @code{512}. Default is @code{30}.
  9370. @item seed
  9371. Set seed for random number generator, must be an integer included between
  9372. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9373. less than @code{0}, the filter will try to use a good random seed on a
  9374. best effort basis.
  9375. @end table
  9376. @section readeia608
  9377. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9378. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9379. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9380. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9381. @table @option
  9382. @item lavfi.readeia608.X.cc
  9383. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9384. @item lavfi.readeia608.X.line
  9385. The number of the line on which the EIA-608 data was identified and read.
  9386. @end table
  9387. This filter accepts the following options:
  9388. @table @option
  9389. @item scan_min
  9390. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9391. @item scan_max
  9392. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9393. @item mac
  9394. Set minimal acceptable amplitude change for sync codes detection.
  9395. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9396. @item spw
  9397. Set the ratio of width reserved for sync code detection.
  9398. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9399. @item mhd
  9400. Set the max peaks height difference for sync code detection.
  9401. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9402. @item mpd
  9403. Set max peaks period difference for sync code detection.
  9404. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9405. @item msd
  9406. Set the first two max start code bits differences.
  9407. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9408. @item bhd
  9409. Set the minimum ratio of bits height compared to 3rd start code bit.
  9410. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9411. @item th_w
  9412. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9413. @item th_b
  9414. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9415. @item chp
  9416. Enable checking the parity bit. In the event of a parity error, the filter will output
  9417. @code{0x00} for that character. Default is false.
  9418. @end table
  9419. @subsection Examples
  9420. @itemize
  9421. @item
  9422. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9423. @example
  9424. 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
  9425. @end example
  9426. @end itemize
  9427. @section readvitc
  9428. Read vertical interval timecode (VITC) information from the top lines of a
  9429. video frame.
  9430. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9431. timecode value, if a valid timecode has been detected. Further metadata key
  9432. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9433. timecode data has been found or not.
  9434. This filter accepts the following options:
  9435. @table @option
  9436. @item scan_max
  9437. Set the maximum number of lines to scan for VITC data. If the value is set to
  9438. @code{-1} the full video frame is scanned. Default is @code{45}.
  9439. @item thr_b
  9440. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9441. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9442. @item thr_w
  9443. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9444. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9445. @end table
  9446. @subsection Examples
  9447. @itemize
  9448. @item
  9449. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9450. draw @code{--:--:--:--} as a placeholder:
  9451. @example
  9452. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9453. @end example
  9454. @end itemize
  9455. @section remap
  9456. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9457. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9458. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9459. value for pixel will be used for destination pixel.
  9460. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9461. will have Xmap/Ymap video stream dimensions.
  9462. Xmap and Ymap input video streams are 16bit depth, single channel.
  9463. @section removegrain
  9464. The removegrain filter is a spatial denoiser for progressive video.
  9465. @table @option
  9466. @item m0
  9467. Set mode for the first plane.
  9468. @item m1
  9469. Set mode for the second plane.
  9470. @item m2
  9471. Set mode for the third plane.
  9472. @item m3
  9473. Set mode for the fourth plane.
  9474. @end table
  9475. Range of mode is from 0 to 24. Description of each mode follows:
  9476. @table @var
  9477. @item 0
  9478. Leave input plane unchanged. Default.
  9479. @item 1
  9480. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9481. @item 2
  9482. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9483. @item 3
  9484. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9485. @item 4
  9486. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9487. This is equivalent to a median filter.
  9488. @item 5
  9489. Line-sensitive clipping giving the minimal change.
  9490. @item 6
  9491. Line-sensitive clipping, intermediate.
  9492. @item 7
  9493. Line-sensitive clipping, intermediate.
  9494. @item 8
  9495. Line-sensitive clipping, intermediate.
  9496. @item 9
  9497. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9498. @item 10
  9499. Replaces the target pixel with the closest neighbour.
  9500. @item 11
  9501. [1 2 1] horizontal and vertical kernel blur.
  9502. @item 12
  9503. Same as mode 11.
  9504. @item 13
  9505. Bob mode, interpolates top field from the line where the neighbours
  9506. pixels are the closest.
  9507. @item 14
  9508. Bob mode, interpolates bottom field from the line where the neighbours
  9509. pixels are the closest.
  9510. @item 15
  9511. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9512. interpolation formula.
  9513. @item 16
  9514. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9515. interpolation formula.
  9516. @item 17
  9517. Clips the pixel with the minimum and maximum of respectively the maximum and
  9518. minimum of each pair of opposite neighbour pixels.
  9519. @item 18
  9520. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9521. the current pixel is minimal.
  9522. @item 19
  9523. Replaces the pixel with the average of its 8 neighbours.
  9524. @item 20
  9525. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9526. @item 21
  9527. Clips pixels using the averages of opposite neighbour.
  9528. @item 22
  9529. Same as mode 21 but simpler and faster.
  9530. @item 23
  9531. Small edge and halo removal, but reputed useless.
  9532. @item 24
  9533. Similar as 23.
  9534. @end table
  9535. @section removelogo
  9536. Suppress a TV station logo, using an image file to determine which
  9537. pixels comprise the logo. It works by filling in the pixels that
  9538. comprise the logo with neighboring pixels.
  9539. The filter accepts the following options:
  9540. @table @option
  9541. @item filename, f
  9542. Set the filter bitmap file, which can be any image format supported by
  9543. libavformat. The width and height of the image file must match those of the
  9544. video stream being processed.
  9545. @end table
  9546. Pixels in the provided bitmap image with a value of zero are not
  9547. considered part of the logo, non-zero pixels are considered part of
  9548. the logo. If you use white (255) for the logo and black (0) for the
  9549. rest, you will be safe. For making the filter bitmap, it is
  9550. recommended to take a screen capture of a black frame with the logo
  9551. visible, and then using a threshold filter followed by the erode
  9552. filter once or twice.
  9553. If needed, little splotches can be fixed manually. Remember that if
  9554. logo pixels are not covered, the filter quality will be much
  9555. reduced. Marking too many pixels as part of the logo does not hurt as
  9556. much, but it will increase the amount of blurring needed to cover over
  9557. the image and will destroy more information than necessary, and extra
  9558. pixels will slow things down on a large logo.
  9559. @section repeatfields
  9560. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9561. fields based on its value.
  9562. @section reverse
  9563. Reverse a video clip.
  9564. Warning: This filter requires memory to buffer the entire clip, so trimming
  9565. is suggested.
  9566. @subsection Examples
  9567. @itemize
  9568. @item
  9569. Take the first 5 seconds of a clip, and reverse it.
  9570. @example
  9571. trim=end=5,reverse
  9572. @end example
  9573. @end itemize
  9574. @section roberts
  9575. Apply roberts cross operator to input video stream.
  9576. The filter accepts the following option:
  9577. @table @option
  9578. @item planes
  9579. Set which planes will be processed, unprocessed planes will be copied.
  9580. By default value 0xf, all planes will be processed.
  9581. @item scale
  9582. Set value which will be multiplied with filtered result.
  9583. @item delta
  9584. Set value which will be added to filtered result.
  9585. @end table
  9586. @section rotate
  9587. Rotate video by an arbitrary angle expressed in radians.
  9588. The filter accepts the following options:
  9589. A description of the optional parameters follows.
  9590. @table @option
  9591. @item angle, a
  9592. Set an expression for the angle by which to rotate the input video
  9593. clockwise, expressed as a number of radians. A negative value will
  9594. result in a counter-clockwise rotation. By default it is set to "0".
  9595. This expression is evaluated for each frame.
  9596. @item out_w, ow
  9597. Set the output width expression, default value is "iw".
  9598. This expression is evaluated just once during configuration.
  9599. @item out_h, oh
  9600. Set the output height expression, default value is "ih".
  9601. This expression is evaluated just once during configuration.
  9602. @item bilinear
  9603. Enable bilinear interpolation if set to 1, a value of 0 disables
  9604. it. Default value is 1.
  9605. @item fillcolor, c
  9606. Set the color used to fill the output area not covered by the rotated
  9607. image. For the general syntax of this option, check the "Color" section in the
  9608. ffmpeg-utils manual. If the special value "none" is selected then no
  9609. background is printed (useful for example if the background is never shown).
  9610. Default value is "black".
  9611. @end table
  9612. The expressions for the angle and the output size can contain the
  9613. following constants and functions:
  9614. @table @option
  9615. @item n
  9616. sequential number of the input frame, starting from 0. It is always NAN
  9617. before the first frame is filtered.
  9618. @item t
  9619. time in seconds of the input frame, it is set to 0 when the filter is
  9620. configured. It is always NAN before the first frame is filtered.
  9621. @item hsub
  9622. @item vsub
  9623. horizontal and vertical chroma subsample values. For example for the
  9624. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9625. @item in_w, iw
  9626. @item in_h, ih
  9627. the input video width and height
  9628. @item out_w, ow
  9629. @item out_h, oh
  9630. the output width and height, that is the size of the padded area as
  9631. specified by the @var{width} and @var{height} expressions
  9632. @item rotw(a)
  9633. @item roth(a)
  9634. the minimal width/height required for completely containing the input
  9635. video rotated by @var{a} radians.
  9636. These are only available when computing the @option{out_w} and
  9637. @option{out_h} expressions.
  9638. @end table
  9639. @subsection Examples
  9640. @itemize
  9641. @item
  9642. Rotate the input by PI/6 radians clockwise:
  9643. @example
  9644. rotate=PI/6
  9645. @end example
  9646. @item
  9647. Rotate the input by PI/6 radians counter-clockwise:
  9648. @example
  9649. rotate=-PI/6
  9650. @end example
  9651. @item
  9652. Rotate the input by 45 degrees clockwise:
  9653. @example
  9654. rotate=45*PI/180
  9655. @end example
  9656. @item
  9657. Apply a constant rotation with period T, starting from an angle of PI/3:
  9658. @example
  9659. rotate=PI/3+2*PI*t/T
  9660. @end example
  9661. @item
  9662. Make the input video rotation oscillating with a period of T
  9663. seconds and an amplitude of A radians:
  9664. @example
  9665. rotate=A*sin(2*PI/T*t)
  9666. @end example
  9667. @item
  9668. Rotate the video, output size is chosen so that the whole rotating
  9669. input video is always completely contained in the output:
  9670. @example
  9671. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9672. @end example
  9673. @item
  9674. Rotate the video, reduce the output size so that no background is ever
  9675. shown:
  9676. @example
  9677. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9678. @end example
  9679. @end itemize
  9680. @subsection Commands
  9681. The filter supports the following commands:
  9682. @table @option
  9683. @item a, angle
  9684. Set the angle expression.
  9685. The command accepts the same syntax of the corresponding option.
  9686. If the specified expression is not valid, it is kept at its current
  9687. value.
  9688. @end table
  9689. @section sab
  9690. Apply Shape Adaptive Blur.
  9691. The filter accepts the following options:
  9692. @table @option
  9693. @item luma_radius, lr
  9694. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9695. value is 1.0. A greater value will result in a more blurred image, and
  9696. in slower processing.
  9697. @item luma_pre_filter_radius, lpfr
  9698. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9699. value is 1.0.
  9700. @item luma_strength, ls
  9701. Set luma maximum difference between pixels to still be considered, must
  9702. be a value in the 0.1-100.0 range, default value is 1.0.
  9703. @item chroma_radius, cr
  9704. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9705. greater value will result in a more blurred image, and in slower
  9706. processing.
  9707. @item chroma_pre_filter_radius, cpfr
  9708. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9709. @item chroma_strength, cs
  9710. Set chroma maximum difference between pixels to still be considered,
  9711. must be a value in the -0.9-100.0 range.
  9712. @end table
  9713. Each chroma option value, if not explicitly specified, is set to the
  9714. corresponding luma option value.
  9715. @anchor{scale}
  9716. @section scale
  9717. Scale (resize) the input video, using the libswscale library.
  9718. The scale filter forces the output display aspect ratio to be the same
  9719. of the input, by changing the output sample aspect ratio.
  9720. If the input image format is different from the format requested by
  9721. the next filter, the scale filter will convert the input to the
  9722. requested format.
  9723. @subsection Options
  9724. The filter accepts the following options, or any of the options
  9725. supported by the libswscale scaler.
  9726. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9727. the complete list of scaler options.
  9728. @table @option
  9729. @item width, w
  9730. @item height, h
  9731. Set the output video dimension expression. Default value is the input
  9732. dimension.
  9733. If the @var{width} or @var{w} value is 0, the input width is used for
  9734. the output. If the @var{height} or @var{h} value is 0, the input height
  9735. is used for the output.
  9736. If one and only one of the values is -n with n >= 1, the scale filter
  9737. will use a value that maintains the aspect ratio of the input image,
  9738. calculated from the other specified dimension. After that it will,
  9739. however, make sure that the calculated dimension is divisible by n and
  9740. adjust the value if necessary.
  9741. If both values are -n with n >= 1, the behavior will be identical to
  9742. both values being set to 0 as previously detailed.
  9743. See below for the list of accepted constants for use in the dimension
  9744. expression.
  9745. @item eval
  9746. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9747. @table @samp
  9748. @item init
  9749. Only evaluate expressions once during the filter initialization or when a command is processed.
  9750. @item frame
  9751. Evaluate expressions for each incoming frame.
  9752. @end table
  9753. Default value is @samp{init}.
  9754. @item interl
  9755. Set the interlacing mode. It accepts the following values:
  9756. @table @samp
  9757. @item 1
  9758. Force interlaced aware scaling.
  9759. @item 0
  9760. Do not apply interlaced scaling.
  9761. @item -1
  9762. Select interlaced aware scaling depending on whether the source frames
  9763. are flagged as interlaced or not.
  9764. @end table
  9765. Default value is @samp{0}.
  9766. @item flags
  9767. Set libswscale scaling flags. See
  9768. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9769. complete list of values. If not explicitly specified the filter applies
  9770. the default flags.
  9771. @item param0, param1
  9772. Set libswscale input parameters for scaling algorithms that need them. See
  9773. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9774. complete documentation. If not explicitly specified the filter applies
  9775. empty parameters.
  9776. @item size, s
  9777. Set the video size. For the syntax of this option, check the
  9778. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9779. @item in_color_matrix
  9780. @item out_color_matrix
  9781. Set in/output YCbCr color space type.
  9782. This allows the autodetected value to be overridden as well as allows forcing
  9783. a specific value used for the output and encoder.
  9784. If not specified, the color space type depends on the pixel format.
  9785. Possible values:
  9786. @table @samp
  9787. @item auto
  9788. Choose automatically.
  9789. @item bt709
  9790. Format conforming to International Telecommunication Union (ITU)
  9791. Recommendation BT.709.
  9792. @item fcc
  9793. Set color space conforming to the United States Federal Communications
  9794. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9795. @item bt601
  9796. Set color space conforming to:
  9797. @itemize
  9798. @item
  9799. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9800. @item
  9801. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9802. @item
  9803. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9804. @end itemize
  9805. @item smpte240m
  9806. Set color space conforming to SMPTE ST 240:1999.
  9807. @end table
  9808. @item in_range
  9809. @item out_range
  9810. Set in/output YCbCr sample range.
  9811. This allows the autodetected value to be overridden as well as allows forcing
  9812. a specific value used for the output and encoder. If not specified, the
  9813. range depends on the pixel format. Possible values:
  9814. @table @samp
  9815. @item auto
  9816. Choose automatically.
  9817. @item jpeg/full/pc
  9818. Set full range (0-255 in case of 8-bit luma).
  9819. @item mpeg/tv
  9820. Set "MPEG" range (16-235 in case of 8-bit luma).
  9821. @end table
  9822. @item force_original_aspect_ratio
  9823. Enable decreasing or increasing output video width or height if necessary to
  9824. keep the original aspect ratio. Possible values:
  9825. @table @samp
  9826. @item disable
  9827. Scale the video as specified and disable this feature.
  9828. @item decrease
  9829. The output video dimensions will automatically be decreased if needed.
  9830. @item increase
  9831. The output video dimensions will automatically be increased if needed.
  9832. @end table
  9833. One useful instance of this option is that when you know a specific device's
  9834. maximum allowed resolution, you can use this to limit the output video to
  9835. that, while retaining the aspect ratio. For example, device A allows
  9836. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9837. decrease) and specifying 1280x720 to the command line makes the output
  9838. 1280x533.
  9839. Please note that this is a different thing than specifying -1 for @option{w}
  9840. or @option{h}, you still need to specify the output resolution for this option
  9841. to work.
  9842. @end table
  9843. The values of the @option{w} and @option{h} options are expressions
  9844. containing the following constants:
  9845. @table @var
  9846. @item in_w
  9847. @item in_h
  9848. The input width and height
  9849. @item iw
  9850. @item ih
  9851. These are the same as @var{in_w} and @var{in_h}.
  9852. @item out_w
  9853. @item out_h
  9854. The output (scaled) width and height
  9855. @item ow
  9856. @item oh
  9857. These are the same as @var{out_w} and @var{out_h}
  9858. @item a
  9859. The same as @var{iw} / @var{ih}
  9860. @item sar
  9861. input sample aspect ratio
  9862. @item dar
  9863. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9864. @item hsub
  9865. @item vsub
  9866. horizontal and vertical input chroma subsample values. For example for the
  9867. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9868. @item ohsub
  9869. @item ovsub
  9870. horizontal and vertical output chroma subsample values. For example for the
  9871. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9872. @end table
  9873. @subsection Examples
  9874. @itemize
  9875. @item
  9876. Scale the input video to a size of 200x100
  9877. @example
  9878. scale=w=200:h=100
  9879. @end example
  9880. This is equivalent to:
  9881. @example
  9882. scale=200:100
  9883. @end example
  9884. or:
  9885. @example
  9886. scale=200x100
  9887. @end example
  9888. @item
  9889. Specify a size abbreviation for the output size:
  9890. @example
  9891. scale=qcif
  9892. @end example
  9893. which can also be written as:
  9894. @example
  9895. scale=size=qcif
  9896. @end example
  9897. @item
  9898. Scale the input to 2x:
  9899. @example
  9900. scale=w=2*iw:h=2*ih
  9901. @end example
  9902. @item
  9903. The above is the same as:
  9904. @example
  9905. scale=2*in_w:2*in_h
  9906. @end example
  9907. @item
  9908. Scale the input to 2x with forced interlaced scaling:
  9909. @example
  9910. scale=2*iw:2*ih:interl=1
  9911. @end example
  9912. @item
  9913. Scale the input to half size:
  9914. @example
  9915. scale=w=iw/2:h=ih/2
  9916. @end example
  9917. @item
  9918. Increase the width, and set the height to the same size:
  9919. @example
  9920. scale=3/2*iw:ow
  9921. @end example
  9922. @item
  9923. Seek Greek harmony:
  9924. @example
  9925. scale=iw:1/PHI*iw
  9926. scale=ih*PHI:ih
  9927. @end example
  9928. @item
  9929. Increase the height, and set the width to 3/2 of the height:
  9930. @example
  9931. scale=w=3/2*oh:h=3/5*ih
  9932. @end example
  9933. @item
  9934. Increase the size, making the size a multiple of the chroma
  9935. subsample values:
  9936. @example
  9937. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9938. @end example
  9939. @item
  9940. Increase the width to a maximum of 500 pixels,
  9941. keeping the same aspect ratio as the input:
  9942. @example
  9943. scale=w='min(500\, iw*3/2):h=-1'
  9944. @end example
  9945. @end itemize
  9946. @subsection Commands
  9947. This filter supports the following commands:
  9948. @table @option
  9949. @item width, w
  9950. @item height, h
  9951. Set the output video dimension expression.
  9952. The command accepts the same syntax of the corresponding option.
  9953. If the specified expression is not valid, it is kept at its current
  9954. value.
  9955. @end table
  9956. @section scale_npp
  9957. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9958. format conversion on CUDA video frames. Setting the output width and height
  9959. works in the same way as for the @var{scale} filter.
  9960. The following additional options are accepted:
  9961. @table @option
  9962. @item format
  9963. The pixel format of the output CUDA frames. If set to the string "same" (the
  9964. default), the input format will be kept. Note that automatic format negotiation
  9965. and conversion is not yet supported for hardware frames
  9966. @item interp_algo
  9967. The interpolation algorithm used for resizing. One of the following:
  9968. @table @option
  9969. @item nn
  9970. Nearest neighbour.
  9971. @item linear
  9972. @item cubic
  9973. @item cubic2p_bspline
  9974. 2-parameter cubic (B=1, C=0)
  9975. @item cubic2p_catmullrom
  9976. 2-parameter cubic (B=0, C=1/2)
  9977. @item cubic2p_b05c03
  9978. 2-parameter cubic (B=1/2, C=3/10)
  9979. @item super
  9980. Supersampling
  9981. @item lanczos
  9982. @end table
  9983. @end table
  9984. @section scale2ref
  9985. Scale (resize) the input video, based on a reference video.
  9986. See the scale filter for available options, scale2ref supports the same but
  9987. uses the reference video instead of the main input as basis. scale2ref also
  9988. supports the following additional constants for the @option{w} and
  9989. @option{h} options:
  9990. @table @var
  9991. @item main_w
  9992. @item main_h
  9993. The main input video's width and height
  9994. @item main_a
  9995. The same as @var{main_w} / @var{main_h}
  9996. @item main_sar
  9997. The main input video's sample aspect ratio
  9998. @item main_dar, mdar
  9999. The main input video's display aspect ratio. Calculated from
  10000. @code{(main_w / main_h) * main_sar}.
  10001. @item main_hsub
  10002. @item main_vsub
  10003. The main input video's horizontal and vertical chroma subsample values.
  10004. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10005. is 1.
  10006. @end table
  10007. @subsection Examples
  10008. @itemize
  10009. @item
  10010. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10011. @example
  10012. 'scale2ref[b][a];[a][b]overlay'
  10013. @end example
  10014. @end itemize
  10015. @anchor{selectivecolor}
  10016. @section selectivecolor
  10017. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10018. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10019. by the "purity" of the color (that is, how saturated it already is).
  10020. This filter is similar to the Adobe Photoshop Selective Color tool.
  10021. The filter accepts the following options:
  10022. @table @option
  10023. @item correction_method
  10024. Select color correction method.
  10025. Available values are:
  10026. @table @samp
  10027. @item absolute
  10028. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10029. component value).
  10030. @item relative
  10031. Specified adjustments are relative to the original component value.
  10032. @end table
  10033. Default is @code{absolute}.
  10034. @item reds
  10035. Adjustments for red pixels (pixels where the red component is the maximum)
  10036. @item yellows
  10037. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10038. @item greens
  10039. Adjustments for green pixels (pixels where the green component is the maximum)
  10040. @item cyans
  10041. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10042. @item blues
  10043. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10044. @item magentas
  10045. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10046. @item whites
  10047. Adjustments for white pixels (pixels where all components are greater than 128)
  10048. @item neutrals
  10049. Adjustments for all pixels except pure black and pure white
  10050. @item blacks
  10051. Adjustments for black pixels (pixels where all components are lesser than 128)
  10052. @item psfile
  10053. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10054. @end table
  10055. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10056. 4 space separated floating point adjustment values in the [-1,1] range,
  10057. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10058. pixels of its range.
  10059. @subsection Examples
  10060. @itemize
  10061. @item
  10062. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10063. increase magenta by 27% in blue areas:
  10064. @example
  10065. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10066. @end example
  10067. @item
  10068. Use a Photoshop selective color preset:
  10069. @example
  10070. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10071. @end example
  10072. @end itemize
  10073. @anchor{separatefields}
  10074. @section separatefields
  10075. The @code{separatefields} takes a frame-based video input and splits
  10076. each frame into its components fields, producing a new half height clip
  10077. with twice the frame rate and twice the frame count.
  10078. This filter use field-dominance information in frame to decide which
  10079. of each pair of fields to place first in the output.
  10080. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10081. @section setdar, setsar
  10082. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10083. output video.
  10084. This is done by changing the specified Sample (aka Pixel) Aspect
  10085. Ratio, according to the following equation:
  10086. @example
  10087. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10088. @end example
  10089. Keep in mind that the @code{setdar} filter does not modify the pixel
  10090. dimensions of the video frame. Also, the display aspect ratio set by
  10091. this filter may be changed by later filters in the filterchain,
  10092. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10093. applied.
  10094. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10095. the filter output video.
  10096. Note that as a consequence of the application of this filter, the
  10097. output display aspect ratio will change according to the equation
  10098. above.
  10099. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10100. filter may be changed by later filters in the filterchain, e.g. if
  10101. another "setsar" or a "setdar" filter is applied.
  10102. It accepts the following parameters:
  10103. @table @option
  10104. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10105. Set the aspect ratio used by the filter.
  10106. The parameter can be a floating point number string, an expression, or
  10107. a string of the form @var{num}:@var{den}, where @var{num} and
  10108. @var{den} are the numerator and denominator of the aspect ratio. If
  10109. the parameter is not specified, it is assumed the value "0".
  10110. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10111. should be escaped.
  10112. @item max
  10113. Set the maximum integer value to use for expressing numerator and
  10114. denominator when reducing the expressed aspect ratio to a rational.
  10115. Default value is @code{100}.
  10116. @end table
  10117. The parameter @var{sar} is an expression containing
  10118. the following constants:
  10119. @table @option
  10120. @item E, PI, PHI
  10121. These are approximated values for the mathematical constants e
  10122. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10123. @item w, h
  10124. The input width and height.
  10125. @item a
  10126. These are the same as @var{w} / @var{h}.
  10127. @item sar
  10128. The input sample aspect ratio.
  10129. @item dar
  10130. The input display aspect ratio. It is the same as
  10131. (@var{w} / @var{h}) * @var{sar}.
  10132. @item hsub, vsub
  10133. Horizontal and vertical chroma subsample values. For example, for the
  10134. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10135. @end table
  10136. @subsection Examples
  10137. @itemize
  10138. @item
  10139. To change the display aspect ratio to 16:9, specify one of the following:
  10140. @example
  10141. setdar=dar=1.77777
  10142. setdar=dar=16/9
  10143. @end example
  10144. @item
  10145. To change the sample aspect ratio to 10:11, specify:
  10146. @example
  10147. setsar=sar=10/11
  10148. @end example
  10149. @item
  10150. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10151. 1000 in the aspect ratio reduction, use the command:
  10152. @example
  10153. setdar=ratio=16/9:max=1000
  10154. @end example
  10155. @end itemize
  10156. @anchor{setfield}
  10157. @section setfield
  10158. Force field for the output video frame.
  10159. The @code{setfield} filter marks the interlace type field for the
  10160. output frames. It does not change the input frame, but only sets the
  10161. corresponding property, which affects how the frame is treated by
  10162. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10163. The filter accepts the following options:
  10164. @table @option
  10165. @item mode
  10166. Available values are:
  10167. @table @samp
  10168. @item auto
  10169. Keep the same field property.
  10170. @item bff
  10171. Mark the frame as bottom-field-first.
  10172. @item tff
  10173. Mark the frame as top-field-first.
  10174. @item prog
  10175. Mark the frame as progressive.
  10176. @end table
  10177. @end table
  10178. @section showinfo
  10179. Show a line containing various information for each input video frame.
  10180. The input video is not modified.
  10181. The shown line contains a sequence of key/value pairs of the form
  10182. @var{key}:@var{value}.
  10183. The following values are shown in the output:
  10184. @table @option
  10185. @item n
  10186. The (sequential) number of the input frame, starting from 0.
  10187. @item pts
  10188. The Presentation TimeStamp of the input frame, expressed as a number of
  10189. time base units. The time base unit depends on the filter input pad.
  10190. @item pts_time
  10191. The Presentation TimeStamp of the input frame, expressed as a number of
  10192. seconds.
  10193. @item pos
  10194. The position of the frame in the input stream, or -1 if this information is
  10195. unavailable and/or meaningless (for example in case of synthetic video).
  10196. @item fmt
  10197. The pixel format name.
  10198. @item sar
  10199. The sample aspect ratio of the input frame, expressed in the form
  10200. @var{num}/@var{den}.
  10201. @item s
  10202. The size of the input frame. For the syntax of this option, check the
  10203. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10204. @item i
  10205. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10206. for bottom field first).
  10207. @item iskey
  10208. This is 1 if the frame is a key frame, 0 otherwise.
  10209. @item type
  10210. The picture type of the input frame ("I" for an I-frame, "P" for a
  10211. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10212. Also refer to the documentation of the @code{AVPictureType} enum and of
  10213. the @code{av_get_picture_type_char} function defined in
  10214. @file{libavutil/avutil.h}.
  10215. @item checksum
  10216. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10217. @item plane_checksum
  10218. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10219. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10220. @end table
  10221. @section showpalette
  10222. Displays the 256 colors palette of each frame. This filter is only relevant for
  10223. @var{pal8} pixel format frames.
  10224. It accepts the following option:
  10225. @table @option
  10226. @item s
  10227. Set the size of the box used to represent one palette color entry. Default is
  10228. @code{30} (for a @code{30x30} pixel box).
  10229. @end table
  10230. @section shuffleframes
  10231. Reorder and/or duplicate and/or drop video frames.
  10232. It accepts the following parameters:
  10233. @table @option
  10234. @item mapping
  10235. Set the destination indexes of input frames.
  10236. This is space or '|' separated list of indexes that maps input frames to output
  10237. frames. Number of indexes also sets maximal value that each index may have.
  10238. '-1' index have special meaning and that is to drop frame.
  10239. @end table
  10240. The first frame has the index 0. The default is to keep the input unchanged.
  10241. @subsection Examples
  10242. @itemize
  10243. @item
  10244. Swap second and third frame of every three frames of the input:
  10245. @example
  10246. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10247. @end example
  10248. @item
  10249. Swap 10th and 1st frame of every ten frames of the input:
  10250. @example
  10251. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10252. @end example
  10253. @end itemize
  10254. @section shuffleplanes
  10255. Reorder and/or duplicate video planes.
  10256. It accepts the following parameters:
  10257. @table @option
  10258. @item map0
  10259. The index of the input plane to be used as the first output plane.
  10260. @item map1
  10261. The index of the input plane to be used as the second output plane.
  10262. @item map2
  10263. The index of the input plane to be used as the third output plane.
  10264. @item map3
  10265. The index of the input plane to be used as the fourth output plane.
  10266. @end table
  10267. The first plane has the index 0. The default is to keep the input unchanged.
  10268. @subsection Examples
  10269. @itemize
  10270. @item
  10271. Swap the second and third planes of the input:
  10272. @example
  10273. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10274. @end example
  10275. @end itemize
  10276. @anchor{signalstats}
  10277. @section signalstats
  10278. Evaluate various visual metrics that assist in determining issues associated
  10279. with the digitization of analog video media.
  10280. By default the filter will log these metadata values:
  10281. @table @option
  10282. @item YMIN
  10283. Display the minimal Y value contained within the input frame. Expressed in
  10284. range of [0-255].
  10285. @item YLOW
  10286. Display the Y value at the 10% percentile within the input frame. Expressed in
  10287. range of [0-255].
  10288. @item YAVG
  10289. Display the average Y value within the input frame. Expressed in range of
  10290. [0-255].
  10291. @item YHIGH
  10292. Display the Y value at the 90% percentile within the input frame. Expressed in
  10293. range of [0-255].
  10294. @item YMAX
  10295. Display the maximum Y value contained within the input frame. Expressed in
  10296. range of [0-255].
  10297. @item UMIN
  10298. Display the minimal U value contained within the input frame. Expressed in
  10299. range of [0-255].
  10300. @item ULOW
  10301. Display the U value at the 10% percentile within the input frame. Expressed in
  10302. range of [0-255].
  10303. @item UAVG
  10304. Display the average U value within the input frame. Expressed in range of
  10305. [0-255].
  10306. @item UHIGH
  10307. Display the U value at the 90% percentile within the input frame. Expressed in
  10308. range of [0-255].
  10309. @item UMAX
  10310. Display the maximum U value contained within the input frame. Expressed in
  10311. range of [0-255].
  10312. @item VMIN
  10313. Display the minimal V value contained within the input frame. Expressed in
  10314. range of [0-255].
  10315. @item VLOW
  10316. Display the V value at the 10% percentile within the input frame. Expressed in
  10317. range of [0-255].
  10318. @item VAVG
  10319. Display the average V value within the input frame. Expressed in range of
  10320. [0-255].
  10321. @item VHIGH
  10322. Display the V value at the 90% percentile within the input frame. Expressed in
  10323. range of [0-255].
  10324. @item VMAX
  10325. Display the maximum V value contained within the input frame. Expressed in
  10326. range of [0-255].
  10327. @item SATMIN
  10328. Display the minimal saturation value contained within the input frame.
  10329. Expressed in range of [0-~181.02].
  10330. @item SATLOW
  10331. Display the saturation value at the 10% percentile within the input frame.
  10332. Expressed in range of [0-~181.02].
  10333. @item SATAVG
  10334. Display the average saturation value within the input frame. Expressed in range
  10335. of [0-~181.02].
  10336. @item SATHIGH
  10337. Display the saturation value at the 90% percentile within the input frame.
  10338. Expressed in range of [0-~181.02].
  10339. @item SATMAX
  10340. Display the maximum saturation value contained within the input frame.
  10341. Expressed in range of [0-~181.02].
  10342. @item HUEMED
  10343. Display the median value for hue within the input frame. Expressed in range of
  10344. [0-360].
  10345. @item HUEAVG
  10346. Display the average value for hue within the input frame. Expressed in range of
  10347. [0-360].
  10348. @item YDIF
  10349. Display the average of sample value difference between all values of the Y
  10350. plane in the current frame and corresponding values of the previous input frame.
  10351. Expressed in range of [0-255].
  10352. @item UDIF
  10353. Display the average of sample value difference between all values of the U
  10354. plane in the current frame and corresponding values of the previous input frame.
  10355. Expressed in range of [0-255].
  10356. @item VDIF
  10357. Display the average of sample value difference between all values of the V
  10358. plane in the current frame and corresponding values of the previous input frame.
  10359. Expressed in range of [0-255].
  10360. @item YBITDEPTH
  10361. Display bit depth of Y plane in current frame.
  10362. Expressed in range of [0-16].
  10363. @item UBITDEPTH
  10364. Display bit depth of U plane in current frame.
  10365. Expressed in range of [0-16].
  10366. @item VBITDEPTH
  10367. Display bit depth of V plane in current frame.
  10368. Expressed in range of [0-16].
  10369. @end table
  10370. The filter accepts the following options:
  10371. @table @option
  10372. @item stat
  10373. @item out
  10374. @option{stat} specify an additional form of image analysis.
  10375. @option{out} output video with the specified type of pixel highlighted.
  10376. Both options accept the following values:
  10377. @table @samp
  10378. @item tout
  10379. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10380. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10381. include the results of video dropouts, head clogs, or tape tracking issues.
  10382. @item vrep
  10383. Identify @var{vertical line repetition}. Vertical line repetition includes
  10384. similar rows of pixels within a frame. In born-digital video vertical line
  10385. repetition is common, but this pattern is uncommon in video digitized from an
  10386. analog source. When it occurs in video that results from the digitization of an
  10387. analog source it can indicate concealment from a dropout compensator.
  10388. @item brng
  10389. Identify pixels that fall outside of legal broadcast range.
  10390. @end table
  10391. @item color, c
  10392. Set the highlight color for the @option{out} option. The default color is
  10393. yellow.
  10394. @end table
  10395. @subsection Examples
  10396. @itemize
  10397. @item
  10398. Output data of various video metrics:
  10399. @example
  10400. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10401. @end example
  10402. @item
  10403. Output specific data about the minimum and maximum values of the Y plane per frame:
  10404. @example
  10405. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10406. @end example
  10407. @item
  10408. Playback video while highlighting pixels that are outside of broadcast range in red.
  10409. @example
  10410. ffplay example.mov -vf signalstats="out=brng:color=red"
  10411. @end example
  10412. @item
  10413. Playback video with signalstats metadata drawn over the frame.
  10414. @example
  10415. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10416. @end example
  10417. The contents of signalstat_drawtext.txt used in the command are:
  10418. @example
  10419. time %@{pts:hms@}
  10420. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10421. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10422. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10423. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10424. @end example
  10425. @end itemize
  10426. @anchor{signature}
  10427. @section signature
  10428. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10429. input. In this case the matching between the inputs can be calculated additionally.
  10430. The filter always passes through the first input. The signature of each stream can
  10431. be written into a file.
  10432. It accepts the following options:
  10433. @table @option
  10434. @item detectmode
  10435. Enable or disable the matching process.
  10436. Available values are:
  10437. @table @samp
  10438. @item off
  10439. Disable the calculation of a matching (default).
  10440. @item full
  10441. Calculate the matching for the whole video and output whether the whole video
  10442. matches or only parts.
  10443. @item fast
  10444. Calculate only until a matching is found or the video ends. Should be faster in
  10445. some cases.
  10446. @end table
  10447. @item nb_inputs
  10448. Set the number of inputs. The option value must be a non negative integer.
  10449. Default value is 1.
  10450. @item filename
  10451. Set the path to which the output is written. If there is more than one input,
  10452. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10453. integer), that will be replaced with the input number. If no filename is
  10454. specified, no output will be written. This is the default.
  10455. @item format
  10456. Choose the output format.
  10457. Available values are:
  10458. @table @samp
  10459. @item binary
  10460. Use the specified binary representation (default).
  10461. @item xml
  10462. Use the specified xml representation.
  10463. @end table
  10464. @item th_d
  10465. Set threshold to detect one word as similar. The option value must be an integer
  10466. greater than zero. The default value is 9000.
  10467. @item th_dc
  10468. Set threshold to detect all words as similar. The option value must be an integer
  10469. greater than zero. The default value is 60000.
  10470. @item th_xh
  10471. Set threshold to detect frames as similar. The option value must be an integer
  10472. greater than zero. The default value is 116.
  10473. @item th_di
  10474. Set the minimum length of a sequence in frames to recognize it as matching
  10475. sequence. The option value must be a non negative integer value.
  10476. The default value is 0.
  10477. @item th_it
  10478. Set the minimum relation, that matching frames to all frames must have.
  10479. The option value must be a double value between 0 and 1. The default value is 0.5.
  10480. @end table
  10481. @subsection Examples
  10482. @itemize
  10483. @item
  10484. To calculate the signature of an input video and store it in signature.bin:
  10485. @example
  10486. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10487. @end example
  10488. @item
  10489. To detect whether two videos match and store the signatures in XML format in
  10490. signature0.xml and signature1.xml:
  10491. @example
  10492. 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 -
  10493. @end example
  10494. @end itemize
  10495. @anchor{smartblur}
  10496. @section smartblur
  10497. Blur the input video without impacting the outlines.
  10498. It accepts the following options:
  10499. @table @option
  10500. @item luma_radius, lr
  10501. Set the luma radius. The option value must be a float number in
  10502. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10503. used to blur the image (slower if larger). Default value is 1.0.
  10504. @item luma_strength, ls
  10505. Set the luma strength. The option value must be a float number
  10506. in the range [-1.0,1.0] that configures the blurring. A value included
  10507. in [0.0,1.0] will blur the image whereas a value included in
  10508. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10509. @item luma_threshold, lt
  10510. Set the luma threshold used as a coefficient to determine
  10511. whether a pixel should be blurred or not. The option value must be an
  10512. integer in the range [-30,30]. A value of 0 will filter all the image,
  10513. a value included in [0,30] will filter flat areas and a value included
  10514. in [-30,0] will filter edges. Default value is 0.
  10515. @item chroma_radius, cr
  10516. Set the chroma radius. The option value must be a float number in
  10517. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10518. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10519. @item chroma_strength, cs
  10520. Set the chroma strength. The option value must be a float number
  10521. in the range [-1.0,1.0] that configures the blurring. A value included
  10522. in [0.0,1.0] will blur the image whereas a value included in
  10523. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10524. @item chroma_threshold, ct
  10525. Set the chroma threshold used as a coefficient to determine
  10526. whether a pixel should be blurred or not. The option value must be an
  10527. integer in the range [-30,30]. A value of 0 will filter all the image,
  10528. a value included in [0,30] will filter flat areas and a value included
  10529. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10530. @end table
  10531. If a chroma option is not explicitly set, the corresponding luma value
  10532. is set.
  10533. @section ssim
  10534. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10535. This filter takes in input two input videos, the first input is
  10536. considered the "main" source and is passed unchanged to the
  10537. output. The second input is used as a "reference" video for computing
  10538. the SSIM.
  10539. Both video inputs must have the same resolution and pixel format for
  10540. this filter to work correctly. Also it assumes that both inputs
  10541. have the same number of frames, which are compared one by one.
  10542. The filter stores the calculated SSIM of each frame.
  10543. The description of the accepted parameters follows.
  10544. @table @option
  10545. @item stats_file, f
  10546. If specified the filter will use the named file to save the SSIM of
  10547. each individual frame. When filename equals "-" the data is sent to
  10548. standard output.
  10549. @end table
  10550. The file printed if @var{stats_file} is selected, contains a sequence of
  10551. key/value pairs of the form @var{key}:@var{value} for each compared
  10552. couple of frames.
  10553. A description of each shown parameter follows:
  10554. @table @option
  10555. @item n
  10556. sequential number of the input frame, starting from 1
  10557. @item Y, U, V, R, G, B
  10558. SSIM of the compared frames for the component specified by the suffix.
  10559. @item All
  10560. SSIM of the compared frames for the whole frame.
  10561. @item dB
  10562. Same as above but in dB representation.
  10563. @end table
  10564. This filter also supports the @ref{framesync} options.
  10565. For example:
  10566. @example
  10567. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10568. [main][ref] ssim="stats_file=stats.log" [out]
  10569. @end example
  10570. On this example the input file being processed is compared with the
  10571. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10572. is stored in @file{stats.log}.
  10573. Another example with both psnr and ssim at same time:
  10574. @example
  10575. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10576. @end example
  10577. @section stereo3d
  10578. Convert between different stereoscopic image formats.
  10579. The filters accept the following options:
  10580. @table @option
  10581. @item in
  10582. Set stereoscopic image format of input.
  10583. Available values for input image formats are:
  10584. @table @samp
  10585. @item sbsl
  10586. side by side parallel (left eye left, right eye right)
  10587. @item sbsr
  10588. side by side crosseye (right eye left, left eye right)
  10589. @item sbs2l
  10590. side by side parallel with half width resolution
  10591. (left eye left, right eye right)
  10592. @item sbs2r
  10593. side by side crosseye with half width resolution
  10594. (right eye left, left eye right)
  10595. @item abl
  10596. above-below (left eye above, right eye below)
  10597. @item abr
  10598. above-below (right eye above, left eye below)
  10599. @item ab2l
  10600. above-below with half height resolution
  10601. (left eye above, right eye below)
  10602. @item ab2r
  10603. above-below with half height resolution
  10604. (right eye above, left eye below)
  10605. @item al
  10606. alternating frames (left eye first, right eye second)
  10607. @item ar
  10608. alternating frames (right eye first, left eye second)
  10609. @item irl
  10610. interleaved rows (left eye has top row, right eye starts on next row)
  10611. @item irr
  10612. interleaved rows (right eye has top row, left eye starts on next row)
  10613. @item icl
  10614. interleaved columns, left eye first
  10615. @item icr
  10616. interleaved columns, right eye first
  10617. Default value is @samp{sbsl}.
  10618. @end table
  10619. @item out
  10620. Set stereoscopic image format of output.
  10621. @table @samp
  10622. @item sbsl
  10623. side by side parallel (left eye left, right eye right)
  10624. @item sbsr
  10625. side by side crosseye (right eye left, left eye right)
  10626. @item sbs2l
  10627. side by side parallel with half width resolution
  10628. (left eye left, right eye right)
  10629. @item sbs2r
  10630. side by side crosseye with half width resolution
  10631. (right eye left, left eye right)
  10632. @item abl
  10633. above-below (left eye above, right eye below)
  10634. @item abr
  10635. above-below (right eye above, left eye below)
  10636. @item ab2l
  10637. above-below with half height resolution
  10638. (left eye above, right eye below)
  10639. @item ab2r
  10640. above-below with half height resolution
  10641. (right eye above, left eye below)
  10642. @item al
  10643. alternating frames (left eye first, right eye second)
  10644. @item ar
  10645. alternating frames (right eye first, left eye second)
  10646. @item irl
  10647. interleaved rows (left eye has top row, right eye starts on next row)
  10648. @item irr
  10649. interleaved rows (right eye has top row, left eye starts on next row)
  10650. @item arbg
  10651. anaglyph red/blue gray
  10652. (red filter on left eye, blue filter on right eye)
  10653. @item argg
  10654. anaglyph red/green gray
  10655. (red filter on left eye, green filter on right eye)
  10656. @item arcg
  10657. anaglyph red/cyan gray
  10658. (red filter on left eye, cyan filter on right eye)
  10659. @item arch
  10660. anaglyph red/cyan half colored
  10661. (red filter on left eye, cyan filter on right eye)
  10662. @item arcc
  10663. anaglyph red/cyan color
  10664. (red filter on left eye, cyan filter on right eye)
  10665. @item arcd
  10666. anaglyph red/cyan color optimized with the least squares projection of dubois
  10667. (red filter on left eye, cyan filter on right eye)
  10668. @item agmg
  10669. anaglyph green/magenta gray
  10670. (green filter on left eye, magenta filter on right eye)
  10671. @item agmh
  10672. anaglyph green/magenta half colored
  10673. (green filter on left eye, magenta filter on right eye)
  10674. @item agmc
  10675. anaglyph green/magenta colored
  10676. (green filter on left eye, magenta filter on right eye)
  10677. @item agmd
  10678. anaglyph green/magenta color optimized with the least squares projection of dubois
  10679. (green filter on left eye, magenta filter on right eye)
  10680. @item aybg
  10681. anaglyph yellow/blue gray
  10682. (yellow filter on left eye, blue filter on right eye)
  10683. @item aybh
  10684. anaglyph yellow/blue half colored
  10685. (yellow filter on left eye, blue filter on right eye)
  10686. @item aybc
  10687. anaglyph yellow/blue colored
  10688. (yellow filter on left eye, blue filter on right eye)
  10689. @item aybd
  10690. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10691. (yellow filter on left eye, blue filter on right eye)
  10692. @item ml
  10693. mono output (left eye only)
  10694. @item mr
  10695. mono output (right eye only)
  10696. @item chl
  10697. checkerboard, left eye first
  10698. @item chr
  10699. checkerboard, right eye first
  10700. @item icl
  10701. interleaved columns, left eye first
  10702. @item icr
  10703. interleaved columns, right eye first
  10704. @item hdmi
  10705. HDMI frame pack
  10706. @end table
  10707. Default value is @samp{arcd}.
  10708. @end table
  10709. @subsection Examples
  10710. @itemize
  10711. @item
  10712. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10713. @example
  10714. stereo3d=sbsl:aybd
  10715. @end example
  10716. @item
  10717. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10718. @example
  10719. stereo3d=abl:sbsr
  10720. @end example
  10721. @end itemize
  10722. @section streamselect, astreamselect
  10723. Select video or audio streams.
  10724. The filter accepts the following options:
  10725. @table @option
  10726. @item inputs
  10727. Set number of inputs. Default is 2.
  10728. @item map
  10729. Set input indexes to remap to outputs.
  10730. @end table
  10731. @subsection Commands
  10732. The @code{streamselect} and @code{astreamselect} filter supports the following
  10733. commands:
  10734. @table @option
  10735. @item map
  10736. Set input indexes to remap to outputs.
  10737. @end table
  10738. @subsection Examples
  10739. @itemize
  10740. @item
  10741. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10742. @example
  10743. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10744. @end example
  10745. @item
  10746. Same as above, but for audio:
  10747. @example
  10748. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10749. @end example
  10750. @end itemize
  10751. @section sobel
  10752. Apply sobel operator to input video stream.
  10753. The filter accepts the following option:
  10754. @table @option
  10755. @item planes
  10756. Set which planes will be processed, unprocessed planes will be copied.
  10757. By default value 0xf, all planes will be processed.
  10758. @item scale
  10759. Set value which will be multiplied with filtered result.
  10760. @item delta
  10761. Set value which will be added to filtered result.
  10762. @end table
  10763. @anchor{spp}
  10764. @section spp
  10765. Apply a simple postprocessing filter that compresses and decompresses the image
  10766. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10767. and average the results.
  10768. The filter accepts the following options:
  10769. @table @option
  10770. @item quality
  10771. Set quality. This option defines the number of levels for averaging. It accepts
  10772. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10773. effect. A value of @code{6} means the higher quality. For each increment of
  10774. that value the speed drops by a factor of approximately 2. Default value is
  10775. @code{3}.
  10776. @item qp
  10777. Force a constant quantization parameter. If not set, the filter will use the QP
  10778. from the video stream (if available).
  10779. @item mode
  10780. Set thresholding mode. Available modes are:
  10781. @table @samp
  10782. @item hard
  10783. Set hard thresholding (default).
  10784. @item soft
  10785. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10786. @end table
  10787. @item use_bframe_qp
  10788. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10789. option may cause flicker since the B-Frames have often larger QP. Default is
  10790. @code{0} (not enabled).
  10791. @end table
  10792. @anchor{subtitles}
  10793. @section subtitles
  10794. Draw subtitles on top of input video using the libass library.
  10795. To enable compilation of this filter you need to configure FFmpeg with
  10796. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10797. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10798. Alpha) subtitles format.
  10799. The filter accepts the following options:
  10800. @table @option
  10801. @item filename, f
  10802. Set the filename of the subtitle file to read. It must be specified.
  10803. @item original_size
  10804. Specify the size of the original video, the video for which the ASS file
  10805. was composed. For the syntax of this option, check the
  10806. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10807. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10808. correctly scale the fonts if the aspect ratio has been changed.
  10809. @item fontsdir
  10810. Set a directory path containing fonts that can be used by the filter.
  10811. These fonts will be used in addition to whatever the font provider uses.
  10812. @item alpha
  10813. Process alpha channel, by default alpha channel is untouched.
  10814. @item charenc
  10815. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10816. useful if not UTF-8.
  10817. @item stream_index, si
  10818. Set subtitles stream index. @code{subtitles} filter only.
  10819. @item force_style
  10820. Override default style or script info parameters of the subtitles. It accepts a
  10821. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10822. @end table
  10823. If the first key is not specified, it is assumed that the first value
  10824. specifies the @option{filename}.
  10825. For example, to render the file @file{sub.srt} on top of the input
  10826. video, use the command:
  10827. @example
  10828. subtitles=sub.srt
  10829. @end example
  10830. which is equivalent to:
  10831. @example
  10832. subtitles=filename=sub.srt
  10833. @end example
  10834. To render the default subtitles stream from file @file{video.mkv}, use:
  10835. @example
  10836. subtitles=video.mkv
  10837. @end example
  10838. To render the second subtitles stream from that file, use:
  10839. @example
  10840. subtitles=video.mkv:si=1
  10841. @end example
  10842. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10843. @code{DejaVu Serif}, use:
  10844. @example
  10845. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10846. @end example
  10847. @section super2xsai
  10848. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10849. Interpolate) pixel art scaling algorithm.
  10850. Useful for enlarging pixel art images without reducing sharpness.
  10851. @section swaprect
  10852. Swap two rectangular objects in video.
  10853. This filter accepts the following options:
  10854. @table @option
  10855. @item w
  10856. Set object width.
  10857. @item h
  10858. Set object height.
  10859. @item x1
  10860. Set 1st rect x coordinate.
  10861. @item y1
  10862. Set 1st rect y coordinate.
  10863. @item x2
  10864. Set 2nd rect x coordinate.
  10865. @item y2
  10866. Set 2nd rect y coordinate.
  10867. All expressions are evaluated once for each frame.
  10868. @end table
  10869. The all options are expressions containing the following constants:
  10870. @table @option
  10871. @item w
  10872. @item h
  10873. The input width and height.
  10874. @item a
  10875. same as @var{w} / @var{h}
  10876. @item sar
  10877. input sample aspect ratio
  10878. @item dar
  10879. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10880. @item n
  10881. The number of the input frame, starting from 0.
  10882. @item t
  10883. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10884. @item pos
  10885. the position in the file of the input frame, NAN if unknown
  10886. @end table
  10887. @section swapuv
  10888. Swap U & V plane.
  10889. @section telecine
  10890. Apply telecine process to the video.
  10891. This filter accepts the following options:
  10892. @table @option
  10893. @item first_field
  10894. @table @samp
  10895. @item top, t
  10896. top field first
  10897. @item bottom, b
  10898. bottom field first
  10899. The default value is @code{top}.
  10900. @end table
  10901. @item pattern
  10902. A string of numbers representing the pulldown pattern you wish to apply.
  10903. The default value is @code{23}.
  10904. @end table
  10905. @example
  10906. Some typical patterns:
  10907. NTSC output (30i):
  10908. 27.5p: 32222
  10909. 24p: 23 (classic)
  10910. 24p: 2332 (preferred)
  10911. 20p: 33
  10912. 18p: 334
  10913. 16p: 3444
  10914. PAL output (25i):
  10915. 27.5p: 12222
  10916. 24p: 222222222223 ("Euro pulldown")
  10917. 16.67p: 33
  10918. 16p: 33333334
  10919. @end example
  10920. @section threshold
  10921. Apply threshold effect to video stream.
  10922. This filter needs four video streams to perform thresholding.
  10923. First stream is stream we are filtering.
  10924. Second stream is holding threshold values, third stream is holding min values,
  10925. and last, fourth stream is holding max values.
  10926. The filter accepts the following option:
  10927. @table @option
  10928. @item planes
  10929. Set which planes will be processed, unprocessed planes will be copied.
  10930. By default value 0xf, all planes will be processed.
  10931. @end table
  10932. For example if first stream pixel's component value is less then threshold value
  10933. of pixel component from 2nd threshold stream, third stream value will picked,
  10934. otherwise fourth stream pixel component value will be picked.
  10935. Using color source filter one can perform various types of thresholding:
  10936. @subsection Examples
  10937. @itemize
  10938. @item
  10939. Binary threshold, using gray color as threshold:
  10940. @example
  10941. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10942. @end example
  10943. @item
  10944. Inverted binary threshold, using gray color as threshold:
  10945. @example
  10946. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10947. @end example
  10948. @item
  10949. Truncate binary threshold, using gray color as threshold:
  10950. @example
  10951. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10952. @end example
  10953. @item
  10954. Threshold to zero, using gray color as threshold:
  10955. @example
  10956. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10957. @end example
  10958. @item
  10959. Inverted threshold to zero, using gray color as threshold:
  10960. @example
  10961. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10962. @end example
  10963. @end itemize
  10964. @section thumbnail
  10965. Select the most representative frame in a given sequence of consecutive frames.
  10966. The filter accepts the following options:
  10967. @table @option
  10968. @item n
  10969. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10970. will pick one of them, and then handle the next batch of @var{n} frames until
  10971. the end. Default is @code{100}.
  10972. @end table
  10973. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10974. value will result in a higher memory usage, so a high value is not recommended.
  10975. @subsection Examples
  10976. @itemize
  10977. @item
  10978. Extract one picture each 50 frames:
  10979. @example
  10980. thumbnail=50
  10981. @end example
  10982. @item
  10983. Complete example of a thumbnail creation with @command{ffmpeg}:
  10984. @example
  10985. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10986. @end example
  10987. @end itemize
  10988. @section tile
  10989. Tile several successive frames together.
  10990. The filter accepts the following options:
  10991. @table @option
  10992. @item layout
  10993. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10994. this option, check the
  10995. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10996. @item nb_frames
  10997. Set the maximum number of frames to render in the given area. It must be less
  10998. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10999. the area will be used.
  11000. @item margin
  11001. Set the outer border margin in pixels.
  11002. @item padding
  11003. Set the inner border thickness (i.e. the number of pixels between frames). For
  11004. more advanced padding options (such as having different values for the edges),
  11005. refer to the pad video filter.
  11006. @item color
  11007. Specify the color of the unused area. For the syntax of this option, check the
  11008. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11009. is "black".
  11010. @end table
  11011. @subsection Examples
  11012. @itemize
  11013. @item
  11014. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11015. @example
  11016. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11017. @end example
  11018. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11019. duplicating each output frame to accommodate the originally detected frame
  11020. rate.
  11021. @item
  11022. Display @code{5} pictures in an area of @code{3x2} frames,
  11023. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11024. mixed flat and named options:
  11025. @example
  11026. tile=3x2:nb_frames=5:padding=7:margin=2
  11027. @end example
  11028. @end itemize
  11029. @section tinterlace
  11030. Perform various types of temporal field interlacing.
  11031. Frames are counted starting from 1, so the first input frame is
  11032. considered odd.
  11033. The filter accepts the following options:
  11034. @table @option
  11035. @item mode
  11036. Specify the mode of the interlacing. This option can also be specified
  11037. as a value alone. See below for a list of values for this option.
  11038. Available values are:
  11039. @table @samp
  11040. @item merge, 0
  11041. Move odd frames into the upper field, even into the lower field,
  11042. generating a double height frame at half frame rate.
  11043. @example
  11044. ------> time
  11045. Input:
  11046. Frame 1 Frame 2 Frame 3 Frame 4
  11047. 11111 22222 33333 44444
  11048. 11111 22222 33333 44444
  11049. 11111 22222 33333 44444
  11050. 11111 22222 33333 44444
  11051. Output:
  11052. 11111 33333
  11053. 22222 44444
  11054. 11111 33333
  11055. 22222 44444
  11056. 11111 33333
  11057. 22222 44444
  11058. 11111 33333
  11059. 22222 44444
  11060. @end example
  11061. @item drop_even, 1
  11062. Only output odd frames, even frames are dropped, generating a frame with
  11063. unchanged height at half frame rate.
  11064. @example
  11065. ------> time
  11066. Input:
  11067. Frame 1 Frame 2 Frame 3 Frame 4
  11068. 11111 22222 33333 44444
  11069. 11111 22222 33333 44444
  11070. 11111 22222 33333 44444
  11071. 11111 22222 33333 44444
  11072. Output:
  11073. 11111 33333
  11074. 11111 33333
  11075. 11111 33333
  11076. 11111 33333
  11077. @end example
  11078. @item drop_odd, 2
  11079. Only output even frames, odd frames are dropped, generating a frame with
  11080. unchanged height at half frame rate.
  11081. @example
  11082. ------> time
  11083. Input:
  11084. Frame 1 Frame 2 Frame 3 Frame 4
  11085. 11111 22222 33333 44444
  11086. 11111 22222 33333 44444
  11087. 11111 22222 33333 44444
  11088. 11111 22222 33333 44444
  11089. Output:
  11090. 22222 44444
  11091. 22222 44444
  11092. 22222 44444
  11093. 22222 44444
  11094. @end example
  11095. @item pad, 3
  11096. Expand each frame to full height, but pad alternate lines with black,
  11097. generating a frame with double height at the same input frame rate.
  11098. @example
  11099. ------> time
  11100. Input:
  11101. Frame 1 Frame 2 Frame 3 Frame 4
  11102. 11111 22222 33333 44444
  11103. 11111 22222 33333 44444
  11104. 11111 22222 33333 44444
  11105. 11111 22222 33333 44444
  11106. Output:
  11107. 11111 ..... 33333 .....
  11108. ..... 22222 ..... 44444
  11109. 11111 ..... 33333 .....
  11110. ..... 22222 ..... 44444
  11111. 11111 ..... 33333 .....
  11112. ..... 22222 ..... 44444
  11113. 11111 ..... 33333 .....
  11114. ..... 22222 ..... 44444
  11115. @end example
  11116. @item interleave_top, 4
  11117. Interleave the upper field from odd frames with the lower field from
  11118. even frames, generating a frame with unchanged height at half frame rate.
  11119. @example
  11120. ------> time
  11121. Input:
  11122. Frame 1 Frame 2 Frame 3 Frame 4
  11123. 11111<- 22222 33333<- 44444
  11124. 11111 22222<- 33333 44444<-
  11125. 11111<- 22222 33333<- 44444
  11126. 11111 22222<- 33333 44444<-
  11127. Output:
  11128. 11111 33333
  11129. 22222 44444
  11130. 11111 33333
  11131. 22222 44444
  11132. @end example
  11133. @item interleave_bottom, 5
  11134. Interleave the lower field from odd frames with the upper field from
  11135. even frames, generating a frame with unchanged height at half frame rate.
  11136. @example
  11137. ------> time
  11138. Input:
  11139. Frame 1 Frame 2 Frame 3 Frame 4
  11140. 11111 22222<- 33333 44444<-
  11141. 11111<- 22222 33333<- 44444
  11142. 11111 22222<- 33333 44444<-
  11143. 11111<- 22222 33333<- 44444
  11144. Output:
  11145. 22222 44444
  11146. 11111 33333
  11147. 22222 44444
  11148. 11111 33333
  11149. @end example
  11150. @item interlacex2, 6
  11151. Double frame rate with unchanged height. Frames are inserted each
  11152. containing the second temporal field from the previous input frame and
  11153. the first temporal field from the next input frame. This mode relies on
  11154. the top_field_first flag. Useful for interlaced video displays with no
  11155. field synchronisation.
  11156. @example
  11157. ------> time
  11158. Input:
  11159. Frame 1 Frame 2 Frame 3 Frame 4
  11160. 11111 22222 33333 44444
  11161. 11111 22222 33333 44444
  11162. 11111 22222 33333 44444
  11163. 11111 22222 33333 44444
  11164. Output:
  11165. 11111 22222 22222 33333 33333 44444 44444
  11166. 11111 11111 22222 22222 33333 33333 44444
  11167. 11111 22222 22222 33333 33333 44444 44444
  11168. 11111 11111 22222 22222 33333 33333 44444
  11169. @end example
  11170. @item mergex2, 7
  11171. Move odd frames into the upper field, even into the lower field,
  11172. generating a double height frame at same frame rate.
  11173. @example
  11174. ------> time
  11175. Input:
  11176. Frame 1 Frame 2 Frame 3 Frame 4
  11177. 11111 22222 33333 44444
  11178. 11111 22222 33333 44444
  11179. 11111 22222 33333 44444
  11180. 11111 22222 33333 44444
  11181. Output:
  11182. 11111 33333 33333 55555
  11183. 22222 22222 44444 44444
  11184. 11111 33333 33333 55555
  11185. 22222 22222 44444 44444
  11186. 11111 33333 33333 55555
  11187. 22222 22222 44444 44444
  11188. 11111 33333 33333 55555
  11189. 22222 22222 44444 44444
  11190. @end example
  11191. @end table
  11192. Numeric values are deprecated but are accepted for backward
  11193. compatibility reasons.
  11194. Default mode is @code{merge}.
  11195. @item flags
  11196. Specify flags influencing the filter process.
  11197. Available value for @var{flags} is:
  11198. @table @option
  11199. @item low_pass_filter, vlfp
  11200. Enable linear vertical low-pass filtering in the filter.
  11201. Vertical low-pass filtering is required when creating an interlaced
  11202. destination from a progressive source which contains high-frequency
  11203. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11204. patterning.
  11205. @item complex_filter, cvlfp
  11206. Enable complex vertical low-pass filtering.
  11207. This will slightly less reduce interlace 'twitter' and Moire
  11208. patterning but better retain detail and subjective sharpness impression.
  11209. @end table
  11210. Vertical low-pass filtering can only be enabled for @option{mode}
  11211. @var{interleave_top} and @var{interleave_bottom}.
  11212. @end table
  11213. @section tonemap
  11214. Tone map colors from different dynamic ranges.
  11215. This filter expects data in single precision floating point, as it needs to
  11216. operate on (and can output) out-of-range values. Another filter, such as
  11217. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11218. The tonemapping algorithms implemented only work on linear light, so input
  11219. data should be linearized beforehand (and possibly correctly tagged).
  11220. @example
  11221. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11222. @end example
  11223. @subsection Options
  11224. The filter accepts the following options.
  11225. @table @option
  11226. @item tonemap
  11227. Set the tone map algorithm to use.
  11228. Possible values are:
  11229. @table @var
  11230. @item none
  11231. Do not apply any tone map, only desaturate overbright pixels.
  11232. @item clip
  11233. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11234. in-range values, while distorting out-of-range values.
  11235. @item linear
  11236. Stretch the entire reference gamut to a linear multiple of the display.
  11237. @item gamma
  11238. Fit a logarithmic transfer between the tone curves.
  11239. @item reinhard
  11240. Preserve overall image brightness with a simple curve, using nonlinear
  11241. contrast, which results in flattening details and degrading color accuracy.
  11242. @item hable
  11243. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11244. of slightly darkening everything. Use it when detail preservation is more
  11245. important than color and brightness accuracy.
  11246. @item mobius
  11247. Smoothly map out-of-range values, while retaining contrast and colors for
  11248. in-range material as much as possible. Use it when color accuracy is more
  11249. important than detail preservation.
  11250. @end table
  11251. Default is none.
  11252. @item param
  11253. Tune the tone mapping algorithm.
  11254. This affects the following algorithms:
  11255. @table @var
  11256. @item none
  11257. Ignored.
  11258. @item linear
  11259. Specifies the scale factor to use while stretching.
  11260. Default to 1.0.
  11261. @item gamma
  11262. Specifies the exponent of the function.
  11263. Default to 1.8.
  11264. @item clip
  11265. Specify an extra linear coefficient to multiply into the signal before clipping.
  11266. Default to 1.0.
  11267. @item reinhard
  11268. Specify the local contrast coefficient at the display peak.
  11269. Default to 0.5, which means that in-gamut values will be about half as bright
  11270. as when clipping.
  11271. @item hable
  11272. Ignored.
  11273. @item mobius
  11274. Specify the transition point from linear to mobius transform. Every value
  11275. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11276. more accurate the result will be, at the cost of losing bright details.
  11277. Default to 0.3, which due to the steep initial slope still preserves in-range
  11278. colors fairly accurately.
  11279. @end table
  11280. @item desat
  11281. Apply desaturation for highlights that exceed this level of brightness. The
  11282. higher the parameter, the more color information will be preserved. This
  11283. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11284. (smoothly) turning into white instead. This makes images feel more natural,
  11285. at the cost of reducing information about out-of-range colors.
  11286. The default of 2.0 is somewhat conservative and will mostly just apply to
  11287. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11288. This option works only if the input frame has a supported color tag.
  11289. @item peak
  11290. Override signal/nominal/reference peak with this value. Useful when the
  11291. embedded peak information in display metadata is not reliable or when tone
  11292. mapping from a lower range to a higher range.
  11293. @end table
  11294. @section transpose
  11295. Transpose rows with columns in the input video and optionally flip it.
  11296. It accepts the following parameters:
  11297. @table @option
  11298. @item dir
  11299. Specify the transposition direction.
  11300. Can assume the following values:
  11301. @table @samp
  11302. @item 0, 4, cclock_flip
  11303. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11304. @example
  11305. L.R L.l
  11306. . . -> . .
  11307. l.r R.r
  11308. @end example
  11309. @item 1, 5, clock
  11310. Rotate by 90 degrees clockwise, that is:
  11311. @example
  11312. L.R l.L
  11313. . . -> . .
  11314. l.r r.R
  11315. @end example
  11316. @item 2, 6, cclock
  11317. Rotate by 90 degrees counterclockwise, that is:
  11318. @example
  11319. L.R R.r
  11320. . . -> . .
  11321. l.r L.l
  11322. @end example
  11323. @item 3, 7, clock_flip
  11324. Rotate by 90 degrees clockwise and vertically flip, that is:
  11325. @example
  11326. L.R r.R
  11327. . . -> . .
  11328. l.r l.L
  11329. @end example
  11330. @end table
  11331. For values between 4-7, the transposition is only done if the input
  11332. video geometry is portrait and not landscape. These values are
  11333. deprecated, the @code{passthrough} option should be used instead.
  11334. Numerical values are deprecated, and should be dropped in favor of
  11335. symbolic constants.
  11336. @item passthrough
  11337. Do not apply the transposition if the input geometry matches the one
  11338. specified by the specified value. It accepts the following values:
  11339. @table @samp
  11340. @item none
  11341. Always apply transposition.
  11342. @item portrait
  11343. Preserve portrait geometry (when @var{height} >= @var{width}).
  11344. @item landscape
  11345. Preserve landscape geometry (when @var{width} >= @var{height}).
  11346. @end table
  11347. Default value is @code{none}.
  11348. @end table
  11349. For example to rotate by 90 degrees clockwise and preserve portrait
  11350. layout:
  11351. @example
  11352. transpose=dir=1:passthrough=portrait
  11353. @end example
  11354. The command above can also be specified as:
  11355. @example
  11356. transpose=1:portrait
  11357. @end example
  11358. @section trim
  11359. Trim the input so that the output contains one continuous subpart of the input.
  11360. It accepts the following parameters:
  11361. @table @option
  11362. @item start
  11363. Specify the time of the start of the kept section, i.e. the frame with the
  11364. timestamp @var{start} will be the first frame in the output.
  11365. @item end
  11366. Specify the time of the first frame that will be dropped, i.e. the frame
  11367. immediately preceding the one with the timestamp @var{end} will be the last
  11368. frame in the output.
  11369. @item start_pts
  11370. This is the same as @var{start}, except this option sets the start timestamp
  11371. in timebase units instead of seconds.
  11372. @item end_pts
  11373. This is the same as @var{end}, except this option sets the end timestamp
  11374. in timebase units instead of seconds.
  11375. @item duration
  11376. The maximum duration of the output in seconds.
  11377. @item start_frame
  11378. The number of the first frame that should be passed to the output.
  11379. @item end_frame
  11380. The number of the first frame that should be dropped.
  11381. @end table
  11382. @option{start}, @option{end}, and @option{duration} are expressed as time
  11383. duration specifications; see
  11384. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11385. for the accepted syntax.
  11386. Note that the first two sets of the start/end options and the @option{duration}
  11387. option look at the frame timestamp, while the _frame variants simply count the
  11388. frames that pass through the filter. Also note that this filter does not modify
  11389. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11390. setpts filter after the trim filter.
  11391. If multiple start or end options are set, this filter tries to be greedy and
  11392. keep all the frames that match at least one of the specified constraints. To keep
  11393. only the part that matches all the constraints at once, chain multiple trim
  11394. filters.
  11395. The defaults are such that all the input is kept. So it is possible to set e.g.
  11396. just the end values to keep everything before the specified time.
  11397. Examples:
  11398. @itemize
  11399. @item
  11400. Drop everything except the second minute of input:
  11401. @example
  11402. ffmpeg -i INPUT -vf trim=60:120
  11403. @end example
  11404. @item
  11405. Keep only the first second:
  11406. @example
  11407. ffmpeg -i INPUT -vf trim=duration=1
  11408. @end example
  11409. @end itemize
  11410. @section unpremultiply
  11411. Apply alpha unpremultiply effect to input video stream using first plane
  11412. of second stream as alpha.
  11413. Both streams must have same dimensions and same pixel format.
  11414. The filter accepts the following option:
  11415. @table @option
  11416. @item planes
  11417. Set which planes will be processed, unprocessed planes will be copied.
  11418. By default value 0xf, all planes will be processed.
  11419. If the format has 1 or 2 components, then luma is bit 0.
  11420. If the format has 3 or 4 components:
  11421. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11422. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11423. If present, the alpha channel is always the last bit.
  11424. @item inplace
  11425. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11426. @end table
  11427. @anchor{unsharp}
  11428. @section unsharp
  11429. Sharpen or blur the input video.
  11430. It accepts the following parameters:
  11431. @table @option
  11432. @item luma_msize_x, lx
  11433. Set the luma matrix horizontal size. It must be an odd integer between
  11434. 3 and 23. The default value is 5.
  11435. @item luma_msize_y, ly
  11436. Set the luma matrix vertical size. It must be an odd integer between 3
  11437. and 23. The default value is 5.
  11438. @item luma_amount, la
  11439. Set the luma effect strength. It must be a floating point number, reasonable
  11440. values lay between -1.5 and 1.5.
  11441. Negative values will blur the input video, while positive values will
  11442. sharpen it, a value of zero will disable the effect.
  11443. Default value is 1.0.
  11444. @item chroma_msize_x, cx
  11445. Set the chroma matrix horizontal size. It must be an odd integer
  11446. between 3 and 23. The default value is 5.
  11447. @item chroma_msize_y, cy
  11448. Set the chroma matrix vertical size. It must be an odd integer
  11449. between 3 and 23. The default value is 5.
  11450. @item chroma_amount, ca
  11451. Set the chroma effect strength. It must be a floating point number, reasonable
  11452. values lay between -1.5 and 1.5.
  11453. Negative values will blur the input video, while positive values will
  11454. sharpen it, a value of zero will disable the effect.
  11455. Default value is 0.0.
  11456. @item opencl
  11457. If set to 1, specify using OpenCL capabilities, only available if
  11458. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11459. @end table
  11460. All parameters are optional and default to the equivalent of the
  11461. string '5:5:1.0:5:5:0.0'.
  11462. @subsection Examples
  11463. @itemize
  11464. @item
  11465. Apply strong luma sharpen effect:
  11466. @example
  11467. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11468. @end example
  11469. @item
  11470. Apply a strong blur of both luma and chroma parameters:
  11471. @example
  11472. unsharp=7:7:-2:7:7:-2
  11473. @end example
  11474. @end itemize
  11475. @section uspp
  11476. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11477. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11478. shifts and average the results.
  11479. The way this differs from the behavior of spp is that uspp actually encodes &
  11480. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11481. DCT similar to MJPEG.
  11482. The filter accepts the following options:
  11483. @table @option
  11484. @item quality
  11485. Set quality. This option defines the number of levels for averaging. It accepts
  11486. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11487. effect. A value of @code{8} means the higher quality. For each increment of
  11488. that value the speed drops by a factor of approximately 2. Default value is
  11489. @code{3}.
  11490. @item qp
  11491. Force a constant quantization parameter. If not set, the filter will use the QP
  11492. from the video stream (if available).
  11493. @end table
  11494. @section vaguedenoiser
  11495. Apply a wavelet based denoiser.
  11496. It transforms each frame from the video input into the wavelet domain,
  11497. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11498. the obtained coefficients. It does an inverse wavelet transform after.
  11499. Due to wavelet properties, it should give a nice smoothed result, and
  11500. reduced noise, without blurring picture features.
  11501. This filter accepts the following options:
  11502. @table @option
  11503. @item threshold
  11504. The filtering strength. The higher, the more filtered the video will be.
  11505. Hard thresholding can use a higher threshold than soft thresholding
  11506. before the video looks overfiltered. Default value is 2.
  11507. @item method
  11508. The filtering method the filter will use.
  11509. It accepts the following values:
  11510. @table @samp
  11511. @item hard
  11512. All values under the threshold will be zeroed.
  11513. @item soft
  11514. All values under the threshold will be zeroed. All values above will be
  11515. reduced by the threshold.
  11516. @item garrote
  11517. Scales or nullifies coefficients - intermediary between (more) soft and
  11518. (less) hard thresholding.
  11519. @end table
  11520. Default is garrote.
  11521. @item nsteps
  11522. Number of times, the wavelet will decompose the picture. Picture can't
  11523. be decomposed beyond a particular point (typically, 8 for a 640x480
  11524. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11525. @item percent
  11526. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11527. @item planes
  11528. A list of the planes to process. By default all planes are processed.
  11529. @end table
  11530. @section vectorscope
  11531. Display 2 color component values in the two dimensional graph (which is called
  11532. a vectorscope).
  11533. This filter accepts the following options:
  11534. @table @option
  11535. @item mode, m
  11536. Set vectorscope mode.
  11537. It accepts the following values:
  11538. @table @samp
  11539. @item gray
  11540. Gray values are displayed on graph, higher brightness means more pixels have
  11541. same component color value on location in graph. This is the default mode.
  11542. @item color
  11543. Gray values are displayed on graph. Surrounding pixels values which are not
  11544. present in video frame are drawn in gradient of 2 color components which are
  11545. set by option @code{x} and @code{y}. The 3rd color component is static.
  11546. @item color2
  11547. Actual color components values present in video frame are displayed on graph.
  11548. @item color3
  11549. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11550. on graph increases value of another color component, which is luminance by
  11551. default values of @code{x} and @code{y}.
  11552. @item color4
  11553. Actual colors present in video frame are displayed on graph. If two different
  11554. colors map to same position on graph then color with higher value of component
  11555. not present in graph is picked.
  11556. @item color5
  11557. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11558. component picked from radial gradient.
  11559. @end table
  11560. @item x
  11561. Set which color component will be represented on X-axis. Default is @code{1}.
  11562. @item y
  11563. Set which color component will be represented on Y-axis. Default is @code{2}.
  11564. @item intensity, i
  11565. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11566. of color component which represents frequency of (X, Y) location in graph.
  11567. @item envelope, e
  11568. @table @samp
  11569. @item none
  11570. No envelope, this is default.
  11571. @item instant
  11572. Instant envelope, even darkest single pixel will be clearly highlighted.
  11573. @item peak
  11574. Hold maximum and minimum values presented in graph over time. This way you
  11575. can still spot out of range values without constantly looking at vectorscope.
  11576. @item peak+instant
  11577. Peak and instant envelope combined together.
  11578. @end table
  11579. @item graticule, g
  11580. Set what kind of graticule to draw.
  11581. @table @samp
  11582. @item none
  11583. @item green
  11584. @item color
  11585. @end table
  11586. @item opacity, o
  11587. Set graticule opacity.
  11588. @item flags, f
  11589. Set graticule flags.
  11590. @table @samp
  11591. @item white
  11592. Draw graticule for white point.
  11593. @item black
  11594. Draw graticule for black point.
  11595. @item name
  11596. Draw color points short names.
  11597. @end table
  11598. @item bgopacity, b
  11599. Set background opacity.
  11600. @item lthreshold, l
  11601. Set low threshold for color component not represented on X or Y axis.
  11602. Values lower than this value will be ignored. Default is 0.
  11603. Note this value is multiplied with actual max possible value one pixel component
  11604. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11605. is 0.1 * 255 = 25.
  11606. @item hthreshold, h
  11607. Set high threshold for color component not represented on X or Y axis.
  11608. Values higher than this value will be ignored. Default is 1.
  11609. Note this value is multiplied with actual max possible value one pixel component
  11610. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11611. is 0.9 * 255 = 230.
  11612. @item colorspace, c
  11613. Set what kind of colorspace to use when drawing graticule.
  11614. @table @samp
  11615. @item auto
  11616. @item 601
  11617. @item 709
  11618. @end table
  11619. Default is auto.
  11620. @end table
  11621. @anchor{vidstabdetect}
  11622. @section vidstabdetect
  11623. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11624. @ref{vidstabtransform} for pass 2.
  11625. This filter generates a file with relative translation and rotation
  11626. transform information about subsequent frames, which is then used by
  11627. the @ref{vidstabtransform} filter.
  11628. To enable compilation of this filter you need to configure FFmpeg with
  11629. @code{--enable-libvidstab}.
  11630. This filter accepts the following options:
  11631. @table @option
  11632. @item result
  11633. Set the path to the file used to write the transforms information.
  11634. Default value is @file{transforms.trf}.
  11635. @item shakiness
  11636. Set how shaky the video is and how quick the camera is. It accepts an
  11637. integer in the range 1-10, a value of 1 means little shakiness, a
  11638. value of 10 means strong shakiness. Default value is 5.
  11639. @item accuracy
  11640. Set the accuracy of the detection process. It must be a value in the
  11641. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11642. accuracy. Default value is 15.
  11643. @item stepsize
  11644. Set stepsize of the search process. The region around minimum is
  11645. scanned with 1 pixel resolution. Default value is 6.
  11646. @item mincontrast
  11647. Set minimum contrast. Below this value a local measurement field is
  11648. discarded. Must be a floating point value in the range 0-1. Default
  11649. value is 0.3.
  11650. @item tripod
  11651. Set reference frame number for tripod mode.
  11652. If enabled, the motion of the frames is compared to a reference frame
  11653. in the filtered stream, identified by the specified number. The idea
  11654. is to compensate all movements in a more-or-less static scene and keep
  11655. the camera view absolutely still.
  11656. If set to 0, it is disabled. The frames are counted starting from 1.
  11657. @item show
  11658. Show fields and transforms in the resulting frames. It accepts an
  11659. integer in the range 0-2. Default value is 0, which disables any
  11660. visualization.
  11661. @end table
  11662. @subsection Examples
  11663. @itemize
  11664. @item
  11665. Use default values:
  11666. @example
  11667. vidstabdetect
  11668. @end example
  11669. @item
  11670. Analyze strongly shaky movie and put the results in file
  11671. @file{mytransforms.trf}:
  11672. @example
  11673. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11674. @end example
  11675. @item
  11676. Visualize the result of internal transformations in the resulting
  11677. video:
  11678. @example
  11679. vidstabdetect=show=1
  11680. @end example
  11681. @item
  11682. Analyze a video with medium shakiness using @command{ffmpeg}:
  11683. @example
  11684. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11685. @end example
  11686. @end itemize
  11687. @anchor{vidstabtransform}
  11688. @section vidstabtransform
  11689. Video stabilization/deshaking: pass 2 of 2,
  11690. see @ref{vidstabdetect} for pass 1.
  11691. Read a file with transform information for each frame and
  11692. apply/compensate them. Together with the @ref{vidstabdetect}
  11693. filter this can be used to deshake videos. See also
  11694. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11695. the @ref{unsharp} filter, see below.
  11696. To enable compilation of this filter you need to configure FFmpeg with
  11697. @code{--enable-libvidstab}.
  11698. @subsection Options
  11699. @table @option
  11700. @item input
  11701. Set path to the file used to read the transforms. Default value is
  11702. @file{transforms.trf}.
  11703. @item smoothing
  11704. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11705. camera movements. Default value is 10.
  11706. For example a number of 10 means that 21 frames are used (10 in the
  11707. past and 10 in the future) to smoothen the motion in the video. A
  11708. larger value leads to a smoother video, but limits the acceleration of
  11709. the camera (pan/tilt movements). 0 is a special case where a static
  11710. camera is simulated.
  11711. @item optalgo
  11712. Set the camera path optimization algorithm.
  11713. Accepted values are:
  11714. @table @samp
  11715. @item gauss
  11716. gaussian kernel low-pass filter on camera motion (default)
  11717. @item avg
  11718. averaging on transformations
  11719. @end table
  11720. @item maxshift
  11721. Set maximal number of pixels to translate frames. Default value is -1,
  11722. meaning no limit.
  11723. @item maxangle
  11724. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11725. value is -1, meaning no limit.
  11726. @item crop
  11727. Specify how to deal with borders that may be visible due to movement
  11728. compensation.
  11729. Available values are:
  11730. @table @samp
  11731. @item keep
  11732. keep image information from previous frame (default)
  11733. @item black
  11734. fill the border black
  11735. @end table
  11736. @item invert
  11737. Invert transforms if set to 1. Default value is 0.
  11738. @item relative
  11739. Consider transforms as relative to previous frame if set to 1,
  11740. absolute if set to 0. Default value is 0.
  11741. @item zoom
  11742. Set percentage to zoom. A positive value will result in a zoom-in
  11743. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11744. zoom).
  11745. @item optzoom
  11746. Set optimal zooming to avoid borders.
  11747. Accepted values are:
  11748. @table @samp
  11749. @item 0
  11750. disabled
  11751. @item 1
  11752. optimal static zoom value is determined (only very strong movements
  11753. will lead to visible borders) (default)
  11754. @item 2
  11755. optimal adaptive zoom value is determined (no borders will be
  11756. visible), see @option{zoomspeed}
  11757. @end table
  11758. Note that the value given at zoom is added to the one calculated here.
  11759. @item zoomspeed
  11760. Set percent to zoom maximally each frame (enabled when
  11761. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11762. 0.25.
  11763. @item interpol
  11764. Specify type of interpolation.
  11765. Available values are:
  11766. @table @samp
  11767. @item no
  11768. no interpolation
  11769. @item linear
  11770. linear only horizontal
  11771. @item bilinear
  11772. linear in both directions (default)
  11773. @item bicubic
  11774. cubic in both directions (slow)
  11775. @end table
  11776. @item tripod
  11777. Enable virtual tripod mode if set to 1, which is equivalent to
  11778. @code{relative=0:smoothing=0}. Default value is 0.
  11779. Use also @code{tripod} option of @ref{vidstabdetect}.
  11780. @item debug
  11781. Increase log verbosity if set to 1. Also the detected global motions
  11782. are written to the temporary file @file{global_motions.trf}. Default
  11783. value is 0.
  11784. @end table
  11785. @subsection Examples
  11786. @itemize
  11787. @item
  11788. Use @command{ffmpeg} for a typical stabilization with default values:
  11789. @example
  11790. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11791. @end example
  11792. Note the use of the @ref{unsharp} filter which is always recommended.
  11793. @item
  11794. Zoom in a bit more and load transform data from a given file:
  11795. @example
  11796. vidstabtransform=zoom=5:input="mytransforms.trf"
  11797. @end example
  11798. @item
  11799. Smoothen the video even more:
  11800. @example
  11801. vidstabtransform=smoothing=30
  11802. @end example
  11803. @end itemize
  11804. @section vflip
  11805. Flip the input video vertically.
  11806. For example, to vertically flip a video with @command{ffmpeg}:
  11807. @example
  11808. ffmpeg -i in.avi -vf "vflip" out.avi
  11809. @end example
  11810. @anchor{vignette}
  11811. @section vignette
  11812. Make or reverse a natural vignetting effect.
  11813. The filter accepts the following options:
  11814. @table @option
  11815. @item angle, a
  11816. Set lens angle expression as a number of radians.
  11817. The value is clipped in the @code{[0,PI/2]} range.
  11818. Default value: @code{"PI/5"}
  11819. @item x0
  11820. @item y0
  11821. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11822. by default.
  11823. @item mode
  11824. Set forward/backward mode.
  11825. Available modes are:
  11826. @table @samp
  11827. @item forward
  11828. The larger the distance from the central point, the darker the image becomes.
  11829. @item backward
  11830. The larger the distance from the central point, the brighter the image becomes.
  11831. This can be used to reverse a vignette effect, though there is no automatic
  11832. detection to extract the lens @option{angle} and other settings (yet). It can
  11833. also be used to create a burning effect.
  11834. @end table
  11835. Default value is @samp{forward}.
  11836. @item eval
  11837. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11838. It accepts the following values:
  11839. @table @samp
  11840. @item init
  11841. Evaluate expressions only once during the filter initialization.
  11842. @item frame
  11843. Evaluate expressions for each incoming frame. This is way slower than the
  11844. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11845. allows advanced dynamic expressions.
  11846. @end table
  11847. Default value is @samp{init}.
  11848. @item dither
  11849. Set dithering to reduce the circular banding effects. Default is @code{1}
  11850. (enabled).
  11851. @item aspect
  11852. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11853. Setting this value to the SAR of the input will make a rectangular vignetting
  11854. following the dimensions of the video.
  11855. Default is @code{1/1}.
  11856. @end table
  11857. @subsection Expressions
  11858. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11859. following parameters.
  11860. @table @option
  11861. @item w
  11862. @item h
  11863. input width and height
  11864. @item n
  11865. the number of input frame, starting from 0
  11866. @item pts
  11867. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11868. @var{TB} units, NAN if undefined
  11869. @item r
  11870. frame rate of the input video, NAN if the input frame rate is unknown
  11871. @item t
  11872. the PTS (Presentation TimeStamp) of the filtered video frame,
  11873. expressed in seconds, NAN if undefined
  11874. @item tb
  11875. time base of the input video
  11876. @end table
  11877. @subsection Examples
  11878. @itemize
  11879. @item
  11880. Apply simple strong vignetting effect:
  11881. @example
  11882. vignette=PI/4
  11883. @end example
  11884. @item
  11885. Make a flickering vignetting:
  11886. @example
  11887. vignette='PI/4+random(1)*PI/50':eval=frame
  11888. @end example
  11889. @end itemize
  11890. @section vmafmotion
  11891. Obtain the average vmaf motion score of a video.
  11892. It is one of the component filters of VMAF.
  11893. The obtained average motion score is printed through the logging system.
  11894. In the below example the input file @file{ref.mpg} is being processed and score
  11895. is computed.
  11896. @example
  11897. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11898. @end example
  11899. @section vstack
  11900. Stack input videos vertically.
  11901. All streams must be of same pixel format and of same width.
  11902. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11903. to create same output.
  11904. The filter accept the following option:
  11905. @table @option
  11906. @item inputs
  11907. Set number of input streams. Default is 2.
  11908. @item shortest
  11909. If set to 1, force the output to terminate when the shortest input
  11910. terminates. Default value is 0.
  11911. @end table
  11912. @section w3fdif
  11913. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11914. Deinterlacing Filter").
  11915. Based on the process described by Martin Weston for BBC R&D, and
  11916. implemented based on the de-interlace algorithm written by Jim
  11917. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11918. uses filter coefficients calculated by BBC R&D.
  11919. There are two sets of filter coefficients, so called "simple":
  11920. and "complex". Which set of filter coefficients is used can
  11921. be set by passing an optional parameter:
  11922. @table @option
  11923. @item filter
  11924. Set the interlacing filter coefficients. Accepts one of the following values:
  11925. @table @samp
  11926. @item simple
  11927. Simple filter coefficient set.
  11928. @item complex
  11929. More-complex filter coefficient set.
  11930. @end table
  11931. Default value is @samp{complex}.
  11932. @item deint
  11933. Specify which frames to deinterlace. Accept one of the following values:
  11934. @table @samp
  11935. @item all
  11936. Deinterlace all frames,
  11937. @item interlaced
  11938. Only deinterlace frames marked as interlaced.
  11939. @end table
  11940. Default value is @samp{all}.
  11941. @end table
  11942. @section waveform
  11943. Video waveform monitor.
  11944. The waveform monitor plots color component intensity. By default luminance
  11945. only. Each column of the waveform corresponds to a column of pixels in the
  11946. source video.
  11947. It accepts the following options:
  11948. @table @option
  11949. @item mode, m
  11950. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11951. In row mode, the graph on the left side represents color component value 0 and
  11952. the right side represents value = 255. In column mode, the top side represents
  11953. color component value = 0 and bottom side represents value = 255.
  11954. @item intensity, i
  11955. Set intensity. Smaller values are useful to find out how many values of the same
  11956. luminance are distributed across input rows/columns.
  11957. Default value is @code{0.04}. Allowed range is [0, 1].
  11958. @item mirror, r
  11959. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11960. In mirrored mode, higher values will be represented on the left
  11961. side for @code{row} mode and at the top for @code{column} mode. Default is
  11962. @code{1} (mirrored).
  11963. @item display, d
  11964. Set display mode.
  11965. It accepts the following values:
  11966. @table @samp
  11967. @item overlay
  11968. Presents information identical to that in the @code{parade}, except
  11969. that the graphs representing color components are superimposed directly
  11970. over one another.
  11971. This display mode makes it easier to spot relative differences or similarities
  11972. in overlapping areas of the color components that are supposed to be identical,
  11973. such as neutral whites, grays, or blacks.
  11974. @item stack
  11975. Display separate graph for the color components side by side in
  11976. @code{row} mode or one below the other in @code{column} mode.
  11977. @item parade
  11978. Display separate graph for the color components side by side in
  11979. @code{column} mode or one below the other in @code{row} mode.
  11980. Using this display mode makes it easy to spot color casts in the highlights
  11981. and shadows of an image, by comparing the contours of the top and the bottom
  11982. graphs of each waveform. Since whites, grays, and blacks are characterized
  11983. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11984. should display three waveforms of roughly equal width/height. If not, the
  11985. correction is easy to perform by making level adjustments the three waveforms.
  11986. @end table
  11987. Default is @code{stack}.
  11988. @item components, c
  11989. Set which color components to display. Default is 1, which means only luminance
  11990. or red color component if input is in RGB colorspace. If is set for example to
  11991. 7 it will display all 3 (if) available color components.
  11992. @item envelope, e
  11993. @table @samp
  11994. @item none
  11995. No envelope, this is default.
  11996. @item instant
  11997. Instant envelope, minimum and maximum values presented in graph will be easily
  11998. visible even with small @code{step} value.
  11999. @item peak
  12000. Hold minimum and maximum values presented in graph across time. This way you
  12001. can still spot out of range values without constantly looking at waveforms.
  12002. @item peak+instant
  12003. Peak and instant envelope combined together.
  12004. @end table
  12005. @item filter, f
  12006. @table @samp
  12007. @item lowpass
  12008. No filtering, this is default.
  12009. @item flat
  12010. Luma and chroma combined together.
  12011. @item aflat
  12012. Similar as above, but shows difference between blue and red chroma.
  12013. @item chroma
  12014. Displays only chroma.
  12015. @item color
  12016. Displays actual color value on waveform.
  12017. @item acolor
  12018. Similar as above, but with luma showing frequency of chroma values.
  12019. @end table
  12020. @item graticule, g
  12021. Set which graticule to display.
  12022. @table @samp
  12023. @item none
  12024. Do not display graticule.
  12025. @item green
  12026. Display green graticule showing legal broadcast ranges.
  12027. @end table
  12028. @item opacity, o
  12029. Set graticule opacity.
  12030. @item flags, fl
  12031. Set graticule flags.
  12032. @table @samp
  12033. @item numbers
  12034. Draw numbers above lines. By default enabled.
  12035. @item dots
  12036. Draw dots instead of lines.
  12037. @end table
  12038. @item scale, s
  12039. Set scale used for displaying graticule.
  12040. @table @samp
  12041. @item digital
  12042. @item millivolts
  12043. @item ire
  12044. @end table
  12045. Default is digital.
  12046. @item bgopacity, b
  12047. Set background opacity.
  12048. @end table
  12049. @section weave, doubleweave
  12050. The @code{weave} takes a field-based video input and join
  12051. each two sequential fields into single frame, producing a new double
  12052. height clip with half the frame rate and half the frame count.
  12053. The @code{doubleweave} works same as @code{weave} but without
  12054. halving frame rate and frame count.
  12055. It accepts the following option:
  12056. @table @option
  12057. @item first_field
  12058. Set first field. Available values are:
  12059. @table @samp
  12060. @item top, t
  12061. Set the frame as top-field-first.
  12062. @item bottom, b
  12063. Set the frame as bottom-field-first.
  12064. @end table
  12065. @end table
  12066. @subsection Examples
  12067. @itemize
  12068. @item
  12069. Interlace video using @ref{select} and @ref{separatefields} filter:
  12070. @example
  12071. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12072. @end example
  12073. @end itemize
  12074. @section xbr
  12075. Apply the xBR high-quality magnification filter which is designed for pixel
  12076. art. It follows a set of edge-detection rules, see
  12077. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12078. It accepts the following option:
  12079. @table @option
  12080. @item n
  12081. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12082. @code{3xBR} and @code{4} for @code{4xBR}.
  12083. Default is @code{3}.
  12084. @end table
  12085. @anchor{yadif}
  12086. @section yadif
  12087. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12088. filter").
  12089. It accepts the following parameters:
  12090. @table @option
  12091. @item mode
  12092. The interlacing mode to adopt. It accepts one of the following values:
  12093. @table @option
  12094. @item 0, send_frame
  12095. Output one frame for each frame.
  12096. @item 1, send_field
  12097. Output one frame for each field.
  12098. @item 2, send_frame_nospatial
  12099. Like @code{send_frame}, but it skips the spatial interlacing check.
  12100. @item 3, send_field_nospatial
  12101. Like @code{send_field}, but it skips the spatial interlacing check.
  12102. @end table
  12103. The default value is @code{send_frame}.
  12104. @item parity
  12105. The picture field parity assumed for the input interlaced video. It accepts one
  12106. of the following values:
  12107. @table @option
  12108. @item 0, tff
  12109. Assume the top field is first.
  12110. @item 1, bff
  12111. Assume the bottom field is first.
  12112. @item -1, auto
  12113. Enable automatic detection of field parity.
  12114. @end table
  12115. The default value is @code{auto}.
  12116. If the interlacing is unknown or the decoder does not export this information,
  12117. top field first will be assumed.
  12118. @item deint
  12119. Specify which frames to deinterlace. Accept one of the following
  12120. values:
  12121. @table @option
  12122. @item 0, all
  12123. Deinterlace all frames.
  12124. @item 1, interlaced
  12125. Only deinterlace frames marked as interlaced.
  12126. @end table
  12127. The default value is @code{all}.
  12128. @end table
  12129. @section zoompan
  12130. Apply Zoom & Pan effect.
  12131. This filter accepts the following options:
  12132. @table @option
  12133. @item zoom, z
  12134. Set the zoom expression. Default is 1.
  12135. @item x
  12136. @item y
  12137. Set the x and y expression. Default is 0.
  12138. @item d
  12139. Set the duration expression in number of frames.
  12140. This sets for how many number of frames effect will last for
  12141. single input image.
  12142. @item s
  12143. Set the output image size, default is 'hd720'.
  12144. @item fps
  12145. Set the output frame rate, default is '25'.
  12146. @end table
  12147. Each expression can contain the following constants:
  12148. @table @option
  12149. @item in_w, iw
  12150. Input width.
  12151. @item in_h, ih
  12152. Input height.
  12153. @item out_w, ow
  12154. Output width.
  12155. @item out_h, oh
  12156. Output height.
  12157. @item in
  12158. Input frame count.
  12159. @item on
  12160. Output frame count.
  12161. @item x
  12162. @item y
  12163. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12164. for current input frame.
  12165. @item px
  12166. @item py
  12167. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12168. not yet such frame (first input frame).
  12169. @item zoom
  12170. Last calculated zoom from 'z' expression for current input frame.
  12171. @item pzoom
  12172. Last calculated zoom of last output frame of previous input frame.
  12173. @item duration
  12174. Number of output frames for current input frame. Calculated from 'd' expression
  12175. for each input frame.
  12176. @item pduration
  12177. number of output frames created for previous input frame
  12178. @item a
  12179. Rational number: input width / input height
  12180. @item sar
  12181. sample aspect ratio
  12182. @item dar
  12183. display aspect ratio
  12184. @end table
  12185. @subsection Examples
  12186. @itemize
  12187. @item
  12188. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12189. @example
  12190. 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
  12191. @end example
  12192. @item
  12193. Zoom-in up to 1.5 and pan always at center of picture:
  12194. @example
  12195. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12196. @end example
  12197. @item
  12198. Same as above but without pausing:
  12199. @example
  12200. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12201. @end example
  12202. @end itemize
  12203. @anchor{zscale}
  12204. @section zscale
  12205. Scale (resize) the input video, using the z.lib library:
  12206. https://github.com/sekrit-twc/zimg.
  12207. The zscale filter forces the output display aspect ratio to be the same
  12208. as the input, by changing the output sample aspect ratio.
  12209. If the input image format is different from the format requested by
  12210. the next filter, the zscale filter will convert the input to the
  12211. requested format.
  12212. @subsection Options
  12213. The filter accepts the following options.
  12214. @table @option
  12215. @item width, w
  12216. @item height, h
  12217. Set the output video dimension expression. Default value is the input
  12218. dimension.
  12219. If the @var{width} or @var{w} value is 0, the input width is used for
  12220. the output. If the @var{height} or @var{h} value is 0, the input height
  12221. is used for the output.
  12222. If one and only one of the values is -n with n >= 1, the zscale filter
  12223. will use a value that maintains the aspect ratio of the input image,
  12224. calculated from the other specified dimension. After that it will,
  12225. however, make sure that the calculated dimension is divisible by n and
  12226. adjust the value if necessary.
  12227. If both values are -n with n >= 1, the behavior will be identical to
  12228. both values being set to 0 as previously detailed.
  12229. See below for the list of accepted constants for use in the dimension
  12230. expression.
  12231. @item size, s
  12232. Set the video size. For the syntax of this option, check the
  12233. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12234. @item dither, d
  12235. Set the dither type.
  12236. Possible values are:
  12237. @table @var
  12238. @item none
  12239. @item ordered
  12240. @item random
  12241. @item error_diffusion
  12242. @end table
  12243. Default is none.
  12244. @item filter, f
  12245. Set the resize filter type.
  12246. Possible values are:
  12247. @table @var
  12248. @item point
  12249. @item bilinear
  12250. @item bicubic
  12251. @item spline16
  12252. @item spline36
  12253. @item lanczos
  12254. @end table
  12255. Default is bilinear.
  12256. @item range, r
  12257. Set the color range.
  12258. Possible values are:
  12259. @table @var
  12260. @item input
  12261. @item limited
  12262. @item full
  12263. @end table
  12264. Default is same as input.
  12265. @item primaries, p
  12266. Set the color primaries.
  12267. Possible values are:
  12268. @table @var
  12269. @item input
  12270. @item 709
  12271. @item unspecified
  12272. @item 170m
  12273. @item 240m
  12274. @item 2020
  12275. @end table
  12276. Default is same as input.
  12277. @item transfer, t
  12278. Set the transfer characteristics.
  12279. Possible values are:
  12280. @table @var
  12281. @item input
  12282. @item 709
  12283. @item unspecified
  12284. @item 601
  12285. @item linear
  12286. @item 2020_10
  12287. @item 2020_12
  12288. @item smpte2084
  12289. @item iec61966-2-1
  12290. @item arib-std-b67
  12291. @end table
  12292. Default is same as input.
  12293. @item matrix, m
  12294. Set the colorspace matrix.
  12295. Possible value are:
  12296. @table @var
  12297. @item input
  12298. @item 709
  12299. @item unspecified
  12300. @item 470bg
  12301. @item 170m
  12302. @item 2020_ncl
  12303. @item 2020_cl
  12304. @end table
  12305. Default is same as input.
  12306. @item rangein, rin
  12307. Set the input color range.
  12308. Possible values are:
  12309. @table @var
  12310. @item input
  12311. @item limited
  12312. @item full
  12313. @end table
  12314. Default is same as input.
  12315. @item primariesin, pin
  12316. Set the input color primaries.
  12317. Possible values are:
  12318. @table @var
  12319. @item input
  12320. @item 709
  12321. @item unspecified
  12322. @item 170m
  12323. @item 240m
  12324. @item 2020
  12325. @end table
  12326. Default is same as input.
  12327. @item transferin, tin
  12328. Set the input transfer characteristics.
  12329. Possible values are:
  12330. @table @var
  12331. @item input
  12332. @item 709
  12333. @item unspecified
  12334. @item 601
  12335. @item linear
  12336. @item 2020_10
  12337. @item 2020_12
  12338. @end table
  12339. Default is same as input.
  12340. @item matrixin, min
  12341. Set the input colorspace matrix.
  12342. Possible value are:
  12343. @table @var
  12344. @item input
  12345. @item 709
  12346. @item unspecified
  12347. @item 470bg
  12348. @item 170m
  12349. @item 2020_ncl
  12350. @item 2020_cl
  12351. @end table
  12352. @item chromal, c
  12353. Set the output chroma location.
  12354. Possible values are:
  12355. @table @var
  12356. @item input
  12357. @item left
  12358. @item center
  12359. @item topleft
  12360. @item top
  12361. @item bottomleft
  12362. @item bottom
  12363. @end table
  12364. @item chromalin, cin
  12365. Set the input chroma location.
  12366. Possible values are:
  12367. @table @var
  12368. @item input
  12369. @item left
  12370. @item center
  12371. @item topleft
  12372. @item top
  12373. @item bottomleft
  12374. @item bottom
  12375. @end table
  12376. @item npl
  12377. Set the nominal peak luminance.
  12378. @end table
  12379. The values of the @option{w} and @option{h} options are expressions
  12380. containing the following constants:
  12381. @table @var
  12382. @item in_w
  12383. @item in_h
  12384. The input width and height
  12385. @item iw
  12386. @item ih
  12387. These are the same as @var{in_w} and @var{in_h}.
  12388. @item out_w
  12389. @item out_h
  12390. The output (scaled) width and height
  12391. @item ow
  12392. @item oh
  12393. These are the same as @var{out_w} and @var{out_h}
  12394. @item a
  12395. The same as @var{iw} / @var{ih}
  12396. @item sar
  12397. input sample aspect ratio
  12398. @item dar
  12399. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12400. @item hsub
  12401. @item vsub
  12402. horizontal and vertical input chroma subsample values. For example for the
  12403. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12404. @item ohsub
  12405. @item ovsub
  12406. horizontal and vertical output chroma subsample values. For example for the
  12407. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12408. @end table
  12409. @table @option
  12410. @end table
  12411. @c man end VIDEO FILTERS
  12412. @chapter Video Sources
  12413. @c man begin VIDEO SOURCES
  12414. Below is a description of the currently available video sources.
  12415. @section buffer
  12416. Buffer video frames, and make them available to the filter chain.
  12417. This source is mainly intended for a programmatic use, in particular
  12418. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12419. It accepts the following parameters:
  12420. @table @option
  12421. @item video_size
  12422. Specify the size (width and height) of the buffered video frames. For the
  12423. syntax of this option, check the
  12424. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12425. @item width
  12426. The input video width.
  12427. @item height
  12428. The input video height.
  12429. @item pix_fmt
  12430. A string representing the pixel format of the buffered video frames.
  12431. It may be a number corresponding to a pixel format, or a pixel format
  12432. name.
  12433. @item time_base
  12434. Specify the timebase assumed by the timestamps of the buffered frames.
  12435. @item frame_rate
  12436. Specify the frame rate expected for the video stream.
  12437. @item pixel_aspect, sar
  12438. The sample (pixel) aspect ratio of the input video.
  12439. @item sws_param
  12440. Specify the optional parameters to be used for the scale filter which
  12441. is automatically inserted when an input change is detected in the
  12442. input size or format.
  12443. @item hw_frames_ctx
  12444. When using a hardware pixel format, this should be a reference to an
  12445. AVHWFramesContext describing input frames.
  12446. @end table
  12447. For example:
  12448. @example
  12449. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12450. @end example
  12451. will instruct the source to accept video frames with size 320x240 and
  12452. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12453. square pixels (1:1 sample aspect ratio).
  12454. Since the pixel format with name "yuv410p" corresponds to the number 6
  12455. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12456. this example corresponds to:
  12457. @example
  12458. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12459. @end example
  12460. Alternatively, the options can be specified as a flat string, but this
  12461. syntax is deprecated:
  12462. @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}]
  12463. @section cellauto
  12464. Create a pattern generated by an elementary cellular automaton.
  12465. The initial state of the cellular automaton can be defined through the
  12466. @option{filename} and @option{pattern} options. If such options are
  12467. not specified an initial state is created randomly.
  12468. At each new frame a new row in the video is filled with the result of
  12469. the cellular automaton next generation. The behavior when the whole
  12470. frame is filled is defined by the @option{scroll} option.
  12471. This source accepts the following options:
  12472. @table @option
  12473. @item filename, f
  12474. Read the initial cellular automaton state, i.e. the starting row, from
  12475. the specified file.
  12476. In the file, each non-whitespace character is considered an alive
  12477. cell, a newline will terminate the row, and further characters in the
  12478. file will be ignored.
  12479. @item pattern, p
  12480. Read the initial cellular automaton state, i.e. the starting row, from
  12481. the specified string.
  12482. Each non-whitespace character in the string is considered an alive
  12483. cell, a newline will terminate the row, and further characters in the
  12484. string will be ignored.
  12485. @item rate, r
  12486. Set the video rate, that is the number of frames generated per second.
  12487. Default is 25.
  12488. @item random_fill_ratio, ratio
  12489. Set the random fill ratio for the initial cellular automaton row. It
  12490. is a floating point number value ranging from 0 to 1, defaults to
  12491. 1/PHI.
  12492. This option is ignored when a file or a pattern is specified.
  12493. @item random_seed, seed
  12494. Set the seed for filling randomly the initial row, must be an integer
  12495. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12496. set to -1, the filter will try to use a good random seed on a best
  12497. effort basis.
  12498. @item rule
  12499. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12500. Default value is 110.
  12501. @item size, s
  12502. Set the size of the output video. For the syntax of this option, check the
  12503. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12504. If @option{filename} or @option{pattern} is specified, the size is set
  12505. by default to the width of the specified initial state row, and the
  12506. height is set to @var{width} * PHI.
  12507. If @option{size} is set, it must contain the width of the specified
  12508. pattern string, and the specified pattern will be centered in the
  12509. larger row.
  12510. If a filename or a pattern string is not specified, the size value
  12511. defaults to "320x518" (used for a randomly generated initial state).
  12512. @item scroll
  12513. If set to 1, scroll the output upward when all the rows in the output
  12514. have been already filled. If set to 0, the new generated row will be
  12515. written over the top row just after the bottom row is filled.
  12516. Defaults to 1.
  12517. @item start_full, full
  12518. If set to 1, completely fill the output with generated rows before
  12519. outputting the first frame.
  12520. This is the default behavior, for disabling set the value to 0.
  12521. @item stitch
  12522. If set to 1, stitch the left and right row edges together.
  12523. This is the default behavior, for disabling set the value to 0.
  12524. @end table
  12525. @subsection Examples
  12526. @itemize
  12527. @item
  12528. Read the initial state from @file{pattern}, and specify an output of
  12529. size 200x400.
  12530. @example
  12531. cellauto=f=pattern:s=200x400
  12532. @end example
  12533. @item
  12534. Generate a random initial row with a width of 200 cells, with a fill
  12535. ratio of 2/3:
  12536. @example
  12537. cellauto=ratio=2/3:s=200x200
  12538. @end example
  12539. @item
  12540. Create a pattern generated by rule 18 starting by a single alive cell
  12541. centered on an initial row with width 100:
  12542. @example
  12543. cellauto=p=@@:s=100x400:full=0:rule=18
  12544. @end example
  12545. @item
  12546. Specify a more elaborated initial pattern:
  12547. @example
  12548. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12549. @end example
  12550. @end itemize
  12551. @anchor{coreimagesrc}
  12552. @section coreimagesrc
  12553. Video source generated on GPU using Apple's CoreImage API on OSX.
  12554. This video source is a specialized version of the @ref{coreimage} video filter.
  12555. Use a core image generator at the beginning of the applied filterchain to
  12556. generate the content.
  12557. The coreimagesrc video source accepts the following options:
  12558. @table @option
  12559. @item list_generators
  12560. List all available generators along with all their respective options as well as
  12561. possible minimum and maximum values along with the default values.
  12562. @example
  12563. list_generators=true
  12564. @end example
  12565. @item size, s
  12566. Specify the size of the sourced video. For the syntax of this option, check the
  12567. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12568. The default value is @code{320x240}.
  12569. @item rate, r
  12570. Specify the frame rate of the sourced video, as the number of frames
  12571. generated per second. It has to be a string in the format
  12572. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12573. number or a valid video frame rate abbreviation. The default value is
  12574. "25".
  12575. @item sar
  12576. Set the sample aspect ratio of the sourced video.
  12577. @item duration, d
  12578. Set the duration of the sourced video. See
  12579. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12580. for the accepted syntax.
  12581. If not specified, or the expressed duration is negative, the video is
  12582. supposed to be generated forever.
  12583. @end table
  12584. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12585. A complete filterchain can be used for further processing of the
  12586. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12587. and examples for details.
  12588. @subsection Examples
  12589. @itemize
  12590. @item
  12591. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12592. given as complete and escaped command-line for Apple's standard bash shell:
  12593. @example
  12594. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12595. @end example
  12596. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12597. need for a nullsrc video source.
  12598. @end itemize
  12599. @section mandelbrot
  12600. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12601. point specified with @var{start_x} and @var{start_y}.
  12602. This source accepts the following options:
  12603. @table @option
  12604. @item end_pts
  12605. Set the terminal pts value. Default value is 400.
  12606. @item end_scale
  12607. Set the terminal scale value.
  12608. Must be a floating point value. Default value is 0.3.
  12609. @item inner
  12610. Set the inner coloring mode, that is the algorithm used to draw the
  12611. Mandelbrot fractal internal region.
  12612. It shall assume one of the following values:
  12613. @table @option
  12614. @item black
  12615. Set black mode.
  12616. @item convergence
  12617. Show time until convergence.
  12618. @item mincol
  12619. Set color based on point closest to the origin of the iterations.
  12620. @item period
  12621. Set period mode.
  12622. @end table
  12623. Default value is @var{mincol}.
  12624. @item bailout
  12625. Set the bailout value. Default value is 10.0.
  12626. @item maxiter
  12627. Set the maximum of iterations performed by the rendering
  12628. algorithm. Default value is 7189.
  12629. @item outer
  12630. Set outer coloring mode.
  12631. It shall assume one of following values:
  12632. @table @option
  12633. @item iteration_count
  12634. Set iteration cound mode.
  12635. @item normalized_iteration_count
  12636. set normalized iteration count mode.
  12637. @end table
  12638. Default value is @var{normalized_iteration_count}.
  12639. @item rate, r
  12640. Set frame rate, expressed as number of frames per second. Default
  12641. value is "25".
  12642. @item size, s
  12643. Set frame size. For the syntax of this option, check the "Video
  12644. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12645. @item start_scale
  12646. Set the initial scale value. Default value is 3.0.
  12647. @item start_x
  12648. Set the initial x position. Must be a floating point value between
  12649. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12650. @item start_y
  12651. Set the initial y position. Must be a floating point value between
  12652. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12653. @end table
  12654. @section mptestsrc
  12655. Generate various test patterns, as generated by the MPlayer test filter.
  12656. The size of the generated video is fixed, and is 256x256.
  12657. This source is useful in particular for testing encoding features.
  12658. This source accepts the following options:
  12659. @table @option
  12660. @item rate, r
  12661. Specify the frame rate of the sourced video, as the number of frames
  12662. generated per second. It has to be a string in the format
  12663. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12664. number or a valid video frame rate abbreviation. The default value is
  12665. "25".
  12666. @item duration, d
  12667. Set the duration of the sourced video. See
  12668. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12669. for the accepted syntax.
  12670. If not specified, or the expressed duration is negative, the video is
  12671. supposed to be generated forever.
  12672. @item test, t
  12673. Set the number or the name of the test to perform. Supported tests are:
  12674. @table @option
  12675. @item dc_luma
  12676. @item dc_chroma
  12677. @item freq_luma
  12678. @item freq_chroma
  12679. @item amp_luma
  12680. @item amp_chroma
  12681. @item cbp
  12682. @item mv
  12683. @item ring1
  12684. @item ring2
  12685. @item all
  12686. @end table
  12687. Default value is "all", which will cycle through the list of all tests.
  12688. @end table
  12689. Some examples:
  12690. @example
  12691. mptestsrc=t=dc_luma
  12692. @end example
  12693. will generate a "dc_luma" test pattern.
  12694. @section frei0r_src
  12695. Provide a frei0r source.
  12696. To enable compilation of this filter you need to install the frei0r
  12697. header and configure FFmpeg with @code{--enable-frei0r}.
  12698. This source accepts the following parameters:
  12699. @table @option
  12700. @item size
  12701. The size of the video to generate. For the syntax of this option, check the
  12702. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12703. @item framerate
  12704. The framerate of the generated video. It may be a string of the form
  12705. @var{num}/@var{den} or a frame rate abbreviation.
  12706. @item filter_name
  12707. The name to the frei0r source to load. For more information regarding frei0r and
  12708. how to set the parameters, read the @ref{frei0r} section in the video filters
  12709. documentation.
  12710. @item filter_params
  12711. A '|'-separated list of parameters to pass to the frei0r source.
  12712. @end table
  12713. For example, to generate a frei0r partik0l source with size 200x200
  12714. and frame rate 10 which is overlaid on the overlay filter main input:
  12715. @example
  12716. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12717. @end example
  12718. @section life
  12719. Generate a life pattern.
  12720. This source is based on a generalization of John Conway's life game.
  12721. The sourced input represents a life grid, each pixel represents a cell
  12722. which can be in one of two possible states, alive or dead. Every cell
  12723. interacts with its eight neighbours, which are the cells that are
  12724. horizontally, vertically, or diagonally adjacent.
  12725. At each interaction the grid evolves according to the adopted rule,
  12726. which specifies the number of neighbor alive cells which will make a
  12727. cell stay alive or born. The @option{rule} option allows one to specify
  12728. the rule to adopt.
  12729. This source accepts the following options:
  12730. @table @option
  12731. @item filename, f
  12732. Set the file from which to read the initial grid state. In the file,
  12733. each non-whitespace character is considered an alive cell, and newline
  12734. is used to delimit the end of each row.
  12735. If this option is not specified, the initial grid is generated
  12736. randomly.
  12737. @item rate, r
  12738. Set the video rate, that is the number of frames generated per second.
  12739. Default is 25.
  12740. @item random_fill_ratio, ratio
  12741. Set the random fill ratio for the initial random grid. It is a
  12742. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12743. It is ignored when a file is specified.
  12744. @item random_seed, seed
  12745. Set the seed for filling the initial random grid, must be an integer
  12746. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12747. set to -1, the filter will try to use a good random seed on a best
  12748. effort basis.
  12749. @item rule
  12750. Set the life rule.
  12751. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12752. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12753. @var{NS} specifies the number of alive neighbor cells which make a
  12754. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12755. which make a dead cell to become alive (i.e. to "born").
  12756. "s" and "b" can be used in place of "S" and "B", respectively.
  12757. Alternatively a rule can be specified by an 18-bits integer. The 9
  12758. high order bits are used to encode the next cell state if it is alive
  12759. for each number of neighbor alive cells, the low order bits specify
  12760. the rule for "borning" new cells. Higher order bits encode for an
  12761. higher number of neighbor cells.
  12762. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12763. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12764. Default value is "S23/B3", which is the original Conway's game of life
  12765. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12766. cells, and will born a new cell if there are three alive cells around
  12767. a dead cell.
  12768. @item size, s
  12769. Set the size of the output video. For the syntax of this option, check the
  12770. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12771. If @option{filename} is specified, the size is set by default to the
  12772. same size of the input file. If @option{size} is set, it must contain
  12773. the size specified in the input file, and the initial grid defined in
  12774. that file is centered in the larger resulting area.
  12775. If a filename is not specified, the size value defaults to "320x240"
  12776. (used for a randomly generated initial grid).
  12777. @item stitch
  12778. If set to 1, stitch the left and right grid edges together, and the
  12779. top and bottom edges also. Defaults to 1.
  12780. @item mold
  12781. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12782. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12783. value from 0 to 255.
  12784. @item life_color
  12785. Set the color of living (or new born) cells.
  12786. @item death_color
  12787. Set the color of dead cells. If @option{mold} is set, this is the first color
  12788. used to represent a dead cell.
  12789. @item mold_color
  12790. Set mold color, for definitely dead and moldy cells.
  12791. For the syntax of these 3 color options, check the "Color" section in the
  12792. ffmpeg-utils manual.
  12793. @end table
  12794. @subsection Examples
  12795. @itemize
  12796. @item
  12797. Read a grid from @file{pattern}, and center it on a grid of size
  12798. 300x300 pixels:
  12799. @example
  12800. life=f=pattern:s=300x300
  12801. @end example
  12802. @item
  12803. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12804. @example
  12805. life=ratio=2/3:s=200x200
  12806. @end example
  12807. @item
  12808. Specify a custom rule for evolving a randomly generated grid:
  12809. @example
  12810. life=rule=S14/B34
  12811. @end example
  12812. @item
  12813. Full example with slow death effect (mold) using @command{ffplay}:
  12814. @example
  12815. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12816. @end example
  12817. @end itemize
  12818. @anchor{allrgb}
  12819. @anchor{allyuv}
  12820. @anchor{color}
  12821. @anchor{haldclutsrc}
  12822. @anchor{nullsrc}
  12823. @anchor{rgbtestsrc}
  12824. @anchor{smptebars}
  12825. @anchor{smptehdbars}
  12826. @anchor{testsrc}
  12827. @anchor{testsrc2}
  12828. @anchor{yuvtestsrc}
  12829. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12830. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12831. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12832. The @code{color} source provides an uniformly colored input.
  12833. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12834. @ref{haldclut} filter.
  12835. The @code{nullsrc} source returns unprocessed video frames. It is
  12836. mainly useful to be employed in analysis / debugging tools, or as the
  12837. source for filters which ignore the input data.
  12838. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12839. detecting RGB vs BGR issues. You should see a red, green and blue
  12840. stripe from top to bottom.
  12841. The @code{smptebars} source generates a color bars pattern, based on
  12842. the SMPTE Engineering Guideline EG 1-1990.
  12843. The @code{smptehdbars} source generates a color bars pattern, based on
  12844. the SMPTE RP 219-2002.
  12845. The @code{testsrc} source generates a test video pattern, showing a
  12846. color pattern, a scrolling gradient and a timestamp. This is mainly
  12847. intended for testing purposes.
  12848. The @code{testsrc2} source is similar to testsrc, but supports more
  12849. pixel formats instead of just @code{rgb24}. This allows using it as an
  12850. input for other tests without requiring a format conversion.
  12851. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12852. see a y, cb and cr stripe from top to bottom.
  12853. The sources accept the following parameters:
  12854. @table @option
  12855. @item alpha
  12856. Specify the alpha (opacity) of the background, only available in the
  12857. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12858. 255 (fully opaque, the default).
  12859. @item color, c
  12860. Specify the color of the source, only available in the @code{color}
  12861. source. For the syntax of this option, check the "Color" section in the
  12862. ffmpeg-utils manual.
  12863. @item level
  12864. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12865. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12866. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12867. coded on a @code{1/(N*N)} scale.
  12868. @item size, s
  12869. Specify the size of the sourced video. For the syntax of this option, check the
  12870. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12871. The default value is @code{320x240}.
  12872. This option is not available with the @code{haldclutsrc} filter.
  12873. @item rate, r
  12874. Specify the frame rate of the sourced video, as the number of frames
  12875. generated per second. It has to be a string in the format
  12876. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12877. number or a valid video frame rate abbreviation. The default value is
  12878. "25".
  12879. @item sar
  12880. Set the sample aspect ratio of the sourced video.
  12881. @item duration, d
  12882. Set the duration of the sourced video. See
  12883. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12884. for the accepted syntax.
  12885. If not specified, or the expressed duration is negative, the video is
  12886. supposed to be generated forever.
  12887. @item decimals, n
  12888. Set the number of decimals to show in the timestamp, only available in the
  12889. @code{testsrc} source.
  12890. The displayed timestamp value will correspond to the original
  12891. timestamp value multiplied by the power of 10 of the specified
  12892. value. Default value is 0.
  12893. @end table
  12894. For example the following:
  12895. @example
  12896. testsrc=duration=5.3:size=qcif:rate=10
  12897. @end example
  12898. will generate a video with a duration of 5.3 seconds, with size
  12899. 176x144 and a frame rate of 10 frames per second.
  12900. The following graph description will generate a red source
  12901. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12902. frames per second.
  12903. @example
  12904. color=c=red@@0.2:s=qcif:r=10
  12905. @end example
  12906. If the input content is to be ignored, @code{nullsrc} can be used. The
  12907. following command generates noise in the luminance plane by employing
  12908. the @code{geq} filter:
  12909. @example
  12910. nullsrc=s=256x256, geq=random(1)*255:128:128
  12911. @end example
  12912. @subsection Commands
  12913. The @code{color} source supports the following commands:
  12914. @table @option
  12915. @item c, color
  12916. Set the color of the created image. Accepts the same syntax of the
  12917. corresponding @option{color} option.
  12918. @end table
  12919. @c man end VIDEO SOURCES
  12920. @chapter Video Sinks
  12921. @c man begin VIDEO SINKS
  12922. Below is a description of the currently available video sinks.
  12923. @section buffersink
  12924. Buffer video frames, and make them available to the end of the filter
  12925. graph.
  12926. This sink is mainly intended for programmatic use, in particular
  12927. through the interface defined in @file{libavfilter/buffersink.h}
  12928. or the options system.
  12929. It accepts a pointer to an AVBufferSinkContext structure, which
  12930. defines the incoming buffers' formats, to be passed as the opaque
  12931. parameter to @code{avfilter_init_filter} for initialization.
  12932. @section nullsink
  12933. Null video sink: do absolutely nothing with the input video. It is
  12934. mainly useful as a template and for use in analysis / debugging
  12935. tools.
  12936. @c man end VIDEO SINKS
  12937. @chapter Multimedia Filters
  12938. @c man begin MULTIMEDIA FILTERS
  12939. Below is a description of the currently available multimedia filters.
  12940. @section abitscope
  12941. Convert input audio to a video output, displaying the audio bit scope.
  12942. The filter accepts the following options:
  12943. @table @option
  12944. @item rate, r
  12945. Set frame rate, expressed as number of frames per second. Default
  12946. value is "25".
  12947. @item size, s
  12948. Specify the video size for the output. For the syntax of this option, check the
  12949. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12950. Default value is @code{1024x256}.
  12951. @item colors
  12952. Specify list of colors separated by space or by '|' which will be used to
  12953. draw channels. Unrecognized or missing colors will be replaced
  12954. by white color.
  12955. @end table
  12956. @section ahistogram
  12957. Convert input audio to a video output, displaying the volume histogram.
  12958. The filter accepts the following options:
  12959. @table @option
  12960. @item dmode
  12961. Specify how histogram is calculated.
  12962. It accepts the following values:
  12963. @table @samp
  12964. @item single
  12965. Use single histogram for all channels.
  12966. @item separate
  12967. Use separate histogram for each channel.
  12968. @end table
  12969. Default is @code{single}.
  12970. @item rate, r
  12971. Set frame rate, expressed as number of frames per second. Default
  12972. value is "25".
  12973. @item size, s
  12974. Specify the video size for the output. For the syntax of this option, check the
  12975. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12976. Default value is @code{hd720}.
  12977. @item scale
  12978. Set display scale.
  12979. It accepts the following values:
  12980. @table @samp
  12981. @item log
  12982. logarithmic
  12983. @item sqrt
  12984. square root
  12985. @item cbrt
  12986. cubic root
  12987. @item lin
  12988. linear
  12989. @item rlog
  12990. reverse logarithmic
  12991. @end table
  12992. Default is @code{log}.
  12993. @item ascale
  12994. Set amplitude scale.
  12995. It accepts the following values:
  12996. @table @samp
  12997. @item log
  12998. logarithmic
  12999. @item lin
  13000. linear
  13001. @end table
  13002. Default is @code{log}.
  13003. @item acount
  13004. Set how much frames to accumulate in histogram.
  13005. Defauls is 1. Setting this to -1 accumulates all frames.
  13006. @item rheight
  13007. Set histogram ratio of window height.
  13008. @item slide
  13009. Set sonogram sliding.
  13010. It accepts the following values:
  13011. @table @samp
  13012. @item replace
  13013. replace old rows with new ones.
  13014. @item scroll
  13015. scroll from top to bottom.
  13016. @end table
  13017. Default is @code{replace}.
  13018. @end table
  13019. @section aphasemeter
  13020. Convert input audio to a video output, displaying the audio phase.
  13021. The filter accepts the following options:
  13022. @table @option
  13023. @item rate, r
  13024. Set the output frame rate. Default value is @code{25}.
  13025. @item size, s
  13026. Set the video size for the output. For the syntax of this option, check the
  13027. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13028. Default value is @code{800x400}.
  13029. @item rc
  13030. @item gc
  13031. @item bc
  13032. Specify the red, green, blue contrast. Default values are @code{2},
  13033. @code{7} and @code{1}.
  13034. Allowed range is @code{[0, 255]}.
  13035. @item mpc
  13036. Set color which will be used for drawing median phase. If color is
  13037. @code{none} which is default, no median phase value will be drawn.
  13038. @item video
  13039. Enable video output. Default is enabled.
  13040. @end table
  13041. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13042. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13043. The @code{-1} means left and right channels are completely out of phase and
  13044. @code{1} means channels are in phase.
  13045. @section avectorscope
  13046. Convert input audio to a video output, representing the audio vector
  13047. scope.
  13048. The filter is used to measure the difference between channels of stereo
  13049. audio stream. A monoaural signal, consisting of identical left and right
  13050. signal, results in straight vertical line. Any stereo separation is visible
  13051. as a deviation from this line, creating a Lissajous figure.
  13052. If the straight (or deviation from it) but horizontal line appears this
  13053. indicates that the left and right channels are out of phase.
  13054. The filter accepts the following options:
  13055. @table @option
  13056. @item mode, m
  13057. Set the vectorscope mode.
  13058. Available values are:
  13059. @table @samp
  13060. @item lissajous
  13061. Lissajous rotated by 45 degrees.
  13062. @item lissajous_xy
  13063. Same as above but not rotated.
  13064. @item polar
  13065. Shape resembling half of circle.
  13066. @end table
  13067. Default value is @samp{lissajous}.
  13068. @item size, s
  13069. Set the video size for the output. For the syntax of this option, check the
  13070. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13071. Default value is @code{400x400}.
  13072. @item rate, r
  13073. Set the output frame rate. Default value is @code{25}.
  13074. @item rc
  13075. @item gc
  13076. @item bc
  13077. @item ac
  13078. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13079. @code{160}, @code{80} and @code{255}.
  13080. Allowed range is @code{[0, 255]}.
  13081. @item rf
  13082. @item gf
  13083. @item bf
  13084. @item af
  13085. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13086. @code{10}, @code{5} and @code{5}.
  13087. Allowed range is @code{[0, 255]}.
  13088. @item zoom
  13089. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13090. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13091. @item draw
  13092. Set the vectorscope drawing mode.
  13093. Available values are:
  13094. @table @samp
  13095. @item dot
  13096. Draw dot for each sample.
  13097. @item line
  13098. Draw line between previous and current sample.
  13099. @end table
  13100. Default value is @samp{dot}.
  13101. @item scale
  13102. Specify amplitude scale of audio samples.
  13103. Available values are:
  13104. @table @samp
  13105. @item lin
  13106. Linear.
  13107. @item sqrt
  13108. Square root.
  13109. @item cbrt
  13110. Cubic root.
  13111. @item log
  13112. Logarithmic.
  13113. @end table
  13114. @end table
  13115. @subsection Examples
  13116. @itemize
  13117. @item
  13118. Complete example using @command{ffplay}:
  13119. @example
  13120. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13121. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13122. @end example
  13123. @end itemize
  13124. @section bench, abench
  13125. Benchmark part of a filtergraph.
  13126. The filter accepts the following options:
  13127. @table @option
  13128. @item action
  13129. Start or stop a timer.
  13130. Available values are:
  13131. @table @samp
  13132. @item start
  13133. Get the current time, set it as frame metadata (using the key
  13134. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13135. @item stop
  13136. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13137. the input frame metadata to get the time difference. Time difference, average,
  13138. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13139. @code{min}) are then printed. The timestamps are expressed in seconds.
  13140. @end table
  13141. @end table
  13142. @subsection Examples
  13143. @itemize
  13144. @item
  13145. Benchmark @ref{selectivecolor} filter:
  13146. @example
  13147. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13148. @end example
  13149. @end itemize
  13150. @section concat
  13151. Concatenate audio and video streams, joining them together one after the
  13152. other.
  13153. The filter works on segments of synchronized video and audio streams. All
  13154. segments must have the same number of streams of each type, and that will
  13155. also be the number of streams at output.
  13156. The filter accepts the following options:
  13157. @table @option
  13158. @item n
  13159. Set the number of segments. Default is 2.
  13160. @item v
  13161. Set the number of output video streams, that is also the number of video
  13162. streams in each segment. Default is 1.
  13163. @item a
  13164. Set the number of output audio streams, that is also the number of audio
  13165. streams in each segment. Default is 0.
  13166. @item unsafe
  13167. Activate unsafe mode: do not fail if segments have a different format.
  13168. @end table
  13169. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13170. @var{a} audio outputs.
  13171. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13172. segment, in the same order as the outputs, then the inputs for the second
  13173. segment, etc.
  13174. Related streams do not always have exactly the same duration, for various
  13175. reasons including codec frame size or sloppy authoring. For that reason,
  13176. related synchronized streams (e.g. a video and its audio track) should be
  13177. concatenated at once. The concat filter will use the duration of the longest
  13178. stream in each segment (except the last one), and if necessary pad shorter
  13179. audio streams with silence.
  13180. For this filter to work correctly, all segments must start at timestamp 0.
  13181. All corresponding streams must have the same parameters in all segments; the
  13182. filtering system will automatically select a common pixel format for video
  13183. streams, and a common sample format, sample rate and channel layout for
  13184. audio streams, but other settings, such as resolution, must be converted
  13185. explicitly by the user.
  13186. Different frame rates are acceptable but will result in variable frame rate
  13187. at output; be sure to configure the output file to handle it.
  13188. @subsection Examples
  13189. @itemize
  13190. @item
  13191. Concatenate an opening, an episode and an ending, all in bilingual version
  13192. (video in stream 0, audio in streams 1 and 2):
  13193. @example
  13194. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13195. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13196. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13197. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13198. @end example
  13199. @item
  13200. Concatenate two parts, handling audio and video separately, using the
  13201. (a)movie sources, and adjusting the resolution:
  13202. @example
  13203. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13204. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13205. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13206. @end example
  13207. Note that a desync will happen at the stitch if the audio and video streams
  13208. do not have exactly the same duration in the first file.
  13209. @end itemize
  13210. @section drawgraph, adrawgraph
  13211. Draw a graph using input video or audio metadata.
  13212. It accepts the following parameters:
  13213. @table @option
  13214. @item m1
  13215. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13216. @item fg1
  13217. Set 1st foreground color expression.
  13218. @item m2
  13219. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13220. @item fg2
  13221. Set 2nd foreground color expression.
  13222. @item m3
  13223. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13224. @item fg3
  13225. Set 3rd foreground color expression.
  13226. @item m4
  13227. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13228. @item fg4
  13229. Set 4th foreground color expression.
  13230. @item min
  13231. Set minimal value of metadata value.
  13232. @item max
  13233. Set maximal value of metadata value.
  13234. @item bg
  13235. Set graph background color. Default is white.
  13236. @item mode
  13237. Set graph mode.
  13238. Available values for mode is:
  13239. @table @samp
  13240. @item bar
  13241. @item dot
  13242. @item line
  13243. @end table
  13244. Default is @code{line}.
  13245. @item slide
  13246. Set slide mode.
  13247. Available values for slide is:
  13248. @table @samp
  13249. @item frame
  13250. Draw new frame when right border is reached.
  13251. @item replace
  13252. Replace old columns with new ones.
  13253. @item scroll
  13254. Scroll from right to left.
  13255. @item rscroll
  13256. Scroll from left to right.
  13257. @item picture
  13258. Draw single picture.
  13259. @end table
  13260. Default is @code{frame}.
  13261. @item size
  13262. Set size of graph video. For the syntax of this option, check the
  13263. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13264. The default value is @code{900x256}.
  13265. The foreground color expressions can use the following variables:
  13266. @table @option
  13267. @item MIN
  13268. Minimal value of metadata value.
  13269. @item MAX
  13270. Maximal value of metadata value.
  13271. @item VAL
  13272. Current metadata key value.
  13273. @end table
  13274. The color is defined as 0xAABBGGRR.
  13275. @end table
  13276. Example using metadata from @ref{signalstats} filter:
  13277. @example
  13278. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13279. @end example
  13280. Example using metadata from @ref{ebur128} filter:
  13281. @example
  13282. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13283. @end example
  13284. @anchor{ebur128}
  13285. @section ebur128
  13286. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13287. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13288. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13289. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13290. The filter also has a video output (see the @var{video} option) with a real
  13291. time graph to observe the loudness evolution. The graphic contains the logged
  13292. message mentioned above, so it is not printed anymore when this option is set,
  13293. unless the verbose logging is set. The main graphing area contains the
  13294. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13295. the momentary loudness (400 milliseconds).
  13296. More information about the Loudness Recommendation EBU R128 on
  13297. @url{http://tech.ebu.ch/loudness}.
  13298. The filter accepts the following options:
  13299. @table @option
  13300. @item video
  13301. Activate the video output. The audio stream is passed unchanged whether this
  13302. option is set or no. The video stream will be the first output stream if
  13303. activated. Default is @code{0}.
  13304. @item size
  13305. Set the video size. This option is for video only. For the syntax of this
  13306. option, check the
  13307. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13308. Default and minimum resolution is @code{640x480}.
  13309. @item meter
  13310. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13311. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13312. other integer value between this range is allowed.
  13313. @item metadata
  13314. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13315. into 100ms output frames, each of them containing various loudness information
  13316. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13317. Default is @code{0}.
  13318. @item framelog
  13319. Force the frame logging level.
  13320. Available values are:
  13321. @table @samp
  13322. @item info
  13323. information logging level
  13324. @item verbose
  13325. verbose logging level
  13326. @end table
  13327. By default, the logging level is set to @var{info}. If the @option{video} or
  13328. the @option{metadata} options are set, it switches to @var{verbose}.
  13329. @item peak
  13330. Set peak mode(s).
  13331. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13332. values are:
  13333. @table @samp
  13334. @item none
  13335. Disable any peak mode (default).
  13336. @item sample
  13337. Enable sample-peak mode.
  13338. Simple peak mode looking for the higher sample value. It logs a message
  13339. for sample-peak (identified by @code{SPK}).
  13340. @item true
  13341. Enable true-peak mode.
  13342. If enabled, the peak lookup is done on an over-sampled version of the input
  13343. stream for better peak accuracy. It logs a message for true-peak.
  13344. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13345. This mode requires a build with @code{libswresample}.
  13346. @end table
  13347. @item dualmono
  13348. Treat mono input files as "dual mono". If a mono file is intended for playback
  13349. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13350. If set to @code{true}, this option will compensate for this effect.
  13351. Multi-channel input files are not affected by this option.
  13352. @item panlaw
  13353. Set a specific pan law to be used for the measurement of dual mono files.
  13354. This parameter is optional, and has a default value of -3.01dB.
  13355. @end table
  13356. @subsection Examples
  13357. @itemize
  13358. @item
  13359. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13360. @example
  13361. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13362. @end example
  13363. @item
  13364. Run an analysis with @command{ffmpeg}:
  13365. @example
  13366. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13367. @end example
  13368. @end itemize
  13369. @section interleave, ainterleave
  13370. Temporally interleave frames from several inputs.
  13371. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13372. These filters read frames from several inputs and send the oldest
  13373. queued frame to the output.
  13374. Input streams must have well defined, monotonically increasing frame
  13375. timestamp values.
  13376. In order to submit one frame to output, these filters need to enqueue
  13377. at least one frame for each input, so they cannot work in case one
  13378. input is not yet terminated and will not receive incoming frames.
  13379. For example consider the case when one input is a @code{select} filter
  13380. which always drops input frames. The @code{interleave} filter will keep
  13381. reading from that input, but it will never be able to send new frames
  13382. to output until the input sends an end-of-stream signal.
  13383. Also, depending on inputs synchronization, the filters will drop
  13384. frames in case one input receives more frames than the other ones, and
  13385. the queue is already filled.
  13386. These filters accept the following options:
  13387. @table @option
  13388. @item nb_inputs, n
  13389. Set the number of different inputs, it is 2 by default.
  13390. @end table
  13391. @subsection Examples
  13392. @itemize
  13393. @item
  13394. Interleave frames belonging to different streams using @command{ffmpeg}:
  13395. @example
  13396. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13397. @end example
  13398. @item
  13399. Add flickering blur effect:
  13400. @example
  13401. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13402. @end example
  13403. @end itemize
  13404. @section metadata, ametadata
  13405. Manipulate frame metadata.
  13406. This filter accepts the following options:
  13407. @table @option
  13408. @item mode
  13409. Set mode of operation of the filter.
  13410. Can be one of the following:
  13411. @table @samp
  13412. @item select
  13413. If both @code{value} and @code{key} is set, select frames
  13414. which have such metadata. If only @code{key} is set, select
  13415. every frame that has such key in metadata.
  13416. @item add
  13417. Add new metadata @code{key} and @code{value}. If key is already available
  13418. do nothing.
  13419. @item modify
  13420. Modify value of already present key.
  13421. @item delete
  13422. If @code{value} is set, delete only keys that have such value.
  13423. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13424. the frame.
  13425. @item print
  13426. Print key and its value if metadata was found. If @code{key} is not set print all
  13427. metadata values available in frame.
  13428. @end table
  13429. @item key
  13430. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13431. @item value
  13432. Set metadata value which will be used. This option is mandatory for
  13433. @code{modify} and @code{add} mode.
  13434. @item function
  13435. Which function to use when comparing metadata value and @code{value}.
  13436. Can be one of following:
  13437. @table @samp
  13438. @item same_str
  13439. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13440. @item starts_with
  13441. Values are interpreted as strings, returns true if metadata value starts with
  13442. the @code{value} option string.
  13443. @item less
  13444. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13445. @item equal
  13446. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13447. @item greater
  13448. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13449. @item expr
  13450. Values are interpreted as floats, returns true if expression from option @code{expr}
  13451. evaluates to true.
  13452. @end table
  13453. @item expr
  13454. Set expression which is used when @code{function} is set to @code{expr}.
  13455. The expression is evaluated through the eval API and can contain the following
  13456. constants:
  13457. @table @option
  13458. @item VALUE1
  13459. Float representation of @code{value} from metadata key.
  13460. @item VALUE2
  13461. Float representation of @code{value} as supplied by user in @code{value} option.
  13462. @end table
  13463. @item file
  13464. If specified in @code{print} mode, output is written to the named file. Instead of
  13465. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13466. for standard output. If @code{file} option is not set, output is written to the log
  13467. with AV_LOG_INFO loglevel.
  13468. @end table
  13469. @subsection Examples
  13470. @itemize
  13471. @item
  13472. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13473. between 0 and 1.
  13474. @example
  13475. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13476. @end example
  13477. @item
  13478. Print silencedetect output to file @file{metadata.txt}.
  13479. @example
  13480. silencedetect,ametadata=mode=print:file=metadata.txt
  13481. @end example
  13482. @item
  13483. Direct all metadata to a pipe with file descriptor 4.
  13484. @example
  13485. metadata=mode=print:file='pipe\:4'
  13486. @end example
  13487. @end itemize
  13488. @section perms, aperms
  13489. Set read/write permissions for the output frames.
  13490. These filters are mainly aimed at developers to test direct path in the
  13491. following filter in the filtergraph.
  13492. The filters accept the following options:
  13493. @table @option
  13494. @item mode
  13495. Select the permissions mode.
  13496. It accepts the following values:
  13497. @table @samp
  13498. @item none
  13499. Do nothing. This is the default.
  13500. @item ro
  13501. Set all the output frames read-only.
  13502. @item rw
  13503. Set all the output frames directly writable.
  13504. @item toggle
  13505. Make the frame read-only if writable, and writable if read-only.
  13506. @item random
  13507. Set each output frame read-only or writable randomly.
  13508. @end table
  13509. @item seed
  13510. Set the seed for the @var{random} mode, must be an integer included between
  13511. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13512. @code{-1}, the filter will try to use a good random seed on a best effort
  13513. basis.
  13514. @end table
  13515. Note: in case of auto-inserted filter between the permission filter and the
  13516. following one, the permission might not be received as expected in that
  13517. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13518. perms/aperms filter can avoid this problem.
  13519. @section realtime, arealtime
  13520. Slow down filtering to match real time approximately.
  13521. These filters will pause the filtering for a variable amount of time to
  13522. match the output rate with the input timestamps.
  13523. They are similar to the @option{re} option to @code{ffmpeg}.
  13524. They accept the following options:
  13525. @table @option
  13526. @item limit
  13527. Time limit for the pauses. Any pause longer than that will be considered
  13528. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13529. @end table
  13530. @anchor{select}
  13531. @section select, aselect
  13532. Select frames to pass in output.
  13533. This filter accepts the following options:
  13534. @table @option
  13535. @item expr, e
  13536. Set expression, which is evaluated for each input frame.
  13537. If the expression is evaluated to zero, the frame is discarded.
  13538. If the evaluation result is negative or NaN, the frame is sent to the
  13539. first output; otherwise it is sent to the output with index
  13540. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13541. For example a value of @code{1.2} corresponds to the output with index
  13542. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13543. @item outputs, n
  13544. Set the number of outputs. The output to which to send the selected
  13545. frame is based on the result of the evaluation. Default value is 1.
  13546. @end table
  13547. The expression can contain the following constants:
  13548. @table @option
  13549. @item n
  13550. The (sequential) number of the filtered frame, starting from 0.
  13551. @item selected_n
  13552. The (sequential) number of the selected frame, starting from 0.
  13553. @item prev_selected_n
  13554. The sequential number of the last selected frame. It's NAN if undefined.
  13555. @item TB
  13556. The timebase of the input timestamps.
  13557. @item pts
  13558. The PTS (Presentation TimeStamp) of the filtered video frame,
  13559. expressed in @var{TB} units. It's NAN if undefined.
  13560. @item t
  13561. The PTS of the filtered video frame,
  13562. expressed in seconds. It's NAN if undefined.
  13563. @item prev_pts
  13564. The PTS of the previously filtered video frame. It's NAN if undefined.
  13565. @item prev_selected_pts
  13566. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13567. @item prev_selected_t
  13568. The PTS of the last previously selected video frame. It's NAN if undefined.
  13569. @item start_pts
  13570. The PTS of the first video frame in the video. It's NAN if undefined.
  13571. @item start_t
  13572. The time of the first video frame in the video. It's NAN if undefined.
  13573. @item pict_type @emph{(video only)}
  13574. The type of the filtered frame. It can assume one of the following
  13575. values:
  13576. @table @option
  13577. @item I
  13578. @item P
  13579. @item B
  13580. @item S
  13581. @item SI
  13582. @item SP
  13583. @item BI
  13584. @end table
  13585. @item interlace_type @emph{(video only)}
  13586. The frame interlace type. It can assume one of the following values:
  13587. @table @option
  13588. @item PROGRESSIVE
  13589. The frame is progressive (not interlaced).
  13590. @item TOPFIRST
  13591. The frame is top-field-first.
  13592. @item BOTTOMFIRST
  13593. The frame is bottom-field-first.
  13594. @end table
  13595. @item consumed_sample_n @emph{(audio only)}
  13596. the number of selected samples before the current frame
  13597. @item samples_n @emph{(audio only)}
  13598. the number of samples in the current frame
  13599. @item sample_rate @emph{(audio only)}
  13600. the input sample rate
  13601. @item key
  13602. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13603. @item pos
  13604. the position in the file of the filtered frame, -1 if the information
  13605. is not available (e.g. for synthetic video)
  13606. @item scene @emph{(video only)}
  13607. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13608. probability for the current frame to introduce a new scene, while a higher
  13609. value means the current frame is more likely to be one (see the example below)
  13610. @item concatdec_select
  13611. The concat demuxer can select only part of a concat input file by setting an
  13612. inpoint and an outpoint, but the output packets may not be entirely contained
  13613. in the selected interval. By using this variable, it is possible to skip frames
  13614. generated by the concat demuxer which are not exactly contained in the selected
  13615. interval.
  13616. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13617. and the @var{lavf.concat.duration} packet metadata values which are also
  13618. present in the decoded frames.
  13619. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13620. start_time and either the duration metadata is missing or the frame pts is less
  13621. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13622. missing.
  13623. That basically means that an input frame is selected if its pts is within the
  13624. interval set by the concat demuxer.
  13625. @end table
  13626. The default value of the select expression is "1".
  13627. @subsection Examples
  13628. @itemize
  13629. @item
  13630. Select all frames in input:
  13631. @example
  13632. select
  13633. @end example
  13634. The example above is the same as:
  13635. @example
  13636. select=1
  13637. @end example
  13638. @item
  13639. Skip all frames:
  13640. @example
  13641. select=0
  13642. @end example
  13643. @item
  13644. Select only I-frames:
  13645. @example
  13646. select='eq(pict_type\,I)'
  13647. @end example
  13648. @item
  13649. Select one frame every 100:
  13650. @example
  13651. select='not(mod(n\,100))'
  13652. @end example
  13653. @item
  13654. Select only frames contained in the 10-20 time interval:
  13655. @example
  13656. select=between(t\,10\,20)
  13657. @end example
  13658. @item
  13659. Select only I-frames contained in the 10-20 time interval:
  13660. @example
  13661. select=between(t\,10\,20)*eq(pict_type\,I)
  13662. @end example
  13663. @item
  13664. Select frames with a minimum distance of 10 seconds:
  13665. @example
  13666. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13667. @end example
  13668. @item
  13669. Use aselect to select only audio frames with samples number > 100:
  13670. @example
  13671. aselect='gt(samples_n\,100)'
  13672. @end example
  13673. @item
  13674. Create a mosaic of the first scenes:
  13675. @example
  13676. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13677. @end example
  13678. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13679. choice.
  13680. @item
  13681. Send even and odd frames to separate outputs, and compose them:
  13682. @example
  13683. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13684. @end example
  13685. @item
  13686. Select useful frames from an ffconcat file which is using inpoints and
  13687. outpoints but where the source files are not intra frame only.
  13688. @example
  13689. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13690. @end example
  13691. @end itemize
  13692. @section sendcmd, asendcmd
  13693. Send commands to filters in the filtergraph.
  13694. These filters read commands to be sent to other filters in the
  13695. filtergraph.
  13696. @code{sendcmd} must be inserted between two video filters,
  13697. @code{asendcmd} must be inserted between two audio filters, but apart
  13698. from that they act the same way.
  13699. The specification of commands can be provided in the filter arguments
  13700. with the @var{commands} option, or in a file specified by the
  13701. @var{filename} option.
  13702. These filters accept the following options:
  13703. @table @option
  13704. @item commands, c
  13705. Set the commands to be read and sent to the other filters.
  13706. @item filename, f
  13707. Set the filename of the commands to be read and sent to the other
  13708. filters.
  13709. @end table
  13710. @subsection Commands syntax
  13711. A commands description consists of a sequence of interval
  13712. specifications, comprising a list of commands to be executed when a
  13713. particular event related to that interval occurs. The occurring event
  13714. is typically the current frame time entering or leaving a given time
  13715. interval.
  13716. An interval is specified by the following syntax:
  13717. @example
  13718. @var{START}[-@var{END}] @var{COMMANDS};
  13719. @end example
  13720. The time interval is specified by the @var{START} and @var{END} times.
  13721. @var{END} is optional and defaults to the maximum time.
  13722. The current frame time is considered within the specified interval if
  13723. it is included in the interval [@var{START}, @var{END}), that is when
  13724. the time is greater or equal to @var{START} and is lesser than
  13725. @var{END}.
  13726. @var{COMMANDS} consists of a sequence of one or more command
  13727. specifications, separated by ",", relating to that interval. The
  13728. syntax of a command specification is given by:
  13729. @example
  13730. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13731. @end example
  13732. @var{FLAGS} is optional and specifies the type of events relating to
  13733. the time interval which enable sending the specified command, and must
  13734. be a non-null sequence of identifier flags separated by "+" or "|" and
  13735. enclosed between "[" and "]".
  13736. The following flags are recognized:
  13737. @table @option
  13738. @item enter
  13739. The command is sent when the current frame timestamp enters the
  13740. specified interval. In other words, the command is sent when the
  13741. previous frame timestamp was not in the given interval, and the
  13742. current is.
  13743. @item leave
  13744. The command is sent when the current frame timestamp leaves the
  13745. specified interval. In other words, the command is sent when the
  13746. previous frame timestamp was in the given interval, and the
  13747. current is not.
  13748. @end table
  13749. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13750. assumed.
  13751. @var{TARGET} specifies the target of the command, usually the name of
  13752. the filter class or a specific filter instance name.
  13753. @var{COMMAND} specifies the name of the command for the target filter.
  13754. @var{ARG} is optional and specifies the optional list of argument for
  13755. the given @var{COMMAND}.
  13756. Between one interval specification and another, whitespaces, or
  13757. sequences of characters starting with @code{#} until the end of line,
  13758. are ignored and can be used to annotate comments.
  13759. A simplified BNF description of the commands specification syntax
  13760. follows:
  13761. @example
  13762. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13763. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13764. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13765. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13766. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13767. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13768. @end example
  13769. @subsection Examples
  13770. @itemize
  13771. @item
  13772. Specify audio tempo change at second 4:
  13773. @example
  13774. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13775. @end example
  13776. @item
  13777. Target a specific filter instance:
  13778. @example
  13779. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13780. @end example
  13781. @item
  13782. Specify a list of drawtext and hue commands in a file.
  13783. @example
  13784. # show text in the interval 5-10
  13785. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13786. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13787. # desaturate the image in the interval 15-20
  13788. 15.0-20.0 [enter] hue s 0,
  13789. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13790. [leave] hue s 1,
  13791. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13792. # apply an exponential saturation fade-out effect, starting from time 25
  13793. 25 [enter] hue s exp(25-t)
  13794. @end example
  13795. A filtergraph allowing to read and process the above command list
  13796. stored in a file @file{test.cmd}, can be specified with:
  13797. @example
  13798. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13799. @end example
  13800. @end itemize
  13801. @anchor{setpts}
  13802. @section setpts, asetpts
  13803. Change the PTS (presentation timestamp) of the input frames.
  13804. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13805. This filter accepts the following options:
  13806. @table @option
  13807. @item expr
  13808. The expression which is evaluated for each frame to construct its timestamp.
  13809. @end table
  13810. The expression is evaluated through the eval API and can contain the following
  13811. constants:
  13812. @table @option
  13813. @item FRAME_RATE
  13814. frame rate, only defined for constant frame-rate video
  13815. @item PTS
  13816. The presentation timestamp in input
  13817. @item N
  13818. The count of the input frame for video or the number of consumed samples,
  13819. not including the current frame for audio, starting from 0.
  13820. @item NB_CONSUMED_SAMPLES
  13821. The number of consumed samples, not including the current frame (only
  13822. audio)
  13823. @item NB_SAMPLES, S
  13824. The number of samples in the current frame (only audio)
  13825. @item SAMPLE_RATE, SR
  13826. The audio sample rate.
  13827. @item STARTPTS
  13828. The PTS of the first frame.
  13829. @item STARTT
  13830. the time in seconds of the first frame
  13831. @item INTERLACED
  13832. State whether the current frame is interlaced.
  13833. @item T
  13834. the time in seconds of the current frame
  13835. @item POS
  13836. original position in the file of the frame, or undefined if undefined
  13837. for the current frame
  13838. @item PREV_INPTS
  13839. The previous input PTS.
  13840. @item PREV_INT
  13841. previous input time in seconds
  13842. @item PREV_OUTPTS
  13843. The previous output PTS.
  13844. @item PREV_OUTT
  13845. previous output time in seconds
  13846. @item RTCTIME
  13847. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13848. instead.
  13849. @item RTCSTART
  13850. The wallclock (RTC) time at the start of the movie in microseconds.
  13851. @item TB
  13852. The timebase of the input timestamps.
  13853. @end table
  13854. @subsection Examples
  13855. @itemize
  13856. @item
  13857. Start counting PTS from zero
  13858. @example
  13859. setpts=PTS-STARTPTS
  13860. @end example
  13861. @item
  13862. Apply fast motion effect:
  13863. @example
  13864. setpts=0.5*PTS
  13865. @end example
  13866. @item
  13867. Apply slow motion effect:
  13868. @example
  13869. setpts=2.0*PTS
  13870. @end example
  13871. @item
  13872. Set fixed rate of 25 frames per second:
  13873. @example
  13874. setpts=N/(25*TB)
  13875. @end example
  13876. @item
  13877. Set fixed rate 25 fps with some jitter:
  13878. @example
  13879. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13880. @end example
  13881. @item
  13882. Apply an offset of 10 seconds to the input PTS:
  13883. @example
  13884. setpts=PTS+10/TB
  13885. @end example
  13886. @item
  13887. Generate timestamps from a "live source" and rebase onto the current timebase:
  13888. @example
  13889. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13890. @end example
  13891. @item
  13892. Generate timestamps by counting samples:
  13893. @example
  13894. asetpts=N/SR/TB
  13895. @end example
  13896. @end itemize
  13897. @section settb, asettb
  13898. Set the timebase to use for the output frames timestamps.
  13899. It is mainly useful for testing timebase configuration.
  13900. It accepts the following parameters:
  13901. @table @option
  13902. @item expr, tb
  13903. The expression which is evaluated into the output timebase.
  13904. @end table
  13905. The value for @option{tb} is an arithmetic expression representing a
  13906. rational. The expression can contain the constants "AVTB" (the default
  13907. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13908. audio only). Default value is "intb".
  13909. @subsection Examples
  13910. @itemize
  13911. @item
  13912. Set the timebase to 1/25:
  13913. @example
  13914. settb=expr=1/25
  13915. @end example
  13916. @item
  13917. Set the timebase to 1/10:
  13918. @example
  13919. settb=expr=0.1
  13920. @end example
  13921. @item
  13922. Set the timebase to 1001/1000:
  13923. @example
  13924. settb=1+0.001
  13925. @end example
  13926. @item
  13927. Set the timebase to 2*intb:
  13928. @example
  13929. settb=2*intb
  13930. @end example
  13931. @item
  13932. Set the default timebase value:
  13933. @example
  13934. settb=AVTB
  13935. @end example
  13936. @end itemize
  13937. @section showcqt
  13938. Convert input audio to a video output representing frequency spectrum
  13939. logarithmically using Brown-Puckette constant Q transform algorithm with
  13940. direct frequency domain coefficient calculation (but the transform itself
  13941. is not really constant Q, instead the Q factor is actually variable/clamped),
  13942. with musical tone scale, from E0 to D#10.
  13943. The filter accepts the following options:
  13944. @table @option
  13945. @item size, s
  13946. Specify the video size for the output. It must be even. For the syntax of this option,
  13947. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13948. Default value is @code{1920x1080}.
  13949. @item fps, rate, r
  13950. Set the output frame rate. Default value is @code{25}.
  13951. @item bar_h
  13952. Set the bargraph height. It must be even. Default value is @code{-1} which
  13953. computes the bargraph height automatically.
  13954. @item axis_h
  13955. Set the axis height. It must be even. Default value is @code{-1} which computes
  13956. the axis height automatically.
  13957. @item sono_h
  13958. Set the sonogram height. It must be even. Default value is @code{-1} which
  13959. computes the sonogram height automatically.
  13960. @item fullhd
  13961. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13962. instead. Default value is @code{1}.
  13963. @item sono_v, volume
  13964. Specify the sonogram volume expression. It can contain variables:
  13965. @table @option
  13966. @item bar_v
  13967. the @var{bar_v} evaluated expression
  13968. @item frequency, freq, f
  13969. the frequency where it is evaluated
  13970. @item timeclamp, tc
  13971. the value of @var{timeclamp} option
  13972. @end table
  13973. and functions:
  13974. @table @option
  13975. @item a_weighting(f)
  13976. A-weighting of equal loudness
  13977. @item b_weighting(f)
  13978. B-weighting of equal loudness
  13979. @item c_weighting(f)
  13980. C-weighting of equal loudness.
  13981. @end table
  13982. Default value is @code{16}.
  13983. @item bar_v, volume2
  13984. Specify the bargraph volume expression. It can contain variables:
  13985. @table @option
  13986. @item sono_v
  13987. the @var{sono_v} evaluated expression
  13988. @item frequency, freq, f
  13989. the frequency where it is evaluated
  13990. @item timeclamp, tc
  13991. the value of @var{timeclamp} option
  13992. @end table
  13993. and functions:
  13994. @table @option
  13995. @item a_weighting(f)
  13996. A-weighting of equal loudness
  13997. @item b_weighting(f)
  13998. B-weighting of equal loudness
  13999. @item c_weighting(f)
  14000. C-weighting of equal loudness.
  14001. @end table
  14002. Default value is @code{sono_v}.
  14003. @item sono_g, gamma
  14004. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14005. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14006. Acceptable range is @code{[1, 7]}.
  14007. @item bar_g, gamma2
  14008. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14009. @code{[1, 7]}.
  14010. @item bar_t
  14011. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14012. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14013. @item timeclamp, tc
  14014. Specify the transform timeclamp. At low frequency, there is trade-off between
  14015. accuracy in time domain and frequency domain. If timeclamp is lower,
  14016. event in time domain is represented more accurately (such as fast bass drum),
  14017. otherwise event in frequency domain is represented more accurately
  14018. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14019. @item attack
  14020. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14021. limits future samples by applying asymmetric windowing in time domain, useful
  14022. when low latency is required. Accepted range is @code{[0, 1]}.
  14023. @item basefreq
  14024. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14025. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14026. @item endfreq
  14027. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14028. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14029. @item coeffclamp
  14030. This option is deprecated and ignored.
  14031. @item tlength
  14032. Specify the transform length in time domain. Use this option to control accuracy
  14033. trade-off between time domain and frequency domain at every frequency sample.
  14034. It can contain variables:
  14035. @table @option
  14036. @item frequency, freq, f
  14037. the frequency where it is evaluated
  14038. @item timeclamp, tc
  14039. the value of @var{timeclamp} option.
  14040. @end table
  14041. Default value is @code{384*tc/(384+tc*f)}.
  14042. @item count
  14043. Specify the transform count for every video frame. Default value is @code{6}.
  14044. Acceptable range is @code{[1, 30]}.
  14045. @item fcount
  14046. Specify the transform count for every single pixel. Default value is @code{0},
  14047. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14048. @item fontfile
  14049. Specify font file for use with freetype to draw the axis. If not specified,
  14050. use embedded font. Note that drawing with font file or embedded font is not
  14051. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14052. option instead.
  14053. @item font
  14054. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14055. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14056. @item fontcolor
  14057. Specify font color expression. This is arithmetic expression that should return
  14058. integer value 0xRRGGBB. It can contain variables:
  14059. @table @option
  14060. @item frequency, freq, f
  14061. the frequency where it is evaluated
  14062. @item timeclamp, tc
  14063. the value of @var{timeclamp} option
  14064. @end table
  14065. and functions:
  14066. @table @option
  14067. @item midi(f)
  14068. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14069. @item r(x), g(x), b(x)
  14070. red, green, and blue value of intensity x.
  14071. @end table
  14072. Default value is @code{st(0, (midi(f)-59.5)/12);
  14073. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14074. r(1-ld(1)) + b(ld(1))}.
  14075. @item axisfile
  14076. Specify image file to draw the axis. This option override @var{fontfile} and
  14077. @var{fontcolor} option.
  14078. @item axis, text
  14079. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14080. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14081. Default value is @code{1}.
  14082. @item csp
  14083. Set colorspace. The accepted values are:
  14084. @table @samp
  14085. @item unspecified
  14086. Unspecified (default)
  14087. @item bt709
  14088. BT.709
  14089. @item fcc
  14090. FCC
  14091. @item bt470bg
  14092. BT.470BG or BT.601-6 625
  14093. @item smpte170m
  14094. SMPTE-170M or BT.601-6 525
  14095. @item smpte240m
  14096. SMPTE-240M
  14097. @item bt2020ncl
  14098. BT.2020 with non-constant luminance
  14099. @end table
  14100. @item cscheme
  14101. Set spectrogram color scheme. This is list of floating point values with format
  14102. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14103. The default is @code{1|0.5|0|0|0.5|1}.
  14104. @end table
  14105. @subsection Examples
  14106. @itemize
  14107. @item
  14108. Playing audio while showing the spectrum:
  14109. @example
  14110. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14111. @end example
  14112. @item
  14113. Same as above, but with frame rate 30 fps:
  14114. @example
  14115. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14116. @end example
  14117. @item
  14118. Playing at 1280x720:
  14119. @example
  14120. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14121. @end example
  14122. @item
  14123. Disable sonogram display:
  14124. @example
  14125. sono_h=0
  14126. @end example
  14127. @item
  14128. A1 and its harmonics: A1, A2, (near)E3, A3:
  14129. @example
  14130. 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),
  14131. asplit[a][out1]; [a] showcqt [out0]'
  14132. @end example
  14133. @item
  14134. Same as above, but with more accuracy in frequency domain:
  14135. @example
  14136. 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),
  14137. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14138. @end example
  14139. @item
  14140. Custom volume:
  14141. @example
  14142. bar_v=10:sono_v=bar_v*a_weighting(f)
  14143. @end example
  14144. @item
  14145. Custom gamma, now spectrum is linear to the amplitude.
  14146. @example
  14147. bar_g=2:sono_g=2
  14148. @end example
  14149. @item
  14150. Custom tlength equation:
  14151. @example
  14152. 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)))'
  14153. @end example
  14154. @item
  14155. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14156. @example
  14157. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14158. @end example
  14159. @item
  14160. Custom font using fontconfig:
  14161. @example
  14162. font='Courier New,Monospace,mono|bold'
  14163. @end example
  14164. @item
  14165. Custom frequency range with custom axis using image file:
  14166. @example
  14167. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14168. @end example
  14169. @end itemize
  14170. @section showfreqs
  14171. Convert input audio to video output representing the audio power spectrum.
  14172. Audio amplitude is on Y-axis while frequency is on X-axis.
  14173. The filter accepts the following options:
  14174. @table @option
  14175. @item size, s
  14176. Specify size of video. For the syntax of this option, check the
  14177. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14178. Default is @code{1024x512}.
  14179. @item mode
  14180. Set display mode.
  14181. This set how each frequency bin will be represented.
  14182. It accepts the following values:
  14183. @table @samp
  14184. @item line
  14185. @item bar
  14186. @item dot
  14187. @end table
  14188. Default is @code{bar}.
  14189. @item ascale
  14190. Set amplitude scale.
  14191. It accepts the following values:
  14192. @table @samp
  14193. @item lin
  14194. Linear scale.
  14195. @item sqrt
  14196. Square root scale.
  14197. @item cbrt
  14198. Cubic root scale.
  14199. @item log
  14200. Logarithmic scale.
  14201. @end table
  14202. Default is @code{log}.
  14203. @item fscale
  14204. Set frequency scale.
  14205. It accepts the following values:
  14206. @table @samp
  14207. @item lin
  14208. Linear scale.
  14209. @item log
  14210. Logarithmic scale.
  14211. @item rlog
  14212. Reverse logarithmic scale.
  14213. @end table
  14214. Default is @code{lin}.
  14215. @item win_size
  14216. Set window size.
  14217. It accepts the following values:
  14218. @table @samp
  14219. @item w16
  14220. @item w32
  14221. @item w64
  14222. @item w128
  14223. @item w256
  14224. @item w512
  14225. @item w1024
  14226. @item w2048
  14227. @item w4096
  14228. @item w8192
  14229. @item w16384
  14230. @item w32768
  14231. @item w65536
  14232. @end table
  14233. Default is @code{w2048}
  14234. @item win_func
  14235. Set windowing function.
  14236. It accepts the following values:
  14237. @table @samp
  14238. @item rect
  14239. @item bartlett
  14240. @item hanning
  14241. @item hamming
  14242. @item blackman
  14243. @item welch
  14244. @item flattop
  14245. @item bharris
  14246. @item bnuttall
  14247. @item bhann
  14248. @item sine
  14249. @item nuttall
  14250. @item lanczos
  14251. @item gauss
  14252. @item tukey
  14253. @item dolph
  14254. @item cauchy
  14255. @item parzen
  14256. @item poisson
  14257. @end table
  14258. Default is @code{hanning}.
  14259. @item overlap
  14260. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14261. which means optimal overlap for selected window function will be picked.
  14262. @item averaging
  14263. Set time averaging. Setting this to 0 will display current maximal peaks.
  14264. Default is @code{1}, which means time averaging is disabled.
  14265. @item colors
  14266. Specify list of colors separated by space or by '|' which will be used to
  14267. draw channel frequencies. Unrecognized or missing colors will be replaced
  14268. by white color.
  14269. @item cmode
  14270. Set channel display mode.
  14271. It accepts the following values:
  14272. @table @samp
  14273. @item combined
  14274. @item separate
  14275. @end table
  14276. Default is @code{combined}.
  14277. @item minamp
  14278. Set minimum amplitude used in @code{log} amplitude scaler.
  14279. @end table
  14280. @anchor{showspectrum}
  14281. @section showspectrum
  14282. Convert input audio to a video output, representing the audio frequency
  14283. spectrum.
  14284. The filter accepts the following options:
  14285. @table @option
  14286. @item size, s
  14287. Specify the video size for the output. For the syntax of this option, check the
  14288. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14289. Default value is @code{640x512}.
  14290. @item slide
  14291. Specify how the spectrum should slide along the window.
  14292. It accepts the following values:
  14293. @table @samp
  14294. @item replace
  14295. the samples start again on the left when they reach the right
  14296. @item scroll
  14297. the samples scroll from right to left
  14298. @item fullframe
  14299. frames are only produced when the samples reach the right
  14300. @item rscroll
  14301. the samples scroll from left to right
  14302. @end table
  14303. Default value is @code{replace}.
  14304. @item mode
  14305. Specify display mode.
  14306. It accepts the following values:
  14307. @table @samp
  14308. @item combined
  14309. all channels are displayed in the same row
  14310. @item separate
  14311. all channels are displayed in separate rows
  14312. @end table
  14313. Default value is @samp{combined}.
  14314. @item color
  14315. Specify display color mode.
  14316. It accepts the following values:
  14317. @table @samp
  14318. @item channel
  14319. each channel is displayed in a separate color
  14320. @item intensity
  14321. each channel is displayed using the same color scheme
  14322. @item rainbow
  14323. each channel is displayed using the rainbow color scheme
  14324. @item moreland
  14325. each channel is displayed using the moreland color scheme
  14326. @item nebulae
  14327. each channel is displayed using the nebulae color scheme
  14328. @item fire
  14329. each channel is displayed using the fire color scheme
  14330. @item fiery
  14331. each channel is displayed using the fiery color scheme
  14332. @item fruit
  14333. each channel is displayed using the fruit color scheme
  14334. @item cool
  14335. each channel is displayed using the cool color scheme
  14336. @end table
  14337. Default value is @samp{channel}.
  14338. @item scale
  14339. Specify scale used for calculating intensity color values.
  14340. It accepts the following values:
  14341. @table @samp
  14342. @item lin
  14343. linear
  14344. @item sqrt
  14345. square root, default
  14346. @item cbrt
  14347. cubic root
  14348. @item log
  14349. logarithmic
  14350. @item 4thrt
  14351. 4th root
  14352. @item 5thrt
  14353. 5th root
  14354. @end table
  14355. Default value is @samp{sqrt}.
  14356. @item saturation
  14357. Set saturation modifier for displayed colors. Negative values provide
  14358. alternative color scheme. @code{0} is no saturation at all.
  14359. Saturation must be in [-10.0, 10.0] range.
  14360. Default value is @code{1}.
  14361. @item win_func
  14362. Set window function.
  14363. It accepts the following values:
  14364. @table @samp
  14365. @item rect
  14366. @item bartlett
  14367. @item hann
  14368. @item hanning
  14369. @item hamming
  14370. @item blackman
  14371. @item welch
  14372. @item flattop
  14373. @item bharris
  14374. @item bnuttall
  14375. @item bhann
  14376. @item sine
  14377. @item nuttall
  14378. @item lanczos
  14379. @item gauss
  14380. @item tukey
  14381. @item dolph
  14382. @item cauchy
  14383. @item parzen
  14384. @item poisson
  14385. @end table
  14386. Default value is @code{hann}.
  14387. @item orientation
  14388. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14389. @code{horizontal}. Default is @code{vertical}.
  14390. @item overlap
  14391. Set ratio of overlap window. Default value is @code{0}.
  14392. When value is @code{1} overlap is set to recommended size for specific
  14393. window function currently used.
  14394. @item gain
  14395. Set scale gain for calculating intensity color values.
  14396. Default value is @code{1}.
  14397. @item data
  14398. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14399. @item rotation
  14400. Set color rotation, must be in [-1.0, 1.0] range.
  14401. Default value is @code{0}.
  14402. @end table
  14403. The usage is very similar to the showwaves filter; see the examples in that
  14404. section.
  14405. @subsection Examples
  14406. @itemize
  14407. @item
  14408. Large window with logarithmic color scaling:
  14409. @example
  14410. showspectrum=s=1280x480:scale=log
  14411. @end example
  14412. @item
  14413. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14414. @example
  14415. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14416. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14417. @end example
  14418. @end itemize
  14419. @section showspectrumpic
  14420. Convert input audio to a single video frame, representing the audio frequency
  14421. spectrum.
  14422. The filter accepts the following options:
  14423. @table @option
  14424. @item size, s
  14425. Specify the video size for the output. For the syntax of this option, check the
  14426. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14427. Default value is @code{4096x2048}.
  14428. @item mode
  14429. Specify display mode.
  14430. It accepts the following values:
  14431. @table @samp
  14432. @item combined
  14433. all channels are displayed in the same row
  14434. @item separate
  14435. all channels are displayed in separate rows
  14436. @end table
  14437. Default value is @samp{combined}.
  14438. @item color
  14439. Specify display color mode.
  14440. It accepts the following values:
  14441. @table @samp
  14442. @item channel
  14443. each channel is displayed in a separate color
  14444. @item intensity
  14445. each channel is displayed using the same color scheme
  14446. @item rainbow
  14447. each channel is displayed using the rainbow color scheme
  14448. @item moreland
  14449. each channel is displayed using the moreland color scheme
  14450. @item nebulae
  14451. each channel is displayed using the nebulae color scheme
  14452. @item fire
  14453. each channel is displayed using the fire color scheme
  14454. @item fiery
  14455. each channel is displayed using the fiery color scheme
  14456. @item fruit
  14457. each channel is displayed using the fruit color scheme
  14458. @item cool
  14459. each channel is displayed using the cool color scheme
  14460. @end table
  14461. Default value is @samp{intensity}.
  14462. @item scale
  14463. Specify scale used for calculating intensity color values.
  14464. It accepts the following values:
  14465. @table @samp
  14466. @item lin
  14467. linear
  14468. @item sqrt
  14469. square root, default
  14470. @item cbrt
  14471. cubic root
  14472. @item log
  14473. logarithmic
  14474. @item 4thrt
  14475. 4th root
  14476. @item 5thrt
  14477. 5th root
  14478. @end table
  14479. Default value is @samp{log}.
  14480. @item saturation
  14481. Set saturation modifier for displayed colors. Negative values provide
  14482. alternative color scheme. @code{0} is no saturation at all.
  14483. Saturation must be in [-10.0, 10.0] range.
  14484. Default value is @code{1}.
  14485. @item win_func
  14486. Set window function.
  14487. It accepts the following values:
  14488. @table @samp
  14489. @item rect
  14490. @item bartlett
  14491. @item hann
  14492. @item hanning
  14493. @item hamming
  14494. @item blackman
  14495. @item welch
  14496. @item flattop
  14497. @item bharris
  14498. @item bnuttall
  14499. @item bhann
  14500. @item sine
  14501. @item nuttall
  14502. @item lanczos
  14503. @item gauss
  14504. @item tukey
  14505. @item dolph
  14506. @item cauchy
  14507. @item parzen
  14508. @item poisson
  14509. @end table
  14510. Default value is @code{hann}.
  14511. @item orientation
  14512. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14513. @code{horizontal}. Default is @code{vertical}.
  14514. @item gain
  14515. Set scale gain for calculating intensity color values.
  14516. Default value is @code{1}.
  14517. @item legend
  14518. Draw time and frequency axes and legends. Default is enabled.
  14519. @item rotation
  14520. Set color rotation, must be in [-1.0, 1.0] range.
  14521. Default value is @code{0}.
  14522. @end table
  14523. @subsection Examples
  14524. @itemize
  14525. @item
  14526. Extract an audio spectrogram of a whole audio track
  14527. in a 1024x1024 picture using @command{ffmpeg}:
  14528. @example
  14529. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14530. @end example
  14531. @end itemize
  14532. @section showvolume
  14533. Convert input audio volume to a video output.
  14534. The filter accepts the following options:
  14535. @table @option
  14536. @item rate, r
  14537. Set video rate.
  14538. @item b
  14539. Set border width, allowed range is [0, 5]. Default is 1.
  14540. @item w
  14541. Set channel width, allowed range is [80, 8192]. Default is 400.
  14542. @item h
  14543. Set channel height, allowed range is [1, 900]. Default is 20.
  14544. @item f
  14545. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14546. @item c
  14547. Set volume color expression.
  14548. The expression can use the following variables:
  14549. @table @option
  14550. @item VOLUME
  14551. Current max volume of channel in dB.
  14552. @item PEAK
  14553. Current peak.
  14554. @item CHANNEL
  14555. Current channel number, starting from 0.
  14556. @end table
  14557. @item t
  14558. If set, displays channel names. Default is enabled.
  14559. @item v
  14560. If set, displays volume values. Default is enabled.
  14561. @item o
  14562. Set orientation, can be @code{horizontal} or @code{vertical},
  14563. default is @code{horizontal}.
  14564. @item s
  14565. Set step size, allowed range s [0, 5]. Default is 0, which means
  14566. step is disabled.
  14567. @end table
  14568. @section showwaves
  14569. Convert input audio to a video output, representing the samples waves.
  14570. The filter accepts the following options:
  14571. @table @option
  14572. @item size, s
  14573. Specify the video size for the output. For the syntax of this option, check the
  14574. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14575. Default value is @code{600x240}.
  14576. @item mode
  14577. Set display mode.
  14578. Available values are:
  14579. @table @samp
  14580. @item point
  14581. Draw a point for each sample.
  14582. @item line
  14583. Draw a vertical line for each sample.
  14584. @item p2p
  14585. Draw a point for each sample and a line between them.
  14586. @item cline
  14587. Draw a centered vertical line for each sample.
  14588. @end table
  14589. Default value is @code{point}.
  14590. @item n
  14591. Set the number of samples which are printed on the same column. A
  14592. larger value will decrease the frame rate. Must be a positive
  14593. integer. This option can be set only if the value for @var{rate}
  14594. is not explicitly specified.
  14595. @item rate, r
  14596. Set the (approximate) output frame rate. This is done by setting the
  14597. option @var{n}. Default value is "25".
  14598. @item split_channels
  14599. Set if channels should be drawn separately or overlap. Default value is 0.
  14600. @item colors
  14601. Set colors separated by '|' which are going to be used for drawing of each channel.
  14602. @item scale
  14603. Set amplitude scale.
  14604. Available values are:
  14605. @table @samp
  14606. @item lin
  14607. Linear.
  14608. @item log
  14609. Logarithmic.
  14610. @item sqrt
  14611. Square root.
  14612. @item cbrt
  14613. Cubic root.
  14614. @end table
  14615. Default is linear.
  14616. @end table
  14617. @subsection Examples
  14618. @itemize
  14619. @item
  14620. Output the input file audio and the corresponding video representation
  14621. at the same time:
  14622. @example
  14623. amovie=a.mp3,asplit[out0],showwaves[out1]
  14624. @end example
  14625. @item
  14626. Create a synthetic signal and show it with showwaves, forcing a
  14627. frame rate of 30 frames per second:
  14628. @example
  14629. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14630. @end example
  14631. @end itemize
  14632. @section showwavespic
  14633. Convert input audio to a single video frame, representing the samples waves.
  14634. The filter accepts the following options:
  14635. @table @option
  14636. @item size, s
  14637. Specify the video size for the output. For the syntax of this option, check the
  14638. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14639. Default value is @code{600x240}.
  14640. @item split_channels
  14641. Set if channels should be drawn separately or overlap. Default value is 0.
  14642. @item colors
  14643. Set colors separated by '|' which are going to be used for drawing of each channel.
  14644. @item scale
  14645. Set amplitude scale.
  14646. Available values are:
  14647. @table @samp
  14648. @item lin
  14649. Linear.
  14650. @item log
  14651. Logarithmic.
  14652. @item sqrt
  14653. Square root.
  14654. @item cbrt
  14655. Cubic root.
  14656. @end table
  14657. Default is linear.
  14658. @end table
  14659. @subsection Examples
  14660. @itemize
  14661. @item
  14662. Extract a channel split representation of the wave form of a whole audio track
  14663. in a 1024x800 picture using @command{ffmpeg}:
  14664. @example
  14665. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14666. @end example
  14667. @end itemize
  14668. @section sidedata, asidedata
  14669. Delete frame side data, or select frames based on it.
  14670. This filter accepts the following options:
  14671. @table @option
  14672. @item mode
  14673. Set mode of operation of the filter.
  14674. Can be one of the following:
  14675. @table @samp
  14676. @item select
  14677. Select every frame with side data of @code{type}.
  14678. @item delete
  14679. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14680. data in the frame.
  14681. @end table
  14682. @item type
  14683. Set side data type used with all modes. Must be set for @code{select} mode. For
  14684. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14685. in @file{libavutil/frame.h}. For example, to choose
  14686. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14687. @end table
  14688. @section spectrumsynth
  14689. Sythesize audio from 2 input video spectrums, first input stream represents
  14690. magnitude across time and second represents phase across time.
  14691. The filter will transform from frequency domain as displayed in videos back
  14692. to time domain as presented in audio output.
  14693. This filter is primarily created for reversing processed @ref{showspectrum}
  14694. filter outputs, but can synthesize sound from other spectrograms too.
  14695. But in such case results are going to be poor if the phase data is not
  14696. available, because in such cases phase data need to be recreated, usually
  14697. its just recreated from random noise.
  14698. For best results use gray only output (@code{channel} color mode in
  14699. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14700. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14701. @code{data} option. Inputs videos should generally use @code{fullframe}
  14702. slide mode as that saves resources needed for decoding video.
  14703. The filter accepts the following options:
  14704. @table @option
  14705. @item sample_rate
  14706. Specify sample rate of output audio, the sample rate of audio from which
  14707. spectrum was generated may differ.
  14708. @item channels
  14709. Set number of channels represented in input video spectrums.
  14710. @item scale
  14711. Set scale which was used when generating magnitude input spectrum.
  14712. Can be @code{lin} or @code{log}. Default is @code{log}.
  14713. @item slide
  14714. Set slide which was used when generating inputs spectrums.
  14715. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14716. Default is @code{fullframe}.
  14717. @item win_func
  14718. Set window function used for resynthesis.
  14719. @item overlap
  14720. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14721. which means optimal overlap for selected window function will be picked.
  14722. @item orientation
  14723. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14724. Default is @code{vertical}.
  14725. @end table
  14726. @subsection Examples
  14727. @itemize
  14728. @item
  14729. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14730. then resynthesize videos back to audio with spectrumsynth:
  14731. @example
  14732. 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
  14733. 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
  14734. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14735. @end example
  14736. @end itemize
  14737. @section split, asplit
  14738. Split input into several identical outputs.
  14739. @code{asplit} works with audio input, @code{split} with video.
  14740. The filter accepts a single parameter which specifies the number of outputs. If
  14741. unspecified, it defaults to 2.
  14742. @subsection Examples
  14743. @itemize
  14744. @item
  14745. Create two separate outputs from the same input:
  14746. @example
  14747. [in] split [out0][out1]
  14748. @end example
  14749. @item
  14750. To create 3 or more outputs, you need to specify the number of
  14751. outputs, like in:
  14752. @example
  14753. [in] asplit=3 [out0][out1][out2]
  14754. @end example
  14755. @item
  14756. Create two separate outputs from the same input, one cropped and
  14757. one padded:
  14758. @example
  14759. [in] split [splitout1][splitout2];
  14760. [splitout1] crop=100:100:0:0 [cropout];
  14761. [splitout2] pad=200:200:100:100 [padout];
  14762. @end example
  14763. @item
  14764. Create 5 copies of the input audio with @command{ffmpeg}:
  14765. @example
  14766. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14767. @end example
  14768. @end itemize
  14769. @section zmq, azmq
  14770. Receive commands sent through a libzmq client, and forward them to
  14771. filters in the filtergraph.
  14772. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14773. must be inserted between two video filters, @code{azmq} between two
  14774. audio filters.
  14775. To enable these filters you need to install the libzmq library and
  14776. headers and configure FFmpeg with @code{--enable-libzmq}.
  14777. For more information about libzmq see:
  14778. @url{http://www.zeromq.org/}
  14779. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14780. receives messages sent through a network interface defined by the
  14781. @option{bind_address} option.
  14782. The received message must be in the form:
  14783. @example
  14784. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14785. @end example
  14786. @var{TARGET} specifies the target of the command, usually the name of
  14787. the filter class or a specific filter instance name.
  14788. @var{COMMAND} specifies the name of the command for the target filter.
  14789. @var{ARG} is optional and specifies the optional argument list for the
  14790. given @var{COMMAND}.
  14791. Upon reception, the message is processed and the corresponding command
  14792. is injected into the filtergraph. Depending on the result, the filter
  14793. will send a reply to the client, adopting the format:
  14794. @example
  14795. @var{ERROR_CODE} @var{ERROR_REASON}
  14796. @var{MESSAGE}
  14797. @end example
  14798. @var{MESSAGE} is optional.
  14799. @subsection Examples
  14800. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14801. be used to send commands processed by these filters.
  14802. Consider the following filtergraph generated by @command{ffplay}
  14803. @example
  14804. ffplay -dumpgraph 1 -f lavfi "
  14805. color=s=100x100:c=red [l];
  14806. color=s=100x100:c=blue [r];
  14807. nullsrc=s=200x100, zmq [bg];
  14808. [bg][l] overlay [bg+l];
  14809. [bg+l][r] overlay=x=100 "
  14810. @end example
  14811. To change the color of the left side of the video, the following
  14812. command can be used:
  14813. @example
  14814. echo Parsed_color_0 c yellow | tools/zmqsend
  14815. @end example
  14816. To change the right side:
  14817. @example
  14818. echo Parsed_color_1 c pink | tools/zmqsend
  14819. @end example
  14820. @c man end MULTIMEDIA FILTERS
  14821. @chapter Multimedia Sources
  14822. @c man begin MULTIMEDIA SOURCES
  14823. Below is a description of the currently available multimedia sources.
  14824. @section amovie
  14825. This is the same as @ref{movie} source, except it selects an audio
  14826. stream by default.
  14827. @anchor{movie}
  14828. @section movie
  14829. Read audio and/or video stream(s) from a movie container.
  14830. It accepts the following parameters:
  14831. @table @option
  14832. @item filename
  14833. The name of the resource to read (not necessarily a file; it can also be a
  14834. device or a stream accessed through some protocol).
  14835. @item format_name, f
  14836. Specifies the format assumed for the movie to read, and can be either
  14837. the name of a container or an input device. If not specified, the
  14838. format is guessed from @var{movie_name} or by probing.
  14839. @item seek_point, sp
  14840. Specifies the seek point in seconds. The frames will be output
  14841. starting from this seek point. The parameter is evaluated with
  14842. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14843. postfix. The default value is "0".
  14844. @item streams, s
  14845. Specifies the streams to read. Several streams can be specified,
  14846. separated by "+". The source will then have as many outputs, in the
  14847. same order. The syntax is explained in the ``Stream specifiers''
  14848. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14849. respectively the default (best suited) video and audio stream. Default
  14850. is "dv", or "da" if the filter is called as "amovie".
  14851. @item stream_index, si
  14852. Specifies the index of the video stream to read. If the value is -1,
  14853. the most suitable video stream will be automatically selected. The default
  14854. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14855. audio instead of video.
  14856. @item loop
  14857. Specifies how many times to read the stream in sequence.
  14858. If the value is 0, the stream will be looped infinitely.
  14859. Default value is "1".
  14860. Note that when the movie is looped the source timestamps are not
  14861. changed, so it will generate non monotonically increasing timestamps.
  14862. @item discontinuity
  14863. Specifies the time difference between frames above which the point is
  14864. considered a timestamp discontinuity which is removed by adjusting the later
  14865. timestamps.
  14866. @end table
  14867. It allows overlaying a second video on top of the main input of
  14868. a filtergraph, as shown in this graph:
  14869. @example
  14870. input -----------> deltapts0 --> overlay --> output
  14871. ^
  14872. |
  14873. movie --> scale--> deltapts1 -------+
  14874. @end example
  14875. @subsection Examples
  14876. @itemize
  14877. @item
  14878. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14879. on top of the input labelled "in":
  14880. @example
  14881. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14882. [in] setpts=PTS-STARTPTS [main];
  14883. [main][over] overlay=16:16 [out]
  14884. @end example
  14885. @item
  14886. Read from a video4linux2 device, and overlay it on top of the input
  14887. labelled "in":
  14888. @example
  14889. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14890. [in] setpts=PTS-STARTPTS [main];
  14891. [main][over] overlay=16:16 [out]
  14892. @end example
  14893. @item
  14894. Read the first video stream and the audio stream with id 0x81 from
  14895. dvd.vob; the video is connected to the pad named "video" and the audio is
  14896. connected to the pad named "audio":
  14897. @example
  14898. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14899. @end example
  14900. @end itemize
  14901. @subsection Commands
  14902. Both movie and amovie support the following commands:
  14903. @table @option
  14904. @item seek
  14905. Perform seek using "av_seek_frame".
  14906. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14907. @itemize
  14908. @item
  14909. @var{stream_index}: If stream_index is -1, a default
  14910. stream is selected, and @var{timestamp} is automatically converted
  14911. from AV_TIME_BASE units to the stream specific time_base.
  14912. @item
  14913. @var{timestamp}: Timestamp in AVStream.time_base units
  14914. or, if no stream is specified, in AV_TIME_BASE units.
  14915. @item
  14916. @var{flags}: Flags which select direction and seeking mode.
  14917. @end itemize
  14918. @item get_duration
  14919. Get movie duration in AV_TIME_BASE units.
  14920. @end table
  14921. @c man end MULTIMEDIA SOURCES