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.

20681 lines
548KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adelay
  434. Delay one or more audio channels.
  435. Samples in delayed channel are filled with silence.
  436. The filter accepts the following option:
  437. @table @option
  438. @item delays
  439. Set list of delays in milliseconds for each channel separated by '|'.
  440. Unused delays will be silently ignored. If number of given delays is
  441. smaller than number of channels all remaining channels will not be delayed.
  442. If you want to delay exact number of samples, append 'S' to number.
  443. @end table
  444. @subsection Examples
  445. @itemize
  446. @item
  447. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  448. the second channel (and any other channels that may be present) unchanged.
  449. @example
  450. adelay=1500|0|500
  451. @end example
  452. @item
  453. Delay second channel by 500 samples, the third channel by 700 samples and leave
  454. the first channel (and any other channels that may be present) unchanged.
  455. @example
  456. adelay=0|500S|700S
  457. @end example
  458. @end itemize
  459. @section aecho
  460. Apply echoing to the input audio.
  461. Echoes are reflected sound and can occur naturally amongst mountains
  462. (and sometimes large buildings) when talking or shouting; digital echo
  463. effects emulate this behaviour and are often used to help fill out the
  464. sound of a single instrument or vocal. The time difference between the
  465. original signal and the reflection is the @code{delay}, and the
  466. loudness of the reflected signal is the @code{decay}.
  467. Multiple echoes can have different delays and decays.
  468. A description of the accepted parameters follows.
  469. @table @option
  470. @item in_gain
  471. Set input gain of reflected signal. Default is @code{0.6}.
  472. @item out_gain
  473. Set output gain of reflected signal. Default is @code{0.3}.
  474. @item delays
  475. Set list of time intervals in milliseconds between original signal and reflections
  476. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  477. Default is @code{1000}.
  478. @item decays
  479. Set list of loudness of reflected signals separated by '|'.
  480. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  481. Default is @code{0.5}.
  482. @end table
  483. @subsection Examples
  484. @itemize
  485. @item
  486. Make it sound as if there are twice as many instruments as are actually playing:
  487. @example
  488. aecho=0.8:0.88:60:0.4
  489. @end example
  490. @item
  491. If delay is very short, then it sound like a (metallic) robot playing music:
  492. @example
  493. aecho=0.8:0.88:6:0.4
  494. @end example
  495. @item
  496. A longer delay will sound like an open air concert in the mountains:
  497. @example
  498. aecho=0.8:0.9:1000:0.3
  499. @end example
  500. @item
  501. Same as above but with one more mountain:
  502. @example
  503. aecho=0.8:0.9:1000|1800:0.3|0.25
  504. @end example
  505. @end itemize
  506. @section aemphasis
  507. Audio emphasis filter creates or restores material directly taken from LPs or
  508. emphased CDs with different filter curves. E.g. to store music on vinyl the
  509. signal has to be altered by a filter first to even out the disadvantages of
  510. this recording medium.
  511. Once the material is played back the inverse filter has to be applied to
  512. restore the distortion of the frequency response.
  513. The filter accepts the following options:
  514. @table @option
  515. @item level_in
  516. Set input gain.
  517. @item level_out
  518. Set output gain.
  519. @item mode
  520. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  521. use @code{production} mode. Default is @code{reproduction} mode.
  522. @item type
  523. Set filter type. Selects medium. Can be one of the following:
  524. @table @option
  525. @item col
  526. select Columbia.
  527. @item emi
  528. select EMI.
  529. @item bsi
  530. select BSI (78RPM).
  531. @item riaa
  532. select RIAA.
  533. @item cd
  534. select Compact Disc (CD).
  535. @item 50fm
  536. select 50µs (FM).
  537. @item 75fm
  538. select 75µs (FM).
  539. @item 50kf
  540. select 50µs (FM-KF).
  541. @item 75kf
  542. select 75µs (FM-KF).
  543. @end table
  544. @end table
  545. @section aeval
  546. Modify an audio signal according to the specified expressions.
  547. This filter accepts one or more expressions (one for each channel),
  548. which are evaluated and used to modify a corresponding audio signal.
  549. It accepts the following parameters:
  550. @table @option
  551. @item exprs
  552. Set the '|'-separated expressions list for each separate channel. If
  553. the number of input channels is greater than the number of
  554. expressions, the last specified expression is used for the remaining
  555. output channels.
  556. @item channel_layout, c
  557. Set output channel layout. If not specified, the channel layout is
  558. specified by the number of expressions. If set to @samp{same}, it will
  559. use by default the same input channel layout.
  560. @end table
  561. Each expression in @var{exprs} can contain the following constants and functions:
  562. @table @option
  563. @item ch
  564. channel number of the current expression
  565. @item n
  566. number of the evaluated sample, starting from 0
  567. @item s
  568. sample rate
  569. @item t
  570. time of the evaluated sample expressed in seconds
  571. @item nb_in_channels
  572. @item nb_out_channels
  573. input and output number of channels
  574. @item val(CH)
  575. the value of input channel with number @var{CH}
  576. @end table
  577. Note: this filter is slow. For faster processing you should use a
  578. dedicated filter.
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Half volume:
  583. @example
  584. aeval=val(ch)/2:c=same
  585. @end example
  586. @item
  587. Invert phase of the second channel:
  588. @example
  589. aeval=val(0)|-val(1)
  590. @end example
  591. @end itemize
  592. @anchor{afade}
  593. @section afade
  594. Apply fade-in/out effect to input audio.
  595. A description of the accepted parameters follows.
  596. @table @option
  597. @item type, t
  598. Specify the effect type, can be either @code{in} for fade-in, or
  599. @code{out} for a fade-out effect. Default is @code{in}.
  600. @item start_sample, ss
  601. Specify the number of the start sample for starting to apply the fade
  602. effect. Default is 0.
  603. @item nb_samples, ns
  604. Specify the number of samples for which the fade effect has to last. At
  605. the end of the fade-in effect the output audio will have the same
  606. volume as the input audio, at the end of the fade-out transition
  607. the output audio will be silence. Default is 44100.
  608. @item start_time, st
  609. Specify the start time of the fade effect. Default is 0.
  610. The value must be specified as a time duration; see
  611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  612. for the accepted syntax.
  613. If set this option is used instead of @var{start_sample}.
  614. @item duration, d
  615. Specify the duration of the fade effect. See
  616. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  617. for the accepted syntax.
  618. At the end of the fade-in effect the output audio will have the same
  619. volume as the input audio, at the end of the fade-out transition
  620. the output audio will be silence.
  621. By default the duration is determined by @var{nb_samples}.
  622. If set this option is used instead of @var{nb_samples}.
  623. @item curve
  624. Set curve for fade transition.
  625. It accepts the following values:
  626. @table @option
  627. @item tri
  628. select triangular, linear slope (default)
  629. @item qsin
  630. select quarter of sine wave
  631. @item hsin
  632. select half of sine wave
  633. @item esin
  634. select exponential sine wave
  635. @item log
  636. select logarithmic
  637. @item ipar
  638. select inverted parabola
  639. @item qua
  640. select quadratic
  641. @item cub
  642. select cubic
  643. @item squ
  644. select square root
  645. @item cbr
  646. select cubic root
  647. @item par
  648. select parabola
  649. @item exp
  650. select exponential
  651. @item iqsin
  652. select inverted quarter of sine wave
  653. @item ihsin
  654. select inverted half of sine wave
  655. @item dese
  656. select double-exponential seat
  657. @item desi
  658. select double-exponential sigmoid
  659. @end table
  660. @end table
  661. @subsection Examples
  662. @itemize
  663. @item
  664. Fade in first 15 seconds of audio:
  665. @example
  666. afade=t=in:ss=0:d=15
  667. @end example
  668. @item
  669. Fade out last 25 seconds of a 900 seconds audio:
  670. @example
  671. afade=t=out:st=875:d=25
  672. @end example
  673. @end itemize
  674. @section afftfilt
  675. Apply arbitrary expressions to samples in frequency domain.
  676. @table @option
  677. @item real
  678. Set frequency domain real expression for each separate channel separated
  679. by '|'. Default is "1".
  680. If the number of input channels is greater than the number of
  681. expressions, the last specified expression is used for the remaining
  682. output channels.
  683. @item imag
  684. Set frequency domain imaginary expression for each separate channel
  685. separated by '|'. If not set, @var{real} option is used.
  686. Each expression in @var{real} and @var{imag} can contain the following
  687. constants:
  688. @table @option
  689. @item sr
  690. sample rate
  691. @item b
  692. current frequency bin number
  693. @item nb
  694. number of available bins
  695. @item ch
  696. channel number of the current expression
  697. @item chs
  698. number of channels
  699. @item pts
  700. current frame pts
  701. @end table
  702. @item win_size
  703. Set window size.
  704. It accepts the following values:
  705. @table @samp
  706. @item w16
  707. @item w32
  708. @item w64
  709. @item w128
  710. @item w256
  711. @item w512
  712. @item w1024
  713. @item w2048
  714. @item w4096
  715. @item w8192
  716. @item w16384
  717. @item w32768
  718. @item w65536
  719. @end table
  720. Default is @code{w4096}
  721. @item win_func
  722. Set window function. Default is @code{hann}.
  723. @item overlap
  724. Set window overlap. If set to 1, the recommended overlap for selected
  725. window function will be picked. Default is @code{0.75}.
  726. @end table
  727. @subsection Examples
  728. @itemize
  729. @item
  730. Leave almost only low frequencies in audio:
  731. @example
  732. afftfilt="1-clip((b/nb)*b,0,1)"
  733. @end example
  734. @end itemize
  735. @anchor{afir}
  736. @section afir
  737. Apply an arbitrary Frequency Impulse Response filter.
  738. This filter is designed for applying long FIR filters,
  739. up to 30 seconds long.
  740. It can be used as component for digital crossover filters,
  741. room equalization, cross talk cancellation, wavefield synthesis,
  742. auralization, ambiophonics and ambisonics.
  743. This filter uses second stream as FIR coefficients.
  744. If second stream holds single channel, it will be used
  745. for all input channels in first stream, otherwise
  746. number of channels in second stream must be same as
  747. number of channels in first stream.
  748. It accepts the following parameters:
  749. @table @option
  750. @item dry
  751. Set dry gain. This sets input gain.
  752. @item wet
  753. Set wet gain. This sets final output gain.
  754. @item length
  755. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  756. @item again
  757. Enable applying gain measured from power of IR.
  758. @item maxir
  759. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  760. Allowed range is 0.1 to 60 seconds.
  761. @end table
  762. @subsection Examples
  763. @itemize
  764. @item
  765. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  766. @example
  767. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  768. @end example
  769. @end itemize
  770. @anchor{aformat}
  771. @section aformat
  772. Set output format constraints for the input audio. The framework will
  773. negotiate the most appropriate format to minimize conversions.
  774. It accepts the following parameters:
  775. @table @option
  776. @item sample_fmts
  777. A '|'-separated list of requested sample formats.
  778. @item sample_rates
  779. A '|'-separated list of requested sample rates.
  780. @item channel_layouts
  781. A '|'-separated list of requested channel layouts.
  782. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  783. for the required syntax.
  784. @end table
  785. If a parameter is omitted, all values are allowed.
  786. Force the output to either unsigned 8-bit or signed 16-bit stereo
  787. @example
  788. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  789. @end example
  790. @section agate
  791. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  792. processing reduces disturbing noise between useful signals.
  793. Gating is done by detecting the volume below a chosen level @var{threshold}
  794. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  795. floor is set via @var{range}. Because an exact manipulation of the signal
  796. would cause distortion of the waveform the reduction can be levelled over
  797. time. This is done by setting @var{attack} and @var{release}.
  798. @var{attack} determines how long the signal has to fall below the threshold
  799. before any reduction will occur and @var{release} sets the time the signal
  800. has to rise above the threshold to reduce the reduction again.
  801. Shorter signals than the chosen attack time will be left untouched.
  802. @table @option
  803. @item level_in
  804. Set input level before filtering.
  805. Default is 1. Allowed range is from 0.015625 to 64.
  806. @item range
  807. Set the level of gain reduction when the signal is below the threshold.
  808. Default is 0.06125. Allowed range is from 0 to 1.
  809. @item threshold
  810. If a signal rises above this level the gain reduction is released.
  811. Default is 0.125. Allowed range is from 0 to 1.
  812. @item ratio
  813. Set a ratio by which the signal is reduced.
  814. Default is 2. Allowed range is from 1 to 9000.
  815. @item attack
  816. Amount of milliseconds the signal has to rise above the threshold before gain
  817. reduction stops.
  818. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  819. @item release
  820. Amount of milliseconds the signal has to fall below the threshold before the
  821. reduction is increased again. Default is 250 milliseconds.
  822. Allowed range is from 0.01 to 9000.
  823. @item makeup
  824. Set amount of amplification of signal after processing.
  825. Default is 1. Allowed range is from 1 to 64.
  826. @item knee
  827. Curve the sharp knee around the threshold to enter gain reduction more softly.
  828. Default is 2.828427125. Allowed range is from 1 to 8.
  829. @item detection
  830. Choose if exact signal should be taken for detection or an RMS like one.
  831. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  832. @item link
  833. Choose if the average level between all channels or the louder channel affects
  834. the reduction.
  835. Default is @code{average}. Can be @code{average} or @code{maximum}.
  836. @end table
  837. @section aiir
  838. Apply an arbitrary Infinite Impulse Response filter.
  839. It accepts the following parameters:
  840. @table @option
  841. @item z
  842. Set numerator/zeros coefficients.
  843. @item p
  844. Set denominator/poles coefficients.
  845. @item k
  846. Set channels gains.
  847. @item dry_gain
  848. Set input gain.
  849. @item wet_gain
  850. Set output gain.
  851. @item f
  852. Set coefficients format.
  853. @table @samp
  854. @item tf
  855. transfer function
  856. @item zp
  857. Z-plane zeros/poles, cartesian (default)
  858. @item pr
  859. Z-plane zeros/poles, polar radians
  860. @item pd
  861. Z-plane zeros/poles, polar degrees
  862. @end table
  863. @item r
  864. Set kind of processing.
  865. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  866. @item e
  867. Set filtering precision.
  868. @table @samp
  869. @item dbl
  870. double-precision floating-point (default)
  871. @item flt
  872. single-precision floating-point
  873. @item i32
  874. 32-bit integers
  875. @item i16
  876. 16-bit integers
  877. @end table
  878. @end table
  879. Coefficients in @code{tf} format are separated by spaces and are in ascending
  880. order.
  881. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  882. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  883. imaginary unit.
  884. Different coefficients and gains can be provided for every channel, in such case
  885. use '|' to separate coefficients or gains. Last provided coefficients will be
  886. used for all remaining channels.
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  891. @example
  892. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  893. @end example
  894. @item
  895. Same as above but in @code{zp} format:
  896. @example
  897. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  898. @end example
  899. @end itemize
  900. @section alimiter
  901. The limiter prevents an input signal from rising over a desired threshold.
  902. This limiter uses lookahead technology to prevent your signal from distorting.
  903. It means that there is a small delay after the signal is processed. Keep in mind
  904. that the delay it produces is the attack time you set.
  905. The filter accepts the following options:
  906. @table @option
  907. @item level_in
  908. Set input gain. Default is 1.
  909. @item level_out
  910. Set output gain. Default is 1.
  911. @item limit
  912. Don't let signals above this level pass the limiter. Default is 1.
  913. @item attack
  914. The limiter will reach its attenuation level in this amount of time in
  915. milliseconds. Default is 5 milliseconds.
  916. @item release
  917. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  918. Default is 50 milliseconds.
  919. @item asc
  920. When gain reduction is always needed ASC takes care of releasing to an
  921. average reduction level rather than reaching a reduction of 0 in the release
  922. time.
  923. @item asc_level
  924. Select how much the release time is affected by ASC, 0 means nearly no changes
  925. in release time while 1 produces higher release times.
  926. @item level
  927. Auto level output signal. Default is enabled.
  928. This normalizes audio back to 0dB if enabled.
  929. @end table
  930. Depending on picked setting it is recommended to upsample input 2x or 4x times
  931. with @ref{aresample} before applying this filter.
  932. @section allpass
  933. Apply a two-pole all-pass filter with central frequency (in Hz)
  934. @var{frequency}, and filter-width @var{width}.
  935. An all-pass filter changes the audio's frequency to phase relationship
  936. without changing its frequency to amplitude relationship.
  937. The filter accepts the following options:
  938. @table @option
  939. @item frequency, f
  940. Set frequency in Hz.
  941. @item width_type, t
  942. Set method to specify band-width of filter.
  943. @table @option
  944. @item h
  945. Hz
  946. @item q
  947. Q-Factor
  948. @item o
  949. octave
  950. @item s
  951. slope
  952. @item k
  953. kHz
  954. @end table
  955. @item width, w
  956. Specify the band-width of a filter in width_type units.
  957. @item channels, c
  958. Specify which channels to filter, by default all available are filtered.
  959. @end table
  960. @subsection Commands
  961. This filter supports the following commands:
  962. @table @option
  963. @item frequency, f
  964. Change allpass frequency.
  965. Syntax for the command is : "@var{frequency}"
  966. @item width_type, t
  967. Change allpass width_type.
  968. Syntax for the command is : "@var{width_type}"
  969. @item width, w
  970. Change allpass width.
  971. Syntax for the command is : "@var{width}"
  972. @end table
  973. @section aloop
  974. Loop audio samples.
  975. The filter accepts the following options:
  976. @table @option
  977. @item loop
  978. Set the number of loops. Setting this value to -1 will result in infinite loops.
  979. Default is 0.
  980. @item size
  981. Set maximal number of samples. Default is 0.
  982. @item start
  983. Set first sample of loop. Default is 0.
  984. @end table
  985. @anchor{amerge}
  986. @section amerge
  987. Merge two or more audio streams into a single multi-channel stream.
  988. The filter accepts the following options:
  989. @table @option
  990. @item inputs
  991. Set the number of inputs. Default is 2.
  992. @end table
  993. If the channel layouts of the inputs are disjoint, and therefore compatible,
  994. the channel layout of the output will be set accordingly and the channels
  995. will be reordered as necessary. If the channel layouts of the inputs are not
  996. disjoint, the output will have all the channels of the first input then all
  997. the channels of the second input, in that order, and the channel layout of
  998. the output will be the default value corresponding to the total number of
  999. channels.
  1000. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1001. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1002. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1003. first input, b1 is the first channel of the second input).
  1004. On the other hand, if both input are in stereo, the output channels will be
  1005. in the default order: a1, a2, b1, b2, and the channel layout will be
  1006. arbitrarily set to 4.0, which may or may not be the expected value.
  1007. All inputs must have the same sample rate, and format.
  1008. If inputs do not have the same duration, the output will stop with the
  1009. shortest.
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Merge two mono files into a stereo stream:
  1014. @example
  1015. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1016. @end example
  1017. @item
  1018. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1019. @example
  1020. 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
  1021. @end example
  1022. @end itemize
  1023. @section amix
  1024. Mixes multiple audio inputs into a single output.
  1025. Note that this filter only supports float samples (the @var{amerge}
  1026. and @var{pan} audio filters support many formats). If the @var{amix}
  1027. input has integer samples then @ref{aresample} will be automatically
  1028. inserted to perform the conversion to float samples.
  1029. For example
  1030. @example
  1031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1032. @end example
  1033. will mix 3 input audio streams to a single output with the same duration as the
  1034. first input and a dropout transition time of 3 seconds.
  1035. It accepts the following parameters:
  1036. @table @option
  1037. @item inputs
  1038. The number of inputs. If unspecified, it defaults to 2.
  1039. @item duration
  1040. How to determine the end-of-stream.
  1041. @table @option
  1042. @item longest
  1043. The duration of the longest input. (default)
  1044. @item shortest
  1045. The duration of the shortest input.
  1046. @item first
  1047. The duration of the first input.
  1048. @end table
  1049. @item dropout_transition
  1050. The transition time, in seconds, for volume renormalization when an input
  1051. stream ends. The default value is 2 seconds.
  1052. @item weights
  1053. Specify weight of each input audio stream as sequence.
  1054. Each weight is separated by space. By default all inputs have same weight.
  1055. @end table
  1056. @section anequalizer
  1057. High-order parametric multiband equalizer for each channel.
  1058. It accepts the following parameters:
  1059. @table @option
  1060. @item params
  1061. This option string is in format:
  1062. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1063. Each equalizer band is separated by '|'.
  1064. @table @option
  1065. @item chn
  1066. Set channel number to which equalization will be applied.
  1067. If input doesn't have that channel the entry is ignored.
  1068. @item f
  1069. Set central frequency for band.
  1070. If input doesn't have that frequency the entry is ignored.
  1071. @item w
  1072. Set band width in hertz.
  1073. @item g
  1074. Set band gain in dB.
  1075. @item t
  1076. Set filter type for band, optional, can be:
  1077. @table @samp
  1078. @item 0
  1079. Butterworth, this is default.
  1080. @item 1
  1081. Chebyshev type 1.
  1082. @item 2
  1083. Chebyshev type 2.
  1084. @end table
  1085. @end table
  1086. @item curves
  1087. With this option activated frequency response of anequalizer is displayed
  1088. in video stream.
  1089. @item size
  1090. Set video stream size. Only useful if curves option is activated.
  1091. @item mgain
  1092. Set max gain that will be displayed. Only useful if curves option is activated.
  1093. Setting this to a reasonable value makes it possible to display gain which is derived from
  1094. neighbour bands which are too close to each other and thus produce higher gain
  1095. when both are activated.
  1096. @item fscale
  1097. Set frequency scale used to draw frequency response in video output.
  1098. Can be linear or logarithmic. Default is logarithmic.
  1099. @item colors
  1100. Set color for each channel curve which is going to be displayed in video stream.
  1101. This is list of color names separated by space or by '|'.
  1102. Unrecognised or missing colors will be replaced by white color.
  1103. @end table
  1104. @subsection Examples
  1105. @itemize
  1106. @item
  1107. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1108. for first 2 channels using Chebyshev type 1 filter:
  1109. @example
  1110. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1111. @end example
  1112. @end itemize
  1113. @subsection Commands
  1114. This filter supports the following commands:
  1115. @table @option
  1116. @item change
  1117. Alter existing filter parameters.
  1118. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1119. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1120. error is returned.
  1121. @var{freq} set new frequency parameter.
  1122. @var{width} set new width parameter in herz.
  1123. @var{gain} set new gain parameter in dB.
  1124. Full filter invocation with asendcmd may look like this:
  1125. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1126. @end table
  1127. @section anull
  1128. Pass the audio source unchanged to the output.
  1129. @section apad
  1130. Pad the end of an audio stream with silence.
  1131. This can be used together with @command{ffmpeg} @option{-shortest} to
  1132. extend audio streams to the same length as the video stream.
  1133. A description of the accepted options follows.
  1134. @table @option
  1135. @item packet_size
  1136. Set silence packet size. Default value is 4096.
  1137. @item pad_len
  1138. Set the number of samples of silence to add to the end. After the
  1139. value is reached, the stream is terminated. This option is mutually
  1140. exclusive with @option{whole_len}.
  1141. @item whole_len
  1142. Set the minimum total number of samples in the output audio stream. If
  1143. the value is longer than the input audio length, silence is added to
  1144. the end, until the value is reached. This option is mutually exclusive
  1145. with @option{pad_len}.
  1146. @end table
  1147. If neither the @option{pad_len} nor the @option{whole_len} option is
  1148. set, the filter will add silence to the end of the input stream
  1149. indefinitely.
  1150. @subsection Examples
  1151. @itemize
  1152. @item
  1153. Add 1024 samples of silence to the end of the input:
  1154. @example
  1155. apad=pad_len=1024
  1156. @end example
  1157. @item
  1158. Make sure the audio output will contain at least 10000 samples, pad
  1159. the input with silence if required:
  1160. @example
  1161. apad=whole_len=10000
  1162. @end example
  1163. @item
  1164. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1165. video stream will always result the shortest and will be converted
  1166. until the end in the output file when using the @option{shortest}
  1167. option:
  1168. @example
  1169. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1170. @end example
  1171. @end itemize
  1172. @section aphaser
  1173. Add a phasing effect to the input audio.
  1174. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1175. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1176. A description of the accepted parameters follows.
  1177. @table @option
  1178. @item in_gain
  1179. Set input gain. Default is 0.4.
  1180. @item out_gain
  1181. Set output gain. Default is 0.74
  1182. @item delay
  1183. Set delay in milliseconds. Default is 3.0.
  1184. @item decay
  1185. Set decay. Default is 0.4.
  1186. @item speed
  1187. Set modulation speed in Hz. Default is 0.5.
  1188. @item type
  1189. Set modulation type. Default is triangular.
  1190. It accepts the following values:
  1191. @table @samp
  1192. @item triangular, t
  1193. @item sinusoidal, s
  1194. @end table
  1195. @end table
  1196. @section apulsator
  1197. Audio pulsator is something between an autopanner and a tremolo.
  1198. But it can produce funny stereo effects as well. Pulsator changes the volume
  1199. of the left and right channel based on a LFO (low frequency oscillator) with
  1200. different waveforms and shifted phases.
  1201. This filter have the ability to define an offset between left and right
  1202. channel. An offset of 0 means that both LFO shapes match each other.
  1203. The left and right channel are altered equally - a conventional tremolo.
  1204. An offset of 50% means that the shape of the right channel is exactly shifted
  1205. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1206. an autopanner. At 1 both curves match again. Every setting in between moves the
  1207. phase shift gapless between all stages and produces some "bypassing" sounds with
  1208. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1209. the 0.5) the faster the signal passes from the left to the right speaker.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item level_in
  1213. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1214. @item level_out
  1215. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1216. @item mode
  1217. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1218. sawup or sawdown. Default is sine.
  1219. @item amount
  1220. Set modulation. Define how much of original signal is affected by the LFO.
  1221. @item offset_l
  1222. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1223. @item offset_r
  1224. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1225. @item width
  1226. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1227. @item timing
  1228. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1229. @item bpm
  1230. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1231. is set to bpm.
  1232. @item ms
  1233. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1234. is set to ms.
  1235. @item hz
  1236. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1237. if timing is set to hz.
  1238. @end table
  1239. @anchor{aresample}
  1240. @section aresample
  1241. Resample the input audio to the specified parameters, using the
  1242. libswresample library. If none are specified then the filter will
  1243. automatically convert between its input and output.
  1244. This filter is also able to stretch/squeeze the audio data to make it match
  1245. the timestamps or to inject silence / cut out audio to make it match the
  1246. timestamps, do a combination of both or do neither.
  1247. The filter accepts the syntax
  1248. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1249. expresses a sample rate and @var{resampler_options} is a list of
  1250. @var{key}=@var{value} pairs, separated by ":". See the
  1251. @ref{Resampler Options,,"Resampler Options" section in the
  1252. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1253. for the complete list of supported options.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Resample the input audio to 44100Hz:
  1258. @example
  1259. aresample=44100
  1260. @end example
  1261. @item
  1262. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1263. samples per second compensation:
  1264. @example
  1265. aresample=async=1000
  1266. @end example
  1267. @end itemize
  1268. @section areverse
  1269. Reverse an audio clip.
  1270. Warning: This filter requires memory to buffer the entire clip, so trimming
  1271. is suggested.
  1272. @subsection Examples
  1273. @itemize
  1274. @item
  1275. Take the first 5 seconds of a clip, and reverse it.
  1276. @example
  1277. atrim=end=5,areverse
  1278. @end example
  1279. @end itemize
  1280. @section asetnsamples
  1281. Set the number of samples per each output audio frame.
  1282. The last output packet may contain a different number of samples, as
  1283. the filter will flush all the remaining samples when the input audio
  1284. signals its end.
  1285. The filter accepts the following options:
  1286. @table @option
  1287. @item nb_out_samples, n
  1288. Set the number of frames per each output audio frame. The number is
  1289. intended as the number of samples @emph{per each channel}.
  1290. Default value is 1024.
  1291. @item pad, p
  1292. If set to 1, the filter will pad the last audio frame with zeroes, so
  1293. that the last frame will contain the same number of samples as the
  1294. previous ones. Default value is 1.
  1295. @end table
  1296. For example, to set the number of per-frame samples to 1234 and
  1297. disable padding for the last frame, use:
  1298. @example
  1299. asetnsamples=n=1234:p=0
  1300. @end example
  1301. @section asetrate
  1302. Set the sample rate without altering the PCM data.
  1303. This will result in a change of speed and pitch.
  1304. The filter accepts the following options:
  1305. @table @option
  1306. @item sample_rate, r
  1307. Set the output sample rate. Default is 44100 Hz.
  1308. @end table
  1309. @section ashowinfo
  1310. Show a line containing various information for each input audio frame.
  1311. The input audio is not modified.
  1312. The shown line contains a sequence of key/value pairs of the form
  1313. @var{key}:@var{value}.
  1314. The following values are shown in the output:
  1315. @table @option
  1316. @item n
  1317. The (sequential) number of the input frame, starting from 0.
  1318. @item pts
  1319. The presentation timestamp of the input frame, in time base units; the time base
  1320. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1321. @item pts_time
  1322. The presentation timestamp of the input frame in seconds.
  1323. @item pos
  1324. position of the frame in the input stream, -1 if this information in
  1325. unavailable and/or meaningless (for example in case of synthetic audio)
  1326. @item fmt
  1327. The sample format.
  1328. @item chlayout
  1329. The channel layout.
  1330. @item rate
  1331. The sample rate for the audio frame.
  1332. @item nb_samples
  1333. The number of samples (per channel) in the frame.
  1334. @item checksum
  1335. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1336. audio, the data is treated as if all the planes were concatenated.
  1337. @item plane_checksums
  1338. A list of Adler-32 checksums for each data plane.
  1339. @end table
  1340. @anchor{astats}
  1341. @section astats
  1342. Display time domain statistical information about the audio channels.
  1343. Statistics are calculated and displayed for each audio channel and,
  1344. where applicable, an overall figure is also given.
  1345. It accepts the following option:
  1346. @table @option
  1347. @item length
  1348. Short window length in seconds, used for peak and trough RMS measurement.
  1349. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1350. @item metadata
  1351. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1352. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1353. disabled.
  1354. Available keys for each channel are:
  1355. DC_offset
  1356. Min_level
  1357. Max_level
  1358. Min_difference
  1359. Max_difference
  1360. Mean_difference
  1361. RMS_difference
  1362. Peak_level
  1363. RMS_peak
  1364. RMS_trough
  1365. Crest_factor
  1366. Flat_factor
  1367. Peak_count
  1368. Bit_depth
  1369. Dynamic_range
  1370. and for Overall:
  1371. DC_offset
  1372. Min_level
  1373. Max_level
  1374. Min_difference
  1375. Max_difference
  1376. Mean_difference
  1377. RMS_difference
  1378. Peak_level
  1379. RMS_level
  1380. RMS_peak
  1381. RMS_trough
  1382. Flat_factor
  1383. Peak_count
  1384. Bit_depth
  1385. Number_of_samples
  1386. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1387. this @code{lavfi.astats.Overall.Peak_count}.
  1388. For description what each key means read below.
  1389. @item reset
  1390. Set number of frame after which stats are going to be recalculated.
  1391. Default is disabled.
  1392. @end table
  1393. A description of each shown parameter follows:
  1394. @table @option
  1395. @item DC offset
  1396. Mean amplitude displacement from zero.
  1397. @item Min level
  1398. Minimal sample level.
  1399. @item Max level
  1400. Maximal sample level.
  1401. @item Min difference
  1402. Minimal difference between two consecutive samples.
  1403. @item Max difference
  1404. Maximal difference between two consecutive samples.
  1405. @item Mean difference
  1406. Mean difference between two consecutive samples.
  1407. The average of each difference between two consecutive samples.
  1408. @item RMS difference
  1409. Root Mean Square difference between two consecutive samples.
  1410. @item Peak level dB
  1411. @item RMS level dB
  1412. Standard peak and RMS level measured in dBFS.
  1413. @item RMS peak dB
  1414. @item RMS trough dB
  1415. Peak and trough values for RMS level measured over a short window.
  1416. @item Crest factor
  1417. Standard ratio of peak to RMS level (note: not in dB).
  1418. @item Flat factor
  1419. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1420. (i.e. either @var{Min level} or @var{Max level}).
  1421. @item Peak count
  1422. Number of occasions (not the number of samples) that the signal attained either
  1423. @var{Min level} or @var{Max level}.
  1424. @item Bit depth
  1425. Overall bit depth of audio. Number of bits used for each sample.
  1426. @item Dynamic range
  1427. Measured dynamic range of audio in dB.
  1428. @end table
  1429. @section atempo
  1430. Adjust audio tempo.
  1431. The filter accepts exactly one parameter, the audio tempo. If not
  1432. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1433. be in the [0.5, 2.0] range.
  1434. @subsection Examples
  1435. @itemize
  1436. @item
  1437. Slow down audio to 80% tempo:
  1438. @example
  1439. atempo=0.8
  1440. @end example
  1441. @item
  1442. To speed up audio to 125% tempo:
  1443. @example
  1444. atempo=1.25
  1445. @end example
  1446. @end itemize
  1447. @section atrim
  1448. Trim the input so that the output contains one continuous subpart of the input.
  1449. It accepts the following parameters:
  1450. @table @option
  1451. @item start
  1452. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1453. sample with the timestamp @var{start} will be the first sample in the output.
  1454. @item end
  1455. Specify time of the first audio sample that will be dropped, i.e. the
  1456. audio sample immediately preceding the one with the timestamp @var{end} will be
  1457. the last sample in the output.
  1458. @item start_pts
  1459. Same as @var{start}, except this option sets the start timestamp in samples
  1460. instead of seconds.
  1461. @item end_pts
  1462. Same as @var{end}, except this option sets the end timestamp in samples instead
  1463. of seconds.
  1464. @item duration
  1465. The maximum duration of the output in seconds.
  1466. @item start_sample
  1467. The number of the first sample that should be output.
  1468. @item end_sample
  1469. The number of the first sample that should be dropped.
  1470. @end table
  1471. @option{start}, @option{end}, and @option{duration} are expressed as time
  1472. duration specifications; see
  1473. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1474. Note that the first two sets of the start/end options and the @option{duration}
  1475. option look at the frame timestamp, while the _sample options simply count the
  1476. samples that pass through the filter. So start/end_pts and start/end_sample will
  1477. give different results when the timestamps are wrong, inexact or do not start at
  1478. zero. Also note that this filter does not modify the timestamps. If you wish
  1479. to have the output timestamps start at zero, insert the asetpts filter after the
  1480. atrim filter.
  1481. If multiple start or end options are set, this filter tries to be greedy and
  1482. keep all samples that match at least one of the specified constraints. To keep
  1483. only the part that matches all the constraints at once, chain multiple atrim
  1484. filters.
  1485. The defaults are such that all the input is kept. So it is possible to set e.g.
  1486. just the end values to keep everything before the specified time.
  1487. Examples:
  1488. @itemize
  1489. @item
  1490. Drop everything except the second minute of input:
  1491. @example
  1492. ffmpeg -i INPUT -af atrim=60:120
  1493. @end example
  1494. @item
  1495. Keep only the first 1000 samples:
  1496. @example
  1497. ffmpeg -i INPUT -af atrim=end_sample=1000
  1498. @end example
  1499. @end itemize
  1500. @section bandpass
  1501. Apply a two-pole Butterworth band-pass filter with central
  1502. frequency @var{frequency}, and (3dB-point) band-width width.
  1503. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1504. instead of the default: constant 0dB peak gain.
  1505. The filter roll off at 6dB per octave (20dB per decade).
  1506. The filter accepts the following options:
  1507. @table @option
  1508. @item frequency, f
  1509. Set the filter's central frequency. Default is @code{3000}.
  1510. @item csg
  1511. Constant skirt gain if set to 1. Defaults to 0.
  1512. @item width_type, t
  1513. Set method to specify band-width of filter.
  1514. @table @option
  1515. @item h
  1516. Hz
  1517. @item q
  1518. Q-Factor
  1519. @item o
  1520. octave
  1521. @item s
  1522. slope
  1523. @item k
  1524. kHz
  1525. @end table
  1526. @item width, w
  1527. Specify the band-width of a filter in width_type units.
  1528. @item channels, c
  1529. Specify which channels to filter, by default all available are filtered.
  1530. @end table
  1531. @subsection Commands
  1532. This filter supports the following commands:
  1533. @table @option
  1534. @item frequency, f
  1535. Change bandpass frequency.
  1536. Syntax for the command is : "@var{frequency}"
  1537. @item width_type, t
  1538. Change bandpass width_type.
  1539. Syntax for the command is : "@var{width_type}"
  1540. @item width, w
  1541. Change bandpass width.
  1542. Syntax for the command is : "@var{width}"
  1543. @end table
  1544. @section bandreject
  1545. Apply a two-pole Butterworth band-reject filter with central
  1546. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1547. The filter roll off at 6dB per octave (20dB per decade).
  1548. The filter accepts the following options:
  1549. @table @option
  1550. @item frequency, f
  1551. Set the filter's central frequency. Default is @code{3000}.
  1552. @item width_type, t
  1553. Set method to specify band-width of filter.
  1554. @table @option
  1555. @item h
  1556. Hz
  1557. @item q
  1558. Q-Factor
  1559. @item o
  1560. octave
  1561. @item s
  1562. slope
  1563. @item k
  1564. kHz
  1565. @end table
  1566. @item width, w
  1567. Specify the band-width of a filter in width_type units.
  1568. @item channels, c
  1569. Specify which channels to filter, by default all available are filtered.
  1570. @end table
  1571. @subsection Commands
  1572. This filter supports the following commands:
  1573. @table @option
  1574. @item frequency, f
  1575. Change bandreject frequency.
  1576. Syntax for the command is : "@var{frequency}"
  1577. @item width_type, t
  1578. Change bandreject width_type.
  1579. Syntax for the command is : "@var{width_type}"
  1580. @item width, w
  1581. Change bandreject width.
  1582. Syntax for the command is : "@var{width}"
  1583. @end table
  1584. @section bass, lowshelf
  1585. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1586. shelving filter with a response similar to that of a standard
  1587. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1588. The filter accepts the following options:
  1589. @table @option
  1590. @item gain, g
  1591. Give the gain at 0 Hz. Its useful range is about -20
  1592. (for a large cut) to +20 (for a large boost).
  1593. Beware of clipping when using a positive gain.
  1594. @item frequency, f
  1595. Set the filter's central frequency and so can be used
  1596. to extend or reduce the frequency range to be boosted or cut.
  1597. The default value is @code{100} Hz.
  1598. @item width_type, t
  1599. Set method to specify band-width of filter.
  1600. @table @option
  1601. @item h
  1602. Hz
  1603. @item q
  1604. Q-Factor
  1605. @item o
  1606. octave
  1607. @item s
  1608. slope
  1609. @item k
  1610. kHz
  1611. @end table
  1612. @item width, w
  1613. Determine how steep is the filter's shelf transition.
  1614. @item channels, c
  1615. Specify which channels to filter, by default all available are filtered.
  1616. @end table
  1617. @subsection Commands
  1618. This filter supports the following commands:
  1619. @table @option
  1620. @item frequency, f
  1621. Change bass frequency.
  1622. Syntax for the command is : "@var{frequency}"
  1623. @item width_type, t
  1624. Change bass width_type.
  1625. Syntax for the command is : "@var{width_type}"
  1626. @item width, w
  1627. Change bass width.
  1628. Syntax for the command is : "@var{width}"
  1629. @item gain, g
  1630. Change bass gain.
  1631. Syntax for the command is : "@var{gain}"
  1632. @end table
  1633. @section biquad
  1634. Apply a biquad IIR filter with the given coefficients.
  1635. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1636. are the numerator and denominator coefficients respectively.
  1637. and @var{channels}, @var{c} specify which channels to filter, by default all
  1638. available are filtered.
  1639. @subsection Commands
  1640. This filter supports the following commands:
  1641. @table @option
  1642. @item a0
  1643. @item a1
  1644. @item a2
  1645. @item b0
  1646. @item b1
  1647. @item b2
  1648. Change biquad parameter.
  1649. Syntax for the command is : "@var{value}"
  1650. @end table
  1651. @section bs2b
  1652. Bauer stereo to binaural transformation, which improves headphone listening of
  1653. stereo audio records.
  1654. To enable compilation of this filter you need to configure FFmpeg with
  1655. @code{--enable-libbs2b}.
  1656. It accepts the following parameters:
  1657. @table @option
  1658. @item profile
  1659. Pre-defined crossfeed level.
  1660. @table @option
  1661. @item default
  1662. Default level (fcut=700, feed=50).
  1663. @item cmoy
  1664. Chu Moy circuit (fcut=700, feed=60).
  1665. @item jmeier
  1666. Jan Meier circuit (fcut=650, feed=95).
  1667. @end table
  1668. @item fcut
  1669. Cut frequency (in Hz).
  1670. @item feed
  1671. Feed level (in Hz).
  1672. @end table
  1673. @section channelmap
  1674. Remap input channels to new locations.
  1675. It accepts the following parameters:
  1676. @table @option
  1677. @item map
  1678. Map channels from input to output. The argument is a '|'-separated list of
  1679. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1680. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1681. channel (e.g. FL for front left) or its index in the input channel layout.
  1682. @var{out_channel} is the name of the output channel or its index in the output
  1683. channel layout. If @var{out_channel} is not given then it is implicitly an
  1684. index, starting with zero and increasing by one for each mapping.
  1685. @item channel_layout
  1686. The channel layout of the output stream.
  1687. @end table
  1688. If no mapping is present, the filter will implicitly map input channels to
  1689. output channels, preserving indices.
  1690. @subsection Examples
  1691. @itemize
  1692. @item
  1693. For example, assuming a 5.1+downmix input MOV file,
  1694. @example
  1695. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1696. @end example
  1697. will create an output WAV file tagged as stereo from the downmix channels of
  1698. the input.
  1699. @item
  1700. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1701. @example
  1702. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1703. @end example
  1704. @end itemize
  1705. @section channelsplit
  1706. Split each channel from an input audio stream into a separate output stream.
  1707. It accepts the following parameters:
  1708. @table @option
  1709. @item channel_layout
  1710. The channel layout of the input stream. The default is "stereo".
  1711. @item channels
  1712. A channel layout describing the channels to be extracted as separate output streams
  1713. or "all" to extract each input channel as a separate stream. The default is "all".
  1714. Choosing channels not present in channel layout in the input will result in an error.
  1715. @end table
  1716. @subsection Examples
  1717. @itemize
  1718. @item
  1719. For example, assuming a stereo input MP3 file,
  1720. @example
  1721. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1722. @end example
  1723. will create an output Matroska file with two audio streams, one containing only
  1724. the left channel and the other the right channel.
  1725. @item
  1726. Split a 5.1 WAV file into per-channel files:
  1727. @example
  1728. ffmpeg -i in.wav -filter_complex
  1729. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1730. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1731. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1732. side_right.wav
  1733. @end example
  1734. @item
  1735. Extract only LFE from a 5.1 WAV file:
  1736. @example
  1737. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1738. -map '[LFE]' lfe.wav
  1739. @end example
  1740. @end itemize
  1741. @section chorus
  1742. Add a chorus effect to the audio.
  1743. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1744. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1745. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1746. The modulation depth defines the range the modulated delay is played before or after
  1747. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1748. sound tuned around the original one, like in a chorus where some vocals are slightly
  1749. off key.
  1750. It accepts the following parameters:
  1751. @table @option
  1752. @item in_gain
  1753. Set input gain. Default is 0.4.
  1754. @item out_gain
  1755. Set output gain. Default is 0.4.
  1756. @item delays
  1757. Set delays. A typical delay is around 40ms to 60ms.
  1758. @item decays
  1759. Set decays.
  1760. @item speeds
  1761. Set speeds.
  1762. @item depths
  1763. Set depths.
  1764. @end table
  1765. @subsection Examples
  1766. @itemize
  1767. @item
  1768. A single delay:
  1769. @example
  1770. chorus=0.7:0.9:55:0.4:0.25:2
  1771. @end example
  1772. @item
  1773. Two delays:
  1774. @example
  1775. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1776. @end example
  1777. @item
  1778. Fuller sounding chorus with three delays:
  1779. @example
  1780. 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
  1781. @end example
  1782. @end itemize
  1783. @section compand
  1784. Compress or expand the audio's dynamic range.
  1785. It accepts the following parameters:
  1786. @table @option
  1787. @item attacks
  1788. @item decays
  1789. A list of times in seconds for each channel over which the instantaneous level
  1790. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1791. increase of volume and @var{decays} refers to decrease of volume. For most
  1792. situations, the attack time (response to the audio getting louder) should be
  1793. shorter than the decay time, because the human ear is more sensitive to sudden
  1794. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1795. a typical value for decay is 0.8 seconds.
  1796. If specified number of attacks & decays is lower than number of channels, the last
  1797. set attack/decay will be used for all remaining channels.
  1798. @item points
  1799. A list of points for the transfer function, specified in dB relative to the
  1800. maximum possible signal amplitude. Each key points list must be defined using
  1801. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1802. @code{x0/y0 x1/y1 x2/y2 ....}
  1803. The input values must be in strictly increasing order but the transfer function
  1804. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1805. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1806. function are @code{-70/-70|-60/-20|1/0}.
  1807. @item soft-knee
  1808. Set the curve radius in dB for all joints. It defaults to 0.01.
  1809. @item gain
  1810. Set the additional gain in dB to be applied at all points on the transfer
  1811. function. This allows for easy adjustment of the overall gain.
  1812. It defaults to 0.
  1813. @item volume
  1814. Set an initial volume, in dB, to be assumed for each channel when filtering
  1815. starts. This permits the user to supply a nominal level initially, so that, for
  1816. example, a very large gain is not applied to initial signal levels before the
  1817. companding has begun to operate. A typical value for audio which is initially
  1818. quiet is -90 dB. It defaults to 0.
  1819. @item delay
  1820. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1821. delayed before being fed to the volume adjuster. Specifying a delay
  1822. approximately equal to the attack/decay times allows the filter to effectively
  1823. operate in predictive rather than reactive mode. It defaults to 0.
  1824. @end table
  1825. @subsection Examples
  1826. @itemize
  1827. @item
  1828. Make music with both quiet and loud passages suitable for listening to in a
  1829. noisy environment:
  1830. @example
  1831. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1832. @end example
  1833. Another example for audio with whisper and explosion parts:
  1834. @example
  1835. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1836. @end example
  1837. @item
  1838. A noise gate for when the noise is at a lower level than the signal:
  1839. @example
  1840. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1841. @end example
  1842. @item
  1843. Here is another noise gate, this time for when the noise is at a higher level
  1844. than the signal (making it, in some ways, similar to squelch):
  1845. @example
  1846. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1847. @end example
  1848. @item
  1849. 2:1 compression starting at -6dB:
  1850. @example
  1851. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1852. @end example
  1853. @item
  1854. 2:1 compression starting at -9dB:
  1855. @example
  1856. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1857. @end example
  1858. @item
  1859. 2:1 compression starting at -12dB:
  1860. @example
  1861. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1862. @end example
  1863. @item
  1864. 2:1 compression starting at -18dB:
  1865. @example
  1866. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1867. @end example
  1868. @item
  1869. 3:1 compression starting at -15dB:
  1870. @example
  1871. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1872. @end example
  1873. @item
  1874. Compressor/Gate:
  1875. @example
  1876. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1877. @end example
  1878. @item
  1879. Expander:
  1880. @example
  1881. 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
  1882. @end example
  1883. @item
  1884. Hard limiter at -6dB:
  1885. @example
  1886. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1887. @end example
  1888. @item
  1889. Hard limiter at -12dB:
  1890. @example
  1891. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1892. @end example
  1893. @item
  1894. Hard noise gate at -35 dB:
  1895. @example
  1896. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1897. @end example
  1898. @item
  1899. Soft limiter:
  1900. @example
  1901. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1902. @end example
  1903. @end itemize
  1904. @section compensationdelay
  1905. Compensation Delay Line is a metric based delay to compensate differing
  1906. positions of microphones or speakers.
  1907. For example, you have recorded guitar with two microphones placed in
  1908. different location. Because the front of sound wave has fixed speed in
  1909. normal conditions, the phasing of microphones can vary and depends on
  1910. their location and interposition. The best sound mix can be achieved when
  1911. these microphones are in phase (synchronized). Note that distance of
  1912. ~30 cm between microphones makes one microphone to capture signal in
  1913. antiphase to another microphone. That makes the final mix sounding moody.
  1914. This filter helps to solve phasing problems by adding different delays
  1915. to each microphone track and make them synchronized.
  1916. The best result can be reached when you take one track as base and
  1917. synchronize other tracks one by one with it.
  1918. Remember that synchronization/delay tolerance depends on sample rate, too.
  1919. Higher sample rates will give more tolerance.
  1920. It accepts the following parameters:
  1921. @table @option
  1922. @item mm
  1923. Set millimeters distance. This is compensation distance for fine tuning.
  1924. Default is 0.
  1925. @item cm
  1926. Set cm distance. This is compensation distance for tightening distance setup.
  1927. Default is 0.
  1928. @item m
  1929. Set meters distance. This is compensation distance for hard distance setup.
  1930. Default is 0.
  1931. @item dry
  1932. Set dry amount. Amount of unprocessed (dry) signal.
  1933. Default is 0.
  1934. @item wet
  1935. Set wet amount. Amount of processed (wet) signal.
  1936. Default is 1.
  1937. @item temp
  1938. Set temperature degree in Celsius. This is the temperature of the environment.
  1939. Default is 20.
  1940. @end table
  1941. @section crossfeed
  1942. Apply headphone crossfeed filter.
  1943. Crossfeed is the process of blending the left and right channels of stereo
  1944. audio recording.
  1945. It is mainly used to reduce extreme stereo separation of low frequencies.
  1946. The intent is to produce more speaker like sound to the listener.
  1947. The filter accepts the following options:
  1948. @table @option
  1949. @item strength
  1950. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1951. This sets gain of low shelf filter for side part of stereo image.
  1952. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1953. @item range
  1954. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1955. This sets cut off frequency of low shelf filter. Default is cut off near
  1956. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1957. @item level_in
  1958. Set input gain. Default is 0.9.
  1959. @item level_out
  1960. Set output gain. Default is 1.
  1961. @end table
  1962. @section crystalizer
  1963. Simple algorithm to expand audio dynamic range.
  1964. The filter accepts the following options:
  1965. @table @option
  1966. @item i
  1967. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1968. (unchanged sound) to 10.0 (maximum effect).
  1969. @item c
  1970. Enable clipping. By default is enabled.
  1971. @end table
  1972. @section dcshift
  1973. Apply a DC shift to the audio.
  1974. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1975. in the recording chain) from the audio. The effect of a DC offset is reduced
  1976. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1977. a signal has a DC offset.
  1978. @table @option
  1979. @item shift
  1980. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1981. the audio.
  1982. @item limitergain
  1983. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1984. used to prevent clipping.
  1985. @end table
  1986. @section drmeter
  1987. Measure audio dynamic range.
  1988. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1989. is found in transition material. And anything less that 8 have very poor dynamics
  1990. and is very compressed.
  1991. The filter accepts the following options:
  1992. @table @option
  1993. @item length
  1994. Set window length in seconds used to split audio into segments of equal length.
  1995. Default is 3 seconds.
  1996. @end table
  1997. @section dynaudnorm
  1998. Dynamic Audio Normalizer.
  1999. This filter applies a certain amount of gain to the input audio in order
  2000. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2001. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2002. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2003. This allows for applying extra gain to the "quiet" sections of the audio
  2004. while avoiding distortions or clipping the "loud" sections. In other words:
  2005. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2006. sections, in the sense that the volume of each section is brought to the
  2007. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2008. this goal *without* applying "dynamic range compressing". It will retain 100%
  2009. of the dynamic range *within* each section of the audio file.
  2010. @table @option
  2011. @item f
  2012. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2013. Default is 500 milliseconds.
  2014. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2015. referred to as frames. This is required, because a peak magnitude has no
  2016. meaning for just a single sample value. Instead, we need to determine the
  2017. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2018. normalizer would simply use the peak magnitude of the complete file, the
  2019. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2020. frame. The length of a frame is specified in milliseconds. By default, the
  2021. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2022. been found to give good results with most files.
  2023. Note that the exact frame length, in number of samples, will be determined
  2024. automatically, based on the sampling rate of the individual input audio file.
  2025. @item g
  2026. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2027. number. Default is 31.
  2028. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2029. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2030. is specified in frames, centered around the current frame. For the sake of
  2031. simplicity, this must be an odd number. Consequently, the default value of 31
  2032. takes into account the current frame, as well as the 15 preceding frames and
  2033. the 15 subsequent frames. Using a larger window results in a stronger
  2034. smoothing effect and thus in less gain variation, i.e. slower gain
  2035. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2036. effect and thus in more gain variation, i.e. faster gain adaptation.
  2037. In other words, the more you increase this value, the more the Dynamic Audio
  2038. Normalizer will behave like a "traditional" normalization filter. On the
  2039. contrary, the more you decrease this value, the more the Dynamic Audio
  2040. Normalizer will behave like a dynamic range compressor.
  2041. @item p
  2042. Set the target peak value. This specifies the highest permissible magnitude
  2043. level for the normalized audio input. This filter will try to approach the
  2044. target peak magnitude as closely as possible, but at the same time it also
  2045. makes sure that the normalized signal will never exceed the peak magnitude.
  2046. A frame's maximum local gain factor is imposed directly by the target peak
  2047. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2048. It is not recommended to go above this value.
  2049. @item m
  2050. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2051. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2052. factor for each input frame, i.e. the maximum gain factor that does not
  2053. result in clipping or distortion. The maximum gain factor is determined by
  2054. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2055. additionally bounds the frame's maximum gain factor by a predetermined
  2056. (global) maximum gain factor. This is done in order to avoid excessive gain
  2057. factors in "silent" or almost silent frames. By default, the maximum gain
  2058. factor is 10.0, For most inputs the default value should be sufficient and
  2059. it usually is not recommended to increase this value. Though, for input
  2060. with an extremely low overall volume level, it may be necessary to allow even
  2061. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2062. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2063. Instead, a "sigmoid" threshold function will be applied. This way, the
  2064. gain factors will smoothly approach the threshold value, but never exceed that
  2065. value.
  2066. @item r
  2067. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2068. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2069. This means that the maximum local gain factor for each frame is defined
  2070. (only) by the frame's highest magnitude sample. This way, the samples can
  2071. be amplified as much as possible without exceeding the maximum signal
  2072. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2073. Normalizer can also take into account the frame's root mean square,
  2074. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2075. determine the power of a time-varying signal. It is therefore considered
  2076. that the RMS is a better approximation of the "perceived loudness" than
  2077. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2078. frames to a constant RMS value, a uniform "perceived loudness" can be
  2079. established. If a target RMS value has been specified, a frame's local gain
  2080. factor is defined as the factor that would result in exactly that RMS value.
  2081. Note, however, that the maximum local gain factor is still restricted by the
  2082. frame's highest magnitude sample, in order to prevent clipping.
  2083. @item n
  2084. Enable channels coupling. By default is enabled.
  2085. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2086. amount. This means the same gain factor will be applied to all channels, i.e.
  2087. the maximum possible gain factor is determined by the "loudest" channel.
  2088. However, in some recordings, it may happen that the volume of the different
  2089. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2090. In this case, this option can be used to disable the channel coupling. This way,
  2091. the gain factor will be determined independently for each channel, depending
  2092. only on the individual channel's highest magnitude sample. This allows for
  2093. harmonizing the volume of the different channels.
  2094. @item c
  2095. Enable DC bias correction. By default is disabled.
  2096. An audio signal (in the time domain) is a sequence of sample values.
  2097. In the Dynamic Audio Normalizer these sample values are represented in the
  2098. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2099. audio signal, or "waveform", should be centered around the zero point.
  2100. That means if we calculate the mean value of all samples in a file, or in a
  2101. single frame, then the result should be 0.0 or at least very close to that
  2102. value. If, however, there is a significant deviation of the mean value from
  2103. 0.0, in either positive or negative direction, this is referred to as a
  2104. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2105. Audio Normalizer provides optional DC bias correction.
  2106. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2107. the mean value, or "DC correction" offset, of each input frame and subtract
  2108. that value from all of the frame's sample values which ensures those samples
  2109. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2110. boundaries, the DC correction offset values will be interpolated smoothly
  2111. between neighbouring frames.
  2112. @item b
  2113. Enable alternative boundary mode. By default is disabled.
  2114. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2115. around each frame. This includes the preceding frames as well as the
  2116. subsequent frames. However, for the "boundary" frames, located at the very
  2117. beginning and at the very end of the audio file, not all neighbouring
  2118. frames are available. In particular, for the first few frames in the audio
  2119. file, the preceding frames are not known. And, similarly, for the last few
  2120. frames in the audio file, the subsequent frames are not known. Thus, the
  2121. question arises which gain factors should be assumed for the missing frames
  2122. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2123. to deal with this situation. The default boundary mode assumes a gain factor
  2124. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2125. "fade out" at the beginning and at the end of the input, respectively.
  2126. @item s
  2127. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2128. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2129. compression. This means that signal peaks will not be pruned and thus the
  2130. full dynamic range will be retained within each local neighbourhood. However,
  2131. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2132. normalization algorithm with a more "traditional" compression.
  2133. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2134. (thresholding) function. If (and only if) the compression feature is enabled,
  2135. all input frames will be processed by a soft knee thresholding function prior
  2136. to the actual normalization process. Put simply, the thresholding function is
  2137. going to prune all samples whose magnitude exceeds a certain threshold value.
  2138. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2139. value. Instead, the threshold value will be adjusted for each individual
  2140. frame.
  2141. In general, smaller parameters result in stronger compression, and vice versa.
  2142. Values below 3.0 are not recommended, because audible distortion may appear.
  2143. @end table
  2144. @section earwax
  2145. Make audio easier to listen to on headphones.
  2146. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2147. so that when listened to on headphones the stereo image is moved from
  2148. inside your head (standard for headphones) to outside and in front of
  2149. the listener (standard for speakers).
  2150. Ported from SoX.
  2151. @section equalizer
  2152. Apply a two-pole peaking equalisation (EQ) filter. With this
  2153. filter, the signal-level at and around a selected frequency can
  2154. be increased or decreased, whilst (unlike bandpass and bandreject
  2155. filters) that at all other frequencies is unchanged.
  2156. In order to produce complex equalisation curves, this filter can
  2157. be given several times, each with a different central frequency.
  2158. The filter accepts the following options:
  2159. @table @option
  2160. @item frequency, f
  2161. Set the filter's central frequency in Hz.
  2162. @item width_type, t
  2163. Set method to specify band-width of filter.
  2164. @table @option
  2165. @item h
  2166. Hz
  2167. @item q
  2168. Q-Factor
  2169. @item o
  2170. octave
  2171. @item s
  2172. slope
  2173. @item k
  2174. kHz
  2175. @end table
  2176. @item width, w
  2177. Specify the band-width of a filter in width_type units.
  2178. @item gain, g
  2179. Set the required gain or attenuation in dB.
  2180. Beware of clipping when using a positive gain.
  2181. @item channels, c
  2182. Specify which channels to filter, by default all available are filtered.
  2183. @end table
  2184. @subsection Examples
  2185. @itemize
  2186. @item
  2187. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2188. @example
  2189. equalizer=f=1000:t=h:width=200:g=-10
  2190. @end example
  2191. @item
  2192. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2193. @example
  2194. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2195. @end example
  2196. @end itemize
  2197. @subsection Commands
  2198. This filter supports the following commands:
  2199. @table @option
  2200. @item frequency, f
  2201. Change equalizer frequency.
  2202. Syntax for the command is : "@var{frequency}"
  2203. @item width_type, t
  2204. Change equalizer width_type.
  2205. Syntax for the command is : "@var{width_type}"
  2206. @item width, w
  2207. Change equalizer width.
  2208. Syntax for the command is : "@var{width}"
  2209. @item gain, g
  2210. Change equalizer gain.
  2211. Syntax for the command is : "@var{gain}"
  2212. @end table
  2213. @section extrastereo
  2214. Linearly increases the difference between left and right channels which
  2215. adds some sort of "live" effect to playback.
  2216. The filter accepts the following options:
  2217. @table @option
  2218. @item m
  2219. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2220. (average of both channels), with 1.0 sound will be unchanged, with
  2221. -1.0 left and right channels will be swapped.
  2222. @item c
  2223. Enable clipping. By default is enabled.
  2224. @end table
  2225. @section firequalizer
  2226. Apply FIR Equalization using arbitrary frequency response.
  2227. The filter accepts the following option:
  2228. @table @option
  2229. @item gain
  2230. Set gain curve equation (in dB). The expression can contain variables:
  2231. @table @option
  2232. @item f
  2233. the evaluated frequency
  2234. @item sr
  2235. sample rate
  2236. @item ch
  2237. channel number, set to 0 when multichannels evaluation is disabled
  2238. @item chid
  2239. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2240. multichannels evaluation is disabled
  2241. @item chs
  2242. number of channels
  2243. @item chlayout
  2244. channel_layout, see libavutil/channel_layout.h
  2245. @end table
  2246. and functions:
  2247. @table @option
  2248. @item gain_interpolate(f)
  2249. interpolate gain on frequency f based on gain_entry
  2250. @item cubic_interpolate(f)
  2251. same as gain_interpolate, but smoother
  2252. @end table
  2253. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2254. @item gain_entry
  2255. Set gain entry for gain_interpolate function. The expression can
  2256. contain functions:
  2257. @table @option
  2258. @item entry(f, g)
  2259. store gain entry at frequency f with value g
  2260. @end table
  2261. This option is also available as command.
  2262. @item delay
  2263. Set filter delay in seconds. Higher value means more accurate.
  2264. Default is @code{0.01}.
  2265. @item accuracy
  2266. Set filter accuracy in Hz. Lower value means more accurate.
  2267. Default is @code{5}.
  2268. @item wfunc
  2269. Set window function. Acceptable values are:
  2270. @table @option
  2271. @item rectangular
  2272. rectangular window, useful when gain curve is already smooth
  2273. @item hann
  2274. hann window (default)
  2275. @item hamming
  2276. hamming window
  2277. @item blackman
  2278. blackman window
  2279. @item nuttall3
  2280. 3-terms continuous 1st derivative nuttall window
  2281. @item mnuttall3
  2282. minimum 3-terms discontinuous nuttall window
  2283. @item nuttall
  2284. 4-terms continuous 1st derivative nuttall window
  2285. @item bnuttall
  2286. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2287. @item bharris
  2288. blackman-harris window
  2289. @item tukey
  2290. tukey window
  2291. @end table
  2292. @item fixed
  2293. If enabled, use fixed number of audio samples. This improves speed when
  2294. filtering with large delay. Default is disabled.
  2295. @item multi
  2296. Enable multichannels evaluation on gain. Default is disabled.
  2297. @item zero_phase
  2298. Enable zero phase mode by subtracting timestamp to compensate delay.
  2299. Default is disabled.
  2300. @item scale
  2301. Set scale used by gain. Acceptable values are:
  2302. @table @option
  2303. @item linlin
  2304. linear frequency, linear gain
  2305. @item linlog
  2306. linear frequency, logarithmic (in dB) gain (default)
  2307. @item loglin
  2308. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2309. @item loglog
  2310. logarithmic frequency, logarithmic gain
  2311. @end table
  2312. @item dumpfile
  2313. Set file for dumping, suitable for gnuplot.
  2314. @item dumpscale
  2315. Set scale for dumpfile. Acceptable values are same with scale option.
  2316. Default is linlog.
  2317. @item fft2
  2318. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2319. Default is disabled.
  2320. @item min_phase
  2321. Enable minimum phase impulse response. Default is disabled.
  2322. @end table
  2323. @subsection Examples
  2324. @itemize
  2325. @item
  2326. lowpass at 1000 Hz:
  2327. @example
  2328. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2329. @end example
  2330. @item
  2331. lowpass at 1000 Hz with gain_entry:
  2332. @example
  2333. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2334. @end example
  2335. @item
  2336. custom equalization:
  2337. @example
  2338. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2339. @end example
  2340. @item
  2341. higher delay with zero phase to compensate delay:
  2342. @example
  2343. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2344. @end example
  2345. @item
  2346. lowpass on left channel, highpass on right channel:
  2347. @example
  2348. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2349. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2350. @end example
  2351. @end itemize
  2352. @section flanger
  2353. Apply a flanging effect to the audio.
  2354. The filter accepts the following options:
  2355. @table @option
  2356. @item delay
  2357. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2358. @item depth
  2359. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2360. @item regen
  2361. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2362. Default value is 0.
  2363. @item width
  2364. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2365. Default value is 71.
  2366. @item speed
  2367. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2368. @item shape
  2369. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2370. Default value is @var{sinusoidal}.
  2371. @item phase
  2372. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2373. Default value is 25.
  2374. @item interp
  2375. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2376. Default is @var{linear}.
  2377. @end table
  2378. @section haas
  2379. Apply Haas effect to audio.
  2380. Note that this makes most sense to apply on mono signals.
  2381. With this filter applied to mono signals it give some directionality and
  2382. stretches its stereo image.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item level_in
  2386. Set input level. By default is @var{1}, or 0dB
  2387. @item level_out
  2388. Set output level. By default is @var{1}, or 0dB.
  2389. @item side_gain
  2390. Set gain applied to side part of signal. By default is @var{1}.
  2391. @item middle_source
  2392. Set kind of middle source. Can be one of the following:
  2393. @table @samp
  2394. @item left
  2395. Pick left channel.
  2396. @item right
  2397. Pick right channel.
  2398. @item mid
  2399. Pick middle part signal of stereo image.
  2400. @item side
  2401. Pick side part signal of stereo image.
  2402. @end table
  2403. @item middle_phase
  2404. Change middle phase. By default is disabled.
  2405. @item left_delay
  2406. Set left channel delay. By default is @var{2.05} milliseconds.
  2407. @item left_balance
  2408. Set left channel balance. By default is @var{-1}.
  2409. @item left_gain
  2410. Set left channel gain. By default is @var{1}.
  2411. @item left_phase
  2412. Change left phase. By default is disabled.
  2413. @item right_delay
  2414. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2415. @item right_balance
  2416. Set right channel balance. By default is @var{1}.
  2417. @item right_gain
  2418. Set right channel gain. By default is @var{1}.
  2419. @item right_phase
  2420. Change right phase. By default is enabled.
  2421. @end table
  2422. @section hdcd
  2423. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2424. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2425. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2426. of HDCD, and detects the Transient Filter flag.
  2427. @example
  2428. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2429. @end example
  2430. When using the filter with wav, note the default encoding for wav is 16-bit,
  2431. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2432. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2433. @example
  2434. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2435. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2436. @end example
  2437. The filter accepts the following options:
  2438. @table @option
  2439. @item disable_autoconvert
  2440. Disable any automatic format conversion or resampling in the filter graph.
  2441. @item process_stereo
  2442. Process the stereo channels together. If target_gain does not match between
  2443. channels, consider it invalid and use the last valid target_gain.
  2444. @item cdt_ms
  2445. Set the code detect timer period in ms.
  2446. @item force_pe
  2447. Always extend peaks above -3dBFS even if PE isn't signaled.
  2448. @item analyze_mode
  2449. Replace audio with a solid tone and adjust the amplitude to signal some
  2450. specific aspect of the decoding process. The output file can be loaded in
  2451. an audio editor alongside the original to aid analysis.
  2452. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2453. Modes are:
  2454. @table @samp
  2455. @item 0, off
  2456. Disabled
  2457. @item 1, lle
  2458. Gain adjustment level at each sample
  2459. @item 2, pe
  2460. Samples where peak extend occurs
  2461. @item 3, cdt
  2462. Samples where the code detect timer is active
  2463. @item 4, tgm
  2464. Samples where the target gain does not match between channels
  2465. @end table
  2466. @end table
  2467. @section headphone
  2468. Apply head-related transfer functions (HRTFs) to create virtual
  2469. loudspeakers around the user for binaural listening via headphones.
  2470. The HRIRs are provided via additional streams, for each channel
  2471. one stereo input stream is needed.
  2472. The filter accepts the following options:
  2473. @table @option
  2474. @item map
  2475. Set mapping of input streams for convolution.
  2476. The argument is a '|'-separated list of channel names in order as they
  2477. are given as additional stream inputs for filter.
  2478. This also specify number of input streams. Number of input streams
  2479. must be not less than number of channels in first stream plus one.
  2480. @item gain
  2481. Set gain applied to audio. Value is in dB. Default is 0.
  2482. @item type
  2483. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2484. processing audio in time domain which is slow.
  2485. @var{freq} is processing audio in frequency domain which is fast.
  2486. Default is @var{freq}.
  2487. @item lfe
  2488. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2489. @item size
  2490. Set size of frame in number of samples which will be processed at once.
  2491. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2492. @item hrir
  2493. Set format of hrir stream.
  2494. Default value is @var{stereo}. Alternative value is @var{multich}.
  2495. If value is set to @var{stereo}, number of additional streams should
  2496. be greater or equal to number of input channels in first input stream.
  2497. Also each additional stream should have stereo number of channels.
  2498. If value is set to @var{multich}, number of additional streams should
  2499. be exactly one. Also number of input channels of additional stream
  2500. should be equal or greater than twice number of channels of first input
  2501. stream.
  2502. @end table
  2503. @subsection Examples
  2504. @itemize
  2505. @item
  2506. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2507. each amovie filter use stereo file with IR coefficients as input.
  2508. The files give coefficients for each position of virtual loudspeaker:
  2509. @example
  2510. 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"
  2511. output.wav
  2512. @end example
  2513. @item
  2514. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2515. but now in @var{multich} @var{hrir} format.
  2516. @example
  2517. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2518. output.wav
  2519. @end example
  2520. @end itemize
  2521. @section highpass
  2522. Apply a high-pass filter with 3dB point frequency.
  2523. The filter can be either single-pole, or double-pole (the default).
  2524. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item frequency, f
  2528. Set frequency in Hz. Default is 3000.
  2529. @item poles, p
  2530. Set number of poles. Default is 2.
  2531. @item width_type, t
  2532. Set method to specify band-width of filter.
  2533. @table @option
  2534. @item h
  2535. Hz
  2536. @item q
  2537. Q-Factor
  2538. @item o
  2539. octave
  2540. @item s
  2541. slope
  2542. @item k
  2543. kHz
  2544. @end table
  2545. @item width, w
  2546. Specify the band-width of a filter in width_type units.
  2547. Applies only to double-pole filter.
  2548. The default is 0.707q and gives a Butterworth response.
  2549. @item channels, c
  2550. Specify which channels to filter, by default all available are filtered.
  2551. @end table
  2552. @subsection Commands
  2553. This filter supports the following commands:
  2554. @table @option
  2555. @item frequency, f
  2556. Change highpass frequency.
  2557. Syntax for the command is : "@var{frequency}"
  2558. @item width_type, t
  2559. Change highpass width_type.
  2560. Syntax for the command is : "@var{width_type}"
  2561. @item width, w
  2562. Change highpass width.
  2563. Syntax for the command is : "@var{width}"
  2564. @end table
  2565. @section join
  2566. Join multiple input streams into one multi-channel stream.
  2567. It accepts the following parameters:
  2568. @table @option
  2569. @item inputs
  2570. The number of input streams. It defaults to 2.
  2571. @item channel_layout
  2572. The desired output channel layout. It defaults to stereo.
  2573. @item map
  2574. Map channels from inputs to output. The argument is a '|'-separated list of
  2575. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2576. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2577. can be either the name of the input channel (e.g. FL for front left) or its
  2578. index in the specified input stream. @var{out_channel} is the name of the output
  2579. channel.
  2580. @end table
  2581. The filter will attempt to guess the mappings when they are not specified
  2582. explicitly. It does so by first trying to find an unused matching input channel
  2583. and if that fails it picks the first unused input channel.
  2584. Join 3 inputs (with properly set channel layouts):
  2585. @example
  2586. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2587. @end example
  2588. Build a 5.1 output from 6 single-channel streams:
  2589. @example
  2590. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2591. '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'
  2592. out
  2593. @end example
  2594. @section ladspa
  2595. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2596. To enable compilation of this filter you need to configure FFmpeg with
  2597. @code{--enable-ladspa}.
  2598. @table @option
  2599. @item file, f
  2600. Specifies the name of LADSPA plugin library to load. If the environment
  2601. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2602. each one of the directories specified by the colon separated list in
  2603. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2604. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2605. @file{/usr/lib/ladspa/}.
  2606. @item plugin, p
  2607. Specifies the plugin within the library. Some libraries contain only
  2608. one plugin, but others contain many of them. If this is not set filter
  2609. will list all available plugins within the specified library.
  2610. @item controls, c
  2611. Set the '|' separated list of controls which are zero or more floating point
  2612. values that determine the behavior of the loaded plugin (for example delay,
  2613. threshold or gain).
  2614. Controls need to be defined using the following syntax:
  2615. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2616. @var{valuei} is the value set on the @var{i}-th control.
  2617. Alternatively they can be also defined using the following syntax:
  2618. @var{value0}|@var{value1}|@var{value2}|..., where
  2619. @var{valuei} is the value set on the @var{i}-th control.
  2620. If @option{controls} is set to @code{help}, all available controls and
  2621. their valid ranges are printed.
  2622. @item sample_rate, s
  2623. Specify the sample rate, default to 44100. Only used if plugin have
  2624. zero inputs.
  2625. @item nb_samples, n
  2626. Set the number of samples per channel per each output frame, default
  2627. is 1024. Only used if plugin have zero inputs.
  2628. @item duration, d
  2629. Set the minimum duration of the sourced audio. See
  2630. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2631. for the accepted syntax.
  2632. Note that the resulting duration may be greater than the specified duration,
  2633. as the generated audio is always cut at the end of a complete frame.
  2634. If not specified, or the expressed duration is negative, the audio is
  2635. supposed to be generated forever.
  2636. Only used if plugin have zero inputs.
  2637. @end table
  2638. @subsection Examples
  2639. @itemize
  2640. @item
  2641. List all available plugins within amp (LADSPA example plugin) library:
  2642. @example
  2643. ladspa=file=amp
  2644. @end example
  2645. @item
  2646. List all available controls and their valid ranges for @code{vcf_notch}
  2647. plugin from @code{VCF} library:
  2648. @example
  2649. ladspa=f=vcf:p=vcf_notch:c=help
  2650. @end example
  2651. @item
  2652. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2653. plugin library:
  2654. @example
  2655. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2656. @end example
  2657. @item
  2658. Add reverberation to the audio using TAP-plugins
  2659. (Tom's Audio Processing plugins):
  2660. @example
  2661. ladspa=file=tap_reverb:tap_reverb
  2662. @end example
  2663. @item
  2664. Generate white noise, with 0.2 amplitude:
  2665. @example
  2666. ladspa=file=cmt:noise_source_white:c=c0=.2
  2667. @end example
  2668. @item
  2669. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2670. @code{C* Audio Plugin Suite} (CAPS) library:
  2671. @example
  2672. ladspa=file=caps:Click:c=c1=20'
  2673. @end example
  2674. @item
  2675. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2676. @example
  2677. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2678. @end example
  2679. @item
  2680. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2681. @code{SWH Plugins} collection:
  2682. @example
  2683. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2684. @end example
  2685. @item
  2686. Attenuate low frequencies using Multiband EQ from Steve Harris
  2687. @code{SWH Plugins} collection:
  2688. @example
  2689. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2690. @end example
  2691. @item
  2692. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2693. (CAPS) library:
  2694. @example
  2695. ladspa=caps:Narrower
  2696. @end example
  2697. @item
  2698. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2699. @example
  2700. ladspa=caps:White:.2
  2701. @end example
  2702. @item
  2703. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2704. @example
  2705. ladspa=caps:Fractal:c=c1=1
  2706. @end example
  2707. @item
  2708. Dynamic volume normalization using @code{VLevel} plugin:
  2709. @example
  2710. ladspa=vlevel-ladspa:vlevel_mono
  2711. @end example
  2712. @end itemize
  2713. @subsection Commands
  2714. This filter supports the following commands:
  2715. @table @option
  2716. @item cN
  2717. Modify the @var{N}-th control value.
  2718. If the specified value is not valid, it is ignored and prior one is kept.
  2719. @end table
  2720. @section loudnorm
  2721. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2722. Support for both single pass (livestreams, files) and double pass (files) modes.
  2723. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2724. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2725. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2726. The filter accepts the following options:
  2727. @table @option
  2728. @item I, i
  2729. Set integrated loudness target.
  2730. Range is -70.0 - -5.0. Default value is -24.0.
  2731. @item LRA, lra
  2732. Set loudness range target.
  2733. Range is 1.0 - 20.0. Default value is 7.0.
  2734. @item TP, tp
  2735. Set maximum true peak.
  2736. Range is -9.0 - +0.0. Default value is -2.0.
  2737. @item measured_I, measured_i
  2738. Measured IL of input file.
  2739. Range is -99.0 - +0.0.
  2740. @item measured_LRA, measured_lra
  2741. Measured LRA of input file.
  2742. Range is 0.0 - 99.0.
  2743. @item measured_TP, measured_tp
  2744. Measured true peak of input file.
  2745. Range is -99.0 - +99.0.
  2746. @item measured_thresh
  2747. Measured threshold of input file.
  2748. Range is -99.0 - +0.0.
  2749. @item offset
  2750. Set offset gain. Gain is applied before the true-peak limiter.
  2751. Range is -99.0 - +99.0. Default is +0.0.
  2752. @item linear
  2753. Normalize linearly if possible.
  2754. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2755. to be specified in order to use this mode.
  2756. Options are true or false. Default is true.
  2757. @item dual_mono
  2758. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2759. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2760. If set to @code{true}, this option will compensate for this effect.
  2761. Multi-channel input files are not affected by this option.
  2762. Options are true or false. Default is false.
  2763. @item print_format
  2764. Set print format for stats. Options are summary, json, or none.
  2765. Default value is none.
  2766. @end table
  2767. @section lowpass
  2768. Apply a low-pass filter with 3dB point frequency.
  2769. The filter can be either single-pole or double-pole (the default).
  2770. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2771. The filter accepts the following options:
  2772. @table @option
  2773. @item frequency, f
  2774. Set frequency in Hz. Default is 500.
  2775. @item poles, p
  2776. Set number of poles. Default is 2.
  2777. @item width_type, t
  2778. Set method to specify band-width of filter.
  2779. @table @option
  2780. @item h
  2781. Hz
  2782. @item q
  2783. Q-Factor
  2784. @item o
  2785. octave
  2786. @item s
  2787. slope
  2788. @item k
  2789. kHz
  2790. @end table
  2791. @item width, w
  2792. Specify the band-width of a filter in width_type units.
  2793. Applies only to double-pole filter.
  2794. The default is 0.707q and gives a Butterworth response.
  2795. @item channels, c
  2796. Specify which channels to filter, by default all available are filtered.
  2797. @end table
  2798. @subsection Examples
  2799. @itemize
  2800. @item
  2801. Lowpass only LFE channel, it LFE is not present it does nothing:
  2802. @example
  2803. lowpass=c=LFE
  2804. @end example
  2805. @end itemize
  2806. @subsection Commands
  2807. This filter supports the following commands:
  2808. @table @option
  2809. @item frequency, f
  2810. Change lowpass frequency.
  2811. Syntax for the command is : "@var{frequency}"
  2812. @item width_type, t
  2813. Change lowpass width_type.
  2814. Syntax for the command is : "@var{width_type}"
  2815. @item width, w
  2816. Change lowpass width.
  2817. Syntax for the command is : "@var{width}"
  2818. @end table
  2819. @section lv2
  2820. Load a LV2 (LADSPA Version 2) plugin.
  2821. To enable compilation of this filter you need to configure FFmpeg with
  2822. @code{--enable-lv2}.
  2823. @table @option
  2824. @item plugin, p
  2825. Specifies the plugin URI. You may need to escape ':'.
  2826. @item controls, c
  2827. Set the '|' separated list of controls which are zero or more floating point
  2828. values that determine the behavior of the loaded plugin (for example delay,
  2829. threshold or gain).
  2830. If @option{controls} is set to @code{help}, all available controls and
  2831. their valid ranges are printed.
  2832. @item sample_rate, s
  2833. Specify the sample rate, default to 44100. Only used if plugin have
  2834. zero inputs.
  2835. @item nb_samples, n
  2836. Set the number of samples per channel per each output frame, default
  2837. is 1024. Only used if plugin have zero inputs.
  2838. @item duration, d
  2839. Set the minimum duration of the sourced audio. See
  2840. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2841. for the accepted syntax.
  2842. Note that the resulting duration may be greater than the specified duration,
  2843. as the generated audio is always cut at the end of a complete frame.
  2844. If not specified, or the expressed duration is negative, the audio is
  2845. supposed to be generated forever.
  2846. Only used if plugin have zero inputs.
  2847. @end table
  2848. @subsection Examples
  2849. @itemize
  2850. @item
  2851. Apply bass enhancer plugin from Calf:
  2852. @example
  2853. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2854. @end example
  2855. @item
  2856. Apply vinyl plugin from Calf:
  2857. @example
  2858. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2859. @end example
  2860. @item
  2861. Apply bit crusher plugin from ArtyFX:
  2862. @example
  2863. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2864. @end example
  2865. @end itemize
  2866. @section mcompand
  2867. Multiband Compress or expand the audio's dynamic range.
  2868. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2869. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2870. response when absent compander action.
  2871. It accepts the following parameters:
  2872. @table @option
  2873. @item args
  2874. This option syntax is:
  2875. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2876. For explanation of each item refer to compand filter documentation.
  2877. @end table
  2878. @anchor{pan}
  2879. @section pan
  2880. Mix channels with specific gain levels. The filter accepts the output
  2881. channel layout followed by a set of channels definitions.
  2882. This filter is also designed to efficiently remap the channels of an audio
  2883. stream.
  2884. The filter accepts parameters of the form:
  2885. "@var{l}|@var{outdef}|@var{outdef}|..."
  2886. @table @option
  2887. @item l
  2888. output channel layout or number of channels
  2889. @item outdef
  2890. output channel specification, of the form:
  2891. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2892. @item out_name
  2893. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2894. number (c0, c1, etc.)
  2895. @item gain
  2896. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2897. @item in_name
  2898. input channel to use, see out_name for details; it is not possible to mix
  2899. named and numbered input channels
  2900. @end table
  2901. If the `=' in a channel specification is replaced by `<', then the gains for
  2902. that specification will be renormalized so that the total is 1, thus
  2903. avoiding clipping noise.
  2904. @subsection Mixing examples
  2905. For example, if you want to down-mix from stereo to mono, but with a bigger
  2906. factor for the left channel:
  2907. @example
  2908. pan=1c|c0=0.9*c0+0.1*c1
  2909. @end example
  2910. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2911. 7-channels surround:
  2912. @example
  2913. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2914. @end example
  2915. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2916. that should be preferred (see "-ac" option) unless you have very specific
  2917. needs.
  2918. @subsection Remapping examples
  2919. The channel remapping will be effective if, and only if:
  2920. @itemize
  2921. @item gain coefficients are zeroes or ones,
  2922. @item only one input per channel output,
  2923. @end itemize
  2924. If all these conditions are satisfied, the filter will notify the user ("Pure
  2925. channel mapping detected"), and use an optimized and lossless method to do the
  2926. remapping.
  2927. For example, if you have a 5.1 source and want a stereo audio stream by
  2928. dropping the extra channels:
  2929. @example
  2930. pan="stereo| c0=FL | c1=FR"
  2931. @end example
  2932. Given the same source, you can also switch front left and front right channels
  2933. and keep the input channel layout:
  2934. @example
  2935. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2936. @end example
  2937. If the input is a stereo audio stream, you can mute the front left channel (and
  2938. still keep the stereo channel layout) with:
  2939. @example
  2940. pan="stereo|c1=c1"
  2941. @end example
  2942. Still with a stereo audio stream input, you can copy the right channel in both
  2943. front left and right:
  2944. @example
  2945. pan="stereo| c0=FR | c1=FR"
  2946. @end example
  2947. @section replaygain
  2948. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2949. outputs it unchanged.
  2950. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2951. @section resample
  2952. Convert the audio sample format, sample rate and channel layout. It is
  2953. not meant to be used directly.
  2954. @section rubberband
  2955. Apply time-stretching and pitch-shifting with librubberband.
  2956. The filter accepts the following options:
  2957. @table @option
  2958. @item tempo
  2959. Set tempo scale factor.
  2960. @item pitch
  2961. Set pitch scale factor.
  2962. @item transients
  2963. Set transients detector.
  2964. Possible values are:
  2965. @table @var
  2966. @item crisp
  2967. @item mixed
  2968. @item smooth
  2969. @end table
  2970. @item detector
  2971. Set detector.
  2972. Possible values are:
  2973. @table @var
  2974. @item compound
  2975. @item percussive
  2976. @item soft
  2977. @end table
  2978. @item phase
  2979. Set phase.
  2980. Possible values are:
  2981. @table @var
  2982. @item laminar
  2983. @item independent
  2984. @end table
  2985. @item window
  2986. Set processing window size.
  2987. Possible values are:
  2988. @table @var
  2989. @item standard
  2990. @item short
  2991. @item long
  2992. @end table
  2993. @item smoothing
  2994. Set smoothing.
  2995. Possible values are:
  2996. @table @var
  2997. @item off
  2998. @item on
  2999. @end table
  3000. @item formant
  3001. Enable formant preservation when shift pitching.
  3002. Possible values are:
  3003. @table @var
  3004. @item shifted
  3005. @item preserved
  3006. @end table
  3007. @item pitchq
  3008. Set pitch quality.
  3009. Possible values are:
  3010. @table @var
  3011. @item quality
  3012. @item speed
  3013. @item consistency
  3014. @end table
  3015. @item channels
  3016. Set channels.
  3017. Possible values are:
  3018. @table @var
  3019. @item apart
  3020. @item together
  3021. @end table
  3022. @end table
  3023. @section sidechaincompress
  3024. This filter acts like normal compressor but has the ability to compress
  3025. detected signal using second input signal.
  3026. It needs two input streams and returns one output stream.
  3027. First input stream will be processed depending on second stream signal.
  3028. The filtered signal then can be filtered with other filters in later stages of
  3029. processing. See @ref{pan} and @ref{amerge} filter.
  3030. The filter accepts the following options:
  3031. @table @option
  3032. @item level_in
  3033. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3034. @item threshold
  3035. If a signal of second stream raises above this level it will affect the gain
  3036. reduction of first stream.
  3037. By default is 0.125. Range is between 0.00097563 and 1.
  3038. @item ratio
  3039. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3040. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3041. Default is 2. Range is between 1 and 20.
  3042. @item attack
  3043. Amount of milliseconds the signal has to rise above the threshold before gain
  3044. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3045. @item release
  3046. Amount of milliseconds the signal has to fall below the threshold before
  3047. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3048. @item makeup
  3049. Set the amount by how much signal will be amplified after processing.
  3050. Default is 1. Range is from 1 to 64.
  3051. @item knee
  3052. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3053. Default is 2.82843. Range is between 1 and 8.
  3054. @item link
  3055. Choose if the @code{average} level between all channels of side-chain stream
  3056. or the louder(@code{maximum}) channel of side-chain stream affects the
  3057. reduction. Default is @code{average}.
  3058. @item detection
  3059. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3060. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3061. @item level_sc
  3062. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3063. @item mix
  3064. How much to use compressed signal in output. Default is 1.
  3065. Range is between 0 and 1.
  3066. @end table
  3067. @subsection Examples
  3068. @itemize
  3069. @item
  3070. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3071. depending on the signal of 2nd input and later compressed signal to be
  3072. merged with 2nd input:
  3073. @example
  3074. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3075. @end example
  3076. @end itemize
  3077. @section sidechaingate
  3078. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3079. filter the detected signal before sending it to the gain reduction stage.
  3080. Normally a gate uses the full range signal to detect a level above the
  3081. threshold.
  3082. For example: If you cut all lower frequencies from your sidechain signal
  3083. the gate will decrease the volume of your track only if not enough highs
  3084. appear. With this technique you are able to reduce the resonation of a
  3085. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3086. guitar.
  3087. It needs two input streams and returns one output stream.
  3088. First input stream will be processed depending on second stream signal.
  3089. The filter accepts the following options:
  3090. @table @option
  3091. @item level_in
  3092. Set input level before filtering.
  3093. Default is 1. Allowed range is from 0.015625 to 64.
  3094. @item range
  3095. Set the level of gain reduction when the signal is below the threshold.
  3096. Default is 0.06125. Allowed range is from 0 to 1.
  3097. @item threshold
  3098. If a signal rises above this level the gain reduction is released.
  3099. Default is 0.125. Allowed range is from 0 to 1.
  3100. @item ratio
  3101. Set a ratio about which the signal is reduced.
  3102. Default is 2. Allowed range is from 1 to 9000.
  3103. @item attack
  3104. Amount of milliseconds the signal has to rise above the threshold before gain
  3105. reduction stops.
  3106. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3107. @item release
  3108. Amount of milliseconds the signal has to fall below the threshold before the
  3109. reduction is increased again. Default is 250 milliseconds.
  3110. Allowed range is from 0.01 to 9000.
  3111. @item makeup
  3112. Set amount of amplification of signal after processing.
  3113. Default is 1. Allowed range is from 1 to 64.
  3114. @item knee
  3115. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3116. Default is 2.828427125. Allowed range is from 1 to 8.
  3117. @item detection
  3118. Choose if exact signal should be taken for detection or an RMS like one.
  3119. Default is rms. Can be peak or rms.
  3120. @item link
  3121. Choose if the average level between all channels or the louder channel affects
  3122. the reduction.
  3123. Default is average. Can be average or maximum.
  3124. @item level_sc
  3125. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3126. @end table
  3127. @section silencedetect
  3128. Detect silence in an audio stream.
  3129. This filter logs a message when it detects that the input audio volume is less
  3130. or equal to a noise tolerance value for a duration greater or equal to the
  3131. minimum detected noise duration.
  3132. The printed times and duration are expressed in seconds.
  3133. The filter accepts the following options:
  3134. @table @option
  3135. @item duration, d
  3136. Set silence duration until notification (default is 2 seconds).
  3137. @item noise, n
  3138. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3139. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3140. @end table
  3141. @subsection Examples
  3142. @itemize
  3143. @item
  3144. Detect 5 seconds of silence with -50dB noise tolerance:
  3145. @example
  3146. silencedetect=n=-50dB:d=5
  3147. @end example
  3148. @item
  3149. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3150. tolerance in @file{silence.mp3}:
  3151. @example
  3152. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3153. @end example
  3154. @end itemize
  3155. @section silenceremove
  3156. Remove silence from the beginning, middle or end of the audio.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item start_periods
  3160. This value is used to indicate if audio should be trimmed at beginning of
  3161. the audio. A value of zero indicates no silence should be trimmed from the
  3162. beginning. When specifying a non-zero value, it trims audio up until it
  3163. finds non-silence. Normally, when trimming silence from beginning of audio
  3164. the @var{start_periods} will be @code{1} but it can be increased to higher
  3165. values to trim all audio up to specific count of non-silence periods.
  3166. Default value is @code{0}.
  3167. @item start_duration
  3168. Specify the amount of time that non-silence must be detected before it stops
  3169. trimming audio. By increasing the duration, bursts of noises can be treated
  3170. as silence and trimmed off. Default value is @code{0}.
  3171. @item start_threshold
  3172. This indicates what sample value should be treated as silence. For digital
  3173. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3174. you may wish to increase the value to account for background noise.
  3175. Can be specified in dB (in case "dB" is appended to the specified value)
  3176. or amplitude ratio. Default value is @code{0}.
  3177. @item stop_periods
  3178. Set the count for trimming silence from the end of audio.
  3179. To remove silence from the middle of a file, specify a @var{stop_periods}
  3180. that is negative. This value is then treated as a positive value and is
  3181. used to indicate the effect should restart processing as specified by
  3182. @var{start_periods}, making it suitable for removing periods of silence
  3183. in the middle of the audio.
  3184. Default value is @code{0}.
  3185. @item stop_duration
  3186. Specify a duration of silence that must exist before audio is not copied any
  3187. more. By specifying a higher duration, silence that is wanted can be left in
  3188. the audio.
  3189. Default value is @code{0}.
  3190. @item stop_threshold
  3191. This is the same as @option{start_threshold} but for trimming silence from
  3192. the end of audio.
  3193. Can be specified in dB (in case "dB" is appended to the specified value)
  3194. or amplitude ratio. Default value is @code{0}.
  3195. @item leave_silence
  3196. This indicates that @var{stop_duration} length of audio should be left intact
  3197. at the beginning of each period of silence.
  3198. For example, if you want to remove long pauses between words but do not want
  3199. to remove the pauses completely. Default value is @code{0}.
  3200. @item detection
  3201. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3202. and works better with digital silence which is exactly 0.
  3203. Default value is @code{rms}.
  3204. @item window
  3205. Set ratio used to calculate size of window for detecting silence.
  3206. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3207. @end table
  3208. @subsection Examples
  3209. @itemize
  3210. @item
  3211. The following example shows how this filter can be used to start a recording
  3212. that does not contain the delay at the start which usually occurs between
  3213. pressing the record button and the start of the performance:
  3214. @example
  3215. silenceremove=1:5:0.02
  3216. @end example
  3217. @item
  3218. Trim all silence encountered from beginning to end where there is more than 1
  3219. second of silence in audio:
  3220. @example
  3221. silenceremove=0:0:0:-1:1:-90dB
  3222. @end example
  3223. @end itemize
  3224. @section sofalizer
  3225. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3226. loudspeakers around the user for binaural listening via headphones (audio
  3227. formats up to 9 channels supported).
  3228. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3229. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3230. Austrian Academy of Sciences.
  3231. To enable compilation of this filter you need to configure FFmpeg with
  3232. @code{--enable-libmysofa}.
  3233. The filter accepts the following options:
  3234. @table @option
  3235. @item sofa
  3236. Set the SOFA file used for rendering.
  3237. @item gain
  3238. Set gain applied to audio. Value is in dB. Default is 0.
  3239. @item rotation
  3240. Set rotation of virtual loudspeakers in deg. Default is 0.
  3241. @item elevation
  3242. Set elevation of virtual speakers in deg. Default is 0.
  3243. @item radius
  3244. Set distance in meters between loudspeakers and the listener with near-field
  3245. HRTFs. Default is 1.
  3246. @item type
  3247. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3248. processing audio in time domain which is slow.
  3249. @var{freq} is processing audio in frequency domain which is fast.
  3250. Default is @var{freq}.
  3251. @item speakers
  3252. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3253. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3254. Each virtual loudspeaker is described with short channel name following with
  3255. azimuth and elevation in degrees.
  3256. Each virtual loudspeaker description is separated by '|'.
  3257. For example to override front left and front right channel positions use:
  3258. 'speakers=FL 45 15|FR 345 15'.
  3259. Descriptions with unrecognised channel names are ignored.
  3260. @item lfegain
  3261. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3262. @end table
  3263. @subsection Examples
  3264. @itemize
  3265. @item
  3266. Using ClubFritz6 sofa file:
  3267. @example
  3268. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3269. @end example
  3270. @item
  3271. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3272. @example
  3273. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3274. @end example
  3275. @item
  3276. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3277. and also with custom gain:
  3278. @example
  3279. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3280. @end example
  3281. @end itemize
  3282. @section stereotools
  3283. This filter has some handy utilities to manage stereo signals, for converting
  3284. M/S stereo recordings to L/R signal while having control over the parameters
  3285. or spreading the stereo image of master track.
  3286. The filter accepts the following options:
  3287. @table @option
  3288. @item level_in
  3289. Set input level before filtering for both channels. Defaults is 1.
  3290. Allowed range is from 0.015625 to 64.
  3291. @item level_out
  3292. Set output level after filtering for both channels. Defaults is 1.
  3293. Allowed range is from 0.015625 to 64.
  3294. @item balance_in
  3295. Set input balance between both channels. Default is 0.
  3296. Allowed range is from -1 to 1.
  3297. @item balance_out
  3298. Set output balance between both channels. Default is 0.
  3299. Allowed range is from -1 to 1.
  3300. @item softclip
  3301. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3302. clipping. Disabled by default.
  3303. @item mutel
  3304. Mute the left channel. Disabled by default.
  3305. @item muter
  3306. Mute the right channel. Disabled by default.
  3307. @item phasel
  3308. Change the phase of the left channel. Disabled by default.
  3309. @item phaser
  3310. Change the phase of the right channel. Disabled by default.
  3311. @item mode
  3312. Set stereo mode. Available values are:
  3313. @table @samp
  3314. @item lr>lr
  3315. Left/Right to Left/Right, this is default.
  3316. @item lr>ms
  3317. Left/Right to Mid/Side.
  3318. @item ms>lr
  3319. Mid/Side to Left/Right.
  3320. @item lr>ll
  3321. Left/Right to Left/Left.
  3322. @item lr>rr
  3323. Left/Right to Right/Right.
  3324. @item lr>l+r
  3325. Left/Right to Left + Right.
  3326. @item lr>rl
  3327. Left/Right to Right/Left.
  3328. @item ms>ll
  3329. Mid/Side to Left/Left.
  3330. @item ms>rr
  3331. Mid/Side to Right/Right.
  3332. @end table
  3333. @item slev
  3334. Set level of side signal. Default is 1.
  3335. Allowed range is from 0.015625 to 64.
  3336. @item sbal
  3337. Set balance of side signal. Default is 0.
  3338. Allowed range is from -1 to 1.
  3339. @item mlev
  3340. Set level of the middle signal. Default is 1.
  3341. Allowed range is from 0.015625 to 64.
  3342. @item mpan
  3343. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3344. @item base
  3345. Set stereo base between mono and inversed channels. Default is 0.
  3346. Allowed range is from -1 to 1.
  3347. @item delay
  3348. Set delay in milliseconds how much to delay left from right channel and
  3349. vice versa. Default is 0. Allowed range is from -20 to 20.
  3350. @item sclevel
  3351. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3352. @item phase
  3353. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3354. @item bmode_in, bmode_out
  3355. Set balance mode for balance_in/balance_out option.
  3356. Can be one of the following:
  3357. @table @samp
  3358. @item balance
  3359. Classic balance mode. Attenuate one channel at time.
  3360. Gain is raised up to 1.
  3361. @item amplitude
  3362. Similar as classic mode above but gain is raised up to 2.
  3363. @item power
  3364. Equal power distribution, from -6dB to +6dB range.
  3365. @end table
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Apply karaoke like effect:
  3371. @example
  3372. stereotools=mlev=0.015625
  3373. @end example
  3374. @item
  3375. Convert M/S signal to L/R:
  3376. @example
  3377. "stereotools=mode=ms>lr"
  3378. @end example
  3379. @end itemize
  3380. @section stereowiden
  3381. This filter enhance the stereo effect by suppressing signal common to both
  3382. channels and by delaying the signal of left into right and vice versa,
  3383. thereby widening the stereo effect.
  3384. The filter accepts the following options:
  3385. @table @option
  3386. @item delay
  3387. Time in milliseconds of the delay of left signal into right and vice versa.
  3388. Default is 20 milliseconds.
  3389. @item feedback
  3390. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3391. effect of left signal in right output and vice versa which gives widening
  3392. effect. Default is 0.3.
  3393. @item crossfeed
  3394. Cross feed of left into right with inverted phase. This helps in suppressing
  3395. the mono. If the value is 1 it will cancel all the signal common to both
  3396. channels. Default is 0.3.
  3397. @item drymix
  3398. Set level of input signal of original channel. Default is 0.8.
  3399. @end table
  3400. @section superequalizer
  3401. Apply 18 band equalizer.
  3402. The filter accepts the following options:
  3403. @table @option
  3404. @item 1b
  3405. Set 65Hz band gain.
  3406. @item 2b
  3407. Set 92Hz band gain.
  3408. @item 3b
  3409. Set 131Hz band gain.
  3410. @item 4b
  3411. Set 185Hz band gain.
  3412. @item 5b
  3413. Set 262Hz band gain.
  3414. @item 6b
  3415. Set 370Hz band gain.
  3416. @item 7b
  3417. Set 523Hz band gain.
  3418. @item 8b
  3419. Set 740Hz band gain.
  3420. @item 9b
  3421. Set 1047Hz band gain.
  3422. @item 10b
  3423. Set 1480Hz band gain.
  3424. @item 11b
  3425. Set 2093Hz band gain.
  3426. @item 12b
  3427. Set 2960Hz band gain.
  3428. @item 13b
  3429. Set 4186Hz band gain.
  3430. @item 14b
  3431. Set 5920Hz band gain.
  3432. @item 15b
  3433. Set 8372Hz band gain.
  3434. @item 16b
  3435. Set 11840Hz band gain.
  3436. @item 17b
  3437. Set 16744Hz band gain.
  3438. @item 18b
  3439. Set 20000Hz band gain.
  3440. @end table
  3441. @section surround
  3442. Apply audio surround upmix filter.
  3443. This filter allows to produce multichannel output from audio stream.
  3444. The filter accepts the following options:
  3445. @table @option
  3446. @item chl_out
  3447. Set output channel layout. By default, this is @var{5.1}.
  3448. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3449. for the required syntax.
  3450. @item chl_in
  3451. Set input channel layout. By default, this is @var{stereo}.
  3452. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3453. for the required syntax.
  3454. @item level_in
  3455. Set input volume level. By default, this is @var{1}.
  3456. @item level_out
  3457. Set output volume level. By default, this is @var{1}.
  3458. @item lfe
  3459. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3460. @item lfe_low
  3461. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3462. @item lfe_high
  3463. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3464. @item fc_in
  3465. Set front center input volume. By default, this is @var{1}.
  3466. @item fc_out
  3467. Set front center output volume. By default, this is @var{1}.
  3468. @item lfe_in
  3469. Set LFE input volume. By default, this is @var{1}.
  3470. @item lfe_out
  3471. Set LFE output volume. By default, this is @var{1}.
  3472. @end table
  3473. @section treble, highshelf
  3474. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3475. shelving filter with a response similar to that of a standard
  3476. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item gain, g
  3480. Give the gain at whichever is the lower of ~22 kHz and the
  3481. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3482. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3483. @item frequency, f
  3484. Set the filter's central frequency and so can be used
  3485. to extend or reduce the frequency range to be boosted or cut.
  3486. The default value is @code{3000} Hz.
  3487. @item width_type, t
  3488. Set method to specify band-width of filter.
  3489. @table @option
  3490. @item h
  3491. Hz
  3492. @item q
  3493. Q-Factor
  3494. @item o
  3495. octave
  3496. @item s
  3497. slope
  3498. @item k
  3499. kHz
  3500. @end table
  3501. @item width, w
  3502. Determine how steep is the filter's shelf transition.
  3503. @item channels, c
  3504. Specify which channels to filter, by default all available are filtered.
  3505. @end table
  3506. @subsection Commands
  3507. This filter supports the following commands:
  3508. @table @option
  3509. @item frequency, f
  3510. Change treble frequency.
  3511. Syntax for the command is : "@var{frequency}"
  3512. @item width_type, t
  3513. Change treble width_type.
  3514. Syntax for the command is : "@var{width_type}"
  3515. @item width, w
  3516. Change treble width.
  3517. Syntax for the command is : "@var{width}"
  3518. @item gain, g
  3519. Change treble gain.
  3520. Syntax for the command is : "@var{gain}"
  3521. @end table
  3522. @section tremolo
  3523. Sinusoidal amplitude modulation.
  3524. The filter accepts the following options:
  3525. @table @option
  3526. @item f
  3527. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3528. (20 Hz or lower) will result in a tremolo effect.
  3529. This filter may also be used as a ring modulator by specifying
  3530. a modulation frequency higher than 20 Hz.
  3531. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3532. @item d
  3533. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3534. Default value is 0.5.
  3535. @end table
  3536. @section vibrato
  3537. Sinusoidal phase modulation.
  3538. The filter accepts the following options:
  3539. @table @option
  3540. @item f
  3541. Modulation frequency in Hertz.
  3542. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3543. @item d
  3544. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3545. Default value is 0.5.
  3546. @end table
  3547. @section volume
  3548. Adjust the input audio volume.
  3549. It accepts the following parameters:
  3550. @table @option
  3551. @item volume
  3552. Set audio volume expression.
  3553. Output values are clipped to the maximum value.
  3554. The output audio volume is given by the relation:
  3555. @example
  3556. @var{output_volume} = @var{volume} * @var{input_volume}
  3557. @end example
  3558. The default value for @var{volume} is "1.0".
  3559. @item precision
  3560. This parameter represents the mathematical precision.
  3561. It determines which input sample formats will be allowed, which affects the
  3562. precision of the volume scaling.
  3563. @table @option
  3564. @item fixed
  3565. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3566. @item float
  3567. 32-bit floating-point; this limits input sample format to FLT. (default)
  3568. @item double
  3569. 64-bit floating-point; this limits input sample format to DBL.
  3570. @end table
  3571. @item replaygain
  3572. Choose the behaviour on encountering ReplayGain side data in input frames.
  3573. @table @option
  3574. @item drop
  3575. Remove ReplayGain side data, ignoring its contents (the default).
  3576. @item ignore
  3577. Ignore ReplayGain side data, but leave it in the frame.
  3578. @item track
  3579. Prefer the track gain, if present.
  3580. @item album
  3581. Prefer the album gain, if present.
  3582. @end table
  3583. @item replaygain_preamp
  3584. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3585. Default value for @var{replaygain_preamp} is 0.0.
  3586. @item eval
  3587. Set when the volume expression is evaluated.
  3588. It accepts the following values:
  3589. @table @samp
  3590. @item once
  3591. only evaluate expression once during the filter initialization, or
  3592. when the @samp{volume} command is sent
  3593. @item frame
  3594. evaluate expression for each incoming frame
  3595. @end table
  3596. Default value is @samp{once}.
  3597. @end table
  3598. The volume expression can contain the following parameters.
  3599. @table @option
  3600. @item n
  3601. frame number (starting at zero)
  3602. @item nb_channels
  3603. number of channels
  3604. @item nb_consumed_samples
  3605. number of samples consumed by the filter
  3606. @item nb_samples
  3607. number of samples in the current frame
  3608. @item pos
  3609. original frame position in the file
  3610. @item pts
  3611. frame PTS
  3612. @item sample_rate
  3613. sample rate
  3614. @item startpts
  3615. PTS at start of stream
  3616. @item startt
  3617. time at start of stream
  3618. @item t
  3619. frame time
  3620. @item tb
  3621. timestamp timebase
  3622. @item volume
  3623. last set volume value
  3624. @end table
  3625. Note that when @option{eval} is set to @samp{once} only the
  3626. @var{sample_rate} and @var{tb} variables are available, all other
  3627. variables will evaluate to NAN.
  3628. @subsection Commands
  3629. This filter supports the following commands:
  3630. @table @option
  3631. @item volume
  3632. Modify the volume expression.
  3633. The command accepts the same syntax of the corresponding option.
  3634. If the specified expression is not valid, it is kept at its current
  3635. value.
  3636. @item replaygain_noclip
  3637. Prevent clipping by limiting the gain applied.
  3638. Default value for @var{replaygain_noclip} is 1.
  3639. @end table
  3640. @subsection Examples
  3641. @itemize
  3642. @item
  3643. Halve the input audio volume:
  3644. @example
  3645. volume=volume=0.5
  3646. volume=volume=1/2
  3647. volume=volume=-6.0206dB
  3648. @end example
  3649. In all the above example the named key for @option{volume} can be
  3650. omitted, for example like in:
  3651. @example
  3652. volume=0.5
  3653. @end example
  3654. @item
  3655. Increase input audio power by 6 decibels using fixed-point precision:
  3656. @example
  3657. volume=volume=6dB:precision=fixed
  3658. @end example
  3659. @item
  3660. Fade volume after time 10 with an annihilation period of 5 seconds:
  3661. @example
  3662. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3663. @end example
  3664. @end itemize
  3665. @section volumedetect
  3666. Detect the volume of the input video.
  3667. The filter has no parameters. The input is not modified. Statistics about
  3668. the volume will be printed in the log when the input stream end is reached.
  3669. In particular it will show the mean volume (root mean square), maximum
  3670. volume (on a per-sample basis), and the beginning of a histogram of the
  3671. registered volume values (from the maximum value to a cumulated 1/1000 of
  3672. the samples).
  3673. All volumes are in decibels relative to the maximum PCM value.
  3674. @subsection Examples
  3675. Here is an excerpt of the output:
  3676. @example
  3677. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3678. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3679. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3680. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3681. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3682. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3683. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3684. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3685. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3686. @end example
  3687. It means that:
  3688. @itemize
  3689. @item
  3690. The mean square energy is approximately -27 dB, or 10^-2.7.
  3691. @item
  3692. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3693. @item
  3694. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3695. @end itemize
  3696. In other words, raising the volume by +4 dB does not cause any clipping,
  3697. raising it by +5 dB causes clipping for 6 samples, etc.
  3698. @c man end AUDIO FILTERS
  3699. @chapter Audio Sources
  3700. @c man begin AUDIO SOURCES
  3701. Below is a description of the currently available audio sources.
  3702. @section abuffer
  3703. Buffer audio frames, and make them available to the filter chain.
  3704. This source is mainly intended for a programmatic use, in particular
  3705. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3706. It accepts the following parameters:
  3707. @table @option
  3708. @item time_base
  3709. The timebase which will be used for timestamps of submitted frames. It must be
  3710. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3711. @item sample_rate
  3712. The sample rate of the incoming audio buffers.
  3713. @item sample_fmt
  3714. The sample format of the incoming audio buffers.
  3715. Either a sample format name or its corresponding integer representation from
  3716. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3717. @item channel_layout
  3718. The channel layout of the incoming audio buffers.
  3719. Either a channel layout name from channel_layout_map in
  3720. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3721. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3722. @item channels
  3723. The number of channels of the incoming audio buffers.
  3724. If both @var{channels} and @var{channel_layout} are specified, then they
  3725. must be consistent.
  3726. @end table
  3727. @subsection Examples
  3728. @example
  3729. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3730. @end example
  3731. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3732. Since the sample format with name "s16p" corresponds to the number
  3733. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3734. equivalent to:
  3735. @example
  3736. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3737. @end example
  3738. @section aevalsrc
  3739. Generate an audio signal specified by an expression.
  3740. This source accepts in input one or more expressions (one for each
  3741. channel), which are evaluated and used to generate a corresponding
  3742. audio signal.
  3743. This source accepts the following options:
  3744. @table @option
  3745. @item exprs
  3746. Set the '|'-separated expressions list for each separate channel. In case the
  3747. @option{channel_layout} option is not specified, the selected channel layout
  3748. depends on the number of provided expressions. Otherwise the last
  3749. specified expression is applied to the remaining output channels.
  3750. @item channel_layout, c
  3751. Set the channel layout. The number of channels in the specified layout
  3752. must be equal to the number of specified expressions.
  3753. @item duration, d
  3754. Set the minimum duration of the sourced audio. See
  3755. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3756. for the accepted syntax.
  3757. Note that the resulting duration may be greater than the specified
  3758. duration, as the generated audio is always cut at the end of a
  3759. complete frame.
  3760. If not specified, or the expressed duration is negative, the audio is
  3761. supposed to be generated forever.
  3762. @item nb_samples, n
  3763. Set the number of samples per channel per each output frame,
  3764. default to 1024.
  3765. @item sample_rate, s
  3766. Specify the sample rate, default to 44100.
  3767. @end table
  3768. Each expression in @var{exprs} can contain the following constants:
  3769. @table @option
  3770. @item n
  3771. number of the evaluated sample, starting from 0
  3772. @item t
  3773. time of the evaluated sample expressed in seconds, starting from 0
  3774. @item s
  3775. sample rate
  3776. @end table
  3777. @subsection Examples
  3778. @itemize
  3779. @item
  3780. Generate silence:
  3781. @example
  3782. aevalsrc=0
  3783. @end example
  3784. @item
  3785. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3786. 8000 Hz:
  3787. @example
  3788. aevalsrc="sin(440*2*PI*t):s=8000"
  3789. @end example
  3790. @item
  3791. Generate a two channels signal, specify the channel layout (Front
  3792. Center + Back Center) explicitly:
  3793. @example
  3794. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3795. @end example
  3796. @item
  3797. Generate white noise:
  3798. @example
  3799. aevalsrc="-2+random(0)"
  3800. @end example
  3801. @item
  3802. Generate an amplitude modulated signal:
  3803. @example
  3804. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3805. @end example
  3806. @item
  3807. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3808. @example
  3809. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3810. @end example
  3811. @end itemize
  3812. @section anullsrc
  3813. The null audio source, return unprocessed audio frames. It is mainly useful
  3814. as a template and to be employed in analysis / debugging tools, or as
  3815. the source for filters which ignore the input data (for example the sox
  3816. synth filter).
  3817. This source accepts the following options:
  3818. @table @option
  3819. @item channel_layout, cl
  3820. Specifies the channel layout, and can be either an integer or a string
  3821. representing a channel layout. The default value of @var{channel_layout}
  3822. is "stereo".
  3823. Check the channel_layout_map definition in
  3824. @file{libavutil/channel_layout.c} for the mapping between strings and
  3825. channel layout values.
  3826. @item sample_rate, r
  3827. Specifies the sample rate, and defaults to 44100.
  3828. @item nb_samples, n
  3829. Set the number of samples per requested frames.
  3830. @end table
  3831. @subsection Examples
  3832. @itemize
  3833. @item
  3834. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3835. @example
  3836. anullsrc=r=48000:cl=4
  3837. @end example
  3838. @item
  3839. Do the same operation with a more obvious syntax:
  3840. @example
  3841. anullsrc=r=48000:cl=mono
  3842. @end example
  3843. @end itemize
  3844. All the parameters need to be explicitly defined.
  3845. @section flite
  3846. Synthesize a voice utterance using the libflite library.
  3847. To enable compilation of this filter you need to configure FFmpeg with
  3848. @code{--enable-libflite}.
  3849. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3850. The filter accepts the following options:
  3851. @table @option
  3852. @item list_voices
  3853. If set to 1, list the names of the available voices and exit
  3854. immediately. Default value is 0.
  3855. @item nb_samples, n
  3856. Set the maximum number of samples per frame. Default value is 512.
  3857. @item textfile
  3858. Set the filename containing the text to speak.
  3859. @item text
  3860. Set the text to speak.
  3861. @item voice, v
  3862. Set the voice to use for the speech synthesis. Default value is
  3863. @code{kal}. See also the @var{list_voices} option.
  3864. @end table
  3865. @subsection Examples
  3866. @itemize
  3867. @item
  3868. Read from file @file{speech.txt}, and synthesize the text using the
  3869. standard flite voice:
  3870. @example
  3871. flite=textfile=speech.txt
  3872. @end example
  3873. @item
  3874. Read the specified text selecting the @code{slt} voice:
  3875. @example
  3876. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3877. @end example
  3878. @item
  3879. Input text to ffmpeg:
  3880. @example
  3881. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3882. @end example
  3883. @item
  3884. Make @file{ffplay} speak the specified text, using @code{flite} and
  3885. the @code{lavfi} device:
  3886. @example
  3887. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3888. @end example
  3889. @end itemize
  3890. For more information about libflite, check:
  3891. @url{http://www.festvox.org/flite/}
  3892. @section anoisesrc
  3893. Generate a noise audio signal.
  3894. The filter accepts the following options:
  3895. @table @option
  3896. @item sample_rate, r
  3897. Specify the sample rate. Default value is 48000 Hz.
  3898. @item amplitude, a
  3899. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3900. is 1.0.
  3901. @item duration, d
  3902. Specify the duration of the generated audio stream. Not specifying this option
  3903. results in noise with an infinite length.
  3904. @item color, colour, c
  3905. Specify the color of noise. Available noise colors are white, pink, brown,
  3906. blue and violet. Default color is white.
  3907. @item seed, s
  3908. Specify a value used to seed the PRNG.
  3909. @item nb_samples, n
  3910. Set the number of samples per each output frame, default is 1024.
  3911. @end table
  3912. @subsection Examples
  3913. @itemize
  3914. @item
  3915. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3916. @example
  3917. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3918. @end example
  3919. @end itemize
  3920. @section hilbert
  3921. Generate odd-tap Hilbert transform FIR coefficients.
  3922. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3923. the signal by 90 degrees.
  3924. This is used in many matrix coding schemes and for analytic signal generation.
  3925. The process is often written as a multiplication by i (or j), the imaginary unit.
  3926. The filter accepts the following options:
  3927. @table @option
  3928. @item sample_rate, s
  3929. Set sample rate, default is 44100.
  3930. @item taps, t
  3931. Set length of FIR filter, default is 22051.
  3932. @item nb_samples, n
  3933. Set number of samples per each frame.
  3934. @item win_func, w
  3935. Set window function to be used when generating FIR coefficients.
  3936. @end table
  3937. @section sine
  3938. Generate an audio signal made of a sine wave with amplitude 1/8.
  3939. The audio signal is bit-exact.
  3940. The filter accepts the following options:
  3941. @table @option
  3942. @item frequency, f
  3943. Set the carrier frequency. Default is 440 Hz.
  3944. @item beep_factor, b
  3945. Enable a periodic beep every second with frequency @var{beep_factor} times
  3946. the carrier frequency. Default is 0, meaning the beep is disabled.
  3947. @item sample_rate, r
  3948. Specify the sample rate, default is 44100.
  3949. @item duration, d
  3950. Specify the duration of the generated audio stream.
  3951. @item samples_per_frame
  3952. Set the number of samples per output frame.
  3953. The expression can contain the following constants:
  3954. @table @option
  3955. @item n
  3956. The (sequential) number of the output audio frame, starting from 0.
  3957. @item pts
  3958. The PTS (Presentation TimeStamp) of the output audio frame,
  3959. expressed in @var{TB} units.
  3960. @item t
  3961. The PTS of the output audio frame, expressed in seconds.
  3962. @item TB
  3963. The timebase of the output audio frames.
  3964. @end table
  3965. Default is @code{1024}.
  3966. @end table
  3967. @subsection Examples
  3968. @itemize
  3969. @item
  3970. Generate a simple 440 Hz sine wave:
  3971. @example
  3972. sine
  3973. @end example
  3974. @item
  3975. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3976. @example
  3977. sine=220:4:d=5
  3978. sine=f=220:b=4:d=5
  3979. sine=frequency=220:beep_factor=4:duration=5
  3980. @end example
  3981. @item
  3982. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3983. pattern:
  3984. @example
  3985. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3986. @end example
  3987. @end itemize
  3988. @c man end AUDIO SOURCES
  3989. @chapter Audio Sinks
  3990. @c man begin AUDIO SINKS
  3991. Below is a description of the currently available audio sinks.
  3992. @section abuffersink
  3993. Buffer audio frames, and make them available to the end of filter chain.
  3994. This sink is mainly intended for programmatic use, in particular
  3995. through the interface defined in @file{libavfilter/buffersink.h}
  3996. or the options system.
  3997. It accepts a pointer to an AVABufferSinkContext structure, which
  3998. defines the incoming buffers' formats, to be passed as the opaque
  3999. parameter to @code{avfilter_init_filter} for initialization.
  4000. @section anullsink
  4001. Null audio sink; do absolutely nothing with the input audio. It is
  4002. mainly useful as a template and for use in analysis / debugging
  4003. tools.
  4004. @c man end AUDIO SINKS
  4005. @chapter Video Filters
  4006. @c man begin VIDEO FILTERS
  4007. When you configure your FFmpeg build, you can disable any of the
  4008. existing filters using @code{--disable-filters}.
  4009. The configure output will show the video filters included in your
  4010. build.
  4011. Below is a description of the currently available video filters.
  4012. @section alphaextract
  4013. Extract the alpha component from the input as a grayscale video. This
  4014. is especially useful with the @var{alphamerge} filter.
  4015. @section alphamerge
  4016. Add or replace the alpha component of the primary input with the
  4017. grayscale value of a second input. This is intended for use with
  4018. @var{alphaextract} to allow the transmission or storage of frame
  4019. sequences that have alpha in a format that doesn't support an alpha
  4020. channel.
  4021. For example, to reconstruct full frames from a normal YUV-encoded video
  4022. and a separate video created with @var{alphaextract}, you might use:
  4023. @example
  4024. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4025. @end example
  4026. Since this filter is designed for reconstruction, it operates on frame
  4027. sequences without considering timestamps, and terminates when either
  4028. input reaches end of stream. This will cause problems if your encoding
  4029. pipeline drops frames. If you're trying to apply an image as an
  4030. overlay to a video stream, consider the @var{overlay} filter instead.
  4031. @section amplify
  4032. Amplify differences between current pixel and pixels of adjacent frames in
  4033. same pixel location.
  4034. This filter accepts the following options:
  4035. @table @option
  4036. @item radius
  4037. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4038. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4039. @item factor
  4040. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4041. @item threshold
  4042. Set threshold for difference amplification. Any differrence greater or equal to
  4043. this value will not alter source pixel. Default is 10.
  4044. Allowed range is from 0 to 65535.
  4045. @item low
  4046. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4047. This option controls maximum possible value that will decrease source pixel value.
  4048. @item high
  4049. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4050. This option controls maximum possible value that will increase source pixel value.
  4051. @item planes
  4052. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4053. @end table
  4054. @section ass
  4055. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4056. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4057. Substation Alpha) subtitles files.
  4058. This filter accepts the following option in addition to the common options from
  4059. the @ref{subtitles} filter:
  4060. @table @option
  4061. @item shaping
  4062. Set the shaping engine
  4063. Available values are:
  4064. @table @samp
  4065. @item auto
  4066. The default libass shaping engine, which is the best available.
  4067. @item simple
  4068. Fast, font-agnostic shaper that can do only substitutions
  4069. @item complex
  4070. Slower shaper using OpenType for substitutions and positioning
  4071. @end table
  4072. The default is @code{auto}.
  4073. @end table
  4074. @section atadenoise
  4075. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4076. The filter accepts the following options:
  4077. @table @option
  4078. @item 0a
  4079. Set threshold A for 1st plane. Default is 0.02.
  4080. Valid range is 0 to 0.3.
  4081. @item 0b
  4082. Set threshold B for 1st plane. Default is 0.04.
  4083. Valid range is 0 to 5.
  4084. @item 1a
  4085. Set threshold A for 2nd plane. Default is 0.02.
  4086. Valid range is 0 to 0.3.
  4087. @item 1b
  4088. Set threshold B for 2nd plane. Default is 0.04.
  4089. Valid range is 0 to 5.
  4090. @item 2a
  4091. Set threshold A for 3rd plane. Default is 0.02.
  4092. Valid range is 0 to 0.3.
  4093. @item 2b
  4094. Set threshold B for 3rd plane. Default is 0.04.
  4095. Valid range is 0 to 5.
  4096. Threshold A is designed to react on abrupt changes in the input signal and
  4097. threshold B is designed to react on continuous changes in the input signal.
  4098. @item s
  4099. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4100. number in range [5, 129].
  4101. @item p
  4102. Set what planes of frame filter will use for averaging. Default is all.
  4103. @end table
  4104. @section avgblur
  4105. Apply average blur filter.
  4106. The filter accepts the following options:
  4107. @table @option
  4108. @item sizeX
  4109. Set horizontal kernel size.
  4110. @item planes
  4111. Set which planes to filter. By default all planes are filtered.
  4112. @item sizeY
  4113. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4114. Default is @code{0}.
  4115. @end table
  4116. @section bbox
  4117. Compute the bounding box for the non-black pixels in the input frame
  4118. luminance plane.
  4119. This filter computes the bounding box containing all the pixels with a
  4120. luminance value greater than the minimum allowed value.
  4121. The parameters describing the bounding box are printed on the filter
  4122. log.
  4123. The filter accepts the following option:
  4124. @table @option
  4125. @item min_val
  4126. Set the minimal luminance value. Default is @code{16}.
  4127. @end table
  4128. @section bitplanenoise
  4129. Show and measure bit plane noise.
  4130. The filter accepts the following options:
  4131. @table @option
  4132. @item bitplane
  4133. Set which plane to analyze. Default is @code{1}.
  4134. @item filter
  4135. Filter out noisy pixels from @code{bitplane} set above.
  4136. Default is disabled.
  4137. @end table
  4138. @section blackdetect
  4139. Detect video intervals that are (almost) completely black. Can be
  4140. useful to detect chapter transitions, commercials, or invalid
  4141. recordings. Output lines contains the time for the start, end and
  4142. duration of the detected black interval expressed in seconds.
  4143. In order to display the output lines, you need to set the loglevel at
  4144. least to the AV_LOG_INFO value.
  4145. The filter accepts the following options:
  4146. @table @option
  4147. @item black_min_duration, d
  4148. Set the minimum detected black duration expressed in seconds. It must
  4149. be a non-negative floating point number.
  4150. Default value is 2.0.
  4151. @item picture_black_ratio_th, pic_th
  4152. Set the threshold for considering a picture "black".
  4153. Express the minimum value for the ratio:
  4154. @example
  4155. @var{nb_black_pixels} / @var{nb_pixels}
  4156. @end example
  4157. for which a picture is considered black.
  4158. Default value is 0.98.
  4159. @item pixel_black_th, pix_th
  4160. Set the threshold for considering a pixel "black".
  4161. The threshold expresses the maximum pixel luminance value for which a
  4162. pixel is considered "black". The provided value is scaled according to
  4163. the following equation:
  4164. @example
  4165. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4166. @end example
  4167. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4168. the input video format, the range is [0-255] for YUV full-range
  4169. formats and [16-235] for YUV non full-range formats.
  4170. Default value is 0.10.
  4171. @end table
  4172. The following example sets the maximum pixel threshold to the minimum
  4173. value, and detects only black intervals of 2 or more seconds:
  4174. @example
  4175. blackdetect=d=2:pix_th=0.00
  4176. @end example
  4177. @section blackframe
  4178. Detect frames that are (almost) completely black. Can be useful to
  4179. detect chapter transitions or commercials. Output lines consist of
  4180. the frame number of the detected frame, the percentage of blackness,
  4181. the position in the file if known or -1 and the timestamp in seconds.
  4182. In order to display the output lines, you need to set the loglevel at
  4183. least to the AV_LOG_INFO value.
  4184. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4185. The value represents the percentage of pixels in the picture that
  4186. are below the threshold value.
  4187. It accepts the following parameters:
  4188. @table @option
  4189. @item amount
  4190. The percentage of the pixels that have to be below the threshold; it defaults to
  4191. @code{98}.
  4192. @item threshold, thresh
  4193. The threshold below which a pixel value is considered black; it defaults to
  4194. @code{32}.
  4195. @end table
  4196. @section blend, tblend
  4197. Blend two video frames into each other.
  4198. The @code{blend} filter takes two input streams and outputs one
  4199. stream, the first input is the "top" layer and second input is
  4200. "bottom" layer. By default, the output terminates when the longest input terminates.
  4201. The @code{tblend} (time blend) filter takes two consecutive frames
  4202. from one single stream, and outputs the result obtained by blending
  4203. the new frame on top of the old frame.
  4204. A description of the accepted options follows.
  4205. @table @option
  4206. @item c0_mode
  4207. @item c1_mode
  4208. @item c2_mode
  4209. @item c3_mode
  4210. @item all_mode
  4211. Set blend mode for specific pixel component or all pixel components in case
  4212. of @var{all_mode}. Default value is @code{normal}.
  4213. Available values for component modes are:
  4214. @table @samp
  4215. @item addition
  4216. @item grainmerge
  4217. @item and
  4218. @item average
  4219. @item burn
  4220. @item darken
  4221. @item difference
  4222. @item grainextract
  4223. @item divide
  4224. @item dodge
  4225. @item freeze
  4226. @item exclusion
  4227. @item extremity
  4228. @item glow
  4229. @item hardlight
  4230. @item hardmix
  4231. @item heat
  4232. @item lighten
  4233. @item linearlight
  4234. @item multiply
  4235. @item multiply128
  4236. @item negation
  4237. @item normal
  4238. @item or
  4239. @item overlay
  4240. @item phoenix
  4241. @item pinlight
  4242. @item reflect
  4243. @item screen
  4244. @item softlight
  4245. @item subtract
  4246. @item vividlight
  4247. @item xor
  4248. @end table
  4249. @item c0_opacity
  4250. @item c1_opacity
  4251. @item c2_opacity
  4252. @item c3_opacity
  4253. @item all_opacity
  4254. Set blend opacity for specific pixel component or all pixel components in case
  4255. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4256. @item c0_expr
  4257. @item c1_expr
  4258. @item c2_expr
  4259. @item c3_expr
  4260. @item all_expr
  4261. Set blend expression for specific pixel component or all pixel components in case
  4262. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4263. The expressions can use the following variables:
  4264. @table @option
  4265. @item N
  4266. The sequential number of the filtered frame, starting from @code{0}.
  4267. @item X
  4268. @item Y
  4269. the coordinates of the current sample
  4270. @item W
  4271. @item H
  4272. the width and height of currently filtered plane
  4273. @item SW
  4274. @item SH
  4275. Width and height scale depending on the currently filtered plane. It is the
  4276. ratio between the corresponding luma plane number of pixels and the current
  4277. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4278. @code{0.5,0.5} for chroma planes.
  4279. @item T
  4280. Time of the current frame, expressed in seconds.
  4281. @item TOP, A
  4282. Value of pixel component at current location for first video frame (top layer).
  4283. @item BOTTOM, B
  4284. Value of pixel component at current location for second video frame (bottom layer).
  4285. @end table
  4286. @end table
  4287. The @code{blend} filter also supports the @ref{framesync} options.
  4288. @subsection Examples
  4289. @itemize
  4290. @item
  4291. Apply transition from bottom layer to top layer in first 10 seconds:
  4292. @example
  4293. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4294. @end example
  4295. @item
  4296. Apply linear horizontal transition from top layer to bottom layer:
  4297. @example
  4298. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4299. @end example
  4300. @item
  4301. Apply 1x1 checkerboard effect:
  4302. @example
  4303. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4304. @end example
  4305. @item
  4306. Apply uncover left effect:
  4307. @example
  4308. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4309. @end example
  4310. @item
  4311. Apply uncover down effect:
  4312. @example
  4313. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4314. @end example
  4315. @item
  4316. Apply uncover up-left effect:
  4317. @example
  4318. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4319. @end example
  4320. @item
  4321. Split diagonally video and shows top and bottom layer on each side:
  4322. @example
  4323. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4324. @end example
  4325. @item
  4326. Display differences between the current and the previous frame:
  4327. @example
  4328. tblend=all_mode=grainextract
  4329. @end example
  4330. @end itemize
  4331. @section boxblur
  4332. Apply a boxblur algorithm to the input video.
  4333. It accepts the following parameters:
  4334. @table @option
  4335. @item luma_radius, lr
  4336. @item luma_power, lp
  4337. @item chroma_radius, cr
  4338. @item chroma_power, cp
  4339. @item alpha_radius, ar
  4340. @item alpha_power, ap
  4341. @end table
  4342. A description of the accepted options follows.
  4343. @table @option
  4344. @item luma_radius, lr
  4345. @item chroma_radius, cr
  4346. @item alpha_radius, ar
  4347. Set an expression for the box radius in pixels used for blurring the
  4348. corresponding input plane.
  4349. The radius value must be a non-negative number, and must not be
  4350. greater than the value of the expression @code{min(w,h)/2} for the
  4351. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4352. planes.
  4353. Default value for @option{luma_radius} is "2". If not specified,
  4354. @option{chroma_radius} and @option{alpha_radius} default to the
  4355. corresponding value set for @option{luma_radius}.
  4356. The expressions can contain the following constants:
  4357. @table @option
  4358. @item w
  4359. @item h
  4360. The input width and height in pixels.
  4361. @item cw
  4362. @item ch
  4363. The input chroma image width and height in pixels.
  4364. @item hsub
  4365. @item vsub
  4366. The horizontal and vertical chroma subsample values. For example, for the
  4367. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4368. @end table
  4369. @item luma_power, lp
  4370. @item chroma_power, cp
  4371. @item alpha_power, ap
  4372. Specify how many times the boxblur filter is applied to the
  4373. corresponding plane.
  4374. Default value for @option{luma_power} is 2. If not specified,
  4375. @option{chroma_power} and @option{alpha_power} default to the
  4376. corresponding value set for @option{luma_power}.
  4377. A value of 0 will disable the effect.
  4378. @end table
  4379. @subsection Examples
  4380. @itemize
  4381. @item
  4382. Apply a boxblur filter with the luma, chroma, and alpha radii
  4383. set to 2:
  4384. @example
  4385. boxblur=luma_radius=2:luma_power=1
  4386. boxblur=2:1
  4387. @end example
  4388. @item
  4389. Set the luma radius to 2, and alpha and chroma radius to 0:
  4390. @example
  4391. boxblur=2:1:cr=0:ar=0
  4392. @end example
  4393. @item
  4394. Set the luma and chroma radii to a fraction of the video dimension:
  4395. @example
  4396. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4397. @end example
  4398. @end itemize
  4399. @section bwdif
  4400. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4401. Deinterlacing Filter").
  4402. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4403. interpolation algorithms.
  4404. It accepts the following parameters:
  4405. @table @option
  4406. @item mode
  4407. The interlacing mode to adopt. It accepts one of the following values:
  4408. @table @option
  4409. @item 0, send_frame
  4410. Output one frame for each frame.
  4411. @item 1, send_field
  4412. Output one frame for each field.
  4413. @end table
  4414. The default value is @code{send_field}.
  4415. @item parity
  4416. The picture field parity assumed for the input interlaced video. It accepts one
  4417. of the following values:
  4418. @table @option
  4419. @item 0, tff
  4420. Assume the top field is first.
  4421. @item 1, bff
  4422. Assume the bottom field is first.
  4423. @item -1, auto
  4424. Enable automatic detection of field parity.
  4425. @end table
  4426. The default value is @code{auto}.
  4427. If the interlacing is unknown or the decoder does not export this information,
  4428. top field first will be assumed.
  4429. @item deint
  4430. Specify which frames to deinterlace. Accept one of the following
  4431. values:
  4432. @table @option
  4433. @item 0, all
  4434. Deinterlace all frames.
  4435. @item 1, interlaced
  4436. Only deinterlace frames marked as interlaced.
  4437. @end table
  4438. The default value is @code{all}.
  4439. @end table
  4440. @section chromakey
  4441. YUV colorspace color/chroma keying.
  4442. The filter accepts the following options:
  4443. @table @option
  4444. @item color
  4445. The color which will be replaced with transparency.
  4446. @item similarity
  4447. Similarity percentage with the key color.
  4448. 0.01 matches only the exact key color, while 1.0 matches everything.
  4449. @item blend
  4450. Blend percentage.
  4451. 0.0 makes pixels either fully transparent, or not transparent at all.
  4452. Higher values result in semi-transparent pixels, with a higher transparency
  4453. the more similar the pixels color is to the key color.
  4454. @item yuv
  4455. Signals that the color passed is already in YUV instead of RGB.
  4456. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4457. This can be used to pass exact YUV values as hexadecimal numbers.
  4458. @end table
  4459. @subsection Examples
  4460. @itemize
  4461. @item
  4462. Make every green pixel in the input image transparent:
  4463. @example
  4464. ffmpeg -i input.png -vf chromakey=green out.png
  4465. @end example
  4466. @item
  4467. Overlay a greenscreen-video on top of a static black background.
  4468. @example
  4469. 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
  4470. @end example
  4471. @end itemize
  4472. @section ciescope
  4473. Display CIE color diagram with pixels overlaid onto it.
  4474. The filter accepts the following options:
  4475. @table @option
  4476. @item system
  4477. Set color system.
  4478. @table @samp
  4479. @item ntsc, 470m
  4480. @item ebu, 470bg
  4481. @item smpte
  4482. @item 240m
  4483. @item apple
  4484. @item widergb
  4485. @item cie1931
  4486. @item rec709, hdtv
  4487. @item uhdtv, rec2020
  4488. @end table
  4489. @item cie
  4490. Set CIE system.
  4491. @table @samp
  4492. @item xyy
  4493. @item ucs
  4494. @item luv
  4495. @end table
  4496. @item gamuts
  4497. Set what gamuts to draw.
  4498. See @code{system} option for available values.
  4499. @item size, s
  4500. Set ciescope size, by default set to 512.
  4501. @item intensity, i
  4502. Set intensity used to map input pixel values to CIE diagram.
  4503. @item contrast
  4504. Set contrast used to draw tongue colors that are out of active color system gamut.
  4505. @item corrgamma
  4506. Correct gamma displayed on scope, by default enabled.
  4507. @item showwhite
  4508. Show white point on CIE diagram, by default disabled.
  4509. @item gamma
  4510. Set input gamma. Used only with XYZ input color space.
  4511. @end table
  4512. @section codecview
  4513. Visualize information exported by some codecs.
  4514. Some codecs can export information through frames using side-data or other
  4515. means. For example, some MPEG based codecs export motion vectors through the
  4516. @var{export_mvs} flag in the codec @option{flags2} option.
  4517. The filter accepts the following option:
  4518. @table @option
  4519. @item mv
  4520. Set motion vectors to visualize.
  4521. Available flags for @var{mv} are:
  4522. @table @samp
  4523. @item pf
  4524. forward predicted MVs of P-frames
  4525. @item bf
  4526. forward predicted MVs of B-frames
  4527. @item bb
  4528. backward predicted MVs of B-frames
  4529. @end table
  4530. @item qp
  4531. Display quantization parameters using the chroma planes.
  4532. @item mv_type, mvt
  4533. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4534. Available flags for @var{mv_type} are:
  4535. @table @samp
  4536. @item fp
  4537. forward predicted MVs
  4538. @item bp
  4539. backward predicted MVs
  4540. @end table
  4541. @item frame_type, ft
  4542. Set frame type to visualize motion vectors of.
  4543. Available flags for @var{frame_type} are:
  4544. @table @samp
  4545. @item if
  4546. intra-coded frames (I-frames)
  4547. @item pf
  4548. predicted frames (P-frames)
  4549. @item bf
  4550. bi-directionally predicted frames (B-frames)
  4551. @end table
  4552. @end table
  4553. @subsection Examples
  4554. @itemize
  4555. @item
  4556. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4557. @example
  4558. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4559. @end example
  4560. @item
  4561. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4562. @example
  4563. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4564. @end example
  4565. @end itemize
  4566. @section colorbalance
  4567. Modify intensity of primary colors (red, green and blue) of input frames.
  4568. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4569. regions for the red-cyan, green-magenta or blue-yellow balance.
  4570. A positive adjustment value shifts the balance towards the primary color, a negative
  4571. value towards the complementary color.
  4572. The filter accepts the following options:
  4573. @table @option
  4574. @item rs
  4575. @item gs
  4576. @item bs
  4577. Adjust red, green and blue shadows (darkest pixels).
  4578. @item rm
  4579. @item gm
  4580. @item bm
  4581. Adjust red, green and blue midtones (medium pixels).
  4582. @item rh
  4583. @item gh
  4584. @item bh
  4585. Adjust red, green and blue highlights (brightest pixels).
  4586. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4587. @end table
  4588. @subsection Examples
  4589. @itemize
  4590. @item
  4591. Add red color cast to shadows:
  4592. @example
  4593. colorbalance=rs=.3
  4594. @end example
  4595. @end itemize
  4596. @section colorkey
  4597. RGB colorspace color keying.
  4598. The filter accepts the following options:
  4599. @table @option
  4600. @item color
  4601. The color which will be replaced with transparency.
  4602. @item similarity
  4603. Similarity percentage with the key color.
  4604. 0.01 matches only the exact key color, while 1.0 matches everything.
  4605. @item blend
  4606. Blend percentage.
  4607. 0.0 makes pixels either fully transparent, or not transparent at all.
  4608. Higher values result in semi-transparent pixels, with a higher transparency
  4609. the more similar the pixels color is to the key color.
  4610. @end table
  4611. @subsection Examples
  4612. @itemize
  4613. @item
  4614. Make every green pixel in the input image transparent:
  4615. @example
  4616. ffmpeg -i input.png -vf colorkey=green out.png
  4617. @end example
  4618. @item
  4619. Overlay a greenscreen-video on top of a static background image.
  4620. @example
  4621. 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
  4622. @end example
  4623. @end itemize
  4624. @section colorlevels
  4625. Adjust video input frames using levels.
  4626. The filter accepts the following options:
  4627. @table @option
  4628. @item rimin
  4629. @item gimin
  4630. @item bimin
  4631. @item aimin
  4632. Adjust red, green, blue and alpha input black point.
  4633. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4634. @item rimax
  4635. @item gimax
  4636. @item bimax
  4637. @item aimax
  4638. Adjust red, green, blue and alpha input white point.
  4639. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4640. Input levels are used to lighten highlights (bright tones), darken shadows
  4641. (dark tones), change the balance of bright and dark tones.
  4642. @item romin
  4643. @item gomin
  4644. @item bomin
  4645. @item aomin
  4646. Adjust red, green, blue and alpha output black point.
  4647. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4648. @item romax
  4649. @item gomax
  4650. @item bomax
  4651. @item aomax
  4652. Adjust red, green, blue and alpha output white point.
  4653. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4654. Output levels allows manual selection of a constrained output level range.
  4655. @end table
  4656. @subsection Examples
  4657. @itemize
  4658. @item
  4659. Make video output darker:
  4660. @example
  4661. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4662. @end example
  4663. @item
  4664. Increase contrast:
  4665. @example
  4666. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4667. @end example
  4668. @item
  4669. Make video output lighter:
  4670. @example
  4671. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4672. @end example
  4673. @item
  4674. Increase brightness:
  4675. @example
  4676. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4677. @end example
  4678. @end itemize
  4679. @section colorchannelmixer
  4680. Adjust video input frames by re-mixing color channels.
  4681. This filter modifies a color channel by adding the values associated to
  4682. the other channels of the same pixels. For example if the value to
  4683. modify is red, the output value will be:
  4684. @example
  4685. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4686. @end example
  4687. The filter accepts the following options:
  4688. @table @option
  4689. @item rr
  4690. @item rg
  4691. @item rb
  4692. @item ra
  4693. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4694. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4695. @item gr
  4696. @item gg
  4697. @item gb
  4698. @item ga
  4699. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4700. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4701. @item br
  4702. @item bg
  4703. @item bb
  4704. @item ba
  4705. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4706. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4707. @item ar
  4708. @item ag
  4709. @item ab
  4710. @item aa
  4711. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4712. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4713. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4714. @end table
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Convert source to grayscale:
  4719. @example
  4720. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4721. @end example
  4722. @item
  4723. Simulate sepia tones:
  4724. @example
  4725. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4726. @end example
  4727. @end itemize
  4728. @section colormatrix
  4729. Convert color matrix.
  4730. The filter accepts the following options:
  4731. @table @option
  4732. @item src
  4733. @item dst
  4734. Specify the source and destination color matrix. Both values must be
  4735. specified.
  4736. The accepted values are:
  4737. @table @samp
  4738. @item bt709
  4739. BT.709
  4740. @item fcc
  4741. FCC
  4742. @item bt601
  4743. BT.601
  4744. @item bt470
  4745. BT.470
  4746. @item bt470bg
  4747. BT.470BG
  4748. @item smpte170m
  4749. SMPTE-170M
  4750. @item smpte240m
  4751. SMPTE-240M
  4752. @item bt2020
  4753. BT.2020
  4754. @end table
  4755. @end table
  4756. For example to convert from BT.601 to SMPTE-240M, use the command:
  4757. @example
  4758. colormatrix=bt601:smpte240m
  4759. @end example
  4760. @section colorspace
  4761. Convert colorspace, transfer characteristics or color primaries.
  4762. Input video needs to have an even size.
  4763. The filter accepts the following options:
  4764. @table @option
  4765. @anchor{all}
  4766. @item all
  4767. Specify all color properties at once.
  4768. The accepted values are:
  4769. @table @samp
  4770. @item bt470m
  4771. BT.470M
  4772. @item bt470bg
  4773. BT.470BG
  4774. @item bt601-6-525
  4775. BT.601-6 525
  4776. @item bt601-6-625
  4777. BT.601-6 625
  4778. @item bt709
  4779. BT.709
  4780. @item smpte170m
  4781. SMPTE-170M
  4782. @item smpte240m
  4783. SMPTE-240M
  4784. @item bt2020
  4785. BT.2020
  4786. @end table
  4787. @anchor{space}
  4788. @item space
  4789. Specify output colorspace.
  4790. The accepted values are:
  4791. @table @samp
  4792. @item bt709
  4793. BT.709
  4794. @item fcc
  4795. FCC
  4796. @item bt470bg
  4797. BT.470BG or BT.601-6 625
  4798. @item smpte170m
  4799. SMPTE-170M or BT.601-6 525
  4800. @item smpte240m
  4801. SMPTE-240M
  4802. @item ycgco
  4803. YCgCo
  4804. @item bt2020ncl
  4805. BT.2020 with non-constant luminance
  4806. @end table
  4807. @anchor{trc}
  4808. @item trc
  4809. Specify output transfer characteristics.
  4810. The accepted values are:
  4811. @table @samp
  4812. @item bt709
  4813. BT.709
  4814. @item bt470m
  4815. BT.470M
  4816. @item bt470bg
  4817. BT.470BG
  4818. @item gamma22
  4819. Constant gamma of 2.2
  4820. @item gamma28
  4821. Constant gamma of 2.8
  4822. @item smpte170m
  4823. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4824. @item smpte240m
  4825. SMPTE-240M
  4826. @item srgb
  4827. SRGB
  4828. @item iec61966-2-1
  4829. iec61966-2-1
  4830. @item iec61966-2-4
  4831. iec61966-2-4
  4832. @item xvycc
  4833. xvycc
  4834. @item bt2020-10
  4835. BT.2020 for 10-bits content
  4836. @item bt2020-12
  4837. BT.2020 for 12-bits content
  4838. @end table
  4839. @anchor{primaries}
  4840. @item primaries
  4841. Specify output color primaries.
  4842. The accepted values are:
  4843. @table @samp
  4844. @item bt709
  4845. BT.709
  4846. @item bt470m
  4847. BT.470M
  4848. @item bt470bg
  4849. BT.470BG or BT.601-6 625
  4850. @item smpte170m
  4851. SMPTE-170M or BT.601-6 525
  4852. @item smpte240m
  4853. SMPTE-240M
  4854. @item film
  4855. film
  4856. @item smpte431
  4857. SMPTE-431
  4858. @item smpte432
  4859. SMPTE-432
  4860. @item bt2020
  4861. BT.2020
  4862. @item jedec-p22
  4863. JEDEC P22 phosphors
  4864. @end table
  4865. @anchor{range}
  4866. @item range
  4867. Specify output color range.
  4868. The accepted values are:
  4869. @table @samp
  4870. @item tv
  4871. TV (restricted) range
  4872. @item mpeg
  4873. MPEG (restricted) range
  4874. @item pc
  4875. PC (full) range
  4876. @item jpeg
  4877. JPEG (full) range
  4878. @end table
  4879. @item format
  4880. Specify output color format.
  4881. The accepted values are:
  4882. @table @samp
  4883. @item yuv420p
  4884. YUV 4:2:0 planar 8-bits
  4885. @item yuv420p10
  4886. YUV 4:2:0 planar 10-bits
  4887. @item yuv420p12
  4888. YUV 4:2:0 planar 12-bits
  4889. @item yuv422p
  4890. YUV 4:2:2 planar 8-bits
  4891. @item yuv422p10
  4892. YUV 4:2:2 planar 10-bits
  4893. @item yuv422p12
  4894. YUV 4:2:2 planar 12-bits
  4895. @item yuv444p
  4896. YUV 4:4:4 planar 8-bits
  4897. @item yuv444p10
  4898. YUV 4:4:4 planar 10-bits
  4899. @item yuv444p12
  4900. YUV 4:4:4 planar 12-bits
  4901. @end table
  4902. @item fast
  4903. Do a fast conversion, which skips gamma/primary correction. This will take
  4904. significantly less CPU, but will be mathematically incorrect. To get output
  4905. compatible with that produced by the colormatrix filter, use fast=1.
  4906. @item dither
  4907. Specify dithering mode.
  4908. The accepted values are:
  4909. @table @samp
  4910. @item none
  4911. No dithering
  4912. @item fsb
  4913. Floyd-Steinberg dithering
  4914. @end table
  4915. @item wpadapt
  4916. Whitepoint adaptation mode.
  4917. The accepted values are:
  4918. @table @samp
  4919. @item bradford
  4920. Bradford whitepoint adaptation
  4921. @item vonkries
  4922. von Kries whitepoint adaptation
  4923. @item identity
  4924. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4925. @end table
  4926. @item iall
  4927. Override all input properties at once. Same accepted values as @ref{all}.
  4928. @item ispace
  4929. Override input colorspace. Same accepted values as @ref{space}.
  4930. @item iprimaries
  4931. Override input color primaries. Same accepted values as @ref{primaries}.
  4932. @item itrc
  4933. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4934. @item irange
  4935. Override input color range. Same accepted values as @ref{range}.
  4936. @end table
  4937. The filter converts the transfer characteristics, color space and color
  4938. primaries to the specified user values. The output value, if not specified,
  4939. is set to a default value based on the "all" property. If that property is
  4940. also not specified, the filter will log an error. The output color range and
  4941. format default to the same value as the input color range and format. The
  4942. input transfer characteristics, color space, color primaries and color range
  4943. should be set on the input data. If any of these are missing, the filter will
  4944. log an error and no conversion will take place.
  4945. For example to convert the input to SMPTE-240M, use the command:
  4946. @example
  4947. colorspace=smpte240m
  4948. @end example
  4949. @section convolution
  4950. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  4951. The filter accepts the following options:
  4952. @table @option
  4953. @item 0m
  4954. @item 1m
  4955. @item 2m
  4956. @item 3m
  4957. Set matrix for each plane.
  4958. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  4959. and from 1 to 49 odd number of signed integers in @var{row} mode.
  4960. @item 0rdiv
  4961. @item 1rdiv
  4962. @item 2rdiv
  4963. @item 3rdiv
  4964. Set multiplier for calculated value for each plane.
  4965. If unset or 0, it will be sum of all matrix elements.
  4966. @item 0bias
  4967. @item 1bias
  4968. @item 2bias
  4969. @item 3bias
  4970. Set bias for each plane. This value is added to the result of the multiplication.
  4971. Useful for making the overall image brighter or darker. Default is 0.0.
  4972. @item 0mode
  4973. @item 1mode
  4974. @item 2mode
  4975. @item 3mode
  4976. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  4977. Default is @var{square}.
  4978. @end table
  4979. @subsection Examples
  4980. @itemize
  4981. @item
  4982. Apply sharpen:
  4983. @example
  4984. 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"
  4985. @end example
  4986. @item
  4987. Apply blur:
  4988. @example
  4989. 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"
  4990. @end example
  4991. @item
  4992. Apply edge enhance:
  4993. @example
  4994. 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"
  4995. @end example
  4996. @item
  4997. Apply edge detect:
  4998. @example
  4999. 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"
  5000. @end example
  5001. @item
  5002. Apply laplacian edge detector which includes diagonals:
  5003. @example
  5004. 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"
  5005. @end example
  5006. @item
  5007. Apply emboss:
  5008. @example
  5009. 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"
  5010. @end example
  5011. @end itemize
  5012. @section convolve
  5013. Apply 2D convolution of video stream in frequency domain using second stream
  5014. as impulse.
  5015. The filter accepts the following options:
  5016. @table @option
  5017. @item planes
  5018. Set which planes to process.
  5019. @item impulse
  5020. Set which impulse video frames will be processed, can be @var{first}
  5021. or @var{all}. Default is @var{all}.
  5022. @end table
  5023. The @code{convolve} filter also supports the @ref{framesync} options.
  5024. @section copy
  5025. Copy the input video source unchanged to the output. This is mainly useful for
  5026. testing purposes.
  5027. @anchor{coreimage}
  5028. @section coreimage
  5029. Video filtering on GPU using Apple's CoreImage API on OSX.
  5030. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5031. processed by video hardware. However, software-based OpenGL implementations
  5032. exist which means there is no guarantee for hardware processing. It depends on
  5033. the respective OSX.
  5034. There are many filters and image generators provided by Apple that come with a
  5035. large variety of options. The filter has to be referenced by its name along
  5036. with its options.
  5037. The coreimage filter accepts the following options:
  5038. @table @option
  5039. @item list_filters
  5040. List all available filters and generators along with all their respective
  5041. options as well as possible minimum and maximum values along with the default
  5042. values.
  5043. @example
  5044. list_filters=true
  5045. @end example
  5046. @item filter
  5047. Specify all filters by their respective name and options.
  5048. Use @var{list_filters} to determine all valid filter names and options.
  5049. Numerical options are specified by a float value and are automatically clamped
  5050. to their respective value range. Vector and color options have to be specified
  5051. by a list of space separated float values. Character escaping has to be done.
  5052. A special option name @code{default} is available to use default options for a
  5053. filter.
  5054. It is required to specify either @code{default} or at least one of the filter options.
  5055. All omitted options are used with their default values.
  5056. The syntax of the filter string is as follows:
  5057. @example
  5058. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5059. @end example
  5060. @item output_rect
  5061. Specify a rectangle where the output of the filter chain is copied into the
  5062. input image. It is given by a list of space separated float values:
  5063. @example
  5064. output_rect=x\ y\ width\ height
  5065. @end example
  5066. If not given, the output rectangle equals the dimensions of the input image.
  5067. The output rectangle is automatically cropped at the borders of the input
  5068. image. Negative values are valid for each component.
  5069. @example
  5070. output_rect=25\ 25\ 100\ 100
  5071. @end example
  5072. @end table
  5073. Several filters can be chained for successive processing without GPU-HOST
  5074. transfers allowing for fast processing of complex filter chains.
  5075. Currently, only filters with zero (generators) or exactly one (filters) input
  5076. image and one output image are supported. Also, transition filters are not yet
  5077. usable as intended.
  5078. Some filters generate output images with additional padding depending on the
  5079. respective filter kernel. The padding is automatically removed to ensure the
  5080. filter output has the same size as the input image.
  5081. For image generators, the size of the output image is determined by the
  5082. previous output image of the filter chain or the input image of the whole
  5083. filterchain, respectively. The generators do not use the pixel information of
  5084. this image to generate their output. However, the generated output is
  5085. blended onto this image, resulting in partial or complete coverage of the
  5086. output image.
  5087. The @ref{coreimagesrc} video source can be used for generating input images
  5088. which are directly fed into the filter chain. By using it, providing input
  5089. images by another video source or an input video is not required.
  5090. @subsection Examples
  5091. @itemize
  5092. @item
  5093. List all filters available:
  5094. @example
  5095. coreimage=list_filters=true
  5096. @end example
  5097. @item
  5098. Use the CIBoxBlur filter with default options to blur an image:
  5099. @example
  5100. coreimage=filter=CIBoxBlur@@default
  5101. @end example
  5102. @item
  5103. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5104. its center at 100x100 and a radius of 50 pixels:
  5105. @example
  5106. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5107. @end example
  5108. @item
  5109. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5110. given as complete and escaped command-line for Apple's standard bash shell:
  5111. @example
  5112. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5113. @end example
  5114. @end itemize
  5115. @section crop
  5116. Crop the input video to given dimensions.
  5117. It accepts the following parameters:
  5118. @table @option
  5119. @item w, out_w
  5120. The width of the output video. It defaults to @code{iw}.
  5121. This expression is evaluated only once during the filter
  5122. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5123. @item h, out_h
  5124. The height of the output video. It defaults to @code{ih}.
  5125. This expression is evaluated only once during the filter
  5126. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5127. @item x
  5128. The horizontal position, in the input video, of the left edge of the output
  5129. video. It defaults to @code{(in_w-out_w)/2}.
  5130. This expression is evaluated per-frame.
  5131. @item y
  5132. The vertical position, in the input video, of the top edge of the output video.
  5133. It defaults to @code{(in_h-out_h)/2}.
  5134. This expression is evaluated per-frame.
  5135. @item keep_aspect
  5136. If set to 1 will force the output display aspect ratio
  5137. to be the same of the input, by changing the output sample aspect
  5138. ratio. It defaults to 0.
  5139. @item exact
  5140. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5141. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5142. It defaults to 0.
  5143. @end table
  5144. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5145. expressions containing the following constants:
  5146. @table @option
  5147. @item x
  5148. @item y
  5149. The computed values for @var{x} and @var{y}. They are evaluated for
  5150. each new frame.
  5151. @item in_w
  5152. @item in_h
  5153. The input width and height.
  5154. @item iw
  5155. @item ih
  5156. These are the same as @var{in_w} and @var{in_h}.
  5157. @item out_w
  5158. @item out_h
  5159. The output (cropped) width and height.
  5160. @item ow
  5161. @item oh
  5162. These are the same as @var{out_w} and @var{out_h}.
  5163. @item a
  5164. same as @var{iw} / @var{ih}
  5165. @item sar
  5166. input sample aspect ratio
  5167. @item dar
  5168. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5169. @item hsub
  5170. @item vsub
  5171. horizontal and vertical chroma subsample values. For example for the
  5172. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5173. @item n
  5174. The number of the input frame, starting from 0.
  5175. @item pos
  5176. the position in the file of the input frame, NAN if unknown
  5177. @item t
  5178. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5179. @end table
  5180. The expression for @var{out_w} may depend on the value of @var{out_h},
  5181. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5182. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5183. evaluated after @var{out_w} and @var{out_h}.
  5184. The @var{x} and @var{y} parameters specify the expressions for the
  5185. position of the top-left corner of the output (non-cropped) area. They
  5186. are evaluated for each frame. If the evaluated value is not valid, it
  5187. is approximated to the nearest valid value.
  5188. The expression for @var{x} may depend on @var{y}, and the expression
  5189. for @var{y} may depend on @var{x}.
  5190. @subsection Examples
  5191. @itemize
  5192. @item
  5193. Crop area with size 100x100 at position (12,34).
  5194. @example
  5195. crop=100:100:12:34
  5196. @end example
  5197. Using named options, the example above becomes:
  5198. @example
  5199. crop=w=100:h=100:x=12:y=34
  5200. @end example
  5201. @item
  5202. Crop the central input area with size 100x100:
  5203. @example
  5204. crop=100:100
  5205. @end example
  5206. @item
  5207. Crop the central input area with size 2/3 of the input video:
  5208. @example
  5209. crop=2/3*in_w:2/3*in_h
  5210. @end example
  5211. @item
  5212. Crop the input video central square:
  5213. @example
  5214. crop=out_w=in_h
  5215. crop=in_h
  5216. @end example
  5217. @item
  5218. Delimit the rectangle with the top-left corner placed at position
  5219. 100:100 and the right-bottom corner corresponding to the right-bottom
  5220. corner of the input image.
  5221. @example
  5222. crop=in_w-100:in_h-100:100:100
  5223. @end example
  5224. @item
  5225. Crop 10 pixels from the left and right borders, and 20 pixels from
  5226. the top and bottom borders
  5227. @example
  5228. crop=in_w-2*10:in_h-2*20
  5229. @end example
  5230. @item
  5231. Keep only the bottom right quarter of the input image:
  5232. @example
  5233. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5234. @end example
  5235. @item
  5236. Crop height for getting Greek harmony:
  5237. @example
  5238. crop=in_w:1/PHI*in_w
  5239. @end example
  5240. @item
  5241. Apply trembling effect:
  5242. @example
  5243. 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)
  5244. @end example
  5245. @item
  5246. Apply erratic camera effect depending on timestamp:
  5247. @example
  5248. 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)"
  5249. @end example
  5250. @item
  5251. Set x depending on the value of y:
  5252. @example
  5253. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5254. @end example
  5255. @end itemize
  5256. @subsection Commands
  5257. This filter supports the following commands:
  5258. @table @option
  5259. @item w, out_w
  5260. @item h, out_h
  5261. @item x
  5262. @item y
  5263. Set width/height of the output video and the horizontal/vertical position
  5264. in the input video.
  5265. The command accepts the same syntax of the corresponding option.
  5266. If the specified expression is not valid, it is kept at its current
  5267. value.
  5268. @end table
  5269. @section cropdetect
  5270. Auto-detect the crop size.
  5271. It calculates the necessary cropping parameters and prints the
  5272. recommended parameters via the logging system. The detected dimensions
  5273. correspond to the non-black area of the input video.
  5274. It accepts the following parameters:
  5275. @table @option
  5276. @item limit
  5277. Set higher black value threshold, which can be optionally specified
  5278. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5279. value greater to the set value is considered non-black. It defaults to 24.
  5280. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5281. on the bitdepth of the pixel format.
  5282. @item round
  5283. The value which the width/height should be divisible by. It defaults to
  5284. 16. The offset is automatically adjusted to center the video. Use 2 to
  5285. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5286. encoding to most video codecs.
  5287. @item reset_count, reset
  5288. Set the counter that determines after how many frames cropdetect will
  5289. reset the previously detected largest video area and start over to
  5290. detect the current optimal crop area. Default value is 0.
  5291. This can be useful when channel logos distort the video area. 0
  5292. indicates 'never reset', and returns the largest area encountered during
  5293. playback.
  5294. @end table
  5295. @anchor{curves}
  5296. @section curves
  5297. Apply color adjustments using curves.
  5298. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5299. component (red, green and blue) has its values defined by @var{N} key points
  5300. tied from each other using a smooth curve. The x-axis represents the pixel
  5301. values from the input frame, and the y-axis the new pixel values to be set for
  5302. the output frame.
  5303. By default, a component curve is defined by the two points @var{(0;0)} and
  5304. @var{(1;1)}. This creates a straight line where each original pixel value is
  5305. "adjusted" to its own value, which means no change to the image.
  5306. The filter allows you to redefine these two points and add some more. A new
  5307. curve (using a natural cubic spline interpolation) will be define to pass
  5308. smoothly through all these new coordinates. The new defined points needs to be
  5309. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5310. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5311. the vector spaces, the values will be clipped accordingly.
  5312. The filter accepts the following options:
  5313. @table @option
  5314. @item preset
  5315. Select one of the available color presets. This option can be used in addition
  5316. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5317. options takes priority on the preset values.
  5318. Available presets are:
  5319. @table @samp
  5320. @item none
  5321. @item color_negative
  5322. @item cross_process
  5323. @item darker
  5324. @item increase_contrast
  5325. @item lighter
  5326. @item linear_contrast
  5327. @item medium_contrast
  5328. @item negative
  5329. @item strong_contrast
  5330. @item vintage
  5331. @end table
  5332. Default is @code{none}.
  5333. @item master, m
  5334. Set the master key points. These points will define a second pass mapping. It
  5335. is sometimes called a "luminance" or "value" mapping. It can be used with
  5336. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5337. post-processing LUT.
  5338. @item red, r
  5339. Set the key points for the red component.
  5340. @item green, g
  5341. Set the key points for the green component.
  5342. @item blue, b
  5343. Set the key points for the blue component.
  5344. @item all
  5345. Set the key points for all components (not including master).
  5346. Can be used in addition to the other key points component
  5347. options. In this case, the unset component(s) will fallback on this
  5348. @option{all} setting.
  5349. @item psfile
  5350. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5351. @item plot
  5352. Save Gnuplot script of the curves in specified file.
  5353. @end table
  5354. To avoid some filtergraph syntax conflicts, each key points list need to be
  5355. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5356. @subsection Examples
  5357. @itemize
  5358. @item
  5359. Increase slightly the middle level of blue:
  5360. @example
  5361. curves=blue='0/0 0.5/0.58 1/1'
  5362. @end example
  5363. @item
  5364. Vintage effect:
  5365. @example
  5366. 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'
  5367. @end example
  5368. Here we obtain the following coordinates for each components:
  5369. @table @var
  5370. @item red
  5371. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5372. @item green
  5373. @code{(0;0) (0.50;0.48) (1;1)}
  5374. @item blue
  5375. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5376. @end table
  5377. @item
  5378. The previous example can also be achieved with the associated built-in preset:
  5379. @example
  5380. curves=preset=vintage
  5381. @end example
  5382. @item
  5383. Or simply:
  5384. @example
  5385. curves=vintage
  5386. @end example
  5387. @item
  5388. Use a Photoshop preset and redefine the points of the green component:
  5389. @example
  5390. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5391. @end example
  5392. @item
  5393. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5394. and @command{gnuplot}:
  5395. @example
  5396. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5397. gnuplot -p /tmp/curves.plt
  5398. @end example
  5399. @end itemize
  5400. @section datascope
  5401. Video data analysis filter.
  5402. This filter shows hexadecimal pixel values of part of video.
  5403. The filter accepts the following options:
  5404. @table @option
  5405. @item size, s
  5406. Set output video size.
  5407. @item x
  5408. Set x offset from where to pick pixels.
  5409. @item y
  5410. Set y offset from where to pick pixels.
  5411. @item mode
  5412. Set scope mode, can be one of the following:
  5413. @table @samp
  5414. @item mono
  5415. Draw hexadecimal pixel values with white color on black background.
  5416. @item color
  5417. Draw hexadecimal pixel values with input video pixel color on black
  5418. background.
  5419. @item color2
  5420. Draw hexadecimal pixel values on color background picked from input video,
  5421. the text color is picked in such way so its always visible.
  5422. @end table
  5423. @item axis
  5424. Draw rows and columns numbers on left and top of video.
  5425. @item opacity
  5426. Set background opacity.
  5427. @end table
  5428. @section dctdnoiz
  5429. Denoise frames using 2D DCT (frequency domain filtering).
  5430. This filter is not designed for real time.
  5431. The filter accepts the following options:
  5432. @table @option
  5433. @item sigma, s
  5434. Set the noise sigma constant.
  5435. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5436. coefficient (absolute value) below this threshold with be dropped.
  5437. If you need a more advanced filtering, see @option{expr}.
  5438. Default is @code{0}.
  5439. @item overlap
  5440. Set number overlapping pixels for each block. Since the filter can be slow, you
  5441. may want to reduce this value, at the cost of a less effective filter and the
  5442. risk of various artefacts.
  5443. If the overlapping value doesn't permit processing the whole input width or
  5444. height, a warning will be displayed and according borders won't be denoised.
  5445. Default value is @var{blocksize}-1, which is the best possible setting.
  5446. @item expr, e
  5447. Set the coefficient factor expression.
  5448. For each coefficient of a DCT block, this expression will be evaluated as a
  5449. multiplier value for the coefficient.
  5450. If this is option is set, the @option{sigma} option will be ignored.
  5451. The absolute value of the coefficient can be accessed through the @var{c}
  5452. variable.
  5453. @item n
  5454. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5455. @var{blocksize}, which is the width and height of the processed blocks.
  5456. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5457. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5458. on the speed processing. Also, a larger block size does not necessarily means a
  5459. better de-noising.
  5460. @end table
  5461. @subsection Examples
  5462. Apply a denoise with a @option{sigma} of @code{4.5}:
  5463. @example
  5464. dctdnoiz=4.5
  5465. @end example
  5466. The same operation can be achieved using the expression system:
  5467. @example
  5468. dctdnoiz=e='gte(c, 4.5*3)'
  5469. @end example
  5470. Violent denoise using a block size of @code{16x16}:
  5471. @example
  5472. dctdnoiz=15:n=4
  5473. @end example
  5474. @section deband
  5475. Remove banding artifacts from input video.
  5476. It works by replacing banded pixels with average value of referenced pixels.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item 1thr
  5480. @item 2thr
  5481. @item 3thr
  5482. @item 4thr
  5483. Set banding detection threshold for each plane. Default is 0.02.
  5484. Valid range is 0.00003 to 0.5.
  5485. If difference between current pixel and reference pixel is less than threshold,
  5486. it will be considered as banded.
  5487. @item range, r
  5488. Banding detection range in pixels. Default is 16. If positive, random number
  5489. in range 0 to set value will be used. If negative, exact absolute value
  5490. will be used.
  5491. The range defines square of four pixels around current pixel.
  5492. @item direction, d
  5493. Set direction in radians from which four pixel will be compared. If positive,
  5494. random direction from 0 to set direction will be picked. If negative, exact of
  5495. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5496. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5497. column.
  5498. @item blur, b
  5499. If enabled, current pixel is compared with average value of all four
  5500. surrounding pixels. The default is enabled. If disabled current pixel is
  5501. compared with all four surrounding pixels. The pixel is considered banded
  5502. if only all four differences with surrounding pixels are less than threshold.
  5503. @item coupling, c
  5504. If enabled, current pixel is changed if and only if all pixel components are banded,
  5505. e.g. banding detection threshold is triggered for all color components.
  5506. The default is disabled.
  5507. @end table
  5508. @section deblock
  5509. Remove blocking artifacts from input video.
  5510. The filter accepts the following options:
  5511. @table @option
  5512. @item filter
  5513. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5514. This controls what kind of deblocking is applied.
  5515. @item block
  5516. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5517. @item alpha
  5518. @item beta
  5519. @item gamma
  5520. @item delta
  5521. Set blocking detection thresholds. Allowed range is 0 to 1.
  5522. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5523. Using higher threshold gives more deblocking strength.
  5524. Setting @var{alpha} controls threshold detection at exact edge of block.
  5525. Remaining options controls threshold detection near the edge. Each one for
  5526. below/above or left/right. Setting any of those to @var{0} disables
  5527. deblocking.
  5528. @item planes
  5529. Set planes to filter. Default is to filter all available planes.
  5530. @end table
  5531. @subsection Examples
  5532. @itemize
  5533. @item
  5534. Deblock using weak filter and block size of 4 pixels.
  5535. @example
  5536. deblock=filter=weak:block=4
  5537. @end example
  5538. @item
  5539. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5540. deblocking more edges.
  5541. @example
  5542. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5543. @end example
  5544. @item
  5545. Similar as above, but filter only first plane.
  5546. @example
  5547. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5548. @end example
  5549. @item
  5550. Similar as above, but filter only second and third plane.
  5551. @example
  5552. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5553. @end example
  5554. @end itemize
  5555. @anchor{decimate}
  5556. @section decimate
  5557. Drop duplicated frames at regular intervals.
  5558. The filter accepts the following options:
  5559. @table @option
  5560. @item cycle
  5561. Set the number of frames from which one will be dropped. Setting this to
  5562. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5563. Default is @code{5}.
  5564. @item dupthresh
  5565. Set the threshold for duplicate detection. If the difference metric for a frame
  5566. is less than or equal to this value, then it is declared as duplicate. Default
  5567. is @code{1.1}
  5568. @item scthresh
  5569. Set scene change threshold. Default is @code{15}.
  5570. @item blockx
  5571. @item blocky
  5572. Set the size of the x and y-axis blocks used during metric calculations.
  5573. Larger blocks give better noise suppression, but also give worse detection of
  5574. small movements. Must be a power of two. Default is @code{32}.
  5575. @item ppsrc
  5576. Mark main input as a pre-processed input and activate clean source input
  5577. stream. This allows the input to be pre-processed with various filters to help
  5578. the metrics calculation while keeping the frame selection lossless. When set to
  5579. @code{1}, the first stream is for the pre-processed input, and the second
  5580. stream is the clean source from where the kept frames are chosen. Default is
  5581. @code{0}.
  5582. @item chroma
  5583. Set whether or not chroma is considered in the metric calculations. Default is
  5584. @code{1}.
  5585. @end table
  5586. @section deconvolve
  5587. Apply 2D deconvolution of video stream in frequency domain using second stream
  5588. as impulse.
  5589. The filter accepts the following options:
  5590. @table @option
  5591. @item planes
  5592. Set which planes to process.
  5593. @item impulse
  5594. Set which impulse video frames will be processed, can be @var{first}
  5595. or @var{all}. Default is @var{all}.
  5596. @item noise
  5597. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5598. and height are not same and not power of 2 or if stream prior to convolving
  5599. had noise.
  5600. @end table
  5601. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5602. @section deflate
  5603. Apply deflate effect to the video.
  5604. This filter replaces the pixel by the local(3x3) average by taking into account
  5605. only values lower than the pixel.
  5606. It accepts the following options:
  5607. @table @option
  5608. @item threshold0
  5609. @item threshold1
  5610. @item threshold2
  5611. @item threshold3
  5612. Limit the maximum change for each plane, default is 65535.
  5613. If 0, plane will remain unchanged.
  5614. @end table
  5615. @section deflicker
  5616. Remove temporal frame luminance variations.
  5617. It accepts the following options:
  5618. @table @option
  5619. @item size, s
  5620. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5621. @item mode, m
  5622. Set averaging mode to smooth temporal luminance variations.
  5623. Available values are:
  5624. @table @samp
  5625. @item am
  5626. Arithmetic mean
  5627. @item gm
  5628. Geometric mean
  5629. @item hm
  5630. Harmonic mean
  5631. @item qm
  5632. Quadratic mean
  5633. @item cm
  5634. Cubic mean
  5635. @item pm
  5636. Power mean
  5637. @item median
  5638. Median
  5639. @end table
  5640. @item bypass
  5641. Do not actually modify frame. Useful when one only wants metadata.
  5642. @end table
  5643. @section dejudder
  5644. Remove judder produced by partially interlaced telecined content.
  5645. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5646. source was partially telecined content then the output of @code{pullup,dejudder}
  5647. will have a variable frame rate. May change the recorded frame rate of the
  5648. container. Aside from that change, this filter will not affect constant frame
  5649. rate video.
  5650. The option available in this filter is:
  5651. @table @option
  5652. @item cycle
  5653. Specify the length of the window over which the judder repeats.
  5654. Accepts any integer greater than 1. Useful values are:
  5655. @table @samp
  5656. @item 4
  5657. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5658. @item 5
  5659. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5660. @item 20
  5661. If a mixture of the two.
  5662. @end table
  5663. The default is @samp{4}.
  5664. @end table
  5665. @section delogo
  5666. Suppress a TV station logo by a simple interpolation of the surrounding
  5667. pixels. Just set a rectangle covering the logo and watch it disappear
  5668. (and sometimes something even uglier appear - your mileage may vary).
  5669. It accepts the following parameters:
  5670. @table @option
  5671. @item x
  5672. @item y
  5673. Specify the top left corner coordinates of the logo. They must be
  5674. specified.
  5675. @item w
  5676. @item h
  5677. Specify the width and height of the logo to clear. They must be
  5678. specified.
  5679. @item band, t
  5680. Specify the thickness of the fuzzy edge of the rectangle (added to
  5681. @var{w} and @var{h}). The default value is 1. This option is
  5682. deprecated, setting higher values should no longer be necessary and
  5683. is not recommended.
  5684. @item show
  5685. When set to 1, a green rectangle is drawn on the screen to simplify
  5686. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5687. The default value is 0.
  5688. The rectangle is drawn on the outermost pixels which will be (partly)
  5689. replaced with interpolated values. The values of the next pixels
  5690. immediately outside this rectangle in each direction will be used to
  5691. compute the interpolated pixel values inside the rectangle.
  5692. @end table
  5693. @subsection Examples
  5694. @itemize
  5695. @item
  5696. Set a rectangle covering the area with top left corner coordinates 0,0
  5697. and size 100x77, and a band of size 10:
  5698. @example
  5699. delogo=x=0:y=0:w=100:h=77:band=10
  5700. @end example
  5701. @end itemize
  5702. @section deshake
  5703. Attempt to fix small changes in horizontal and/or vertical shift. This
  5704. filter helps remove camera shake from hand-holding a camera, bumping a
  5705. tripod, moving on a vehicle, etc.
  5706. The filter accepts the following options:
  5707. @table @option
  5708. @item x
  5709. @item y
  5710. @item w
  5711. @item h
  5712. Specify a rectangular area where to limit the search for motion
  5713. vectors.
  5714. If desired the search for motion vectors can be limited to a
  5715. rectangular area of the frame defined by its top left corner, width
  5716. and height. These parameters have the same meaning as the drawbox
  5717. filter which can be used to visualise the position of the bounding
  5718. box.
  5719. This is useful when simultaneous movement of subjects within the frame
  5720. might be confused for camera motion by the motion vector search.
  5721. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5722. then the full frame is used. This allows later options to be set
  5723. without specifying the bounding box for the motion vector search.
  5724. Default - search the whole frame.
  5725. @item rx
  5726. @item ry
  5727. Specify the maximum extent of movement in x and y directions in the
  5728. range 0-64 pixels. Default 16.
  5729. @item edge
  5730. Specify how to generate pixels to fill blanks at the edge of the
  5731. frame. Available values are:
  5732. @table @samp
  5733. @item blank, 0
  5734. Fill zeroes at blank locations
  5735. @item original, 1
  5736. Original image at blank locations
  5737. @item clamp, 2
  5738. Extruded edge value at blank locations
  5739. @item mirror, 3
  5740. Mirrored edge at blank locations
  5741. @end table
  5742. Default value is @samp{mirror}.
  5743. @item blocksize
  5744. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5745. default 8.
  5746. @item contrast
  5747. Specify the contrast threshold for blocks. Only blocks with more than
  5748. the specified contrast (difference between darkest and lightest
  5749. pixels) will be considered. Range 1-255, default 125.
  5750. @item search
  5751. Specify the search strategy. Available values are:
  5752. @table @samp
  5753. @item exhaustive, 0
  5754. Set exhaustive search
  5755. @item less, 1
  5756. Set less exhaustive search.
  5757. @end table
  5758. Default value is @samp{exhaustive}.
  5759. @item filename
  5760. If set then a detailed log of the motion search is written to the
  5761. specified file.
  5762. @end table
  5763. @section despill
  5764. Remove unwanted contamination of foreground colors, caused by reflected color of
  5765. greenscreen or bluescreen.
  5766. This filter accepts the following options:
  5767. @table @option
  5768. @item type
  5769. Set what type of despill to use.
  5770. @item mix
  5771. Set how spillmap will be generated.
  5772. @item expand
  5773. Set how much to get rid of still remaining spill.
  5774. @item red
  5775. Controls amount of red in spill area.
  5776. @item green
  5777. Controls amount of green in spill area.
  5778. Should be -1 for greenscreen.
  5779. @item blue
  5780. Controls amount of blue in spill area.
  5781. Should be -1 for bluescreen.
  5782. @item brightness
  5783. Controls brightness of spill area, preserving colors.
  5784. @item alpha
  5785. Modify alpha from generated spillmap.
  5786. @end table
  5787. @section detelecine
  5788. Apply an exact inverse of the telecine operation. It requires a predefined
  5789. pattern specified using the pattern option which must be the same as that passed
  5790. to the telecine filter.
  5791. This filter accepts the following options:
  5792. @table @option
  5793. @item first_field
  5794. @table @samp
  5795. @item top, t
  5796. top field first
  5797. @item bottom, b
  5798. bottom field first
  5799. The default value is @code{top}.
  5800. @end table
  5801. @item pattern
  5802. A string of numbers representing the pulldown pattern you wish to apply.
  5803. The default value is @code{23}.
  5804. @item start_frame
  5805. A number representing position of the first frame with respect to the telecine
  5806. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5807. @end table
  5808. @section dilation
  5809. Apply dilation effect to the video.
  5810. This filter replaces the pixel by the local(3x3) maximum.
  5811. It accepts the following options:
  5812. @table @option
  5813. @item threshold0
  5814. @item threshold1
  5815. @item threshold2
  5816. @item threshold3
  5817. Limit the maximum change for each plane, default is 65535.
  5818. If 0, plane will remain unchanged.
  5819. @item coordinates
  5820. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5821. pixels are used.
  5822. Flags to local 3x3 coordinates maps like this:
  5823. 1 2 3
  5824. 4 5
  5825. 6 7 8
  5826. @end table
  5827. @section displace
  5828. Displace pixels as indicated by second and third input stream.
  5829. It takes three input streams and outputs one stream, the first input is the
  5830. source, and second and third input are displacement maps.
  5831. The second input specifies how much to displace pixels along the
  5832. x-axis, while the third input specifies how much to displace pixels
  5833. along the y-axis.
  5834. If one of displacement map streams terminates, last frame from that
  5835. displacement map will be used.
  5836. Note that once generated, displacements maps can be reused over and over again.
  5837. A description of the accepted options follows.
  5838. @table @option
  5839. @item edge
  5840. Set displace behavior for pixels that are out of range.
  5841. Available values are:
  5842. @table @samp
  5843. @item blank
  5844. Missing pixels are replaced by black pixels.
  5845. @item smear
  5846. Adjacent pixels will spread out to replace missing pixels.
  5847. @item wrap
  5848. Out of range pixels are wrapped so they point to pixels of other side.
  5849. @item mirror
  5850. Out of range pixels will be replaced with mirrored pixels.
  5851. @end table
  5852. Default is @samp{smear}.
  5853. @end table
  5854. @subsection Examples
  5855. @itemize
  5856. @item
  5857. Add ripple effect to rgb input of video size hd720:
  5858. @example
  5859. 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
  5860. @end example
  5861. @item
  5862. Add wave effect to rgb input of video size hd720:
  5863. @example
  5864. 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
  5865. @end example
  5866. @end itemize
  5867. @section drawbox
  5868. Draw a colored box on the input image.
  5869. It accepts the following parameters:
  5870. @table @option
  5871. @item x
  5872. @item y
  5873. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5874. @item width, w
  5875. @item height, h
  5876. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5877. the input width and height. It defaults to 0.
  5878. @item color, c
  5879. Specify the color of the box to write. For the general syntax of this option,
  5880. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5881. value @code{invert} is used, the box edge color is the same as the
  5882. video with inverted luma.
  5883. @item thickness, t
  5884. The expression which sets the thickness of the box edge.
  5885. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5886. See below for the list of accepted constants.
  5887. @item replace
  5888. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5889. will overwrite the video's color and alpha pixels.
  5890. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5891. @end table
  5892. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5893. following constants:
  5894. @table @option
  5895. @item dar
  5896. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5897. @item hsub
  5898. @item vsub
  5899. horizontal and vertical chroma subsample values. For example for the
  5900. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5901. @item in_h, ih
  5902. @item in_w, iw
  5903. The input width and height.
  5904. @item sar
  5905. The input sample aspect ratio.
  5906. @item x
  5907. @item y
  5908. The x and y offset coordinates where the box is drawn.
  5909. @item w
  5910. @item h
  5911. The width and height of the drawn box.
  5912. @item t
  5913. The thickness of the drawn box.
  5914. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5915. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5916. @end table
  5917. @subsection Examples
  5918. @itemize
  5919. @item
  5920. Draw a black box around the edge of the input image:
  5921. @example
  5922. drawbox
  5923. @end example
  5924. @item
  5925. Draw a box with color red and an opacity of 50%:
  5926. @example
  5927. drawbox=10:20:200:60:red@@0.5
  5928. @end example
  5929. The previous example can be specified as:
  5930. @example
  5931. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5932. @end example
  5933. @item
  5934. Fill the box with pink color:
  5935. @example
  5936. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5937. @end example
  5938. @item
  5939. Draw a 2-pixel red 2.40:1 mask:
  5940. @example
  5941. 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
  5942. @end example
  5943. @end itemize
  5944. @section drawgrid
  5945. Draw a grid on the input image.
  5946. It accepts the following parameters:
  5947. @table @option
  5948. @item x
  5949. @item y
  5950. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5951. @item width, w
  5952. @item height, h
  5953. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5954. input width and height, respectively, minus @code{thickness}, so image gets
  5955. framed. Default to 0.
  5956. @item color, c
  5957. Specify the color of the grid. For the general syntax of this option,
  5958. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5959. value @code{invert} is used, the grid color is the same as the
  5960. video with inverted luma.
  5961. @item thickness, t
  5962. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5963. See below for the list of accepted constants.
  5964. @item replace
  5965. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5966. will overwrite the video's color and alpha pixels.
  5967. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5968. @end table
  5969. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5970. following constants:
  5971. @table @option
  5972. @item dar
  5973. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5974. @item hsub
  5975. @item vsub
  5976. horizontal and vertical chroma subsample values. For example for the
  5977. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5978. @item in_h, ih
  5979. @item in_w, iw
  5980. The input grid cell width and height.
  5981. @item sar
  5982. The input sample aspect ratio.
  5983. @item x
  5984. @item y
  5985. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5986. @item w
  5987. @item h
  5988. The width and height of the drawn cell.
  5989. @item t
  5990. The thickness of the drawn cell.
  5991. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5992. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5993. @end table
  5994. @subsection Examples
  5995. @itemize
  5996. @item
  5997. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5998. @example
  5999. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6000. @end example
  6001. @item
  6002. Draw a white 3x3 grid with an opacity of 50%:
  6003. @example
  6004. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6005. @end example
  6006. @end itemize
  6007. @anchor{drawtext}
  6008. @section drawtext
  6009. Draw a text string or text from a specified file on top of a video, using the
  6010. libfreetype library.
  6011. To enable compilation of this filter, you need to configure FFmpeg with
  6012. @code{--enable-libfreetype}.
  6013. To enable default font fallback and the @var{font} option you need to
  6014. configure FFmpeg with @code{--enable-libfontconfig}.
  6015. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6016. @code{--enable-libfribidi}.
  6017. @subsection Syntax
  6018. It accepts the following parameters:
  6019. @table @option
  6020. @item box
  6021. Used to draw a box around text using the background color.
  6022. The value must be either 1 (enable) or 0 (disable).
  6023. The default value of @var{box} is 0.
  6024. @item boxborderw
  6025. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6026. The default value of @var{boxborderw} is 0.
  6027. @item boxcolor
  6028. The color to be used for drawing box around text. For the syntax of this
  6029. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6030. The default value of @var{boxcolor} is "white".
  6031. @item line_spacing
  6032. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6033. The default value of @var{line_spacing} is 0.
  6034. @item borderw
  6035. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6036. The default value of @var{borderw} is 0.
  6037. @item bordercolor
  6038. Set the color to be used for drawing border around text. For the syntax of this
  6039. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6040. The default value of @var{bordercolor} is "black".
  6041. @item expansion
  6042. Select how the @var{text} is expanded. Can be either @code{none},
  6043. @code{strftime} (deprecated) or
  6044. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6045. below for details.
  6046. @item basetime
  6047. Set a start time for the count. Value is in microseconds. Only applied
  6048. in the deprecated strftime expansion mode. To emulate in normal expansion
  6049. mode use the @code{pts} function, supplying the start time (in seconds)
  6050. as the second argument.
  6051. @item fix_bounds
  6052. If true, check and fix text coords to avoid clipping.
  6053. @item fontcolor
  6054. The color to be used for drawing fonts. For the syntax of this option, check
  6055. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6056. The default value of @var{fontcolor} is "black".
  6057. @item fontcolor_expr
  6058. String which is expanded the same way as @var{text} to obtain dynamic
  6059. @var{fontcolor} value. By default this option has empty value and is not
  6060. processed. When this option is set, it overrides @var{fontcolor} option.
  6061. @item font
  6062. The font family to be used for drawing text. By default Sans.
  6063. @item fontfile
  6064. The font file to be used for drawing text. The path must be included.
  6065. This parameter is mandatory if the fontconfig support is disabled.
  6066. @item alpha
  6067. Draw the text applying alpha blending. The value can
  6068. be a number between 0.0 and 1.0.
  6069. The expression accepts the same variables @var{x, y} as well.
  6070. The default value is 1.
  6071. Please see @var{fontcolor_expr}.
  6072. @item fontsize
  6073. The font size to be used for drawing text.
  6074. The default value of @var{fontsize} is 16.
  6075. @item text_shaping
  6076. If set to 1, attempt to shape the text (for example, reverse the order of
  6077. right-to-left text and join Arabic characters) before drawing it.
  6078. Otherwise, just draw the text exactly as given.
  6079. By default 1 (if supported).
  6080. @item ft_load_flags
  6081. The flags to be used for loading the fonts.
  6082. The flags map the corresponding flags supported by libfreetype, and are
  6083. a combination of the following values:
  6084. @table @var
  6085. @item default
  6086. @item no_scale
  6087. @item no_hinting
  6088. @item render
  6089. @item no_bitmap
  6090. @item vertical_layout
  6091. @item force_autohint
  6092. @item crop_bitmap
  6093. @item pedantic
  6094. @item ignore_global_advance_width
  6095. @item no_recurse
  6096. @item ignore_transform
  6097. @item monochrome
  6098. @item linear_design
  6099. @item no_autohint
  6100. @end table
  6101. Default value is "default".
  6102. For more information consult the documentation for the FT_LOAD_*
  6103. libfreetype flags.
  6104. @item shadowcolor
  6105. The color to be used for drawing a shadow behind the drawn text. For the
  6106. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6107. ffmpeg-utils manual,ffmpeg-utils}.
  6108. The default value of @var{shadowcolor} is "black".
  6109. @item shadowx
  6110. @item shadowy
  6111. The x and y offsets for the text shadow position with respect to the
  6112. position of the text. They can be either positive or negative
  6113. values. The default value for both is "0".
  6114. @item start_number
  6115. The starting frame number for the n/frame_num variable. The default value
  6116. is "0".
  6117. @item tabsize
  6118. The size in number of spaces to use for rendering the tab.
  6119. Default value is 4.
  6120. @item timecode
  6121. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6122. format. It can be used with or without text parameter. @var{timecode_rate}
  6123. option must be specified.
  6124. @item timecode_rate, rate, r
  6125. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6126. integer. Minimum value is "1".
  6127. Drop-frame timecode is supported for frame rates 30 & 60.
  6128. @item tc24hmax
  6129. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6130. Default is 0 (disabled).
  6131. @item text
  6132. The text string to be drawn. The text must be a sequence of UTF-8
  6133. encoded characters.
  6134. This parameter is mandatory if no file is specified with the parameter
  6135. @var{textfile}.
  6136. @item textfile
  6137. A text file containing text to be drawn. The text must be a sequence
  6138. of UTF-8 encoded characters.
  6139. This parameter is mandatory if no text string is specified with the
  6140. parameter @var{text}.
  6141. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6142. @item reload
  6143. If set to 1, the @var{textfile} will be reloaded before each frame.
  6144. Be sure to update it atomically, or it may be read partially, or even fail.
  6145. @item x
  6146. @item y
  6147. The expressions which specify the offsets where text will be drawn
  6148. within the video frame. They are relative to the top/left border of the
  6149. output image.
  6150. The default value of @var{x} and @var{y} is "0".
  6151. See below for the list of accepted constants and functions.
  6152. @end table
  6153. The parameters for @var{x} and @var{y} are expressions containing the
  6154. following constants and functions:
  6155. @table @option
  6156. @item dar
  6157. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6158. @item hsub
  6159. @item vsub
  6160. horizontal and vertical chroma subsample values. For example for the
  6161. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6162. @item line_h, lh
  6163. the height of each text line
  6164. @item main_h, h, H
  6165. the input height
  6166. @item main_w, w, W
  6167. the input width
  6168. @item max_glyph_a, ascent
  6169. the maximum distance from the baseline to the highest/upper grid
  6170. coordinate used to place a glyph outline point, for all the rendered
  6171. glyphs.
  6172. It is a positive value, due to the grid's orientation with the Y axis
  6173. upwards.
  6174. @item max_glyph_d, descent
  6175. the maximum distance from the baseline to the lowest grid coordinate
  6176. used to place a glyph outline point, for all the rendered glyphs.
  6177. This is a negative value, due to the grid's orientation, with the Y axis
  6178. upwards.
  6179. @item max_glyph_h
  6180. maximum glyph height, that is the maximum height for all the glyphs
  6181. contained in the rendered text, it is equivalent to @var{ascent} -
  6182. @var{descent}.
  6183. @item max_glyph_w
  6184. maximum glyph width, that is the maximum width for all the glyphs
  6185. contained in the rendered text
  6186. @item n
  6187. the number of input frame, starting from 0
  6188. @item rand(min, max)
  6189. return a random number included between @var{min} and @var{max}
  6190. @item sar
  6191. The input sample aspect ratio.
  6192. @item t
  6193. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6194. @item text_h, th
  6195. the height of the rendered text
  6196. @item text_w, tw
  6197. the width of the rendered text
  6198. @item x
  6199. @item y
  6200. the x and y offset coordinates where the text is drawn.
  6201. These parameters allow the @var{x} and @var{y} expressions to refer
  6202. each other, so you can for example specify @code{y=x/dar}.
  6203. @end table
  6204. @anchor{drawtext_expansion}
  6205. @subsection Text expansion
  6206. If @option{expansion} is set to @code{strftime},
  6207. the filter recognizes strftime() sequences in the provided text and
  6208. expands them accordingly. Check the documentation of strftime(). This
  6209. feature is deprecated.
  6210. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6211. If @option{expansion} is set to @code{normal} (which is the default),
  6212. the following expansion mechanism is used.
  6213. The backslash character @samp{\}, followed by any character, always expands to
  6214. the second character.
  6215. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6216. braces is a function name, possibly followed by arguments separated by ':'.
  6217. If the arguments contain special characters or delimiters (':' or '@}'),
  6218. they should be escaped.
  6219. Note that they probably must also be escaped as the value for the
  6220. @option{text} option in the filter argument string and as the filter
  6221. argument in the filtergraph description, and possibly also for the shell,
  6222. that makes up to four levels of escaping; using a text file avoids these
  6223. problems.
  6224. The following functions are available:
  6225. @table @command
  6226. @item expr, e
  6227. The expression evaluation result.
  6228. It must take one argument specifying the expression to be evaluated,
  6229. which accepts the same constants and functions as the @var{x} and
  6230. @var{y} values. Note that not all constants should be used, for
  6231. example the text size is not known when evaluating the expression, so
  6232. the constants @var{text_w} and @var{text_h} will have an undefined
  6233. value.
  6234. @item expr_int_format, eif
  6235. Evaluate the expression's value and output as formatted integer.
  6236. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6237. The second argument specifies the output format. Allowed values are @samp{x},
  6238. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6239. @code{printf} function.
  6240. The third parameter is optional and sets the number of positions taken by the output.
  6241. It can be used to add padding with zeros from the left.
  6242. @item gmtime
  6243. The time at which the filter is running, expressed in UTC.
  6244. It can accept an argument: a strftime() format string.
  6245. @item localtime
  6246. The time at which the filter is running, expressed in the local time zone.
  6247. It can accept an argument: a strftime() format string.
  6248. @item metadata
  6249. Frame metadata. Takes one or two arguments.
  6250. The first argument is mandatory and specifies the metadata key.
  6251. The second argument is optional and specifies a default value, used when the
  6252. metadata key is not found or empty.
  6253. @item n, frame_num
  6254. The frame number, starting from 0.
  6255. @item pict_type
  6256. A 1 character description of the current picture type.
  6257. @item pts
  6258. The timestamp of the current frame.
  6259. It can take up to three arguments.
  6260. The first argument is the format of the timestamp; it defaults to @code{flt}
  6261. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6262. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6263. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6264. @code{localtime} stands for the timestamp of the frame formatted as
  6265. local time zone time.
  6266. The second argument is an offset added to the timestamp.
  6267. If the format is set to @code{localtime} or @code{gmtime},
  6268. a third argument may be supplied: a strftime() format string.
  6269. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6270. @end table
  6271. @subsection Examples
  6272. @itemize
  6273. @item
  6274. Draw "Test Text" with font FreeSerif, using the default values for the
  6275. optional parameters.
  6276. @example
  6277. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6278. @end example
  6279. @item
  6280. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6281. and y=50 (counting from the top-left corner of the screen), text is
  6282. yellow with a red box around it. Both the text and the box have an
  6283. opacity of 20%.
  6284. @example
  6285. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6286. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6287. @end example
  6288. Note that the double quotes are not necessary if spaces are not used
  6289. within the parameter list.
  6290. @item
  6291. Show the text at the center of the video frame:
  6292. @example
  6293. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6294. @end example
  6295. @item
  6296. Show the text at a random position, switching to a new position every 30 seconds:
  6297. @example
  6298. 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)"
  6299. @end example
  6300. @item
  6301. Show a text line sliding from right to left in the last row of the video
  6302. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6303. with no newlines.
  6304. @example
  6305. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6306. @end example
  6307. @item
  6308. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6309. @example
  6310. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6311. @end example
  6312. @item
  6313. Draw a single green letter "g", at the center of the input video.
  6314. The glyph baseline is placed at half screen height.
  6315. @example
  6316. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6317. @end example
  6318. @item
  6319. Show text for 1 second every 3 seconds:
  6320. @example
  6321. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6322. @end example
  6323. @item
  6324. Use fontconfig to set the font. Note that the colons need to be escaped.
  6325. @example
  6326. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6327. @end example
  6328. @item
  6329. Print the date of a real-time encoding (see strftime(3)):
  6330. @example
  6331. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6332. @end example
  6333. @item
  6334. Show text fading in and out (appearing/disappearing):
  6335. @example
  6336. #!/bin/sh
  6337. DS=1.0 # display start
  6338. DE=10.0 # display end
  6339. FID=1.5 # fade in duration
  6340. FOD=5 # fade out duration
  6341. 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 @}"
  6342. @end example
  6343. @item
  6344. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6345. and the @option{fontsize} value are included in the @option{y} offset.
  6346. @example
  6347. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6348. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6349. @end example
  6350. @end itemize
  6351. For more information about libfreetype, check:
  6352. @url{http://www.freetype.org/}.
  6353. For more information about fontconfig, check:
  6354. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6355. For more information about libfribidi, check:
  6356. @url{http://fribidi.org/}.
  6357. @section edgedetect
  6358. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6359. The filter accepts the following options:
  6360. @table @option
  6361. @item low
  6362. @item high
  6363. Set low and high threshold values used by the Canny thresholding
  6364. algorithm.
  6365. The high threshold selects the "strong" edge pixels, which are then
  6366. connected through 8-connectivity with the "weak" edge pixels selected
  6367. by the low threshold.
  6368. @var{low} and @var{high} threshold values must be chosen in the range
  6369. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6370. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6371. is @code{50/255}.
  6372. @item mode
  6373. Define the drawing mode.
  6374. @table @samp
  6375. @item wires
  6376. Draw white/gray wires on black background.
  6377. @item colormix
  6378. Mix the colors to create a paint/cartoon effect.
  6379. @end table
  6380. Default value is @var{wires}.
  6381. @end table
  6382. @subsection Examples
  6383. @itemize
  6384. @item
  6385. Standard edge detection with custom values for the hysteresis thresholding:
  6386. @example
  6387. edgedetect=low=0.1:high=0.4
  6388. @end example
  6389. @item
  6390. Painting effect without thresholding:
  6391. @example
  6392. edgedetect=mode=colormix:high=0
  6393. @end example
  6394. @end itemize
  6395. @section eq
  6396. Set brightness, contrast, saturation and approximate gamma adjustment.
  6397. The filter accepts the following options:
  6398. @table @option
  6399. @item contrast
  6400. Set the contrast expression. The value must be a float value in range
  6401. @code{-2.0} to @code{2.0}. The default value is "1".
  6402. @item brightness
  6403. Set the brightness expression. The value must be a float value in
  6404. range @code{-1.0} to @code{1.0}. The default value is "0".
  6405. @item saturation
  6406. Set the saturation expression. The value must be a float in
  6407. range @code{0.0} to @code{3.0}. The default value is "1".
  6408. @item gamma
  6409. Set the gamma expression. The value must be a float in range
  6410. @code{0.1} to @code{10.0}. The default value is "1".
  6411. @item gamma_r
  6412. Set the gamma expression for red. The value must be a float in
  6413. range @code{0.1} to @code{10.0}. The default value is "1".
  6414. @item gamma_g
  6415. Set the gamma expression for green. The value must be a float in range
  6416. @code{0.1} to @code{10.0}. The default value is "1".
  6417. @item gamma_b
  6418. Set the gamma expression for blue. The value must be a float in range
  6419. @code{0.1} to @code{10.0}. The default value is "1".
  6420. @item gamma_weight
  6421. Set the gamma weight expression. It can be used to reduce the effect
  6422. of a high gamma value on bright image areas, e.g. keep them from
  6423. getting overamplified and just plain white. The value must be a float
  6424. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6425. gamma correction all the way down while @code{1.0} leaves it at its
  6426. full strength. Default is "1".
  6427. @item eval
  6428. Set when the expressions for brightness, contrast, saturation and
  6429. gamma expressions are evaluated.
  6430. It accepts the following values:
  6431. @table @samp
  6432. @item init
  6433. only evaluate expressions once during the filter initialization or
  6434. when a command is processed
  6435. @item frame
  6436. evaluate expressions for each incoming frame
  6437. @end table
  6438. Default value is @samp{init}.
  6439. @end table
  6440. The expressions accept the following parameters:
  6441. @table @option
  6442. @item n
  6443. frame count of the input frame starting from 0
  6444. @item pos
  6445. byte position of the corresponding packet in the input file, NAN if
  6446. unspecified
  6447. @item r
  6448. frame rate of the input video, NAN if the input frame rate is unknown
  6449. @item t
  6450. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6451. @end table
  6452. @subsection Commands
  6453. The filter supports the following commands:
  6454. @table @option
  6455. @item contrast
  6456. Set the contrast expression.
  6457. @item brightness
  6458. Set the brightness expression.
  6459. @item saturation
  6460. Set the saturation expression.
  6461. @item gamma
  6462. Set the gamma expression.
  6463. @item gamma_r
  6464. Set the gamma_r expression.
  6465. @item gamma_g
  6466. Set gamma_g expression.
  6467. @item gamma_b
  6468. Set gamma_b expression.
  6469. @item gamma_weight
  6470. Set gamma_weight expression.
  6471. The command accepts the same syntax of the corresponding option.
  6472. If the specified expression is not valid, it is kept at its current
  6473. value.
  6474. @end table
  6475. @section erosion
  6476. Apply erosion effect to the video.
  6477. This filter replaces the pixel by the local(3x3) minimum.
  6478. It accepts the following options:
  6479. @table @option
  6480. @item threshold0
  6481. @item threshold1
  6482. @item threshold2
  6483. @item threshold3
  6484. Limit the maximum change for each plane, default is 65535.
  6485. If 0, plane will remain unchanged.
  6486. @item coordinates
  6487. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6488. pixels are used.
  6489. Flags to local 3x3 coordinates maps like this:
  6490. 1 2 3
  6491. 4 5
  6492. 6 7 8
  6493. @end table
  6494. @section extractplanes
  6495. Extract color channel components from input video stream into
  6496. separate grayscale video streams.
  6497. The filter accepts the following option:
  6498. @table @option
  6499. @item planes
  6500. Set plane(s) to extract.
  6501. Available values for planes are:
  6502. @table @samp
  6503. @item y
  6504. @item u
  6505. @item v
  6506. @item a
  6507. @item r
  6508. @item g
  6509. @item b
  6510. @end table
  6511. Choosing planes not available in the input will result in an error.
  6512. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6513. with @code{y}, @code{u}, @code{v} planes at same time.
  6514. @end table
  6515. @subsection Examples
  6516. @itemize
  6517. @item
  6518. Extract luma, u and v color channel component from input video frame
  6519. into 3 grayscale outputs:
  6520. @example
  6521. 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
  6522. @end example
  6523. @end itemize
  6524. @section elbg
  6525. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6526. For each input image, the filter will compute the optimal mapping from
  6527. the input to the output given the codebook length, that is the number
  6528. of distinct output colors.
  6529. This filter accepts the following options.
  6530. @table @option
  6531. @item codebook_length, l
  6532. Set codebook length. The value must be a positive integer, and
  6533. represents the number of distinct output colors. Default value is 256.
  6534. @item nb_steps, n
  6535. Set the maximum number of iterations to apply for computing the optimal
  6536. mapping. The higher the value the better the result and the higher the
  6537. computation time. Default value is 1.
  6538. @item seed, s
  6539. Set a random seed, must be an integer included between 0 and
  6540. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6541. will try to use a good random seed on a best effort basis.
  6542. @item pal8
  6543. Set pal8 output pixel format. This option does not work with codebook
  6544. length greater than 256.
  6545. @end table
  6546. @section entropy
  6547. Measure graylevel entropy in histogram of color channels of video frames.
  6548. It accepts the following parameters:
  6549. @table @option
  6550. @item mode
  6551. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6552. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6553. between neighbour histogram values.
  6554. @end table
  6555. @section fade
  6556. Apply a fade-in/out effect to the input video.
  6557. It accepts the following parameters:
  6558. @table @option
  6559. @item type, t
  6560. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6561. effect.
  6562. Default is @code{in}.
  6563. @item start_frame, s
  6564. Specify the number of the frame to start applying the fade
  6565. effect at. Default is 0.
  6566. @item nb_frames, n
  6567. The number of frames that the fade effect lasts. At the end of the
  6568. fade-in effect, the output video will have the same intensity as the input video.
  6569. At the end of the fade-out transition, the output video will be filled with the
  6570. selected @option{color}.
  6571. Default is 25.
  6572. @item alpha
  6573. If set to 1, fade only alpha channel, if one exists on the input.
  6574. Default value is 0.
  6575. @item start_time, st
  6576. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6577. effect. If both start_frame and start_time are specified, the fade will start at
  6578. whichever comes last. Default is 0.
  6579. @item duration, d
  6580. The number of seconds for which the fade effect has to last. At the end of the
  6581. fade-in effect the output video will have the same intensity as the input video,
  6582. at the end of the fade-out transition the output video will be filled with the
  6583. selected @option{color}.
  6584. If both duration and nb_frames are specified, duration is used. Default is 0
  6585. (nb_frames is used by default).
  6586. @item color, c
  6587. Specify the color of the fade. Default is "black".
  6588. @end table
  6589. @subsection Examples
  6590. @itemize
  6591. @item
  6592. Fade in the first 30 frames of video:
  6593. @example
  6594. fade=in:0:30
  6595. @end example
  6596. The command above is equivalent to:
  6597. @example
  6598. fade=t=in:s=0:n=30
  6599. @end example
  6600. @item
  6601. Fade out the last 45 frames of a 200-frame video:
  6602. @example
  6603. fade=out:155:45
  6604. fade=type=out:start_frame=155:nb_frames=45
  6605. @end example
  6606. @item
  6607. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6608. @example
  6609. fade=in:0:25, fade=out:975:25
  6610. @end example
  6611. @item
  6612. Make the first 5 frames yellow, then fade in from frame 5-24:
  6613. @example
  6614. fade=in:5:20:color=yellow
  6615. @end example
  6616. @item
  6617. Fade in alpha over first 25 frames of video:
  6618. @example
  6619. fade=in:0:25:alpha=1
  6620. @end example
  6621. @item
  6622. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6623. @example
  6624. fade=t=in:st=5.5:d=0.5
  6625. @end example
  6626. @end itemize
  6627. @section fftfilt
  6628. Apply arbitrary expressions to samples in frequency domain
  6629. @table @option
  6630. @item dc_Y
  6631. Adjust the dc value (gain) of the luma plane of the image. The filter
  6632. accepts an integer value in range @code{0} to @code{1000}. The default
  6633. value is set to @code{0}.
  6634. @item dc_U
  6635. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6636. filter accepts an integer value in range @code{0} to @code{1000}. The
  6637. default value is set to @code{0}.
  6638. @item dc_V
  6639. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6640. filter accepts an integer value in range @code{0} to @code{1000}. The
  6641. default value is set to @code{0}.
  6642. @item weight_Y
  6643. Set the frequency domain weight expression for the luma plane.
  6644. @item weight_U
  6645. Set the frequency domain weight expression for the 1st chroma plane.
  6646. @item weight_V
  6647. Set the frequency domain weight expression for the 2nd chroma plane.
  6648. @item eval
  6649. Set when the expressions are evaluated.
  6650. It accepts the following values:
  6651. @table @samp
  6652. @item init
  6653. Only evaluate expressions once during the filter initialization.
  6654. @item frame
  6655. Evaluate expressions for each incoming frame.
  6656. @end table
  6657. Default value is @samp{init}.
  6658. The filter accepts the following variables:
  6659. @item X
  6660. @item Y
  6661. The coordinates of the current sample.
  6662. @item W
  6663. @item H
  6664. The width and height of the image.
  6665. @item N
  6666. The number of input frame, starting from 0.
  6667. @end table
  6668. @subsection Examples
  6669. @itemize
  6670. @item
  6671. High-pass:
  6672. @example
  6673. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6674. @end example
  6675. @item
  6676. Low-pass:
  6677. @example
  6678. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6679. @end example
  6680. @item
  6681. Sharpen:
  6682. @example
  6683. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6684. @end example
  6685. @item
  6686. Blur:
  6687. @example
  6688. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6689. @end example
  6690. @end itemize
  6691. @section field
  6692. Extract a single field from an interlaced image using stride
  6693. arithmetic to avoid wasting CPU time. The output frames are marked as
  6694. non-interlaced.
  6695. The filter accepts the following options:
  6696. @table @option
  6697. @item type
  6698. Specify whether to extract the top (if the value is @code{0} or
  6699. @code{top}) or the bottom field (if the value is @code{1} or
  6700. @code{bottom}).
  6701. @end table
  6702. @section fieldhint
  6703. Create new frames by copying the top and bottom fields from surrounding frames
  6704. supplied as numbers by the hint file.
  6705. @table @option
  6706. @item hint
  6707. Set file containing hints: absolute/relative frame numbers.
  6708. There must be one line for each frame in a clip. Each line must contain two
  6709. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6710. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6711. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6712. for @code{relative} mode. First number tells from which frame to pick up top
  6713. field and second number tells from which frame to pick up bottom field.
  6714. If optionally followed by @code{+} output frame will be marked as interlaced,
  6715. else if followed by @code{-} output frame will be marked as progressive, else
  6716. it will be marked same as input frame.
  6717. If line starts with @code{#} or @code{;} that line is skipped.
  6718. @item mode
  6719. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6720. @end table
  6721. Example of first several lines of @code{hint} file for @code{relative} mode:
  6722. @example
  6723. 0,0 - # first frame
  6724. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6725. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6726. 1,0 -
  6727. 0,0 -
  6728. 0,0 -
  6729. 1,0 -
  6730. 1,0 -
  6731. 1,0 -
  6732. 0,0 -
  6733. 0,0 -
  6734. 1,0 -
  6735. 1,0 -
  6736. 1,0 -
  6737. 0,0 -
  6738. @end example
  6739. @section fieldmatch
  6740. Field matching filter for inverse telecine. It is meant to reconstruct the
  6741. progressive frames from a telecined stream. The filter does not drop duplicated
  6742. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6743. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6744. The separation of the field matching and the decimation is notably motivated by
  6745. the possibility of inserting a de-interlacing filter fallback between the two.
  6746. If the source has mixed telecined and real interlaced content,
  6747. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6748. But these remaining combed frames will be marked as interlaced, and thus can be
  6749. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6750. In addition to the various configuration options, @code{fieldmatch} can take an
  6751. optional second stream, activated through the @option{ppsrc} option. If
  6752. enabled, the frames reconstruction will be based on the fields and frames from
  6753. this second stream. This allows the first input to be pre-processed in order to
  6754. help the various algorithms of the filter, while keeping the output lossless
  6755. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6756. or brightness/contrast adjustments can help.
  6757. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6758. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6759. which @code{fieldmatch} is based on. While the semantic and usage are very
  6760. close, some behaviour and options names can differ.
  6761. The @ref{decimate} filter currently only works for constant frame rate input.
  6762. If your input has mixed telecined (30fps) and progressive content with a lower
  6763. framerate like 24fps use the following filterchain to produce the necessary cfr
  6764. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6765. The filter accepts the following options:
  6766. @table @option
  6767. @item order
  6768. Specify the assumed field order of the input stream. Available values are:
  6769. @table @samp
  6770. @item auto
  6771. Auto detect parity (use FFmpeg's internal parity value).
  6772. @item bff
  6773. Assume bottom field first.
  6774. @item tff
  6775. Assume top field first.
  6776. @end table
  6777. Note that it is sometimes recommended not to trust the parity announced by the
  6778. stream.
  6779. Default value is @var{auto}.
  6780. @item mode
  6781. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6782. sense that it won't risk creating jerkiness due to duplicate frames when
  6783. possible, but if there are bad edits or blended fields it will end up
  6784. outputting combed frames when a good match might actually exist. On the other
  6785. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6786. but will almost always find a good frame if there is one. The other values are
  6787. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6788. jerkiness and creating duplicate frames versus finding good matches in sections
  6789. with bad edits, orphaned fields, blended fields, etc.
  6790. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6791. Available values are:
  6792. @table @samp
  6793. @item pc
  6794. 2-way matching (p/c)
  6795. @item pc_n
  6796. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6797. @item pc_u
  6798. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6799. @item pc_n_ub
  6800. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6801. still combed (p/c + n + u/b)
  6802. @item pcn
  6803. 3-way matching (p/c/n)
  6804. @item pcn_ub
  6805. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6806. detected as combed (p/c/n + u/b)
  6807. @end table
  6808. The parenthesis at the end indicate the matches that would be used for that
  6809. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6810. @var{top}).
  6811. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6812. the slowest.
  6813. Default value is @var{pc_n}.
  6814. @item ppsrc
  6815. Mark the main input stream as a pre-processed input, and enable the secondary
  6816. input stream as the clean source to pick the fields from. See the filter
  6817. introduction for more details. It is similar to the @option{clip2} feature from
  6818. VFM/TFM.
  6819. Default value is @code{0} (disabled).
  6820. @item field
  6821. Set the field to match from. It is recommended to set this to the same value as
  6822. @option{order} unless you experience matching failures with that setting. In
  6823. certain circumstances changing the field that is used to match from can have a
  6824. large impact on matching performance. Available values are:
  6825. @table @samp
  6826. @item auto
  6827. Automatic (same value as @option{order}).
  6828. @item bottom
  6829. Match from the bottom field.
  6830. @item top
  6831. Match from the top field.
  6832. @end table
  6833. Default value is @var{auto}.
  6834. @item mchroma
  6835. Set whether or not chroma is included during the match comparisons. In most
  6836. cases it is recommended to leave this enabled. You should set this to @code{0}
  6837. only if your clip has bad chroma problems such as heavy rainbowing or other
  6838. artifacts. Setting this to @code{0} could also be used to speed things up at
  6839. the cost of some accuracy.
  6840. Default value is @code{1}.
  6841. @item y0
  6842. @item y1
  6843. These define an exclusion band which excludes the lines between @option{y0} and
  6844. @option{y1} from being included in the field matching decision. An exclusion
  6845. band can be used to ignore subtitles, a logo, or other things that may
  6846. interfere with the matching. @option{y0} sets the starting scan line and
  6847. @option{y1} sets the ending line; all lines in between @option{y0} and
  6848. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6849. @option{y0} and @option{y1} to the same value will disable the feature.
  6850. @option{y0} and @option{y1} defaults to @code{0}.
  6851. @item scthresh
  6852. Set the scene change detection threshold as a percentage of maximum change on
  6853. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6854. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6855. @option{scthresh} is @code{[0.0, 100.0]}.
  6856. Default value is @code{12.0}.
  6857. @item combmatch
  6858. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6859. account the combed scores of matches when deciding what match to use as the
  6860. final match. Available values are:
  6861. @table @samp
  6862. @item none
  6863. No final matching based on combed scores.
  6864. @item sc
  6865. Combed scores are only used when a scene change is detected.
  6866. @item full
  6867. Use combed scores all the time.
  6868. @end table
  6869. Default is @var{sc}.
  6870. @item combdbg
  6871. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6872. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6873. Available values are:
  6874. @table @samp
  6875. @item none
  6876. No forced calculation.
  6877. @item pcn
  6878. Force p/c/n calculations.
  6879. @item pcnub
  6880. Force p/c/n/u/b calculations.
  6881. @end table
  6882. Default value is @var{none}.
  6883. @item cthresh
  6884. This is the area combing threshold used for combed frame detection. This
  6885. essentially controls how "strong" or "visible" combing must be to be detected.
  6886. Larger values mean combing must be more visible and smaller values mean combing
  6887. can be less visible or strong and still be detected. Valid settings are from
  6888. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6889. be detected as combed). This is basically a pixel difference value. A good
  6890. range is @code{[8, 12]}.
  6891. Default value is @code{9}.
  6892. @item chroma
  6893. Sets whether or not chroma is considered in the combed frame decision. Only
  6894. disable this if your source has chroma problems (rainbowing, etc.) that are
  6895. causing problems for the combed frame detection with chroma enabled. Actually,
  6896. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6897. where there is chroma only combing in the source.
  6898. Default value is @code{0}.
  6899. @item blockx
  6900. @item blocky
  6901. Respectively set the x-axis and y-axis size of the window used during combed
  6902. frame detection. This has to do with the size of the area in which
  6903. @option{combpel} pixels are required to be detected as combed for a frame to be
  6904. declared combed. See the @option{combpel} parameter description for more info.
  6905. Possible values are any number that is a power of 2 starting at 4 and going up
  6906. to 512.
  6907. Default value is @code{16}.
  6908. @item combpel
  6909. The number of combed pixels inside any of the @option{blocky} by
  6910. @option{blockx} size blocks on the frame for the frame to be detected as
  6911. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6912. setting controls "how much" combing there must be in any localized area (a
  6913. window defined by the @option{blockx} and @option{blocky} settings) on the
  6914. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6915. which point no frames will ever be detected as combed). This setting is known
  6916. as @option{MI} in TFM/VFM vocabulary.
  6917. Default value is @code{80}.
  6918. @end table
  6919. @anchor{p/c/n/u/b meaning}
  6920. @subsection p/c/n/u/b meaning
  6921. @subsubsection p/c/n
  6922. We assume the following telecined stream:
  6923. @example
  6924. Top fields: 1 2 2 3 4
  6925. Bottom fields: 1 2 3 4 4
  6926. @end example
  6927. The numbers correspond to the progressive frame the fields relate to. Here, the
  6928. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6929. When @code{fieldmatch} is configured to run a matching from bottom
  6930. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6931. @example
  6932. Input stream:
  6933. T 1 2 2 3 4
  6934. B 1 2 3 4 4 <-- matching reference
  6935. Matches: c c n n c
  6936. Output stream:
  6937. T 1 2 3 4 4
  6938. B 1 2 3 4 4
  6939. @end example
  6940. As a result of the field matching, we can see that some frames get duplicated.
  6941. To perform a complete inverse telecine, you need to rely on a decimation filter
  6942. after this operation. See for instance the @ref{decimate} filter.
  6943. The same operation now matching from top fields (@option{field}=@var{top})
  6944. looks like this:
  6945. @example
  6946. Input stream:
  6947. T 1 2 2 3 4 <-- matching reference
  6948. B 1 2 3 4 4
  6949. Matches: c c p p c
  6950. Output stream:
  6951. T 1 2 2 3 4
  6952. B 1 2 2 3 4
  6953. @end example
  6954. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6955. basically, they refer to the frame and field of the opposite parity:
  6956. @itemize
  6957. @item @var{p} matches the field of the opposite parity in the previous frame
  6958. @item @var{c} matches the field of the opposite parity in the current frame
  6959. @item @var{n} matches the field of the opposite parity in the next frame
  6960. @end itemize
  6961. @subsubsection u/b
  6962. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6963. from the opposite parity flag. In the following examples, we assume that we are
  6964. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6965. 'x' is placed above and below each matched fields.
  6966. With bottom matching (@option{field}=@var{bottom}):
  6967. @example
  6968. Match: c p n b u
  6969. x x x x x
  6970. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6971. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6972. x x x x x
  6973. Output frames:
  6974. 2 1 2 2 2
  6975. 2 2 2 1 3
  6976. @end example
  6977. With top matching (@option{field}=@var{top}):
  6978. @example
  6979. Match: c p n b u
  6980. x x x x x
  6981. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6982. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6983. x x x x x
  6984. Output frames:
  6985. 2 2 2 1 2
  6986. 2 1 3 2 2
  6987. @end example
  6988. @subsection Examples
  6989. Simple IVTC of a top field first telecined stream:
  6990. @example
  6991. fieldmatch=order=tff:combmatch=none, decimate
  6992. @end example
  6993. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6994. @example
  6995. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6996. @end example
  6997. @section fieldorder
  6998. Transform the field order of the input video.
  6999. It accepts the following parameters:
  7000. @table @option
  7001. @item order
  7002. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7003. for bottom field first.
  7004. @end table
  7005. The default value is @samp{tff}.
  7006. The transformation is done by shifting the picture content up or down
  7007. by one line, and filling the remaining line with appropriate picture content.
  7008. This method is consistent with most broadcast field order converters.
  7009. If the input video is not flagged as being interlaced, or it is already
  7010. flagged as being of the required output field order, then this filter does
  7011. not alter the incoming video.
  7012. It is very useful when converting to or from PAL DV material,
  7013. which is bottom field first.
  7014. For example:
  7015. @example
  7016. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7017. @end example
  7018. @section fifo, afifo
  7019. Buffer input images and send them when they are requested.
  7020. It is mainly useful when auto-inserted by the libavfilter
  7021. framework.
  7022. It does not take parameters.
  7023. @section fillborders
  7024. Fill borders of the input video, without changing video stream dimensions.
  7025. Sometimes video can have garbage at the four edges and you may not want to
  7026. crop video input to keep size multiple of some number.
  7027. This filter accepts the following options:
  7028. @table @option
  7029. @item left
  7030. Number of pixels to fill from left border.
  7031. @item right
  7032. Number of pixels to fill from right border.
  7033. @item top
  7034. Number of pixels to fill from top border.
  7035. @item bottom
  7036. Number of pixels to fill from bottom border.
  7037. @item mode
  7038. Set fill mode.
  7039. It accepts the following values:
  7040. @table @samp
  7041. @item smear
  7042. fill pixels using outermost pixels
  7043. @item mirror
  7044. fill pixels using mirroring
  7045. @item fixed
  7046. fill pixels with constant value
  7047. @end table
  7048. Default is @var{smear}.
  7049. @item color
  7050. Set color for pixels in fixed mode. Default is @var{black}.
  7051. @end table
  7052. @section find_rect
  7053. Find a rectangular object
  7054. It accepts the following options:
  7055. @table @option
  7056. @item object
  7057. Filepath of the object image, needs to be in gray8.
  7058. @item threshold
  7059. Detection threshold, default is 0.5.
  7060. @item mipmaps
  7061. Number of mipmaps, default is 3.
  7062. @item xmin, ymin, xmax, ymax
  7063. Specifies the rectangle in which to search.
  7064. @end table
  7065. @subsection Examples
  7066. @itemize
  7067. @item
  7068. Generate a representative palette of a given video using @command{ffmpeg}:
  7069. @example
  7070. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7071. @end example
  7072. @end itemize
  7073. @section cover_rect
  7074. Cover a rectangular object
  7075. It accepts the following options:
  7076. @table @option
  7077. @item cover
  7078. Filepath of the optional cover image, needs to be in yuv420.
  7079. @item mode
  7080. Set covering mode.
  7081. It accepts the following values:
  7082. @table @samp
  7083. @item cover
  7084. cover it by the supplied image
  7085. @item blur
  7086. cover it by interpolating the surrounding pixels
  7087. @end table
  7088. Default value is @var{blur}.
  7089. @end table
  7090. @subsection Examples
  7091. @itemize
  7092. @item
  7093. Generate a representative palette of a given video using @command{ffmpeg}:
  7094. @example
  7095. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7096. @end example
  7097. @end itemize
  7098. @section floodfill
  7099. Flood area with values of same pixel components with another values.
  7100. It accepts the following options:
  7101. @table @option
  7102. @item x
  7103. Set pixel x coordinate.
  7104. @item y
  7105. Set pixel y coordinate.
  7106. @item s0
  7107. Set source #0 component value.
  7108. @item s1
  7109. Set source #1 component value.
  7110. @item s2
  7111. Set source #2 component value.
  7112. @item s3
  7113. Set source #3 component value.
  7114. @item d0
  7115. Set destination #0 component value.
  7116. @item d1
  7117. Set destination #1 component value.
  7118. @item d2
  7119. Set destination #2 component value.
  7120. @item d3
  7121. Set destination #3 component value.
  7122. @end table
  7123. @anchor{format}
  7124. @section format
  7125. Convert the input video to one of the specified pixel formats.
  7126. Libavfilter will try to pick one that is suitable as input to
  7127. the next filter.
  7128. It accepts the following parameters:
  7129. @table @option
  7130. @item pix_fmts
  7131. A '|'-separated list of pixel format names, such as
  7132. "pix_fmts=yuv420p|monow|rgb24".
  7133. @end table
  7134. @subsection Examples
  7135. @itemize
  7136. @item
  7137. Convert the input video to the @var{yuv420p} format
  7138. @example
  7139. format=pix_fmts=yuv420p
  7140. @end example
  7141. Convert the input video to any of the formats in the list
  7142. @example
  7143. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7144. @end example
  7145. @end itemize
  7146. @anchor{fps}
  7147. @section fps
  7148. Convert the video to specified constant frame rate by duplicating or dropping
  7149. frames as necessary.
  7150. It accepts the following parameters:
  7151. @table @option
  7152. @item fps
  7153. The desired output frame rate. The default is @code{25}.
  7154. @item start_time
  7155. Assume the first PTS should be the given value, in seconds. This allows for
  7156. padding/trimming at the start of stream. By default, no assumption is made
  7157. about the first frame's expected PTS, so no padding or trimming is done.
  7158. For example, this could be set to 0 to pad the beginning with duplicates of
  7159. the first frame if a video stream starts after the audio stream or to trim any
  7160. frames with a negative PTS.
  7161. @item round
  7162. Timestamp (PTS) rounding method.
  7163. Possible values are:
  7164. @table @option
  7165. @item zero
  7166. round towards 0
  7167. @item inf
  7168. round away from 0
  7169. @item down
  7170. round towards -infinity
  7171. @item up
  7172. round towards +infinity
  7173. @item near
  7174. round to nearest
  7175. @end table
  7176. The default is @code{near}.
  7177. @item eof_action
  7178. Action performed when reading the last frame.
  7179. Possible values are:
  7180. @table @option
  7181. @item round
  7182. Use same timestamp rounding method as used for other frames.
  7183. @item pass
  7184. Pass through last frame if input duration has not been reached yet.
  7185. @end table
  7186. The default is @code{round}.
  7187. @end table
  7188. Alternatively, the options can be specified as a flat string:
  7189. @var{fps}[:@var{start_time}[:@var{round}]].
  7190. See also the @ref{setpts} filter.
  7191. @subsection Examples
  7192. @itemize
  7193. @item
  7194. A typical usage in order to set the fps to 25:
  7195. @example
  7196. fps=fps=25
  7197. @end example
  7198. @item
  7199. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7200. @example
  7201. fps=fps=film:round=near
  7202. @end example
  7203. @end itemize
  7204. @section framepack
  7205. Pack two different video streams into a stereoscopic video, setting proper
  7206. metadata on supported codecs. The two views should have the same size and
  7207. framerate and processing will stop when the shorter video ends. Please note
  7208. that you may conveniently adjust view properties with the @ref{scale} and
  7209. @ref{fps} filters.
  7210. It accepts the following parameters:
  7211. @table @option
  7212. @item format
  7213. The desired packing format. Supported values are:
  7214. @table @option
  7215. @item sbs
  7216. The views are next to each other (default).
  7217. @item tab
  7218. The views are on top of each other.
  7219. @item lines
  7220. The views are packed by line.
  7221. @item columns
  7222. The views are packed by column.
  7223. @item frameseq
  7224. The views are temporally interleaved.
  7225. @end table
  7226. @end table
  7227. Some examples:
  7228. @example
  7229. # Convert left and right views into a frame-sequential video
  7230. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7231. # Convert views into a side-by-side video with the same output resolution as the input
  7232. 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
  7233. @end example
  7234. @section framerate
  7235. Change the frame rate by interpolating new video output frames from the source
  7236. frames.
  7237. This filter is not designed to function correctly with interlaced media. If
  7238. you wish to change the frame rate of interlaced media then you are required
  7239. to deinterlace before this filter and re-interlace after this filter.
  7240. A description of the accepted options follows.
  7241. @table @option
  7242. @item fps
  7243. Specify the output frames per second. This option can also be specified
  7244. as a value alone. The default is @code{50}.
  7245. @item interp_start
  7246. Specify the start of a range where the output frame will be created as a
  7247. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7248. the default is @code{15}.
  7249. @item interp_end
  7250. Specify the end of a range where the output frame will be created as a
  7251. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7252. the default is @code{240}.
  7253. @item scene
  7254. Specify the level at which a scene change is detected as a value between
  7255. 0 and 100 to indicate a new scene; a low value reflects a low
  7256. probability for the current frame to introduce a new scene, while a higher
  7257. value means the current frame is more likely to be one.
  7258. The default is @code{8.2}.
  7259. @item flags
  7260. Specify flags influencing the filter process.
  7261. Available value for @var{flags} is:
  7262. @table @option
  7263. @item scene_change_detect, scd
  7264. Enable scene change detection using the value of the option @var{scene}.
  7265. This flag is enabled by default.
  7266. @end table
  7267. @end table
  7268. @section framestep
  7269. Select one frame every N-th frame.
  7270. This filter accepts the following option:
  7271. @table @option
  7272. @item step
  7273. Select frame after every @code{step} frames.
  7274. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7275. @end table
  7276. @anchor{frei0r}
  7277. @section frei0r
  7278. Apply a frei0r effect to the input video.
  7279. To enable the compilation of this filter, you need to install the frei0r
  7280. header and configure FFmpeg with @code{--enable-frei0r}.
  7281. It accepts the following parameters:
  7282. @table @option
  7283. @item filter_name
  7284. The name of the frei0r effect to load. If the environment variable
  7285. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7286. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7287. Otherwise, the standard frei0r paths are searched, in this order:
  7288. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7289. @file{/usr/lib/frei0r-1/}.
  7290. @item filter_params
  7291. A '|'-separated list of parameters to pass to the frei0r effect.
  7292. @end table
  7293. A frei0r effect parameter can be a boolean (its value is either
  7294. "y" or "n"), a double, a color (specified as
  7295. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7296. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7297. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7298. a position (specified as @var{X}/@var{Y}, where
  7299. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7300. The number and types of parameters depend on the loaded effect. If an
  7301. effect parameter is not specified, the default value is set.
  7302. @subsection Examples
  7303. @itemize
  7304. @item
  7305. Apply the distort0r effect, setting the first two double parameters:
  7306. @example
  7307. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7308. @end example
  7309. @item
  7310. Apply the colordistance effect, taking a color as the first parameter:
  7311. @example
  7312. frei0r=colordistance:0.2/0.3/0.4
  7313. frei0r=colordistance:violet
  7314. frei0r=colordistance:0x112233
  7315. @end example
  7316. @item
  7317. Apply the perspective effect, specifying the top left and top right image
  7318. positions:
  7319. @example
  7320. frei0r=perspective:0.2/0.2|0.8/0.2
  7321. @end example
  7322. @end itemize
  7323. For more information, see
  7324. @url{http://frei0r.dyne.org}
  7325. @section fspp
  7326. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7327. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7328. processing filter, one of them is performed once per block, not per pixel.
  7329. This allows for much higher speed.
  7330. The filter accepts the following options:
  7331. @table @option
  7332. @item quality
  7333. Set quality. This option defines the number of levels for averaging. It accepts
  7334. an integer in the range 4-5. Default value is @code{4}.
  7335. @item qp
  7336. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7337. If not set, the filter will use the QP from the video stream (if available).
  7338. @item strength
  7339. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7340. more details but also more artifacts, while higher values make the image smoother
  7341. but also blurrier. Default value is @code{0} − PSNR optimal.
  7342. @item use_bframe_qp
  7343. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7344. option may cause flicker since the B-Frames have often larger QP. Default is
  7345. @code{0} (not enabled).
  7346. @end table
  7347. @section gblur
  7348. Apply Gaussian blur filter.
  7349. The filter accepts the following options:
  7350. @table @option
  7351. @item sigma
  7352. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7353. @item steps
  7354. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7355. @item planes
  7356. Set which planes to filter. By default all planes are filtered.
  7357. @item sigmaV
  7358. Set vertical sigma, if negative it will be same as @code{sigma}.
  7359. Default is @code{-1}.
  7360. @end table
  7361. @section geq
  7362. The filter accepts the following options:
  7363. @table @option
  7364. @item lum_expr, lum
  7365. Set the luminance expression.
  7366. @item cb_expr, cb
  7367. Set the chrominance blue expression.
  7368. @item cr_expr, cr
  7369. Set the chrominance red expression.
  7370. @item alpha_expr, a
  7371. Set the alpha expression.
  7372. @item red_expr, r
  7373. Set the red expression.
  7374. @item green_expr, g
  7375. Set the green expression.
  7376. @item blue_expr, b
  7377. Set the blue expression.
  7378. @end table
  7379. The colorspace is selected according to the specified options. If one
  7380. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7381. options is specified, the filter will automatically select a YCbCr
  7382. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7383. @option{blue_expr} options is specified, it will select an RGB
  7384. colorspace.
  7385. If one of the chrominance expression is not defined, it falls back on the other
  7386. one. If no alpha expression is specified it will evaluate to opaque value.
  7387. If none of chrominance expressions are specified, they will evaluate
  7388. to the luminance expression.
  7389. The expressions can use the following variables and functions:
  7390. @table @option
  7391. @item N
  7392. The sequential number of the filtered frame, starting from @code{0}.
  7393. @item X
  7394. @item Y
  7395. The coordinates of the current sample.
  7396. @item W
  7397. @item H
  7398. The width and height of the image.
  7399. @item SW
  7400. @item SH
  7401. Width and height scale depending on the currently filtered plane. It is the
  7402. ratio between the corresponding luma plane number of pixels and the current
  7403. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7404. @code{0.5,0.5} for chroma planes.
  7405. @item T
  7406. Time of the current frame, expressed in seconds.
  7407. @item p(x, y)
  7408. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7409. plane.
  7410. @item lum(x, y)
  7411. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7412. plane.
  7413. @item cb(x, y)
  7414. Return the value of the pixel at location (@var{x},@var{y}) of the
  7415. blue-difference chroma plane. Return 0 if there is no such plane.
  7416. @item cr(x, y)
  7417. Return the value of the pixel at location (@var{x},@var{y}) of the
  7418. red-difference chroma plane. Return 0 if there is no such plane.
  7419. @item r(x, y)
  7420. @item g(x, y)
  7421. @item b(x, y)
  7422. Return the value of the pixel at location (@var{x},@var{y}) of the
  7423. red/green/blue component. Return 0 if there is no such component.
  7424. @item alpha(x, y)
  7425. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7426. plane. Return 0 if there is no such plane.
  7427. @end table
  7428. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7429. automatically clipped to the closer edge.
  7430. @subsection Examples
  7431. @itemize
  7432. @item
  7433. Flip the image horizontally:
  7434. @example
  7435. geq=p(W-X\,Y)
  7436. @end example
  7437. @item
  7438. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7439. wavelength of 100 pixels:
  7440. @example
  7441. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7442. @end example
  7443. @item
  7444. Generate a fancy enigmatic moving light:
  7445. @example
  7446. 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
  7447. @end example
  7448. @item
  7449. Generate a quick emboss effect:
  7450. @example
  7451. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7452. @end example
  7453. @item
  7454. Modify RGB components depending on pixel position:
  7455. @example
  7456. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7457. @end example
  7458. @item
  7459. Create a radial gradient that is the same size as the input (also see
  7460. the @ref{vignette} filter):
  7461. @example
  7462. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7463. @end example
  7464. @end itemize
  7465. @section gradfun
  7466. Fix the banding artifacts that are sometimes introduced into nearly flat
  7467. regions by truncation to 8-bit color depth.
  7468. Interpolate the gradients that should go where the bands are, and
  7469. dither them.
  7470. It is designed for playback only. Do not use it prior to
  7471. lossy compression, because compression tends to lose the dither and
  7472. bring back the bands.
  7473. It accepts the following parameters:
  7474. @table @option
  7475. @item strength
  7476. The maximum amount by which the filter will change any one pixel. This is also
  7477. the threshold for detecting nearly flat regions. Acceptable values range from
  7478. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7479. valid range.
  7480. @item radius
  7481. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7482. gradients, but also prevents the filter from modifying the pixels near detailed
  7483. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7484. values will be clipped to the valid range.
  7485. @end table
  7486. Alternatively, the options can be specified as a flat string:
  7487. @var{strength}[:@var{radius}]
  7488. @subsection Examples
  7489. @itemize
  7490. @item
  7491. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7492. @example
  7493. gradfun=3.5:8
  7494. @end example
  7495. @item
  7496. Specify radius, omitting the strength (which will fall-back to the default
  7497. value):
  7498. @example
  7499. gradfun=radius=8
  7500. @end example
  7501. @end itemize
  7502. @anchor{haldclut}
  7503. @section haldclut
  7504. Apply a Hald CLUT to a video stream.
  7505. First input is the video stream to process, and second one is the Hald CLUT.
  7506. The Hald CLUT input can be a simple picture or a complete video stream.
  7507. The filter accepts the following options:
  7508. @table @option
  7509. @item shortest
  7510. Force termination when the shortest input terminates. Default is @code{0}.
  7511. @item repeatlast
  7512. Continue applying the last CLUT after the end of the stream. A value of
  7513. @code{0} disable the filter after the last frame of the CLUT is reached.
  7514. Default is @code{1}.
  7515. @end table
  7516. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7517. filters share the same internals).
  7518. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7519. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7520. @subsection Workflow examples
  7521. @subsubsection Hald CLUT video stream
  7522. Generate an identity Hald CLUT stream altered with various effects:
  7523. @example
  7524. 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
  7525. @end example
  7526. Note: make sure you use a lossless codec.
  7527. Then use it with @code{haldclut} to apply it on some random stream:
  7528. @example
  7529. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7530. @end example
  7531. The Hald CLUT will be applied to the 10 first seconds (duration of
  7532. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7533. to the remaining frames of the @code{mandelbrot} stream.
  7534. @subsubsection Hald CLUT with preview
  7535. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7536. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7537. biggest possible square starting at the top left of the picture. The remaining
  7538. padding pixels (bottom or right) will be ignored. This area can be used to add
  7539. a preview of the Hald CLUT.
  7540. Typically, the following generated Hald CLUT will be supported by the
  7541. @code{haldclut} filter:
  7542. @example
  7543. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7544. pad=iw+320 [padded_clut];
  7545. smptebars=s=320x256, split [a][b];
  7546. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7547. [main][b] overlay=W-320" -frames:v 1 clut.png
  7548. @end example
  7549. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7550. bars are displayed on the right-top, and below the same color bars processed by
  7551. the color changes.
  7552. Then, the effect of this Hald CLUT can be visualized with:
  7553. @example
  7554. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7555. @end example
  7556. @section hflip
  7557. Flip the input video horizontally.
  7558. For example, to horizontally flip the input video with @command{ffmpeg}:
  7559. @example
  7560. ffmpeg -i in.avi -vf "hflip" out.avi
  7561. @end example
  7562. @section histeq
  7563. This filter applies a global color histogram equalization on a
  7564. per-frame basis.
  7565. It can be used to correct video that has a compressed range of pixel
  7566. intensities. The filter redistributes the pixel intensities to
  7567. equalize their distribution across the intensity range. It may be
  7568. viewed as an "automatically adjusting contrast filter". This filter is
  7569. useful only for correcting degraded or poorly captured source
  7570. video.
  7571. The filter accepts the following options:
  7572. @table @option
  7573. @item strength
  7574. Determine the amount of equalization to be applied. As the strength
  7575. is reduced, the distribution of pixel intensities more-and-more
  7576. approaches that of the input frame. The value must be a float number
  7577. in the range [0,1] and defaults to 0.200.
  7578. @item intensity
  7579. Set the maximum intensity that can generated and scale the output
  7580. values appropriately. The strength should be set as desired and then
  7581. the intensity can be limited if needed to avoid washing-out. The value
  7582. must be a float number in the range [0,1] and defaults to 0.210.
  7583. @item antibanding
  7584. Set the antibanding level. If enabled the filter will randomly vary
  7585. the luminance of output pixels by a small amount to avoid banding of
  7586. the histogram. Possible values are @code{none}, @code{weak} or
  7587. @code{strong}. It defaults to @code{none}.
  7588. @end table
  7589. @section histogram
  7590. Compute and draw a color distribution histogram for the input video.
  7591. The computed histogram is a representation of the color component
  7592. distribution in an image.
  7593. Standard histogram displays the color components distribution in an image.
  7594. Displays color graph for each color component. Shows distribution of
  7595. the Y, U, V, A or R, G, B components, depending on input format, in the
  7596. current frame. Below each graph a color component scale meter is shown.
  7597. The filter accepts the following options:
  7598. @table @option
  7599. @item level_height
  7600. Set height of level. Default value is @code{200}.
  7601. Allowed range is [50, 2048].
  7602. @item scale_height
  7603. Set height of color scale. Default value is @code{12}.
  7604. Allowed range is [0, 40].
  7605. @item display_mode
  7606. Set display mode.
  7607. It accepts the following values:
  7608. @table @samp
  7609. @item stack
  7610. Per color component graphs are placed below each other.
  7611. @item parade
  7612. Per color component graphs are placed side by side.
  7613. @item overlay
  7614. Presents information identical to that in the @code{parade}, except
  7615. that the graphs representing color components are superimposed directly
  7616. over one another.
  7617. @end table
  7618. Default is @code{stack}.
  7619. @item levels_mode
  7620. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7621. Default is @code{linear}.
  7622. @item components
  7623. Set what color components to display.
  7624. Default is @code{7}.
  7625. @item fgopacity
  7626. Set foreground opacity. Default is @code{0.7}.
  7627. @item bgopacity
  7628. Set background opacity. Default is @code{0.5}.
  7629. @end table
  7630. @subsection Examples
  7631. @itemize
  7632. @item
  7633. Calculate and draw histogram:
  7634. @example
  7635. ffplay -i input -vf histogram
  7636. @end example
  7637. @end itemize
  7638. @anchor{hqdn3d}
  7639. @section hqdn3d
  7640. This is a high precision/quality 3d denoise filter. It aims to reduce
  7641. image noise, producing smooth images and making still images really
  7642. still. It should enhance compressibility.
  7643. It accepts the following optional parameters:
  7644. @table @option
  7645. @item luma_spatial
  7646. A non-negative floating point number which specifies spatial luma strength.
  7647. It defaults to 4.0.
  7648. @item chroma_spatial
  7649. A non-negative floating point number which specifies spatial chroma strength.
  7650. It defaults to 3.0*@var{luma_spatial}/4.0.
  7651. @item luma_tmp
  7652. A floating point number which specifies luma temporal strength. It defaults to
  7653. 6.0*@var{luma_spatial}/4.0.
  7654. @item chroma_tmp
  7655. A floating point number which specifies chroma temporal strength. It defaults to
  7656. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7657. @end table
  7658. @section hwdownload
  7659. Download hardware frames to system memory.
  7660. The input must be in hardware frames, and the output a non-hardware format.
  7661. Not all formats will be supported on the output - it may be necessary to insert
  7662. an additional @option{format} filter immediately following in the graph to get
  7663. the output in a supported format.
  7664. @section hwmap
  7665. Map hardware frames to system memory or to another device.
  7666. This filter has several different modes of operation; which one is used depends
  7667. on the input and output formats:
  7668. @itemize
  7669. @item
  7670. Hardware frame input, normal frame output
  7671. Map the input frames to system memory and pass them to the output. If the
  7672. original hardware frame is later required (for example, after overlaying
  7673. something else on part of it), the @option{hwmap} filter can be used again
  7674. in the next mode to retrieve it.
  7675. @item
  7676. Normal frame input, hardware frame output
  7677. If the input is actually a software-mapped hardware frame, then unmap it -
  7678. that is, return the original hardware frame.
  7679. Otherwise, a device must be provided. Create new hardware surfaces on that
  7680. device for the output, then map them back to the software format at the input
  7681. and give those frames to the preceding filter. This will then act like the
  7682. @option{hwupload} filter, but may be able to avoid an additional copy when
  7683. the input is already in a compatible format.
  7684. @item
  7685. Hardware frame input and output
  7686. A device must be supplied for the output, either directly or with the
  7687. @option{derive_device} option. The input and output devices must be of
  7688. different types and compatible - the exact meaning of this is
  7689. system-dependent, but typically it means that they must refer to the same
  7690. underlying hardware context (for example, refer to the same graphics card).
  7691. If the input frames were originally created on the output device, then unmap
  7692. to retrieve the original frames.
  7693. Otherwise, map the frames to the output device - create new hardware frames
  7694. on the output corresponding to the frames on the input.
  7695. @end itemize
  7696. The following additional parameters are accepted:
  7697. @table @option
  7698. @item mode
  7699. Set the frame mapping mode. Some combination of:
  7700. @table @var
  7701. @item read
  7702. The mapped frame should be readable.
  7703. @item write
  7704. The mapped frame should be writeable.
  7705. @item overwrite
  7706. The mapping will always overwrite the entire frame.
  7707. This may improve performance in some cases, as the original contents of the
  7708. frame need not be loaded.
  7709. @item direct
  7710. The mapping must not involve any copying.
  7711. Indirect mappings to copies of frames are created in some cases where either
  7712. direct mapping is not possible or it would have unexpected properties.
  7713. Setting this flag ensures that the mapping is direct and will fail if that is
  7714. not possible.
  7715. @end table
  7716. Defaults to @var{read+write} if not specified.
  7717. @item derive_device @var{type}
  7718. Rather than using the device supplied at initialisation, instead derive a new
  7719. device of type @var{type} from the device the input frames exist on.
  7720. @item reverse
  7721. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7722. and map them back to the source. This may be necessary in some cases where
  7723. a mapping in one direction is required but only the opposite direction is
  7724. supported by the devices being used.
  7725. This option is dangerous - it may break the preceding filter in undefined
  7726. ways if there are any additional constraints on that filter's output.
  7727. Do not use it without fully understanding the implications of its use.
  7728. @end table
  7729. @section hwupload
  7730. Upload system memory frames to hardware surfaces.
  7731. The device to upload to must be supplied when the filter is initialised. If
  7732. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7733. option.
  7734. @anchor{hwupload_cuda}
  7735. @section hwupload_cuda
  7736. Upload system memory frames to a CUDA device.
  7737. It accepts the following optional parameters:
  7738. @table @option
  7739. @item device
  7740. The number of the CUDA device to use
  7741. @end table
  7742. @section hqx
  7743. Apply a high-quality magnification filter designed for pixel art. This filter
  7744. was originally created by Maxim Stepin.
  7745. It accepts the following option:
  7746. @table @option
  7747. @item n
  7748. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7749. @code{hq3x} and @code{4} for @code{hq4x}.
  7750. Default is @code{3}.
  7751. @end table
  7752. @section hstack
  7753. Stack input videos horizontally.
  7754. All streams must be of same pixel format and of same height.
  7755. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7756. to create same output.
  7757. The filter accept the following option:
  7758. @table @option
  7759. @item inputs
  7760. Set number of input streams. Default is 2.
  7761. @item shortest
  7762. If set to 1, force the output to terminate when the shortest input
  7763. terminates. Default value is 0.
  7764. @end table
  7765. @section hue
  7766. Modify the hue and/or the saturation of the input.
  7767. It accepts the following parameters:
  7768. @table @option
  7769. @item h
  7770. Specify the hue angle as a number of degrees. It accepts an expression,
  7771. and defaults to "0".
  7772. @item s
  7773. Specify the saturation in the [-10,10] range. It accepts an expression and
  7774. defaults to "1".
  7775. @item H
  7776. Specify the hue angle as a number of radians. It accepts an
  7777. expression, and defaults to "0".
  7778. @item b
  7779. Specify the brightness in the [-10,10] range. It accepts an expression and
  7780. defaults to "0".
  7781. @end table
  7782. @option{h} and @option{H} are mutually exclusive, and can't be
  7783. specified at the same time.
  7784. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7785. expressions containing the following constants:
  7786. @table @option
  7787. @item n
  7788. frame count of the input frame starting from 0
  7789. @item pts
  7790. presentation timestamp of the input frame expressed in time base units
  7791. @item r
  7792. frame rate of the input video, NAN if the input frame rate is unknown
  7793. @item t
  7794. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7795. @item tb
  7796. time base of the input video
  7797. @end table
  7798. @subsection Examples
  7799. @itemize
  7800. @item
  7801. Set the hue to 90 degrees and the saturation to 1.0:
  7802. @example
  7803. hue=h=90:s=1
  7804. @end example
  7805. @item
  7806. Same command but expressing the hue in radians:
  7807. @example
  7808. hue=H=PI/2:s=1
  7809. @end example
  7810. @item
  7811. Rotate hue and make the saturation swing between 0
  7812. and 2 over a period of 1 second:
  7813. @example
  7814. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7815. @end example
  7816. @item
  7817. Apply a 3 seconds saturation fade-in effect starting at 0:
  7818. @example
  7819. hue="s=min(t/3\,1)"
  7820. @end example
  7821. The general fade-in expression can be written as:
  7822. @example
  7823. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7824. @end example
  7825. @item
  7826. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7827. @example
  7828. hue="s=max(0\, min(1\, (8-t)/3))"
  7829. @end example
  7830. The general fade-out expression can be written as:
  7831. @example
  7832. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7833. @end example
  7834. @end itemize
  7835. @subsection Commands
  7836. This filter supports the following commands:
  7837. @table @option
  7838. @item b
  7839. @item s
  7840. @item h
  7841. @item H
  7842. Modify the hue and/or the saturation and/or brightness of the input video.
  7843. The command accepts the same syntax of the corresponding option.
  7844. If the specified expression is not valid, it is kept at its current
  7845. value.
  7846. @end table
  7847. @section hysteresis
  7848. Grow first stream into second stream by connecting components.
  7849. This makes it possible to build more robust edge masks.
  7850. This filter accepts the following options:
  7851. @table @option
  7852. @item planes
  7853. Set which planes will be processed as bitmap, unprocessed planes will be
  7854. copied from first stream.
  7855. By default value 0xf, all planes will be processed.
  7856. @item threshold
  7857. Set threshold which is used in filtering. If pixel component value is higher than
  7858. this value filter algorithm for connecting components is activated.
  7859. By default value is 0.
  7860. @end table
  7861. @section idet
  7862. Detect video interlacing type.
  7863. This filter tries to detect if the input frames are interlaced, progressive,
  7864. top or bottom field first. It will also try to detect fields that are
  7865. repeated between adjacent frames (a sign of telecine).
  7866. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7867. Multiple frame detection incorporates the classification history of previous frames.
  7868. The filter will log these metadata values:
  7869. @table @option
  7870. @item single.current_frame
  7871. Detected type of current frame using single-frame detection. One of:
  7872. ``tff'' (top field first), ``bff'' (bottom field first),
  7873. ``progressive'', or ``undetermined''
  7874. @item single.tff
  7875. Cumulative number of frames detected as top field first using single-frame detection.
  7876. @item multiple.tff
  7877. Cumulative number of frames detected as top field first using multiple-frame detection.
  7878. @item single.bff
  7879. Cumulative number of frames detected as bottom field first using single-frame detection.
  7880. @item multiple.current_frame
  7881. Detected type of current frame using multiple-frame detection. One of:
  7882. ``tff'' (top field first), ``bff'' (bottom field first),
  7883. ``progressive'', or ``undetermined''
  7884. @item multiple.bff
  7885. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7886. @item single.progressive
  7887. Cumulative number of frames detected as progressive using single-frame detection.
  7888. @item multiple.progressive
  7889. Cumulative number of frames detected as progressive using multiple-frame detection.
  7890. @item single.undetermined
  7891. Cumulative number of frames that could not be classified using single-frame detection.
  7892. @item multiple.undetermined
  7893. Cumulative number of frames that could not be classified using multiple-frame detection.
  7894. @item repeated.current_frame
  7895. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7896. @item repeated.neither
  7897. Cumulative number of frames with no repeated field.
  7898. @item repeated.top
  7899. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7900. @item repeated.bottom
  7901. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7902. @end table
  7903. The filter accepts the following options:
  7904. @table @option
  7905. @item intl_thres
  7906. Set interlacing threshold.
  7907. @item prog_thres
  7908. Set progressive threshold.
  7909. @item rep_thres
  7910. Threshold for repeated field detection.
  7911. @item half_life
  7912. Number of frames after which a given frame's contribution to the
  7913. statistics is halved (i.e., it contributes only 0.5 to its
  7914. classification). The default of 0 means that all frames seen are given
  7915. full weight of 1.0 forever.
  7916. @item analyze_interlaced_flag
  7917. When this is not 0 then idet will use the specified number of frames to determine
  7918. if the interlaced flag is accurate, it will not count undetermined frames.
  7919. If the flag is found to be accurate it will be used without any further
  7920. computations, if it is found to be inaccurate it will be cleared without any
  7921. further computations. This allows inserting the idet filter as a low computational
  7922. method to clean up the interlaced flag
  7923. @end table
  7924. @section il
  7925. Deinterleave or interleave fields.
  7926. This filter allows one to process interlaced images fields without
  7927. deinterlacing them. Deinterleaving splits the input frame into 2
  7928. fields (so called half pictures). Odd lines are moved to the top
  7929. half of the output image, even lines to the bottom half.
  7930. You can process (filter) them independently and then re-interleave them.
  7931. The filter accepts the following options:
  7932. @table @option
  7933. @item luma_mode, l
  7934. @item chroma_mode, c
  7935. @item alpha_mode, a
  7936. Available values for @var{luma_mode}, @var{chroma_mode} and
  7937. @var{alpha_mode} are:
  7938. @table @samp
  7939. @item none
  7940. Do nothing.
  7941. @item deinterleave, d
  7942. Deinterleave fields, placing one above the other.
  7943. @item interleave, i
  7944. Interleave fields. Reverse the effect of deinterleaving.
  7945. @end table
  7946. Default value is @code{none}.
  7947. @item luma_swap, ls
  7948. @item chroma_swap, cs
  7949. @item alpha_swap, as
  7950. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7951. @end table
  7952. @section inflate
  7953. Apply inflate effect to the video.
  7954. This filter replaces the pixel by the local(3x3) average by taking into account
  7955. only values higher than the pixel.
  7956. It accepts the following options:
  7957. @table @option
  7958. @item threshold0
  7959. @item threshold1
  7960. @item threshold2
  7961. @item threshold3
  7962. Limit the maximum change for each plane, default is 65535.
  7963. If 0, plane will remain unchanged.
  7964. @end table
  7965. @section interlace
  7966. Simple interlacing filter from progressive contents. This interleaves upper (or
  7967. lower) lines from odd frames with lower (or upper) lines from even frames,
  7968. halving the frame rate and preserving image height.
  7969. @example
  7970. Original Original New Frame
  7971. Frame 'j' Frame 'j+1' (tff)
  7972. ========== =========== ==================
  7973. Line 0 --------------------> Frame 'j' Line 0
  7974. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7975. Line 2 ---------------------> Frame 'j' Line 2
  7976. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7977. ... ... ...
  7978. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7979. @end example
  7980. It accepts the following optional parameters:
  7981. @table @option
  7982. @item scan
  7983. This determines whether the interlaced frame is taken from the even
  7984. (tff - default) or odd (bff) lines of the progressive frame.
  7985. @item lowpass
  7986. Vertical lowpass filter to avoid twitter interlacing and
  7987. reduce moire patterns.
  7988. @table @samp
  7989. @item 0, off
  7990. Disable vertical lowpass filter
  7991. @item 1, linear
  7992. Enable linear filter (default)
  7993. @item 2, complex
  7994. Enable complex filter. This will slightly less reduce twitter and moire
  7995. but better retain detail and subjective sharpness impression.
  7996. @end table
  7997. @end table
  7998. @section kerndeint
  7999. Deinterlace input video by applying Donald Graft's adaptive kernel
  8000. deinterling. Work on interlaced parts of a video to produce
  8001. progressive frames.
  8002. The description of the accepted parameters follows.
  8003. @table @option
  8004. @item thresh
  8005. Set the threshold which affects the filter's tolerance when
  8006. determining if a pixel line must be processed. It must be an integer
  8007. in the range [0,255] and defaults to 10. A value of 0 will result in
  8008. applying the process on every pixels.
  8009. @item map
  8010. Paint pixels exceeding the threshold value to white if set to 1.
  8011. Default is 0.
  8012. @item order
  8013. Set the fields order. Swap fields if set to 1, leave fields alone if
  8014. 0. Default is 0.
  8015. @item sharp
  8016. Enable additional sharpening if set to 1. Default is 0.
  8017. @item twoway
  8018. Enable twoway sharpening if set to 1. Default is 0.
  8019. @end table
  8020. @subsection Examples
  8021. @itemize
  8022. @item
  8023. Apply default values:
  8024. @example
  8025. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8026. @end example
  8027. @item
  8028. Enable additional sharpening:
  8029. @example
  8030. kerndeint=sharp=1
  8031. @end example
  8032. @item
  8033. Paint processed pixels in white:
  8034. @example
  8035. kerndeint=map=1
  8036. @end example
  8037. @end itemize
  8038. @section lenscorrection
  8039. Correct radial lens distortion
  8040. This filter can be used to correct for radial distortion as can result from the use
  8041. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8042. one can use tools available for example as part of opencv or simply trial-and-error.
  8043. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8044. and extract the k1 and k2 coefficients from the resulting matrix.
  8045. Note that effectively the same filter is available in the open-source tools Krita and
  8046. Digikam from the KDE project.
  8047. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8048. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8049. brightness distribution, so you may want to use both filters together in certain
  8050. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8051. be applied before or after lens correction.
  8052. @subsection Options
  8053. The filter accepts the following options:
  8054. @table @option
  8055. @item cx
  8056. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8057. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8058. width. Default is 0.5.
  8059. @item cy
  8060. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8061. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8062. height. Default is 0.5.
  8063. @item k1
  8064. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8065. no correction. Default is 0.
  8066. @item k2
  8067. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8068. 0 means no correction. Default is 0.
  8069. @end table
  8070. The formula that generates the correction is:
  8071. @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)
  8072. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8073. distances from the focal point in the source and target images, respectively.
  8074. @section libvmaf
  8075. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8076. score between two input videos.
  8077. The obtained VMAF score is printed through the logging system.
  8078. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8079. After installing the library it can be enabled using:
  8080. @code{./configure --enable-libvmaf}.
  8081. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8082. The filter has following options:
  8083. @table @option
  8084. @item model_path
  8085. Set the model path which is to be used for SVM.
  8086. Default value: @code{"vmaf_v0.6.1.pkl"}
  8087. @item log_path
  8088. Set the file path to be used to store logs.
  8089. @item log_fmt
  8090. Set the format of the log file (xml or json).
  8091. @item enable_transform
  8092. Enables transform for computing vmaf.
  8093. @item phone_model
  8094. Invokes the phone model which will generate VMAF scores higher than in the
  8095. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8096. @item psnr
  8097. Enables computing psnr along with vmaf.
  8098. @item ssim
  8099. Enables computing ssim along with vmaf.
  8100. @item ms_ssim
  8101. Enables computing ms_ssim along with vmaf.
  8102. @item pool
  8103. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8104. @end table
  8105. This filter also supports the @ref{framesync} options.
  8106. On the below examples the input file @file{main.mpg} being processed is
  8107. compared with the reference file @file{ref.mpg}.
  8108. @example
  8109. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8110. @end example
  8111. Example with options:
  8112. @example
  8113. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8114. @end example
  8115. @section limiter
  8116. Limits the pixel components values to the specified range [min, max].
  8117. The filter accepts the following options:
  8118. @table @option
  8119. @item min
  8120. Lower bound. Defaults to the lowest allowed value for the input.
  8121. @item max
  8122. Upper bound. Defaults to the highest allowed value for the input.
  8123. @item planes
  8124. Specify which planes will be processed. Defaults to all available.
  8125. @end table
  8126. @section loop
  8127. Loop video frames.
  8128. The filter accepts the following options:
  8129. @table @option
  8130. @item loop
  8131. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8132. Default is 0.
  8133. @item size
  8134. Set maximal size in number of frames. Default is 0.
  8135. @item start
  8136. Set first frame of loop. Default is 0.
  8137. @end table
  8138. @anchor{lut3d}
  8139. @section lut3d
  8140. Apply a 3D LUT to an input video.
  8141. The filter accepts the following options:
  8142. @table @option
  8143. @item file
  8144. Set the 3D LUT file name.
  8145. Currently supported formats:
  8146. @table @samp
  8147. @item 3dl
  8148. AfterEffects
  8149. @item cube
  8150. Iridas
  8151. @item dat
  8152. DaVinci
  8153. @item m3d
  8154. Pandora
  8155. @end table
  8156. @item interp
  8157. Select interpolation mode.
  8158. Available values are:
  8159. @table @samp
  8160. @item nearest
  8161. Use values from the nearest defined point.
  8162. @item trilinear
  8163. Interpolate values using the 8 points defining a cube.
  8164. @item tetrahedral
  8165. Interpolate values using a tetrahedron.
  8166. @end table
  8167. @end table
  8168. This filter also supports the @ref{framesync} options.
  8169. @section lumakey
  8170. Turn certain luma values into transparency.
  8171. The filter accepts the following options:
  8172. @table @option
  8173. @item threshold
  8174. Set the luma which will be used as base for transparency.
  8175. Default value is @code{0}.
  8176. @item tolerance
  8177. Set the range of luma values to be keyed out.
  8178. Default value is @code{0}.
  8179. @item softness
  8180. Set the range of softness. Default value is @code{0}.
  8181. Use this to control gradual transition from zero to full transparency.
  8182. @end table
  8183. @section lut, lutrgb, lutyuv
  8184. Compute a look-up table for binding each pixel component input value
  8185. to an output value, and apply it to the input video.
  8186. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8187. to an RGB input video.
  8188. These filters accept the following parameters:
  8189. @table @option
  8190. @item c0
  8191. set first pixel component expression
  8192. @item c1
  8193. set second pixel component expression
  8194. @item c2
  8195. set third pixel component expression
  8196. @item c3
  8197. set fourth pixel component expression, corresponds to the alpha component
  8198. @item r
  8199. set red component expression
  8200. @item g
  8201. set green component expression
  8202. @item b
  8203. set blue component expression
  8204. @item a
  8205. alpha component expression
  8206. @item y
  8207. set Y/luminance component expression
  8208. @item u
  8209. set U/Cb component expression
  8210. @item v
  8211. set V/Cr component expression
  8212. @end table
  8213. Each of them specifies the expression to use for computing the lookup table for
  8214. the corresponding pixel component values.
  8215. The exact component associated to each of the @var{c*} options depends on the
  8216. format in input.
  8217. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8218. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8219. The expressions can contain the following constants and functions:
  8220. @table @option
  8221. @item w
  8222. @item h
  8223. The input width and height.
  8224. @item val
  8225. The input value for the pixel component.
  8226. @item clipval
  8227. The input value, clipped to the @var{minval}-@var{maxval} range.
  8228. @item maxval
  8229. The maximum value for the pixel component.
  8230. @item minval
  8231. The minimum value for the pixel component.
  8232. @item negval
  8233. The negated value for the pixel component value, clipped to the
  8234. @var{minval}-@var{maxval} range; it corresponds to the expression
  8235. "maxval-clipval+minval".
  8236. @item clip(val)
  8237. The computed value in @var{val}, clipped to the
  8238. @var{minval}-@var{maxval} range.
  8239. @item gammaval(gamma)
  8240. The computed gamma correction value of the pixel component value,
  8241. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8242. expression
  8243. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8244. @end table
  8245. All expressions default to "val".
  8246. @subsection Examples
  8247. @itemize
  8248. @item
  8249. Negate input video:
  8250. @example
  8251. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8252. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8253. @end example
  8254. The above is the same as:
  8255. @example
  8256. lutrgb="r=negval:g=negval:b=negval"
  8257. lutyuv="y=negval:u=negval:v=negval"
  8258. @end example
  8259. @item
  8260. Negate luminance:
  8261. @example
  8262. lutyuv=y=negval
  8263. @end example
  8264. @item
  8265. Remove chroma components, turning the video into a graytone image:
  8266. @example
  8267. lutyuv="u=128:v=128"
  8268. @end example
  8269. @item
  8270. Apply a luma burning effect:
  8271. @example
  8272. lutyuv="y=2*val"
  8273. @end example
  8274. @item
  8275. Remove green and blue components:
  8276. @example
  8277. lutrgb="g=0:b=0"
  8278. @end example
  8279. @item
  8280. Set a constant alpha channel value on input:
  8281. @example
  8282. format=rgba,lutrgb=a="maxval-minval/2"
  8283. @end example
  8284. @item
  8285. Correct luminance gamma by a factor of 0.5:
  8286. @example
  8287. lutyuv=y=gammaval(0.5)
  8288. @end example
  8289. @item
  8290. Discard least significant bits of luma:
  8291. @example
  8292. lutyuv=y='bitand(val, 128+64+32)'
  8293. @end example
  8294. @item
  8295. Technicolor like effect:
  8296. @example
  8297. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8298. @end example
  8299. @end itemize
  8300. @section lut2, tlut2
  8301. The @code{lut2} filter takes two input streams and outputs one
  8302. stream.
  8303. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8304. from one single stream.
  8305. This filter accepts the following parameters:
  8306. @table @option
  8307. @item c0
  8308. set first pixel component expression
  8309. @item c1
  8310. set second pixel component expression
  8311. @item c2
  8312. set third pixel component expression
  8313. @item c3
  8314. set fourth pixel component expression, corresponds to the alpha component
  8315. @end table
  8316. Each of them specifies the expression to use for computing the lookup table for
  8317. the corresponding pixel component values.
  8318. The exact component associated to each of the @var{c*} options depends on the
  8319. format in inputs.
  8320. The expressions can contain the following constants:
  8321. @table @option
  8322. @item w
  8323. @item h
  8324. The input width and height.
  8325. @item x
  8326. The first input value for the pixel component.
  8327. @item y
  8328. The second input value for the pixel component.
  8329. @item bdx
  8330. The first input video bit depth.
  8331. @item bdy
  8332. The second input video bit depth.
  8333. @end table
  8334. All expressions default to "x".
  8335. @subsection Examples
  8336. @itemize
  8337. @item
  8338. Highlight differences between two RGB video streams:
  8339. @example
  8340. 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)'
  8341. @end example
  8342. @item
  8343. Highlight differences between two YUV video streams:
  8344. @example
  8345. 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)'
  8346. @end example
  8347. @item
  8348. Show max difference between two video streams:
  8349. @example
  8350. 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)))'
  8351. @end example
  8352. @end itemize
  8353. @section maskedclamp
  8354. Clamp the first input stream with the second input and third input stream.
  8355. Returns the value of first stream to be between second input
  8356. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8357. This filter accepts the following options:
  8358. @table @option
  8359. @item undershoot
  8360. Default value is @code{0}.
  8361. @item overshoot
  8362. Default value is @code{0}.
  8363. @item planes
  8364. Set which planes will be processed as bitmap, unprocessed planes will be
  8365. copied from first stream.
  8366. By default value 0xf, all planes will be processed.
  8367. @end table
  8368. @section maskedmerge
  8369. Merge the first input stream with the second input stream using per pixel
  8370. weights in the third input stream.
  8371. A value of 0 in the third stream pixel component means that pixel component
  8372. from first stream is returned unchanged, while maximum value (eg. 255 for
  8373. 8-bit videos) means that pixel component from second stream is returned
  8374. unchanged. Intermediate values define the amount of merging between both
  8375. input stream's pixel components.
  8376. This filter accepts the following options:
  8377. @table @option
  8378. @item planes
  8379. Set which planes will be processed as bitmap, unprocessed planes will be
  8380. copied from first stream.
  8381. By default value 0xf, all planes will be processed.
  8382. @end table
  8383. @section mcdeint
  8384. Apply motion-compensation deinterlacing.
  8385. It needs one field per frame as input and must thus be used together
  8386. with yadif=1/3 or equivalent.
  8387. This filter accepts the following options:
  8388. @table @option
  8389. @item mode
  8390. Set the deinterlacing mode.
  8391. It accepts one of the following values:
  8392. @table @samp
  8393. @item fast
  8394. @item medium
  8395. @item slow
  8396. use iterative motion estimation
  8397. @item extra_slow
  8398. like @samp{slow}, but use multiple reference frames.
  8399. @end table
  8400. Default value is @samp{fast}.
  8401. @item parity
  8402. Set the picture field parity assumed for the input video. It must be
  8403. one of the following values:
  8404. @table @samp
  8405. @item 0, tff
  8406. assume top field first
  8407. @item 1, bff
  8408. assume bottom field first
  8409. @end table
  8410. Default value is @samp{bff}.
  8411. @item qp
  8412. Set per-block quantization parameter (QP) used by the internal
  8413. encoder.
  8414. Higher values should result in a smoother motion vector field but less
  8415. optimal individual vectors. Default value is 1.
  8416. @end table
  8417. @section mergeplanes
  8418. Merge color channel components from several video streams.
  8419. The filter accepts up to 4 input streams, and merge selected input
  8420. planes to the output video.
  8421. This filter accepts the following options:
  8422. @table @option
  8423. @item mapping
  8424. Set input to output plane mapping. Default is @code{0}.
  8425. The mappings is specified as a bitmap. It should be specified as a
  8426. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8427. mapping for the first plane of the output stream. 'A' sets the number of
  8428. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8429. corresponding input to use (from 0 to 3). The rest of the mappings is
  8430. similar, 'Bb' describes the mapping for the output stream second
  8431. plane, 'Cc' describes the mapping for the output stream third plane and
  8432. 'Dd' describes the mapping for the output stream fourth plane.
  8433. @item format
  8434. Set output pixel format. Default is @code{yuva444p}.
  8435. @end table
  8436. @subsection Examples
  8437. @itemize
  8438. @item
  8439. Merge three gray video streams of same width and height into single video stream:
  8440. @example
  8441. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8442. @end example
  8443. @item
  8444. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8445. @example
  8446. [a0][a1]mergeplanes=0x00010210:yuva444p
  8447. @end example
  8448. @item
  8449. Swap Y and A plane in yuva444p stream:
  8450. @example
  8451. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8452. @end example
  8453. @item
  8454. Swap U and V plane in yuv420p stream:
  8455. @example
  8456. format=yuv420p,mergeplanes=0x000201:yuv420p
  8457. @end example
  8458. @item
  8459. Cast a rgb24 clip to yuv444p:
  8460. @example
  8461. format=rgb24,mergeplanes=0x000102:yuv444p
  8462. @end example
  8463. @end itemize
  8464. @section mestimate
  8465. Estimate and export motion vectors using block matching algorithms.
  8466. Motion vectors are stored in frame side data to be used by other filters.
  8467. This filter accepts the following options:
  8468. @table @option
  8469. @item method
  8470. Specify the motion estimation method. Accepts one of the following values:
  8471. @table @samp
  8472. @item esa
  8473. Exhaustive search algorithm.
  8474. @item tss
  8475. Three step search algorithm.
  8476. @item tdls
  8477. Two dimensional logarithmic search algorithm.
  8478. @item ntss
  8479. New three step search algorithm.
  8480. @item fss
  8481. Four step search algorithm.
  8482. @item ds
  8483. Diamond search algorithm.
  8484. @item hexbs
  8485. Hexagon-based search algorithm.
  8486. @item epzs
  8487. Enhanced predictive zonal search algorithm.
  8488. @item umh
  8489. Uneven multi-hexagon search algorithm.
  8490. @end table
  8491. Default value is @samp{esa}.
  8492. @item mb_size
  8493. Macroblock size. Default @code{16}.
  8494. @item search_param
  8495. Search parameter. Default @code{7}.
  8496. @end table
  8497. @section midequalizer
  8498. Apply Midway Image Equalization effect using two video streams.
  8499. Midway Image Equalization adjusts a pair of images to have the same
  8500. histogram, while maintaining their dynamics as much as possible. It's
  8501. useful for e.g. matching exposures from a pair of stereo cameras.
  8502. This filter has two inputs and one output, which must be of same pixel format, but
  8503. may be of different sizes. The output of filter is first input adjusted with
  8504. midway histogram of both inputs.
  8505. This filter accepts the following option:
  8506. @table @option
  8507. @item planes
  8508. Set which planes to process. Default is @code{15}, which is all available planes.
  8509. @end table
  8510. @section minterpolate
  8511. Convert the video to specified frame rate using motion interpolation.
  8512. This filter accepts the following options:
  8513. @table @option
  8514. @item fps
  8515. 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}.
  8516. @item mi_mode
  8517. Motion interpolation mode. Following values are accepted:
  8518. @table @samp
  8519. @item dup
  8520. Duplicate previous or next frame for interpolating new ones.
  8521. @item blend
  8522. Blend source frames. Interpolated frame is mean of previous and next frames.
  8523. @item mci
  8524. Motion compensated interpolation. Following options are effective when this mode is selected:
  8525. @table @samp
  8526. @item mc_mode
  8527. Motion compensation mode. Following values are accepted:
  8528. @table @samp
  8529. @item obmc
  8530. Overlapped block motion compensation.
  8531. @item aobmc
  8532. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8533. @end table
  8534. Default mode is @samp{obmc}.
  8535. @item me_mode
  8536. Motion estimation mode. Following values are accepted:
  8537. @table @samp
  8538. @item bidir
  8539. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8540. @item bilat
  8541. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8542. @end table
  8543. Default mode is @samp{bilat}.
  8544. @item me
  8545. The algorithm to be used for motion estimation. Following values are accepted:
  8546. @table @samp
  8547. @item esa
  8548. Exhaustive search algorithm.
  8549. @item tss
  8550. Three step search algorithm.
  8551. @item tdls
  8552. Two dimensional logarithmic search algorithm.
  8553. @item ntss
  8554. New three step search algorithm.
  8555. @item fss
  8556. Four step search algorithm.
  8557. @item ds
  8558. Diamond search algorithm.
  8559. @item hexbs
  8560. Hexagon-based search algorithm.
  8561. @item epzs
  8562. Enhanced predictive zonal search algorithm.
  8563. @item umh
  8564. Uneven multi-hexagon search algorithm.
  8565. @end table
  8566. Default algorithm is @samp{epzs}.
  8567. @item mb_size
  8568. Macroblock size. Default @code{16}.
  8569. @item search_param
  8570. Motion estimation search parameter. Default @code{32}.
  8571. @item vsbmc
  8572. 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).
  8573. @end table
  8574. @end table
  8575. @item scd
  8576. 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:
  8577. @table @samp
  8578. @item none
  8579. Disable scene change detection.
  8580. @item fdiff
  8581. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8582. @end table
  8583. Default method is @samp{fdiff}.
  8584. @item scd_threshold
  8585. Scene change detection threshold. Default is @code{5.0}.
  8586. @end table
  8587. @section mix
  8588. Mix several video input streams into one video stream.
  8589. A description of the accepted options follows.
  8590. @table @option
  8591. @item nb_inputs
  8592. The number of inputs. If unspecified, it defaults to 2.
  8593. @item weights
  8594. Specify weight of each input video stream as sequence.
  8595. Each weight is separated by space. If number of weights
  8596. is smaller than number of @var{frames} last specified
  8597. weight will be used for all remaining unset weights.
  8598. @item scale
  8599. Specify scale, if it is set it will be multiplied with sum
  8600. of each weight multiplied with pixel values to give final destination
  8601. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8602. @item duration
  8603. Specify how end of stream is determined.
  8604. @table @samp
  8605. @item longest
  8606. The duration of the longest input. (default)
  8607. @item shortest
  8608. The duration of the shortest input.
  8609. @item first
  8610. The duration of the first input.
  8611. @end table
  8612. @end table
  8613. @section mpdecimate
  8614. Drop frames that do not differ greatly from the previous frame in
  8615. order to reduce frame rate.
  8616. The main use of this filter is for very-low-bitrate encoding
  8617. (e.g. streaming over dialup modem), but it could in theory be used for
  8618. fixing movies that were inverse-telecined incorrectly.
  8619. A description of the accepted options follows.
  8620. @table @option
  8621. @item max
  8622. Set the maximum number of consecutive frames which can be dropped (if
  8623. positive), or the minimum interval between dropped frames (if
  8624. negative). If the value is 0, the frame is dropped disregarding the
  8625. number of previous sequentially dropped frames.
  8626. Default value is 0.
  8627. @item hi
  8628. @item lo
  8629. @item frac
  8630. Set the dropping threshold values.
  8631. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8632. represent actual pixel value differences, so a threshold of 64
  8633. corresponds to 1 unit of difference for each pixel, or the same spread
  8634. out differently over the block.
  8635. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8636. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8637. meaning the whole image) differ by more than a threshold of @option{lo}.
  8638. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8639. 64*5, and default value for @option{frac} is 0.33.
  8640. @end table
  8641. @section negate
  8642. Negate input video.
  8643. It accepts an integer in input; if non-zero it negates the
  8644. alpha component (if available). The default value in input is 0.
  8645. @section nlmeans
  8646. Denoise frames using Non-Local Means algorithm.
  8647. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8648. context similarity is defined by comparing their surrounding patches of size
  8649. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8650. around the pixel.
  8651. Note that the research area defines centers for patches, which means some
  8652. patches will be made of pixels outside that research area.
  8653. The filter accepts the following options.
  8654. @table @option
  8655. @item s
  8656. Set denoising strength.
  8657. @item p
  8658. Set patch size.
  8659. @item pc
  8660. Same as @option{p} but for chroma planes.
  8661. The default value is @var{0} and means automatic.
  8662. @item r
  8663. Set research size.
  8664. @item rc
  8665. Same as @option{r} but for chroma planes.
  8666. The default value is @var{0} and means automatic.
  8667. @end table
  8668. @section nnedi
  8669. Deinterlace video using neural network edge directed interpolation.
  8670. This filter accepts the following options:
  8671. @table @option
  8672. @item weights
  8673. Mandatory option, without binary file filter can not work.
  8674. Currently file can be found here:
  8675. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8676. @item deint
  8677. Set which frames to deinterlace, by default it is @code{all}.
  8678. Can be @code{all} or @code{interlaced}.
  8679. @item field
  8680. Set mode of operation.
  8681. Can be one of the following:
  8682. @table @samp
  8683. @item af
  8684. Use frame flags, both fields.
  8685. @item a
  8686. Use frame flags, single field.
  8687. @item t
  8688. Use top field only.
  8689. @item b
  8690. Use bottom field only.
  8691. @item tf
  8692. Use both fields, top first.
  8693. @item bf
  8694. Use both fields, bottom first.
  8695. @end table
  8696. @item planes
  8697. Set which planes to process, by default filter process all frames.
  8698. @item nsize
  8699. Set size of local neighborhood around each pixel, used by the predictor neural
  8700. network.
  8701. Can be one of the following:
  8702. @table @samp
  8703. @item s8x6
  8704. @item s16x6
  8705. @item s32x6
  8706. @item s48x6
  8707. @item s8x4
  8708. @item s16x4
  8709. @item s32x4
  8710. @end table
  8711. @item nns
  8712. Set the number of neurons in predictor neural network.
  8713. Can be one of the following:
  8714. @table @samp
  8715. @item n16
  8716. @item n32
  8717. @item n64
  8718. @item n128
  8719. @item n256
  8720. @end table
  8721. @item qual
  8722. Controls the number of different neural network predictions that are blended
  8723. together to compute the final output value. Can be @code{fast}, default or
  8724. @code{slow}.
  8725. @item etype
  8726. Set which set of weights to use in the predictor.
  8727. Can be one of the following:
  8728. @table @samp
  8729. @item a
  8730. weights trained to minimize absolute error
  8731. @item s
  8732. weights trained to minimize squared error
  8733. @end table
  8734. @item pscrn
  8735. Controls whether or not the prescreener neural network is used to decide
  8736. which pixels should be processed by the predictor neural network and which
  8737. can be handled by simple cubic interpolation.
  8738. The prescreener is trained to know whether cubic interpolation will be
  8739. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8740. The computational complexity of the prescreener nn is much less than that of
  8741. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8742. using the prescreener generally results in much faster processing.
  8743. The prescreener is pretty accurate, so the difference between using it and not
  8744. using it is almost always unnoticeable.
  8745. Can be one of the following:
  8746. @table @samp
  8747. @item none
  8748. @item original
  8749. @item new
  8750. @end table
  8751. Default is @code{new}.
  8752. @item fapprox
  8753. Set various debugging flags.
  8754. @end table
  8755. @section noformat
  8756. Force libavfilter not to use any of the specified pixel formats for the
  8757. input to the next filter.
  8758. It accepts the following parameters:
  8759. @table @option
  8760. @item pix_fmts
  8761. A '|'-separated list of pixel format names, such as
  8762. pix_fmts=yuv420p|monow|rgb24".
  8763. @end table
  8764. @subsection Examples
  8765. @itemize
  8766. @item
  8767. Force libavfilter to use a format different from @var{yuv420p} for the
  8768. input to the vflip filter:
  8769. @example
  8770. noformat=pix_fmts=yuv420p,vflip
  8771. @end example
  8772. @item
  8773. Convert the input video to any of the formats not contained in the list:
  8774. @example
  8775. noformat=yuv420p|yuv444p|yuv410p
  8776. @end example
  8777. @end itemize
  8778. @section noise
  8779. Add noise on video input frame.
  8780. The filter accepts the following options:
  8781. @table @option
  8782. @item all_seed
  8783. @item c0_seed
  8784. @item c1_seed
  8785. @item c2_seed
  8786. @item c3_seed
  8787. Set noise seed for specific pixel component or all pixel components in case
  8788. of @var{all_seed}. Default value is @code{123457}.
  8789. @item all_strength, alls
  8790. @item c0_strength, c0s
  8791. @item c1_strength, c1s
  8792. @item c2_strength, c2s
  8793. @item c3_strength, c3s
  8794. Set noise strength for specific pixel component or all pixel components in case
  8795. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8796. @item all_flags, allf
  8797. @item c0_flags, c0f
  8798. @item c1_flags, c1f
  8799. @item c2_flags, c2f
  8800. @item c3_flags, c3f
  8801. Set pixel component flags or set flags for all components if @var{all_flags}.
  8802. Available values for component flags are:
  8803. @table @samp
  8804. @item a
  8805. averaged temporal noise (smoother)
  8806. @item p
  8807. mix random noise with a (semi)regular pattern
  8808. @item t
  8809. temporal noise (noise pattern changes between frames)
  8810. @item u
  8811. uniform noise (gaussian otherwise)
  8812. @end table
  8813. @end table
  8814. @subsection Examples
  8815. Add temporal and uniform noise to input video:
  8816. @example
  8817. noise=alls=20:allf=t+u
  8818. @end example
  8819. @section normalize
  8820. Normalize RGB video (aka histogram stretching, contrast stretching).
  8821. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8822. For each channel of each frame, the filter computes the input range and maps
  8823. it linearly to the user-specified output range. The output range defaults
  8824. to the full dynamic range from pure black to pure white.
  8825. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8826. changes in brightness) caused when small dark or bright objects enter or leave
  8827. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8828. video camera, and, like a video camera, it may cause a period of over- or
  8829. under-exposure of the video.
  8830. The R,G,B channels can be normalized independently, which may cause some
  8831. color shifting, or linked together as a single channel, which prevents
  8832. color shifting. Linked normalization preserves hue. Independent normalization
  8833. does not, so it can be used to remove some color casts. Independent and linked
  8834. normalization can be combined in any ratio.
  8835. The normalize filter accepts the following options:
  8836. @table @option
  8837. @item blackpt
  8838. @item whitept
  8839. Colors which define the output range. The minimum input value is mapped to
  8840. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8841. The defaults are black and white respectively. Specifying white for
  8842. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8843. normalized video. Shades of grey can be used to reduce the dynamic range
  8844. (contrast). Specifying saturated colors here can create some interesting
  8845. effects.
  8846. @item smoothing
  8847. The number of previous frames to use for temporal smoothing. The input range
  8848. of each channel is smoothed using a rolling average over the current frame
  8849. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8850. smoothing).
  8851. @item independence
  8852. Controls the ratio of independent (color shifting) channel normalization to
  8853. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8854. independent. Defaults to 1.0 (fully independent).
  8855. @item strength
  8856. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8857. expensive no-op. Defaults to 1.0 (full strength).
  8858. @end table
  8859. @subsection Examples
  8860. Stretch video contrast to use the full dynamic range, with no temporal
  8861. smoothing; may flicker depending on the source content:
  8862. @example
  8863. normalize=blackpt=black:whitept=white:smoothing=0
  8864. @end example
  8865. As above, but with 50 frames of temporal smoothing; flicker should be
  8866. reduced, depending on the source content:
  8867. @example
  8868. normalize=blackpt=black:whitept=white:smoothing=50
  8869. @end example
  8870. As above, but with hue-preserving linked channel normalization:
  8871. @example
  8872. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8873. @end example
  8874. As above, but with half strength:
  8875. @example
  8876. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8877. @end example
  8878. Map the darkest input color to red, the brightest input color to cyan:
  8879. @example
  8880. normalize=blackpt=red:whitept=cyan
  8881. @end example
  8882. @section null
  8883. Pass the video source unchanged to the output.
  8884. @section ocr
  8885. Optical Character Recognition
  8886. This filter uses Tesseract for optical character recognition.
  8887. It accepts the following options:
  8888. @table @option
  8889. @item datapath
  8890. Set datapath to tesseract data. Default is to use whatever was
  8891. set at installation.
  8892. @item language
  8893. Set language, default is "eng".
  8894. @item whitelist
  8895. Set character whitelist.
  8896. @item blacklist
  8897. Set character blacklist.
  8898. @end table
  8899. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8900. @section ocv
  8901. Apply a video transform using libopencv.
  8902. To enable this filter, install the libopencv library and headers and
  8903. configure FFmpeg with @code{--enable-libopencv}.
  8904. It accepts the following parameters:
  8905. @table @option
  8906. @item filter_name
  8907. The name of the libopencv filter to apply.
  8908. @item filter_params
  8909. The parameters to pass to the libopencv filter. If not specified, the default
  8910. values are assumed.
  8911. @end table
  8912. Refer to the official libopencv documentation for more precise
  8913. information:
  8914. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8915. Several libopencv filters are supported; see the following subsections.
  8916. @anchor{dilate}
  8917. @subsection dilate
  8918. Dilate an image by using a specific structuring element.
  8919. It corresponds to the libopencv function @code{cvDilate}.
  8920. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8921. @var{struct_el} represents a structuring element, and has the syntax:
  8922. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8923. @var{cols} and @var{rows} represent the number of columns and rows of
  8924. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8925. point, and @var{shape} the shape for the structuring element. @var{shape}
  8926. must be "rect", "cross", "ellipse", or "custom".
  8927. If the value for @var{shape} is "custom", it must be followed by a
  8928. string of the form "=@var{filename}". The file with name
  8929. @var{filename} is assumed to represent a binary image, with each
  8930. printable character corresponding to a bright pixel. When a custom
  8931. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8932. or columns and rows of the read file are assumed instead.
  8933. The default value for @var{struct_el} is "3x3+0x0/rect".
  8934. @var{nb_iterations} specifies the number of times the transform is
  8935. applied to the image, and defaults to 1.
  8936. Some examples:
  8937. @example
  8938. # Use the default values
  8939. ocv=dilate
  8940. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8941. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8942. # Read the shape from the file diamond.shape, iterating two times.
  8943. # The file diamond.shape may contain a pattern of characters like this
  8944. # *
  8945. # ***
  8946. # *****
  8947. # ***
  8948. # *
  8949. # The specified columns and rows are ignored
  8950. # but the anchor point coordinates are not
  8951. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8952. @end example
  8953. @subsection erode
  8954. Erode an image by using a specific structuring element.
  8955. It corresponds to the libopencv function @code{cvErode}.
  8956. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8957. with the same syntax and semantics as the @ref{dilate} filter.
  8958. @subsection smooth
  8959. Smooth the input video.
  8960. The filter takes the following parameters:
  8961. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8962. @var{type} is the type of smooth filter to apply, and must be one of
  8963. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8964. or "bilateral". The default value is "gaussian".
  8965. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8966. depend on the smooth type. @var{param1} and
  8967. @var{param2} accept integer positive values or 0. @var{param3} and
  8968. @var{param4} accept floating point values.
  8969. The default value for @var{param1} is 3. The default value for the
  8970. other parameters is 0.
  8971. These parameters correspond to the parameters assigned to the
  8972. libopencv function @code{cvSmooth}.
  8973. @section oscilloscope
  8974. 2D Video Oscilloscope.
  8975. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8976. It accepts the following parameters:
  8977. @table @option
  8978. @item x
  8979. Set scope center x position.
  8980. @item y
  8981. Set scope center y position.
  8982. @item s
  8983. Set scope size, relative to frame diagonal.
  8984. @item t
  8985. Set scope tilt/rotation.
  8986. @item o
  8987. Set trace opacity.
  8988. @item tx
  8989. Set trace center x position.
  8990. @item ty
  8991. Set trace center y position.
  8992. @item tw
  8993. Set trace width, relative to width of frame.
  8994. @item th
  8995. Set trace height, relative to height of frame.
  8996. @item c
  8997. Set which components to trace. By default it traces first three components.
  8998. @item g
  8999. Draw trace grid. By default is enabled.
  9000. @item st
  9001. Draw some statistics. By default is enabled.
  9002. @item sc
  9003. Draw scope. By default is enabled.
  9004. @end table
  9005. @subsection Examples
  9006. @itemize
  9007. @item
  9008. Inspect full first row of video frame.
  9009. @example
  9010. oscilloscope=x=0.5:y=0:s=1
  9011. @end example
  9012. @item
  9013. Inspect full last row of video frame.
  9014. @example
  9015. oscilloscope=x=0.5:y=1:s=1
  9016. @end example
  9017. @item
  9018. Inspect full 5th line of video frame of height 1080.
  9019. @example
  9020. oscilloscope=x=0.5:y=5/1080:s=1
  9021. @end example
  9022. @item
  9023. Inspect full last column of video frame.
  9024. @example
  9025. oscilloscope=x=1:y=0.5:s=1:t=1
  9026. @end example
  9027. @end itemize
  9028. @anchor{overlay}
  9029. @section overlay
  9030. Overlay one video on top of another.
  9031. It takes two inputs and has one output. The first input is the "main"
  9032. video on which the second input is overlaid.
  9033. It accepts the following parameters:
  9034. A description of the accepted options follows.
  9035. @table @option
  9036. @item x
  9037. @item y
  9038. Set the expression for the x and y coordinates of the overlaid video
  9039. on the main video. Default value is "0" for both expressions. In case
  9040. the expression is invalid, it is set to a huge value (meaning that the
  9041. overlay will not be displayed within the output visible area).
  9042. @item eof_action
  9043. See @ref{framesync}.
  9044. @item eval
  9045. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9046. It accepts the following values:
  9047. @table @samp
  9048. @item init
  9049. only evaluate expressions once during the filter initialization or
  9050. when a command is processed
  9051. @item frame
  9052. evaluate expressions for each incoming frame
  9053. @end table
  9054. Default value is @samp{frame}.
  9055. @item shortest
  9056. See @ref{framesync}.
  9057. @item format
  9058. Set the format for the output video.
  9059. It accepts the following values:
  9060. @table @samp
  9061. @item yuv420
  9062. force YUV420 output
  9063. @item yuv422
  9064. force YUV422 output
  9065. @item yuv444
  9066. force YUV444 output
  9067. @item rgb
  9068. force packed RGB output
  9069. @item gbrp
  9070. force planar RGB output
  9071. @item auto
  9072. automatically pick format
  9073. @end table
  9074. Default value is @samp{yuv420}.
  9075. @item repeatlast
  9076. See @ref{framesync}.
  9077. @item alpha
  9078. Set format of alpha of the overlaid video, it can be @var{straight} or
  9079. @var{premultiplied}. Default is @var{straight}.
  9080. @end table
  9081. The @option{x}, and @option{y} expressions can contain the following
  9082. parameters.
  9083. @table @option
  9084. @item main_w, W
  9085. @item main_h, H
  9086. The main input width and height.
  9087. @item overlay_w, w
  9088. @item overlay_h, h
  9089. The overlay input width and height.
  9090. @item x
  9091. @item y
  9092. The computed values for @var{x} and @var{y}. They are evaluated for
  9093. each new frame.
  9094. @item hsub
  9095. @item vsub
  9096. horizontal and vertical chroma subsample values of the output
  9097. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9098. @var{vsub} is 1.
  9099. @item n
  9100. the number of input frame, starting from 0
  9101. @item pos
  9102. the position in the file of the input frame, NAN if unknown
  9103. @item t
  9104. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9105. @end table
  9106. This filter also supports the @ref{framesync} options.
  9107. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9108. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9109. when @option{eval} is set to @samp{init}.
  9110. Be aware that frames are taken from each input video in timestamp
  9111. order, hence, if their initial timestamps differ, it is a good idea
  9112. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9113. have them begin in the same zero timestamp, as the example for
  9114. the @var{movie} filter does.
  9115. You can chain together more overlays but you should test the
  9116. efficiency of such approach.
  9117. @subsection Commands
  9118. This filter supports the following commands:
  9119. @table @option
  9120. @item x
  9121. @item y
  9122. Modify the x and y of the overlay input.
  9123. The command accepts the same syntax of the corresponding option.
  9124. If the specified expression is not valid, it is kept at its current
  9125. value.
  9126. @end table
  9127. @subsection Examples
  9128. @itemize
  9129. @item
  9130. Draw the overlay at 10 pixels from the bottom right corner of the main
  9131. video:
  9132. @example
  9133. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9134. @end example
  9135. Using named options the example above becomes:
  9136. @example
  9137. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9138. @end example
  9139. @item
  9140. Insert a transparent PNG logo in the bottom left corner of the input,
  9141. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9142. @example
  9143. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9144. @end example
  9145. @item
  9146. Insert 2 different transparent PNG logos (second logo on bottom
  9147. right corner) using the @command{ffmpeg} tool:
  9148. @example
  9149. 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
  9150. @end example
  9151. @item
  9152. Add a transparent color layer on top of the main video; @code{WxH}
  9153. must specify the size of the main input to the overlay filter:
  9154. @example
  9155. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9156. @end example
  9157. @item
  9158. Play an original video and a filtered version (here with the deshake
  9159. filter) side by side using the @command{ffplay} tool:
  9160. @example
  9161. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9162. @end example
  9163. The above command is the same as:
  9164. @example
  9165. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9166. @end example
  9167. @item
  9168. Make a sliding overlay appearing from the left to the right top part of the
  9169. screen starting since time 2:
  9170. @example
  9171. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9172. @end example
  9173. @item
  9174. Compose output by putting two input videos side to side:
  9175. @example
  9176. ffmpeg -i left.avi -i right.avi -filter_complex "
  9177. nullsrc=size=200x100 [background];
  9178. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9179. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9180. [background][left] overlay=shortest=1 [background+left];
  9181. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9182. "
  9183. @end example
  9184. @item
  9185. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9186. @example
  9187. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9188. -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]'
  9189. masked.avi
  9190. @end example
  9191. @item
  9192. Chain several overlays in cascade:
  9193. @example
  9194. nullsrc=s=200x200 [bg];
  9195. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9196. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9197. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9198. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9199. [in3] null, [mid2] overlay=100:100 [out0]
  9200. @end example
  9201. @end itemize
  9202. @section owdenoise
  9203. Apply Overcomplete Wavelet denoiser.
  9204. The filter accepts the following options:
  9205. @table @option
  9206. @item depth
  9207. Set depth.
  9208. Larger depth values will denoise lower frequency components more, but
  9209. slow down filtering.
  9210. Must be an int in the range 8-16, default is @code{8}.
  9211. @item luma_strength, ls
  9212. Set luma strength.
  9213. Must be a double value in the range 0-1000, default is @code{1.0}.
  9214. @item chroma_strength, cs
  9215. Set chroma strength.
  9216. Must be a double value in the range 0-1000, default is @code{1.0}.
  9217. @end table
  9218. @anchor{pad}
  9219. @section pad
  9220. Add paddings to the input image, and place the original input at the
  9221. provided @var{x}, @var{y} coordinates.
  9222. It accepts the following parameters:
  9223. @table @option
  9224. @item width, w
  9225. @item height, h
  9226. Specify an expression for the size of the output image with the
  9227. paddings added. If the value for @var{width} or @var{height} is 0, the
  9228. corresponding input size is used for the output.
  9229. The @var{width} expression can reference the value set by the
  9230. @var{height} expression, and vice versa.
  9231. The default value of @var{width} and @var{height} is 0.
  9232. @item x
  9233. @item y
  9234. Specify the offsets to place the input image at within the padded area,
  9235. with respect to the top/left border of the output image.
  9236. The @var{x} expression can reference the value set by the @var{y}
  9237. expression, and vice versa.
  9238. The default value of @var{x} and @var{y} is 0.
  9239. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9240. so the input image is centered on the padded area.
  9241. @item color
  9242. Specify the color of the padded area. For the syntax of this option,
  9243. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9244. manual,ffmpeg-utils}.
  9245. The default value of @var{color} is "black".
  9246. @item eval
  9247. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9248. It accepts the following values:
  9249. @table @samp
  9250. @item init
  9251. Only evaluate expressions once during the filter initialization or when
  9252. a command is processed.
  9253. @item frame
  9254. Evaluate expressions for each incoming frame.
  9255. @end table
  9256. Default value is @samp{init}.
  9257. @item aspect
  9258. Pad to aspect instead to a resolution.
  9259. @end table
  9260. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9261. options are expressions containing the following constants:
  9262. @table @option
  9263. @item in_w
  9264. @item in_h
  9265. The input video width and height.
  9266. @item iw
  9267. @item ih
  9268. These are the same as @var{in_w} and @var{in_h}.
  9269. @item out_w
  9270. @item out_h
  9271. The output width and height (the size of the padded area), as
  9272. specified by the @var{width} and @var{height} expressions.
  9273. @item ow
  9274. @item oh
  9275. These are the same as @var{out_w} and @var{out_h}.
  9276. @item x
  9277. @item y
  9278. The x and y offsets as specified by the @var{x} and @var{y}
  9279. expressions, or NAN if not yet specified.
  9280. @item a
  9281. same as @var{iw} / @var{ih}
  9282. @item sar
  9283. input sample aspect ratio
  9284. @item dar
  9285. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9286. @item hsub
  9287. @item vsub
  9288. The horizontal and vertical chroma subsample values. For example for the
  9289. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9290. @end table
  9291. @subsection Examples
  9292. @itemize
  9293. @item
  9294. Add paddings with the color "violet" to the input video. The output video
  9295. size is 640x480, and the top-left corner of the input video is placed at
  9296. column 0, row 40
  9297. @example
  9298. pad=640:480:0:40:violet
  9299. @end example
  9300. The example above is equivalent to the following command:
  9301. @example
  9302. pad=width=640:height=480:x=0:y=40:color=violet
  9303. @end example
  9304. @item
  9305. Pad the input to get an output with dimensions increased by 3/2,
  9306. and put the input video at the center of the padded area:
  9307. @example
  9308. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9309. @end example
  9310. @item
  9311. Pad the input to get a squared output with size equal to the maximum
  9312. value between the input width and height, and put the input video at
  9313. the center of the padded area:
  9314. @example
  9315. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9316. @end example
  9317. @item
  9318. Pad the input to get a final w/h ratio of 16:9:
  9319. @example
  9320. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9321. @end example
  9322. @item
  9323. In case of anamorphic video, in order to set the output display aspect
  9324. correctly, it is necessary to use @var{sar} in the expression,
  9325. according to the relation:
  9326. @example
  9327. (ih * X / ih) * sar = output_dar
  9328. X = output_dar / sar
  9329. @end example
  9330. Thus the previous example needs to be modified to:
  9331. @example
  9332. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9333. @end example
  9334. @item
  9335. Double the output size and put the input video in the bottom-right
  9336. corner of the output padded area:
  9337. @example
  9338. pad="2*iw:2*ih:ow-iw:oh-ih"
  9339. @end example
  9340. @end itemize
  9341. @anchor{palettegen}
  9342. @section palettegen
  9343. Generate one palette for a whole video stream.
  9344. It accepts the following options:
  9345. @table @option
  9346. @item max_colors
  9347. Set the maximum number of colors to quantize in the palette.
  9348. Note: the palette will still contain 256 colors; the unused palette entries
  9349. will be black.
  9350. @item reserve_transparent
  9351. Create a palette of 255 colors maximum and reserve the last one for
  9352. transparency. Reserving the transparency color is useful for GIF optimization.
  9353. If not set, the maximum of colors in the palette will be 256. You probably want
  9354. to disable this option for a standalone image.
  9355. Set by default.
  9356. @item transparency_color
  9357. Set the color that will be used as background for transparency.
  9358. @item stats_mode
  9359. Set statistics mode.
  9360. It accepts the following values:
  9361. @table @samp
  9362. @item full
  9363. Compute full frame histograms.
  9364. @item diff
  9365. Compute histograms only for the part that differs from previous frame. This
  9366. might be relevant to give more importance to the moving part of your input if
  9367. the background is static.
  9368. @item single
  9369. Compute new histogram for each frame.
  9370. @end table
  9371. Default value is @var{full}.
  9372. @end table
  9373. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9374. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9375. color quantization of the palette. This information is also visible at
  9376. @var{info} logging level.
  9377. @subsection Examples
  9378. @itemize
  9379. @item
  9380. Generate a representative palette of a given video using @command{ffmpeg}:
  9381. @example
  9382. ffmpeg -i input.mkv -vf palettegen palette.png
  9383. @end example
  9384. @end itemize
  9385. @section paletteuse
  9386. Use a palette to downsample an input video stream.
  9387. The filter takes two inputs: one video stream and a palette. The palette must
  9388. be a 256 pixels image.
  9389. It accepts the following options:
  9390. @table @option
  9391. @item dither
  9392. Select dithering mode. Available algorithms are:
  9393. @table @samp
  9394. @item bayer
  9395. Ordered 8x8 bayer dithering (deterministic)
  9396. @item heckbert
  9397. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9398. Note: this dithering is sometimes considered "wrong" and is included as a
  9399. reference.
  9400. @item floyd_steinberg
  9401. Floyd and Steingberg dithering (error diffusion)
  9402. @item sierra2
  9403. Frankie Sierra dithering v2 (error diffusion)
  9404. @item sierra2_4a
  9405. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9406. @end table
  9407. Default is @var{sierra2_4a}.
  9408. @item bayer_scale
  9409. When @var{bayer} dithering is selected, this option defines the scale of the
  9410. pattern (how much the crosshatch pattern is visible). A low value means more
  9411. visible pattern for less banding, and higher value means less visible pattern
  9412. at the cost of more banding.
  9413. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9414. @item diff_mode
  9415. If set, define the zone to process
  9416. @table @samp
  9417. @item rectangle
  9418. Only the changing rectangle will be reprocessed. This is similar to GIF
  9419. cropping/offsetting compression mechanism. This option can be useful for speed
  9420. if only a part of the image is changing, and has use cases such as limiting the
  9421. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9422. moving scene (it leads to more deterministic output if the scene doesn't change
  9423. much, and as a result less moving noise and better GIF compression).
  9424. @end table
  9425. Default is @var{none}.
  9426. @item new
  9427. Take new palette for each output frame.
  9428. @item alpha_threshold
  9429. Sets the alpha threshold for transparency. Alpha values above this threshold
  9430. will be treated as completely opaque, and values below this threshold will be
  9431. treated as completely transparent.
  9432. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9433. @end table
  9434. @subsection Examples
  9435. @itemize
  9436. @item
  9437. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9438. using @command{ffmpeg}:
  9439. @example
  9440. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9441. @end example
  9442. @end itemize
  9443. @section perspective
  9444. Correct perspective of video not recorded perpendicular to the screen.
  9445. A description of the accepted parameters follows.
  9446. @table @option
  9447. @item x0
  9448. @item y0
  9449. @item x1
  9450. @item y1
  9451. @item x2
  9452. @item y2
  9453. @item x3
  9454. @item y3
  9455. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9456. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9457. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9458. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9459. then the corners of the source will be sent to the specified coordinates.
  9460. The expressions can use the following variables:
  9461. @table @option
  9462. @item W
  9463. @item H
  9464. the width and height of video frame.
  9465. @item in
  9466. Input frame count.
  9467. @item on
  9468. Output frame count.
  9469. @end table
  9470. @item interpolation
  9471. Set interpolation for perspective correction.
  9472. It accepts the following values:
  9473. @table @samp
  9474. @item linear
  9475. @item cubic
  9476. @end table
  9477. Default value is @samp{linear}.
  9478. @item sense
  9479. Set interpretation of coordinate options.
  9480. It accepts the following values:
  9481. @table @samp
  9482. @item 0, source
  9483. Send point in the source specified by the given coordinates to
  9484. the corners of the destination.
  9485. @item 1, destination
  9486. Send the corners of the source to the point in the destination specified
  9487. by the given coordinates.
  9488. Default value is @samp{source}.
  9489. @end table
  9490. @item eval
  9491. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9492. It accepts the following values:
  9493. @table @samp
  9494. @item init
  9495. only evaluate expressions once during the filter initialization or
  9496. when a command is processed
  9497. @item frame
  9498. evaluate expressions for each incoming frame
  9499. @end table
  9500. Default value is @samp{init}.
  9501. @end table
  9502. @section phase
  9503. Delay interlaced video by one field time so that the field order changes.
  9504. The intended use is to fix PAL movies that have been captured with the
  9505. opposite field order to the film-to-video transfer.
  9506. A description of the accepted parameters follows.
  9507. @table @option
  9508. @item mode
  9509. Set phase mode.
  9510. It accepts the following values:
  9511. @table @samp
  9512. @item t
  9513. Capture field order top-first, transfer bottom-first.
  9514. Filter will delay the bottom field.
  9515. @item b
  9516. Capture field order bottom-first, transfer top-first.
  9517. Filter will delay the top field.
  9518. @item p
  9519. Capture and transfer with the same field order. This mode only exists
  9520. for the documentation of the other options to refer to, but if you
  9521. actually select it, the filter will faithfully do nothing.
  9522. @item a
  9523. Capture field order determined automatically by field flags, transfer
  9524. opposite.
  9525. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9526. basis using field flags. If no field information is available,
  9527. then this works just like @samp{u}.
  9528. @item u
  9529. Capture unknown or varying, transfer opposite.
  9530. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9531. analyzing the images and selecting the alternative that produces best
  9532. match between the fields.
  9533. @item T
  9534. Capture top-first, transfer unknown or varying.
  9535. Filter selects among @samp{t} and @samp{p} using image analysis.
  9536. @item B
  9537. Capture bottom-first, transfer unknown or varying.
  9538. Filter selects among @samp{b} and @samp{p} using image analysis.
  9539. @item A
  9540. Capture determined by field flags, transfer unknown or varying.
  9541. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9542. image analysis. If no field information is available, then this works just
  9543. like @samp{U}. This is the default mode.
  9544. @item U
  9545. Both capture and transfer unknown or varying.
  9546. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9547. @end table
  9548. @end table
  9549. @section pixdesctest
  9550. Pixel format descriptor test filter, mainly useful for internal
  9551. testing. The output video should be equal to the input video.
  9552. For example:
  9553. @example
  9554. format=monow, pixdesctest
  9555. @end example
  9556. can be used to test the monowhite pixel format descriptor definition.
  9557. @section pixscope
  9558. Display sample values of color channels. Mainly useful for checking color
  9559. and levels. Minimum supported resolution is 640x480.
  9560. The filters accept the following options:
  9561. @table @option
  9562. @item x
  9563. Set scope X position, relative offset on X axis.
  9564. @item y
  9565. Set scope Y position, relative offset on Y axis.
  9566. @item w
  9567. Set scope width.
  9568. @item h
  9569. Set scope height.
  9570. @item o
  9571. Set window opacity. This window also holds statistics about pixel area.
  9572. @item wx
  9573. Set window X position, relative offset on X axis.
  9574. @item wy
  9575. Set window Y position, relative offset on Y axis.
  9576. @end table
  9577. @section pp
  9578. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9579. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9580. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9581. Each subfilter and some options have a short and a long name that can be used
  9582. interchangeably, i.e. dr/dering are the same.
  9583. The filters accept the following options:
  9584. @table @option
  9585. @item subfilters
  9586. Set postprocessing subfilters string.
  9587. @end table
  9588. All subfilters share common options to determine their scope:
  9589. @table @option
  9590. @item a/autoq
  9591. Honor the quality commands for this subfilter.
  9592. @item c/chrom
  9593. Do chrominance filtering, too (default).
  9594. @item y/nochrom
  9595. Do luminance filtering only (no chrominance).
  9596. @item n/noluma
  9597. Do chrominance filtering only (no luminance).
  9598. @end table
  9599. These options can be appended after the subfilter name, separated by a '|'.
  9600. Available subfilters are:
  9601. @table @option
  9602. @item hb/hdeblock[|difference[|flatness]]
  9603. Horizontal deblocking filter
  9604. @table @option
  9605. @item difference
  9606. Difference factor where higher values mean more deblocking (default: @code{32}).
  9607. @item flatness
  9608. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9609. @end table
  9610. @item vb/vdeblock[|difference[|flatness]]
  9611. Vertical deblocking filter
  9612. @table @option
  9613. @item difference
  9614. Difference factor where higher values mean more deblocking (default: @code{32}).
  9615. @item flatness
  9616. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9617. @end table
  9618. @item ha/hadeblock[|difference[|flatness]]
  9619. Accurate horizontal deblocking filter
  9620. @table @option
  9621. @item difference
  9622. Difference factor where higher values mean more deblocking (default: @code{32}).
  9623. @item flatness
  9624. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9625. @end table
  9626. @item va/vadeblock[|difference[|flatness]]
  9627. Accurate vertical deblocking filter
  9628. @table @option
  9629. @item difference
  9630. Difference factor where higher values mean more deblocking (default: @code{32}).
  9631. @item flatness
  9632. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9633. @end table
  9634. @end table
  9635. The horizontal and vertical deblocking filters share the difference and
  9636. flatness values so you cannot set different horizontal and vertical
  9637. thresholds.
  9638. @table @option
  9639. @item h1/x1hdeblock
  9640. Experimental horizontal deblocking filter
  9641. @item v1/x1vdeblock
  9642. Experimental vertical deblocking filter
  9643. @item dr/dering
  9644. Deringing filter
  9645. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9646. @table @option
  9647. @item threshold1
  9648. larger -> stronger filtering
  9649. @item threshold2
  9650. larger -> stronger filtering
  9651. @item threshold3
  9652. larger -> stronger filtering
  9653. @end table
  9654. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9655. @table @option
  9656. @item f/fullyrange
  9657. Stretch luminance to @code{0-255}.
  9658. @end table
  9659. @item lb/linblenddeint
  9660. Linear blend deinterlacing filter that deinterlaces the given block by
  9661. filtering all lines with a @code{(1 2 1)} filter.
  9662. @item li/linipoldeint
  9663. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9664. linearly interpolating every second line.
  9665. @item ci/cubicipoldeint
  9666. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9667. cubically interpolating every second line.
  9668. @item md/mediandeint
  9669. Median deinterlacing filter that deinterlaces the given block by applying a
  9670. median filter to every second line.
  9671. @item fd/ffmpegdeint
  9672. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9673. second line with a @code{(-1 4 2 4 -1)} filter.
  9674. @item l5/lowpass5
  9675. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9676. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9677. @item fq/forceQuant[|quantizer]
  9678. Overrides the quantizer table from the input with the constant quantizer you
  9679. specify.
  9680. @table @option
  9681. @item quantizer
  9682. Quantizer to use
  9683. @end table
  9684. @item de/default
  9685. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9686. @item fa/fast
  9687. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9688. @item ac
  9689. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9690. @end table
  9691. @subsection Examples
  9692. @itemize
  9693. @item
  9694. Apply horizontal and vertical deblocking, deringing and automatic
  9695. brightness/contrast:
  9696. @example
  9697. pp=hb/vb/dr/al
  9698. @end example
  9699. @item
  9700. Apply default filters without brightness/contrast correction:
  9701. @example
  9702. pp=de/-al
  9703. @end example
  9704. @item
  9705. Apply default filters and temporal denoiser:
  9706. @example
  9707. pp=default/tmpnoise|1|2|3
  9708. @end example
  9709. @item
  9710. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9711. automatically depending on available CPU time:
  9712. @example
  9713. pp=hb|y/vb|a
  9714. @end example
  9715. @end itemize
  9716. @section pp7
  9717. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9718. similar to spp = 6 with 7 point DCT, where only the center sample is
  9719. used after IDCT.
  9720. The filter accepts the following options:
  9721. @table @option
  9722. @item qp
  9723. Force a constant quantization parameter. It accepts an integer in range
  9724. 0 to 63. If not set, the filter will use the QP from the video stream
  9725. (if available).
  9726. @item mode
  9727. Set thresholding mode. Available modes are:
  9728. @table @samp
  9729. @item hard
  9730. Set hard thresholding.
  9731. @item soft
  9732. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9733. @item medium
  9734. Set medium thresholding (good results, default).
  9735. @end table
  9736. @end table
  9737. @section premultiply
  9738. Apply alpha premultiply effect to input video stream using first plane
  9739. of second stream as alpha.
  9740. Both streams must have same dimensions and same pixel format.
  9741. The filter accepts the following option:
  9742. @table @option
  9743. @item planes
  9744. Set which planes will be processed, unprocessed planes will be copied.
  9745. By default value 0xf, all planes will be processed.
  9746. @item inplace
  9747. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9748. @end table
  9749. @section prewitt
  9750. Apply prewitt operator to input video stream.
  9751. The filter accepts the following option:
  9752. @table @option
  9753. @item planes
  9754. Set which planes will be processed, unprocessed planes will be copied.
  9755. By default value 0xf, all planes will be processed.
  9756. @item scale
  9757. Set value which will be multiplied with filtered result.
  9758. @item delta
  9759. Set value which will be added to filtered result.
  9760. @end table
  9761. @anchor{program_opencl}
  9762. @section program_opencl
  9763. Filter video using an OpenCL program.
  9764. @table @option
  9765. @item source
  9766. OpenCL program source file.
  9767. @item kernel
  9768. Kernel name in program.
  9769. @item inputs
  9770. Number of inputs to the filter. Defaults to 1.
  9771. @item size, s
  9772. Size of output frames. Defaults to the same as the first input.
  9773. @end table
  9774. The program source file must contain a kernel function with the given name,
  9775. which will be run once for each plane of the output. Each run on a plane
  9776. gets enqueued as a separate 2D global NDRange with one work-item for each
  9777. pixel to be generated. The global ID offset for each work-item is therefore
  9778. the coordinates of a pixel in the destination image.
  9779. The kernel function needs to take the following arguments:
  9780. @itemize
  9781. @item
  9782. Destination image, @var{__write_only image2d_t}.
  9783. This image will become the output; the kernel should write all of it.
  9784. @item
  9785. Frame index, @var{unsigned int}.
  9786. This is a counter starting from zero and increasing by one for each frame.
  9787. @item
  9788. Source images, @var{__read_only image2d_t}.
  9789. These are the most recent images on each input. The kernel may read from
  9790. them to generate the output, but they can't be written to.
  9791. @end itemize
  9792. Example programs:
  9793. @itemize
  9794. @item
  9795. Copy the input to the output (output must be the same size as the input).
  9796. @verbatim
  9797. __kernel void copy(__write_only image2d_t destination,
  9798. unsigned int index,
  9799. __read_only image2d_t source)
  9800. {
  9801. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9802. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9803. float4 value = read_imagef(source, sampler, location);
  9804. write_imagef(destination, location, value);
  9805. }
  9806. @end verbatim
  9807. @item
  9808. Apply a simple transformation, rotating the input by an amount increasing
  9809. with the index counter. Pixel values are linearly interpolated by the
  9810. sampler, and the output need not have the same dimensions as the input.
  9811. @verbatim
  9812. __kernel void rotate_image(__write_only image2d_t dst,
  9813. unsigned int index,
  9814. __read_only image2d_t src)
  9815. {
  9816. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9817. CLK_FILTER_LINEAR);
  9818. float angle = (float)index / 100.0f;
  9819. float2 dst_dim = convert_float2(get_image_dim(dst));
  9820. float2 src_dim = convert_float2(get_image_dim(src));
  9821. float2 dst_cen = dst_dim / 2.0f;
  9822. float2 src_cen = src_dim / 2.0f;
  9823. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9824. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9825. float2 src_pos = {
  9826. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9827. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9828. };
  9829. src_pos = src_pos * src_dim / dst_dim;
  9830. float2 src_loc = src_pos + src_cen;
  9831. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9832. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9833. write_imagef(dst, dst_loc, 0.5f);
  9834. else
  9835. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9836. }
  9837. @end verbatim
  9838. @item
  9839. Blend two inputs together, with the amount of each input used varying
  9840. with the index counter.
  9841. @verbatim
  9842. __kernel void blend_images(__write_only image2d_t dst,
  9843. unsigned int index,
  9844. __read_only image2d_t src1,
  9845. __read_only image2d_t src2)
  9846. {
  9847. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9848. CLK_FILTER_LINEAR);
  9849. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9850. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9851. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9852. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9853. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9854. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9855. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9856. }
  9857. @end verbatim
  9858. @end itemize
  9859. @section pseudocolor
  9860. Alter frame colors in video with pseudocolors.
  9861. This filter accept the following options:
  9862. @table @option
  9863. @item c0
  9864. set pixel first component expression
  9865. @item c1
  9866. set pixel second component expression
  9867. @item c2
  9868. set pixel third component expression
  9869. @item c3
  9870. set pixel fourth component expression, corresponds to the alpha component
  9871. @item i
  9872. set component to use as base for altering colors
  9873. @end table
  9874. Each of them specifies the expression to use for computing the lookup table for
  9875. the corresponding pixel component values.
  9876. The expressions can contain the following constants and functions:
  9877. @table @option
  9878. @item w
  9879. @item h
  9880. The input width and height.
  9881. @item val
  9882. The input value for the pixel component.
  9883. @item ymin, umin, vmin, amin
  9884. The minimum allowed component value.
  9885. @item ymax, umax, vmax, amax
  9886. The maximum allowed component value.
  9887. @end table
  9888. All expressions default to "val".
  9889. @subsection Examples
  9890. @itemize
  9891. @item
  9892. Change too high luma values to gradient:
  9893. @example
  9894. 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'"
  9895. @end example
  9896. @end itemize
  9897. @section psnr
  9898. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9899. Ratio) between two input videos.
  9900. This filter takes in input two input videos, the first input is
  9901. considered the "main" source and is passed unchanged to the
  9902. output. The second input is used as a "reference" video for computing
  9903. the PSNR.
  9904. Both video inputs must have the same resolution and pixel format for
  9905. this filter to work correctly. Also it assumes that both inputs
  9906. have the same number of frames, which are compared one by one.
  9907. The obtained average PSNR is printed through the logging system.
  9908. The filter stores the accumulated MSE (mean squared error) of each
  9909. frame, and at the end of the processing it is averaged across all frames
  9910. equally, and the following formula is applied to obtain the PSNR:
  9911. @example
  9912. PSNR = 10*log10(MAX^2/MSE)
  9913. @end example
  9914. Where MAX is the average of the maximum values of each component of the
  9915. image.
  9916. The description of the accepted parameters follows.
  9917. @table @option
  9918. @item stats_file, f
  9919. If specified the filter will use the named file to save the PSNR of
  9920. each individual frame. When filename equals "-" the data is sent to
  9921. standard output.
  9922. @item stats_version
  9923. Specifies which version of the stats file format to use. Details of
  9924. each format are written below.
  9925. Default value is 1.
  9926. @item stats_add_max
  9927. Determines whether the max value is output to the stats log.
  9928. Default value is 0.
  9929. Requires stats_version >= 2. If this is set and stats_version < 2,
  9930. the filter will return an error.
  9931. @end table
  9932. This filter also supports the @ref{framesync} options.
  9933. The file printed if @var{stats_file} is selected, contains a sequence of
  9934. key/value pairs of the form @var{key}:@var{value} for each compared
  9935. couple of frames.
  9936. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9937. the list of per-frame-pair stats, with key value pairs following the frame
  9938. format with the following parameters:
  9939. @table @option
  9940. @item psnr_log_version
  9941. The version of the log file format. Will match @var{stats_version}.
  9942. @item fields
  9943. A comma separated list of the per-frame-pair parameters included in
  9944. the log.
  9945. @end table
  9946. A description of each shown per-frame-pair parameter follows:
  9947. @table @option
  9948. @item n
  9949. sequential number of the input frame, starting from 1
  9950. @item mse_avg
  9951. Mean Square Error pixel-by-pixel average difference of the compared
  9952. frames, averaged over all the image components.
  9953. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9954. Mean Square Error pixel-by-pixel average difference of the compared
  9955. frames for the component specified by the suffix.
  9956. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9957. Peak Signal to Noise ratio of the compared frames for the component
  9958. specified by the suffix.
  9959. @item max_avg, max_y, max_u, max_v
  9960. Maximum allowed value for each channel, and average over all
  9961. channels.
  9962. @end table
  9963. For example:
  9964. @example
  9965. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9966. [main][ref] psnr="stats_file=stats.log" [out]
  9967. @end example
  9968. On this example the input file being processed is compared with the
  9969. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9970. is stored in @file{stats.log}.
  9971. @anchor{pullup}
  9972. @section pullup
  9973. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9974. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9975. content.
  9976. The pullup filter is designed to take advantage of future context in making
  9977. its decisions. This filter is stateless in the sense that it does not lock
  9978. onto a pattern to follow, but it instead looks forward to the following
  9979. fields in order to identify matches and rebuild progressive frames.
  9980. To produce content with an even framerate, insert the fps filter after
  9981. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9982. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9983. The filter accepts the following options:
  9984. @table @option
  9985. @item jl
  9986. @item jr
  9987. @item jt
  9988. @item jb
  9989. These options set the amount of "junk" to ignore at the left, right, top, and
  9990. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9991. while top and bottom are in units of 2 lines.
  9992. The default is 8 pixels on each side.
  9993. @item sb
  9994. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9995. filter generating an occasional mismatched frame, but it may also cause an
  9996. excessive number of frames to be dropped during high motion sequences.
  9997. Conversely, setting it to -1 will make filter match fields more easily.
  9998. This may help processing of video where there is slight blurring between
  9999. the fields, but may also cause there to be interlaced frames in the output.
  10000. Default value is @code{0}.
  10001. @item mp
  10002. Set the metric plane to use. It accepts the following values:
  10003. @table @samp
  10004. @item l
  10005. Use luma plane.
  10006. @item u
  10007. Use chroma blue plane.
  10008. @item v
  10009. Use chroma red plane.
  10010. @end table
  10011. This option may be set to use chroma plane instead of the default luma plane
  10012. for doing filter's computations. This may improve accuracy on very clean
  10013. source material, but more likely will decrease accuracy, especially if there
  10014. is chroma noise (rainbow effect) or any grayscale video.
  10015. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10016. load and make pullup usable in realtime on slow machines.
  10017. @end table
  10018. For best results (without duplicated frames in the output file) it is
  10019. necessary to change the output frame rate. For example, to inverse
  10020. telecine NTSC input:
  10021. @example
  10022. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10023. @end example
  10024. @section qp
  10025. Change video quantization parameters (QP).
  10026. The filter accepts the following option:
  10027. @table @option
  10028. @item qp
  10029. Set expression for quantization parameter.
  10030. @end table
  10031. The expression is evaluated through the eval API and can contain, among others,
  10032. the following constants:
  10033. @table @var
  10034. @item known
  10035. 1 if index is not 129, 0 otherwise.
  10036. @item qp
  10037. Sequential index starting from -129 to 128.
  10038. @end table
  10039. @subsection Examples
  10040. @itemize
  10041. @item
  10042. Some equation like:
  10043. @example
  10044. qp=2+2*sin(PI*qp)
  10045. @end example
  10046. @end itemize
  10047. @section random
  10048. Flush video frames from internal cache of frames into a random order.
  10049. No frame is discarded.
  10050. Inspired by @ref{frei0r} nervous filter.
  10051. @table @option
  10052. @item frames
  10053. Set size in number of frames of internal cache, in range from @code{2} to
  10054. @code{512}. Default is @code{30}.
  10055. @item seed
  10056. Set seed for random number generator, must be an integer included between
  10057. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10058. less than @code{0}, the filter will try to use a good random seed on a
  10059. best effort basis.
  10060. @end table
  10061. @section readeia608
  10062. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10063. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10064. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10065. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10066. @table @option
  10067. @item lavfi.readeia608.X.cc
  10068. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10069. @item lavfi.readeia608.X.line
  10070. The number of the line on which the EIA-608 data was identified and read.
  10071. @end table
  10072. This filter accepts the following options:
  10073. @table @option
  10074. @item scan_min
  10075. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10076. @item scan_max
  10077. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10078. @item mac
  10079. Set minimal acceptable amplitude change for sync codes detection.
  10080. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10081. @item spw
  10082. Set the ratio of width reserved for sync code detection.
  10083. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10084. @item mhd
  10085. Set the max peaks height difference for sync code detection.
  10086. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10087. @item mpd
  10088. Set max peaks period difference for sync code detection.
  10089. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10090. @item msd
  10091. Set the first two max start code bits differences.
  10092. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10093. @item bhd
  10094. Set the minimum ratio of bits height compared to 3rd start code bit.
  10095. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10096. @item th_w
  10097. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10098. @item th_b
  10099. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10100. @item chp
  10101. Enable checking the parity bit. In the event of a parity error, the filter will output
  10102. @code{0x00} for that character. Default is false.
  10103. @end table
  10104. @subsection Examples
  10105. @itemize
  10106. @item
  10107. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10108. @example
  10109. 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
  10110. @end example
  10111. @end itemize
  10112. @section readvitc
  10113. Read vertical interval timecode (VITC) information from the top lines of a
  10114. video frame.
  10115. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10116. timecode value, if a valid timecode has been detected. Further metadata key
  10117. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10118. timecode data has been found or not.
  10119. This filter accepts the following options:
  10120. @table @option
  10121. @item scan_max
  10122. Set the maximum number of lines to scan for VITC data. If the value is set to
  10123. @code{-1} the full video frame is scanned. Default is @code{45}.
  10124. @item thr_b
  10125. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10126. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10127. @item thr_w
  10128. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10129. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10130. @end table
  10131. @subsection Examples
  10132. @itemize
  10133. @item
  10134. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10135. draw @code{--:--:--:--} as a placeholder:
  10136. @example
  10137. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10138. @end example
  10139. @end itemize
  10140. @section remap
  10141. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10142. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10143. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10144. value for pixel will be used for destination pixel.
  10145. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10146. will have Xmap/Ymap video stream dimensions.
  10147. Xmap and Ymap input video streams are 16bit depth, single channel.
  10148. @section removegrain
  10149. The removegrain filter is a spatial denoiser for progressive video.
  10150. @table @option
  10151. @item m0
  10152. Set mode for the first plane.
  10153. @item m1
  10154. Set mode for the second plane.
  10155. @item m2
  10156. Set mode for the third plane.
  10157. @item m3
  10158. Set mode for the fourth plane.
  10159. @end table
  10160. Range of mode is from 0 to 24. Description of each mode follows:
  10161. @table @var
  10162. @item 0
  10163. Leave input plane unchanged. Default.
  10164. @item 1
  10165. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10166. @item 2
  10167. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10168. @item 3
  10169. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10170. @item 4
  10171. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10172. This is equivalent to a median filter.
  10173. @item 5
  10174. Line-sensitive clipping giving the minimal change.
  10175. @item 6
  10176. Line-sensitive clipping, intermediate.
  10177. @item 7
  10178. Line-sensitive clipping, intermediate.
  10179. @item 8
  10180. Line-sensitive clipping, intermediate.
  10181. @item 9
  10182. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10183. @item 10
  10184. Replaces the target pixel with the closest neighbour.
  10185. @item 11
  10186. [1 2 1] horizontal and vertical kernel blur.
  10187. @item 12
  10188. Same as mode 11.
  10189. @item 13
  10190. Bob mode, interpolates top field from the line where the neighbours
  10191. pixels are the closest.
  10192. @item 14
  10193. Bob mode, interpolates bottom field from the line where the neighbours
  10194. pixels are the closest.
  10195. @item 15
  10196. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10197. interpolation formula.
  10198. @item 16
  10199. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10200. interpolation formula.
  10201. @item 17
  10202. Clips the pixel with the minimum and maximum of respectively the maximum and
  10203. minimum of each pair of opposite neighbour pixels.
  10204. @item 18
  10205. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10206. the current pixel is minimal.
  10207. @item 19
  10208. Replaces the pixel with the average of its 8 neighbours.
  10209. @item 20
  10210. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10211. @item 21
  10212. Clips pixels using the averages of opposite neighbour.
  10213. @item 22
  10214. Same as mode 21 but simpler and faster.
  10215. @item 23
  10216. Small edge and halo removal, but reputed useless.
  10217. @item 24
  10218. Similar as 23.
  10219. @end table
  10220. @section removelogo
  10221. Suppress a TV station logo, using an image file to determine which
  10222. pixels comprise the logo. It works by filling in the pixels that
  10223. comprise the logo with neighboring pixels.
  10224. The filter accepts the following options:
  10225. @table @option
  10226. @item filename, f
  10227. Set the filter bitmap file, which can be any image format supported by
  10228. libavformat. The width and height of the image file must match those of the
  10229. video stream being processed.
  10230. @end table
  10231. Pixels in the provided bitmap image with a value of zero are not
  10232. considered part of the logo, non-zero pixels are considered part of
  10233. the logo. If you use white (255) for the logo and black (0) for the
  10234. rest, you will be safe. For making the filter bitmap, it is
  10235. recommended to take a screen capture of a black frame with the logo
  10236. visible, and then using a threshold filter followed by the erode
  10237. filter once or twice.
  10238. If needed, little splotches can be fixed manually. Remember that if
  10239. logo pixels are not covered, the filter quality will be much
  10240. reduced. Marking too many pixels as part of the logo does not hurt as
  10241. much, but it will increase the amount of blurring needed to cover over
  10242. the image and will destroy more information than necessary, and extra
  10243. pixels will slow things down on a large logo.
  10244. @section repeatfields
  10245. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10246. fields based on its value.
  10247. @section reverse
  10248. Reverse a video clip.
  10249. Warning: This filter requires memory to buffer the entire clip, so trimming
  10250. is suggested.
  10251. @subsection Examples
  10252. @itemize
  10253. @item
  10254. Take the first 5 seconds of a clip, and reverse it.
  10255. @example
  10256. trim=end=5,reverse
  10257. @end example
  10258. @end itemize
  10259. @section roberts
  10260. Apply roberts cross operator to input video stream.
  10261. The filter accepts the following option:
  10262. @table @option
  10263. @item planes
  10264. Set which planes will be processed, unprocessed planes will be copied.
  10265. By default value 0xf, all planes will be processed.
  10266. @item scale
  10267. Set value which will be multiplied with filtered result.
  10268. @item delta
  10269. Set value which will be added to filtered result.
  10270. @end table
  10271. @section rotate
  10272. Rotate video by an arbitrary angle expressed in radians.
  10273. The filter accepts the following options:
  10274. A description of the optional parameters follows.
  10275. @table @option
  10276. @item angle, a
  10277. Set an expression for the angle by which to rotate the input video
  10278. clockwise, expressed as a number of radians. A negative value will
  10279. result in a counter-clockwise rotation. By default it is set to "0".
  10280. This expression is evaluated for each frame.
  10281. @item out_w, ow
  10282. Set the output width expression, default value is "iw".
  10283. This expression is evaluated just once during configuration.
  10284. @item out_h, oh
  10285. Set the output height expression, default value is "ih".
  10286. This expression is evaluated just once during configuration.
  10287. @item bilinear
  10288. Enable bilinear interpolation if set to 1, a value of 0 disables
  10289. it. Default value is 1.
  10290. @item fillcolor, c
  10291. Set the color used to fill the output area not covered by the rotated
  10292. image. For the general syntax of this option, check the
  10293. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10294. If the special value "none" is selected then no
  10295. background is printed (useful for example if the background is never shown).
  10296. Default value is "black".
  10297. @end table
  10298. The expressions for the angle and the output size can contain the
  10299. following constants and functions:
  10300. @table @option
  10301. @item n
  10302. sequential number of the input frame, starting from 0. It is always NAN
  10303. before the first frame is filtered.
  10304. @item t
  10305. time in seconds of the input frame, it is set to 0 when the filter is
  10306. configured. It is always NAN before the first frame is filtered.
  10307. @item hsub
  10308. @item vsub
  10309. horizontal and vertical chroma subsample values. For example for the
  10310. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10311. @item in_w, iw
  10312. @item in_h, ih
  10313. the input video width and height
  10314. @item out_w, ow
  10315. @item out_h, oh
  10316. the output width and height, that is the size of the padded area as
  10317. specified by the @var{width} and @var{height} expressions
  10318. @item rotw(a)
  10319. @item roth(a)
  10320. the minimal width/height required for completely containing the input
  10321. video rotated by @var{a} radians.
  10322. These are only available when computing the @option{out_w} and
  10323. @option{out_h} expressions.
  10324. @end table
  10325. @subsection Examples
  10326. @itemize
  10327. @item
  10328. Rotate the input by PI/6 radians clockwise:
  10329. @example
  10330. rotate=PI/6
  10331. @end example
  10332. @item
  10333. Rotate the input by PI/6 radians counter-clockwise:
  10334. @example
  10335. rotate=-PI/6
  10336. @end example
  10337. @item
  10338. Rotate the input by 45 degrees clockwise:
  10339. @example
  10340. rotate=45*PI/180
  10341. @end example
  10342. @item
  10343. Apply a constant rotation with period T, starting from an angle of PI/3:
  10344. @example
  10345. rotate=PI/3+2*PI*t/T
  10346. @end example
  10347. @item
  10348. Make the input video rotation oscillating with a period of T
  10349. seconds and an amplitude of A radians:
  10350. @example
  10351. rotate=A*sin(2*PI/T*t)
  10352. @end example
  10353. @item
  10354. Rotate the video, output size is chosen so that the whole rotating
  10355. input video is always completely contained in the output:
  10356. @example
  10357. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10358. @end example
  10359. @item
  10360. Rotate the video, reduce the output size so that no background is ever
  10361. shown:
  10362. @example
  10363. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10364. @end example
  10365. @end itemize
  10366. @subsection Commands
  10367. The filter supports the following commands:
  10368. @table @option
  10369. @item a, angle
  10370. Set the angle expression.
  10371. The command accepts the same syntax of the corresponding option.
  10372. If the specified expression is not valid, it is kept at its current
  10373. value.
  10374. @end table
  10375. @section sab
  10376. Apply Shape Adaptive Blur.
  10377. The filter accepts the following options:
  10378. @table @option
  10379. @item luma_radius, lr
  10380. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10381. value is 1.0. A greater value will result in a more blurred image, and
  10382. in slower processing.
  10383. @item luma_pre_filter_radius, lpfr
  10384. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10385. value is 1.0.
  10386. @item luma_strength, ls
  10387. Set luma maximum difference between pixels to still be considered, must
  10388. be a value in the 0.1-100.0 range, default value is 1.0.
  10389. @item chroma_radius, cr
  10390. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10391. greater value will result in a more blurred image, and in slower
  10392. processing.
  10393. @item chroma_pre_filter_radius, cpfr
  10394. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10395. @item chroma_strength, cs
  10396. Set chroma maximum difference between pixels to still be considered,
  10397. must be a value in the -0.9-100.0 range.
  10398. @end table
  10399. Each chroma option value, if not explicitly specified, is set to the
  10400. corresponding luma option value.
  10401. @anchor{scale}
  10402. @section scale
  10403. Scale (resize) the input video, using the libswscale library.
  10404. The scale filter forces the output display aspect ratio to be the same
  10405. of the input, by changing the output sample aspect ratio.
  10406. If the input image format is different from the format requested by
  10407. the next filter, the scale filter will convert the input to the
  10408. requested format.
  10409. @subsection Options
  10410. The filter accepts the following options, or any of the options
  10411. supported by the libswscale scaler.
  10412. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10413. the complete list of scaler options.
  10414. @table @option
  10415. @item width, w
  10416. @item height, h
  10417. Set the output video dimension expression. Default value is the input
  10418. dimension.
  10419. If the @var{width} or @var{w} value is 0, the input width is used for
  10420. the output. If the @var{height} or @var{h} value is 0, the input height
  10421. is used for the output.
  10422. If one and only one of the values is -n with n >= 1, the scale filter
  10423. will use a value that maintains the aspect ratio of the input image,
  10424. calculated from the other specified dimension. After that it will,
  10425. however, make sure that the calculated dimension is divisible by n and
  10426. adjust the value if necessary.
  10427. If both values are -n with n >= 1, the behavior will be identical to
  10428. both values being set to 0 as previously detailed.
  10429. See below for the list of accepted constants for use in the dimension
  10430. expression.
  10431. @item eval
  10432. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10433. @table @samp
  10434. @item init
  10435. Only evaluate expressions once during the filter initialization or when a command is processed.
  10436. @item frame
  10437. Evaluate expressions for each incoming frame.
  10438. @end table
  10439. Default value is @samp{init}.
  10440. @item interl
  10441. Set the interlacing mode. It accepts the following values:
  10442. @table @samp
  10443. @item 1
  10444. Force interlaced aware scaling.
  10445. @item 0
  10446. Do not apply interlaced scaling.
  10447. @item -1
  10448. Select interlaced aware scaling depending on whether the source frames
  10449. are flagged as interlaced or not.
  10450. @end table
  10451. Default value is @samp{0}.
  10452. @item flags
  10453. Set libswscale scaling flags. See
  10454. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10455. complete list of values. If not explicitly specified the filter applies
  10456. the default flags.
  10457. @item param0, param1
  10458. Set libswscale input parameters for scaling algorithms that need them. See
  10459. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10460. complete documentation. If not explicitly specified the filter applies
  10461. empty parameters.
  10462. @item size, s
  10463. Set the video size. For the syntax of this option, check the
  10464. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10465. @item in_color_matrix
  10466. @item out_color_matrix
  10467. Set in/output YCbCr color space type.
  10468. This allows the autodetected value to be overridden as well as allows forcing
  10469. a specific value used for the output and encoder.
  10470. If not specified, the color space type depends on the pixel format.
  10471. Possible values:
  10472. @table @samp
  10473. @item auto
  10474. Choose automatically.
  10475. @item bt709
  10476. Format conforming to International Telecommunication Union (ITU)
  10477. Recommendation BT.709.
  10478. @item fcc
  10479. Set color space conforming to the United States Federal Communications
  10480. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10481. @item bt601
  10482. Set color space conforming to:
  10483. @itemize
  10484. @item
  10485. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10486. @item
  10487. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10488. @item
  10489. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10490. @end itemize
  10491. @item smpte240m
  10492. Set color space conforming to SMPTE ST 240:1999.
  10493. @end table
  10494. @item in_range
  10495. @item out_range
  10496. Set in/output YCbCr sample range.
  10497. This allows the autodetected value to be overridden as well as allows forcing
  10498. a specific value used for the output and encoder. If not specified, the
  10499. range depends on the pixel format. Possible values:
  10500. @table @samp
  10501. @item auto/unknown
  10502. Choose automatically.
  10503. @item jpeg/full/pc
  10504. Set full range (0-255 in case of 8-bit luma).
  10505. @item mpeg/limited/tv
  10506. Set "MPEG" range (16-235 in case of 8-bit luma).
  10507. @end table
  10508. @item force_original_aspect_ratio
  10509. Enable decreasing or increasing output video width or height if necessary to
  10510. keep the original aspect ratio. Possible values:
  10511. @table @samp
  10512. @item disable
  10513. Scale the video as specified and disable this feature.
  10514. @item decrease
  10515. The output video dimensions will automatically be decreased if needed.
  10516. @item increase
  10517. The output video dimensions will automatically be increased if needed.
  10518. @end table
  10519. One useful instance of this option is that when you know a specific device's
  10520. maximum allowed resolution, you can use this to limit the output video to
  10521. that, while retaining the aspect ratio. For example, device A allows
  10522. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10523. decrease) and specifying 1280x720 to the command line makes the output
  10524. 1280x533.
  10525. Please note that this is a different thing than specifying -1 for @option{w}
  10526. or @option{h}, you still need to specify the output resolution for this option
  10527. to work.
  10528. @end table
  10529. The values of the @option{w} and @option{h} options are expressions
  10530. containing the following constants:
  10531. @table @var
  10532. @item in_w
  10533. @item in_h
  10534. The input width and height
  10535. @item iw
  10536. @item ih
  10537. These are the same as @var{in_w} and @var{in_h}.
  10538. @item out_w
  10539. @item out_h
  10540. The output (scaled) width and height
  10541. @item ow
  10542. @item oh
  10543. These are the same as @var{out_w} and @var{out_h}
  10544. @item a
  10545. The same as @var{iw} / @var{ih}
  10546. @item sar
  10547. input sample aspect ratio
  10548. @item dar
  10549. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10550. @item hsub
  10551. @item vsub
  10552. horizontal and vertical input chroma subsample values. For example for the
  10553. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10554. @item ohsub
  10555. @item ovsub
  10556. horizontal and vertical output chroma subsample values. For example for the
  10557. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10558. @end table
  10559. @subsection Examples
  10560. @itemize
  10561. @item
  10562. Scale the input video to a size of 200x100
  10563. @example
  10564. scale=w=200:h=100
  10565. @end example
  10566. This is equivalent to:
  10567. @example
  10568. scale=200:100
  10569. @end example
  10570. or:
  10571. @example
  10572. scale=200x100
  10573. @end example
  10574. @item
  10575. Specify a size abbreviation for the output size:
  10576. @example
  10577. scale=qcif
  10578. @end example
  10579. which can also be written as:
  10580. @example
  10581. scale=size=qcif
  10582. @end example
  10583. @item
  10584. Scale the input to 2x:
  10585. @example
  10586. scale=w=2*iw:h=2*ih
  10587. @end example
  10588. @item
  10589. The above is the same as:
  10590. @example
  10591. scale=2*in_w:2*in_h
  10592. @end example
  10593. @item
  10594. Scale the input to 2x with forced interlaced scaling:
  10595. @example
  10596. scale=2*iw:2*ih:interl=1
  10597. @end example
  10598. @item
  10599. Scale the input to half size:
  10600. @example
  10601. scale=w=iw/2:h=ih/2
  10602. @end example
  10603. @item
  10604. Increase the width, and set the height to the same size:
  10605. @example
  10606. scale=3/2*iw:ow
  10607. @end example
  10608. @item
  10609. Seek Greek harmony:
  10610. @example
  10611. scale=iw:1/PHI*iw
  10612. scale=ih*PHI:ih
  10613. @end example
  10614. @item
  10615. Increase the height, and set the width to 3/2 of the height:
  10616. @example
  10617. scale=w=3/2*oh:h=3/5*ih
  10618. @end example
  10619. @item
  10620. Increase the size, making the size a multiple of the chroma
  10621. subsample values:
  10622. @example
  10623. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10624. @end example
  10625. @item
  10626. Increase the width to a maximum of 500 pixels,
  10627. keeping the same aspect ratio as the input:
  10628. @example
  10629. scale=w='min(500\, iw*3/2):h=-1'
  10630. @end example
  10631. @item
  10632. Make pixels square by combining scale and setsar:
  10633. @example
  10634. scale='trunc(ih*dar):ih',setsar=1/1
  10635. @end example
  10636. @item
  10637. Make pixels square by combining scale and setsar,
  10638. making sure the resulting resolution is even (required by some codecs):
  10639. @example
  10640. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10641. @end example
  10642. @end itemize
  10643. @subsection Commands
  10644. This filter supports the following commands:
  10645. @table @option
  10646. @item width, w
  10647. @item height, h
  10648. Set the output video dimension expression.
  10649. The command accepts the same syntax of the corresponding option.
  10650. If the specified expression is not valid, it is kept at its current
  10651. value.
  10652. @end table
  10653. @section scale_npp
  10654. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10655. format conversion on CUDA video frames. Setting the output width and height
  10656. works in the same way as for the @var{scale} filter.
  10657. The following additional options are accepted:
  10658. @table @option
  10659. @item format
  10660. The pixel format of the output CUDA frames. If set to the string "same" (the
  10661. default), the input format will be kept. Note that automatic format negotiation
  10662. and conversion is not yet supported for hardware frames
  10663. @item interp_algo
  10664. The interpolation algorithm used for resizing. One of the following:
  10665. @table @option
  10666. @item nn
  10667. Nearest neighbour.
  10668. @item linear
  10669. @item cubic
  10670. @item cubic2p_bspline
  10671. 2-parameter cubic (B=1, C=0)
  10672. @item cubic2p_catmullrom
  10673. 2-parameter cubic (B=0, C=1/2)
  10674. @item cubic2p_b05c03
  10675. 2-parameter cubic (B=1/2, C=3/10)
  10676. @item super
  10677. Supersampling
  10678. @item lanczos
  10679. @end table
  10680. @end table
  10681. @section scale2ref
  10682. Scale (resize) the input video, based on a reference video.
  10683. See the scale filter for available options, scale2ref supports the same but
  10684. uses the reference video instead of the main input as basis. scale2ref also
  10685. supports the following additional constants for the @option{w} and
  10686. @option{h} options:
  10687. @table @var
  10688. @item main_w
  10689. @item main_h
  10690. The main input video's width and height
  10691. @item main_a
  10692. The same as @var{main_w} / @var{main_h}
  10693. @item main_sar
  10694. The main input video's sample aspect ratio
  10695. @item main_dar, mdar
  10696. The main input video's display aspect ratio. Calculated from
  10697. @code{(main_w / main_h) * main_sar}.
  10698. @item main_hsub
  10699. @item main_vsub
  10700. The main input video's horizontal and vertical chroma subsample values.
  10701. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10702. is 1.
  10703. @end table
  10704. @subsection Examples
  10705. @itemize
  10706. @item
  10707. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10708. @example
  10709. 'scale2ref[b][a];[a][b]overlay'
  10710. @end example
  10711. @end itemize
  10712. @anchor{selectivecolor}
  10713. @section selectivecolor
  10714. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10715. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10716. by the "purity" of the color (that is, how saturated it already is).
  10717. This filter is similar to the Adobe Photoshop Selective Color tool.
  10718. The filter accepts the following options:
  10719. @table @option
  10720. @item correction_method
  10721. Select color correction method.
  10722. Available values are:
  10723. @table @samp
  10724. @item absolute
  10725. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10726. component value).
  10727. @item relative
  10728. Specified adjustments are relative to the original component value.
  10729. @end table
  10730. Default is @code{absolute}.
  10731. @item reds
  10732. Adjustments for red pixels (pixels where the red component is the maximum)
  10733. @item yellows
  10734. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10735. @item greens
  10736. Adjustments for green pixels (pixels where the green component is the maximum)
  10737. @item cyans
  10738. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10739. @item blues
  10740. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10741. @item magentas
  10742. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10743. @item whites
  10744. Adjustments for white pixels (pixels where all components are greater than 128)
  10745. @item neutrals
  10746. Adjustments for all pixels except pure black and pure white
  10747. @item blacks
  10748. Adjustments for black pixels (pixels where all components are lesser than 128)
  10749. @item psfile
  10750. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10751. @end table
  10752. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10753. 4 space separated floating point adjustment values in the [-1,1] range,
  10754. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10755. pixels of its range.
  10756. @subsection Examples
  10757. @itemize
  10758. @item
  10759. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10760. increase magenta by 27% in blue areas:
  10761. @example
  10762. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10763. @end example
  10764. @item
  10765. Use a Photoshop selective color preset:
  10766. @example
  10767. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10768. @end example
  10769. @end itemize
  10770. @anchor{separatefields}
  10771. @section separatefields
  10772. The @code{separatefields} takes a frame-based video input and splits
  10773. each frame into its components fields, producing a new half height clip
  10774. with twice the frame rate and twice the frame count.
  10775. This filter use field-dominance information in frame to decide which
  10776. of each pair of fields to place first in the output.
  10777. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10778. @section setdar, setsar
  10779. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10780. output video.
  10781. This is done by changing the specified Sample (aka Pixel) Aspect
  10782. Ratio, according to the following equation:
  10783. @example
  10784. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10785. @end example
  10786. Keep in mind that the @code{setdar} filter does not modify the pixel
  10787. dimensions of the video frame. Also, the display aspect ratio set by
  10788. this filter may be changed by later filters in the filterchain,
  10789. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10790. applied.
  10791. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10792. the filter output video.
  10793. Note that as a consequence of the application of this filter, the
  10794. output display aspect ratio will change according to the equation
  10795. above.
  10796. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10797. filter may be changed by later filters in the filterchain, e.g. if
  10798. another "setsar" or a "setdar" filter is applied.
  10799. It accepts the following parameters:
  10800. @table @option
  10801. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10802. Set the aspect ratio used by the filter.
  10803. The parameter can be a floating point number string, an expression, or
  10804. a string of the form @var{num}:@var{den}, where @var{num} and
  10805. @var{den} are the numerator and denominator of the aspect ratio. If
  10806. the parameter is not specified, it is assumed the value "0".
  10807. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10808. should be escaped.
  10809. @item max
  10810. Set the maximum integer value to use for expressing numerator and
  10811. denominator when reducing the expressed aspect ratio to a rational.
  10812. Default value is @code{100}.
  10813. @end table
  10814. The parameter @var{sar} is an expression containing
  10815. the following constants:
  10816. @table @option
  10817. @item E, PI, PHI
  10818. These are approximated values for the mathematical constants e
  10819. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10820. @item w, h
  10821. The input width and height.
  10822. @item a
  10823. These are the same as @var{w} / @var{h}.
  10824. @item sar
  10825. The input sample aspect ratio.
  10826. @item dar
  10827. The input display aspect ratio. It is the same as
  10828. (@var{w} / @var{h}) * @var{sar}.
  10829. @item hsub, vsub
  10830. Horizontal and vertical chroma subsample values. For example, for the
  10831. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10832. @end table
  10833. @subsection Examples
  10834. @itemize
  10835. @item
  10836. To change the display aspect ratio to 16:9, specify one of the following:
  10837. @example
  10838. setdar=dar=1.77777
  10839. setdar=dar=16/9
  10840. @end example
  10841. @item
  10842. To change the sample aspect ratio to 10:11, specify:
  10843. @example
  10844. setsar=sar=10/11
  10845. @end example
  10846. @item
  10847. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10848. 1000 in the aspect ratio reduction, use the command:
  10849. @example
  10850. setdar=ratio=16/9:max=1000
  10851. @end example
  10852. @end itemize
  10853. @anchor{setfield}
  10854. @section setfield
  10855. Force field for the output video frame.
  10856. The @code{setfield} filter marks the interlace type field for the
  10857. output frames. It does not change the input frame, but only sets the
  10858. corresponding property, which affects how the frame is treated by
  10859. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10860. The filter accepts the following options:
  10861. @table @option
  10862. @item mode
  10863. Available values are:
  10864. @table @samp
  10865. @item auto
  10866. Keep the same field property.
  10867. @item bff
  10868. Mark the frame as bottom-field-first.
  10869. @item tff
  10870. Mark the frame as top-field-first.
  10871. @item prog
  10872. Mark the frame as progressive.
  10873. @end table
  10874. @end table
  10875. @section showinfo
  10876. Show a line containing various information for each input video frame.
  10877. The input video is not modified.
  10878. The shown line contains a sequence of key/value pairs of the form
  10879. @var{key}:@var{value}.
  10880. The following values are shown in the output:
  10881. @table @option
  10882. @item n
  10883. The (sequential) number of the input frame, starting from 0.
  10884. @item pts
  10885. The Presentation TimeStamp of the input frame, expressed as a number of
  10886. time base units. The time base unit depends on the filter input pad.
  10887. @item pts_time
  10888. The Presentation TimeStamp of the input frame, expressed as a number of
  10889. seconds.
  10890. @item pos
  10891. The position of the frame in the input stream, or -1 if this information is
  10892. unavailable and/or meaningless (for example in case of synthetic video).
  10893. @item fmt
  10894. The pixel format name.
  10895. @item sar
  10896. The sample aspect ratio of the input frame, expressed in the form
  10897. @var{num}/@var{den}.
  10898. @item s
  10899. The size of the input frame. For the syntax of this option, check the
  10900. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10901. @item i
  10902. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10903. for bottom field first).
  10904. @item iskey
  10905. This is 1 if the frame is a key frame, 0 otherwise.
  10906. @item type
  10907. The picture type of the input frame ("I" for an I-frame, "P" for a
  10908. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10909. Also refer to the documentation of the @code{AVPictureType} enum and of
  10910. the @code{av_get_picture_type_char} function defined in
  10911. @file{libavutil/avutil.h}.
  10912. @item checksum
  10913. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10914. @item plane_checksum
  10915. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10916. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10917. @end table
  10918. @section showpalette
  10919. Displays the 256 colors palette of each frame. This filter is only relevant for
  10920. @var{pal8} pixel format frames.
  10921. It accepts the following option:
  10922. @table @option
  10923. @item s
  10924. Set the size of the box used to represent one palette color entry. Default is
  10925. @code{30} (for a @code{30x30} pixel box).
  10926. @end table
  10927. @section shuffleframes
  10928. Reorder and/or duplicate and/or drop video frames.
  10929. It accepts the following parameters:
  10930. @table @option
  10931. @item mapping
  10932. Set the destination indexes of input frames.
  10933. This is space or '|' separated list of indexes that maps input frames to output
  10934. frames. Number of indexes also sets maximal value that each index may have.
  10935. '-1' index have special meaning and that is to drop frame.
  10936. @end table
  10937. The first frame has the index 0. The default is to keep the input unchanged.
  10938. @subsection Examples
  10939. @itemize
  10940. @item
  10941. Swap second and third frame of every three frames of the input:
  10942. @example
  10943. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10944. @end example
  10945. @item
  10946. Swap 10th and 1st frame of every ten frames of the input:
  10947. @example
  10948. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10949. @end example
  10950. @end itemize
  10951. @section shuffleplanes
  10952. Reorder and/or duplicate video planes.
  10953. It accepts the following parameters:
  10954. @table @option
  10955. @item map0
  10956. The index of the input plane to be used as the first output plane.
  10957. @item map1
  10958. The index of the input plane to be used as the second output plane.
  10959. @item map2
  10960. The index of the input plane to be used as the third output plane.
  10961. @item map3
  10962. The index of the input plane to be used as the fourth output plane.
  10963. @end table
  10964. The first plane has the index 0. The default is to keep the input unchanged.
  10965. @subsection Examples
  10966. @itemize
  10967. @item
  10968. Swap the second and third planes of the input:
  10969. @example
  10970. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10971. @end example
  10972. @end itemize
  10973. @anchor{signalstats}
  10974. @section signalstats
  10975. Evaluate various visual metrics that assist in determining issues associated
  10976. with the digitization of analog video media.
  10977. By default the filter will log these metadata values:
  10978. @table @option
  10979. @item YMIN
  10980. Display the minimal Y value contained within the input frame. Expressed in
  10981. range of [0-255].
  10982. @item YLOW
  10983. Display the Y value at the 10% percentile within the input frame. Expressed in
  10984. range of [0-255].
  10985. @item YAVG
  10986. Display the average Y value within the input frame. Expressed in range of
  10987. [0-255].
  10988. @item YHIGH
  10989. Display the Y value at the 90% percentile within the input frame. Expressed in
  10990. range of [0-255].
  10991. @item YMAX
  10992. Display the maximum Y value contained within the input frame. Expressed in
  10993. range of [0-255].
  10994. @item UMIN
  10995. Display the minimal U value contained within the input frame. Expressed in
  10996. range of [0-255].
  10997. @item ULOW
  10998. Display the U value at the 10% percentile within the input frame. Expressed in
  10999. range of [0-255].
  11000. @item UAVG
  11001. Display the average U value within the input frame. Expressed in range of
  11002. [0-255].
  11003. @item UHIGH
  11004. Display the U value at the 90% percentile within the input frame. Expressed in
  11005. range of [0-255].
  11006. @item UMAX
  11007. Display the maximum U value contained within the input frame. Expressed in
  11008. range of [0-255].
  11009. @item VMIN
  11010. Display the minimal V value contained within the input frame. Expressed in
  11011. range of [0-255].
  11012. @item VLOW
  11013. Display the V value at the 10% percentile within the input frame. Expressed in
  11014. range of [0-255].
  11015. @item VAVG
  11016. Display the average V value within the input frame. Expressed in range of
  11017. [0-255].
  11018. @item VHIGH
  11019. Display the V value at the 90% percentile within the input frame. Expressed in
  11020. range of [0-255].
  11021. @item VMAX
  11022. Display the maximum V value contained within the input frame. Expressed in
  11023. range of [0-255].
  11024. @item SATMIN
  11025. Display the minimal saturation value contained within the input frame.
  11026. Expressed in range of [0-~181.02].
  11027. @item SATLOW
  11028. Display the saturation value at the 10% percentile within the input frame.
  11029. Expressed in range of [0-~181.02].
  11030. @item SATAVG
  11031. Display the average saturation value within the input frame. Expressed in range
  11032. of [0-~181.02].
  11033. @item SATHIGH
  11034. Display the saturation value at the 90% percentile within the input frame.
  11035. Expressed in range of [0-~181.02].
  11036. @item SATMAX
  11037. Display the maximum saturation value contained within the input frame.
  11038. Expressed in range of [0-~181.02].
  11039. @item HUEMED
  11040. Display the median value for hue within the input frame. Expressed in range of
  11041. [0-360].
  11042. @item HUEAVG
  11043. Display the average value for hue within the input frame. Expressed in range of
  11044. [0-360].
  11045. @item YDIF
  11046. Display the average of sample value difference between all values of the Y
  11047. plane in the current frame and corresponding values of the previous input frame.
  11048. Expressed in range of [0-255].
  11049. @item UDIF
  11050. Display the average of sample value difference between all values of the U
  11051. plane in the current frame and corresponding values of the previous input frame.
  11052. Expressed in range of [0-255].
  11053. @item VDIF
  11054. Display the average of sample value difference between all values of the V
  11055. plane in the current frame and corresponding values of the previous input frame.
  11056. Expressed in range of [0-255].
  11057. @item YBITDEPTH
  11058. Display bit depth of Y plane in current frame.
  11059. Expressed in range of [0-16].
  11060. @item UBITDEPTH
  11061. Display bit depth of U plane in current frame.
  11062. Expressed in range of [0-16].
  11063. @item VBITDEPTH
  11064. Display bit depth of V plane in current frame.
  11065. Expressed in range of [0-16].
  11066. @end table
  11067. The filter accepts the following options:
  11068. @table @option
  11069. @item stat
  11070. @item out
  11071. @option{stat} specify an additional form of image analysis.
  11072. @option{out} output video with the specified type of pixel highlighted.
  11073. Both options accept the following values:
  11074. @table @samp
  11075. @item tout
  11076. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11077. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11078. include the results of video dropouts, head clogs, or tape tracking issues.
  11079. @item vrep
  11080. Identify @var{vertical line repetition}. Vertical line repetition includes
  11081. similar rows of pixels within a frame. In born-digital video vertical line
  11082. repetition is common, but this pattern is uncommon in video digitized from an
  11083. analog source. When it occurs in video that results from the digitization of an
  11084. analog source it can indicate concealment from a dropout compensator.
  11085. @item brng
  11086. Identify pixels that fall outside of legal broadcast range.
  11087. @end table
  11088. @item color, c
  11089. Set the highlight color for the @option{out} option. The default color is
  11090. yellow.
  11091. @end table
  11092. @subsection Examples
  11093. @itemize
  11094. @item
  11095. Output data of various video metrics:
  11096. @example
  11097. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11098. @end example
  11099. @item
  11100. Output specific data about the minimum and maximum values of the Y plane per frame:
  11101. @example
  11102. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11103. @end example
  11104. @item
  11105. Playback video while highlighting pixels that are outside of broadcast range in red.
  11106. @example
  11107. ffplay example.mov -vf signalstats="out=brng:color=red"
  11108. @end example
  11109. @item
  11110. Playback video with signalstats metadata drawn over the frame.
  11111. @example
  11112. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11113. @end example
  11114. The contents of signalstat_drawtext.txt used in the command are:
  11115. @example
  11116. time %@{pts:hms@}
  11117. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11118. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11119. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11120. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11121. @end example
  11122. @end itemize
  11123. @anchor{signature}
  11124. @section signature
  11125. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11126. input. In this case the matching between the inputs can be calculated additionally.
  11127. The filter always passes through the first input. The signature of each stream can
  11128. be written into a file.
  11129. It accepts the following options:
  11130. @table @option
  11131. @item detectmode
  11132. Enable or disable the matching process.
  11133. Available values are:
  11134. @table @samp
  11135. @item off
  11136. Disable the calculation of a matching (default).
  11137. @item full
  11138. Calculate the matching for the whole video and output whether the whole video
  11139. matches or only parts.
  11140. @item fast
  11141. Calculate only until a matching is found or the video ends. Should be faster in
  11142. some cases.
  11143. @end table
  11144. @item nb_inputs
  11145. Set the number of inputs. The option value must be a non negative integer.
  11146. Default value is 1.
  11147. @item filename
  11148. Set the path to which the output is written. If there is more than one input,
  11149. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11150. integer), that will be replaced with the input number. If no filename is
  11151. specified, no output will be written. This is the default.
  11152. @item format
  11153. Choose the output format.
  11154. Available values are:
  11155. @table @samp
  11156. @item binary
  11157. Use the specified binary representation (default).
  11158. @item xml
  11159. Use the specified xml representation.
  11160. @end table
  11161. @item th_d
  11162. Set threshold to detect one word as similar. The option value must be an integer
  11163. greater than zero. The default value is 9000.
  11164. @item th_dc
  11165. Set threshold to detect all words as similar. The option value must be an integer
  11166. greater than zero. The default value is 60000.
  11167. @item th_xh
  11168. Set threshold to detect frames as similar. The option value must be an integer
  11169. greater than zero. The default value is 116.
  11170. @item th_di
  11171. Set the minimum length of a sequence in frames to recognize it as matching
  11172. sequence. The option value must be a non negative integer value.
  11173. The default value is 0.
  11174. @item th_it
  11175. Set the minimum relation, that matching frames to all frames must have.
  11176. The option value must be a double value between 0 and 1. The default value is 0.5.
  11177. @end table
  11178. @subsection Examples
  11179. @itemize
  11180. @item
  11181. To calculate the signature of an input video and store it in signature.bin:
  11182. @example
  11183. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11184. @end example
  11185. @item
  11186. To detect whether two videos match and store the signatures in XML format in
  11187. signature0.xml and signature1.xml:
  11188. @example
  11189. 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 -
  11190. @end example
  11191. @end itemize
  11192. @anchor{smartblur}
  11193. @section smartblur
  11194. Blur the input video without impacting the outlines.
  11195. It accepts the following options:
  11196. @table @option
  11197. @item luma_radius, lr
  11198. Set the luma radius. The option value must be a float number in
  11199. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11200. used to blur the image (slower if larger). Default value is 1.0.
  11201. @item luma_strength, ls
  11202. Set the luma strength. The option value must be a float number
  11203. in the range [-1.0,1.0] that configures the blurring. A value included
  11204. in [0.0,1.0] will blur the image whereas a value included in
  11205. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11206. @item luma_threshold, lt
  11207. Set the luma threshold used as a coefficient to determine
  11208. whether a pixel should be blurred or not. The option value must be an
  11209. integer in the range [-30,30]. A value of 0 will filter all the image,
  11210. a value included in [0,30] will filter flat areas and a value included
  11211. in [-30,0] will filter edges. Default value is 0.
  11212. @item chroma_radius, cr
  11213. Set the chroma radius. The option value must be a float number in
  11214. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11215. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11216. @item chroma_strength, cs
  11217. Set the chroma strength. The option value must be a float number
  11218. in the range [-1.0,1.0] that configures the blurring. A value included
  11219. in [0.0,1.0] will blur the image whereas a value included in
  11220. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11221. @item chroma_threshold, ct
  11222. Set the chroma threshold used as a coefficient to determine
  11223. whether a pixel should be blurred or not. The option value must be an
  11224. integer in the range [-30,30]. A value of 0 will filter all the image,
  11225. a value included in [0,30] will filter flat areas and a value included
  11226. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11227. @end table
  11228. If a chroma option is not explicitly set, the corresponding luma value
  11229. is set.
  11230. @section ssim
  11231. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11232. This filter takes in input two input videos, the first input is
  11233. considered the "main" source and is passed unchanged to the
  11234. output. The second input is used as a "reference" video for computing
  11235. the SSIM.
  11236. Both video inputs must have the same resolution and pixel format for
  11237. this filter to work correctly. Also it assumes that both inputs
  11238. have the same number of frames, which are compared one by one.
  11239. The filter stores the calculated SSIM of each frame.
  11240. The description of the accepted parameters follows.
  11241. @table @option
  11242. @item stats_file, f
  11243. If specified the filter will use the named file to save the SSIM of
  11244. each individual frame. When filename equals "-" the data is sent to
  11245. standard output.
  11246. @end table
  11247. The file printed if @var{stats_file} is selected, contains a sequence of
  11248. key/value pairs of the form @var{key}:@var{value} for each compared
  11249. couple of frames.
  11250. A description of each shown parameter follows:
  11251. @table @option
  11252. @item n
  11253. sequential number of the input frame, starting from 1
  11254. @item Y, U, V, R, G, B
  11255. SSIM of the compared frames for the component specified by the suffix.
  11256. @item All
  11257. SSIM of the compared frames for the whole frame.
  11258. @item dB
  11259. Same as above but in dB representation.
  11260. @end table
  11261. This filter also supports the @ref{framesync} options.
  11262. For example:
  11263. @example
  11264. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11265. [main][ref] ssim="stats_file=stats.log" [out]
  11266. @end example
  11267. On this example the input file being processed is compared with the
  11268. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11269. is stored in @file{stats.log}.
  11270. Another example with both psnr and ssim at same time:
  11271. @example
  11272. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11273. @end example
  11274. @section stereo3d
  11275. Convert between different stereoscopic image formats.
  11276. The filters accept the following options:
  11277. @table @option
  11278. @item in
  11279. Set stereoscopic image format of input.
  11280. Available values for input image formats are:
  11281. @table @samp
  11282. @item sbsl
  11283. side by side parallel (left eye left, right eye right)
  11284. @item sbsr
  11285. side by side crosseye (right eye left, left eye right)
  11286. @item sbs2l
  11287. side by side parallel with half width resolution
  11288. (left eye left, right eye right)
  11289. @item sbs2r
  11290. side by side crosseye with half width resolution
  11291. (right eye left, left eye right)
  11292. @item abl
  11293. above-below (left eye above, right eye below)
  11294. @item abr
  11295. above-below (right eye above, left eye below)
  11296. @item ab2l
  11297. above-below with half height resolution
  11298. (left eye above, right eye below)
  11299. @item ab2r
  11300. above-below with half height resolution
  11301. (right eye above, left eye below)
  11302. @item al
  11303. alternating frames (left eye first, right eye second)
  11304. @item ar
  11305. alternating frames (right eye first, left eye second)
  11306. @item irl
  11307. interleaved rows (left eye has top row, right eye starts on next row)
  11308. @item irr
  11309. interleaved rows (right eye has top row, left eye starts on next row)
  11310. @item icl
  11311. interleaved columns, left eye first
  11312. @item icr
  11313. interleaved columns, right eye first
  11314. Default value is @samp{sbsl}.
  11315. @end table
  11316. @item out
  11317. Set stereoscopic image format of output.
  11318. @table @samp
  11319. @item sbsl
  11320. side by side parallel (left eye left, right eye right)
  11321. @item sbsr
  11322. side by side crosseye (right eye left, left eye right)
  11323. @item sbs2l
  11324. side by side parallel with half width resolution
  11325. (left eye left, right eye right)
  11326. @item sbs2r
  11327. side by side crosseye with half width resolution
  11328. (right eye left, left eye right)
  11329. @item abl
  11330. above-below (left eye above, right eye below)
  11331. @item abr
  11332. above-below (right eye above, left eye below)
  11333. @item ab2l
  11334. above-below with half height resolution
  11335. (left eye above, right eye below)
  11336. @item ab2r
  11337. above-below with half height resolution
  11338. (right eye above, left eye below)
  11339. @item al
  11340. alternating frames (left eye first, right eye second)
  11341. @item ar
  11342. alternating frames (right eye first, left eye second)
  11343. @item irl
  11344. interleaved rows (left eye has top row, right eye starts on next row)
  11345. @item irr
  11346. interleaved rows (right eye has top row, left eye starts on next row)
  11347. @item arbg
  11348. anaglyph red/blue gray
  11349. (red filter on left eye, blue filter on right eye)
  11350. @item argg
  11351. anaglyph red/green gray
  11352. (red filter on left eye, green filter on right eye)
  11353. @item arcg
  11354. anaglyph red/cyan gray
  11355. (red filter on left eye, cyan filter on right eye)
  11356. @item arch
  11357. anaglyph red/cyan half colored
  11358. (red filter on left eye, cyan filter on right eye)
  11359. @item arcc
  11360. anaglyph red/cyan color
  11361. (red filter on left eye, cyan filter on right eye)
  11362. @item arcd
  11363. anaglyph red/cyan color optimized with the least squares projection of dubois
  11364. (red filter on left eye, cyan filter on right eye)
  11365. @item agmg
  11366. anaglyph green/magenta gray
  11367. (green filter on left eye, magenta filter on right eye)
  11368. @item agmh
  11369. anaglyph green/magenta half colored
  11370. (green filter on left eye, magenta filter on right eye)
  11371. @item agmc
  11372. anaglyph green/magenta colored
  11373. (green filter on left eye, magenta filter on right eye)
  11374. @item agmd
  11375. anaglyph green/magenta color optimized with the least squares projection of dubois
  11376. (green filter on left eye, magenta filter on right eye)
  11377. @item aybg
  11378. anaglyph yellow/blue gray
  11379. (yellow filter on left eye, blue filter on right eye)
  11380. @item aybh
  11381. anaglyph yellow/blue half colored
  11382. (yellow filter on left eye, blue filter on right eye)
  11383. @item aybc
  11384. anaglyph yellow/blue colored
  11385. (yellow filter on left eye, blue filter on right eye)
  11386. @item aybd
  11387. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11388. (yellow filter on left eye, blue filter on right eye)
  11389. @item ml
  11390. mono output (left eye only)
  11391. @item mr
  11392. mono output (right eye only)
  11393. @item chl
  11394. checkerboard, left eye first
  11395. @item chr
  11396. checkerboard, right eye first
  11397. @item icl
  11398. interleaved columns, left eye first
  11399. @item icr
  11400. interleaved columns, right eye first
  11401. @item hdmi
  11402. HDMI frame pack
  11403. @end table
  11404. Default value is @samp{arcd}.
  11405. @end table
  11406. @subsection Examples
  11407. @itemize
  11408. @item
  11409. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11410. @example
  11411. stereo3d=sbsl:aybd
  11412. @end example
  11413. @item
  11414. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11415. @example
  11416. stereo3d=abl:sbsr
  11417. @end example
  11418. @end itemize
  11419. @section streamselect, astreamselect
  11420. Select video or audio streams.
  11421. The filter accepts the following options:
  11422. @table @option
  11423. @item inputs
  11424. Set number of inputs. Default is 2.
  11425. @item map
  11426. Set input indexes to remap to outputs.
  11427. @end table
  11428. @subsection Commands
  11429. The @code{streamselect} and @code{astreamselect} filter supports the following
  11430. commands:
  11431. @table @option
  11432. @item map
  11433. Set input indexes to remap to outputs.
  11434. @end table
  11435. @subsection Examples
  11436. @itemize
  11437. @item
  11438. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11439. @example
  11440. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11441. @end example
  11442. @item
  11443. Same as above, but for audio:
  11444. @example
  11445. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11446. @end example
  11447. @end itemize
  11448. @section sobel
  11449. Apply sobel operator to input video stream.
  11450. The filter accepts the following option:
  11451. @table @option
  11452. @item planes
  11453. Set which planes will be processed, unprocessed planes will be copied.
  11454. By default value 0xf, all planes will be processed.
  11455. @item scale
  11456. Set value which will be multiplied with filtered result.
  11457. @item delta
  11458. Set value which will be added to filtered result.
  11459. @end table
  11460. @anchor{spp}
  11461. @section spp
  11462. Apply a simple postprocessing filter that compresses and decompresses the image
  11463. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11464. and average the results.
  11465. The filter accepts the following options:
  11466. @table @option
  11467. @item quality
  11468. Set quality. This option defines the number of levels for averaging. It accepts
  11469. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11470. effect. A value of @code{6} means the higher quality. For each increment of
  11471. that value the speed drops by a factor of approximately 2. Default value is
  11472. @code{3}.
  11473. @item qp
  11474. Force a constant quantization parameter. If not set, the filter will use the QP
  11475. from the video stream (if available).
  11476. @item mode
  11477. Set thresholding mode. Available modes are:
  11478. @table @samp
  11479. @item hard
  11480. Set hard thresholding (default).
  11481. @item soft
  11482. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11483. @end table
  11484. @item use_bframe_qp
  11485. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11486. option may cause flicker since the B-Frames have often larger QP. Default is
  11487. @code{0} (not enabled).
  11488. @end table
  11489. @anchor{subtitles}
  11490. @section subtitles
  11491. Draw subtitles on top of input video using the libass library.
  11492. To enable compilation of this filter you need to configure FFmpeg with
  11493. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11494. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11495. Alpha) subtitles format.
  11496. The filter accepts the following options:
  11497. @table @option
  11498. @item filename, f
  11499. Set the filename of the subtitle file to read. It must be specified.
  11500. @item original_size
  11501. Specify the size of the original video, the video for which the ASS file
  11502. was composed. For the syntax of this option, check the
  11503. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11504. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11505. correctly scale the fonts if the aspect ratio has been changed.
  11506. @item fontsdir
  11507. Set a directory path containing fonts that can be used by the filter.
  11508. These fonts will be used in addition to whatever the font provider uses.
  11509. @item alpha
  11510. Process alpha channel, by default alpha channel is untouched.
  11511. @item charenc
  11512. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11513. useful if not UTF-8.
  11514. @item stream_index, si
  11515. Set subtitles stream index. @code{subtitles} filter only.
  11516. @item force_style
  11517. Override default style or script info parameters of the subtitles. It accepts a
  11518. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11519. @end table
  11520. If the first key is not specified, it is assumed that the first value
  11521. specifies the @option{filename}.
  11522. For example, to render the file @file{sub.srt} on top of the input
  11523. video, use the command:
  11524. @example
  11525. subtitles=sub.srt
  11526. @end example
  11527. which is equivalent to:
  11528. @example
  11529. subtitles=filename=sub.srt
  11530. @end example
  11531. To render the default subtitles stream from file @file{video.mkv}, use:
  11532. @example
  11533. subtitles=video.mkv
  11534. @end example
  11535. To render the second subtitles stream from that file, use:
  11536. @example
  11537. subtitles=video.mkv:si=1
  11538. @end example
  11539. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11540. @code{DejaVu Serif}, use:
  11541. @example
  11542. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11543. @end example
  11544. @section super2xsai
  11545. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11546. Interpolate) pixel art scaling algorithm.
  11547. Useful for enlarging pixel art images without reducing sharpness.
  11548. @section swaprect
  11549. Swap two rectangular objects in video.
  11550. This filter accepts the following options:
  11551. @table @option
  11552. @item w
  11553. Set object width.
  11554. @item h
  11555. Set object height.
  11556. @item x1
  11557. Set 1st rect x coordinate.
  11558. @item y1
  11559. Set 1st rect y coordinate.
  11560. @item x2
  11561. Set 2nd rect x coordinate.
  11562. @item y2
  11563. Set 2nd rect y coordinate.
  11564. All expressions are evaluated once for each frame.
  11565. @end table
  11566. The all options are expressions containing the following constants:
  11567. @table @option
  11568. @item w
  11569. @item h
  11570. The input width and height.
  11571. @item a
  11572. same as @var{w} / @var{h}
  11573. @item sar
  11574. input sample aspect ratio
  11575. @item dar
  11576. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11577. @item n
  11578. The number of the input frame, starting from 0.
  11579. @item t
  11580. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11581. @item pos
  11582. the position in the file of the input frame, NAN if unknown
  11583. @end table
  11584. @section swapuv
  11585. Swap U & V plane.
  11586. @section telecine
  11587. Apply telecine process to the video.
  11588. This filter accepts the following options:
  11589. @table @option
  11590. @item first_field
  11591. @table @samp
  11592. @item top, t
  11593. top field first
  11594. @item bottom, b
  11595. bottom field first
  11596. The default value is @code{top}.
  11597. @end table
  11598. @item pattern
  11599. A string of numbers representing the pulldown pattern you wish to apply.
  11600. The default value is @code{23}.
  11601. @end table
  11602. @example
  11603. Some typical patterns:
  11604. NTSC output (30i):
  11605. 27.5p: 32222
  11606. 24p: 23 (classic)
  11607. 24p: 2332 (preferred)
  11608. 20p: 33
  11609. 18p: 334
  11610. 16p: 3444
  11611. PAL output (25i):
  11612. 27.5p: 12222
  11613. 24p: 222222222223 ("Euro pulldown")
  11614. 16.67p: 33
  11615. 16p: 33333334
  11616. @end example
  11617. @section threshold
  11618. Apply threshold effect to video stream.
  11619. This filter needs four video streams to perform thresholding.
  11620. First stream is stream we are filtering.
  11621. Second stream is holding threshold values, third stream is holding min values,
  11622. and last, fourth stream is holding max values.
  11623. The filter accepts the following option:
  11624. @table @option
  11625. @item planes
  11626. Set which planes will be processed, unprocessed planes will be copied.
  11627. By default value 0xf, all planes will be processed.
  11628. @end table
  11629. For example if first stream pixel's component value is less then threshold value
  11630. of pixel component from 2nd threshold stream, third stream value will picked,
  11631. otherwise fourth stream pixel component value will be picked.
  11632. Using color source filter one can perform various types of thresholding:
  11633. @subsection Examples
  11634. @itemize
  11635. @item
  11636. Binary threshold, using gray color as threshold:
  11637. @example
  11638. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11639. @end example
  11640. @item
  11641. Inverted binary threshold, using gray color as threshold:
  11642. @example
  11643. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11644. @end example
  11645. @item
  11646. Truncate binary threshold, using gray color as threshold:
  11647. @example
  11648. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11649. @end example
  11650. @item
  11651. Threshold to zero, using gray color as threshold:
  11652. @example
  11653. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11654. @end example
  11655. @item
  11656. Inverted threshold to zero, using gray color as threshold:
  11657. @example
  11658. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11659. @end example
  11660. @end itemize
  11661. @section thumbnail
  11662. Select the most representative frame in a given sequence of consecutive frames.
  11663. The filter accepts the following options:
  11664. @table @option
  11665. @item n
  11666. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11667. will pick one of them, and then handle the next batch of @var{n} frames until
  11668. the end. Default is @code{100}.
  11669. @end table
  11670. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11671. value will result in a higher memory usage, so a high value is not recommended.
  11672. @subsection Examples
  11673. @itemize
  11674. @item
  11675. Extract one picture each 50 frames:
  11676. @example
  11677. thumbnail=50
  11678. @end example
  11679. @item
  11680. Complete example of a thumbnail creation with @command{ffmpeg}:
  11681. @example
  11682. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11683. @end example
  11684. @end itemize
  11685. @section tile
  11686. Tile several successive frames together.
  11687. The filter accepts the following options:
  11688. @table @option
  11689. @item layout
  11690. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11691. this option, check the
  11692. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11693. @item nb_frames
  11694. Set the maximum number of frames to render in the given area. It must be less
  11695. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11696. the area will be used.
  11697. @item margin
  11698. Set the outer border margin in pixels.
  11699. @item padding
  11700. Set the inner border thickness (i.e. the number of pixels between frames). For
  11701. more advanced padding options (such as having different values for the edges),
  11702. refer to the pad video filter.
  11703. @item color
  11704. Specify the color of the unused area. For the syntax of this option, check the
  11705. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11706. The default value of @var{color} is "black".
  11707. @item overlap
  11708. Set the number of frames to overlap when tiling several successive frames together.
  11709. The value must be between @code{0} and @var{nb_frames - 1}.
  11710. @item init_padding
  11711. Set the number of frames to initially be empty before displaying first output frame.
  11712. This controls how soon will one get first output frame.
  11713. The value must be between @code{0} and @var{nb_frames - 1}.
  11714. @end table
  11715. @subsection Examples
  11716. @itemize
  11717. @item
  11718. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11719. @example
  11720. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11721. @end example
  11722. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11723. duplicating each output frame to accommodate the originally detected frame
  11724. rate.
  11725. @item
  11726. Display @code{5} pictures in an area of @code{3x2} frames,
  11727. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11728. mixed flat and named options:
  11729. @example
  11730. tile=3x2:nb_frames=5:padding=7:margin=2
  11731. @end example
  11732. @end itemize
  11733. @section tinterlace
  11734. Perform various types of temporal field interlacing.
  11735. Frames are counted starting from 1, so the first input frame is
  11736. considered odd.
  11737. The filter accepts the following options:
  11738. @table @option
  11739. @item mode
  11740. Specify the mode of the interlacing. This option can also be specified
  11741. as a value alone. See below for a list of values for this option.
  11742. Available values are:
  11743. @table @samp
  11744. @item merge, 0
  11745. Move odd frames into the upper field, even into the lower field,
  11746. generating a double height frame at half frame rate.
  11747. @example
  11748. ------> time
  11749. Input:
  11750. Frame 1 Frame 2 Frame 3 Frame 4
  11751. 11111 22222 33333 44444
  11752. 11111 22222 33333 44444
  11753. 11111 22222 33333 44444
  11754. 11111 22222 33333 44444
  11755. Output:
  11756. 11111 33333
  11757. 22222 44444
  11758. 11111 33333
  11759. 22222 44444
  11760. 11111 33333
  11761. 22222 44444
  11762. 11111 33333
  11763. 22222 44444
  11764. @end example
  11765. @item drop_even, 1
  11766. Only output odd frames, even frames are dropped, generating a frame with
  11767. unchanged height at half frame rate.
  11768. @example
  11769. ------> time
  11770. Input:
  11771. Frame 1 Frame 2 Frame 3 Frame 4
  11772. 11111 22222 33333 44444
  11773. 11111 22222 33333 44444
  11774. 11111 22222 33333 44444
  11775. 11111 22222 33333 44444
  11776. Output:
  11777. 11111 33333
  11778. 11111 33333
  11779. 11111 33333
  11780. 11111 33333
  11781. @end example
  11782. @item drop_odd, 2
  11783. Only output even frames, odd frames are dropped, generating a frame with
  11784. unchanged height at half frame rate.
  11785. @example
  11786. ------> time
  11787. Input:
  11788. Frame 1 Frame 2 Frame 3 Frame 4
  11789. 11111 22222 33333 44444
  11790. 11111 22222 33333 44444
  11791. 11111 22222 33333 44444
  11792. 11111 22222 33333 44444
  11793. Output:
  11794. 22222 44444
  11795. 22222 44444
  11796. 22222 44444
  11797. 22222 44444
  11798. @end example
  11799. @item pad, 3
  11800. Expand each frame to full height, but pad alternate lines with black,
  11801. generating a frame with double height at the same input frame rate.
  11802. @example
  11803. ------> time
  11804. Input:
  11805. Frame 1 Frame 2 Frame 3 Frame 4
  11806. 11111 22222 33333 44444
  11807. 11111 22222 33333 44444
  11808. 11111 22222 33333 44444
  11809. 11111 22222 33333 44444
  11810. Output:
  11811. 11111 ..... 33333 .....
  11812. ..... 22222 ..... 44444
  11813. 11111 ..... 33333 .....
  11814. ..... 22222 ..... 44444
  11815. 11111 ..... 33333 .....
  11816. ..... 22222 ..... 44444
  11817. 11111 ..... 33333 .....
  11818. ..... 22222 ..... 44444
  11819. @end example
  11820. @item interleave_top, 4
  11821. Interleave the upper field from odd frames with the lower field from
  11822. even frames, generating a frame with unchanged height at half frame rate.
  11823. @example
  11824. ------> time
  11825. Input:
  11826. Frame 1 Frame 2 Frame 3 Frame 4
  11827. 11111<- 22222 33333<- 44444
  11828. 11111 22222<- 33333 44444<-
  11829. 11111<- 22222 33333<- 44444
  11830. 11111 22222<- 33333 44444<-
  11831. Output:
  11832. 11111 33333
  11833. 22222 44444
  11834. 11111 33333
  11835. 22222 44444
  11836. @end example
  11837. @item interleave_bottom, 5
  11838. Interleave the lower field from odd frames with the upper field from
  11839. even frames, generating a frame with unchanged height at half frame rate.
  11840. @example
  11841. ------> time
  11842. Input:
  11843. Frame 1 Frame 2 Frame 3 Frame 4
  11844. 11111 22222<- 33333 44444<-
  11845. 11111<- 22222 33333<- 44444
  11846. 11111 22222<- 33333 44444<-
  11847. 11111<- 22222 33333<- 44444
  11848. Output:
  11849. 22222 44444
  11850. 11111 33333
  11851. 22222 44444
  11852. 11111 33333
  11853. @end example
  11854. @item interlacex2, 6
  11855. Double frame rate with unchanged height. Frames are inserted each
  11856. containing the second temporal field from the previous input frame and
  11857. the first temporal field from the next input frame. This mode relies on
  11858. the top_field_first flag. Useful for interlaced video displays with no
  11859. field synchronisation.
  11860. @example
  11861. ------> time
  11862. Input:
  11863. Frame 1 Frame 2 Frame 3 Frame 4
  11864. 11111 22222 33333 44444
  11865. 11111 22222 33333 44444
  11866. 11111 22222 33333 44444
  11867. 11111 22222 33333 44444
  11868. Output:
  11869. 11111 22222 22222 33333 33333 44444 44444
  11870. 11111 11111 22222 22222 33333 33333 44444
  11871. 11111 22222 22222 33333 33333 44444 44444
  11872. 11111 11111 22222 22222 33333 33333 44444
  11873. @end example
  11874. @item mergex2, 7
  11875. Move odd frames into the upper field, even into the lower field,
  11876. generating a double height frame at same frame rate.
  11877. @example
  11878. ------> time
  11879. Input:
  11880. Frame 1 Frame 2 Frame 3 Frame 4
  11881. 11111 22222 33333 44444
  11882. 11111 22222 33333 44444
  11883. 11111 22222 33333 44444
  11884. 11111 22222 33333 44444
  11885. Output:
  11886. 11111 33333 33333 55555
  11887. 22222 22222 44444 44444
  11888. 11111 33333 33333 55555
  11889. 22222 22222 44444 44444
  11890. 11111 33333 33333 55555
  11891. 22222 22222 44444 44444
  11892. 11111 33333 33333 55555
  11893. 22222 22222 44444 44444
  11894. @end example
  11895. @end table
  11896. Numeric values are deprecated but are accepted for backward
  11897. compatibility reasons.
  11898. Default mode is @code{merge}.
  11899. @item flags
  11900. Specify flags influencing the filter process.
  11901. Available value for @var{flags} is:
  11902. @table @option
  11903. @item low_pass_filter, vlfp
  11904. Enable linear vertical low-pass filtering in the filter.
  11905. Vertical low-pass filtering is required when creating an interlaced
  11906. destination from a progressive source which contains high-frequency
  11907. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11908. patterning.
  11909. @item complex_filter, cvlfp
  11910. Enable complex vertical low-pass filtering.
  11911. This will slightly less reduce interlace 'twitter' and Moire
  11912. patterning but better retain detail and subjective sharpness impression.
  11913. @end table
  11914. Vertical low-pass filtering can only be enabled for @option{mode}
  11915. @var{interleave_top} and @var{interleave_bottom}.
  11916. @end table
  11917. @section tmix
  11918. Mix successive video frames.
  11919. A description of the accepted options follows.
  11920. @table @option
  11921. @item frames
  11922. The number of successive frames to mix. If unspecified, it defaults to 3.
  11923. @item weights
  11924. Specify weight of each input video frame.
  11925. Each weight is separated by space. If number of weights is smaller than
  11926. number of @var{frames} last specified weight will be used for all remaining
  11927. unset weights.
  11928. @item scale
  11929. Specify scale, if it is set it will be multiplied with sum
  11930. of each weight multiplied with pixel values to give final destination
  11931. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11932. @end table
  11933. @subsection Examples
  11934. @itemize
  11935. @item
  11936. Average 7 successive frames:
  11937. @example
  11938. tmix=frames=7:weights="1 1 1 1 1 1 1"
  11939. @end example
  11940. @item
  11941. Apply simple temporal convolution:
  11942. @example
  11943. tmix=frames=3:weights="-1 3 -1"
  11944. @end example
  11945. @item
  11946. Similar as above but only showing temporal differences:
  11947. @example
  11948. tmix=frames=3:weights="-1 2 -1":scale=1
  11949. @end example
  11950. @end itemize
  11951. @section tonemap
  11952. Tone map colors from different dynamic ranges.
  11953. This filter expects data in single precision floating point, as it needs to
  11954. operate on (and can output) out-of-range values. Another filter, such as
  11955. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11956. The tonemapping algorithms implemented only work on linear light, so input
  11957. data should be linearized beforehand (and possibly correctly tagged).
  11958. @example
  11959. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11960. @end example
  11961. @subsection Options
  11962. The filter accepts the following options.
  11963. @table @option
  11964. @item tonemap
  11965. Set the tone map algorithm to use.
  11966. Possible values are:
  11967. @table @var
  11968. @item none
  11969. Do not apply any tone map, only desaturate overbright pixels.
  11970. @item clip
  11971. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11972. in-range values, while distorting out-of-range values.
  11973. @item linear
  11974. Stretch the entire reference gamut to a linear multiple of the display.
  11975. @item gamma
  11976. Fit a logarithmic transfer between the tone curves.
  11977. @item reinhard
  11978. Preserve overall image brightness with a simple curve, using nonlinear
  11979. contrast, which results in flattening details and degrading color accuracy.
  11980. @item hable
  11981. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11982. of slightly darkening everything. Use it when detail preservation is more
  11983. important than color and brightness accuracy.
  11984. @item mobius
  11985. Smoothly map out-of-range values, while retaining contrast and colors for
  11986. in-range material as much as possible. Use it when color accuracy is more
  11987. important than detail preservation.
  11988. @end table
  11989. Default is none.
  11990. @item param
  11991. Tune the tone mapping algorithm.
  11992. This affects the following algorithms:
  11993. @table @var
  11994. @item none
  11995. Ignored.
  11996. @item linear
  11997. Specifies the scale factor to use while stretching.
  11998. Default to 1.0.
  11999. @item gamma
  12000. Specifies the exponent of the function.
  12001. Default to 1.8.
  12002. @item clip
  12003. Specify an extra linear coefficient to multiply into the signal before clipping.
  12004. Default to 1.0.
  12005. @item reinhard
  12006. Specify the local contrast coefficient at the display peak.
  12007. Default to 0.5, which means that in-gamut values will be about half as bright
  12008. as when clipping.
  12009. @item hable
  12010. Ignored.
  12011. @item mobius
  12012. Specify the transition point from linear to mobius transform. Every value
  12013. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12014. more accurate the result will be, at the cost of losing bright details.
  12015. Default to 0.3, which due to the steep initial slope still preserves in-range
  12016. colors fairly accurately.
  12017. @end table
  12018. @item desat
  12019. Apply desaturation for highlights that exceed this level of brightness. The
  12020. higher the parameter, the more color information will be preserved. This
  12021. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12022. (smoothly) turning into white instead. This makes images feel more natural,
  12023. at the cost of reducing information about out-of-range colors.
  12024. The default of 2.0 is somewhat conservative and will mostly just apply to
  12025. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12026. This option works only if the input frame has a supported color tag.
  12027. @item peak
  12028. Override signal/nominal/reference peak with this value. Useful when the
  12029. embedded peak information in display metadata is not reliable or when tone
  12030. mapping from a lower range to a higher range.
  12031. @end table
  12032. @section transpose
  12033. Transpose rows with columns in the input video and optionally flip it.
  12034. It accepts the following parameters:
  12035. @table @option
  12036. @item dir
  12037. Specify the transposition direction.
  12038. Can assume the following values:
  12039. @table @samp
  12040. @item 0, 4, cclock_flip
  12041. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12042. @example
  12043. L.R L.l
  12044. . . -> . .
  12045. l.r R.r
  12046. @end example
  12047. @item 1, 5, clock
  12048. Rotate by 90 degrees clockwise, that is:
  12049. @example
  12050. L.R l.L
  12051. . . -> . .
  12052. l.r r.R
  12053. @end example
  12054. @item 2, 6, cclock
  12055. Rotate by 90 degrees counterclockwise, that is:
  12056. @example
  12057. L.R R.r
  12058. . . -> . .
  12059. l.r L.l
  12060. @end example
  12061. @item 3, 7, clock_flip
  12062. Rotate by 90 degrees clockwise and vertically flip, that is:
  12063. @example
  12064. L.R r.R
  12065. . . -> . .
  12066. l.r l.L
  12067. @end example
  12068. @end table
  12069. For values between 4-7, the transposition is only done if the input
  12070. video geometry is portrait and not landscape. These values are
  12071. deprecated, the @code{passthrough} option should be used instead.
  12072. Numerical values are deprecated, and should be dropped in favor of
  12073. symbolic constants.
  12074. @item passthrough
  12075. Do not apply the transposition if the input geometry matches the one
  12076. specified by the specified value. It accepts the following values:
  12077. @table @samp
  12078. @item none
  12079. Always apply transposition.
  12080. @item portrait
  12081. Preserve portrait geometry (when @var{height} >= @var{width}).
  12082. @item landscape
  12083. Preserve landscape geometry (when @var{width} >= @var{height}).
  12084. @end table
  12085. Default value is @code{none}.
  12086. @end table
  12087. For example to rotate by 90 degrees clockwise and preserve portrait
  12088. layout:
  12089. @example
  12090. transpose=dir=1:passthrough=portrait
  12091. @end example
  12092. The command above can also be specified as:
  12093. @example
  12094. transpose=1:portrait
  12095. @end example
  12096. @section trim
  12097. Trim the input so that the output contains one continuous subpart of the input.
  12098. It accepts the following parameters:
  12099. @table @option
  12100. @item start
  12101. Specify the time of the start of the kept section, i.e. the frame with the
  12102. timestamp @var{start} will be the first frame in the output.
  12103. @item end
  12104. Specify the time of the first frame that will be dropped, i.e. the frame
  12105. immediately preceding the one with the timestamp @var{end} will be the last
  12106. frame in the output.
  12107. @item start_pts
  12108. This is the same as @var{start}, except this option sets the start timestamp
  12109. in timebase units instead of seconds.
  12110. @item end_pts
  12111. This is the same as @var{end}, except this option sets the end timestamp
  12112. in timebase units instead of seconds.
  12113. @item duration
  12114. The maximum duration of the output in seconds.
  12115. @item start_frame
  12116. The number of the first frame that should be passed to the output.
  12117. @item end_frame
  12118. The number of the first frame that should be dropped.
  12119. @end table
  12120. @option{start}, @option{end}, and @option{duration} are expressed as time
  12121. duration specifications; see
  12122. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12123. for the accepted syntax.
  12124. Note that the first two sets of the start/end options and the @option{duration}
  12125. option look at the frame timestamp, while the _frame variants simply count the
  12126. frames that pass through the filter. Also note that this filter does not modify
  12127. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12128. setpts filter after the trim filter.
  12129. If multiple start or end options are set, this filter tries to be greedy and
  12130. keep all the frames that match at least one of the specified constraints. To keep
  12131. only the part that matches all the constraints at once, chain multiple trim
  12132. filters.
  12133. The defaults are such that all the input is kept. So it is possible to set e.g.
  12134. just the end values to keep everything before the specified time.
  12135. Examples:
  12136. @itemize
  12137. @item
  12138. Drop everything except the second minute of input:
  12139. @example
  12140. ffmpeg -i INPUT -vf trim=60:120
  12141. @end example
  12142. @item
  12143. Keep only the first second:
  12144. @example
  12145. ffmpeg -i INPUT -vf trim=duration=1
  12146. @end example
  12147. @end itemize
  12148. @section unpremultiply
  12149. Apply alpha unpremultiply effect to input video stream using first plane
  12150. of second stream as alpha.
  12151. Both streams must have same dimensions and same pixel format.
  12152. The filter accepts the following option:
  12153. @table @option
  12154. @item planes
  12155. Set which planes will be processed, unprocessed planes will be copied.
  12156. By default value 0xf, all planes will be processed.
  12157. If the format has 1 or 2 components, then luma is bit 0.
  12158. If the format has 3 or 4 components:
  12159. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12160. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12161. If present, the alpha channel is always the last bit.
  12162. @item inplace
  12163. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12164. @end table
  12165. @anchor{unsharp}
  12166. @section unsharp
  12167. Sharpen or blur the input video.
  12168. It accepts the following parameters:
  12169. @table @option
  12170. @item luma_msize_x, lx
  12171. Set the luma matrix horizontal size. It must be an odd integer between
  12172. 3 and 23. The default value is 5.
  12173. @item luma_msize_y, ly
  12174. Set the luma matrix vertical size. It must be an odd integer between 3
  12175. and 23. The default value is 5.
  12176. @item luma_amount, la
  12177. Set the luma effect strength. It must be a floating point number, reasonable
  12178. values lay between -1.5 and 1.5.
  12179. Negative values will blur the input video, while positive values will
  12180. sharpen it, a value of zero will disable the effect.
  12181. Default value is 1.0.
  12182. @item chroma_msize_x, cx
  12183. Set the chroma matrix horizontal size. It must be an odd integer
  12184. between 3 and 23. The default value is 5.
  12185. @item chroma_msize_y, cy
  12186. Set the chroma matrix vertical size. It must be an odd integer
  12187. between 3 and 23. The default value is 5.
  12188. @item chroma_amount, ca
  12189. Set the chroma effect strength. It must be a floating point number, reasonable
  12190. values lay between -1.5 and 1.5.
  12191. Negative values will blur the input video, while positive values will
  12192. sharpen it, a value of zero will disable the effect.
  12193. Default value is 0.0.
  12194. @end table
  12195. All parameters are optional and default to the equivalent of the
  12196. string '5:5:1.0:5:5:0.0'.
  12197. @subsection Examples
  12198. @itemize
  12199. @item
  12200. Apply strong luma sharpen effect:
  12201. @example
  12202. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12203. @end example
  12204. @item
  12205. Apply a strong blur of both luma and chroma parameters:
  12206. @example
  12207. unsharp=7:7:-2:7:7:-2
  12208. @end example
  12209. @end itemize
  12210. @section uspp
  12211. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12212. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12213. shifts and average the results.
  12214. The way this differs from the behavior of spp is that uspp actually encodes &
  12215. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12216. DCT similar to MJPEG.
  12217. The filter accepts the following options:
  12218. @table @option
  12219. @item quality
  12220. Set quality. This option defines the number of levels for averaging. It accepts
  12221. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12222. effect. A value of @code{8} means the higher quality. For each increment of
  12223. that value the speed drops by a factor of approximately 2. Default value is
  12224. @code{3}.
  12225. @item qp
  12226. Force a constant quantization parameter. If not set, the filter will use the QP
  12227. from the video stream (if available).
  12228. @end table
  12229. @section vaguedenoiser
  12230. Apply a wavelet based denoiser.
  12231. It transforms each frame from the video input into the wavelet domain,
  12232. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12233. the obtained coefficients. It does an inverse wavelet transform after.
  12234. Due to wavelet properties, it should give a nice smoothed result, and
  12235. reduced noise, without blurring picture features.
  12236. This filter accepts the following options:
  12237. @table @option
  12238. @item threshold
  12239. The filtering strength. The higher, the more filtered the video will be.
  12240. Hard thresholding can use a higher threshold than soft thresholding
  12241. before the video looks overfiltered. Default value is 2.
  12242. @item method
  12243. The filtering method the filter will use.
  12244. It accepts the following values:
  12245. @table @samp
  12246. @item hard
  12247. All values under the threshold will be zeroed.
  12248. @item soft
  12249. All values under the threshold will be zeroed. All values above will be
  12250. reduced by the threshold.
  12251. @item garrote
  12252. Scales or nullifies coefficients - intermediary between (more) soft and
  12253. (less) hard thresholding.
  12254. @end table
  12255. Default is garrote.
  12256. @item nsteps
  12257. Number of times, the wavelet will decompose the picture. Picture can't
  12258. be decomposed beyond a particular point (typically, 8 for a 640x480
  12259. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12260. @item percent
  12261. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12262. @item planes
  12263. A list of the planes to process. By default all planes are processed.
  12264. @end table
  12265. @section vectorscope
  12266. Display 2 color component values in the two dimensional graph (which is called
  12267. a vectorscope).
  12268. This filter accepts the following options:
  12269. @table @option
  12270. @item mode, m
  12271. Set vectorscope mode.
  12272. It accepts the following values:
  12273. @table @samp
  12274. @item gray
  12275. Gray values are displayed on graph, higher brightness means more pixels have
  12276. same component color value on location in graph. This is the default mode.
  12277. @item color
  12278. Gray values are displayed on graph. Surrounding pixels values which are not
  12279. present in video frame are drawn in gradient of 2 color components which are
  12280. set by option @code{x} and @code{y}. The 3rd color component is static.
  12281. @item color2
  12282. Actual color components values present in video frame are displayed on graph.
  12283. @item color3
  12284. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12285. on graph increases value of another color component, which is luminance by
  12286. default values of @code{x} and @code{y}.
  12287. @item color4
  12288. Actual colors present in video frame are displayed on graph. If two different
  12289. colors map to same position on graph then color with higher value of component
  12290. not present in graph is picked.
  12291. @item color5
  12292. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12293. component picked from radial gradient.
  12294. @end table
  12295. @item x
  12296. Set which color component will be represented on X-axis. Default is @code{1}.
  12297. @item y
  12298. Set which color component will be represented on Y-axis. Default is @code{2}.
  12299. @item intensity, i
  12300. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12301. of color component which represents frequency of (X, Y) location in graph.
  12302. @item envelope, e
  12303. @table @samp
  12304. @item none
  12305. No envelope, this is default.
  12306. @item instant
  12307. Instant envelope, even darkest single pixel will be clearly highlighted.
  12308. @item peak
  12309. Hold maximum and minimum values presented in graph over time. This way you
  12310. can still spot out of range values without constantly looking at vectorscope.
  12311. @item peak+instant
  12312. Peak and instant envelope combined together.
  12313. @end table
  12314. @item graticule, g
  12315. Set what kind of graticule to draw.
  12316. @table @samp
  12317. @item none
  12318. @item green
  12319. @item color
  12320. @end table
  12321. @item opacity, o
  12322. Set graticule opacity.
  12323. @item flags, f
  12324. Set graticule flags.
  12325. @table @samp
  12326. @item white
  12327. Draw graticule for white point.
  12328. @item black
  12329. Draw graticule for black point.
  12330. @item name
  12331. Draw color points short names.
  12332. @end table
  12333. @item bgopacity, b
  12334. Set background opacity.
  12335. @item lthreshold, l
  12336. Set low threshold for color component not represented on X or Y axis.
  12337. Values lower than this value will be ignored. Default is 0.
  12338. Note this value is multiplied with actual max possible value one pixel component
  12339. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12340. is 0.1 * 255 = 25.
  12341. @item hthreshold, h
  12342. Set high threshold for color component not represented on X or Y axis.
  12343. Values higher than this value will be ignored. Default is 1.
  12344. Note this value is multiplied with actual max possible value one pixel component
  12345. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12346. is 0.9 * 255 = 230.
  12347. @item colorspace, c
  12348. Set what kind of colorspace to use when drawing graticule.
  12349. @table @samp
  12350. @item auto
  12351. @item 601
  12352. @item 709
  12353. @end table
  12354. Default is auto.
  12355. @end table
  12356. @anchor{vidstabdetect}
  12357. @section vidstabdetect
  12358. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12359. @ref{vidstabtransform} for pass 2.
  12360. This filter generates a file with relative translation and rotation
  12361. transform information about subsequent frames, which is then used by
  12362. the @ref{vidstabtransform} filter.
  12363. To enable compilation of this filter you need to configure FFmpeg with
  12364. @code{--enable-libvidstab}.
  12365. This filter accepts the following options:
  12366. @table @option
  12367. @item result
  12368. Set the path to the file used to write the transforms information.
  12369. Default value is @file{transforms.trf}.
  12370. @item shakiness
  12371. Set how shaky the video is and how quick the camera is. It accepts an
  12372. integer in the range 1-10, a value of 1 means little shakiness, a
  12373. value of 10 means strong shakiness. Default value is 5.
  12374. @item accuracy
  12375. Set the accuracy of the detection process. It must be a value in the
  12376. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12377. accuracy. Default value is 15.
  12378. @item stepsize
  12379. Set stepsize of the search process. The region around minimum is
  12380. scanned with 1 pixel resolution. Default value is 6.
  12381. @item mincontrast
  12382. Set minimum contrast. Below this value a local measurement field is
  12383. discarded. Must be a floating point value in the range 0-1. Default
  12384. value is 0.3.
  12385. @item tripod
  12386. Set reference frame number for tripod mode.
  12387. If enabled, the motion of the frames is compared to a reference frame
  12388. in the filtered stream, identified by the specified number. The idea
  12389. is to compensate all movements in a more-or-less static scene and keep
  12390. the camera view absolutely still.
  12391. If set to 0, it is disabled. The frames are counted starting from 1.
  12392. @item show
  12393. Show fields and transforms in the resulting frames. It accepts an
  12394. integer in the range 0-2. Default value is 0, which disables any
  12395. visualization.
  12396. @end table
  12397. @subsection Examples
  12398. @itemize
  12399. @item
  12400. Use default values:
  12401. @example
  12402. vidstabdetect
  12403. @end example
  12404. @item
  12405. Analyze strongly shaky movie and put the results in file
  12406. @file{mytransforms.trf}:
  12407. @example
  12408. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12409. @end example
  12410. @item
  12411. Visualize the result of internal transformations in the resulting
  12412. video:
  12413. @example
  12414. vidstabdetect=show=1
  12415. @end example
  12416. @item
  12417. Analyze a video with medium shakiness using @command{ffmpeg}:
  12418. @example
  12419. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12420. @end example
  12421. @end itemize
  12422. @anchor{vidstabtransform}
  12423. @section vidstabtransform
  12424. Video stabilization/deshaking: pass 2 of 2,
  12425. see @ref{vidstabdetect} for pass 1.
  12426. Read a file with transform information for each frame and
  12427. apply/compensate them. Together with the @ref{vidstabdetect}
  12428. filter this can be used to deshake videos. See also
  12429. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12430. the @ref{unsharp} filter, see below.
  12431. To enable compilation of this filter you need to configure FFmpeg with
  12432. @code{--enable-libvidstab}.
  12433. @subsection Options
  12434. @table @option
  12435. @item input
  12436. Set path to the file used to read the transforms. Default value is
  12437. @file{transforms.trf}.
  12438. @item smoothing
  12439. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12440. camera movements. Default value is 10.
  12441. For example a number of 10 means that 21 frames are used (10 in the
  12442. past and 10 in the future) to smoothen the motion in the video. A
  12443. larger value leads to a smoother video, but limits the acceleration of
  12444. the camera (pan/tilt movements). 0 is a special case where a static
  12445. camera is simulated.
  12446. @item optalgo
  12447. Set the camera path optimization algorithm.
  12448. Accepted values are:
  12449. @table @samp
  12450. @item gauss
  12451. gaussian kernel low-pass filter on camera motion (default)
  12452. @item avg
  12453. averaging on transformations
  12454. @end table
  12455. @item maxshift
  12456. Set maximal number of pixels to translate frames. Default value is -1,
  12457. meaning no limit.
  12458. @item maxangle
  12459. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12460. value is -1, meaning no limit.
  12461. @item crop
  12462. Specify how to deal with borders that may be visible due to movement
  12463. compensation.
  12464. Available values are:
  12465. @table @samp
  12466. @item keep
  12467. keep image information from previous frame (default)
  12468. @item black
  12469. fill the border black
  12470. @end table
  12471. @item invert
  12472. Invert transforms if set to 1. Default value is 0.
  12473. @item relative
  12474. Consider transforms as relative to previous frame if set to 1,
  12475. absolute if set to 0. Default value is 0.
  12476. @item zoom
  12477. Set percentage to zoom. A positive value will result in a zoom-in
  12478. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12479. zoom).
  12480. @item optzoom
  12481. Set optimal zooming to avoid borders.
  12482. Accepted values are:
  12483. @table @samp
  12484. @item 0
  12485. disabled
  12486. @item 1
  12487. optimal static zoom value is determined (only very strong movements
  12488. will lead to visible borders) (default)
  12489. @item 2
  12490. optimal adaptive zoom value is determined (no borders will be
  12491. visible), see @option{zoomspeed}
  12492. @end table
  12493. Note that the value given at zoom is added to the one calculated here.
  12494. @item zoomspeed
  12495. Set percent to zoom maximally each frame (enabled when
  12496. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12497. 0.25.
  12498. @item interpol
  12499. Specify type of interpolation.
  12500. Available values are:
  12501. @table @samp
  12502. @item no
  12503. no interpolation
  12504. @item linear
  12505. linear only horizontal
  12506. @item bilinear
  12507. linear in both directions (default)
  12508. @item bicubic
  12509. cubic in both directions (slow)
  12510. @end table
  12511. @item tripod
  12512. Enable virtual tripod mode if set to 1, which is equivalent to
  12513. @code{relative=0:smoothing=0}. Default value is 0.
  12514. Use also @code{tripod} option of @ref{vidstabdetect}.
  12515. @item debug
  12516. Increase log verbosity if set to 1. Also the detected global motions
  12517. are written to the temporary file @file{global_motions.trf}. Default
  12518. value is 0.
  12519. @end table
  12520. @subsection Examples
  12521. @itemize
  12522. @item
  12523. Use @command{ffmpeg} for a typical stabilization with default values:
  12524. @example
  12525. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12526. @end example
  12527. Note the use of the @ref{unsharp} filter which is always recommended.
  12528. @item
  12529. Zoom in a bit more and load transform data from a given file:
  12530. @example
  12531. vidstabtransform=zoom=5:input="mytransforms.trf"
  12532. @end example
  12533. @item
  12534. Smoothen the video even more:
  12535. @example
  12536. vidstabtransform=smoothing=30
  12537. @end example
  12538. @end itemize
  12539. @section vflip
  12540. Flip the input video vertically.
  12541. For example, to vertically flip a video with @command{ffmpeg}:
  12542. @example
  12543. ffmpeg -i in.avi -vf "vflip" out.avi
  12544. @end example
  12545. @section vfrdet
  12546. Detect variable frame rate video.
  12547. This filter tries to detect if the input is variable or constant frame rate.
  12548. At end it will output number of frames detected as having variable delta pts,
  12549. and ones with constant delta pts.
  12550. If there was frames with variable delta, than it will also show min and max delta
  12551. encountered.
  12552. @anchor{vignette}
  12553. @section vignette
  12554. Make or reverse a natural vignetting effect.
  12555. The filter accepts the following options:
  12556. @table @option
  12557. @item angle, a
  12558. Set lens angle expression as a number of radians.
  12559. The value is clipped in the @code{[0,PI/2]} range.
  12560. Default value: @code{"PI/5"}
  12561. @item x0
  12562. @item y0
  12563. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12564. by default.
  12565. @item mode
  12566. Set forward/backward mode.
  12567. Available modes are:
  12568. @table @samp
  12569. @item forward
  12570. The larger the distance from the central point, the darker the image becomes.
  12571. @item backward
  12572. The larger the distance from the central point, the brighter the image becomes.
  12573. This can be used to reverse a vignette effect, though there is no automatic
  12574. detection to extract the lens @option{angle} and other settings (yet). It can
  12575. also be used to create a burning effect.
  12576. @end table
  12577. Default value is @samp{forward}.
  12578. @item eval
  12579. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12580. It accepts the following values:
  12581. @table @samp
  12582. @item init
  12583. Evaluate expressions only once during the filter initialization.
  12584. @item frame
  12585. Evaluate expressions for each incoming frame. This is way slower than the
  12586. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12587. allows advanced dynamic expressions.
  12588. @end table
  12589. Default value is @samp{init}.
  12590. @item dither
  12591. Set dithering to reduce the circular banding effects. Default is @code{1}
  12592. (enabled).
  12593. @item aspect
  12594. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12595. Setting this value to the SAR of the input will make a rectangular vignetting
  12596. following the dimensions of the video.
  12597. Default is @code{1/1}.
  12598. @end table
  12599. @subsection Expressions
  12600. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12601. following parameters.
  12602. @table @option
  12603. @item w
  12604. @item h
  12605. input width and height
  12606. @item n
  12607. the number of input frame, starting from 0
  12608. @item pts
  12609. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12610. @var{TB} units, NAN if undefined
  12611. @item r
  12612. frame rate of the input video, NAN if the input frame rate is unknown
  12613. @item t
  12614. the PTS (Presentation TimeStamp) of the filtered video frame,
  12615. expressed in seconds, NAN if undefined
  12616. @item tb
  12617. time base of the input video
  12618. @end table
  12619. @subsection Examples
  12620. @itemize
  12621. @item
  12622. Apply simple strong vignetting effect:
  12623. @example
  12624. vignette=PI/4
  12625. @end example
  12626. @item
  12627. Make a flickering vignetting:
  12628. @example
  12629. vignette='PI/4+random(1)*PI/50':eval=frame
  12630. @end example
  12631. @end itemize
  12632. @section vmafmotion
  12633. Obtain the average vmaf motion score of a video.
  12634. It is one of the component filters of VMAF.
  12635. The obtained average motion score is printed through the logging system.
  12636. In the below example the input file @file{ref.mpg} is being processed and score
  12637. is computed.
  12638. @example
  12639. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12640. @end example
  12641. @section vstack
  12642. Stack input videos vertically.
  12643. All streams must be of same pixel format and of same width.
  12644. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12645. to create same output.
  12646. The filter accept the following option:
  12647. @table @option
  12648. @item inputs
  12649. Set number of input streams. Default is 2.
  12650. @item shortest
  12651. If set to 1, force the output to terminate when the shortest input
  12652. terminates. Default value is 0.
  12653. @end table
  12654. @section w3fdif
  12655. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12656. Deinterlacing Filter").
  12657. Based on the process described by Martin Weston for BBC R&D, and
  12658. implemented based on the de-interlace algorithm written by Jim
  12659. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12660. uses filter coefficients calculated by BBC R&D.
  12661. There are two sets of filter coefficients, so called "simple":
  12662. and "complex". Which set of filter coefficients is used can
  12663. be set by passing an optional parameter:
  12664. @table @option
  12665. @item filter
  12666. Set the interlacing filter coefficients. Accepts one of the following values:
  12667. @table @samp
  12668. @item simple
  12669. Simple filter coefficient set.
  12670. @item complex
  12671. More-complex filter coefficient set.
  12672. @end table
  12673. Default value is @samp{complex}.
  12674. @item deint
  12675. Specify which frames to deinterlace. Accept one of the following values:
  12676. @table @samp
  12677. @item all
  12678. Deinterlace all frames,
  12679. @item interlaced
  12680. Only deinterlace frames marked as interlaced.
  12681. @end table
  12682. Default value is @samp{all}.
  12683. @end table
  12684. @section waveform
  12685. Video waveform monitor.
  12686. The waveform monitor plots color component intensity. By default luminance
  12687. only. Each column of the waveform corresponds to a column of pixels in the
  12688. source video.
  12689. It accepts the following options:
  12690. @table @option
  12691. @item mode, m
  12692. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12693. In row mode, the graph on the left side represents color component value 0 and
  12694. the right side represents value = 255. In column mode, the top side represents
  12695. color component value = 0 and bottom side represents value = 255.
  12696. @item intensity, i
  12697. Set intensity. Smaller values are useful to find out how many values of the same
  12698. luminance are distributed across input rows/columns.
  12699. Default value is @code{0.04}. Allowed range is [0, 1].
  12700. @item mirror, r
  12701. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12702. In mirrored mode, higher values will be represented on the left
  12703. side for @code{row} mode and at the top for @code{column} mode. Default is
  12704. @code{1} (mirrored).
  12705. @item display, d
  12706. Set display mode.
  12707. It accepts the following values:
  12708. @table @samp
  12709. @item overlay
  12710. Presents information identical to that in the @code{parade}, except
  12711. that the graphs representing color components are superimposed directly
  12712. over one another.
  12713. This display mode makes it easier to spot relative differences or similarities
  12714. in overlapping areas of the color components that are supposed to be identical,
  12715. such as neutral whites, grays, or blacks.
  12716. @item stack
  12717. Display separate graph for the color components side by side in
  12718. @code{row} mode or one below the other in @code{column} mode.
  12719. @item parade
  12720. Display separate graph for the color components side by side in
  12721. @code{column} mode or one below the other in @code{row} mode.
  12722. Using this display mode makes it easy to spot color casts in the highlights
  12723. and shadows of an image, by comparing the contours of the top and the bottom
  12724. graphs of each waveform. Since whites, grays, and blacks are characterized
  12725. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12726. should display three waveforms of roughly equal width/height. If not, the
  12727. correction is easy to perform by making level adjustments the three waveforms.
  12728. @end table
  12729. Default is @code{stack}.
  12730. @item components, c
  12731. Set which color components to display. Default is 1, which means only luminance
  12732. or red color component if input is in RGB colorspace. If is set for example to
  12733. 7 it will display all 3 (if) available color components.
  12734. @item envelope, e
  12735. @table @samp
  12736. @item none
  12737. No envelope, this is default.
  12738. @item instant
  12739. Instant envelope, minimum and maximum values presented in graph will be easily
  12740. visible even with small @code{step} value.
  12741. @item peak
  12742. Hold minimum and maximum values presented in graph across time. This way you
  12743. can still spot out of range values without constantly looking at waveforms.
  12744. @item peak+instant
  12745. Peak and instant envelope combined together.
  12746. @end table
  12747. @item filter, f
  12748. @table @samp
  12749. @item lowpass
  12750. No filtering, this is default.
  12751. @item flat
  12752. Luma and chroma combined together.
  12753. @item aflat
  12754. Similar as above, but shows difference between blue and red chroma.
  12755. @item xflat
  12756. Similar as above, but use different colors.
  12757. @item chroma
  12758. Displays only chroma.
  12759. @item color
  12760. Displays actual color value on waveform.
  12761. @item acolor
  12762. Similar as above, but with luma showing frequency of chroma values.
  12763. @end table
  12764. @item graticule, g
  12765. Set which graticule to display.
  12766. @table @samp
  12767. @item none
  12768. Do not display graticule.
  12769. @item green
  12770. Display green graticule showing legal broadcast ranges.
  12771. @item orange
  12772. Display orange graticule showing legal broadcast ranges.
  12773. @end table
  12774. @item opacity, o
  12775. Set graticule opacity.
  12776. @item flags, fl
  12777. Set graticule flags.
  12778. @table @samp
  12779. @item numbers
  12780. Draw numbers above lines. By default enabled.
  12781. @item dots
  12782. Draw dots instead of lines.
  12783. @end table
  12784. @item scale, s
  12785. Set scale used for displaying graticule.
  12786. @table @samp
  12787. @item digital
  12788. @item millivolts
  12789. @item ire
  12790. @end table
  12791. Default is digital.
  12792. @item bgopacity, b
  12793. Set background opacity.
  12794. @end table
  12795. @section weave, doubleweave
  12796. The @code{weave} takes a field-based video input and join
  12797. each two sequential fields into single frame, producing a new double
  12798. height clip with half the frame rate and half the frame count.
  12799. The @code{doubleweave} works same as @code{weave} but without
  12800. halving frame rate and frame count.
  12801. It accepts the following option:
  12802. @table @option
  12803. @item first_field
  12804. Set first field. Available values are:
  12805. @table @samp
  12806. @item top, t
  12807. Set the frame as top-field-first.
  12808. @item bottom, b
  12809. Set the frame as bottom-field-first.
  12810. @end table
  12811. @end table
  12812. @subsection Examples
  12813. @itemize
  12814. @item
  12815. Interlace video using @ref{select} and @ref{separatefields} filter:
  12816. @example
  12817. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12818. @end example
  12819. @end itemize
  12820. @section xbr
  12821. Apply the xBR high-quality magnification filter which is designed for pixel
  12822. art. It follows a set of edge-detection rules, see
  12823. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12824. It accepts the following option:
  12825. @table @option
  12826. @item n
  12827. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12828. @code{3xBR} and @code{4} for @code{4xBR}.
  12829. Default is @code{3}.
  12830. @end table
  12831. @anchor{yadif}
  12832. @section yadif
  12833. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12834. filter").
  12835. It accepts the following parameters:
  12836. @table @option
  12837. @item mode
  12838. The interlacing mode to adopt. It accepts one of the following values:
  12839. @table @option
  12840. @item 0, send_frame
  12841. Output one frame for each frame.
  12842. @item 1, send_field
  12843. Output one frame for each field.
  12844. @item 2, send_frame_nospatial
  12845. Like @code{send_frame}, but it skips the spatial interlacing check.
  12846. @item 3, send_field_nospatial
  12847. Like @code{send_field}, but it skips the spatial interlacing check.
  12848. @end table
  12849. The default value is @code{send_frame}.
  12850. @item parity
  12851. The picture field parity assumed for the input interlaced video. It accepts one
  12852. of the following values:
  12853. @table @option
  12854. @item 0, tff
  12855. Assume the top field is first.
  12856. @item 1, bff
  12857. Assume the bottom field is first.
  12858. @item -1, auto
  12859. Enable automatic detection of field parity.
  12860. @end table
  12861. The default value is @code{auto}.
  12862. If the interlacing is unknown or the decoder does not export this information,
  12863. top field first will be assumed.
  12864. @item deint
  12865. Specify which frames to deinterlace. Accept one of the following
  12866. values:
  12867. @table @option
  12868. @item 0, all
  12869. Deinterlace all frames.
  12870. @item 1, interlaced
  12871. Only deinterlace frames marked as interlaced.
  12872. @end table
  12873. The default value is @code{all}.
  12874. @end table
  12875. @section zoompan
  12876. Apply Zoom & Pan effect.
  12877. This filter accepts the following options:
  12878. @table @option
  12879. @item zoom, z
  12880. Set the zoom expression. Default is 1.
  12881. @item x
  12882. @item y
  12883. Set the x and y expression. Default is 0.
  12884. @item d
  12885. Set the duration expression in number of frames.
  12886. This sets for how many number of frames effect will last for
  12887. single input image.
  12888. @item s
  12889. Set the output image size, default is 'hd720'.
  12890. @item fps
  12891. Set the output frame rate, default is '25'.
  12892. @end table
  12893. Each expression can contain the following constants:
  12894. @table @option
  12895. @item in_w, iw
  12896. Input width.
  12897. @item in_h, ih
  12898. Input height.
  12899. @item out_w, ow
  12900. Output width.
  12901. @item out_h, oh
  12902. Output height.
  12903. @item in
  12904. Input frame count.
  12905. @item on
  12906. Output frame count.
  12907. @item x
  12908. @item y
  12909. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12910. for current input frame.
  12911. @item px
  12912. @item py
  12913. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12914. not yet such frame (first input frame).
  12915. @item zoom
  12916. Last calculated zoom from 'z' expression for current input frame.
  12917. @item pzoom
  12918. Last calculated zoom of last output frame of previous input frame.
  12919. @item duration
  12920. Number of output frames for current input frame. Calculated from 'd' expression
  12921. for each input frame.
  12922. @item pduration
  12923. number of output frames created for previous input frame
  12924. @item a
  12925. Rational number: input width / input height
  12926. @item sar
  12927. sample aspect ratio
  12928. @item dar
  12929. display aspect ratio
  12930. @end table
  12931. @subsection Examples
  12932. @itemize
  12933. @item
  12934. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12935. @example
  12936. 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
  12937. @end example
  12938. @item
  12939. Zoom-in up to 1.5 and pan always at center of picture:
  12940. @example
  12941. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12942. @end example
  12943. @item
  12944. Same as above but without pausing:
  12945. @example
  12946. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12947. @end example
  12948. @end itemize
  12949. @anchor{zscale}
  12950. @section zscale
  12951. Scale (resize) the input video, using the z.lib library:
  12952. https://github.com/sekrit-twc/zimg.
  12953. The zscale filter forces the output display aspect ratio to be the same
  12954. as the input, by changing the output sample aspect ratio.
  12955. If the input image format is different from the format requested by
  12956. the next filter, the zscale filter will convert the input to the
  12957. requested format.
  12958. @subsection Options
  12959. The filter accepts the following options.
  12960. @table @option
  12961. @item width, w
  12962. @item height, h
  12963. Set the output video dimension expression. Default value is the input
  12964. dimension.
  12965. If the @var{width} or @var{w} value is 0, the input width is used for
  12966. the output. If the @var{height} or @var{h} value is 0, the input height
  12967. is used for the output.
  12968. If one and only one of the values is -n with n >= 1, the zscale filter
  12969. will use a value that maintains the aspect ratio of the input image,
  12970. calculated from the other specified dimension. After that it will,
  12971. however, make sure that the calculated dimension is divisible by n and
  12972. adjust the value if necessary.
  12973. If both values are -n with n >= 1, the behavior will be identical to
  12974. both values being set to 0 as previously detailed.
  12975. See below for the list of accepted constants for use in the dimension
  12976. expression.
  12977. @item size, s
  12978. Set the video size. For the syntax of this option, check the
  12979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12980. @item dither, d
  12981. Set the dither type.
  12982. Possible values are:
  12983. @table @var
  12984. @item none
  12985. @item ordered
  12986. @item random
  12987. @item error_diffusion
  12988. @end table
  12989. Default is none.
  12990. @item filter, f
  12991. Set the resize filter type.
  12992. Possible values are:
  12993. @table @var
  12994. @item point
  12995. @item bilinear
  12996. @item bicubic
  12997. @item spline16
  12998. @item spline36
  12999. @item lanczos
  13000. @end table
  13001. Default is bilinear.
  13002. @item range, r
  13003. Set the color range.
  13004. Possible values are:
  13005. @table @var
  13006. @item input
  13007. @item limited
  13008. @item full
  13009. @end table
  13010. Default is same as input.
  13011. @item primaries, p
  13012. Set the color primaries.
  13013. Possible values are:
  13014. @table @var
  13015. @item input
  13016. @item 709
  13017. @item unspecified
  13018. @item 170m
  13019. @item 240m
  13020. @item 2020
  13021. @end table
  13022. Default is same as input.
  13023. @item transfer, t
  13024. Set the transfer characteristics.
  13025. Possible values are:
  13026. @table @var
  13027. @item input
  13028. @item 709
  13029. @item unspecified
  13030. @item 601
  13031. @item linear
  13032. @item 2020_10
  13033. @item 2020_12
  13034. @item smpte2084
  13035. @item iec61966-2-1
  13036. @item arib-std-b67
  13037. @end table
  13038. Default is same as input.
  13039. @item matrix, m
  13040. Set the colorspace matrix.
  13041. Possible value are:
  13042. @table @var
  13043. @item input
  13044. @item 709
  13045. @item unspecified
  13046. @item 470bg
  13047. @item 170m
  13048. @item 2020_ncl
  13049. @item 2020_cl
  13050. @end table
  13051. Default is same as input.
  13052. @item rangein, rin
  13053. Set the input color range.
  13054. Possible values are:
  13055. @table @var
  13056. @item input
  13057. @item limited
  13058. @item full
  13059. @end table
  13060. Default is same as input.
  13061. @item primariesin, pin
  13062. Set the input color primaries.
  13063. Possible values are:
  13064. @table @var
  13065. @item input
  13066. @item 709
  13067. @item unspecified
  13068. @item 170m
  13069. @item 240m
  13070. @item 2020
  13071. @end table
  13072. Default is same as input.
  13073. @item transferin, tin
  13074. Set the input transfer characteristics.
  13075. Possible values are:
  13076. @table @var
  13077. @item input
  13078. @item 709
  13079. @item unspecified
  13080. @item 601
  13081. @item linear
  13082. @item 2020_10
  13083. @item 2020_12
  13084. @end table
  13085. Default is same as input.
  13086. @item matrixin, min
  13087. Set the input colorspace matrix.
  13088. Possible value are:
  13089. @table @var
  13090. @item input
  13091. @item 709
  13092. @item unspecified
  13093. @item 470bg
  13094. @item 170m
  13095. @item 2020_ncl
  13096. @item 2020_cl
  13097. @end table
  13098. @item chromal, c
  13099. Set the output chroma location.
  13100. Possible values are:
  13101. @table @var
  13102. @item input
  13103. @item left
  13104. @item center
  13105. @item topleft
  13106. @item top
  13107. @item bottomleft
  13108. @item bottom
  13109. @end table
  13110. @item chromalin, cin
  13111. Set the input chroma location.
  13112. Possible values are:
  13113. @table @var
  13114. @item input
  13115. @item left
  13116. @item center
  13117. @item topleft
  13118. @item top
  13119. @item bottomleft
  13120. @item bottom
  13121. @end table
  13122. @item npl
  13123. Set the nominal peak luminance.
  13124. @end table
  13125. The values of the @option{w} and @option{h} options are expressions
  13126. containing the following constants:
  13127. @table @var
  13128. @item in_w
  13129. @item in_h
  13130. The input width and height
  13131. @item iw
  13132. @item ih
  13133. These are the same as @var{in_w} and @var{in_h}.
  13134. @item out_w
  13135. @item out_h
  13136. The output (scaled) width and height
  13137. @item ow
  13138. @item oh
  13139. These are the same as @var{out_w} and @var{out_h}
  13140. @item a
  13141. The same as @var{iw} / @var{ih}
  13142. @item sar
  13143. input sample aspect ratio
  13144. @item dar
  13145. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13146. @item hsub
  13147. @item vsub
  13148. horizontal and vertical input chroma subsample values. For example for the
  13149. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13150. @item ohsub
  13151. @item ovsub
  13152. horizontal and vertical output chroma subsample values. For example for the
  13153. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13154. @end table
  13155. @table @option
  13156. @end table
  13157. @c man end VIDEO FILTERS
  13158. @chapter Video Sources
  13159. @c man begin VIDEO SOURCES
  13160. Below is a description of the currently available video sources.
  13161. @section buffer
  13162. Buffer video frames, and make them available to the filter chain.
  13163. This source is mainly intended for a programmatic use, in particular
  13164. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13165. It accepts the following parameters:
  13166. @table @option
  13167. @item video_size
  13168. Specify the size (width and height) of the buffered video frames. For the
  13169. syntax of this option, check the
  13170. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13171. @item width
  13172. The input video width.
  13173. @item height
  13174. The input video height.
  13175. @item pix_fmt
  13176. A string representing the pixel format of the buffered video frames.
  13177. It may be a number corresponding to a pixel format, or a pixel format
  13178. name.
  13179. @item time_base
  13180. Specify the timebase assumed by the timestamps of the buffered frames.
  13181. @item frame_rate
  13182. Specify the frame rate expected for the video stream.
  13183. @item pixel_aspect, sar
  13184. The sample (pixel) aspect ratio of the input video.
  13185. @item sws_param
  13186. Specify the optional parameters to be used for the scale filter which
  13187. is automatically inserted when an input change is detected in the
  13188. input size or format.
  13189. @item hw_frames_ctx
  13190. When using a hardware pixel format, this should be a reference to an
  13191. AVHWFramesContext describing input frames.
  13192. @end table
  13193. For example:
  13194. @example
  13195. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13196. @end example
  13197. will instruct the source to accept video frames with size 320x240 and
  13198. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13199. square pixels (1:1 sample aspect ratio).
  13200. Since the pixel format with name "yuv410p" corresponds to the number 6
  13201. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13202. this example corresponds to:
  13203. @example
  13204. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13205. @end example
  13206. Alternatively, the options can be specified as a flat string, but this
  13207. syntax is deprecated:
  13208. @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}]
  13209. @section cellauto
  13210. Create a pattern generated by an elementary cellular automaton.
  13211. The initial state of the cellular automaton can be defined through the
  13212. @option{filename} and @option{pattern} options. If such options are
  13213. not specified an initial state is created randomly.
  13214. At each new frame a new row in the video is filled with the result of
  13215. the cellular automaton next generation. The behavior when the whole
  13216. frame is filled is defined by the @option{scroll} option.
  13217. This source accepts the following options:
  13218. @table @option
  13219. @item filename, f
  13220. Read the initial cellular automaton state, i.e. the starting row, from
  13221. the specified file.
  13222. In the file, each non-whitespace character is considered an alive
  13223. cell, a newline will terminate the row, and further characters in the
  13224. file will be ignored.
  13225. @item pattern, p
  13226. Read the initial cellular automaton state, i.e. the starting row, from
  13227. the specified string.
  13228. Each non-whitespace character in the string is considered an alive
  13229. cell, a newline will terminate the row, and further characters in the
  13230. string will be ignored.
  13231. @item rate, r
  13232. Set the video rate, that is the number of frames generated per second.
  13233. Default is 25.
  13234. @item random_fill_ratio, ratio
  13235. Set the random fill ratio for the initial cellular automaton row. It
  13236. is a floating point number value ranging from 0 to 1, defaults to
  13237. 1/PHI.
  13238. This option is ignored when a file or a pattern is specified.
  13239. @item random_seed, seed
  13240. Set the seed for filling randomly the initial row, must be an integer
  13241. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13242. set to -1, the filter will try to use a good random seed on a best
  13243. effort basis.
  13244. @item rule
  13245. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13246. Default value is 110.
  13247. @item size, s
  13248. Set the size of the output video. For the syntax of this option, check the
  13249. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13250. If @option{filename} or @option{pattern} is specified, the size is set
  13251. by default to the width of the specified initial state row, and the
  13252. height is set to @var{width} * PHI.
  13253. If @option{size} is set, it must contain the width of the specified
  13254. pattern string, and the specified pattern will be centered in the
  13255. larger row.
  13256. If a filename or a pattern string is not specified, the size value
  13257. defaults to "320x518" (used for a randomly generated initial state).
  13258. @item scroll
  13259. If set to 1, scroll the output upward when all the rows in the output
  13260. have been already filled. If set to 0, the new generated row will be
  13261. written over the top row just after the bottom row is filled.
  13262. Defaults to 1.
  13263. @item start_full, full
  13264. If set to 1, completely fill the output with generated rows before
  13265. outputting the first frame.
  13266. This is the default behavior, for disabling set the value to 0.
  13267. @item stitch
  13268. If set to 1, stitch the left and right row edges together.
  13269. This is the default behavior, for disabling set the value to 0.
  13270. @end table
  13271. @subsection Examples
  13272. @itemize
  13273. @item
  13274. Read the initial state from @file{pattern}, and specify an output of
  13275. size 200x400.
  13276. @example
  13277. cellauto=f=pattern:s=200x400
  13278. @end example
  13279. @item
  13280. Generate a random initial row with a width of 200 cells, with a fill
  13281. ratio of 2/3:
  13282. @example
  13283. cellauto=ratio=2/3:s=200x200
  13284. @end example
  13285. @item
  13286. Create a pattern generated by rule 18 starting by a single alive cell
  13287. centered on an initial row with width 100:
  13288. @example
  13289. cellauto=p=@@:s=100x400:full=0:rule=18
  13290. @end example
  13291. @item
  13292. Specify a more elaborated initial pattern:
  13293. @example
  13294. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13295. @end example
  13296. @end itemize
  13297. @anchor{coreimagesrc}
  13298. @section coreimagesrc
  13299. Video source generated on GPU using Apple's CoreImage API on OSX.
  13300. This video source is a specialized version of the @ref{coreimage} video filter.
  13301. Use a core image generator at the beginning of the applied filterchain to
  13302. generate the content.
  13303. The coreimagesrc video source accepts the following options:
  13304. @table @option
  13305. @item list_generators
  13306. List all available generators along with all their respective options as well as
  13307. possible minimum and maximum values along with the default values.
  13308. @example
  13309. list_generators=true
  13310. @end example
  13311. @item size, s
  13312. Specify the size of the sourced video. For the syntax of this option, check the
  13313. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13314. The default value is @code{320x240}.
  13315. @item rate, r
  13316. Specify the frame rate of the sourced video, as the number of frames
  13317. generated per second. It has to be a string in the format
  13318. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13319. number or a valid video frame rate abbreviation. The default value is
  13320. "25".
  13321. @item sar
  13322. Set the sample aspect ratio of the sourced video.
  13323. @item duration, d
  13324. Set the duration of the sourced video. See
  13325. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13326. for the accepted syntax.
  13327. If not specified, or the expressed duration is negative, the video is
  13328. supposed to be generated forever.
  13329. @end table
  13330. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13331. A complete filterchain can be used for further processing of the
  13332. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13333. and examples for details.
  13334. @subsection Examples
  13335. @itemize
  13336. @item
  13337. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13338. given as complete and escaped command-line for Apple's standard bash shell:
  13339. @example
  13340. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13341. @end example
  13342. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13343. need for a nullsrc video source.
  13344. @end itemize
  13345. @section mandelbrot
  13346. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13347. point specified with @var{start_x} and @var{start_y}.
  13348. This source accepts the following options:
  13349. @table @option
  13350. @item end_pts
  13351. Set the terminal pts value. Default value is 400.
  13352. @item end_scale
  13353. Set the terminal scale value.
  13354. Must be a floating point value. Default value is 0.3.
  13355. @item inner
  13356. Set the inner coloring mode, that is the algorithm used to draw the
  13357. Mandelbrot fractal internal region.
  13358. It shall assume one of the following values:
  13359. @table @option
  13360. @item black
  13361. Set black mode.
  13362. @item convergence
  13363. Show time until convergence.
  13364. @item mincol
  13365. Set color based on point closest to the origin of the iterations.
  13366. @item period
  13367. Set period mode.
  13368. @end table
  13369. Default value is @var{mincol}.
  13370. @item bailout
  13371. Set the bailout value. Default value is 10.0.
  13372. @item maxiter
  13373. Set the maximum of iterations performed by the rendering
  13374. algorithm. Default value is 7189.
  13375. @item outer
  13376. Set outer coloring mode.
  13377. It shall assume one of following values:
  13378. @table @option
  13379. @item iteration_count
  13380. Set iteration cound mode.
  13381. @item normalized_iteration_count
  13382. set normalized iteration count mode.
  13383. @end table
  13384. Default value is @var{normalized_iteration_count}.
  13385. @item rate, r
  13386. Set frame rate, expressed as number of frames per second. Default
  13387. value is "25".
  13388. @item size, s
  13389. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13390. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13391. @item start_scale
  13392. Set the initial scale value. Default value is 3.0.
  13393. @item start_x
  13394. Set the initial x position. Must be a floating point value between
  13395. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13396. @item start_y
  13397. Set the initial y position. Must be a floating point value between
  13398. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13399. @end table
  13400. @section mptestsrc
  13401. Generate various test patterns, as generated by the MPlayer test filter.
  13402. The size of the generated video is fixed, and is 256x256.
  13403. This source is useful in particular for testing encoding features.
  13404. This source accepts the following options:
  13405. @table @option
  13406. @item rate, r
  13407. Specify the frame rate of the sourced video, as the number of frames
  13408. generated per second. It has to be a string in the format
  13409. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13410. number or a valid video frame rate abbreviation. The default value is
  13411. "25".
  13412. @item duration, d
  13413. Set the duration of the sourced video. See
  13414. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13415. for the accepted syntax.
  13416. If not specified, or the expressed duration is negative, the video is
  13417. supposed to be generated forever.
  13418. @item test, t
  13419. Set the number or the name of the test to perform. Supported tests are:
  13420. @table @option
  13421. @item dc_luma
  13422. @item dc_chroma
  13423. @item freq_luma
  13424. @item freq_chroma
  13425. @item amp_luma
  13426. @item amp_chroma
  13427. @item cbp
  13428. @item mv
  13429. @item ring1
  13430. @item ring2
  13431. @item all
  13432. @end table
  13433. Default value is "all", which will cycle through the list of all tests.
  13434. @end table
  13435. Some examples:
  13436. @example
  13437. mptestsrc=t=dc_luma
  13438. @end example
  13439. will generate a "dc_luma" test pattern.
  13440. @section frei0r_src
  13441. Provide a frei0r source.
  13442. To enable compilation of this filter you need to install the frei0r
  13443. header and configure FFmpeg with @code{--enable-frei0r}.
  13444. This source accepts the following parameters:
  13445. @table @option
  13446. @item size
  13447. The size of the video to generate. For the syntax of this option, check the
  13448. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13449. @item framerate
  13450. The framerate of the generated video. It may be a string of the form
  13451. @var{num}/@var{den} or a frame rate abbreviation.
  13452. @item filter_name
  13453. The name to the frei0r source to load. For more information regarding frei0r and
  13454. how to set the parameters, read the @ref{frei0r} section in the video filters
  13455. documentation.
  13456. @item filter_params
  13457. A '|'-separated list of parameters to pass to the frei0r source.
  13458. @end table
  13459. For example, to generate a frei0r partik0l source with size 200x200
  13460. and frame rate 10 which is overlaid on the overlay filter main input:
  13461. @example
  13462. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13463. @end example
  13464. @section life
  13465. Generate a life pattern.
  13466. This source is based on a generalization of John Conway's life game.
  13467. The sourced input represents a life grid, each pixel represents a cell
  13468. which can be in one of two possible states, alive or dead. Every cell
  13469. interacts with its eight neighbours, which are the cells that are
  13470. horizontally, vertically, or diagonally adjacent.
  13471. At each interaction the grid evolves according to the adopted rule,
  13472. which specifies the number of neighbor alive cells which will make a
  13473. cell stay alive or born. The @option{rule} option allows one to specify
  13474. the rule to adopt.
  13475. This source accepts the following options:
  13476. @table @option
  13477. @item filename, f
  13478. Set the file from which to read the initial grid state. In the file,
  13479. each non-whitespace character is considered an alive cell, and newline
  13480. is used to delimit the end of each row.
  13481. If this option is not specified, the initial grid is generated
  13482. randomly.
  13483. @item rate, r
  13484. Set the video rate, that is the number of frames generated per second.
  13485. Default is 25.
  13486. @item random_fill_ratio, ratio
  13487. Set the random fill ratio for the initial random grid. It is a
  13488. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13489. It is ignored when a file is specified.
  13490. @item random_seed, seed
  13491. Set the seed for filling the initial random grid, must be an integer
  13492. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13493. set to -1, the filter will try to use a good random seed on a best
  13494. effort basis.
  13495. @item rule
  13496. Set the life rule.
  13497. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13498. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13499. @var{NS} specifies the number of alive neighbor cells which make a
  13500. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13501. which make a dead cell to become alive (i.e. to "born").
  13502. "s" and "b" can be used in place of "S" and "B", respectively.
  13503. Alternatively a rule can be specified by an 18-bits integer. The 9
  13504. high order bits are used to encode the next cell state if it is alive
  13505. for each number of neighbor alive cells, the low order bits specify
  13506. the rule for "borning" new cells. Higher order bits encode for an
  13507. higher number of neighbor cells.
  13508. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13509. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13510. Default value is "S23/B3", which is the original Conway's game of life
  13511. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13512. cells, and will born a new cell if there are three alive cells around
  13513. a dead cell.
  13514. @item size, s
  13515. Set the size of the output video. For the syntax of this option, check the
  13516. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13517. If @option{filename} is specified, the size is set by default to the
  13518. same size of the input file. If @option{size} is set, it must contain
  13519. the size specified in the input file, and the initial grid defined in
  13520. that file is centered in the larger resulting area.
  13521. If a filename is not specified, the size value defaults to "320x240"
  13522. (used for a randomly generated initial grid).
  13523. @item stitch
  13524. If set to 1, stitch the left and right grid edges together, and the
  13525. top and bottom edges also. Defaults to 1.
  13526. @item mold
  13527. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13528. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13529. value from 0 to 255.
  13530. @item life_color
  13531. Set the color of living (or new born) cells.
  13532. @item death_color
  13533. Set the color of dead cells. If @option{mold} is set, this is the first color
  13534. used to represent a dead cell.
  13535. @item mold_color
  13536. Set mold color, for definitely dead and moldy cells.
  13537. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13538. ffmpeg-utils manual,ffmpeg-utils}.
  13539. @end table
  13540. @subsection Examples
  13541. @itemize
  13542. @item
  13543. Read a grid from @file{pattern}, and center it on a grid of size
  13544. 300x300 pixels:
  13545. @example
  13546. life=f=pattern:s=300x300
  13547. @end example
  13548. @item
  13549. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13550. @example
  13551. life=ratio=2/3:s=200x200
  13552. @end example
  13553. @item
  13554. Specify a custom rule for evolving a randomly generated grid:
  13555. @example
  13556. life=rule=S14/B34
  13557. @end example
  13558. @item
  13559. Full example with slow death effect (mold) using @command{ffplay}:
  13560. @example
  13561. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13562. @end example
  13563. @end itemize
  13564. @anchor{allrgb}
  13565. @anchor{allyuv}
  13566. @anchor{color}
  13567. @anchor{haldclutsrc}
  13568. @anchor{nullsrc}
  13569. @anchor{rgbtestsrc}
  13570. @anchor{smptebars}
  13571. @anchor{smptehdbars}
  13572. @anchor{testsrc}
  13573. @anchor{testsrc2}
  13574. @anchor{yuvtestsrc}
  13575. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13576. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13577. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13578. The @code{color} source provides an uniformly colored input.
  13579. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13580. @ref{haldclut} filter.
  13581. The @code{nullsrc} source returns unprocessed video frames. It is
  13582. mainly useful to be employed in analysis / debugging tools, or as the
  13583. source for filters which ignore the input data.
  13584. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13585. detecting RGB vs BGR issues. You should see a red, green and blue
  13586. stripe from top to bottom.
  13587. The @code{smptebars} source generates a color bars pattern, based on
  13588. the SMPTE Engineering Guideline EG 1-1990.
  13589. The @code{smptehdbars} source generates a color bars pattern, based on
  13590. the SMPTE RP 219-2002.
  13591. The @code{testsrc} source generates a test video pattern, showing a
  13592. color pattern, a scrolling gradient and a timestamp. This is mainly
  13593. intended for testing purposes.
  13594. The @code{testsrc2} source is similar to testsrc, but supports more
  13595. pixel formats instead of just @code{rgb24}. This allows using it as an
  13596. input for other tests without requiring a format conversion.
  13597. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13598. see a y, cb and cr stripe from top to bottom.
  13599. The sources accept the following parameters:
  13600. @table @option
  13601. @item level
  13602. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13603. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13604. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13605. coded on a @code{1/(N*N)} scale.
  13606. @item color, c
  13607. Specify the color of the source, only available in the @code{color}
  13608. source. For the syntax of this option, check the
  13609. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13610. @item size, s
  13611. Specify the size of the sourced video. For the syntax of this option, check the
  13612. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13613. The default value is @code{320x240}.
  13614. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13615. @code{haldclutsrc} filters.
  13616. @item rate, r
  13617. Specify the frame rate of the sourced video, as the number of frames
  13618. generated per second. It has to be a string in the format
  13619. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13620. number or a valid video frame rate abbreviation. The default value is
  13621. "25".
  13622. @item duration, d
  13623. Set the duration of the sourced video. See
  13624. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13625. for the accepted syntax.
  13626. If not specified, or the expressed duration is negative, the video is
  13627. supposed to be generated forever.
  13628. @item sar
  13629. Set the sample aspect ratio of the sourced video.
  13630. @item alpha
  13631. Specify the alpha (opacity) of the background, only available in the
  13632. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13633. 255 (fully opaque, the default).
  13634. @item decimals, n
  13635. Set the number of decimals to show in the timestamp, only available in the
  13636. @code{testsrc} source.
  13637. The displayed timestamp value will correspond to the original
  13638. timestamp value multiplied by the power of 10 of the specified
  13639. value. Default value is 0.
  13640. @end table
  13641. @subsection Examples
  13642. @itemize
  13643. @item
  13644. Generate a video with a duration of 5.3 seconds, with size
  13645. 176x144 and a frame rate of 10 frames per second:
  13646. @example
  13647. testsrc=duration=5.3:size=qcif:rate=10
  13648. @end example
  13649. @item
  13650. The following graph description will generate a red source
  13651. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13652. frames per second:
  13653. @example
  13654. color=c=red@@0.2:s=qcif:r=10
  13655. @end example
  13656. @item
  13657. If the input content is to be ignored, @code{nullsrc} can be used. The
  13658. following command generates noise in the luminance plane by employing
  13659. the @code{geq} filter:
  13660. @example
  13661. nullsrc=s=256x256, geq=random(1)*255:128:128
  13662. @end example
  13663. @end itemize
  13664. @subsection Commands
  13665. The @code{color} source supports the following commands:
  13666. @table @option
  13667. @item c, color
  13668. Set the color of the created image. Accepts the same syntax of the
  13669. corresponding @option{color} option.
  13670. @end table
  13671. @section openclsrc
  13672. Generate video using an OpenCL program.
  13673. @table @option
  13674. @item source
  13675. OpenCL program source file.
  13676. @item kernel
  13677. Kernel name in program.
  13678. @item size, s
  13679. Size of frames to generate. This must be set.
  13680. @item format
  13681. Pixel format to use for the generated frames. This must be set.
  13682. @item rate, r
  13683. Number of frames generated every second. Default value is '25'.
  13684. @end table
  13685. For details of how the program loading works, see the @ref{program_opencl}
  13686. filter.
  13687. Example programs:
  13688. @itemize
  13689. @item
  13690. Generate a colour ramp by setting pixel values from the position of the pixel
  13691. in the output image. (Note that this will work with all pixel formats, but
  13692. the generated output will not be the same.)
  13693. @verbatim
  13694. __kernel void ramp(__write_only image2d_t dst,
  13695. unsigned int index)
  13696. {
  13697. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13698. float4 val;
  13699. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13700. write_imagef(dst, loc, val);
  13701. }
  13702. @end verbatim
  13703. @item
  13704. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13705. @verbatim
  13706. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13707. unsigned int index)
  13708. {
  13709. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13710. float4 value = 0.0f;
  13711. int x = loc.x + index;
  13712. int y = loc.y + index;
  13713. while (x > 0 || y > 0) {
  13714. if (x % 3 == 1 && y % 3 == 1) {
  13715. value = 1.0f;
  13716. break;
  13717. }
  13718. x /= 3;
  13719. y /= 3;
  13720. }
  13721. write_imagef(dst, loc, value);
  13722. }
  13723. @end verbatim
  13724. @end itemize
  13725. @c man end VIDEO SOURCES
  13726. @chapter Video Sinks
  13727. @c man begin VIDEO SINKS
  13728. Below is a description of the currently available video sinks.
  13729. @section buffersink
  13730. Buffer video frames, and make them available to the end of the filter
  13731. graph.
  13732. This sink is mainly intended for programmatic use, in particular
  13733. through the interface defined in @file{libavfilter/buffersink.h}
  13734. or the options system.
  13735. It accepts a pointer to an AVBufferSinkContext structure, which
  13736. defines the incoming buffers' formats, to be passed as the opaque
  13737. parameter to @code{avfilter_init_filter} for initialization.
  13738. @section nullsink
  13739. Null video sink: do absolutely nothing with the input video. It is
  13740. mainly useful as a template and for use in analysis / debugging
  13741. tools.
  13742. @c man end VIDEO SINKS
  13743. @chapter Multimedia Filters
  13744. @c man begin MULTIMEDIA FILTERS
  13745. Below is a description of the currently available multimedia filters.
  13746. @section abitscope
  13747. Convert input audio to a video output, displaying the audio bit scope.
  13748. The filter accepts the following options:
  13749. @table @option
  13750. @item rate, r
  13751. Set frame rate, expressed as number of frames per second. Default
  13752. value is "25".
  13753. @item size, s
  13754. Specify the video size for the output. For the syntax of this option, check the
  13755. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13756. Default value is @code{1024x256}.
  13757. @item colors
  13758. Specify list of colors separated by space or by '|' which will be used to
  13759. draw channels. Unrecognized or missing colors will be replaced
  13760. by white color.
  13761. @end table
  13762. @section ahistogram
  13763. Convert input audio to a video output, displaying the volume histogram.
  13764. The filter accepts the following options:
  13765. @table @option
  13766. @item dmode
  13767. Specify how histogram is calculated.
  13768. It accepts the following values:
  13769. @table @samp
  13770. @item single
  13771. Use single histogram for all channels.
  13772. @item separate
  13773. Use separate histogram for each channel.
  13774. @end table
  13775. Default is @code{single}.
  13776. @item rate, r
  13777. Set frame rate, expressed as number of frames per second. Default
  13778. value is "25".
  13779. @item size, s
  13780. Specify the video size for the output. For the syntax of this option, check the
  13781. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13782. Default value is @code{hd720}.
  13783. @item scale
  13784. Set display scale.
  13785. It accepts the following values:
  13786. @table @samp
  13787. @item log
  13788. logarithmic
  13789. @item sqrt
  13790. square root
  13791. @item cbrt
  13792. cubic root
  13793. @item lin
  13794. linear
  13795. @item rlog
  13796. reverse logarithmic
  13797. @end table
  13798. Default is @code{log}.
  13799. @item ascale
  13800. Set amplitude scale.
  13801. It accepts the following values:
  13802. @table @samp
  13803. @item log
  13804. logarithmic
  13805. @item lin
  13806. linear
  13807. @end table
  13808. Default is @code{log}.
  13809. @item acount
  13810. Set how much frames to accumulate in histogram.
  13811. Defauls is 1. Setting this to -1 accumulates all frames.
  13812. @item rheight
  13813. Set histogram ratio of window height.
  13814. @item slide
  13815. Set sonogram sliding.
  13816. It accepts the following values:
  13817. @table @samp
  13818. @item replace
  13819. replace old rows with new ones.
  13820. @item scroll
  13821. scroll from top to bottom.
  13822. @end table
  13823. Default is @code{replace}.
  13824. @end table
  13825. @section aphasemeter
  13826. Convert input audio to a video output, displaying the audio phase.
  13827. The filter accepts the following options:
  13828. @table @option
  13829. @item rate, r
  13830. Set the output frame rate. Default value is @code{25}.
  13831. @item size, s
  13832. Set the video size for the output. For the syntax of this option, check the
  13833. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13834. Default value is @code{800x400}.
  13835. @item rc
  13836. @item gc
  13837. @item bc
  13838. Specify the red, green, blue contrast. Default values are @code{2},
  13839. @code{7} and @code{1}.
  13840. Allowed range is @code{[0, 255]}.
  13841. @item mpc
  13842. Set color which will be used for drawing median phase. If color is
  13843. @code{none} which is default, no median phase value will be drawn.
  13844. @item video
  13845. Enable video output. Default is enabled.
  13846. @end table
  13847. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13848. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13849. The @code{-1} means left and right channels are completely out of phase and
  13850. @code{1} means channels are in phase.
  13851. @section avectorscope
  13852. Convert input audio to a video output, representing the audio vector
  13853. scope.
  13854. The filter is used to measure the difference between channels of stereo
  13855. audio stream. A monoaural signal, consisting of identical left and right
  13856. signal, results in straight vertical line. Any stereo separation is visible
  13857. as a deviation from this line, creating a Lissajous figure.
  13858. If the straight (or deviation from it) but horizontal line appears this
  13859. indicates that the left and right channels are out of phase.
  13860. The filter accepts the following options:
  13861. @table @option
  13862. @item mode, m
  13863. Set the vectorscope mode.
  13864. Available values are:
  13865. @table @samp
  13866. @item lissajous
  13867. Lissajous rotated by 45 degrees.
  13868. @item lissajous_xy
  13869. Same as above but not rotated.
  13870. @item polar
  13871. Shape resembling half of circle.
  13872. @end table
  13873. Default value is @samp{lissajous}.
  13874. @item size, s
  13875. Set the video size for the output. For the syntax of this option, check the
  13876. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13877. Default value is @code{400x400}.
  13878. @item rate, r
  13879. Set the output frame rate. Default value is @code{25}.
  13880. @item rc
  13881. @item gc
  13882. @item bc
  13883. @item ac
  13884. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13885. @code{160}, @code{80} and @code{255}.
  13886. Allowed range is @code{[0, 255]}.
  13887. @item rf
  13888. @item gf
  13889. @item bf
  13890. @item af
  13891. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13892. @code{10}, @code{5} and @code{5}.
  13893. Allowed range is @code{[0, 255]}.
  13894. @item zoom
  13895. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13896. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13897. @item draw
  13898. Set the vectorscope drawing mode.
  13899. Available values are:
  13900. @table @samp
  13901. @item dot
  13902. Draw dot for each sample.
  13903. @item line
  13904. Draw line between previous and current sample.
  13905. @end table
  13906. Default value is @samp{dot}.
  13907. @item scale
  13908. Specify amplitude scale of audio samples.
  13909. Available values are:
  13910. @table @samp
  13911. @item lin
  13912. Linear.
  13913. @item sqrt
  13914. Square root.
  13915. @item cbrt
  13916. Cubic root.
  13917. @item log
  13918. Logarithmic.
  13919. @end table
  13920. @item swap
  13921. Swap left channel axis with right channel axis.
  13922. @item mirror
  13923. Mirror axis.
  13924. @table @samp
  13925. @item none
  13926. No mirror.
  13927. @item x
  13928. Mirror only x axis.
  13929. @item y
  13930. Mirror only y axis.
  13931. @item xy
  13932. Mirror both axis.
  13933. @end table
  13934. @end table
  13935. @subsection Examples
  13936. @itemize
  13937. @item
  13938. Complete example using @command{ffplay}:
  13939. @example
  13940. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13941. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13942. @end example
  13943. @end itemize
  13944. @section bench, abench
  13945. Benchmark part of a filtergraph.
  13946. The filter accepts the following options:
  13947. @table @option
  13948. @item action
  13949. Start or stop a timer.
  13950. Available values are:
  13951. @table @samp
  13952. @item start
  13953. Get the current time, set it as frame metadata (using the key
  13954. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13955. @item stop
  13956. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13957. the input frame metadata to get the time difference. Time difference, average,
  13958. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13959. @code{min}) are then printed. The timestamps are expressed in seconds.
  13960. @end table
  13961. @end table
  13962. @subsection Examples
  13963. @itemize
  13964. @item
  13965. Benchmark @ref{selectivecolor} filter:
  13966. @example
  13967. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13968. @end example
  13969. @end itemize
  13970. @section concat
  13971. Concatenate audio and video streams, joining them together one after the
  13972. other.
  13973. The filter works on segments of synchronized video and audio streams. All
  13974. segments must have the same number of streams of each type, and that will
  13975. also be the number of streams at output.
  13976. The filter accepts the following options:
  13977. @table @option
  13978. @item n
  13979. Set the number of segments. Default is 2.
  13980. @item v
  13981. Set the number of output video streams, that is also the number of video
  13982. streams in each segment. Default is 1.
  13983. @item a
  13984. Set the number of output audio streams, that is also the number of audio
  13985. streams in each segment. Default is 0.
  13986. @item unsafe
  13987. Activate unsafe mode: do not fail if segments have a different format.
  13988. @end table
  13989. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13990. @var{a} audio outputs.
  13991. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13992. segment, in the same order as the outputs, then the inputs for the second
  13993. segment, etc.
  13994. Related streams do not always have exactly the same duration, for various
  13995. reasons including codec frame size or sloppy authoring. For that reason,
  13996. related synchronized streams (e.g. a video and its audio track) should be
  13997. concatenated at once. The concat filter will use the duration of the longest
  13998. stream in each segment (except the last one), and if necessary pad shorter
  13999. audio streams with silence.
  14000. For this filter to work correctly, all segments must start at timestamp 0.
  14001. All corresponding streams must have the same parameters in all segments; the
  14002. filtering system will automatically select a common pixel format for video
  14003. streams, and a common sample format, sample rate and channel layout for
  14004. audio streams, but other settings, such as resolution, must be converted
  14005. explicitly by the user.
  14006. Different frame rates are acceptable but will result in variable frame rate
  14007. at output; be sure to configure the output file to handle it.
  14008. @subsection Examples
  14009. @itemize
  14010. @item
  14011. Concatenate an opening, an episode and an ending, all in bilingual version
  14012. (video in stream 0, audio in streams 1 and 2):
  14013. @example
  14014. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14015. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14016. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14017. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14018. @end example
  14019. @item
  14020. Concatenate two parts, handling audio and video separately, using the
  14021. (a)movie sources, and adjusting the resolution:
  14022. @example
  14023. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14024. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14025. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14026. @end example
  14027. Note that a desync will happen at the stitch if the audio and video streams
  14028. do not have exactly the same duration in the first file.
  14029. @end itemize
  14030. @subsection Commands
  14031. This filter supports the following commands:
  14032. @table @option
  14033. @item next
  14034. Close the current segment and step to the next one
  14035. @end table
  14036. @section drawgraph, adrawgraph
  14037. Draw a graph using input video or audio metadata.
  14038. It accepts the following parameters:
  14039. @table @option
  14040. @item m1
  14041. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14042. @item fg1
  14043. Set 1st foreground color expression.
  14044. @item m2
  14045. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14046. @item fg2
  14047. Set 2nd foreground color expression.
  14048. @item m3
  14049. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14050. @item fg3
  14051. Set 3rd foreground color expression.
  14052. @item m4
  14053. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14054. @item fg4
  14055. Set 4th foreground color expression.
  14056. @item min
  14057. Set minimal value of metadata value.
  14058. @item max
  14059. Set maximal value of metadata value.
  14060. @item bg
  14061. Set graph background color. Default is white.
  14062. @item mode
  14063. Set graph mode.
  14064. Available values for mode is:
  14065. @table @samp
  14066. @item bar
  14067. @item dot
  14068. @item line
  14069. @end table
  14070. Default is @code{line}.
  14071. @item slide
  14072. Set slide mode.
  14073. Available values for slide is:
  14074. @table @samp
  14075. @item frame
  14076. Draw new frame when right border is reached.
  14077. @item replace
  14078. Replace old columns with new ones.
  14079. @item scroll
  14080. Scroll from right to left.
  14081. @item rscroll
  14082. Scroll from left to right.
  14083. @item picture
  14084. Draw single picture.
  14085. @end table
  14086. Default is @code{frame}.
  14087. @item size
  14088. Set size of graph video. For the syntax of this option, check the
  14089. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14090. The default value is @code{900x256}.
  14091. The foreground color expressions can use the following variables:
  14092. @table @option
  14093. @item MIN
  14094. Minimal value of metadata value.
  14095. @item MAX
  14096. Maximal value of metadata value.
  14097. @item VAL
  14098. Current metadata key value.
  14099. @end table
  14100. The color is defined as 0xAABBGGRR.
  14101. @end table
  14102. Example using metadata from @ref{signalstats} filter:
  14103. @example
  14104. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14105. @end example
  14106. Example using metadata from @ref{ebur128} filter:
  14107. @example
  14108. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14109. @end example
  14110. @anchor{ebur128}
  14111. @section ebur128
  14112. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14113. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14114. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14115. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14116. The filter also has a video output (see the @var{video} option) with a real
  14117. time graph to observe the loudness evolution. The graphic contains the logged
  14118. message mentioned above, so it is not printed anymore when this option is set,
  14119. unless the verbose logging is set. The main graphing area contains the
  14120. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14121. the momentary loudness (400 milliseconds).
  14122. More information about the Loudness Recommendation EBU R128 on
  14123. @url{http://tech.ebu.ch/loudness}.
  14124. The filter accepts the following options:
  14125. @table @option
  14126. @item video
  14127. Activate the video output. The audio stream is passed unchanged whether this
  14128. option is set or no. The video stream will be the first output stream if
  14129. activated. Default is @code{0}.
  14130. @item size
  14131. Set the video size. This option is for video only. For the syntax of this
  14132. option, check the
  14133. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14134. Default and minimum resolution is @code{640x480}.
  14135. @item meter
  14136. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14137. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14138. other integer value between this range is allowed.
  14139. @item metadata
  14140. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14141. into 100ms output frames, each of them containing various loudness information
  14142. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14143. Default is @code{0}.
  14144. @item framelog
  14145. Force the frame logging level.
  14146. Available values are:
  14147. @table @samp
  14148. @item info
  14149. information logging level
  14150. @item verbose
  14151. verbose logging level
  14152. @end table
  14153. By default, the logging level is set to @var{info}. If the @option{video} or
  14154. the @option{metadata} options are set, it switches to @var{verbose}.
  14155. @item peak
  14156. Set peak mode(s).
  14157. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14158. values are:
  14159. @table @samp
  14160. @item none
  14161. Disable any peak mode (default).
  14162. @item sample
  14163. Enable sample-peak mode.
  14164. Simple peak mode looking for the higher sample value. It logs a message
  14165. for sample-peak (identified by @code{SPK}).
  14166. @item true
  14167. Enable true-peak mode.
  14168. If enabled, the peak lookup is done on an over-sampled version of the input
  14169. stream for better peak accuracy. It logs a message for true-peak.
  14170. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14171. This mode requires a build with @code{libswresample}.
  14172. @end table
  14173. @item dualmono
  14174. Treat mono input files as "dual mono". If a mono file is intended for playback
  14175. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14176. If set to @code{true}, this option will compensate for this effect.
  14177. Multi-channel input files are not affected by this option.
  14178. @item panlaw
  14179. Set a specific pan law to be used for the measurement of dual mono files.
  14180. This parameter is optional, and has a default value of -3.01dB.
  14181. @end table
  14182. @subsection Examples
  14183. @itemize
  14184. @item
  14185. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14186. @example
  14187. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14188. @end example
  14189. @item
  14190. Run an analysis with @command{ffmpeg}:
  14191. @example
  14192. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14193. @end example
  14194. @end itemize
  14195. @section interleave, ainterleave
  14196. Temporally interleave frames from several inputs.
  14197. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14198. These filters read frames from several inputs and send the oldest
  14199. queued frame to the output.
  14200. Input streams must have well defined, monotonically increasing frame
  14201. timestamp values.
  14202. In order to submit one frame to output, these filters need to enqueue
  14203. at least one frame for each input, so they cannot work in case one
  14204. input is not yet terminated and will not receive incoming frames.
  14205. For example consider the case when one input is a @code{select} filter
  14206. which always drops input frames. The @code{interleave} filter will keep
  14207. reading from that input, but it will never be able to send new frames
  14208. to output until the input sends an end-of-stream signal.
  14209. Also, depending on inputs synchronization, the filters will drop
  14210. frames in case one input receives more frames than the other ones, and
  14211. the queue is already filled.
  14212. These filters accept the following options:
  14213. @table @option
  14214. @item nb_inputs, n
  14215. Set the number of different inputs, it is 2 by default.
  14216. @end table
  14217. @subsection Examples
  14218. @itemize
  14219. @item
  14220. Interleave frames belonging to different streams using @command{ffmpeg}:
  14221. @example
  14222. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14223. @end example
  14224. @item
  14225. Add flickering blur effect:
  14226. @example
  14227. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14228. @end example
  14229. @end itemize
  14230. @section metadata, ametadata
  14231. Manipulate frame metadata.
  14232. This filter accepts the following options:
  14233. @table @option
  14234. @item mode
  14235. Set mode of operation of the filter.
  14236. Can be one of the following:
  14237. @table @samp
  14238. @item select
  14239. If both @code{value} and @code{key} is set, select frames
  14240. which have such metadata. If only @code{key} is set, select
  14241. every frame that has such key in metadata.
  14242. @item add
  14243. Add new metadata @code{key} and @code{value}. If key is already available
  14244. do nothing.
  14245. @item modify
  14246. Modify value of already present key.
  14247. @item delete
  14248. If @code{value} is set, delete only keys that have such value.
  14249. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14250. the frame.
  14251. @item print
  14252. Print key and its value if metadata was found. If @code{key} is not set print all
  14253. metadata values available in frame.
  14254. @end table
  14255. @item key
  14256. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14257. @item value
  14258. Set metadata value which will be used. This option is mandatory for
  14259. @code{modify} and @code{add} mode.
  14260. @item function
  14261. Which function to use when comparing metadata value and @code{value}.
  14262. Can be one of following:
  14263. @table @samp
  14264. @item same_str
  14265. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14266. @item starts_with
  14267. Values are interpreted as strings, returns true if metadata value starts with
  14268. the @code{value} option string.
  14269. @item less
  14270. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14271. @item equal
  14272. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14273. @item greater
  14274. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14275. @item expr
  14276. Values are interpreted as floats, returns true if expression from option @code{expr}
  14277. evaluates to true.
  14278. @end table
  14279. @item expr
  14280. Set expression which is used when @code{function} is set to @code{expr}.
  14281. The expression is evaluated through the eval API and can contain the following
  14282. constants:
  14283. @table @option
  14284. @item VALUE1
  14285. Float representation of @code{value} from metadata key.
  14286. @item VALUE2
  14287. Float representation of @code{value} as supplied by user in @code{value} option.
  14288. @end table
  14289. @item file
  14290. If specified in @code{print} mode, output is written to the named file. Instead of
  14291. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14292. for standard output. If @code{file} option is not set, output is written to the log
  14293. with AV_LOG_INFO loglevel.
  14294. @end table
  14295. @subsection Examples
  14296. @itemize
  14297. @item
  14298. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14299. between 0 and 1.
  14300. @example
  14301. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14302. @end example
  14303. @item
  14304. Print silencedetect output to file @file{metadata.txt}.
  14305. @example
  14306. silencedetect,ametadata=mode=print:file=metadata.txt
  14307. @end example
  14308. @item
  14309. Direct all metadata to a pipe with file descriptor 4.
  14310. @example
  14311. metadata=mode=print:file='pipe\:4'
  14312. @end example
  14313. @end itemize
  14314. @section perms, aperms
  14315. Set read/write permissions for the output frames.
  14316. These filters are mainly aimed at developers to test direct path in the
  14317. following filter in the filtergraph.
  14318. The filters accept the following options:
  14319. @table @option
  14320. @item mode
  14321. Select the permissions mode.
  14322. It accepts the following values:
  14323. @table @samp
  14324. @item none
  14325. Do nothing. This is the default.
  14326. @item ro
  14327. Set all the output frames read-only.
  14328. @item rw
  14329. Set all the output frames directly writable.
  14330. @item toggle
  14331. Make the frame read-only if writable, and writable if read-only.
  14332. @item random
  14333. Set each output frame read-only or writable randomly.
  14334. @end table
  14335. @item seed
  14336. Set the seed for the @var{random} mode, must be an integer included between
  14337. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14338. @code{-1}, the filter will try to use a good random seed on a best effort
  14339. basis.
  14340. @end table
  14341. Note: in case of auto-inserted filter between the permission filter and the
  14342. following one, the permission might not be received as expected in that
  14343. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14344. perms/aperms filter can avoid this problem.
  14345. @section realtime, arealtime
  14346. Slow down filtering to match real time approximately.
  14347. These filters will pause the filtering for a variable amount of time to
  14348. match the output rate with the input timestamps.
  14349. They are similar to the @option{re} option to @code{ffmpeg}.
  14350. They accept the following options:
  14351. @table @option
  14352. @item limit
  14353. Time limit for the pauses. Any pause longer than that will be considered
  14354. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14355. @end table
  14356. @anchor{select}
  14357. @section select, aselect
  14358. Select frames to pass in output.
  14359. This filter accepts the following options:
  14360. @table @option
  14361. @item expr, e
  14362. Set expression, which is evaluated for each input frame.
  14363. If the expression is evaluated to zero, the frame is discarded.
  14364. If the evaluation result is negative or NaN, the frame is sent to the
  14365. first output; otherwise it is sent to the output with index
  14366. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14367. For example a value of @code{1.2} corresponds to the output with index
  14368. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14369. @item outputs, n
  14370. Set the number of outputs. The output to which to send the selected
  14371. frame is based on the result of the evaluation. Default value is 1.
  14372. @end table
  14373. The expression can contain the following constants:
  14374. @table @option
  14375. @item n
  14376. The (sequential) number of the filtered frame, starting from 0.
  14377. @item selected_n
  14378. The (sequential) number of the selected frame, starting from 0.
  14379. @item prev_selected_n
  14380. The sequential number of the last selected frame. It's NAN if undefined.
  14381. @item TB
  14382. The timebase of the input timestamps.
  14383. @item pts
  14384. The PTS (Presentation TimeStamp) of the filtered video frame,
  14385. expressed in @var{TB} units. It's NAN if undefined.
  14386. @item t
  14387. The PTS of the filtered video frame,
  14388. expressed in seconds. It's NAN if undefined.
  14389. @item prev_pts
  14390. The PTS of the previously filtered video frame. It's NAN if undefined.
  14391. @item prev_selected_pts
  14392. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14393. @item prev_selected_t
  14394. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14395. @item start_pts
  14396. The PTS of the first video frame in the video. It's NAN if undefined.
  14397. @item start_t
  14398. The time of the first video frame in the video. It's NAN if undefined.
  14399. @item pict_type @emph{(video only)}
  14400. The type of the filtered frame. It can assume one of the following
  14401. values:
  14402. @table @option
  14403. @item I
  14404. @item P
  14405. @item B
  14406. @item S
  14407. @item SI
  14408. @item SP
  14409. @item BI
  14410. @end table
  14411. @item interlace_type @emph{(video only)}
  14412. The frame interlace type. It can assume one of the following values:
  14413. @table @option
  14414. @item PROGRESSIVE
  14415. The frame is progressive (not interlaced).
  14416. @item TOPFIRST
  14417. The frame is top-field-first.
  14418. @item BOTTOMFIRST
  14419. The frame is bottom-field-first.
  14420. @end table
  14421. @item consumed_sample_n @emph{(audio only)}
  14422. the number of selected samples before the current frame
  14423. @item samples_n @emph{(audio only)}
  14424. the number of samples in the current frame
  14425. @item sample_rate @emph{(audio only)}
  14426. the input sample rate
  14427. @item key
  14428. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14429. @item pos
  14430. the position in the file of the filtered frame, -1 if the information
  14431. is not available (e.g. for synthetic video)
  14432. @item scene @emph{(video only)}
  14433. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14434. probability for the current frame to introduce a new scene, while a higher
  14435. value means the current frame is more likely to be one (see the example below)
  14436. @item concatdec_select
  14437. The concat demuxer can select only part of a concat input file by setting an
  14438. inpoint and an outpoint, but the output packets may not be entirely contained
  14439. in the selected interval. By using this variable, it is possible to skip frames
  14440. generated by the concat demuxer which are not exactly contained in the selected
  14441. interval.
  14442. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14443. and the @var{lavf.concat.duration} packet metadata values which are also
  14444. present in the decoded frames.
  14445. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14446. start_time and either the duration metadata is missing or the frame pts is less
  14447. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14448. missing.
  14449. That basically means that an input frame is selected if its pts is within the
  14450. interval set by the concat demuxer.
  14451. @end table
  14452. The default value of the select expression is "1".
  14453. @subsection Examples
  14454. @itemize
  14455. @item
  14456. Select all frames in input:
  14457. @example
  14458. select
  14459. @end example
  14460. The example above is the same as:
  14461. @example
  14462. select=1
  14463. @end example
  14464. @item
  14465. Skip all frames:
  14466. @example
  14467. select=0
  14468. @end example
  14469. @item
  14470. Select only I-frames:
  14471. @example
  14472. select='eq(pict_type\,I)'
  14473. @end example
  14474. @item
  14475. Select one frame every 100:
  14476. @example
  14477. select='not(mod(n\,100))'
  14478. @end example
  14479. @item
  14480. Select only frames contained in the 10-20 time interval:
  14481. @example
  14482. select=between(t\,10\,20)
  14483. @end example
  14484. @item
  14485. Select only I-frames contained in the 10-20 time interval:
  14486. @example
  14487. select=between(t\,10\,20)*eq(pict_type\,I)
  14488. @end example
  14489. @item
  14490. Select frames with a minimum distance of 10 seconds:
  14491. @example
  14492. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14493. @end example
  14494. @item
  14495. Use aselect to select only audio frames with samples number > 100:
  14496. @example
  14497. aselect='gt(samples_n\,100)'
  14498. @end example
  14499. @item
  14500. Create a mosaic of the first scenes:
  14501. @example
  14502. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14503. @end example
  14504. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14505. choice.
  14506. @item
  14507. Send even and odd frames to separate outputs, and compose them:
  14508. @example
  14509. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14510. @end example
  14511. @item
  14512. Select useful frames from an ffconcat file which is using inpoints and
  14513. outpoints but where the source files are not intra frame only.
  14514. @example
  14515. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14516. @end example
  14517. @end itemize
  14518. @section sendcmd, asendcmd
  14519. Send commands to filters in the filtergraph.
  14520. These filters read commands to be sent to other filters in the
  14521. filtergraph.
  14522. @code{sendcmd} must be inserted between two video filters,
  14523. @code{asendcmd} must be inserted between two audio filters, but apart
  14524. from that they act the same way.
  14525. The specification of commands can be provided in the filter arguments
  14526. with the @var{commands} option, or in a file specified by the
  14527. @var{filename} option.
  14528. These filters accept the following options:
  14529. @table @option
  14530. @item commands, c
  14531. Set the commands to be read and sent to the other filters.
  14532. @item filename, f
  14533. Set the filename of the commands to be read and sent to the other
  14534. filters.
  14535. @end table
  14536. @subsection Commands syntax
  14537. A commands description consists of a sequence of interval
  14538. specifications, comprising a list of commands to be executed when a
  14539. particular event related to that interval occurs. The occurring event
  14540. is typically the current frame time entering or leaving a given time
  14541. interval.
  14542. An interval is specified by the following syntax:
  14543. @example
  14544. @var{START}[-@var{END}] @var{COMMANDS};
  14545. @end example
  14546. The time interval is specified by the @var{START} and @var{END} times.
  14547. @var{END} is optional and defaults to the maximum time.
  14548. The current frame time is considered within the specified interval if
  14549. it is included in the interval [@var{START}, @var{END}), that is when
  14550. the time is greater or equal to @var{START} and is lesser than
  14551. @var{END}.
  14552. @var{COMMANDS} consists of a sequence of one or more command
  14553. specifications, separated by ",", relating to that interval. The
  14554. syntax of a command specification is given by:
  14555. @example
  14556. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14557. @end example
  14558. @var{FLAGS} is optional and specifies the type of events relating to
  14559. the time interval which enable sending the specified command, and must
  14560. be a non-null sequence of identifier flags separated by "+" or "|" and
  14561. enclosed between "[" and "]".
  14562. The following flags are recognized:
  14563. @table @option
  14564. @item enter
  14565. The command is sent when the current frame timestamp enters the
  14566. specified interval. In other words, the command is sent when the
  14567. previous frame timestamp was not in the given interval, and the
  14568. current is.
  14569. @item leave
  14570. The command is sent when the current frame timestamp leaves the
  14571. specified interval. In other words, the command is sent when the
  14572. previous frame timestamp was in the given interval, and the
  14573. current is not.
  14574. @end table
  14575. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14576. assumed.
  14577. @var{TARGET} specifies the target of the command, usually the name of
  14578. the filter class or a specific filter instance name.
  14579. @var{COMMAND} specifies the name of the command for the target filter.
  14580. @var{ARG} is optional and specifies the optional list of argument for
  14581. the given @var{COMMAND}.
  14582. Between one interval specification and another, whitespaces, or
  14583. sequences of characters starting with @code{#} until the end of line,
  14584. are ignored and can be used to annotate comments.
  14585. A simplified BNF description of the commands specification syntax
  14586. follows:
  14587. @example
  14588. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14589. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14590. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14591. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14592. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14593. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14594. @end example
  14595. @subsection Examples
  14596. @itemize
  14597. @item
  14598. Specify audio tempo change at second 4:
  14599. @example
  14600. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14601. @end example
  14602. @item
  14603. Target a specific filter instance:
  14604. @example
  14605. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14606. @end example
  14607. @item
  14608. Specify a list of drawtext and hue commands in a file.
  14609. @example
  14610. # show text in the interval 5-10
  14611. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14612. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14613. # desaturate the image in the interval 15-20
  14614. 15.0-20.0 [enter] hue s 0,
  14615. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14616. [leave] hue s 1,
  14617. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14618. # apply an exponential saturation fade-out effect, starting from time 25
  14619. 25 [enter] hue s exp(25-t)
  14620. @end example
  14621. A filtergraph allowing to read and process the above command list
  14622. stored in a file @file{test.cmd}, can be specified with:
  14623. @example
  14624. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14625. @end example
  14626. @end itemize
  14627. @anchor{setpts}
  14628. @section setpts, asetpts
  14629. Change the PTS (presentation timestamp) of the input frames.
  14630. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14631. This filter accepts the following options:
  14632. @table @option
  14633. @item expr
  14634. The expression which is evaluated for each frame to construct its timestamp.
  14635. @end table
  14636. The expression is evaluated through the eval API and can contain the following
  14637. constants:
  14638. @table @option
  14639. @item FRAME_RATE
  14640. frame rate, only defined for constant frame-rate video
  14641. @item PTS
  14642. The presentation timestamp in input
  14643. @item N
  14644. The count of the input frame for video or the number of consumed samples,
  14645. not including the current frame for audio, starting from 0.
  14646. @item NB_CONSUMED_SAMPLES
  14647. The number of consumed samples, not including the current frame (only
  14648. audio)
  14649. @item NB_SAMPLES, S
  14650. The number of samples in the current frame (only audio)
  14651. @item SAMPLE_RATE, SR
  14652. The audio sample rate.
  14653. @item STARTPTS
  14654. The PTS of the first frame.
  14655. @item STARTT
  14656. the time in seconds of the first frame
  14657. @item INTERLACED
  14658. State whether the current frame is interlaced.
  14659. @item T
  14660. the time in seconds of the current frame
  14661. @item POS
  14662. original position in the file of the frame, or undefined if undefined
  14663. for the current frame
  14664. @item PREV_INPTS
  14665. The previous input PTS.
  14666. @item PREV_INT
  14667. previous input time in seconds
  14668. @item PREV_OUTPTS
  14669. The previous output PTS.
  14670. @item PREV_OUTT
  14671. previous output time in seconds
  14672. @item RTCTIME
  14673. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14674. instead.
  14675. @item RTCSTART
  14676. The wallclock (RTC) time at the start of the movie in microseconds.
  14677. @item TB
  14678. The timebase of the input timestamps.
  14679. @end table
  14680. @subsection Examples
  14681. @itemize
  14682. @item
  14683. Start counting PTS from zero
  14684. @example
  14685. setpts=PTS-STARTPTS
  14686. @end example
  14687. @item
  14688. Apply fast motion effect:
  14689. @example
  14690. setpts=0.5*PTS
  14691. @end example
  14692. @item
  14693. Apply slow motion effect:
  14694. @example
  14695. setpts=2.0*PTS
  14696. @end example
  14697. @item
  14698. Set fixed rate of 25 frames per second:
  14699. @example
  14700. setpts=N/(25*TB)
  14701. @end example
  14702. @item
  14703. Set fixed rate 25 fps with some jitter:
  14704. @example
  14705. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14706. @end example
  14707. @item
  14708. Apply an offset of 10 seconds to the input PTS:
  14709. @example
  14710. setpts=PTS+10/TB
  14711. @end example
  14712. @item
  14713. Generate timestamps from a "live source" and rebase onto the current timebase:
  14714. @example
  14715. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14716. @end example
  14717. @item
  14718. Generate timestamps by counting samples:
  14719. @example
  14720. asetpts=N/SR/TB
  14721. @end example
  14722. @end itemize
  14723. @section setrange
  14724. Force color range for the output video frame.
  14725. The @code{setrange} filter marks the color range property for the
  14726. output frames. It does not change the input frame, but only sets the
  14727. corresponding property, which affects how the frame is treated by
  14728. following filters.
  14729. The filter accepts the following options:
  14730. @table @option
  14731. @item range
  14732. Available values are:
  14733. @table @samp
  14734. @item auto
  14735. Keep the same color range property.
  14736. @item unspecified, unknown
  14737. Set the color range as unspecified.
  14738. @item limited, tv, mpeg
  14739. Set the color range as limited.
  14740. @item full, pc, jpeg
  14741. Set the color range as full.
  14742. @end table
  14743. @end table
  14744. @section settb, asettb
  14745. Set the timebase to use for the output frames timestamps.
  14746. It is mainly useful for testing timebase configuration.
  14747. It accepts the following parameters:
  14748. @table @option
  14749. @item expr, tb
  14750. The expression which is evaluated into the output timebase.
  14751. @end table
  14752. The value for @option{tb} is an arithmetic expression representing a
  14753. rational. The expression can contain the constants "AVTB" (the default
  14754. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14755. audio only). Default value is "intb".
  14756. @subsection Examples
  14757. @itemize
  14758. @item
  14759. Set the timebase to 1/25:
  14760. @example
  14761. settb=expr=1/25
  14762. @end example
  14763. @item
  14764. Set the timebase to 1/10:
  14765. @example
  14766. settb=expr=0.1
  14767. @end example
  14768. @item
  14769. Set the timebase to 1001/1000:
  14770. @example
  14771. settb=1+0.001
  14772. @end example
  14773. @item
  14774. Set the timebase to 2*intb:
  14775. @example
  14776. settb=2*intb
  14777. @end example
  14778. @item
  14779. Set the default timebase value:
  14780. @example
  14781. settb=AVTB
  14782. @end example
  14783. @end itemize
  14784. @section showcqt
  14785. Convert input audio to a video output representing frequency spectrum
  14786. logarithmically using Brown-Puckette constant Q transform algorithm with
  14787. direct frequency domain coefficient calculation (but the transform itself
  14788. is not really constant Q, instead the Q factor is actually variable/clamped),
  14789. with musical tone scale, from E0 to D#10.
  14790. The filter accepts the following options:
  14791. @table @option
  14792. @item size, s
  14793. Specify the video size for the output. It must be even. For the syntax of this option,
  14794. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14795. Default value is @code{1920x1080}.
  14796. @item fps, rate, r
  14797. Set the output frame rate. Default value is @code{25}.
  14798. @item bar_h
  14799. Set the bargraph height. It must be even. Default value is @code{-1} which
  14800. computes the bargraph height automatically.
  14801. @item axis_h
  14802. Set the axis height. It must be even. Default value is @code{-1} which computes
  14803. the axis height automatically.
  14804. @item sono_h
  14805. Set the sonogram height. It must be even. Default value is @code{-1} which
  14806. computes the sonogram height automatically.
  14807. @item fullhd
  14808. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14809. instead. Default value is @code{1}.
  14810. @item sono_v, volume
  14811. Specify the sonogram volume expression. It can contain variables:
  14812. @table @option
  14813. @item bar_v
  14814. the @var{bar_v} evaluated expression
  14815. @item frequency, freq, f
  14816. the frequency where it is evaluated
  14817. @item timeclamp, tc
  14818. the value of @var{timeclamp} option
  14819. @end table
  14820. and functions:
  14821. @table @option
  14822. @item a_weighting(f)
  14823. A-weighting of equal loudness
  14824. @item b_weighting(f)
  14825. B-weighting of equal loudness
  14826. @item c_weighting(f)
  14827. C-weighting of equal loudness.
  14828. @end table
  14829. Default value is @code{16}.
  14830. @item bar_v, volume2
  14831. Specify the bargraph volume expression. It can contain variables:
  14832. @table @option
  14833. @item sono_v
  14834. the @var{sono_v} evaluated expression
  14835. @item frequency, freq, f
  14836. the frequency where it is evaluated
  14837. @item timeclamp, tc
  14838. the value of @var{timeclamp} option
  14839. @end table
  14840. and functions:
  14841. @table @option
  14842. @item a_weighting(f)
  14843. A-weighting of equal loudness
  14844. @item b_weighting(f)
  14845. B-weighting of equal loudness
  14846. @item c_weighting(f)
  14847. C-weighting of equal loudness.
  14848. @end table
  14849. Default value is @code{sono_v}.
  14850. @item sono_g, gamma
  14851. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14852. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14853. Acceptable range is @code{[1, 7]}.
  14854. @item bar_g, gamma2
  14855. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14856. @code{[1, 7]}.
  14857. @item bar_t
  14858. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14859. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14860. @item timeclamp, tc
  14861. Specify the transform timeclamp. At low frequency, there is trade-off between
  14862. accuracy in time domain and frequency domain. If timeclamp is lower,
  14863. event in time domain is represented more accurately (such as fast bass drum),
  14864. otherwise event in frequency domain is represented more accurately
  14865. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14866. @item attack
  14867. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14868. limits future samples by applying asymmetric windowing in time domain, useful
  14869. when low latency is required. Accepted range is @code{[0, 1]}.
  14870. @item basefreq
  14871. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14872. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14873. @item endfreq
  14874. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14875. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14876. @item coeffclamp
  14877. This option is deprecated and ignored.
  14878. @item tlength
  14879. Specify the transform length in time domain. Use this option to control accuracy
  14880. trade-off between time domain and frequency domain at every frequency sample.
  14881. It can contain variables:
  14882. @table @option
  14883. @item frequency, freq, f
  14884. the frequency where it is evaluated
  14885. @item timeclamp, tc
  14886. the value of @var{timeclamp} option.
  14887. @end table
  14888. Default value is @code{384*tc/(384+tc*f)}.
  14889. @item count
  14890. Specify the transform count for every video frame. Default value is @code{6}.
  14891. Acceptable range is @code{[1, 30]}.
  14892. @item fcount
  14893. Specify the transform count for every single pixel. Default value is @code{0},
  14894. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14895. @item fontfile
  14896. Specify font file for use with freetype to draw the axis. If not specified,
  14897. use embedded font. Note that drawing with font file or embedded font is not
  14898. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14899. option instead.
  14900. @item font
  14901. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14902. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14903. @item fontcolor
  14904. Specify font color expression. This is arithmetic expression that should return
  14905. integer value 0xRRGGBB. It can contain variables:
  14906. @table @option
  14907. @item frequency, freq, f
  14908. the frequency where it is evaluated
  14909. @item timeclamp, tc
  14910. the value of @var{timeclamp} option
  14911. @end table
  14912. and functions:
  14913. @table @option
  14914. @item midi(f)
  14915. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14916. @item r(x), g(x), b(x)
  14917. red, green, and blue value of intensity x.
  14918. @end table
  14919. Default value is @code{st(0, (midi(f)-59.5)/12);
  14920. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14921. r(1-ld(1)) + b(ld(1))}.
  14922. @item axisfile
  14923. Specify image file to draw the axis. This option override @var{fontfile} and
  14924. @var{fontcolor} option.
  14925. @item axis, text
  14926. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14927. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14928. Default value is @code{1}.
  14929. @item csp
  14930. Set colorspace. The accepted values are:
  14931. @table @samp
  14932. @item unspecified
  14933. Unspecified (default)
  14934. @item bt709
  14935. BT.709
  14936. @item fcc
  14937. FCC
  14938. @item bt470bg
  14939. BT.470BG or BT.601-6 625
  14940. @item smpte170m
  14941. SMPTE-170M or BT.601-6 525
  14942. @item smpte240m
  14943. SMPTE-240M
  14944. @item bt2020ncl
  14945. BT.2020 with non-constant luminance
  14946. @end table
  14947. @item cscheme
  14948. Set spectrogram color scheme. This is list of floating point values with format
  14949. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14950. The default is @code{1|0.5|0|0|0.5|1}.
  14951. @end table
  14952. @subsection Examples
  14953. @itemize
  14954. @item
  14955. Playing audio while showing the spectrum:
  14956. @example
  14957. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14958. @end example
  14959. @item
  14960. Same as above, but with frame rate 30 fps:
  14961. @example
  14962. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14963. @end example
  14964. @item
  14965. Playing at 1280x720:
  14966. @example
  14967. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14968. @end example
  14969. @item
  14970. Disable sonogram display:
  14971. @example
  14972. sono_h=0
  14973. @end example
  14974. @item
  14975. A1 and its harmonics: A1, A2, (near)E3, A3:
  14976. @example
  14977. 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),
  14978. asplit[a][out1]; [a] showcqt [out0]'
  14979. @end example
  14980. @item
  14981. Same as above, but with more accuracy in frequency domain:
  14982. @example
  14983. 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),
  14984. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14985. @end example
  14986. @item
  14987. Custom volume:
  14988. @example
  14989. bar_v=10:sono_v=bar_v*a_weighting(f)
  14990. @end example
  14991. @item
  14992. Custom gamma, now spectrum is linear to the amplitude.
  14993. @example
  14994. bar_g=2:sono_g=2
  14995. @end example
  14996. @item
  14997. Custom tlength equation:
  14998. @example
  14999. 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)))'
  15000. @end example
  15001. @item
  15002. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15003. @example
  15004. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15005. @end example
  15006. @item
  15007. Custom font using fontconfig:
  15008. @example
  15009. font='Courier New,Monospace,mono|bold'
  15010. @end example
  15011. @item
  15012. Custom frequency range with custom axis using image file:
  15013. @example
  15014. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15015. @end example
  15016. @end itemize
  15017. @section showfreqs
  15018. Convert input audio to video output representing the audio power spectrum.
  15019. Audio amplitude is on Y-axis while frequency is on X-axis.
  15020. The filter accepts the following options:
  15021. @table @option
  15022. @item size, s
  15023. Specify size of video. For the syntax of this option, check the
  15024. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15025. Default is @code{1024x512}.
  15026. @item mode
  15027. Set display mode.
  15028. This set how each frequency bin will be represented.
  15029. It accepts the following values:
  15030. @table @samp
  15031. @item line
  15032. @item bar
  15033. @item dot
  15034. @end table
  15035. Default is @code{bar}.
  15036. @item ascale
  15037. Set amplitude scale.
  15038. It accepts the following values:
  15039. @table @samp
  15040. @item lin
  15041. Linear scale.
  15042. @item sqrt
  15043. Square root scale.
  15044. @item cbrt
  15045. Cubic root scale.
  15046. @item log
  15047. Logarithmic scale.
  15048. @end table
  15049. Default is @code{log}.
  15050. @item fscale
  15051. Set frequency scale.
  15052. It accepts the following values:
  15053. @table @samp
  15054. @item lin
  15055. Linear scale.
  15056. @item log
  15057. Logarithmic scale.
  15058. @item rlog
  15059. Reverse logarithmic scale.
  15060. @end table
  15061. Default is @code{lin}.
  15062. @item win_size
  15063. Set window size.
  15064. It accepts the following values:
  15065. @table @samp
  15066. @item w16
  15067. @item w32
  15068. @item w64
  15069. @item w128
  15070. @item w256
  15071. @item w512
  15072. @item w1024
  15073. @item w2048
  15074. @item w4096
  15075. @item w8192
  15076. @item w16384
  15077. @item w32768
  15078. @item w65536
  15079. @end table
  15080. Default is @code{w2048}
  15081. @item win_func
  15082. Set windowing function.
  15083. It accepts the following values:
  15084. @table @samp
  15085. @item rect
  15086. @item bartlett
  15087. @item hanning
  15088. @item hamming
  15089. @item blackman
  15090. @item welch
  15091. @item flattop
  15092. @item bharris
  15093. @item bnuttall
  15094. @item bhann
  15095. @item sine
  15096. @item nuttall
  15097. @item lanczos
  15098. @item gauss
  15099. @item tukey
  15100. @item dolph
  15101. @item cauchy
  15102. @item parzen
  15103. @item poisson
  15104. @end table
  15105. Default is @code{hanning}.
  15106. @item overlap
  15107. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15108. which means optimal overlap for selected window function will be picked.
  15109. @item averaging
  15110. Set time averaging. Setting this to 0 will display current maximal peaks.
  15111. Default is @code{1}, which means time averaging is disabled.
  15112. @item colors
  15113. Specify list of colors separated by space or by '|' which will be used to
  15114. draw channel frequencies. Unrecognized or missing colors will be replaced
  15115. by white color.
  15116. @item cmode
  15117. Set channel display mode.
  15118. It accepts the following values:
  15119. @table @samp
  15120. @item combined
  15121. @item separate
  15122. @end table
  15123. Default is @code{combined}.
  15124. @item minamp
  15125. Set minimum amplitude used in @code{log} amplitude scaler.
  15126. @end table
  15127. @anchor{showspectrum}
  15128. @section showspectrum
  15129. Convert input audio to a video output, representing the audio frequency
  15130. spectrum.
  15131. The filter accepts the following options:
  15132. @table @option
  15133. @item size, s
  15134. Specify the video size for the output. For the syntax of this option, check the
  15135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15136. Default value is @code{640x512}.
  15137. @item slide
  15138. Specify how the spectrum should slide along the window.
  15139. It accepts the following values:
  15140. @table @samp
  15141. @item replace
  15142. the samples start again on the left when they reach the right
  15143. @item scroll
  15144. the samples scroll from right to left
  15145. @item fullframe
  15146. frames are only produced when the samples reach the right
  15147. @item rscroll
  15148. the samples scroll from left to right
  15149. @end table
  15150. Default value is @code{replace}.
  15151. @item mode
  15152. Specify display mode.
  15153. It accepts the following values:
  15154. @table @samp
  15155. @item combined
  15156. all channels are displayed in the same row
  15157. @item separate
  15158. all channels are displayed in separate rows
  15159. @end table
  15160. Default value is @samp{combined}.
  15161. @item color
  15162. Specify display color mode.
  15163. It accepts the following values:
  15164. @table @samp
  15165. @item channel
  15166. each channel is displayed in a separate color
  15167. @item intensity
  15168. each channel is displayed using the same color scheme
  15169. @item rainbow
  15170. each channel is displayed using the rainbow color scheme
  15171. @item moreland
  15172. each channel is displayed using the moreland color scheme
  15173. @item nebulae
  15174. each channel is displayed using the nebulae color scheme
  15175. @item fire
  15176. each channel is displayed using the fire color scheme
  15177. @item fiery
  15178. each channel is displayed using the fiery color scheme
  15179. @item fruit
  15180. each channel is displayed using the fruit color scheme
  15181. @item cool
  15182. each channel is displayed using the cool color scheme
  15183. @end table
  15184. Default value is @samp{channel}.
  15185. @item scale
  15186. Specify scale used for calculating intensity color values.
  15187. It accepts the following values:
  15188. @table @samp
  15189. @item lin
  15190. linear
  15191. @item sqrt
  15192. square root, default
  15193. @item cbrt
  15194. cubic root
  15195. @item log
  15196. logarithmic
  15197. @item 4thrt
  15198. 4th root
  15199. @item 5thrt
  15200. 5th root
  15201. @end table
  15202. Default value is @samp{sqrt}.
  15203. @item saturation
  15204. Set saturation modifier for displayed colors. Negative values provide
  15205. alternative color scheme. @code{0} is no saturation at all.
  15206. Saturation must be in [-10.0, 10.0] range.
  15207. Default value is @code{1}.
  15208. @item win_func
  15209. Set window function.
  15210. It accepts the following values:
  15211. @table @samp
  15212. @item rect
  15213. @item bartlett
  15214. @item hann
  15215. @item hanning
  15216. @item hamming
  15217. @item blackman
  15218. @item welch
  15219. @item flattop
  15220. @item bharris
  15221. @item bnuttall
  15222. @item bhann
  15223. @item sine
  15224. @item nuttall
  15225. @item lanczos
  15226. @item gauss
  15227. @item tukey
  15228. @item dolph
  15229. @item cauchy
  15230. @item parzen
  15231. @item poisson
  15232. @end table
  15233. Default value is @code{hann}.
  15234. @item orientation
  15235. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15236. @code{horizontal}. Default is @code{vertical}.
  15237. @item overlap
  15238. Set ratio of overlap window. Default value is @code{0}.
  15239. When value is @code{1} overlap is set to recommended size for specific
  15240. window function currently used.
  15241. @item gain
  15242. Set scale gain for calculating intensity color values.
  15243. Default value is @code{1}.
  15244. @item data
  15245. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15246. @item rotation
  15247. Set color rotation, must be in [-1.0, 1.0] range.
  15248. Default value is @code{0}.
  15249. @end table
  15250. The usage is very similar to the showwaves filter; see the examples in that
  15251. section.
  15252. @subsection Examples
  15253. @itemize
  15254. @item
  15255. Large window with logarithmic color scaling:
  15256. @example
  15257. showspectrum=s=1280x480:scale=log
  15258. @end example
  15259. @item
  15260. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15261. @example
  15262. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15263. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15264. @end example
  15265. @end itemize
  15266. @section showspectrumpic
  15267. Convert input audio to a single video frame, representing the audio frequency
  15268. spectrum.
  15269. The filter accepts the following options:
  15270. @table @option
  15271. @item size, s
  15272. Specify the video size for the output. For the syntax of this option, check the
  15273. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15274. Default value is @code{4096x2048}.
  15275. @item mode
  15276. Specify display mode.
  15277. It accepts the following values:
  15278. @table @samp
  15279. @item combined
  15280. all channels are displayed in the same row
  15281. @item separate
  15282. all channels are displayed in separate rows
  15283. @end table
  15284. Default value is @samp{combined}.
  15285. @item color
  15286. Specify display color mode.
  15287. It accepts the following values:
  15288. @table @samp
  15289. @item channel
  15290. each channel is displayed in a separate color
  15291. @item intensity
  15292. each channel is displayed using the same color scheme
  15293. @item rainbow
  15294. each channel is displayed using the rainbow color scheme
  15295. @item moreland
  15296. each channel is displayed using the moreland color scheme
  15297. @item nebulae
  15298. each channel is displayed using the nebulae color scheme
  15299. @item fire
  15300. each channel is displayed using the fire color scheme
  15301. @item fiery
  15302. each channel is displayed using the fiery color scheme
  15303. @item fruit
  15304. each channel is displayed using the fruit color scheme
  15305. @item cool
  15306. each channel is displayed using the cool color scheme
  15307. @end table
  15308. Default value is @samp{intensity}.
  15309. @item scale
  15310. Specify scale used for calculating intensity color values.
  15311. It accepts the following values:
  15312. @table @samp
  15313. @item lin
  15314. linear
  15315. @item sqrt
  15316. square root, default
  15317. @item cbrt
  15318. cubic root
  15319. @item log
  15320. logarithmic
  15321. @item 4thrt
  15322. 4th root
  15323. @item 5thrt
  15324. 5th root
  15325. @end table
  15326. Default value is @samp{log}.
  15327. @item saturation
  15328. Set saturation modifier for displayed colors. Negative values provide
  15329. alternative color scheme. @code{0} is no saturation at all.
  15330. Saturation must be in [-10.0, 10.0] range.
  15331. Default value is @code{1}.
  15332. @item win_func
  15333. Set window function.
  15334. It accepts the following values:
  15335. @table @samp
  15336. @item rect
  15337. @item bartlett
  15338. @item hann
  15339. @item hanning
  15340. @item hamming
  15341. @item blackman
  15342. @item welch
  15343. @item flattop
  15344. @item bharris
  15345. @item bnuttall
  15346. @item bhann
  15347. @item sine
  15348. @item nuttall
  15349. @item lanczos
  15350. @item gauss
  15351. @item tukey
  15352. @item dolph
  15353. @item cauchy
  15354. @item parzen
  15355. @item poisson
  15356. @end table
  15357. Default value is @code{hann}.
  15358. @item orientation
  15359. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15360. @code{horizontal}. Default is @code{vertical}.
  15361. @item gain
  15362. Set scale gain for calculating intensity color values.
  15363. Default value is @code{1}.
  15364. @item legend
  15365. Draw time and frequency axes and legends. Default is enabled.
  15366. @item rotation
  15367. Set color rotation, must be in [-1.0, 1.0] range.
  15368. Default value is @code{0}.
  15369. @end table
  15370. @subsection Examples
  15371. @itemize
  15372. @item
  15373. Extract an audio spectrogram of a whole audio track
  15374. in a 1024x1024 picture using @command{ffmpeg}:
  15375. @example
  15376. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15377. @end example
  15378. @end itemize
  15379. @section showvolume
  15380. Convert input audio volume to a video output.
  15381. The filter accepts the following options:
  15382. @table @option
  15383. @item rate, r
  15384. Set video rate.
  15385. @item b
  15386. Set border width, allowed range is [0, 5]. Default is 1.
  15387. @item w
  15388. Set channel width, allowed range is [80, 8192]. Default is 400.
  15389. @item h
  15390. Set channel height, allowed range is [1, 900]. Default is 20.
  15391. @item f
  15392. Set fade, allowed range is [0, 1]. Default is 0.95.
  15393. @item c
  15394. Set volume color expression.
  15395. The expression can use the following variables:
  15396. @table @option
  15397. @item VOLUME
  15398. Current max volume of channel in dB.
  15399. @item PEAK
  15400. Current peak.
  15401. @item CHANNEL
  15402. Current channel number, starting from 0.
  15403. @end table
  15404. @item t
  15405. If set, displays channel names. Default is enabled.
  15406. @item v
  15407. If set, displays volume values. Default is enabled.
  15408. @item o
  15409. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15410. default is @code{h}.
  15411. @item s
  15412. Set step size, allowed range is [0, 5]. Default is 0, which means
  15413. step is disabled.
  15414. @item p
  15415. Set background opacity, allowed range is [0, 1]. Default is 0.
  15416. @item m
  15417. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15418. default is @code{p}.
  15419. @item ds
  15420. Set display scale, can be linear: @code{lin} or log: @code{log},
  15421. default is @code{lin}.
  15422. @item dm
  15423. In second.
  15424. If set to > 0., display a line for the max level
  15425. in the previous seconds.
  15426. default is disabled: @code{0.}
  15427. @item dmc
  15428. The color of the max line. Use when @code{dm} option is set to > 0.
  15429. default is: @code{orange}
  15430. @end table
  15431. @section showwaves
  15432. Convert input audio to a video output, representing the samples waves.
  15433. The filter accepts the following options:
  15434. @table @option
  15435. @item size, s
  15436. Specify the video size for the output. For the syntax of this option, check the
  15437. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15438. Default value is @code{600x240}.
  15439. @item mode
  15440. Set display mode.
  15441. Available values are:
  15442. @table @samp
  15443. @item point
  15444. Draw a point for each sample.
  15445. @item line
  15446. Draw a vertical line for each sample.
  15447. @item p2p
  15448. Draw a point for each sample and a line between them.
  15449. @item cline
  15450. Draw a centered vertical line for each sample.
  15451. @end table
  15452. Default value is @code{point}.
  15453. @item n
  15454. Set the number of samples which are printed on the same column. A
  15455. larger value will decrease the frame rate. Must be a positive
  15456. integer. This option can be set only if the value for @var{rate}
  15457. is not explicitly specified.
  15458. @item rate, r
  15459. Set the (approximate) output frame rate. This is done by setting the
  15460. option @var{n}. Default value is "25".
  15461. @item split_channels
  15462. Set if channels should be drawn separately or overlap. Default value is 0.
  15463. @item colors
  15464. Set colors separated by '|' which are going to be used for drawing of each channel.
  15465. @item scale
  15466. Set amplitude scale.
  15467. Available values are:
  15468. @table @samp
  15469. @item lin
  15470. Linear.
  15471. @item log
  15472. Logarithmic.
  15473. @item sqrt
  15474. Square root.
  15475. @item cbrt
  15476. Cubic root.
  15477. @end table
  15478. Default is linear.
  15479. @item draw
  15480. Set the draw mode. This is mostly useful to set for high @var{n}.
  15481. Available values are:
  15482. @table @samp
  15483. @item scale
  15484. Scale pixel values for each drawn sample.
  15485. @item full
  15486. Draw every sample directly.
  15487. @end table
  15488. Default value is @code{scale}.
  15489. @end table
  15490. @subsection Examples
  15491. @itemize
  15492. @item
  15493. Output the input file audio and the corresponding video representation
  15494. at the same time:
  15495. @example
  15496. amovie=a.mp3,asplit[out0],showwaves[out1]
  15497. @end example
  15498. @item
  15499. Create a synthetic signal and show it with showwaves, forcing a
  15500. frame rate of 30 frames per second:
  15501. @example
  15502. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15503. @end example
  15504. @end itemize
  15505. @section showwavespic
  15506. Convert input audio to a single video frame, representing the samples waves.
  15507. The filter accepts the following options:
  15508. @table @option
  15509. @item size, s
  15510. Specify the video size for the output. For the syntax of this option, check the
  15511. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15512. Default value is @code{600x240}.
  15513. @item split_channels
  15514. Set if channels should be drawn separately or overlap. Default value is 0.
  15515. @item colors
  15516. Set colors separated by '|' which are going to be used for drawing of each channel.
  15517. @item scale
  15518. Set amplitude scale.
  15519. Available values are:
  15520. @table @samp
  15521. @item lin
  15522. Linear.
  15523. @item log
  15524. Logarithmic.
  15525. @item sqrt
  15526. Square root.
  15527. @item cbrt
  15528. Cubic root.
  15529. @end table
  15530. Default is linear.
  15531. @end table
  15532. @subsection Examples
  15533. @itemize
  15534. @item
  15535. Extract a channel split representation of the wave form of a whole audio track
  15536. in a 1024x800 picture using @command{ffmpeg}:
  15537. @example
  15538. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15539. @end example
  15540. @end itemize
  15541. @section sidedata, asidedata
  15542. Delete frame side data, or select frames based on it.
  15543. This filter accepts the following options:
  15544. @table @option
  15545. @item mode
  15546. Set mode of operation of the filter.
  15547. Can be one of the following:
  15548. @table @samp
  15549. @item select
  15550. Select every frame with side data of @code{type}.
  15551. @item delete
  15552. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15553. data in the frame.
  15554. @end table
  15555. @item type
  15556. Set side data type used with all modes. Must be set for @code{select} mode. For
  15557. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15558. in @file{libavutil/frame.h}. For example, to choose
  15559. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15560. @end table
  15561. @section spectrumsynth
  15562. Sythesize audio from 2 input video spectrums, first input stream represents
  15563. magnitude across time and second represents phase across time.
  15564. The filter will transform from frequency domain as displayed in videos back
  15565. to time domain as presented in audio output.
  15566. This filter is primarily created for reversing processed @ref{showspectrum}
  15567. filter outputs, but can synthesize sound from other spectrograms too.
  15568. But in such case results are going to be poor if the phase data is not
  15569. available, because in such cases phase data need to be recreated, usually
  15570. its just recreated from random noise.
  15571. For best results use gray only output (@code{channel} color mode in
  15572. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15573. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15574. @code{data} option. Inputs videos should generally use @code{fullframe}
  15575. slide mode as that saves resources needed for decoding video.
  15576. The filter accepts the following options:
  15577. @table @option
  15578. @item sample_rate
  15579. Specify sample rate of output audio, the sample rate of audio from which
  15580. spectrum was generated may differ.
  15581. @item channels
  15582. Set number of channels represented in input video spectrums.
  15583. @item scale
  15584. Set scale which was used when generating magnitude input spectrum.
  15585. Can be @code{lin} or @code{log}. Default is @code{log}.
  15586. @item slide
  15587. Set slide which was used when generating inputs spectrums.
  15588. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15589. Default is @code{fullframe}.
  15590. @item win_func
  15591. Set window function used for resynthesis.
  15592. @item overlap
  15593. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15594. which means optimal overlap for selected window function will be picked.
  15595. @item orientation
  15596. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15597. Default is @code{vertical}.
  15598. @end table
  15599. @subsection Examples
  15600. @itemize
  15601. @item
  15602. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15603. then resynthesize videos back to audio with spectrumsynth:
  15604. @example
  15605. 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
  15606. 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
  15607. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15608. @end example
  15609. @end itemize
  15610. @section split, asplit
  15611. Split input into several identical outputs.
  15612. @code{asplit} works with audio input, @code{split} with video.
  15613. The filter accepts a single parameter which specifies the number of outputs. If
  15614. unspecified, it defaults to 2.
  15615. @subsection Examples
  15616. @itemize
  15617. @item
  15618. Create two separate outputs from the same input:
  15619. @example
  15620. [in] split [out0][out1]
  15621. @end example
  15622. @item
  15623. To create 3 or more outputs, you need to specify the number of
  15624. outputs, like in:
  15625. @example
  15626. [in] asplit=3 [out0][out1][out2]
  15627. @end example
  15628. @item
  15629. Create two separate outputs from the same input, one cropped and
  15630. one padded:
  15631. @example
  15632. [in] split [splitout1][splitout2];
  15633. [splitout1] crop=100:100:0:0 [cropout];
  15634. [splitout2] pad=200:200:100:100 [padout];
  15635. @end example
  15636. @item
  15637. Create 5 copies of the input audio with @command{ffmpeg}:
  15638. @example
  15639. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15640. @end example
  15641. @end itemize
  15642. @section zmq, azmq
  15643. Receive commands sent through a libzmq client, and forward them to
  15644. filters in the filtergraph.
  15645. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15646. must be inserted between two video filters, @code{azmq} between two
  15647. audio filters. Both are capable to send messages to any filter type.
  15648. To enable these filters you need to install the libzmq library and
  15649. headers and configure FFmpeg with @code{--enable-libzmq}.
  15650. For more information about libzmq see:
  15651. @url{http://www.zeromq.org/}
  15652. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15653. receives messages sent through a network interface defined by the
  15654. @option{bind_address} (or the abbreviation "@option{b}") option.
  15655. Default value of this option is @file{tcp://localhost:5555}. You may
  15656. want to alter this value to your needs, but do not forget to escape any
  15657. ':' signs (see @ref{filtergraph escaping}).
  15658. The received message must be in the form:
  15659. @example
  15660. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15661. @end example
  15662. @var{TARGET} specifies the target of the command, usually the name of
  15663. the filter class or a specific filter instance name. The default
  15664. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15665. but you can override this by using the @samp{filter_name@@id} syntax
  15666. (see @ref{Filtergraph syntax}).
  15667. @var{COMMAND} specifies the name of the command for the target filter.
  15668. @var{ARG} is optional and specifies the optional argument list for the
  15669. given @var{COMMAND}.
  15670. Upon reception, the message is processed and the corresponding command
  15671. is injected into the filtergraph. Depending on the result, the filter
  15672. will send a reply to the client, adopting the format:
  15673. @example
  15674. @var{ERROR_CODE} @var{ERROR_REASON}
  15675. @var{MESSAGE}
  15676. @end example
  15677. @var{MESSAGE} is optional.
  15678. @subsection Examples
  15679. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15680. be used to send commands processed by these filters.
  15681. Consider the following filtergraph generated by @command{ffplay}.
  15682. In this example the last overlay filter has an instance name. All other
  15683. filters will have default instance names.
  15684. @example
  15685. ffplay -dumpgraph 1 -f lavfi "
  15686. color=s=100x100:c=red [l];
  15687. color=s=100x100:c=blue [r];
  15688. nullsrc=s=200x100, zmq [bg];
  15689. [bg][l] overlay [bg+l];
  15690. [bg+l][r] overlay@@my=x=100 "
  15691. @end example
  15692. To change the color of the left side of the video, the following
  15693. command can be used:
  15694. @example
  15695. echo Parsed_color_0 c yellow | tools/zmqsend
  15696. @end example
  15697. To change the right side:
  15698. @example
  15699. echo Parsed_color_1 c pink | tools/zmqsend
  15700. @end example
  15701. To change the position of the right side:
  15702. @example
  15703. echo overlay@@my x 150 | tools/zmqsend
  15704. @end example
  15705. @c man end MULTIMEDIA FILTERS
  15706. @chapter Multimedia Sources
  15707. @c man begin MULTIMEDIA SOURCES
  15708. Below is a description of the currently available multimedia sources.
  15709. @section amovie
  15710. This is the same as @ref{movie} source, except it selects an audio
  15711. stream by default.
  15712. @anchor{movie}
  15713. @section movie
  15714. Read audio and/or video stream(s) from a movie container.
  15715. It accepts the following parameters:
  15716. @table @option
  15717. @item filename
  15718. The name of the resource to read (not necessarily a file; it can also be a
  15719. device or a stream accessed through some protocol).
  15720. @item format_name, f
  15721. Specifies the format assumed for the movie to read, and can be either
  15722. the name of a container or an input device. If not specified, the
  15723. format is guessed from @var{movie_name} or by probing.
  15724. @item seek_point, sp
  15725. Specifies the seek point in seconds. The frames will be output
  15726. starting from this seek point. The parameter is evaluated with
  15727. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15728. postfix. The default value is "0".
  15729. @item streams, s
  15730. Specifies the streams to read. Several streams can be specified,
  15731. separated by "+". The source will then have as many outputs, in the
  15732. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15733. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15734. respectively the default (best suited) video and audio stream. Default
  15735. is "dv", or "da" if the filter is called as "amovie".
  15736. @item stream_index, si
  15737. Specifies the index of the video stream to read. If the value is -1,
  15738. the most suitable video stream will be automatically selected. The default
  15739. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15740. audio instead of video.
  15741. @item loop
  15742. Specifies how many times to read the stream in sequence.
  15743. If the value is 0, the stream will be looped infinitely.
  15744. Default value is "1".
  15745. Note that when the movie is looped the source timestamps are not
  15746. changed, so it will generate non monotonically increasing timestamps.
  15747. @item discontinuity
  15748. Specifies the time difference between frames above which the point is
  15749. considered a timestamp discontinuity which is removed by adjusting the later
  15750. timestamps.
  15751. @end table
  15752. It allows overlaying a second video on top of the main input of
  15753. a filtergraph, as shown in this graph:
  15754. @example
  15755. input -----------> deltapts0 --> overlay --> output
  15756. ^
  15757. |
  15758. movie --> scale--> deltapts1 -------+
  15759. @end example
  15760. @subsection Examples
  15761. @itemize
  15762. @item
  15763. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15764. on top of the input labelled "in":
  15765. @example
  15766. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15767. [in] setpts=PTS-STARTPTS [main];
  15768. [main][over] overlay=16:16 [out]
  15769. @end example
  15770. @item
  15771. Read from a video4linux2 device, and overlay it on top of the input
  15772. labelled "in":
  15773. @example
  15774. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15775. [in] setpts=PTS-STARTPTS [main];
  15776. [main][over] overlay=16:16 [out]
  15777. @end example
  15778. @item
  15779. Read the first video stream and the audio stream with id 0x81 from
  15780. dvd.vob; the video is connected to the pad named "video" and the audio is
  15781. connected to the pad named "audio":
  15782. @example
  15783. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15784. @end example
  15785. @end itemize
  15786. @subsection Commands
  15787. Both movie and amovie support the following commands:
  15788. @table @option
  15789. @item seek
  15790. Perform seek using "av_seek_frame".
  15791. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15792. @itemize
  15793. @item
  15794. @var{stream_index}: If stream_index is -1, a default
  15795. stream is selected, and @var{timestamp} is automatically converted
  15796. from AV_TIME_BASE units to the stream specific time_base.
  15797. @item
  15798. @var{timestamp}: Timestamp in AVStream.time_base units
  15799. or, if no stream is specified, in AV_TIME_BASE units.
  15800. @item
  15801. @var{flags}: Flags which select direction and seeking mode.
  15802. @end itemize
  15803. @item get_duration
  15804. Get movie duration in AV_TIME_BASE units.
  15805. @end table
  15806. @c man end MULTIMEDIA SOURCES