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.

20684 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. @item canny
  6380. Apply Canny edge detector on all selected planes.
  6381. @end table
  6382. Default value is @var{wires}.
  6383. @end table
  6384. @subsection Examples
  6385. @itemize
  6386. @item
  6387. Standard edge detection with custom values for the hysteresis thresholding:
  6388. @example
  6389. edgedetect=low=0.1:high=0.4
  6390. @end example
  6391. @item
  6392. Painting effect without thresholding:
  6393. @example
  6394. edgedetect=mode=colormix:high=0
  6395. @end example
  6396. @end itemize
  6397. @section eq
  6398. Set brightness, contrast, saturation and approximate gamma adjustment.
  6399. The filter accepts the following options:
  6400. @table @option
  6401. @item contrast
  6402. Set the contrast expression. The value must be a float value in range
  6403. @code{-2.0} to @code{2.0}. The default value is "1".
  6404. @item brightness
  6405. Set the brightness expression. The value must be a float value in
  6406. range @code{-1.0} to @code{1.0}. The default value is "0".
  6407. @item saturation
  6408. Set the saturation expression. The value must be a float in
  6409. range @code{0.0} to @code{3.0}. The default value is "1".
  6410. @item gamma
  6411. Set the gamma expression. The value must be a float in range
  6412. @code{0.1} to @code{10.0}. The default value is "1".
  6413. @item gamma_r
  6414. Set the gamma expression for red. The value must be a float in
  6415. range @code{0.1} to @code{10.0}. The default value is "1".
  6416. @item gamma_g
  6417. Set the gamma expression for green. The value must be a float in range
  6418. @code{0.1} to @code{10.0}. The default value is "1".
  6419. @item gamma_b
  6420. Set the gamma expression for blue. The value must be a float in range
  6421. @code{0.1} to @code{10.0}. The default value is "1".
  6422. @item gamma_weight
  6423. Set the gamma weight expression. It can be used to reduce the effect
  6424. of a high gamma value on bright image areas, e.g. keep them from
  6425. getting overamplified and just plain white. The value must be a float
  6426. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6427. gamma correction all the way down while @code{1.0} leaves it at its
  6428. full strength. Default is "1".
  6429. @item eval
  6430. Set when the expressions for brightness, contrast, saturation and
  6431. gamma expressions are evaluated.
  6432. It accepts the following values:
  6433. @table @samp
  6434. @item init
  6435. only evaluate expressions once during the filter initialization or
  6436. when a command is processed
  6437. @item frame
  6438. evaluate expressions for each incoming frame
  6439. @end table
  6440. Default value is @samp{init}.
  6441. @end table
  6442. The expressions accept the following parameters:
  6443. @table @option
  6444. @item n
  6445. frame count of the input frame starting from 0
  6446. @item pos
  6447. byte position of the corresponding packet in the input file, NAN if
  6448. unspecified
  6449. @item r
  6450. frame rate of the input video, NAN if the input frame rate is unknown
  6451. @item t
  6452. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6453. @end table
  6454. @subsection Commands
  6455. The filter supports the following commands:
  6456. @table @option
  6457. @item contrast
  6458. Set the contrast expression.
  6459. @item brightness
  6460. Set the brightness expression.
  6461. @item saturation
  6462. Set the saturation expression.
  6463. @item gamma
  6464. Set the gamma expression.
  6465. @item gamma_r
  6466. Set the gamma_r expression.
  6467. @item gamma_g
  6468. Set gamma_g expression.
  6469. @item gamma_b
  6470. Set gamma_b expression.
  6471. @item gamma_weight
  6472. Set gamma_weight expression.
  6473. The command accepts the same syntax of the corresponding option.
  6474. If the specified expression is not valid, it is kept at its current
  6475. value.
  6476. @end table
  6477. @section erosion
  6478. Apply erosion effect to the video.
  6479. This filter replaces the pixel by the local(3x3) minimum.
  6480. It accepts the following options:
  6481. @table @option
  6482. @item threshold0
  6483. @item threshold1
  6484. @item threshold2
  6485. @item threshold3
  6486. Limit the maximum change for each plane, default is 65535.
  6487. If 0, plane will remain unchanged.
  6488. @item coordinates
  6489. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6490. pixels are used.
  6491. Flags to local 3x3 coordinates maps like this:
  6492. 1 2 3
  6493. 4 5
  6494. 6 7 8
  6495. @end table
  6496. @section extractplanes
  6497. Extract color channel components from input video stream into
  6498. separate grayscale video streams.
  6499. The filter accepts the following option:
  6500. @table @option
  6501. @item planes
  6502. Set plane(s) to extract.
  6503. Available values for planes are:
  6504. @table @samp
  6505. @item y
  6506. @item u
  6507. @item v
  6508. @item a
  6509. @item r
  6510. @item g
  6511. @item b
  6512. @end table
  6513. Choosing planes not available in the input will result in an error.
  6514. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6515. with @code{y}, @code{u}, @code{v} planes at same time.
  6516. @end table
  6517. @subsection Examples
  6518. @itemize
  6519. @item
  6520. Extract luma, u and v color channel component from input video frame
  6521. into 3 grayscale outputs:
  6522. @example
  6523. 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
  6524. @end example
  6525. @end itemize
  6526. @section elbg
  6527. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6528. For each input image, the filter will compute the optimal mapping from
  6529. the input to the output given the codebook length, that is the number
  6530. of distinct output colors.
  6531. This filter accepts the following options.
  6532. @table @option
  6533. @item codebook_length, l
  6534. Set codebook length. The value must be a positive integer, and
  6535. represents the number of distinct output colors. Default value is 256.
  6536. @item nb_steps, n
  6537. Set the maximum number of iterations to apply for computing the optimal
  6538. mapping. The higher the value the better the result and the higher the
  6539. computation time. Default value is 1.
  6540. @item seed, s
  6541. Set a random seed, must be an integer included between 0 and
  6542. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6543. will try to use a good random seed on a best effort basis.
  6544. @item pal8
  6545. Set pal8 output pixel format. This option does not work with codebook
  6546. length greater than 256.
  6547. @end table
  6548. @section entropy
  6549. Measure graylevel entropy in histogram of color channels of video frames.
  6550. It accepts the following parameters:
  6551. @table @option
  6552. @item mode
  6553. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6554. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6555. between neighbour histogram values.
  6556. @end table
  6557. @section fade
  6558. Apply a fade-in/out effect to the input video.
  6559. It accepts the following parameters:
  6560. @table @option
  6561. @item type, t
  6562. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6563. effect.
  6564. Default is @code{in}.
  6565. @item start_frame, s
  6566. Specify the number of the frame to start applying the fade
  6567. effect at. Default is 0.
  6568. @item nb_frames, n
  6569. The number of frames that the fade effect lasts. At the end of the
  6570. fade-in effect, the output video will have the same intensity as the input video.
  6571. At the end of the fade-out transition, the output video will be filled with the
  6572. selected @option{color}.
  6573. Default is 25.
  6574. @item alpha
  6575. If set to 1, fade only alpha channel, if one exists on the input.
  6576. Default value is 0.
  6577. @item start_time, st
  6578. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6579. effect. If both start_frame and start_time are specified, the fade will start at
  6580. whichever comes last. Default is 0.
  6581. @item duration, d
  6582. The number of seconds for which the fade effect has to last. At the end of the
  6583. fade-in effect the output video will have the same intensity as the input video,
  6584. at the end of the fade-out transition the output video will be filled with the
  6585. selected @option{color}.
  6586. If both duration and nb_frames are specified, duration is used. Default is 0
  6587. (nb_frames is used by default).
  6588. @item color, c
  6589. Specify the color of the fade. Default is "black".
  6590. @end table
  6591. @subsection Examples
  6592. @itemize
  6593. @item
  6594. Fade in the first 30 frames of video:
  6595. @example
  6596. fade=in:0:30
  6597. @end example
  6598. The command above is equivalent to:
  6599. @example
  6600. fade=t=in:s=0:n=30
  6601. @end example
  6602. @item
  6603. Fade out the last 45 frames of a 200-frame video:
  6604. @example
  6605. fade=out:155:45
  6606. fade=type=out:start_frame=155:nb_frames=45
  6607. @end example
  6608. @item
  6609. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6610. @example
  6611. fade=in:0:25, fade=out:975:25
  6612. @end example
  6613. @item
  6614. Make the first 5 frames yellow, then fade in from frame 5-24:
  6615. @example
  6616. fade=in:5:20:color=yellow
  6617. @end example
  6618. @item
  6619. Fade in alpha over first 25 frames of video:
  6620. @example
  6621. fade=in:0:25:alpha=1
  6622. @end example
  6623. @item
  6624. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6625. @example
  6626. fade=t=in:st=5.5:d=0.5
  6627. @end example
  6628. @end itemize
  6629. @section fftfilt
  6630. Apply arbitrary expressions to samples in frequency domain
  6631. @table @option
  6632. @item dc_Y
  6633. Adjust the dc value (gain) of the luma plane of the image. The filter
  6634. accepts an integer value in range @code{0} to @code{1000}. The default
  6635. value is set to @code{0}.
  6636. @item dc_U
  6637. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6638. filter accepts an integer value in range @code{0} to @code{1000}. The
  6639. default value is set to @code{0}.
  6640. @item dc_V
  6641. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6642. filter accepts an integer value in range @code{0} to @code{1000}. The
  6643. default value is set to @code{0}.
  6644. @item weight_Y
  6645. Set the frequency domain weight expression for the luma plane.
  6646. @item weight_U
  6647. Set the frequency domain weight expression for the 1st chroma plane.
  6648. @item weight_V
  6649. Set the frequency domain weight expression for the 2nd chroma plane.
  6650. @item eval
  6651. Set when the expressions are evaluated.
  6652. It accepts the following values:
  6653. @table @samp
  6654. @item init
  6655. Only evaluate expressions once during the filter initialization.
  6656. @item frame
  6657. Evaluate expressions for each incoming frame.
  6658. @end table
  6659. Default value is @samp{init}.
  6660. The filter accepts the following variables:
  6661. @item X
  6662. @item Y
  6663. The coordinates of the current sample.
  6664. @item W
  6665. @item H
  6666. The width and height of the image.
  6667. @item N
  6668. The number of input frame, starting from 0.
  6669. @end table
  6670. @subsection Examples
  6671. @itemize
  6672. @item
  6673. High-pass:
  6674. @example
  6675. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6676. @end example
  6677. @item
  6678. Low-pass:
  6679. @example
  6680. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6681. @end example
  6682. @item
  6683. Sharpen:
  6684. @example
  6685. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6686. @end example
  6687. @item
  6688. Blur:
  6689. @example
  6690. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6691. @end example
  6692. @end itemize
  6693. @section field
  6694. Extract a single field from an interlaced image using stride
  6695. arithmetic to avoid wasting CPU time. The output frames are marked as
  6696. non-interlaced.
  6697. The filter accepts the following options:
  6698. @table @option
  6699. @item type
  6700. Specify whether to extract the top (if the value is @code{0} or
  6701. @code{top}) or the bottom field (if the value is @code{1} or
  6702. @code{bottom}).
  6703. @end table
  6704. @section fieldhint
  6705. Create new frames by copying the top and bottom fields from surrounding frames
  6706. supplied as numbers by the hint file.
  6707. @table @option
  6708. @item hint
  6709. Set file containing hints: absolute/relative frame numbers.
  6710. There must be one line for each frame in a clip. Each line must contain two
  6711. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6712. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6713. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6714. for @code{relative} mode. First number tells from which frame to pick up top
  6715. field and second number tells from which frame to pick up bottom field.
  6716. If optionally followed by @code{+} output frame will be marked as interlaced,
  6717. else if followed by @code{-} output frame will be marked as progressive, else
  6718. it will be marked same as input frame.
  6719. If line starts with @code{#} or @code{;} that line is skipped.
  6720. @item mode
  6721. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6722. @end table
  6723. Example of first several lines of @code{hint} file for @code{relative} mode:
  6724. @example
  6725. 0,0 - # first frame
  6726. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6727. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6728. 1,0 -
  6729. 0,0 -
  6730. 0,0 -
  6731. 1,0 -
  6732. 1,0 -
  6733. 1,0 -
  6734. 0,0 -
  6735. 0,0 -
  6736. 1,0 -
  6737. 1,0 -
  6738. 1,0 -
  6739. 0,0 -
  6740. @end example
  6741. @section fieldmatch
  6742. Field matching filter for inverse telecine. It is meant to reconstruct the
  6743. progressive frames from a telecined stream. The filter does not drop duplicated
  6744. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6745. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6746. The separation of the field matching and the decimation is notably motivated by
  6747. the possibility of inserting a de-interlacing filter fallback between the two.
  6748. If the source has mixed telecined and real interlaced content,
  6749. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6750. But these remaining combed frames will be marked as interlaced, and thus can be
  6751. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6752. In addition to the various configuration options, @code{fieldmatch} can take an
  6753. optional second stream, activated through the @option{ppsrc} option. If
  6754. enabled, the frames reconstruction will be based on the fields and frames from
  6755. this second stream. This allows the first input to be pre-processed in order to
  6756. help the various algorithms of the filter, while keeping the output lossless
  6757. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6758. or brightness/contrast adjustments can help.
  6759. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6760. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6761. which @code{fieldmatch} is based on. While the semantic and usage are very
  6762. close, some behaviour and options names can differ.
  6763. The @ref{decimate} filter currently only works for constant frame rate input.
  6764. If your input has mixed telecined (30fps) and progressive content with a lower
  6765. framerate like 24fps use the following filterchain to produce the necessary cfr
  6766. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6767. The filter accepts the following options:
  6768. @table @option
  6769. @item order
  6770. Specify the assumed field order of the input stream. Available values are:
  6771. @table @samp
  6772. @item auto
  6773. Auto detect parity (use FFmpeg's internal parity value).
  6774. @item bff
  6775. Assume bottom field first.
  6776. @item tff
  6777. Assume top field first.
  6778. @end table
  6779. Note that it is sometimes recommended not to trust the parity announced by the
  6780. stream.
  6781. Default value is @var{auto}.
  6782. @item mode
  6783. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6784. sense that it won't risk creating jerkiness due to duplicate frames when
  6785. possible, but if there are bad edits or blended fields it will end up
  6786. outputting combed frames when a good match might actually exist. On the other
  6787. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6788. but will almost always find a good frame if there is one. The other values are
  6789. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6790. jerkiness and creating duplicate frames versus finding good matches in sections
  6791. with bad edits, orphaned fields, blended fields, etc.
  6792. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6793. Available values are:
  6794. @table @samp
  6795. @item pc
  6796. 2-way matching (p/c)
  6797. @item pc_n
  6798. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6799. @item pc_u
  6800. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6801. @item pc_n_ub
  6802. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6803. still combed (p/c + n + u/b)
  6804. @item pcn
  6805. 3-way matching (p/c/n)
  6806. @item pcn_ub
  6807. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6808. detected as combed (p/c/n + u/b)
  6809. @end table
  6810. The parenthesis at the end indicate the matches that would be used for that
  6811. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6812. @var{top}).
  6813. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6814. the slowest.
  6815. Default value is @var{pc_n}.
  6816. @item ppsrc
  6817. Mark the main input stream as a pre-processed input, and enable the secondary
  6818. input stream as the clean source to pick the fields from. See the filter
  6819. introduction for more details. It is similar to the @option{clip2} feature from
  6820. VFM/TFM.
  6821. Default value is @code{0} (disabled).
  6822. @item field
  6823. Set the field to match from. It is recommended to set this to the same value as
  6824. @option{order} unless you experience matching failures with that setting. In
  6825. certain circumstances changing the field that is used to match from can have a
  6826. large impact on matching performance. Available values are:
  6827. @table @samp
  6828. @item auto
  6829. Automatic (same value as @option{order}).
  6830. @item bottom
  6831. Match from the bottom field.
  6832. @item top
  6833. Match from the top field.
  6834. @end table
  6835. Default value is @var{auto}.
  6836. @item mchroma
  6837. Set whether or not chroma is included during the match comparisons. In most
  6838. cases it is recommended to leave this enabled. You should set this to @code{0}
  6839. only if your clip has bad chroma problems such as heavy rainbowing or other
  6840. artifacts. Setting this to @code{0} could also be used to speed things up at
  6841. the cost of some accuracy.
  6842. Default value is @code{1}.
  6843. @item y0
  6844. @item y1
  6845. These define an exclusion band which excludes the lines between @option{y0} and
  6846. @option{y1} from being included in the field matching decision. An exclusion
  6847. band can be used to ignore subtitles, a logo, or other things that may
  6848. interfere with the matching. @option{y0} sets the starting scan line and
  6849. @option{y1} sets the ending line; all lines in between @option{y0} and
  6850. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6851. @option{y0} and @option{y1} to the same value will disable the feature.
  6852. @option{y0} and @option{y1} defaults to @code{0}.
  6853. @item scthresh
  6854. Set the scene change detection threshold as a percentage of maximum change on
  6855. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6856. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6857. @option{scthresh} is @code{[0.0, 100.0]}.
  6858. Default value is @code{12.0}.
  6859. @item combmatch
  6860. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6861. account the combed scores of matches when deciding what match to use as the
  6862. final match. Available values are:
  6863. @table @samp
  6864. @item none
  6865. No final matching based on combed scores.
  6866. @item sc
  6867. Combed scores are only used when a scene change is detected.
  6868. @item full
  6869. Use combed scores all the time.
  6870. @end table
  6871. Default is @var{sc}.
  6872. @item combdbg
  6873. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6874. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6875. Available values are:
  6876. @table @samp
  6877. @item none
  6878. No forced calculation.
  6879. @item pcn
  6880. Force p/c/n calculations.
  6881. @item pcnub
  6882. Force p/c/n/u/b calculations.
  6883. @end table
  6884. Default value is @var{none}.
  6885. @item cthresh
  6886. This is the area combing threshold used for combed frame detection. This
  6887. essentially controls how "strong" or "visible" combing must be to be detected.
  6888. Larger values mean combing must be more visible and smaller values mean combing
  6889. can be less visible or strong and still be detected. Valid settings are from
  6890. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6891. be detected as combed). This is basically a pixel difference value. A good
  6892. range is @code{[8, 12]}.
  6893. Default value is @code{9}.
  6894. @item chroma
  6895. Sets whether or not chroma is considered in the combed frame decision. Only
  6896. disable this if your source has chroma problems (rainbowing, etc.) that are
  6897. causing problems for the combed frame detection with chroma enabled. Actually,
  6898. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6899. where there is chroma only combing in the source.
  6900. Default value is @code{0}.
  6901. @item blockx
  6902. @item blocky
  6903. Respectively set the x-axis and y-axis size of the window used during combed
  6904. frame detection. This has to do with the size of the area in which
  6905. @option{combpel} pixels are required to be detected as combed for a frame to be
  6906. declared combed. See the @option{combpel} parameter description for more info.
  6907. Possible values are any number that is a power of 2 starting at 4 and going up
  6908. to 512.
  6909. Default value is @code{16}.
  6910. @item combpel
  6911. The number of combed pixels inside any of the @option{blocky} by
  6912. @option{blockx} size blocks on the frame for the frame to be detected as
  6913. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6914. setting controls "how much" combing there must be in any localized area (a
  6915. window defined by the @option{blockx} and @option{blocky} settings) on the
  6916. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6917. which point no frames will ever be detected as combed). This setting is known
  6918. as @option{MI} in TFM/VFM vocabulary.
  6919. Default value is @code{80}.
  6920. @end table
  6921. @anchor{p/c/n/u/b meaning}
  6922. @subsection p/c/n/u/b meaning
  6923. @subsubsection p/c/n
  6924. We assume the following telecined stream:
  6925. @example
  6926. Top fields: 1 2 2 3 4
  6927. Bottom fields: 1 2 3 4 4
  6928. @end example
  6929. The numbers correspond to the progressive frame the fields relate to. Here, the
  6930. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6931. When @code{fieldmatch} is configured to run a matching from bottom
  6932. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6933. @example
  6934. Input stream:
  6935. T 1 2 2 3 4
  6936. B 1 2 3 4 4 <-- matching reference
  6937. Matches: c c n n c
  6938. Output stream:
  6939. T 1 2 3 4 4
  6940. B 1 2 3 4 4
  6941. @end example
  6942. As a result of the field matching, we can see that some frames get duplicated.
  6943. To perform a complete inverse telecine, you need to rely on a decimation filter
  6944. after this operation. See for instance the @ref{decimate} filter.
  6945. The same operation now matching from top fields (@option{field}=@var{top})
  6946. looks like this:
  6947. @example
  6948. Input stream:
  6949. T 1 2 2 3 4 <-- matching reference
  6950. B 1 2 3 4 4
  6951. Matches: c c p p c
  6952. Output stream:
  6953. T 1 2 2 3 4
  6954. B 1 2 2 3 4
  6955. @end example
  6956. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6957. basically, they refer to the frame and field of the opposite parity:
  6958. @itemize
  6959. @item @var{p} matches the field of the opposite parity in the previous frame
  6960. @item @var{c} matches the field of the opposite parity in the current frame
  6961. @item @var{n} matches the field of the opposite parity in the next frame
  6962. @end itemize
  6963. @subsubsection u/b
  6964. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6965. from the opposite parity flag. In the following examples, we assume that we are
  6966. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6967. 'x' is placed above and below each matched fields.
  6968. With bottom matching (@option{field}=@var{bottom}):
  6969. @example
  6970. Match: c p n b u
  6971. x x x x x
  6972. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6973. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6974. x x x x x
  6975. Output frames:
  6976. 2 1 2 2 2
  6977. 2 2 2 1 3
  6978. @end example
  6979. With top matching (@option{field}=@var{top}):
  6980. @example
  6981. Match: c p n b u
  6982. x x x x x
  6983. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6984. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6985. x x x x x
  6986. Output frames:
  6987. 2 2 2 1 2
  6988. 2 1 3 2 2
  6989. @end example
  6990. @subsection Examples
  6991. Simple IVTC of a top field first telecined stream:
  6992. @example
  6993. fieldmatch=order=tff:combmatch=none, decimate
  6994. @end example
  6995. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6996. @example
  6997. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6998. @end example
  6999. @section fieldorder
  7000. Transform the field order of the input video.
  7001. It accepts the following parameters:
  7002. @table @option
  7003. @item order
  7004. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7005. for bottom field first.
  7006. @end table
  7007. The default value is @samp{tff}.
  7008. The transformation is done by shifting the picture content up or down
  7009. by one line, and filling the remaining line with appropriate picture content.
  7010. This method is consistent with most broadcast field order converters.
  7011. If the input video is not flagged as being interlaced, or it is already
  7012. flagged as being of the required output field order, then this filter does
  7013. not alter the incoming video.
  7014. It is very useful when converting to or from PAL DV material,
  7015. which is bottom field first.
  7016. For example:
  7017. @example
  7018. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7019. @end example
  7020. @section fifo, afifo
  7021. Buffer input images and send them when they are requested.
  7022. It is mainly useful when auto-inserted by the libavfilter
  7023. framework.
  7024. It does not take parameters.
  7025. @section fillborders
  7026. Fill borders of the input video, without changing video stream dimensions.
  7027. Sometimes video can have garbage at the four edges and you may not want to
  7028. crop video input to keep size multiple of some number.
  7029. This filter accepts the following options:
  7030. @table @option
  7031. @item left
  7032. Number of pixels to fill from left border.
  7033. @item right
  7034. Number of pixels to fill from right border.
  7035. @item top
  7036. Number of pixels to fill from top border.
  7037. @item bottom
  7038. Number of pixels to fill from bottom border.
  7039. @item mode
  7040. Set fill mode.
  7041. It accepts the following values:
  7042. @table @samp
  7043. @item smear
  7044. fill pixels using outermost pixels
  7045. @item mirror
  7046. fill pixels using mirroring
  7047. @item fixed
  7048. fill pixels with constant value
  7049. @end table
  7050. Default is @var{smear}.
  7051. @item color
  7052. Set color for pixels in fixed mode. Default is @var{black}.
  7053. @end table
  7054. @section find_rect
  7055. Find a rectangular object
  7056. It accepts the following options:
  7057. @table @option
  7058. @item object
  7059. Filepath of the object image, needs to be in gray8.
  7060. @item threshold
  7061. Detection threshold, default is 0.5.
  7062. @item mipmaps
  7063. Number of mipmaps, default is 3.
  7064. @item xmin, ymin, xmax, ymax
  7065. Specifies the rectangle in which to search.
  7066. @end table
  7067. @subsection Examples
  7068. @itemize
  7069. @item
  7070. Generate a representative palette of a given video using @command{ffmpeg}:
  7071. @example
  7072. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7073. @end example
  7074. @end itemize
  7075. @section cover_rect
  7076. Cover a rectangular object
  7077. It accepts the following options:
  7078. @table @option
  7079. @item cover
  7080. Filepath of the optional cover image, needs to be in yuv420.
  7081. @item mode
  7082. Set covering mode.
  7083. It accepts the following values:
  7084. @table @samp
  7085. @item cover
  7086. cover it by the supplied image
  7087. @item blur
  7088. cover it by interpolating the surrounding pixels
  7089. @end table
  7090. Default value is @var{blur}.
  7091. @end table
  7092. @subsection Examples
  7093. @itemize
  7094. @item
  7095. Generate a representative palette of a given video using @command{ffmpeg}:
  7096. @example
  7097. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7098. @end example
  7099. @end itemize
  7100. @section floodfill
  7101. Flood area with values of same pixel components with another values.
  7102. It accepts the following options:
  7103. @table @option
  7104. @item x
  7105. Set pixel x coordinate.
  7106. @item y
  7107. Set pixel y coordinate.
  7108. @item s0
  7109. Set source #0 component value.
  7110. @item s1
  7111. Set source #1 component value.
  7112. @item s2
  7113. Set source #2 component value.
  7114. @item s3
  7115. Set source #3 component value.
  7116. @item d0
  7117. Set destination #0 component value.
  7118. @item d1
  7119. Set destination #1 component value.
  7120. @item d2
  7121. Set destination #2 component value.
  7122. @item d3
  7123. Set destination #3 component value.
  7124. @end table
  7125. @anchor{format}
  7126. @section format
  7127. Convert the input video to one of the specified pixel formats.
  7128. Libavfilter will try to pick one that is suitable as input to
  7129. the next filter.
  7130. It accepts the following parameters:
  7131. @table @option
  7132. @item pix_fmts
  7133. A '|'-separated list of pixel format names, such as
  7134. "pix_fmts=yuv420p|monow|rgb24".
  7135. @end table
  7136. @subsection Examples
  7137. @itemize
  7138. @item
  7139. Convert the input video to the @var{yuv420p} format
  7140. @example
  7141. format=pix_fmts=yuv420p
  7142. @end example
  7143. Convert the input video to any of the formats in the list
  7144. @example
  7145. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7146. @end example
  7147. @end itemize
  7148. @anchor{fps}
  7149. @section fps
  7150. Convert the video to specified constant frame rate by duplicating or dropping
  7151. frames as necessary.
  7152. It accepts the following parameters:
  7153. @table @option
  7154. @item fps
  7155. The desired output frame rate. The default is @code{25}.
  7156. @item start_time
  7157. Assume the first PTS should be the given value, in seconds. This allows for
  7158. padding/trimming at the start of stream. By default, no assumption is made
  7159. about the first frame's expected PTS, so no padding or trimming is done.
  7160. For example, this could be set to 0 to pad the beginning with duplicates of
  7161. the first frame if a video stream starts after the audio stream or to trim any
  7162. frames with a negative PTS.
  7163. @item round
  7164. Timestamp (PTS) rounding method.
  7165. Possible values are:
  7166. @table @option
  7167. @item zero
  7168. round towards 0
  7169. @item inf
  7170. round away from 0
  7171. @item down
  7172. round towards -infinity
  7173. @item up
  7174. round towards +infinity
  7175. @item near
  7176. round to nearest
  7177. @end table
  7178. The default is @code{near}.
  7179. @item eof_action
  7180. Action performed when reading the last frame.
  7181. Possible values are:
  7182. @table @option
  7183. @item round
  7184. Use same timestamp rounding method as used for other frames.
  7185. @item pass
  7186. Pass through last frame if input duration has not been reached yet.
  7187. @end table
  7188. The default is @code{round}.
  7189. @end table
  7190. Alternatively, the options can be specified as a flat string:
  7191. @var{fps}[:@var{start_time}[:@var{round}]].
  7192. See also the @ref{setpts} filter.
  7193. @subsection Examples
  7194. @itemize
  7195. @item
  7196. A typical usage in order to set the fps to 25:
  7197. @example
  7198. fps=fps=25
  7199. @end example
  7200. @item
  7201. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7202. @example
  7203. fps=fps=film:round=near
  7204. @end example
  7205. @end itemize
  7206. @section framepack
  7207. Pack two different video streams into a stereoscopic video, setting proper
  7208. metadata on supported codecs. The two views should have the same size and
  7209. framerate and processing will stop when the shorter video ends. Please note
  7210. that you may conveniently adjust view properties with the @ref{scale} and
  7211. @ref{fps} filters.
  7212. It accepts the following parameters:
  7213. @table @option
  7214. @item format
  7215. The desired packing format. Supported values are:
  7216. @table @option
  7217. @item sbs
  7218. The views are next to each other (default).
  7219. @item tab
  7220. The views are on top of each other.
  7221. @item lines
  7222. The views are packed by line.
  7223. @item columns
  7224. The views are packed by column.
  7225. @item frameseq
  7226. The views are temporally interleaved.
  7227. @end table
  7228. @end table
  7229. Some examples:
  7230. @example
  7231. # Convert left and right views into a frame-sequential video
  7232. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7233. # Convert views into a side-by-side video with the same output resolution as the input
  7234. 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
  7235. @end example
  7236. @section framerate
  7237. Change the frame rate by interpolating new video output frames from the source
  7238. frames.
  7239. This filter is not designed to function correctly with interlaced media. If
  7240. you wish to change the frame rate of interlaced media then you are required
  7241. to deinterlace before this filter and re-interlace after this filter.
  7242. A description of the accepted options follows.
  7243. @table @option
  7244. @item fps
  7245. Specify the output frames per second. This option can also be specified
  7246. as a value alone. The default is @code{50}.
  7247. @item interp_start
  7248. Specify the start of a range where the output frame will be created as a
  7249. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7250. the default is @code{15}.
  7251. @item interp_end
  7252. Specify the end of a range where the output frame will be created as a
  7253. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7254. the default is @code{240}.
  7255. @item scene
  7256. Specify the level at which a scene change is detected as a value between
  7257. 0 and 100 to indicate a new scene; a low value reflects a low
  7258. probability for the current frame to introduce a new scene, while a higher
  7259. value means the current frame is more likely to be one.
  7260. The default is @code{8.2}.
  7261. @item flags
  7262. Specify flags influencing the filter process.
  7263. Available value for @var{flags} is:
  7264. @table @option
  7265. @item scene_change_detect, scd
  7266. Enable scene change detection using the value of the option @var{scene}.
  7267. This flag is enabled by default.
  7268. @end table
  7269. @end table
  7270. @section framestep
  7271. Select one frame every N-th frame.
  7272. This filter accepts the following option:
  7273. @table @option
  7274. @item step
  7275. Select frame after every @code{step} frames.
  7276. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7277. @end table
  7278. @anchor{frei0r}
  7279. @section frei0r
  7280. Apply a frei0r effect to the input video.
  7281. To enable the compilation of this filter, you need to install the frei0r
  7282. header and configure FFmpeg with @code{--enable-frei0r}.
  7283. It accepts the following parameters:
  7284. @table @option
  7285. @item filter_name
  7286. The name of the frei0r effect to load. If the environment variable
  7287. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7288. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7289. Otherwise, the standard frei0r paths are searched, in this order:
  7290. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7291. @file{/usr/lib/frei0r-1/}.
  7292. @item filter_params
  7293. A '|'-separated list of parameters to pass to the frei0r effect.
  7294. @end table
  7295. A frei0r effect parameter can be a boolean (its value is either
  7296. "y" or "n"), a double, a color (specified as
  7297. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7298. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7299. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7300. a position (specified as @var{X}/@var{Y}, where
  7301. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7302. The number and types of parameters depend on the loaded effect. If an
  7303. effect parameter is not specified, the default value is set.
  7304. @subsection Examples
  7305. @itemize
  7306. @item
  7307. Apply the distort0r effect, setting the first two double parameters:
  7308. @example
  7309. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7310. @end example
  7311. @item
  7312. Apply the colordistance effect, taking a color as the first parameter:
  7313. @example
  7314. frei0r=colordistance:0.2/0.3/0.4
  7315. frei0r=colordistance:violet
  7316. frei0r=colordistance:0x112233
  7317. @end example
  7318. @item
  7319. Apply the perspective effect, specifying the top left and top right image
  7320. positions:
  7321. @example
  7322. frei0r=perspective:0.2/0.2|0.8/0.2
  7323. @end example
  7324. @end itemize
  7325. For more information, see
  7326. @url{http://frei0r.dyne.org}
  7327. @section fspp
  7328. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7329. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7330. processing filter, one of them is performed once per block, not per pixel.
  7331. This allows for much higher speed.
  7332. The filter accepts the following options:
  7333. @table @option
  7334. @item quality
  7335. Set quality. This option defines the number of levels for averaging. It accepts
  7336. an integer in the range 4-5. Default value is @code{4}.
  7337. @item qp
  7338. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7339. If not set, the filter will use the QP from the video stream (if available).
  7340. @item strength
  7341. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7342. more details but also more artifacts, while higher values make the image smoother
  7343. but also blurrier. Default value is @code{0} − PSNR optimal.
  7344. @item use_bframe_qp
  7345. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7346. option may cause flicker since the B-Frames have often larger QP. Default is
  7347. @code{0} (not enabled).
  7348. @end table
  7349. @section gblur
  7350. Apply Gaussian blur filter.
  7351. The filter accepts the following options:
  7352. @table @option
  7353. @item sigma
  7354. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7355. @item steps
  7356. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7357. @item planes
  7358. Set which planes to filter. By default all planes are filtered.
  7359. @item sigmaV
  7360. Set vertical sigma, if negative it will be same as @code{sigma}.
  7361. Default is @code{-1}.
  7362. @end table
  7363. @section geq
  7364. The filter accepts the following options:
  7365. @table @option
  7366. @item lum_expr, lum
  7367. Set the luminance expression.
  7368. @item cb_expr, cb
  7369. Set the chrominance blue expression.
  7370. @item cr_expr, cr
  7371. Set the chrominance red expression.
  7372. @item alpha_expr, a
  7373. Set the alpha expression.
  7374. @item red_expr, r
  7375. Set the red expression.
  7376. @item green_expr, g
  7377. Set the green expression.
  7378. @item blue_expr, b
  7379. Set the blue expression.
  7380. @end table
  7381. The colorspace is selected according to the specified options. If one
  7382. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7383. options is specified, the filter will automatically select a YCbCr
  7384. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7385. @option{blue_expr} options is specified, it will select an RGB
  7386. colorspace.
  7387. If one of the chrominance expression is not defined, it falls back on the other
  7388. one. If no alpha expression is specified it will evaluate to opaque value.
  7389. If none of chrominance expressions are specified, they will evaluate
  7390. to the luminance expression.
  7391. The expressions can use the following variables and functions:
  7392. @table @option
  7393. @item N
  7394. The sequential number of the filtered frame, starting from @code{0}.
  7395. @item X
  7396. @item Y
  7397. The coordinates of the current sample.
  7398. @item W
  7399. @item H
  7400. The width and height of the image.
  7401. @item SW
  7402. @item SH
  7403. Width and height scale depending on the currently filtered plane. It is the
  7404. ratio between the corresponding luma plane number of pixels and the current
  7405. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7406. @code{0.5,0.5} for chroma planes.
  7407. @item T
  7408. Time of the current frame, expressed in seconds.
  7409. @item p(x, y)
  7410. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7411. plane.
  7412. @item lum(x, y)
  7413. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7414. plane.
  7415. @item cb(x, y)
  7416. Return the value of the pixel at location (@var{x},@var{y}) of the
  7417. blue-difference chroma plane. Return 0 if there is no such plane.
  7418. @item cr(x, y)
  7419. Return the value of the pixel at location (@var{x},@var{y}) of the
  7420. red-difference chroma plane. Return 0 if there is no such plane.
  7421. @item r(x, y)
  7422. @item g(x, y)
  7423. @item b(x, y)
  7424. Return the value of the pixel at location (@var{x},@var{y}) of the
  7425. red/green/blue component. Return 0 if there is no such component.
  7426. @item alpha(x, y)
  7427. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7428. plane. Return 0 if there is no such plane.
  7429. @end table
  7430. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7431. automatically clipped to the closer edge.
  7432. @subsection Examples
  7433. @itemize
  7434. @item
  7435. Flip the image horizontally:
  7436. @example
  7437. geq=p(W-X\,Y)
  7438. @end example
  7439. @item
  7440. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7441. wavelength of 100 pixels:
  7442. @example
  7443. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7444. @end example
  7445. @item
  7446. Generate a fancy enigmatic moving light:
  7447. @example
  7448. 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
  7449. @end example
  7450. @item
  7451. Generate a quick emboss effect:
  7452. @example
  7453. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7454. @end example
  7455. @item
  7456. Modify RGB components depending on pixel position:
  7457. @example
  7458. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7459. @end example
  7460. @item
  7461. Create a radial gradient that is the same size as the input (also see
  7462. the @ref{vignette} filter):
  7463. @example
  7464. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7465. @end example
  7466. @end itemize
  7467. @section gradfun
  7468. Fix the banding artifacts that are sometimes introduced into nearly flat
  7469. regions by truncation to 8-bit color depth.
  7470. Interpolate the gradients that should go where the bands are, and
  7471. dither them.
  7472. It is designed for playback only. Do not use it prior to
  7473. lossy compression, because compression tends to lose the dither and
  7474. bring back the bands.
  7475. It accepts the following parameters:
  7476. @table @option
  7477. @item strength
  7478. The maximum amount by which the filter will change any one pixel. This is also
  7479. the threshold for detecting nearly flat regions. Acceptable values range from
  7480. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7481. valid range.
  7482. @item radius
  7483. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7484. gradients, but also prevents the filter from modifying the pixels near detailed
  7485. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7486. values will be clipped to the valid range.
  7487. @end table
  7488. Alternatively, the options can be specified as a flat string:
  7489. @var{strength}[:@var{radius}]
  7490. @subsection Examples
  7491. @itemize
  7492. @item
  7493. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7494. @example
  7495. gradfun=3.5:8
  7496. @end example
  7497. @item
  7498. Specify radius, omitting the strength (which will fall-back to the default
  7499. value):
  7500. @example
  7501. gradfun=radius=8
  7502. @end example
  7503. @end itemize
  7504. @anchor{haldclut}
  7505. @section haldclut
  7506. Apply a Hald CLUT to a video stream.
  7507. First input is the video stream to process, and second one is the Hald CLUT.
  7508. The Hald CLUT input can be a simple picture or a complete video stream.
  7509. The filter accepts the following options:
  7510. @table @option
  7511. @item shortest
  7512. Force termination when the shortest input terminates. Default is @code{0}.
  7513. @item repeatlast
  7514. Continue applying the last CLUT after the end of the stream. A value of
  7515. @code{0} disable the filter after the last frame of the CLUT is reached.
  7516. Default is @code{1}.
  7517. @end table
  7518. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7519. filters share the same internals).
  7520. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7521. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7522. @subsection Workflow examples
  7523. @subsubsection Hald CLUT video stream
  7524. Generate an identity Hald CLUT stream altered with various effects:
  7525. @example
  7526. 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
  7527. @end example
  7528. Note: make sure you use a lossless codec.
  7529. Then use it with @code{haldclut} to apply it on some random stream:
  7530. @example
  7531. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7532. @end example
  7533. The Hald CLUT will be applied to the 10 first seconds (duration of
  7534. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7535. to the remaining frames of the @code{mandelbrot} stream.
  7536. @subsubsection Hald CLUT with preview
  7537. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7538. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7539. biggest possible square starting at the top left of the picture. The remaining
  7540. padding pixels (bottom or right) will be ignored. This area can be used to add
  7541. a preview of the Hald CLUT.
  7542. Typically, the following generated Hald CLUT will be supported by the
  7543. @code{haldclut} filter:
  7544. @example
  7545. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7546. pad=iw+320 [padded_clut];
  7547. smptebars=s=320x256, split [a][b];
  7548. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7549. [main][b] overlay=W-320" -frames:v 1 clut.png
  7550. @end example
  7551. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7552. bars are displayed on the right-top, and below the same color bars processed by
  7553. the color changes.
  7554. Then, the effect of this Hald CLUT can be visualized with:
  7555. @example
  7556. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7557. @end example
  7558. @section hflip
  7559. Flip the input video horizontally.
  7560. For example, to horizontally flip the input video with @command{ffmpeg}:
  7561. @example
  7562. ffmpeg -i in.avi -vf "hflip" out.avi
  7563. @end example
  7564. @section histeq
  7565. This filter applies a global color histogram equalization on a
  7566. per-frame basis.
  7567. It can be used to correct video that has a compressed range of pixel
  7568. intensities. The filter redistributes the pixel intensities to
  7569. equalize their distribution across the intensity range. It may be
  7570. viewed as an "automatically adjusting contrast filter". This filter is
  7571. useful only for correcting degraded or poorly captured source
  7572. video.
  7573. The filter accepts the following options:
  7574. @table @option
  7575. @item strength
  7576. Determine the amount of equalization to be applied. As the strength
  7577. is reduced, the distribution of pixel intensities more-and-more
  7578. approaches that of the input frame. The value must be a float number
  7579. in the range [0,1] and defaults to 0.200.
  7580. @item intensity
  7581. Set the maximum intensity that can generated and scale the output
  7582. values appropriately. The strength should be set as desired and then
  7583. the intensity can be limited if needed to avoid washing-out. The value
  7584. must be a float number in the range [0,1] and defaults to 0.210.
  7585. @item antibanding
  7586. Set the antibanding level. If enabled the filter will randomly vary
  7587. the luminance of output pixels by a small amount to avoid banding of
  7588. the histogram. Possible values are @code{none}, @code{weak} or
  7589. @code{strong}. It defaults to @code{none}.
  7590. @end table
  7591. @section histogram
  7592. Compute and draw a color distribution histogram for the input video.
  7593. The computed histogram is a representation of the color component
  7594. distribution in an image.
  7595. Standard histogram displays the color components distribution in an image.
  7596. Displays color graph for each color component. Shows distribution of
  7597. the Y, U, V, A or R, G, B components, depending on input format, in the
  7598. current frame. Below each graph a color component scale meter is shown.
  7599. The filter accepts the following options:
  7600. @table @option
  7601. @item level_height
  7602. Set height of level. Default value is @code{200}.
  7603. Allowed range is [50, 2048].
  7604. @item scale_height
  7605. Set height of color scale. Default value is @code{12}.
  7606. Allowed range is [0, 40].
  7607. @item display_mode
  7608. Set display mode.
  7609. It accepts the following values:
  7610. @table @samp
  7611. @item stack
  7612. Per color component graphs are placed below each other.
  7613. @item parade
  7614. Per color component graphs are placed side by side.
  7615. @item overlay
  7616. Presents information identical to that in the @code{parade}, except
  7617. that the graphs representing color components are superimposed directly
  7618. over one another.
  7619. @end table
  7620. Default is @code{stack}.
  7621. @item levels_mode
  7622. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7623. Default is @code{linear}.
  7624. @item components
  7625. Set what color components to display.
  7626. Default is @code{7}.
  7627. @item fgopacity
  7628. Set foreground opacity. Default is @code{0.7}.
  7629. @item bgopacity
  7630. Set background opacity. Default is @code{0.5}.
  7631. @end table
  7632. @subsection Examples
  7633. @itemize
  7634. @item
  7635. Calculate and draw histogram:
  7636. @example
  7637. ffplay -i input -vf histogram
  7638. @end example
  7639. @end itemize
  7640. @anchor{hqdn3d}
  7641. @section hqdn3d
  7642. This is a high precision/quality 3d denoise filter. It aims to reduce
  7643. image noise, producing smooth images and making still images really
  7644. still. It should enhance compressibility.
  7645. It accepts the following optional parameters:
  7646. @table @option
  7647. @item luma_spatial
  7648. A non-negative floating point number which specifies spatial luma strength.
  7649. It defaults to 4.0.
  7650. @item chroma_spatial
  7651. A non-negative floating point number which specifies spatial chroma strength.
  7652. It defaults to 3.0*@var{luma_spatial}/4.0.
  7653. @item luma_tmp
  7654. A floating point number which specifies luma temporal strength. It defaults to
  7655. 6.0*@var{luma_spatial}/4.0.
  7656. @item chroma_tmp
  7657. A floating point number which specifies chroma temporal strength. It defaults to
  7658. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7659. @end table
  7660. @section hwdownload
  7661. Download hardware frames to system memory.
  7662. The input must be in hardware frames, and the output a non-hardware format.
  7663. Not all formats will be supported on the output - it may be necessary to insert
  7664. an additional @option{format} filter immediately following in the graph to get
  7665. the output in a supported format.
  7666. @section hwmap
  7667. Map hardware frames to system memory or to another device.
  7668. This filter has several different modes of operation; which one is used depends
  7669. on the input and output formats:
  7670. @itemize
  7671. @item
  7672. Hardware frame input, normal frame output
  7673. Map the input frames to system memory and pass them to the output. If the
  7674. original hardware frame is later required (for example, after overlaying
  7675. something else on part of it), the @option{hwmap} filter can be used again
  7676. in the next mode to retrieve it.
  7677. @item
  7678. Normal frame input, hardware frame output
  7679. If the input is actually a software-mapped hardware frame, then unmap it -
  7680. that is, return the original hardware frame.
  7681. Otherwise, a device must be provided. Create new hardware surfaces on that
  7682. device for the output, then map them back to the software format at the input
  7683. and give those frames to the preceding filter. This will then act like the
  7684. @option{hwupload} filter, but may be able to avoid an additional copy when
  7685. the input is already in a compatible format.
  7686. @item
  7687. Hardware frame input and output
  7688. A device must be supplied for the output, either directly or with the
  7689. @option{derive_device} option. The input and output devices must be of
  7690. different types and compatible - the exact meaning of this is
  7691. system-dependent, but typically it means that they must refer to the same
  7692. underlying hardware context (for example, refer to the same graphics card).
  7693. If the input frames were originally created on the output device, then unmap
  7694. to retrieve the original frames.
  7695. Otherwise, map the frames to the output device - create new hardware frames
  7696. on the output corresponding to the frames on the input.
  7697. @end itemize
  7698. The following additional parameters are accepted:
  7699. @table @option
  7700. @item mode
  7701. Set the frame mapping mode. Some combination of:
  7702. @table @var
  7703. @item read
  7704. The mapped frame should be readable.
  7705. @item write
  7706. The mapped frame should be writeable.
  7707. @item overwrite
  7708. The mapping will always overwrite the entire frame.
  7709. This may improve performance in some cases, as the original contents of the
  7710. frame need not be loaded.
  7711. @item direct
  7712. The mapping must not involve any copying.
  7713. Indirect mappings to copies of frames are created in some cases where either
  7714. direct mapping is not possible or it would have unexpected properties.
  7715. Setting this flag ensures that the mapping is direct and will fail if that is
  7716. not possible.
  7717. @end table
  7718. Defaults to @var{read+write} if not specified.
  7719. @item derive_device @var{type}
  7720. Rather than using the device supplied at initialisation, instead derive a new
  7721. device of type @var{type} from the device the input frames exist on.
  7722. @item reverse
  7723. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7724. and map them back to the source. This may be necessary in some cases where
  7725. a mapping in one direction is required but only the opposite direction is
  7726. supported by the devices being used.
  7727. This option is dangerous - it may break the preceding filter in undefined
  7728. ways if there are any additional constraints on that filter's output.
  7729. Do not use it without fully understanding the implications of its use.
  7730. @end table
  7731. @section hwupload
  7732. Upload system memory frames to hardware surfaces.
  7733. The device to upload to must be supplied when the filter is initialised. If
  7734. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7735. option.
  7736. @anchor{hwupload_cuda}
  7737. @section hwupload_cuda
  7738. Upload system memory frames to a CUDA device.
  7739. It accepts the following optional parameters:
  7740. @table @option
  7741. @item device
  7742. The number of the CUDA device to use
  7743. @end table
  7744. @section hqx
  7745. Apply a high-quality magnification filter designed for pixel art. This filter
  7746. was originally created by Maxim Stepin.
  7747. It accepts the following option:
  7748. @table @option
  7749. @item n
  7750. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7751. @code{hq3x} and @code{4} for @code{hq4x}.
  7752. Default is @code{3}.
  7753. @end table
  7754. @section hstack
  7755. Stack input videos horizontally.
  7756. All streams must be of same pixel format and of same height.
  7757. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7758. to create same output.
  7759. The filter accept the following option:
  7760. @table @option
  7761. @item inputs
  7762. Set number of input streams. Default is 2.
  7763. @item shortest
  7764. If set to 1, force the output to terminate when the shortest input
  7765. terminates. Default value is 0.
  7766. @end table
  7767. @section hue
  7768. Modify the hue and/or the saturation of the input.
  7769. It accepts the following parameters:
  7770. @table @option
  7771. @item h
  7772. Specify the hue angle as a number of degrees. It accepts an expression,
  7773. and defaults to "0".
  7774. @item s
  7775. Specify the saturation in the [-10,10] range. It accepts an expression and
  7776. defaults to "1".
  7777. @item H
  7778. Specify the hue angle as a number of radians. It accepts an
  7779. expression, and defaults to "0".
  7780. @item b
  7781. Specify the brightness in the [-10,10] range. It accepts an expression and
  7782. defaults to "0".
  7783. @end table
  7784. @option{h} and @option{H} are mutually exclusive, and can't be
  7785. specified at the same time.
  7786. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7787. expressions containing the following constants:
  7788. @table @option
  7789. @item n
  7790. frame count of the input frame starting from 0
  7791. @item pts
  7792. presentation timestamp of the input frame expressed in time base units
  7793. @item r
  7794. frame rate of the input video, NAN if the input frame rate is unknown
  7795. @item t
  7796. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7797. @item tb
  7798. time base of the input video
  7799. @end table
  7800. @subsection Examples
  7801. @itemize
  7802. @item
  7803. Set the hue to 90 degrees and the saturation to 1.0:
  7804. @example
  7805. hue=h=90:s=1
  7806. @end example
  7807. @item
  7808. Same command but expressing the hue in radians:
  7809. @example
  7810. hue=H=PI/2:s=1
  7811. @end example
  7812. @item
  7813. Rotate hue and make the saturation swing between 0
  7814. and 2 over a period of 1 second:
  7815. @example
  7816. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7817. @end example
  7818. @item
  7819. Apply a 3 seconds saturation fade-in effect starting at 0:
  7820. @example
  7821. hue="s=min(t/3\,1)"
  7822. @end example
  7823. The general fade-in expression can be written as:
  7824. @example
  7825. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7826. @end example
  7827. @item
  7828. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7829. @example
  7830. hue="s=max(0\, min(1\, (8-t)/3))"
  7831. @end example
  7832. The general fade-out expression can be written as:
  7833. @example
  7834. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7835. @end example
  7836. @end itemize
  7837. @subsection Commands
  7838. This filter supports the following commands:
  7839. @table @option
  7840. @item b
  7841. @item s
  7842. @item h
  7843. @item H
  7844. Modify the hue and/or the saturation and/or brightness of the input video.
  7845. The command accepts the same syntax of the corresponding option.
  7846. If the specified expression is not valid, it is kept at its current
  7847. value.
  7848. @end table
  7849. @section hysteresis
  7850. Grow first stream into second stream by connecting components.
  7851. This makes it possible to build more robust edge masks.
  7852. This filter accepts the following options:
  7853. @table @option
  7854. @item planes
  7855. Set which planes will be processed as bitmap, unprocessed planes will be
  7856. copied from first stream.
  7857. By default value 0xf, all planes will be processed.
  7858. @item threshold
  7859. Set threshold which is used in filtering. If pixel component value is higher than
  7860. this value filter algorithm for connecting components is activated.
  7861. By default value is 0.
  7862. @end table
  7863. @section idet
  7864. Detect video interlacing type.
  7865. This filter tries to detect if the input frames are interlaced, progressive,
  7866. top or bottom field first. It will also try to detect fields that are
  7867. repeated between adjacent frames (a sign of telecine).
  7868. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7869. Multiple frame detection incorporates the classification history of previous frames.
  7870. The filter will log these metadata values:
  7871. @table @option
  7872. @item single.current_frame
  7873. Detected type of current frame using single-frame detection. One of:
  7874. ``tff'' (top field first), ``bff'' (bottom field first),
  7875. ``progressive'', or ``undetermined''
  7876. @item single.tff
  7877. Cumulative number of frames detected as top field first using single-frame detection.
  7878. @item multiple.tff
  7879. Cumulative number of frames detected as top field first using multiple-frame detection.
  7880. @item single.bff
  7881. Cumulative number of frames detected as bottom field first using single-frame detection.
  7882. @item multiple.current_frame
  7883. Detected type of current frame using multiple-frame detection. One of:
  7884. ``tff'' (top field first), ``bff'' (bottom field first),
  7885. ``progressive'', or ``undetermined''
  7886. @item multiple.bff
  7887. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7888. @item single.progressive
  7889. Cumulative number of frames detected as progressive using single-frame detection.
  7890. @item multiple.progressive
  7891. Cumulative number of frames detected as progressive using multiple-frame detection.
  7892. @item single.undetermined
  7893. Cumulative number of frames that could not be classified using single-frame detection.
  7894. @item multiple.undetermined
  7895. Cumulative number of frames that could not be classified using multiple-frame detection.
  7896. @item repeated.current_frame
  7897. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7898. @item repeated.neither
  7899. Cumulative number of frames with no repeated field.
  7900. @item repeated.top
  7901. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7902. @item repeated.bottom
  7903. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7904. @end table
  7905. The filter accepts the following options:
  7906. @table @option
  7907. @item intl_thres
  7908. Set interlacing threshold.
  7909. @item prog_thres
  7910. Set progressive threshold.
  7911. @item rep_thres
  7912. Threshold for repeated field detection.
  7913. @item half_life
  7914. Number of frames after which a given frame's contribution to the
  7915. statistics is halved (i.e., it contributes only 0.5 to its
  7916. classification). The default of 0 means that all frames seen are given
  7917. full weight of 1.0 forever.
  7918. @item analyze_interlaced_flag
  7919. When this is not 0 then idet will use the specified number of frames to determine
  7920. if the interlaced flag is accurate, it will not count undetermined frames.
  7921. If the flag is found to be accurate it will be used without any further
  7922. computations, if it is found to be inaccurate it will be cleared without any
  7923. further computations. This allows inserting the idet filter as a low computational
  7924. method to clean up the interlaced flag
  7925. @end table
  7926. @section il
  7927. Deinterleave or interleave fields.
  7928. This filter allows one to process interlaced images fields without
  7929. deinterlacing them. Deinterleaving splits the input frame into 2
  7930. fields (so called half pictures). Odd lines are moved to the top
  7931. half of the output image, even lines to the bottom half.
  7932. You can process (filter) them independently and then re-interleave them.
  7933. The filter accepts the following options:
  7934. @table @option
  7935. @item luma_mode, l
  7936. @item chroma_mode, c
  7937. @item alpha_mode, a
  7938. Available values for @var{luma_mode}, @var{chroma_mode} and
  7939. @var{alpha_mode} are:
  7940. @table @samp
  7941. @item none
  7942. Do nothing.
  7943. @item deinterleave, d
  7944. Deinterleave fields, placing one above the other.
  7945. @item interleave, i
  7946. Interleave fields. Reverse the effect of deinterleaving.
  7947. @end table
  7948. Default value is @code{none}.
  7949. @item luma_swap, ls
  7950. @item chroma_swap, cs
  7951. @item alpha_swap, as
  7952. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7953. @end table
  7954. @section inflate
  7955. Apply inflate effect to the video.
  7956. This filter replaces the pixel by the local(3x3) average by taking into account
  7957. only values higher than the pixel.
  7958. It accepts the following options:
  7959. @table @option
  7960. @item threshold0
  7961. @item threshold1
  7962. @item threshold2
  7963. @item threshold3
  7964. Limit the maximum change for each plane, default is 65535.
  7965. If 0, plane will remain unchanged.
  7966. @end table
  7967. @section interlace
  7968. Simple interlacing filter from progressive contents. This interleaves upper (or
  7969. lower) lines from odd frames with lower (or upper) lines from even frames,
  7970. halving the frame rate and preserving image height.
  7971. @example
  7972. Original Original New Frame
  7973. Frame 'j' Frame 'j+1' (tff)
  7974. ========== =========== ==================
  7975. Line 0 --------------------> Frame 'j' Line 0
  7976. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7977. Line 2 ---------------------> Frame 'j' Line 2
  7978. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7979. ... ... ...
  7980. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7981. @end example
  7982. It accepts the following optional parameters:
  7983. @table @option
  7984. @item scan
  7985. This determines whether the interlaced frame is taken from the even
  7986. (tff - default) or odd (bff) lines of the progressive frame.
  7987. @item lowpass
  7988. Vertical lowpass filter to avoid twitter interlacing and
  7989. reduce moire patterns.
  7990. @table @samp
  7991. @item 0, off
  7992. Disable vertical lowpass filter
  7993. @item 1, linear
  7994. Enable linear filter (default)
  7995. @item 2, complex
  7996. Enable complex filter. This will slightly less reduce twitter and moire
  7997. but better retain detail and subjective sharpness impression.
  7998. @end table
  7999. @end table
  8000. @section kerndeint
  8001. Deinterlace input video by applying Donald Graft's adaptive kernel
  8002. deinterling. Work on interlaced parts of a video to produce
  8003. progressive frames.
  8004. The description of the accepted parameters follows.
  8005. @table @option
  8006. @item thresh
  8007. Set the threshold which affects the filter's tolerance when
  8008. determining if a pixel line must be processed. It must be an integer
  8009. in the range [0,255] and defaults to 10. A value of 0 will result in
  8010. applying the process on every pixels.
  8011. @item map
  8012. Paint pixels exceeding the threshold value to white if set to 1.
  8013. Default is 0.
  8014. @item order
  8015. Set the fields order. Swap fields if set to 1, leave fields alone if
  8016. 0. Default is 0.
  8017. @item sharp
  8018. Enable additional sharpening if set to 1. Default is 0.
  8019. @item twoway
  8020. Enable twoway sharpening if set to 1. Default is 0.
  8021. @end table
  8022. @subsection Examples
  8023. @itemize
  8024. @item
  8025. Apply default values:
  8026. @example
  8027. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8028. @end example
  8029. @item
  8030. Enable additional sharpening:
  8031. @example
  8032. kerndeint=sharp=1
  8033. @end example
  8034. @item
  8035. Paint processed pixels in white:
  8036. @example
  8037. kerndeint=map=1
  8038. @end example
  8039. @end itemize
  8040. @section lenscorrection
  8041. Correct radial lens distortion
  8042. This filter can be used to correct for radial distortion as can result from the use
  8043. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8044. one can use tools available for example as part of opencv or simply trial-and-error.
  8045. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8046. and extract the k1 and k2 coefficients from the resulting matrix.
  8047. Note that effectively the same filter is available in the open-source tools Krita and
  8048. Digikam from the KDE project.
  8049. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8050. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8051. brightness distribution, so you may want to use both filters together in certain
  8052. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8053. be applied before or after lens correction.
  8054. @subsection Options
  8055. The filter accepts the following options:
  8056. @table @option
  8057. @item cx
  8058. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8059. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8060. width. Default is 0.5.
  8061. @item cy
  8062. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8063. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8064. height. Default is 0.5.
  8065. @item k1
  8066. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8067. no correction. Default is 0.
  8068. @item k2
  8069. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8070. 0 means no correction. Default is 0.
  8071. @end table
  8072. The formula that generates the correction is:
  8073. @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)
  8074. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8075. distances from the focal point in the source and target images, respectively.
  8076. @section libvmaf
  8077. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8078. score between two input videos.
  8079. The obtained VMAF score is printed through the logging system.
  8080. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8081. After installing the library it can be enabled using:
  8082. @code{./configure --enable-libvmaf}.
  8083. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8084. The filter has following options:
  8085. @table @option
  8086. @item model_path
  8087. Set the model path which is to be used for SVM.
  8088. Default value: @code{"vmaf_v0.6.1.pkl"}
  8089. @item log_path
  8090. Set the file path to be used to store logs.
  8091. @item log_fmt
  8092. Set the format of the log file (xml or json).
  8093. @item enable_transform
  8094. Enables transform for computing vmaf.
  8095. @item phone_model
  8096. Invokes the phone model which will generate VMAF scores higher than in the
  8097. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8098. @item psnr
  8099. Enables computing psnr along with vmaf.
  8100. @item ssim
  8101. Enables computing ssim along with vmaf.
  8102. @item ms_ssim
  8103. Enables computing ms_ssim along with vmaf.
  8104. @item pool
  8105. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8106. @end table
  8107. This filter also supports the @ref{framesync} options.
  8108. On the below examples the input file @file{main.mpg} being processed is
  8109. compared with the reference file @file{ref.mpg}.
  8110. @example
  8111. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8112. @end example
  8113. Example with options:
  8114. @example
  8115. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8116. @end example
  8117. @section limiter
  8118. Limits the pixel components values to the specified range [min, max].
  8119. The filter accepts the following options:
  8120. @table @option
  8121. @item min
  8122. Lower bound. Defaults to the lowest allowed value for the input.
  8123. @item max
  8124. Upper bound. Defaults to the highest allowed value for the input.
  8125. @item planes
  8126. Specify which planes will be processed. Defaults to all available.
  8127. @end table
  8128. @section loop
  8129. Loop video frames.
  8130. The filter accepts the following options:
  8131. @table @option
  8132. @item loop
  8133. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8134. Default is 0.
  8135. @item size
  8136. Set maximal size in number of frames. Default is 0.
  8137. @item start
  8138. Set first frame of loop. Default is 0.
  8139. @end table
  8140. @anchor{lut3d}
  8141. @section lut3d
  8142. Apply a 3D LUT to an input video.
  8143. The filter accepts the following options:
  8144. @table @option
  8145. @item file
  8146. Set the 3D LUT file name.
  8147. Currently supported formats:
  8148. @table @samp
  8149. @item 3dl
  8150. AfterEffects
  8151. @item cube
  8152. Iridas
  8153. @item dat
  8154. DaVinci
  8155. @item m3d
  8156. Pandora
  8157. @end table
  8158. @item interp
  8159. Select interpolation mode.
  8160. Available values are:
  8161. @table @samp
  8162. @item nearest
  8163. Use values from the nearest defined point.
  8164. @item trilinear
  8165. Interpolate values using the 8 points defining a cube.
  8166. @item tetrahedral
  8167. Interpolate values using a tetrahedron.
  8168. @end table
  8169. @end table
  8170. This filter also supports the @ref{framesync} options.
  8171. @section lumakey
  8172. Turn certain luma values into transparency.
  8173. The filter accepts the following options:
  8174. @table @option
  8175. @item threshold
  8176. Set the luma which will be used as base for transparency.
  8177. Default value is @code{0}.
  8178. @item tolerance
  8179. Set the range of luma values to be keyed out.
  8180. Default value is @code{0}.
  8181. @item softness
  8182. Set the range of softness. Default value is @code{0}.
  8183. Use this to control gradual transition from zero to full transparency.
  8184. @end table
  8185. @section lut, lutrgb, lutyuv
  8186. Compute a look-up table for binding each pixel component input value
  8187. to an output value, and apply it to the input video.
  8188. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8189. to an RGB input video.
  8190. These filters accept the following parameters:
  8191. @table @option
  8192. @item c0
  8193. set first pixel component expression
  8194. @item c1
  8195. set second pixel component expression
  8196. @item c2
  8197. set third pixel component expression
  8198. @item c3
  8199. set fourth pixel component expression, corresponds to the alpha component
  8200. @item r
  8201. set red component expression
  8202. @item g
  8203. set green component expression
  8204. @item b
  8205. set blue component expression
  8206. @item a
  8207. alpha component expression
  8208. @item y
  8209. set Y/luminance component expression
  8210. @item u
  8211. set U/Cb component expression
  8212. @item v
  8213. set V/Cr component expression
  8214. @end table
  8215. Each of them specifies the expression to use for computing the lookup table for
  8216. the corresponding pixel component values.
  8217. The exact component associated to each of the @var{c*} options depends on the
  8218. format in input.
  8219. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8220. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8221. The expressions can contain the following constants and functions:
  8222. @table @option
  8223. @item w
  8224. @item h
  8225. The input width and height.
  8226. @item val
  8227. The input value for the pixel component.
  8228. @item clipval
  8229. The input value, clipped to the @var{minval}-@var{maxval} range.
  8230. @item maxval
  8231. The maximum value for the pixel component.
  8232. @item minval
  8233. The minimum value for the pixel component.
  8234. @item negval
  8235. The negated value for the pixel component value, clipped to the
  8236. @var{minval}-@var{maxval} range; it corresponds to the expression
  8237. "maxval-clipval+minval".
  8238. @item clip(val)
  8239. The computed value in @var{val}, clipped to the
  8240. @var{minval}-@var{maxval} range.
  8241. @item gammaval(gamma)
  8242. The computed gamma correction value of the pixel component value,
  8243. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8244. expression
  8245. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8246. @end table
  8247. All expressions default to "val".
  8248. @subsection Examples
  8249. @itemize
  8250. @item
  8251. Negate input video:
  8252. @example
  8253. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8254. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8255. @end example
  8256. The above is the same as:
  8257. @example
  8258. lutrgb="r=negval:g=negval:b=negval"
  8259. lutyuv="y=negval:u=negval:v=negval"
  8260. @end example
  8261. @item
  8262. Negate luminance:
  8263. @example
  8264. lutyuv=y=negval
  8265. @end example
  8266. @item
  8267. Remove chroma components, turning the video into a graytone image:
  8268. @example
  8269. lutyuv="u=128:v=128"
  8270. @end example
  8271. @item
  8272. Apply a luma burning effect:
  8273. @example
  8274. lutyuv="y=2*val"
  8275. @end example
  8276. @item
  8277. Remove green and blue components:
  8278. @example
  8279. lutrgb="g=0:b=0"
  8280. @end example
  8281. @item
  8282. Set a constant alpha channel value on input:
  8283. @example
  8284. format=rgba,lutrgb=a="maxval-minval/2"
  8285. @end example
  8286. @item
  8287. Correct luminance gamma by a factor of 0.5:
  8288. @example
  8289. lutyuv=y=gammaval(0.5)
  8290. @end example
  8291. @item
  8292. Discard least significant bits of luma:
  8293. @example
  8294. lutyuv=y='bitand(val, 128+64+32)'
  8295. @end example
  8296. @item
  8297. Technicolor like effect:
  8298. @example
  8299. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8300. @end example
  8301. @end itemize
  8302. @section lut2, tlut2
  8303. The @code{lut2} filter takes two input streams and outputs one
  8304. stream.
  8305. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8306. from one single stream.
  8307. This filter accepts the following parameters:
  8308. @table @option
  8309. @item c0
  8310. set first pixel component expression
  8311. @item c1
  8312. set second pixel component expression
  8313. @item c2
  8314. set third pixel component expression
  8315. @item c3
  8316. set fourth pixel component expression, corresponds to the alpha component
  8317. @end table
  8318. Each of them specifies the expression to use for computing the lookup table for
  8319. the corresponding pixel component values.
  8320. The exact component associated to each of the @var{c*} options depends on the
  8321. format in inputs.
  8322. The expressions can contain the following constants:
  8323. @table @option
  8324. @item w
  8325. @item h
  8326. The input width and height.
  8327. @item x
  8328. The first input value for the pixel component.
  8329. @item y
  8330. The second input value for the pixel component.
  8331. @item bdx
  8332. The first input video bit depth.
  8333. @item bdy
  8334. The second input video bit depth.
  8335. @end table
  8336. All expressions default to "x".
  8337. @subsection Examples
  8338. @itemize
  8339. @item
  8340. Highlight differences between two RGB video streams:
  8341. @example
  8342. 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)'
  8343. @end example
  8344. @item
  8345. Highlight differences between two YUV video streams:
  8346. @example
  8347. 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)'
  8348. @end example
  8349. @item
  8350. Show max difference between two video streams:
  8351. @example
  8352. 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)))'
  8353. @end example
  8354. @end itemize
  8355. @section maskedclamp
  8356. Clamp the first input stream with the second input and third input stream.
  8357. Returns the value of first stream to be between second input
  8358. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8359. This filter accepts the following options:
  8360. @table @option
  8361. @item undershoot
  8362. Default value is @code{0}.
  8363. @item overshoot
  8364. Default value is @code{0}.
  8365. @item planes
  8366. Set which planes will be processed as bitmap, unprocessed planes will be
  8367. copied from first stream.
  8368. By default value 0xf, all planes will be processed.
  8369. @end table
  8370. @section maskedmerge
  8371. Merge the first input stream with the second input stream using per pixel
  8372. weights in the third input stream.
  8373. A value of 0 in the third stream pixel component means that pixel component
  8374. from first stream is returned unchanged, while maximum value (eg. 255 for
  8375. 8-bit videos) means that pixel component from second stream is returned
  8376. unchanged. Intermediate values define the amount of merging between both
  8377. input stream's pixel components.
  8378. This filter accepts the following options:
  8379. @table @option
  8380. @item planes
  8381. Set which planes will be processed as bitmap, unprocessed planes will be
  8382. copied from first stream.
  8383. By default value 0xf, all planes will be processed.
  8384. @end table
  8385. @section mcdeint
  8386. Apply motion-compensation deinterlacing.
  8387. It needs one field per frame as input and must thus be used together
  8388. with yadif=1/3 or equivalent.
  8389. This filter accepts the following options:
  8390. @table @option
  8391. @item mode
  8392. Set the deinterlacing mode.
  8393. It accepts one of the following values:
  8394. @table @samp
  8395. @item fast
  8396. @item medium
  8397. @item slow
  8398. use iterative motion estimation
  8399. @item extra_slow
  8400. like @samp{slow}, but use multiple reference frames.
  8401. @end table
  8402. Default value is @samp{fast}.
  8403. @item parity
  8404. Set the picture field parity assumed for the input video. It must be
  8405. one of the following values:
  8406. @table @samp
  8407. @item 0, tff
  8408. assume top field first
  8409. @item 1, bff
  8410. assume bottom field first
  8411. @end table
  8412. Default value is @samp{bff}.
  8413. @item qp
  8414. Set per-block quantization parameter (QP) used by the internal
  8415. encoder.
  8416. Higher values should result in a smoother motion vector field but less
  8417. optimal individual vectors. Default value is 1.
  8418. @end table
  8419. @section mergeplanes
  8420. Merge color channel components from several video streams.
  8421. The filter accepts up to 4 input streams, and merge selected input
  8422. planes to the output video.
  8423. This filter accepts the following options:
  8424. @table @option
  8425. @item mapping
  8426. Set input to output plane mapping. Default is @code{0}.
  8427. The mappings is specified as a bitmap. It should be specified as a
  8428. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8429. mapping for the first plane of the output stream. 'A' sets the number of
  8430. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8431. corresponding input to use (from 0 to 3). The rest of the mappings is
  8432. similar, 'Bb' describes the mapping for the output stream second
  8433. plane, 'Cc' describes the mapping for the output stream third plane and
  8434. 'Dd' describes the mapping for the output stream fourth plane.
  8435. @item format
  8436. Set output pixel format. Default is @code{yuva444p}.
  8437. @end table
  8438. @subsection Examples
  8439. @itemize
  8440. @item
  8441. Merge three gray video streams of same width and height into single video stream:
  8442. @example
  8443. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8444. @end example
  8445. @item
  8446. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8447. @example
  8448. [a0][a1]mergeplanes=0x00010210:yuva444p
  8449. @end example
  8450. @item
  8451. Swap Y and A plane in yuva444p stream:
  8452. @example
  8453. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8454. @end example
  8455. @item
  8456. Swap U and V plane in yuv420p stream:
  8457. @example
  8458. format=yuv420p,mergeplanes=0x000201:yuv420p
  8459. @end example
  8460. @item
  8461. Cast a rgb24 clip to yuv444p:
  8462. @example
  8463. format=rgb24,mergeplanes=0x000102:yuv444p
  8464. @end example
  8465. @end itemize
  8466. @section mestimate
  8467. Estimate and export motion vectors using block matching algorithms.
  8468. Motion vectors are stored in frame side data to be used by other filters.
  8469. This filter accepts the following options:
  8470. @table @option
  8471. @item method
  8472. Specify the motion estimation method. Accepts one of the following values:
  8473. @table @samp
  8474. @item esa
  8475. Exhaustive search algorithm.
  8476. @item tss
  8477. Three step search algorithm.
  8478. @item tdls
  8479. Two dimensional logarithmic search algorithm.
  8480. @item ntss
  8481. New three step search algorithm.
  8482. @item fss
  8483. Four step search algorithm.
  8484. @item ds
  8485. Diamond search algorithm.
  8486. @item hexbs
  8487. Hexagon-based search algorithm.
  8488. @item epzs
  8489. Enhanced predictive zonal search algorithm.
  8490. @item umh
  8491. Uneven multi-hexagon search algorithm.
  8492. @end table
  8493. Default value is @samp{esa}.
  8494. @item mb_size
  8495. Macroblock size. Default @code{16}.
  8496. @item search_param
  8497. Search parameter. Default @code{7}.
  8498. @end table
  8499. @section midequalizer
  8500. Apply Midway Image Equalization effect using two video streams.
  8501. Midway Image Equalization adjusts a pair of images to have the same
  8502. histogram, while maintaining their dynamics as much as possible. It's
  8503. useful for e.g. matching exposures from a pair of stereo cameras.
  8504. This filter has two inputs and one output, which must be of same pixel format, but
  8505. may be of different sizes. The output of filter is first input adjusted with
  8506. midway histogram of both inputs.
  8507. This filter accepts the following option:
  8508. @table @option
  8509. @item planes
  8510. Set which planes to process. Default is @code{15}, which is all available planes.
  8511. @end table
  8512. @section minterpolate
  8513. Convert the video to specified frame rate using motion interpolation.
  8514. This filter accepts the following options:
  8515. @table @option
  8516. @item fps
  8517. 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}.
  8518. @item mi_mode
  8519. Motion interpolation mode. Following values are accepted:
  8520. @table @samp
  8521. @item dup
  8522. Duplicate previous or next frame for interpolating new ones.
  8523. @item blend
  8524. Blend source frames. Interpolated frame is mean of previous and next frames.
  8525. @item mci
  8526. Motion compensated interpolation. Following options are effective when this mode is selected:
  8527. @table @samp
  8528. @item mc_mode
  8529. Motion compensation mode. Following values are accepted:
  8530. @table @samp
  8531. @item obmc
  8532. Overlapped block motion compensation.
  8533. @item aobmc
  8534. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8535. @end table
  8536. Default mode is @samp{obmc}.
  8537. @item me_mode
  8538. Motion estimation mode. Following values are accepted:
  8539. @table @samp
  8540. @item bidir
  8541. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8542. @item bilat
  8543. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8544. @end table
  8545. Default mode is @samp{bilat}.
  8546. @item me
  8547. The algorithm to be used for motion estimation. Following values are accepted:
  8548. @table @samp
  8549. @item esa
  8550. Exhaustive search algorithm.
  8551. @item tss
  8552. Three step search algorithm.
  8553. @item tdls
  8554. Two dimensional logarithmic search algorithm.
  8555. @item ntss
  8556. New three step search algorithm.
  8557. @item fss
  8558. Four step search algorithm.
  8559. @item ds
  8560. Diamond search algorithm.
  8561. @item hexbs
  8562. Hexagon-based search algorithm.
  8563. @item epzs
  8564. Enhanced predictive zonal search algorithm.
  8565. @item umh
  8566. Uneven multi-hexagon search algorithm.
  8567. @end table
  8568. Default algorithm is @samp{epzs}.
  8569. @item mb_size
  8570. Macroblock size. Default @code{16}.
  8571. @item search_param
  8572. Motion estimation search parameter. Default @code{32}.
  8573. @item vsbmc
  8574. 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).
  8575. @end table
  8576. @end table
  8577. @item scd
  8578. 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:
  8579. @table @samp
  8580. @item none
  8581. Disable scene change detection.
  8582. @item fdiff
  8583. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8584. @end table
  8585. Default method is @samp{fdiff}.
  8586. @item scd_threshold
  8587. Scene change detection threshold. Default is @code{5.0}.
  8588. @end table
  8589. @section mix
  8590. Mix several video input streams into one video stream.
  8591. A description of the accepted options follows.
  8592. @table @option
  8593. @item nb_inputs
  8594. The number of inputs. If unspecified, it defaults to 2.
  8595. @item weights
  8596. Specify weight of each input video stream as sequence.
  8597. Each weight is separated by space. If number of weights
  8598. is smaller than number of @var{frames} last specified
  8599. weight will be used for all remaining unset weights.
  8600. @item scale
  8601. Specify scale, if it is set it will be multiplied with sum
  8602. of each weight multiplied with pixel values to give final destination
  8603. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8604. @item duration
  8605. Specify how end of stream is determined.
  8606. @table @samp
  8607. @item longest
  8608. The duration of the longest input. (default)
  8609. @item shortest
  8610. The duration of the shortest input.
  8611. @item first
  8612. The duration of the first input.
  8613. @end table
  8614. @end table
  8615. @section mpdecimate
  8616. Drop frames that do not differ greatly from the previous frame in
  8617. order to reduce frame rate.
  8618. The main use of this filter is for very-low-bitrate encoding
  8619. (e.g. streaming over dialup modem), but it could in theory be used for
  8620. fixing movies that were inverse-telecined incorrectly.
  8621. A description of the accepted options follows.
  8622. @table @option
  8623. @item max
  8624. Set the maximum number of consecutive frames which can be dropped (if
  8625. positive), or the minimum interval between dropped frames (if
  8626. negative). If the value is 0, the frame is dropped disregarding the
  8627. number of previous sequentially dropped frames.
  8628. Default value is 0.
  8629. @item hi
  8630. @item lo
  8631. @item frac
  8632. Set the dropping threshold values.
  8633. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8634. represent actual pixel value differences, so a threshold of 64
  8635. corresponds to 1 unit of difference for each pixel, or the same spread
  8636. out differently over the block.
  8637. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8638. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8639. meaning the whole image) differ by more than a threshold of @option{lo}.
  8640. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8641. 64*5, and default value for @option{frac} is 0.33.
  8642. @end table
  8643. @section negate
  8644. Negate input video.
  8645. It accepts an integer in input; if non-zero it negates the
  8646. alpha component (if available). The default value in input is 0.
  8647. @section nlmeans
  8648. Denoise frames using Non-Local Means algorithm.
  8649. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8650. context similarity is defined by comparing their surrounding patches of size
  8651. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8652. around the pixel.
  8653. Note that the research area defines centers for patches, which means some
  8654. patches will be made of pixels outside that research area.
  8655. The filter accepts the following options.
  8656. @table @option
  8657. @item s
  8658. Set denoising strength.
  8659. @item p
  8660. Set patch size.
  8661. @item pc
  8662. Same as @option{p} but for chroma planes.
  8663. The default value is @var{0} and means automatic.
  8664. @item r
  8665. Set research size.
  8666. @item rc
  8667. Same as @option{r} but for chroma planes.
  8668. The default value is @var{0} and means automatic.
  8669. @end table
  8670. @section nnedi
  8671. Deinterlace video using neural network edge directed interpolation.
  8672. This filter accepts the following options:
  8673. @table @option
  8674. @item weights
  8675. Mandatory option, without binary file filter can not work.
  8676. Currently file can be found here:
  8677. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8678. @item deint
  8679. Set which frames to deinterlace, by default it is @code{all}.
  8680. Can be @code{all} or @code{interlaced}.
  8681. @item field
  8682. Set mode of operation.
  8683. Can be one of the following:
  8684. @table @samp
  8685. @item af
  8686. Use frame flags, both fields.
  8687. @item a
  8688. Use frame flags, single field.
  8689. @item t
  8690. Use top field only.
  8691. @item b
  8692. Use bottom field only.
  8693. @item tf
  8694. Use both fields, top first.
  8695. @item bf
  8696. Use both fields, bottom first.
  8697. @end table
  8698. @item planes
  8699. Set which planes to process, by default filter process all frames.
  8700. @item nsize
  8701. Set size of local neighborhood around each pixel, used by the predictor neural
  8702. network.
  8703. Can be one of the following:
  8704. @table @samp
  8705. @item s8x6
  8706. @item s16x6
  8707. @item s32x6
  8708. @item s48x6
  8709. @item s8x4
  8710. @item s16x4
  8711. @item s32x4
  8712. @end table
  8713. @item nns
  8714. Set the number of neurons in predictor neural network.
  8715. Can be one of the following:
  8716. @table @samp
  8717. @item n16
  8718. @item n32
  8719. @item n64
  8720. @item n128
  8721. @item n256
  8722. @end table
  8723. @item qual
  8724. Controls the number of different neural network predictions that are blended
  8725. together to compute the final output value. Can be @code{fast}, default or
  8726. @code{slow}.
  8727. @item etype
  8728. Set which set of weights to use in the predictor.
  8729. Can be one of the following:
  8730. @table @samp
  8731. @item a
  8732. weights trained to minimize absolute error
  8733. @item s
  8734. weights trained to minimize squared error
  8735. @end table
  8736. @item pscrn
  8737. Controls whether or not the prescreener neural network is used to decide
  8738. which pixels should be processed by the predictor neural network and which
  8739. can be handled by simple cubic interpolation.
  8740. The prescreener is trained to know whether cubic interpolation will be
  8741. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8742. The computational complexity of the prescreener nn is much less than that of
  8743. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8744. using the prescreener generally results in much faster processing.
  8745. The prescreener is pretty accurate, so the difference between using it and not
  8746. using it is almost always unnoticeable.
  8747. Can be one of the following:
  8748. @table @samp
  8749. @item none
  8750. @item original
  8751. @item new
  8752. @end table
  8753. Default is @code{new}.
  8754. @item fapprox
  8755. Set various debugging flags.
  8756. @end table
  8757. @section noformat
  8758. Force libavfilter not to use any of the specified pixel formats for the
  8759. input to the next filter.
  8760. It accepts the following parameters:
  8761. @table @option
  8762. @item pix_fmts
  8763. A '|'-separated list of pixel format names, such as
  8764. pix_fmts=yuv420p|monow|rgb24".
  8765. @end table
  8766. @subsection Examples
  8767. @itemize
  8768. @item
  8769. Force libavfilter to use a format different from @var{yuv420p} for the
  8770. input to the vflip filter:
  8771. @example
  8772. noformat=pix_fmts=yuv420p,vflip
  8773. @end example
  8774. @item
  8775. Convert the input video to any of the formats not contained in the list:
  8776. @example
  8777. noformat=yuv420p|yuv444p|yuv410p
  8778. @end example
  8779. @end itemize
  8780. @section noise
  8781. Add noise on video input frame.
  8782. The filter accepts the following options:
  8783. @table @option
  8784. @item all_seed
  8785. @item c0_seed
  8786. @item c1_seed
  8787. @item c2_seed
  8788. @item c3_seed
  8789. Set noise seed for specific pixel component or all pixel components in case
  8790. of @var{all_seed}. Default value is @code{123457}.
  8791. @item all_strength, alls
  8792. @item c0_strength, c0s
  8793. @item c1_strength, c1s
  8794. @item c2_strength, c2s
  8795. @item c3_strength, c3s
  8796. Set noise strength for specific pixel component or all pixel components in case
  8797. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8798. @item all_flags, allf
  8799. @item c0_flags, c0f
  8800. @item c1_flags, c1f
  8801. @item c2_flags, c2f
  8802. @item c3_flags, c3f
  8803. Set pixel component flags or set flags for all components if @var{all_flags}.
  8804. Available values for component flags are:
  8805. @table @samp
  8806. @item a
  8807. averaged temporal noise (smoother)
  8808. @item p
  8809. mix random noise with a (semi)regular pattern
  8810. @item t
  8811. temporal noise (noise pattern changes between frames)
  8812. @item u
  8813. uniform noise (gaussian otherwise)
  8814. @end table
  8815. @end table
  8816. @subsection Examples
  8817. Add temporal and uniform noise to input video:
  8818. @example
  8819. noise=alls=20:allf=t+u
  8820. @end example
  8821. @section normalize
  8822. Normalize RGB video (aka histogram stretching, contrast stretching).
  8823. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8824. For each channel of each frame, the filter computes the input range and maps
  8825. it linearly to the user-specified output range. The output range defaults
  8826. to the full dynamic range from pure black to pure white.
  8827. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8828. changes in brightness) caused when small dark or bright objects enter or leave
  8829. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8830. video camera, and, like a video camera, it may cause a period of over- or
  8831. under-exposure of the video.
  8832. The R,G,B channels can be normalized independently, which may cause some
  8833. color shifting, or linked together as a single channel, which prevents
  8834. color shifting. Linked normalization preserves hue. Independent normalization
  8835. does not, so it can be used to remove some color casts. Independent and linked
  8836. normalization can be combined in any ratio.
  8837. The normalize filter accepts the following options:
  8838. @table @option
  8839. @item blackpt
  8840. @item whitept
  8841. Colors which define the output range. The minimum input value is mapped to
  8842. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8843. The defaults are black and white respectively. Specifying white for
  8844. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8845. normalized video. Shades of grey can be used to reduce the dynamic range
  8846. (contrast). Specifying saturated colors here can create some interesting
  8847. effects.
  8848. @item smoothing
  8849. The number of previous frames to use for temporal smoothing. The input range
  8850. of each channel is smoothed using a rolling average over the current frame
  8851. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8852. smoothing).
  8853. @item independence
  8854. Controls the ratio of independent (color shifting) channel normalization to
  8855. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8856. independent. Defaults to 1.0 (fully independent).
  8857. @item strength
  8858. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8859. expensive no-op. Defaults to 1.0 (full strength).
  8860. @end table
  8861. @subsection Examples
  8862. Stretch video contrast to use the full dynamic range, with no temporal
  8863. smoothing; may flicker depending on the source content:
  8864. @example
  8865. normalize=blackpt=black:whitept=white:smoothing=0
  8866. @end example
  8867. As above, but with 50 frames of temporal smoothing; flicker should be
  8868. reduced, depending on the source content:
  8869. @example
  8870. normalize=blackpt=black:whitept=white:smoothing=50
  8871. @end example
  8872. As above, but with hue-preserving linked channel normalization:
  8873. @example
  8874. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8875. @end example
  8876. As above, but with half strength:
  8877. @example
  8878. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8879. @end example
  8880. Map the darkest input color to red, the brightest input color to cyan:
  8881. @example
  8882. normalize=blackpt=red:whitept=cyan
  8883. @end example
  8884. @section null
  8885. Pass the video source unchanged to the output.
  8886. @section ocr
  8887. Optical Character Recognition
  8888. This filter uses Tesseract for optical character recognition.
  8889. It accepts the following options:
  8890. @table @option
  8891. @item datapath
  8892. Set datapath to tesseract data. Default is to use whatever was
  8893. set at installation.
  8894. @item language
  8895. Set language, default is "eng".
  8896. @item whitelist
  8897. Set character whitelist.
  8898. @item blacklist
  8899. Set character blacklist.
  8900. @end table
  8901. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8902. @section ocv
  8903. Apply a video transform using libopencv.
  8904. To enable this filter, install the libopencv library and headers and
  8905. configure FFmpeg with @code{--enable-libopencv}.
  8906. It accepts the following parameters:
  8907. @table @option
  8908. @item filter_name
  8909. The name of the libopencv filter to apply.
  8910. @item filter_params
  8911. The parameters to pass to the libopencv filter. If not specified, the default
  8912. values are assumed.
  8913. @end table
  8914. Refer to the official libopencv documentation for more precise
  8915. information:
  8916. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8917. Several libopencv filters are supported; see the following subsections.
  8918. @anchor{dilate}
  8919. @subsection dilate
  8920. Dilate an image by using a specific structuring element.
  8921. It corresponds to the libopencv function @code{cvDilate}.
  8922. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8923. @var{struct_el} represents a structuring element, and has the syntax:
  8924. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8925. @var{cols} and @var{rows} represent the number of columns and rows of
  8926. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8927. point, and @var{shape} the shape for the structuring element. @var{shape}
  8928. must be "rect", "cross", "ellipse", or "custom".
  8929. If the value for @var{shape} is "custom", it must be followed by a
  8930. string of the form "=@var{filename}". The file with name
  8931. @var{filename} is assumed to represent a binary image, with each
  8932. printable character corresponding to a bright pixel. When a custom
  8933. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8934. or columns and rows of the read file are assumed instead.
  8935. The default value for @var{struct_el} is "3x3+0x0/rect".
  8936. @var{nb_iterations} specifies the number of times the transform is
  8937. applied to the image, and defaults to 1.
  8938. Some examples:
  8939. @example
  8940. # Use the default values
  8941. ocv=dilate
  8942. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8943. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8944. # Read the shape from the file diamond.shape, iterating two times.
  8945. # The file diamond.shape may contain a pattern of characters like this
  8946. # *
  8947. # ***
  8948. # *****
  8949. # ***
  8950. # *
  8951. # The specified columns and rows are ignored
  8952. # but the anchor point coordinates are not
  8953. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8954. @end example
  8955. @subsection erode
  8956. Erode an image by using a specific structuring element.
  8957. It corresponds to the libopencv function @code{cvErode}.
  8958. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8959. with the same syntax and semantics as the @ref{dilate} filter.
  8960. @subsection smooth
  8961. Smooth the input video.
  8962. The filter takes the following parameters:
  8963. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8964. @var{type} is the type of smooth filter to apply, and must be one of
  8965. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8966. or "bilateral". The default value is "gaussian".
  8967. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8968. depend on the smooth type. @var{param1} and
  8969. @var{param2} accept integer positive values or 0. @var{param3} and
  8970. @var{param4} accept floating point values.
  8971. The default value for @var{param1} is 3. The default value for the
  8972. other parameters is 0.
  8973. These parameters correspond to the parameters assigned to the
  8974. libopencv function @code{cvSmooth}.
  8975. @section oscilloscope
  8976. 2D Video Oscilloscope.
  8977. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8978. It accepts the following parameters:
  8979. @table @option
  8980. @item x
  8981. Set scope center x position.
  8982. @item y
  8983. Set scope center y position.
  8984. @item s
  8985. Set scope size, relative to frame diagonal.
  8986. @item t
  8987. Set scope tilt/rotation.
  8988. @item o
  8989. Set trace opacity.
  8990. @item tx
  8991. Set trace center x position.
  8992. @item ty
  8993. Set trace center y position.
  8994. @item tw
  8995. Set trace width, relative to width of frame.
  8996. @item th
  8997. Set trace height, relative to height of frame.
  8998. @item c
  8999. Set which components to trace. By default it traces first three components.
  9000. @item g
  9001. Draw trace grid. By default is enabled.
  9002. @item st
  9003. Draw some statistics. By default is enabled.
  9004. @item sc
  9005. Draw scope. By default is enabled.
  9006. @end table
  9007. @subsection Examples
  9008. @itemize
  9009. @item
  9010. Inspect full first row of video frame.
  9011. @example
  9012. oscilloscope=x=0.5:y=0:s=1
  9013. @end example
  9014. @item
  9015. Inspect full last row of video frame.
  9016. @example
  9017. oscilloscope=x=0.5:y=1:s=1
  9018. @end example
  9019. @item
  9020. Inspect full 5th line of video frame of height 1080.
  9021. @example
  9022. oscilloscope=x=0.5:y=5/1080:s=1
  9023. @end example
  9024. @item
  9025. Inspect full last column of video frame.
  9026. @example
  9027. oscilloscope=x=1:y=0.5:s=1:t=1
  9028. @end example
  9029. @end itemize
  9030. @anchor{overlay}
  9031. @section overlay
  9032. Overlay one video on top of another.
  9033. It takes two inputs and has one output. The first input is the "main"
  9034. video on which the second input is overlaid.
  9035. It accepts the following parameters:
  9036. A description of the accepted options follows.
  9037. @table @option
  9038. @item x
  9039. @item y
  9040. Set the expression for the x and y coordinates of the overlaid video
  9041. on the main video. Default value is "0" for both expressions. In case
  9042. the expression is invalid, it is set to a huge value (meaning that the
  9043. overlay will not be displayed within the output visible area).
  9044. @item eof_action
  9045. See @ref{framesync}.
  9046. @item eval
  9047. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9048. It accepts the following values:
  9049. @table @samp
  9050. @item init
  9051. only evaluate expressions once during the filter initialization or
  9052. when a command is processed
  9053. @item frame
  9054. evaluate expressions for each incoming frame
  9055. @end table
  9056. Default value is @samp{frame}.
  9057. @item shortest
  9058. See @ref{framesync}.
  9059. @item format
  9060. Set the format for the output video.
  9061. It accepts the following values:
  9062. @table @samp
  9063. @item yuv420
  9064. force YUV420 output
  9065. @item yuv422
  9066. force YUV422 output
  9067. @item yuv444
  9068. force YUV444 output
  9069. @item rgb
  9070. force packed RGB output
  9071. @item gbrp
  9072. force planar RGB output
  9073. @item auto
  9074. automatically pick format
  9075. @end table
  9076. Default value is @samp{yuv420}.
  9077. @item repeatlast
  9078. See @ref{framesync}.
  9079. @item alpha
  9080. Set format of alpha of the overlaid video, it can be @var{straight} or
  9081. @var{premultiplied}. Default is @var{straight}.
  9082. @end table
  9083. The @option{x}, and @option{y} expressions can contain the following
  9084. parameters.
  9085. @table @option
  9086. @item main_w, W
  9087. @item main_h, H
  9088. The main input width and height.
  9089. @item overlay_w, w
  9090. @item overlay_h, h
  9091. The overlay input width and height.
  9092. @item x
  9093. @item y
  9094. The computed values for @var{x} and @var{y}. They are evaluated for
  9095. each new frame.
  9096. @item hsub
  9097. @item vsub
  9098. horizontal and vertical chroma subsample values of the output
  9099. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9100. @var{vsub} is 1.
  9101. @item n
  9102. the number of input frame, starting from 0
  9103. @item pos
  9104. the position in the file of the input frame, NAN if unknown
  9105. @item t
  9106. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9107. @end table
  9108. This filter also supports the @ref{framesync} options.
  9109. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9110. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9111. when @option{eval} is set to @samp{init}.
  9112. Be aware that frames are taken from each input video in timestamp
  9113. order, hence, if their initial timestamps differ, it is a good idea
  9114. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9115. have them begin in the same zero timestamp, as the example for
  9116. the @var{movie} filter does.
  9117. You can chain together more overlays but you should test the
  9118. efficiency of such approach.
  9119. @subsection Commands
  9120. This filter supports the following commands:
  9121. @table @option
  9122. @item x
  9123. @item y
  9124. Modify the x and y of the overlay input.
  9125. The command accepts the same syntax of the corresponding option.
  9126. If the specified expression is not valid, it is kept at its current
  9127. value.
  9128. @end table
  9129. @subsection Examples
  9130. @itemize
  9131. @item
  9132. Draw the overlay at 10 pixels from the bottom right corner of the main
  9133. video:
  9134. @example
  9135. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9136. @end example
  9137. Using named options the example above becomes:
  9138. @example
  9139. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9140. @end example
  9141. @item
  9142. Insert a transparent PNG logo in the bottom left corner of the input,
  9143. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9144. @example
  9145. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9146. @end example
  9147. @item
  9148. Insert 2 different transparent PNG logos (second logo on bottom
  9149. right corner) using the @command{ffmpeg} tool:
  9150. @example
  9151. 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
  9152. @end example
  9153. @item
  9154. Add a transparent color layer on top of the main video; @code{WxH}
  9155. must specify the size of the main input to the overlay filter:
  9156. @example
  9157. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9158. @end example
  9159. @item
  9160. Play an original video and a filtered version (here with the deshake
  9161. filter) side by side using the @command{ffplay} tool:
  9162. @example
  9163. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9164. @end example
  9165. The above command is the same as:
  9166. @example
  9167. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9168. @end example
  9169. @item
  9170. Make a sliding overlay appearing from the left to the right top part of the
  9171. screen starting since time 2:
  9172. @example
  9173. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9174. @end example
  9175. @item
  9176. Compose output by putting two input videos side to side:
  9177. @example
  9178. ffmpeg -i left.avi -i right.avi -filter_complex "
  9179. nullsrc=size=200x100 [background];
  9180. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9181. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9182. [background][left] overlay=shortest=1 [background+left];
  9183. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9184. "
  9185. @end example
  9186. @item
  9187. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9188. @example
  9189. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9190. -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]'
  9191. masked.avi
  9192. @end example
  9193. @item
  9194. Chain several overlays in cascade:
  9195. @example
  9196. nullsrc=s=200x200 [bg];
  9197. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9198. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9199. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9200. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9201. [in3] null, [mid2] overlay=100:100 [out0]
  9202. @end example
  9203. @end itemize
  9204. @section owdenoise
  9205. Apply Overcomplete Wavelet denoiser.
  9206. The filter accepts the following options:
  9207. @table @option
  9208. @item depth
  9209. Set depth.
  9210. Larger depth values will denoise lower frequency components more, but
  9211. slow down filtering.
  9212. Must be an int in the range 8-16, default is @code{8}.
  9213. @item luma_strength, ls
  9214. Set luma strength.
  9215. Must be a double value in the range 0-1000, default is @code{1.0}.
  9216. @item chroma_strength, cs
  9217. Set chroma strength.
  9218. Must be a double value in the range 0-1000, default is @code{1.0}.
  9219. @end table
  9220. @anchor{pad}
  9221. @section pad
  9222. Add paddings to the input image, and place the original input at the
  9223. provided @var{x}, @var{y} coordinates.
  9224. It accepts the following parameters:
  9225. @table @option
  9226. @item width, w
  9227. @item height, h
  9228. Specify an expression for the size of the output image with the
  9229. paddings added. If the value for @var{width} or @var{height} is 0, the
  9230. corresponding input size is used for the output.
  9231. The @var{width} expression can reference the value set by the
  9232. @var{height} expression, and vice versa.
  9233. The default value of @var{width} and @var{height} is 0.
  9234. @item x
  9235. @item y
  9236. Specify the offsets to place the input image at within the padded area,
  9237. with respect to the top/left border of the output image.
  9238. The @var{x} expression can reference the value set by the @var{y}
  9239. expression, and vice versa.
  9240. The default value of @var{x} and @var{y} is 0.
  9241. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9242. so the input image is centered on the padded area.
  9243. @item color
  9244. Specify the color of the padded area. For the syntax of this option,
  9245. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9246. manual,ffmpeg-utils}.
  9247. The default value of @var{color} is "black".
  9248. @item eval
  9249. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9250. It accepts the following values:
  9251. @table @samp
  9252. @item init
  9253. Only evaluate expressions once during the filter initialization or when
  9254. a command is processed.
  9255. @item frame
  9256. Evaluate expressions for each incoming frame.
  9257. @end table
  9258. Default value is @samp{init}.
  9259. @item aspect
  9260. Pad to aspect instead to a resolution.
  9261. @end table
  9262. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9263. options are expressions containing the following constants:
  9264. @table @option
  9265. @item in_w
  9266. @item in_h
  9267. The input video width and height.
  9268. @item iw
  9269. @item ih
  9270. These are the same as @var{in_w} and @var{in_h}.
  9271. @item out_w
  9272. @item out_h
  9273. The output width and height (the size of the padded area), as
  9274. specified by the @var{width} and @var{height} expressions.
  9275. @item ow
  9276. @item oh
  9277. These are the same as @var{out_w} and @var{out_h}.
  9278. @item x
  9279. @item y
  9280. The x and y offsets as specified by the @var{x} and @var{y}
  9281. expressions, or NAN if not yet specified.
  9282. @item a
  9283. same as @var{iw} / @var{ih}
  9284. @item sar
  9285. input sample aspect ratio
  9286. @item dar
  9287. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9288. @item hsub
  9289. @item vsub
  9290. The horizontal and vertical chroma subsample values. For example for the
  9291. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9292. @end table
  9293. @subsection Examples
  9294. @itemize
  9295. @item
  9296. Add paddings with the color "violet" to the input video. The output video
  9297. size is 640x480, and the top-left corner of the input video is placed at
  9298. column 0, row 40
  9299. @example
  9300. pad=640:480:0:40:violet
  9301. @end example
  9302. The example above is equivalent to the following command:
  9303. @example
  9304. pad=width=640:height=480:x=0:y=40:color=violet
  9305. @end example
  9306. @item
  9307. Pad the input to get an output with dimensions increased by 3/2,
  9308. and put the input video at the center of the padded area:
  9309. @example
  9310. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9311. @end example
  9312. @item
  9313. Pad the input to get a squared output with size equal to the maximum
  9314. value between the input width and height, and put the input video at
  9315. the center of the padded area:
  9316. @example
  9317. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9318. @end example
  9319. @item
  9320. Pad the input to get a final w/h ratio of 16:9:
  9321. @example
  9322. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9323. @end example
  9324. @item
  9325. In case of anamorphic video, in order to set the output display aspect
  9326. correctly, it is necessary to use @var{sar} in the expression,
  9327. according to the relation:
  9328. @example
  9329. (ih * X / ih) * sar = output_dar
  9330. X = output_dar / sar
  9331. @end example
  9332. Thus the previous example needs to be modified to:
  9333. @example
  9334. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9335. @end example
  9336. @item
  9337. Double the output size and put the input video in the bottom-right
  9338. corner of the output padded area:
  9339. @example
  9340. pad="2*iw:2*ih:ow-iw:oh-ih"
  9341. @end example
  9342. @end itemize
  9343. @anchor{palettegen}
  9344. @section palettegen
  9345. Generate one palette for a whole video stream.
  9346. It accepts the following options:
  9347. @table @option
  9348. @item max_colors
  9349. Set the maximum number of colors to quantize in the palette.
  9350. Note: the palette will still contain 256 colors; the unused palette entries
  9351. will be black.
  9352. @item reserve_transparent
  9353. Create a palette of 255 colors maximum and reserve the last one for
  9354. transparency. Reserving the transparency color is useful for GIF optimization.
  9355. If not set, the maximum of colors in the palette will be 256. You probably want
  9356. to disable this option for a standalone image.
  9357. Set by default.
  9358. @item transparency_color
  9359. Set the color that will be used as background for transparency.
  9360. @item stats_mode
  9361. Set statistics mode.
  9362. It accepts the following values:
  9363. @table @samp
  9364. @item full
  9365. Compute full frame histograms.
  9366. @item diff
  9367. Compute histograms only for the part that differs from previous frame. This
  9368. might be relevant to give more importance to the moving part of your input if
  9369. the background is static.
  9370. @item single
  9371. Compute new histogram for each frame.
  9372. @end table
  9373. Default value is @var{full}.
  9374. @end table
  9375. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9376. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9377. color quantization of the palette. This information is also visible at
  9378. @var{info} logging level.
  9379. @subsection Examples
  9380. @itemize
  9381. @item
  9382. Generate a representative palette of a given video using @command{ffmpeg}:
  9383. @example
  9384. ffmpeg -i input.mkv -vf palettegen palette.png
  9385. @end example
  9386. @end itemize
  9387. @section paletteuse
  9388. Use a palette to downsample an input video stream.
  9389. The filter takes two inputs: one video stream and a palette. The palette must
  9390. be a 256 pixels image.
  9391. It accepts the following options:
  9392. @table @option
  9393. @item dither
  9394. Select dithering mode. Available algorithms are:
  9395. @table @samp
  9396. @item bayer
  9397. Ordered 8x8 bayer dithering (deterministic)
  9398. @item heckbert
  9399. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9400. Note: this dithering is sometimes considered "wrong" and is included as a
  9401. reference.
  9402. @item floyd_steinberg
  9403. Floyd and Steingberg dithering (error diffusion)
  9404. @item sierra2
  9405. Frankie Sierra dithering v2 (error diffusion)
  9406. @item sierra2_4a
  9407. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9408. @end table
  9409. Default is @var{sierra2_4a}.
  9410. @item bayer_scale
  9411. When @var{bayer} dithering is selected, this option defines the scale of the
  9412. pattern (how much the crosshatch pattern is visible). A low value means more
  9413. visible pattern for less banding, and higher value means less visible pattern
  9414. at the cost of more banding.
  9415. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9416. @item diff_mode
  9417. If set, define the zone to process
  9418. @table @samp
  9419. @item rectangle
  9420. Only the changing rectangle will be reprocessed. This is similar to GIF
  9421. cropping/offsetting compression mechanism. This option can be useful for speed
  9422. if only a part of the image is changing, and has use cases such as limiting the
  9423. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9424. moving scene (it leads to more deterministic output if the scene doesn't change
  9425. much, and as a result less moving noise and better GIF compression).
  9426. @end table
  9427. Default is @var{none}.
  9428. @item new
  9429. Take new palette for each output frame.
  9430. @item alpha_threshold
  9431. Sets the alpha threshold for transparency. Alpha values above this threshold
  9432. will be treated as completely opaque, and values below this threshold will be
  9433. treated as completely transparent.
  9434. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9435. @end table
  9436. @subsection Examples
  9437. @itemize
  9438. @item
  9439. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9440. using @command{ffmpeg}:
  9441. @example
  9442. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9443. @end example
  9444. @end itemize
  9445. @section perspective
  9446. Correct perspective of video not recorded perpendicular to the screen.
  9447. A description of the accepted parameters follows.
  9448. @table @option
  9449. @item x0
  9450. @item y0
  9451. @item x1
  9452. @item y1
  9453. @item x2
  9454. @item y2
  9455. @item x3
  9456. @item y3
  9457. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9458. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9459. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9460. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9461. then the corners of the source will be sent to the specified coordinates.
  9462. The expressions can use the following variables:
  9463. @table @option
  9464. @item W
  9465. @item H
  9466. the width and height of video frame.
  9467. @item in
  9468. Input frame count.
  9469. @item on
  9470. Output frame count.
  9471. @end table
  9472. @item interpolation
  9473. Set interpolation for perspective correction.
  9474. It accepts the following values:
  9475. @table @samp
  9476. @item linear
  9477. @item cubic
  9478. @end table
  9479. Default value is @samp{linear}.
  9480. @item sense
  9481. Set interpretation of coordinate options.
  9482. It accepts the following values:
  9483. @table @samp
  9484. @item 0, source
  9485. Send point in the source specified by the given coordinates to
  9486. the corners of the destination.
  9487. @item 1, destination
  9488. Send the corners of the source to the point in the destination specified
  9489. by the given coordinates.
  9490. Default value is @samp{source}.
  9491. @end table
  9492. @item eval
  9493. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9494. It accepts the following values:
  9495. @table @samp
  9496. @item init
  9497. only evaluate expressions once during the filter initialization or
  9498. when a command is processed
  9499. @item frame
  9500. evaluate expressions for each incoming frame
  9501. @end table
  9502. Default value is @samp{init}.
  9503. @end table
  9504. @section phase
  9505. Delay interlaced video by one field time so that the field order changes.
  9506. The intended use is to fix PAL movies that have been captured with the
  9507. opposite field order to the film-to-video transfer.
  9508. A description of the accepted parameters follows.
  9509. @table @option
  9510. @item mode
  9511. Set phase mode.
  9512. It accepts the following values:
  9513. @table @samp
  9514. @item t
  9515. Capture field order top-first, transfer bottom-first.
  9516. Filter will delay the bottom field.
  9517. @item b
  9518. Capture field order bottom-first, transfer top-first.
  9519. Filter will delay the top field.
  9520. @item p
  9521. Capture and transfer with the same field order. This mode only exists
  9522. for the documentation of the other options to refer to, but if you
  9523. actually select it, the filter will faithfully do nothing.
  9524. @item a
  9525. Capture field order determined automatically by field flags, transfer
  9526. opposite.
  9527. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9528. basis using field flags. If no field information is available,
  9529. then this works just like @samp{u}.
  9530. @item u
  9531. Capture unknown or varying, transfer opposite.
  9532. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9533. analyzing the images and selecting the alternative that produces best
  9534. match between the fields.
  9535. @item T
  9536. Capture top-first, transfer unknown or varying.
  9537. Filter selects among @samp{t} and @samp{p} using image analysis.
  9538. @item B
  9539. Capture bottom-first, transfer unknown or varying.
  9540. Filter selects among @samp{b} and @samp{p} using image analysis.
  9541. @item A
  9542. Capture determined by field flags, transfer unknown or varying.
  9543. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9544. image analysis. If no field information is available, then this works just
  9545. like @samp{U}. This is the default mode.
  9546. @item U
  9547. Both capture and transfer unknown or varying.
  9548. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9549. @end table
  9550. @end table
  9551. @section pixdesctest
  9552. Pixel format descriptor test filter, mainly useful for internal
  9553. testing. The output video should be equal to the input video.
  9554. For example:
  9555. @example
  9556. format=monow, pixdesctest
  9557. @end example
  9558. can be used to test the monowhite pixel format descriptor definition.
  9559. @section pixscope
  9560. Display sample values of color channels. Mainly useful for checking color
  9561. and levels. Minimum supported resolution is 640x480.
  9562. The filters accept the following options:
  9563. @table @option
  9564. @item x
  9565. Set scope X position, relative offset on X axis.
  9566. @item y
  9567. Set scope Y position, relative offset on Y axis.
  9568. @item w
  9569. Set scope width.
  9570. @item h
  9571. Set scope height.
  9572. @item o
  9573. Set window opacity. This window also holds statistics about pixel area.
  9574. @item wx
  9575. Set window X position, relative offset on X axis.
  9576. @item wy
  9577. Set window Y position, relative offset on Y axis.
  9578. @end table
  9579. @section pp
  9580. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9581. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9582. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9583. Each subfilter and some options have a short and a long name that can be used
  9584. interchangeably, i.e. dr/dering are the same.
  9585. The filters accept the following options:
  9586. @table @option
  9587. @item subfilters
  9588. Set postprocessing subfilters string.
  9589. @end table
  9590. All subfilters share common options to determine their scope:
  9591. @table @option
  9592. @item a/autoq
  9593. Honor the quality commands for this subfilter.
  9594. @item c/chrom
  9595. Do chrominance filtering, too (default).
  9596. @item y/nochrom
  9597. Do luminance filtering only (no chrominance).
  9598. @item n/noluma
  9599. Do chrominance filtering only (no luminance).
  9600. @end table
  9601. These options can be appended after the subfilter name, separated by a '|'.
  9602. Available subfilters are:
  9603. @table @option
  9604. @item hb/hdeblock[|difference[|flatness]]
  9605. Horizontal deblocking filter
  9606. @table @option
  9607. @item difference
  9608. Difference factor where higher values mean more deblocking (default: @code{32}).
  9609. @item flatness
  9610. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9611. @end table
  9612. @item vb/vdeblock[|difference[|flatness]]
  9613. Vertical deblocking filter
  9614. @table @option
  9615. @item difference
  9616. Difference factor where higher values mean more deblocking (default: @code{32}).
  9617. @item flatness
  9618. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9619. @end table
  9620. @item ha/hadeblock[|difference[|flatness]]
  9621. Accurate horizontal deblocking filter
  9622. @table @option
  9623. @item difference
  9624. Difference factor where higher values mean more deblocking (default: @code{32}).
  9625. @item flatness
  9626. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9627. @end table
  9628. @item va/vadeblock[|difference[|flatness]]
  9629. Accurate vertical deblocking filter
  9630. @table @option
  9631. @item difference
  9632. Difference factor where higher values mean more deblocking (default: @code{32}).
  9633. @item flatness
  9634. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9635. @end table
  9636. @end table
  9637. The horizontal and vertical deblocking filters share the difference and
  9638. flatness values so you cannot set different horizontal and vertical
  9639. thresholds.
  9640. @table @option
  9641. @item h1/x1hdeblock
  9642. Experimental horizontal deblocking filter
  9643. @item v1/x1vdeblock
  9644. Experimental vertical deblocking filter
  9645. @item dr/dering
  9646. Deringing filter
  9647. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9648. @table @option
  9649. @item threshold1
  9650. larger -> stronger filtering
  9651. @item threshold2
  9652. larger -> stronger filtering
  9653. @item threshold3
  9654. larger -> stronger filtering
  9655. @end table
  9656. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9657. @table @option
  9658. @item f/fullyrange
  9659. Stretch luminance to @code{0-255}.
  9660. @end table
  9661. @item lb/linblenddeint
  9662. Linear blend deinterlacing filter that deinterlaces the given block by
  9663. filtering all lines with a @code{(1 2 1)} filter.
  9664. @item li/linipoldeint
  9665. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9666. linearly interpolating every second line.
  9667. @item ci/cubicipoldeint
  9668. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9669. cubically interpolating every second line.
  9670. @item md/mediandeint
  9671. Median deinterlacing filter that deinterlaces the given block by applying a
  9672. median filter to every second line.
  9673. @item fd/ffmpegdeint
  9674. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9675. second line with a @code{(-1 4 2 4 -1)} filter.
  9676. @item l5/lowpass5
  9677. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9678. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9679. @item fq/forceQuant[|quantizer]
  9680. Overrides the quantizer table from the input with the constant quantizer you
  9681. specify.
  9682. @table @option
  9683. @item quantizer
  9684. Quantizer to use
  9685. @end table
  9686. @item de/default
  9687. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9688. @item fa/fast
  9689. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9690. @item ac
  9691. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9692. @end table
  9693. @subsection Examples
  9694. @itemize
  9695. @item
  9696. Apply horizontal and vertical deblocking, deringing and automatic
  9697. brightness/contrast:
  9698. @example
  9699. pp=hb/vb/dr/al
  9700. @end example
  9701. @item
  9702. Apply default filters without brightness/contrast correction:
  9703. @example
  9704. pp=de/-al
  9705. @end example
  9706. @item
  9707. Apply default filters and temporal denoiser:
  9708. @example
  9709. pp=default/tmpnoise|1|2|3
  9710. @end example
  9711. @item
  9712. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9713. automatically depending on available CPU time:
  9714. @example
  9715. pp=hb|y/vb|a
  9716. @end example
  9717. @end itemize
  9718. @section pp7
  9719. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9720. similar to spp = 6 with 7 point DCT, where only the center sample is
  9721. used after IDCT.
  9722. The filter accepts the following options:
  9723. @table @option
  9724. @item qp
  9725. Force a constant quantization parameter. It accepts an integer in range
  9726. 0 to 63. If not set, the filter will use the QP from the video stream
  9727. (if available).
  9728. @item mode
  9729. Set thresholding mode. Available modes are:
  9730. @table @samp
  9731. @item hard
  9732. Set hard thresholding.
  9733. @item soft
  9734. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9735. @item medium
  9736. Set medium thresholding (good results, default).
  9737. @end table
  9738. @end table
  9739. @section premultiply
  9740. Apply alpha premultiply effect to input video stream using first plane
  9741. of second stream as alpha.
  9742. Both streams must have same dimensions and same pixel format.
  9743. The filter accepts the following option:
  9744. @table @option
  9745. @item planes
  9746. Set which planes will be processed, unprocessed planes will be copied.
  9747. By default value 0xf, all planes will be processed.
  9748. @item inplace
  9749. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9750. @end table
  9751. @section prewitt
  9752. Apply prewitt operator to input video stream.
  9753. The filter accepts the following option:
  9754. @table @option
  9755. @item planes
  9756. Set which planes will be processed, unprocessed planes will be copied.
  9757. By default value 0xf, all planes will be processed.
  9758. @item scale
  9759. Set value which will be multiplied with filtered result.
  9760. @item delta
  9761. Set value which will be added to filtered result.
  9762. @end table
  9763. @anchor{program_opencl}
  9764. @section program_opencl
  9765. Filter video using an OpenCL program.
  9766. @table @option
  9767. @item source
  9768. OpenCL program source file.
  9769. @item kernel
  9770. Kernel name in program.
  9771. @item inputs
  9772. Number of inputs to the filter. Defaults to 1.
  9773. @item size, s
  9774. Size of output frames. Defaults to the same as the first input.
  9775. @end table
  9776. The program source file must contain a kernel function with the given name,
  9777. which will be run once for each plane of the output. Each run on a plane
  9778. gets enqueued as a separate 2D global NDRange with one work-item for each
  9779. pixel to be generated. The global ID offset for each work-item is therefore
  9780. the coordinates of a pixel in the destination image.
  9781. The kernel function needs to take the following arguments:
  9782. @itemize
  9783. @item
  9784. Destination image, @var{__write_only image2d_t}.
  9785. This image will become the output; the kernel should write all of it.
  9786. @item
  9787. Frame index, @var{unsigned int}.
  9788. This is a counter starting from zero and increasing by one for each frame.
  9789. @item
  9790. Source images, @var{__read_only image2d_t}.
  9791. These are the most recent images on each input. The kernel may read from
  9792. them to generate the output, but they can't be written to.
  9793. @end itemize
  9794. Example programs:
  9795. @itemize
  9796. @item
  9797. Copy the input to the output (output must be the same size as the input).
  9798. @verbatim
  9799. __kernel void copy(__write_only image2d_t destination,
  9800. unsigned int index,
  9801. __read_only image2d_t source)
  9802. {
  9803. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9804. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9805. float4 value = read_imagef(source, sampler, location);
  9806. write_imagef(destination, location, value);
  9807. }
  9808. @end verbatim
  9809. @item
  9810. Apply a simple transformation, rotating the input by an amount increasing
  9811. with the index counter. Pixel values are linearly interpolated by the
  9812. sampler, and the output need not have the same dimensions as the input.
  9813. @verbatim
  9814. __kernel void rotate_image(__write_only image2d_t dst,
  9815. unsigned int index,
  9816. __read_only image2d_t src)
  9817. {
  9818. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9819. CLK_FILTER_LINEAR);
  9820. float angle = (float)index / 100.0f;
  9821. float2 dst_dim = convert_float2(get_image_dim(dst));
  9822. float2 src_dim = convert_float2(get_image_dim(src));
  9823. float2 dst_cen = dst_dim / 2.0f;
  9824. float2 src_cen = src_dim / 2.0f;
  9825. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9826. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9827. float2 src_pos = {
  9828. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9829. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9830. };
  9831. src_pos = src_pos * src_dim / dst_dim;
  9832. float2 src_loc = src_pos + src_cen;
  9833. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9834. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9835. write_imagef(dst, dst_loc, 0.5f);
  9836. else
  9837. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9838. }
  9839. @end verbatim
  9840. @item
  9841. Blend two inputs together, with the amount of each input used varying
  9842. with the index counter.
  9843. @verbatim
  9844. __kernel void blend_images(__write_only image2d_t dst,
  9845. unsigned int index,
  9846. __read_only image2d_t src1,
  9847. __read_only image2d_t src2)
  9848. {
  9849. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9850. CLK_FILTER_LINEAR);
  9851. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9852. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9853. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9854. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9855. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9856. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9857. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9858. }
  9859. @end verbatim
  9860. @end itemize
  9861. @section pseudocolor
  9862. Alter frame colors in video with pseudocolors.
  9863. This filter accept the following options:
  9864. @table @option
  9865. @item c0
  9866. set pixel first component expression
  9867. @item c1
  9868. set pixel second component expression
  9869. @item c2
  9870. set pixel third component expression
  9871. @item c3
  9872. set pixel fourth component expression, corresponds to the alpha component
  9873. @item i
  9874. set component to use as base for altering colors
  9875. @end table
  9876. Each of them specifies the expression to use for computing the lookup table for
  9877. the corresponding pixel component values.
  9878. The expressions can contain the following constants and functions:
  9879. @table @option
  9880. @item w
  9881. @item h
  9882. The input width and height.
  9883. @item val
  9884. The input value for the pixel component.
  9885. @item ymin, umin, vmin, amin
  9886. The minimum allowed component value.
  9887. @item ymax, umax, vmax, amax
  9888. The maximum allowed component value.
  9889. @end table
  9890. All expressions default to "val".
  9891. @subsection Examples
  9892. @itemize
  9893. @item
  9894. Change too high luma values to gradient:
  9895. @example
  9896. 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'"
  9897. @end example
  9898. @end itemize
  9899. @section psnr
  9900. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9901. Ratio) between two input videos.
  9902. This filter takes in input two input videos, the first input is
  9903. considered the "main" source and is passed unchanged to the
  9904. output. The second input is used as a "reference" video for computing
  9905. the PSNR.
  9906. Both video inputs must have the same resolution and pixel format for
  9907. this filter to work correctly. Also it assumes that both inputs
  9908. have the same number of frames, which are compared one by one.
  9909. The obtained average PSNR is printed through the logging system.
  9910. The filter stores the accumulated MSE (mean squared error) of each
  9911. frame, and at the end of the processing it is averaged across all frames
  9912. equally, and the following formula is applied to obtain the PSNR:
  9913. @example
  9914. PSNR = 10*log10(MAX^2/MSE)
  9915. @end example
  9916. Where MAX is the average of the maximum values of each component of the
  9917. image.
  9918. The description of the accepted parameters follows.
  9919. @table @option
  9920. @item stats_file, f
  9921. If specified the filter will use the named file to save the PSNR of
  9922. each individual frame. When filename equals "-" the data is sent to
  9923. standard output.
  9924. @item stats_version
  9925. Specifies which version of the stats file format to use. Details of
  9926. each format are written below.
  9927. Default value is 1.
  9928. @item stats_add_max
  9929. Determines whether the max value is output to the stats log.
  9930. Default value is 0.
  9931. Requires stats_version >= 2. If this is set and stats_version < 2,
  9932. the filter will return an error.
  9933. @end table
  9934. This filter also supports the @ref{framesync} options.
  9935. The file printed if @var{stats_file} is selected, contains a sequence of
  9936. key/value pairs of the form @var{key}:@var{value} for each compared
  9937. couple of frames.
  9938. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9939. the list of per-frame-pair stats, with key value pairs following the frame
  9940. format with the following parameters:
  9941. @table @option
  9942. @item psnr_log_version
  9943. The version of the log file format. Will match @var{stats_version}.
  9944. @item fields
  9945. A comma separated list of the per-frame-pair parameters included in
  9946. the log.
  9947. @end table
  9948. A description of each shown per-frame-pair parameter follows:
  9949. @table @option
  9950. @item n
  9951. sequential number of the input frame, starting from 1
  9952. @item mse_avg
  9953. Mean Square Error pixel-by-pixel average difference of the compared
  9954. frames, averaged over all the image components.
  9955. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9956. Mean Square Error pixel-by-pixel average difference of the compared
  9957. frames for the component specified by the suffix.
  9958. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9959. Peak Signal to Noise ratio of the compared frames for the component
  9960. specified by the suffix.
  9961. @item max_avg, max_y, max_u, max_v
  9962. Maximum allowed value for each channel, and average over all
  9963. channels.
  9964. @end table
  9965. For example:
  9966. @example
  9967. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9968. [main][ref] psnr="stats_file=stats.log" [out]
  9969. @end example
  9970. On this example the input file being processed is compared with the
  9971. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9972. is stored in @file{stats.log}.
  9973. @anchor{pullup}
  9974. @section pullup
  9975. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9976. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9977. content.
  9978. The pullup filter is designed to take advantage of future context in making
  9979. its decisions. This filter is stateless in the sense that it does not lock
  9980. onto a pattern to follow, but it instead looks forward to the following
  9981. fields in order to identify matches and rebuild progressive frames.
  9982. To produce content with an even framerate, insert the fps filter after
  9983. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9984. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9985. The filter accepts the following options:
  9986. @table @option
  9987. @item jl
  9988. @item jr
  9989. @item jt
  9990. @item jb
  9991. These options set the amount of "junk" to ignore at the left, right, top, and
  9992. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9993. while top and bottom are in units of 2 lines.
  9994. The default is 8 pixels on each side.
  9995. @item sb
  9996. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9997. filter generating an occasional mismatched frame, but it may also cause an
  9998. excessive number of frames to be dropped during high motion sequences.
  9999. Conversely, setting it to -1 will make filter match fields more easily.
  10000. This may help processing of video where there is slight blurring between
  10001. the fields, but may also cause there to be interlaced frames in the output.
  10002. Default value is @code{0}.
  10003. @item mp
  10004. Set the metric plane to use. It accepts the following values:
  10005. @table @samp
  10006. @item l
  10007. Use luma plane.
  10008. @item u
  10009. Use chroma blue plane.
  10010. @item v
  10011. Use chroma red plane.
  10012. @end table
  10013. This option may be set to use chroma plane instead of the default luma plane
  10014. for doing filter's computations. This may improve accuracy on very clean
  10015. source material, but more likely will decrease accuracy, especially if there
  10016. is chroma noise (rainbow effect) or any grayscale video.
  10017. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10018. load and make pullup usable in realtime on slow machines.
  10019. @end table
  10020. For best results (without duplicated frames in the output file) it is
  10021. necessary to change the output frame rate. For example, to inverse
  10022. telecine NTSC input:
  10023. @example
  10024. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10025. @end example
  10026. @section qp
  10027. Change video quantization parameters (QP).
  10028. The filter accepts the following option:
  10029. @table @option
  10030. @item qp
  10031. Set expression for quantization parameter.
  10032. @end table
  10033. The expression is evaluated through the eval API and can contain, among others,
  10034. the following constants:
  10035. @table @var
  10036. @item known
  10037. 1 if index is not 129, 0 otherwise.
  10038. @item qp
  10039. Sequential index starting from -129 to 128.
  10040. @end table
  10041. @subsection Examples
  10042. @itemize
  10043. @item
  10044. Some equation like:
  10045. @example
  10046. qp=2+2*sin(PI*qp)
  10047. @end example
  10048. @end itemize
  10049. @section random
  10050. Flush video frames from internal cache of frames into a random order.
  10051. No frame is discarded.
  10052. Inspired by @ref{frei0r} nervous filter.
  10053. @table @option
  10054. @item frames
  10055. Set size in number of frames of internal cache, in range from @code{2} to
  10056. @code{512}. Default is @code{30}.
  10057. @item seed
  10058. Set seed for random number generator, must be an integer included between
  10059. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10060. less than @code{0}, the filter will try to use a good random seed on a
  10061. best effort basis.
  10062. @end table
  10063. @section readeia608
  10064. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10065. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10066. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10067. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10068. @table @option
  10069. @item lavfi.readeia608.X.cc
  10070. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10071. @item lavfi.readeia608.X.line
  10072. The number of the line on which the EIA-608 data was identified and read.
  10073. @end table
  10074. This filter accepts the following options:
  10075. @table @option
  10076. @item scan_min
  10077. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10078. @item scan_max
  10079. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10080. @item mac
  10081. Set minimal acceptable amplitude change for sync codes detection.
  10082. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10083. @item spw
  10084. Set the ratio of width reserved for sync code detection.
  10085. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10086. @item mhd
  10087. Set the max peaks height difference for sync code detection.
  10088. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10089. @item mpd
  10090. Set max peaks period difference for sync code detection.
  10091. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10092. @item msd
  10093. Set the first two max start code bits differences.
  10094. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10095. @item bhd
  10096. Set the minimum ratio of bits height compared to 3rd start code bit.
  10097. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10098. @item th_w
  10099. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10100. @item th_b
  10101. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10102. @item chp
  10103. Enable checking the parity bit. In the event of a parity error, the filter will output
  10104. @code{0x00} for that character. Default is false.
  10105. @end table
  10106. @subsection Examples
  10107. @itemize
  10108. @item
  10109. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10110. @example
  10111. 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
  10112. @end example
  10113. @end itemize
  10114. @section readvitc
  10115. Read vertical interval timecode (VITC) information from the top lines of a
  10116. video frame.
  10117. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10118. timecode value, if a valid timecode has been detected. Further metadata key
  10119. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10120. timecode data has been found or not.
  10121. This filter accepts the following options:
  10122. @table @option
  10123. @item scan_max
  10124. Set the maximum number of lines to scan for VITC data. If the value is set to
  10125. @code{-1} the full video frame is scanned. Default is @code{45}.
  10126. @item thr_b
  10127. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10128. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10129. @item thr_w
  10130. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10131. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10132. @end table
  10133. @subsection Examples
  10134. @itemize
  10135. @item
  10136. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10137. draw @code{--:--:--:--} as a placeholder:
  10138. @example
  10139. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10140. @end example
  10141. @end itemize
  10142. @section remap
  10143. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10144. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10145. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10146. value for pixel will be used for destination pixel.
  10147. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10148. will have Xmap/Ymap video stream dimensions.
  10149. Xmap and Ymap input video streams are 16bit depth, single channel.
  10150. @section removegrain
  10151. The removegrain filter is a spatial denoiser for progressive video.
  10152. @table @option
  10153. @item m0
  10154. Set mode for the first plane.
  10155. @item m1
  10156. Set mode for the second plane.
  10157. @item m2
  10158. Set mode for the third plane.
  10159. @item m3
  10160. Set mode for the fourth plane.
  10161. @end table
  10162. Range of mode is from 0 to 24. Description of each mode follows:
  10163. @table @var
  10164. @item 0
  10165. Leave input plane unchanged. Default.
  10166. @item 1
  10167. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10168. @item 2
  10169. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10170. @item 3
  10171. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10172. @item 4
  10173. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10174. This is equivalent to a median filter.
  10175. @item 5
  10176. Line-sensitive clipping giving the minimal change.
  10177. @item 6
  10178. Line-sensitive clipping, intermediate.
  10179. @item 7
  10180. Line-sensitive clipping, intermediate.
  10181. @item 8
  10182. Line-sensitive clipping, intermediate.
  10183. @item 9
  10184. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10185. @item 10
  10186. Replaces the target pixel with the closest neighbour.
  10187. @item 11
  10188. [1 2 1] horizontal and vertical kernel blur.
  10189. @item 12
  10190. Same as mode 11.
  10191. @item 13
  10192. Bob mode, interpolates top field from the line where the neighbours
  10193. pixels are the closest.
  10194. @item 14
  10195. Bob mode, interpolates bottom field from the line where the neighbours
  10196. pixels are the closest.
  10197. @item 15
  10198. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10199. interpolation formula.
  10200. @item 16
  10201. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10202. interpolation formula.
  10203. @item 17
  10204. Clips the pixel with the minimum and maximum of respectively the maximum and
  10205. minimum of each pair of opposite neighbour pixels.
  10206. @item 18
  10207. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10208. the current pixel is minimal.
  10209. @item 19
  10210. Replaces the pixel with the average of its 8 neighbours.
  10211. @item 20
  10212. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10213. @item 21
  10214. Clips pixels using the averages of opposite neighbour.
  10215. @item 22
  10216. Same as mode 21 but simpler and faster.
  10217. @item 23
  10218. Small edge and halo removal, but reputed useless.
  10219. @item 24
  10220. Similar as 23.
  10221. @end table
  10222. @section removelogo
  10223. Suppress a TV station logo, using an image file to determine which
  10224. pixels comprise the logo. It works by filling in the pixels that
  10225. comprise the logo with neighboring pixels.
  10226. The filter accepts the following options:
  10227. @table @option
  10228. @item filename, f
  10229. Set the filter bitmap file, which can be any image format supported by
  10230. libavformat. The width and height of the image file must match those of the
  10231. video stream being processed.
  10232. @end table
  10233. Pixels in the provided bitmap image with a value of zero are not
  10234. considered part of the logo, non-zero pixels are considered part of
  10235. the logo. If you use white (255) for the logo and black (0) for the
  10236. rest, you will be safe. For making the filter bitmap, it is
  10237. recommended to take a screen capture of a black frame with the logo
  10238. visible, and then using a threshold filter followed by the erode
  10239. filter once or twice.
  10240. If needed, little splotches can be fixed manually. Remember that if
  10241. logo pixels are not covered, the filter quality will be much
  10242. reduced. Marking too many pixels as part of the logo does not hurt as
  10243. much, but it will increase the amount of blurring needed to cover over
  10244. the image and will destroy more information than necessary, and extra
  10245. pixels will slow things down on a large logo.
  10246. @section repeatfields
  10247. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10248. fields based on its value.
  10249. @section reverse
  10250. Reverse a video clip.
  10251. Warning: This filter requires memory to buffer the entire clip, so trimming
  10252. is suggested.
  10253. @subsection Examples
  10254. @itemize
  10255. @item
  10256. Take the first 5 seconds of a clip, and reverse it.
  10257. @example
  10258. trim=end=5,reverse
  10259. @end example
  10260. @end itemize
  10261. @section roberts
  10262. Apply roberts cross operator to input video stream.
  10263. The filter accepts the following option:
  10264. @table @option
  10265. @item planes
  10266. Set which planes will be processed, unprocessed planes will be copied.
  10267. By default value 0xf, all planes will be processed.
  10268. @item scale
  10269. Set value which will be multiplied with filtered result.
  10270. @item delta
  10271. Set value which will be added to filtered result.
  10272. @end table
  10273. @section rotate
  10274. Rotate video by an arbitrary angle expressed in radians.
  10275. The filter accepts the following options:
  10276. A description of the optional parameters follows.
  10277. @table @option
  10278. @item angle, a
  10279. Set an expression for the angle by which to rotate the input video
  10280. clockwise, expressed as a number of radians. A negative value will
  10281. result in a counter-clockwise rotation. By default it is set to "0".
  10282. This expression is evaluated for each frame.
  10283. @item out_w, ow
  10284. Set the output width expression, default value is "iw".
  10285. This expression is evaluated just once during configuration.
  10286. @item out_h, oh
  10287. Set the output height expression, default value is "ih".
  10288. This expression is evaluated just once during configuration.
  10289. @item bilinear
  10290. Enable bilinear interpolation if set to 1, a value of 0 disables
  10291. it. Default value is 1.
  10292. @item fillcolor, c
  10293. Set the color used to fill the output area not covered by the rotated
  10294. image. For the general syntax of this option, check the
  10295. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10296. If the special value "none" is selected then no
  10297. background is printed (useful for example if the background is never shown).
  10298. Default value is "black".
  10299. @end table
  10300. The expressions for the angle and the output size can contain the
  10301. following constants and functions:
  10302. @table @option
  10303. @item n
  10304. sequential number of the input frame, starting from 0. It is always NAN
  10305. before the first frame is filtered.
  10306. @item t
  10307. time in seconds of the input frame, it is set to 0 when the filter is
  10308. configured. It is always NAN before the first frame is filtered.
  10309. @item hsub
  10310. @item vsub
  10311. horizontal and vertical chroma subsample values. For example for the
  10312. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10313. @item in_w, iw
  10314. @item in_h, ih
  10315. the input video width and height
  10316. @item out_w, ow
  10317. @item out_h, oh
  10318. the output width and height, that is the size of the padded area as
  10319. specified by the @var{width} and @var{height} expressions
  10320. @item rotw(a)
  10321. @item roth(a)
  10322. the minimal width/height required for completely containing the input
  10323. video rotated by @var{a} radians.
  10324. These are only available when computing the @option{out_w} and
  10325. @option{out_h} expressions.
  10326. @end table
  10327. @subsection Examples
  10328. @itemize
  10329. @item
  10330. Rotate the input by PI/6 radians clockwise:
  10331. @example
  10332. rotate=PI/6
  10333. @end example
  10334. @item
  10335. Rotate the input by PI/6 radians counter-clockwise:
  10336. @example
  10337. rotate=-PI/6
  10338. @end example
  10339. @item
  10340. Rotate the input by 45 degrees clockwise:
  10341. @example
  10342. rotate=45*PI/180
  10343. @end example
  10344. @item
  10345. Apply a constant rotation with period T, starting from an angle of PI/3:
  10346. @example
  10347. rotate=PI/3+2*PI*t/T
  10348. @end example
  10349. @item
  10350. Make the input video rotation oscillating with a period of T
  10351. seconds and an amplitude of A radians:
  10352. @example
  10353. rotate=A*sin(2*PI/T*t)
  10354. @end example
  10355. @item
  10356. Rotate the video, output size is chosen so that the whole rotating
  10357. input video is always completely contained in the output:
  10358. @example
  10359. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10360. @end example
  10361. @item
  10362. Rotate the video, reduce the output size so that no background is ever
  10363. shown:
  10364. @example
  10365. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10366. @end example
  10367. @end itemize
  10368. @subsection Commands
  10369. The filter supports the following commands:
  10370. @table @option
  10371. @item a, angle
  10372. Set the angle expression.
  10373. The command accepts the same syntax of the corresponding option.
  10374. If the specified expression is not valid, it is kept at its current
  10375. value.
  10376. @end table
  10377. @section sab
  10378. Apply Shape Adaptive Blur.
  10379. The filter accepts the following options:
  10380. @table @option
  10381. @item luma_radius, lr
  10382. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10383. value is 1.0. A greater value will result in a more blurred image, and
  10384. in slower processing.
  10385. @item luma_pre_filter_radius, lpfr
  10386. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10387. value is 1.0.
  10388. @item luma_strength, ls
  10389. Set luma maximum difference between pixels to still be considered, must
  10390. be a value in the 0.1-100.0 range, default value is 1.0.
  10391. @item chroma_radius, cr
  10392. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10393. greater value will result in a more blurred image, and in slower
  10394. processing.
  10395. @item chroma_pre_filter_radius, cpfr
  10396. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10397. @item chroma_strength, cs
  10398. Set chroma maximum difference between pixels to still be considered,
  10399. must be a value in the -0.9-100.0 range.
  10400. @end table
  10401. Each chroma option value, if not explicitly specified, is set to the
  10402. corresponding luma option value.
  10403. @anchor{scale}
  10404. @section scale
  10405. Scale (resize) the input video, using the libswscale library.
  10406. The scale filter forces the output display aspect ratio to be the same
  10407. of the input, by changing the output sample aspect ratio.
  10408. If the input image format is different from the format requested by
  10409. the next filter, the scale filter will convert the input to the
  10410. requested format.
  10411. @subsection Options
  10412. The filter accepts the following options, or any of the options
  10413. supported by the libswscale scaler.
  10414. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10415. the complete list of scaler options.
  10416. @table @option
  10417. @item width, w
  10418. @item height, h
  10419. Set the output video dimension expression. Default value is the input
  10420. dimension.
  10421. If the @var{width} or @var{w} value is 0, the input width is used for
  10422. the output. If the @var{height} or @var{h} value is 0, the input height
  10423. is used for the output.
  10424. If one and only one of the values is -n with n >= 1, the scale filter
  10425. will use a value that maintains the aspect ratio of the input image,
  10426. calculated from the other specified dimension. After that it will,
  10427. however, make sure that the calculated dimension is divisible by n and
  10428. adjust the value if necessary.
  10429. If both values are -n with n >= 1, the behavior will be identical to
  10430. both values being set to 0 as previously detailed.
  10431. See below for the list of accepted constants for use in the dimension
  10432. expression.
  10433. @item eval
  10434. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10435. @table @samp
  10436. @item init
  10437. Only evaluate expressions once during the filter initialization or when a command is processed.
  10438. @item frame
  10439. Evaluate expressions for each incoming frame.
  10440. @end table
  10441. Default value is @samp{init}.
  10442. @item interl
  10443. Set the interlacing mode. It accepts the following values:
  10444. @table @samp
  10445. @item 1
  10446. Force interlaced aware scaling.
  10447. @item 0
  10448. Do not apply interlaced scaling.
  10449. @item -1
  10450. Select interlaced aware scaling depending on whether the source frames
  10451. are flagged as interlaced or not.
  10452. @end table
  10453. Default value is @samp{0}.
  10454. @item flags
  10455. Set libswscale scaling flags. See
  10456. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10457. complete list of values. If not explicitly specified the filter applies
  10458. the default flags.
  10459. @item param0, param1
  10460. Set libswscale input parameters for scaling algorithms that need them. See
  10461. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10462. complete documentation. If not explicitly specified the filter applies
  10463. empty parameters.
  10464. @item size, s
  10465. Set the video size. For the syntax of this option, check the
  10466. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10467. @item in_color_matrix
  10468. @item out_color_matrix
  10469. Set in/output YCbCr color space type.
  10470. This allows the autodetected value to be overridden as well as allows forcing
  10471. a specific value used for the output and encoder.
  10472. If not specified, the color space type depends on the pixel format.
  10473. Possible values:
  10474. @table @samp
  10475. @item auto
  10476. Choose automatically.
  10477. @item bt709
  10478. Format conforming to International Telecommunication Union (ITU)
  10479. Recommendation BT.709.
  10480. @item fcc
  10481. Set color space conforming to the United States Federal Communications
  10482. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10483. @item bt601
  10484. Set color space conforming to:
  10485. @itemize
  10486. @item
  10487. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10488. @item
  10489. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10490. @item
  10491. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10492. @end itemize
  10493. @item smpte240m
  10494. Set color space conforming to SMPTE ST 240:1999.
  10495. @end table
  10496. @item in_range
  10497. @item out_range
  10498. Set in/output YCbCr sample range.
  10499. This allows the autodetected value to be overridden as well as allows forcing
  10500. a specific value used for the output and encoder. If not specified, the
  10501. range depends on the pixel format. Possible values:
  10502. @table @samp
  10503. @item auto/unknown
  10504. Choose automatically.
  10505. @item jpeg/full/pc
  10506. Set full range (0-255 in case of 8-bit luma).
  10507. @item mpeg/limited/tv
  10508. Set "MPEG" range (16-235 in case of 8-bit luma).
  10509. @end table
  10510. @item force_original_aspect_ratio
  10511. Enable decreasing or increasing output video width or height if necessary to
  10512. keep the original aspect ratio. Possible values:
  10513. @table @samp
  10514. @item disable
  10515. Scale the video as specified and disable this feature.
  10516. @item decrease
  10517. The output video dimensions will automatically be decreased if needed.
  10518. @item increase
  10519. The output video dimensions will automatically be increased if needed.
  10520. @end table
  10521. One useful instance of this option is that when you know a specific device's
  10522. maximum allowed resolution, you can use this to limit the output video to
  10523. that, while retaining the aspect ratio. For example, device A allows
  10524. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10525. decrease) and specifying 1280x720 to the command line makes the output
  10526. 1280x533.
  10527. Please note that this is a different thing than specifying -1 for @option{w}
  10528. or @option{h}, you still need to specify the output resolution for this option
  10529. to work.
  10530. @end table
  10531. The values of the @option{w} and @option{h} options are expressions
  10532. containing the following constants:
  10533. @table @var
  10534. @item in_w
  10535. @item in_h
  10536. The input width and height
  10537. @item iw
  10538. @item ih
  10539. These are the same as @var{in_w} and @var{in_h}.
  10540. @item out_w
  10541. @item out_h
  10542. The output (scaled) width and height
  10543. @item ow
  10544. @item oh
  10545. These are the same as @var{out_w} and @var{out_h}
  10546. @item a
  10547. The same as @var{iw} / @var{ih}
  10548. @item sar
  10549. input sample aspect ratio
  10550. @item dar
  10551. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10552. @item hsub
  10553. @item vsub
  10554. horizontal and vertical input chroma subsample values. For example for the
  10555. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10556. @item ohsub
  10557. @item ovsub
  10558. horizontal and vertical output chroma subsample values. For example for the
  10559. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10560. @end table
  10561. @subsection Examples
  10562. @itemize
  10563. @item
  10564. Scale the input video to a size of 200x100
  10565. @example
  10566. scale=w=200:h=100
  10567. @end example
  10568. This is equivalent to:
  10569. @example
  10570. scale=200:100
  10571. @end example
  10572. or:
  10573. @example
  10574. scale=200x100
  10575. @end example
  10576. @item
  10577. Specify a size abbreviation for the output size:
  10578. @example
  10579. scale=qcif
  10580. @end example
  10581. which can also be written as:
  10582. @example
  10583. scale=size=qcif
  10584. @end example
  10585. @item
  10586. Scale the input to 2x:
  10587. @example
  10588. scale=w=2*iw:h=2*ih
  10589. @end example
  10590. @item
  10591. The above is the same as:
  10592. @example
  10593. scale=2*in_w:2*in_h
  10594. @end example
  10595. @item
  10596. Scale the input to 2x with forced interlaced scaling:
  10597. @example
  10598. scale=2*iw:2*ih:interl=1
  10599. @end example
  10600. @item
  10601. Scale the input to half size:
  10602. @example
  10603. scale=w=iw/2:h=ih/2
  10604. @end example
  10605. @item
  10606. Increase the width, and set the height to the same size:
  10607. @example
  10608. scale=3/2*iw:ow
  10609. @end example
  10610. @item
  10611. Seek Greek harmony:
  10612. @example
  10613. scale=iw:1/PHI*iw
  10614. scale=ih*PHI:ih
  10615. @end example
  10616. @item
  10617. Increase the height, and set the width to 3/2 of the height:
  10618. @example
  10619. scale=w=3/2*oh:h=3/5*ih
  10620. @end example
  10621. @item
  10622. Increase the size, making the size a multiple of the chroma
  10623. subsample values:
  10624. @example
  10625. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10626. @end example
  10627. @item
  10628. Increase the width to a maximum of 500 pixels,
  10629. keeping the same aspect ratio as the input:
  10630. @example
  10631. scale=w='min(500\, iw*3/2):h=-1'
  10632. @end example
  10633. @item
  10634. Make pixels square by combining scale and setsar:
  10635. @example
  10636. scale='trunc(ih*dar):ih',setsar=1/1
  10637. @end example
  10638. @item
  10639. Make pixels square by combining scale and setsar,
  10640. making sure the resulting resolution is even (required by some codecs):
  10641. @example
  10642. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10643. @end example
  10644. @end itemize
  10645. @subsection Commands
  10646. This filter supports the following commands:
  10647. @table @option
  10648. @item width, w
  10649. @item height, h
  10650. Set the output video dimension expression.
  10651. The command accepts the same syntax of the corresponding option.
  10652. If the specified expression is not valid, it is kept at its current
  10653. value.
  10654. @end table
  10655. @section scale_npp
  10656. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10657. format conversion on CUDA video frames. Setting the output width and height
  10658. works in the same way as for the @var{scale} filter.
  10659. The following additional options are accepted:
  10660. @table @option
  10661. @item format
  10662. The pixel format of the output CUDA frames. If set to the string "same" (the
  10663. default), the input format will be kept. Note that automatic format negotiation
  10664. and conversion is not yet supported for hardware frames
  10665. @item interp_algo
  10666. The interpolation algorithm used for resizing. One of the following:
  10667. @table @option
  10668. @item nn
  10669. Nearest neighbour.
  10670. @item linear
  10671. @item cubic
  10672. @item cubic2p_bspline
  10673. 2-parameter cubic (B=1, C=0)
  10674. @item cubic2p_catmullrom
  10675. 2-parameter cubic (B=0, C=1/2)
  10676. @item cubic2p_b05c03
  10677. 2-parameter cubic (B=1/2, C=3/10)
  10678. @item super
  10679. Supersampling
  10680. @item lanczos
  10681. @end table
  10682. @end table
  10683. @section scale2ref
  10684. Scale (resize) the input video, based on a reference video.
  10685. See the scale filter for available options, scale2ref supports the same but
  10686. uses the reference video instead of the main input as basis. scale2ref also
  10687. supports the following additional constants for the @option{w} and
  10688. @option{h} options:
  10689. @table @var
  10690. @item main_w
  10691. @item main_h
  10692. The main input video's width and height
  10693. @item main_a
  10694. The same as @var{main_w} / @var{main_h}
  10695. @item main_sar
  10696. The main input video's sample aspect ratio
  10697. @item main_dar, mdar
  10698. The main input video's display aspect ratio. Calculated from
  10699. @code{(main_w / main_h) * main_sar}.
  10700. @item main_hsub
  10701. @item main_vsub
  10702. The main input video's horizontal and vertical chroma subsample values.
  10703. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10704. is 1.
  10705. @end table
  10706. @subsection Examples
  10707. @itemize
  10708. @item
  10709. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10710. @example
  10711. 'scale2ref[b][a];[a][b]overlay'
  10712. @end example
  10713. @end itemize
  10714. @anchor{selectivecolor}
  10715. @section selectivecolor
  10716. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10717. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10718. by the "purity" of the color (that is, how saturated it already is).
  10719. This filter is similar to the Adobe Photoshop Selective Color tool.
  10720. The filter accepts the following options:
  10721. @table @option
  10722. @item correction_method
  10723. Select color correction method.
  10724. Available values are:
  10725. @table @samp
  10726. @item absolute
  10727. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10728. component value).
  10729. @item relative
  10730. Specified adjustments are relative to the original component value.
  10731. @end table
  10732. Default is @code{absolute}.
  10733. @item reds
  10734. Adjustments for red pixels (pixels where the red component is the maximum)
  10735. @item yellows
  10736. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10737. @item greens
  10738. Adjustments for green pixels (pixels where the green component is the maximum)
  10739. @item cyans
  10740. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10741. @item blues
  10742. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10743. @item magentas
  10744. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10745. @item whites
  10746. Adjustments for white pixels (pixels where all components are greater than 128)
  10747. @item neutrals
  10748. Adjustments for all pixels except pure black and pure white
  10749. @item blacks
  10750. Adjustments for black pixels (pixels where all components are lesser than 128)
  10751. @item psfile
  10752. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10753. @end table
  10754. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10755. 4 space separated floating point adjustment values in the [-1,1] range,
  10756. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10757. pixels of its range.
  10758. @subsection Examples
  10759. @itemize
  10760. @item
  10761. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10762. increase magenta by 27% in blue areas:
  10763. @example
  10764. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10765. @end example
  10766. @item
  10767. Use a Photoshop selective color preset:
  10768. @example
  10769. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10770. @end example
  10771. @end itemize
  10772. @anchor{separatefields}
  10773. @section separatefields
  10774. The @code{separatefields} takes a frame-based video input and splits
  10775. each frame into its components fields, producing a new half height clip
  10776. with twice the frame rate and twice the frame count.
  10777. This filter use field-dominance information in frame to decide which
  10778. of each pair of fields to place first in the output.
  10779. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10780. @section setdar, setsar
  10781. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10782. output video.
  10783. This is done by changing the specified Sample (aka Pixel) Aspect
  10784. Ratio, according to the following equation:
  10785. @example
  10786. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10787. @end example
  10788. Keep in mind that the @code{setdar} filter does not modify the pixel
  10789. dimensions of the video frame. Also, the display aspect ratio set by
  10790. this filter may be changed by later filters in the filterchain,
  10791. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10792. applied.
  10793. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10794. the filter output video.
  10795. Note that as a consequence of the application of this filter, the
  10796. output display aspect ratio will change according to the equation
  10797. above.
  10798. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10799. filter may be changed by later filters in the filterchain, e.g. if
  10800. another "setsar" or a "setdar" filter is applied.
  10801. It accepts the following parameters:
  10802. @table @option
  10803. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10804. Set the aspect ratio used by the filter.
  10805. The parameter can be a floating point number string, an expression, or
  10806. a string of the form @var{num}:@var{den}, where @var{num} and
  10807. @var{den} are the numerator and denominator of the aspect ratio. If
  10808. the parameter is not specified, it is assumed the value "0".
  10809. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10810. should be escaped.
  10811. @item max
  10812. Set the maximum integer value to use for expressing numerator and
  10813. denominator when reducing the expressed aspect ratio to a rational.
  10814. Default value is @code{100}.
  10815. @end table
  10816. The parameter @var{sar} is an expression containing
  10817. the following constants:
  10818. @table @option
  10819. @item E, PI, PHI
  10820. These are approximated values for the mathematical constants e
  10821. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10822. @item w, h
  10823. The input width and height.
  10824. @item a
  10825. These are the same as @var{w} / @var{h}.
  10826. @item sar
  10827. The input sample aspect ratio.
  10828. @item dar
  10829. The input display aspect ratio. It is the same as
  10830. (@var{w} / @var{h}) * @var{sar}.
  10831. @item hsub, vsub
  10832. Horizontal and vertical chroma subsample values. For example, for the
  10833. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10834. @end table
  10835. @subsection Examples
  10836. @itemize
  10837. @item
  10838. To change the display aspect ratio to 16:9, specify one of the following:
  10839. @example
  10840. setdar=dar=1.77777
  10841. setdar=dar=16/9
  10842. @end example
  10843. @item
  10844. To change the sample aspect ratio to 10:11, specify:
  10845. @example
  10846. setsar=sar=10/11
  10847. @end example
  10848. @item
  10849. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10850. 1000 in the aspect ratio reduction, use the command:
  10851. @example
  10852. setdar=ratio=16/9:max=1000
  10853. @end example
  10854. @end itemize
  10855. @anchor{setfield}
  10856. @section setfield
  10857. Force field for the output video frame.
  10858. The @code{setfield} filter marks the interlace type field for the
  10859. output frames. It does not change the input frame, but only sets the
  10860. corresponding property, which affects how the frame is treated by
  10861. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10862. The filter accepts the following options:
  10863. @table @option
  10864. @item mode
  10865. Available values are:
  10866. @table @samp
  10867. @item auto
  10868. Keep the same field property.
  10869. @item bff
  10870. Mark the frame as bottom-field-first.
  10871. @item tff
  10872. Mark the frame as top-field-first.
  10873. @item prog
  10874. Mark the frame as progressive.
  10875. @end table
  10876. @end table
  10877. @section showinfo
  10878. Show a line containing various information for each input video frame.
  10879. The input video is not modified.
  10880. The shown line contains a sequence of key/value pairs of the form
  10881. @var{key}:@var{value}.
  10882. The following values are shown in the output:
  10883. @table @option
  10884. @item n
  10885. The (sequential) number of the input frame, starting from 0.
  10886. @item pts
  10887. The Presentation TimeStamp of the input frame, expressed as a number of
  10888. time base units. The time base unit depends on the filter input pad.
  10889. @item pts_time
  10890. The Presentation TimeStamp of the input frame, expressed as a number of
  10891. seconds.
  10892. @item pos
  10893. The position of the frame in the input stream, or -1 if this information is
  10894. unavailable and/or meaningless (for example in case of synthetic video).
  10895. @item fmt
  10896. The pixel format name.
  10897. @item sar
  10898. The sample aspect ratio of the input frame, expressed in the form
  10899. @var{num}/@var{den}.
  10900. @item s
  10901. The size of the input frame. For the syntax of this option, check the
  10902. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10903. @item i
  10904. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10905. for bottom field first).
  10906. @item iskey
  10907. This is 1 if the frame is a key frame, 0 otherwise.
  10908. @item type
  10909. The picture type of the input frame ("I" for an I-frame, "P" for a
  10910. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10911. Also refer to the documentation of the @code{AVPictureType} enum and of
  10912. the @code{av_get_picture_type_char} function defined in
  10913. @file{libavutil/avutil.h}.
  10914. @item checksum
  10915. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10916. @item plane_checksum
  10917. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10918. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10919. @end table
  10920. @section showpalette
  10921. Displays the 256 colors palette of each frame. This filter is only relevant for
  10922. @var{pal8} pixel format frames.
  10923. It accepts the following option:
  10924. @table @option
  10925. @item s
  10926. Set the size of the box used to represent one palette color entry. Default is
  10927. @code{30} (for a @code{30x30} pixel box).
  10928. @end table
  10929. @section shuffleframes
  10930. Reorder and/or duplicate and/or drop video frames.
  10931. It accepts the following parameters:
  10932. @table @option
  10933. @item mapping
  10934. Set the destination indexes of input frames.
  10935. This is space or '|' separated list of indexes that maps input frames to output
  10936. frames. Number of indexes also sets maximal value that each index may have.
  10937. '-1' index have special meaning and that is to drop frame.
  10938. @end table
  10939. The first frame has the index 0. The default is to keep the input unchanged.
  10940. @subsection Examples
  10941. @itemize
  10942. @item
  10943. Swap second and third frame of every three frames of the input:
  10944. @example
  10945. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10946. @end example
  10947. @item
  10948. Swap 10th and 1st frame of every ten frames of the input:
  10949. @example
  10950. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10951. @end example
  10952. @end itemize
  10953. @section shuffleplanes
  10954. Reorder and/or duplicate video planes.
  10955. It accepts the following parameters:
  10956. @table @option
  10957. @item map0
  10958. The index of the input plane to be used as the first output plane.
  10959. @item map1
  10960. The index of the input plane to be used as the second output plane.
  10961. @item map2
  10962. The index of the input plane to be used as the third output plane.
  10963. @item map3
  10964. The index of the input plane to be used as the fourth output plane.
  10965. @end table
  10966. The first plane has the index 0. The default is to keep the input unchanged.
  10967. @subsection Examples
  10968. @itemize
  10969. @item
  10970. Swap the second and third planes of the input:
  10971. @example
  10972. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10973. @end example
  10974. @end itemize
  10975. @anchor{signalstats}
  10976. @section signalstats
  10977. Evaluate various visual metrics that assist in determining issues associated
  10978. with the digitization of analog video media.
  10979. By default the filter will log these metadata values:
  10980. @table @option
  10981. @item YMIN
  10982. Display the minimal Y value contained within the input frame. Expressed in
  10983. range of [0-255].
  10984. @item YLOW
  10985. Display the Y value at the 10% percentile within the input frame. Expressed in
  10986. range of [0-255].
  10987. @item YAVG
  10988. Display the average Y value within the input frame. Expressed in range of
  10989. [0-255].
  10990. @item YHIGH
  10991. Display the Y value at the 90% percentile within the input frame. Expressed in
  10992. range of [0-255].
  10993. @item YMAX
  10994. Display the maximum Y value contained within the input frame. Expressed in
  10995. range of [0-255].
  10996. @item UMIN
  10997. Display the minimal U value contained within the input frame. Expressed in
  10998. range of [0-255].
  10999. @item ULOW
  11000. Display the U value at the 10% percentile within the input frame. Expressed in
  11001. range of [0-255].
  11002. @item UAVG
  11003. Display the average U value within the input frame. Expressed in range of
  11004. [0-255].
  11005. @item UHIGH
  11006. Display the U value at the 90% percentile within the input frame. Expressed in
  11007. range of [0-255].
  11008. @item UMAX
  11009. Display the maximum U value contained within the input frame. Expressed in
  11010. range of [0-255].
  11011. @item VMIN
  11012. Display the minimal V value contained within the input frame. Expressed in
  11013. range of [0-255].
  11014. @item VLOW
  11015. Display the V value at the 10% percentile within the input frame. Expressed in
  11016. range of [0-255].
  11017. @item VAVG
  11018. Display the average V value within the input frame. Expressed in range of
  11019. [0-255].
  11020. @item VHIGH
  11021. Display the V value at the 90% percentile within the input frame. Expressed in
  11022. range of [0-255].
  11023. @item VMAX
  11024. Display the maximum V value contained within the input frame. Expressed in
  11025. range of [0-255].
  11026. @item SATMIN
  11027. Display the minimal saturation value contained within the input frame.
  11028. Expressed in range of [0-~181.02].
  11029. @item SATLOW
  11030. Display the saturation value at the 10% percentile within the input frame.
  11031. Expressed in range of [0-~181.02].
  11032. @item SATAVG
  11033. Display the average saturation value within the input frame. Expressed in range
  11034. of [0-~181.02].
  11035. @item SATHIGH
  11036. Display the saturation value at the 90% percentile within the input frame.
  11037. Expressed in range of [0-~181.02].
  11038. @item SATMAX
  11039. Display the maximum saturation value contained within the input frame.
  11040. Expressed in range of [0-~181.02].
  11041. @item HUEMED
  11042. Display the median value for hue within the input frame. Expressed in range of
  11043. [0-360].
  11044. @item HUEAVG
  11045. Display the average value for hue within the input frame. Expressed in range of
  11046. [0-360].
  11047. @item YDIF
  11048. Display the average of sample value difference between all values of the Y
  11049. plane in the current frame and corresponding values of the previous input frame.
  11050. Expressed in range of [0-255].
  11051. @item UDIF
  11052. Display the average of sample value difference between all values of the U
  11053. plane in the current frame and corresponding values of the previous input frame.
  11054. Expressed in range of [0-255].
  11055. @item VDIF
  11056. Display the average of sample value difference between all values of the V
  11057. plane in the current frame and corresponding values of the previous input frame.
  11058. Expressed in range of [0-255].
  11059. @item YBITDEPTH
  11060. Display bit depth of Y plane in current frame.
  11061. Expressed in range of [0-16].
  11062. @item UBITDEPTH
  11063. Display bit depth of U plane in current frame.
  11064. Expressed in range of [0-16].
  11065. @item VBITDEPTH
  11066. Display bit depth of V plane in current frame.
  11067. Expressed in range of [0-16].
  11068. @end table
  11069. The filter accepts the following options:
  11070. @table @option
  11071. @item stat
  11072. @item out
  11073. @option{stat} specify an additional form of image analysis.
  11074. @option{out} output video with the specified type of pixel highlighted.
  11075. Both options accept the following values:
  11076. @table @samp
  11077. @item tout
  11078. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11079. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11080. include the results of video dropouts, head clogs, or tape tracking issues.
  11081. @item vrep
  11082. Identify @var{vertical line repetition}. Vertical line repetition includes
  11083. similar rows of pixels within a frame. In born-digital video vertical line
  11084. repetition is common, but this pattern is uncommon in video digitized from an
  11085. analog source. When it occurs in video that results from the digitization of an
  11086. analog source it can indicate concealment from a dropout compensator.
  11087. @item brng
  11088. Identify pixels that fall outside of legal broadcast range.
  11089. @end table
  11090. @item color, c
  11091. Set the highlight color for the @option{out} option. The default color is
  11092. yellow.
  11093. @end table
  11094. @subsection Examples
  11095. @itemize
  11096. @item
  11097. Output data of various video metrics:
  11098. @example
  11099. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11100. @end example
  11101. @item
  11102. Output specific data about the minimum and maximum values of the Y plane per frame:
  11103. @example
  11104. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11105. @end example
  11106. @item
  11107. Playback video while highlighting pixels that are outside of broadcast range in red.
  11108. @example
  11109. ffplay example.mov -vf signalstats="out=brng:color=red"
  11110. @end example
  11111. @item
  11112. Playback video with signalstats metadata drawn over the frame.
  11113. @example
  11114. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11115. @end example
  11116. The contents of signalstat_drawtext.txt used in the command are:
  11117. @example
  11118. time %@{pts:hms@}
  11119. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11120. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11121. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11122. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11123. @end example
  11124. @end itemize
  11125. @anchor{signature}
  11126. @section signature
  11127. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11128. input. In this case the matching between the inputs can be calculated additionally.
  11129. The filter always passes through the first input. The signature of each stream can
  11130. be written into a file.
  11131. It accepts the following options:
  11132. @table @option
  11133. @item detectmode
  11134. Enable or disable the matching process.
  11135. Available values are:
  11136. @table @samp
  11137. @item off
  11138. Disable the calculation of a matching (default).
  11139. @item full
  11140. Calculate the matching for the whole video and output whether the whole video
  11141. matches or only parts.
  11142. @item fast
  11143. Calculate only until a matching is found or the video ends. Should be faster in
  11144. some cases.
  11145. @end table
  11146. @item nb_inputs
  11147. Set the number of inputs. The option value must be a non negative integer.
  11148. Default value is 1.
  11149. @item filename
  11150. Set the path to which the output is written. If there is more than one input,
  11151. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11152. integer), that will be replaced with the input number. If no filename is
  11153. specified, no output will be written. This is the default.
  11154. @item format
  11155. Choose the output format.
  11156. Available values are:
  11157. @table @samp
  11158. @item binary
  11159. Use the specified binary representation (default).
  11160. @item xml
  11161. Use the specified xml representation.
  11162. @end table
  11163. @item th_d
  11164. Set threshold to detect one word as similar. The option value must be an integer
  11165. greater than zero. The default value is 9000.
  11166. @item th_dc
  11167. Set threshold to detect all words as similar. The option value must be an integer
  11168. greater than zero. The default value is 60000.
  11169. @item th_xh
  11170. Set threshold to detect frames as similar. The option value must be an integer
  11171. greater than zero. The default value is 116.
  11172. @item th_di
  11173. Set the minimum length of a sequence in frames to recognize it as matching
  11174. sequence. The option value must be a non negative integer value.
  11175. The default value is 0.
  11176. @item th_it
  11177. Set the minimum relation, that matching frames to all frames must have.
  11178. The option value must be a double value between 0 and 1. The default value is 0.5.
  11179. @end table
  11180. @subsection Examples
  11181. @itemize
  11182. @item
  11183. To calculate the signature of an input video and store it in signature.bin:
  11184. @example
  11185. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11186. @end example
  11187. @item
  11188. To detect whether two videos match and store the signatures in XML format in
  11189. signature0.xml and signature1.xml:
  11190. @example
  11191. 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 -
  11192. @end example
  11193. @end itemize
  11194. @anchor{smartblur}
  11195. @section smartblur
  11196. Blur the input video without impacting the outlines.
  11197. It accepts the following options:
  11198. @table @option
  11199. @item luma_radius, lr
  11200. Set the luma radius. The option value must be a float number in
  11201. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11202. used to blur the image (slower if larger). Default value is 1.0.
  11203. @item luma_strength, ls
  11204. Set the luma strength. The option value must be a float number
  11205. in the range [-1.0,1.0] that configures the blurring. A value included
  11206. in [0.0,1.0] will blur the image whereas a value included in
  11207. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11208. @item luma_threshold, lt
  11209. Set the luma threshold used as a coefficient to determine
  11210. whether a pixel should be blurred or not. The option value must be an
  11211. integer in the range [-30,30]. A value of 0 will filter all the image,
  11212. a value included in [0,30] will filter flat areas and a value included
  11213. in [-30,0] will filter edges. Default value is 0.
  11214. @item chroma_radius, cr
  11215. Set the chroma radius. The option value must be a float number in
  11216. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11217. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11218. @item chroma_strength, cs
  11219. Set the chroma strength. The option value must be a float number
  11220. in the range [-1.0,1.0] that configures the blurring. A value included
  11221. in [0.0,1.0] will blur the image whereas a value included in
  11222. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11223. @item chroma_threshold, ct
  11224. Set the chroma threshold used as a coefficient to determine
  11225. whether a pixel should be blurred or not. The option value must be an
  11226. integer in the range [-30,30]. A value of 0 will filter all the image,
  11227. a value included in [0,30] will filter flat areas and a value included
  11228. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11229. @end table
  11230. If a chroma option is not explicitly set, the corresponding luma value
  11231. is set.
  11232. @section ssim
  11233. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11234. This filter takes in input two input videos, the first input is
  11235. considered the "main" source and is passed unchanged to the
  11236. output. The second input is used as a "reference" video for computing
  11237. the SSIM.
  11238. Both video inputs must have the same resolution and pixel format for
  11239. this filter to work correctly. Also it assumes that both inputs
  11240. have the same number of frames, which are compared one by one.
  11241. The filter stores the calculated SSIM of each frame.
  11242. The description of the accepted parameters follows.
  11243. @table @option
  11244. @item stats_file, f
  11245. If specified the filter will use the named file to save the SSIM of
  11246. each individual frame. When filename equals "-" the data is sent to
  11247. standard output.
  11248. @end table
  11249. The file printed if @var{stats_file} is selected, contains a sequence of
  11250. key/value pairs of the form @var{key}:@var{value} for each compared
  11251. couple of frames.
  11252. A description of each shown parameter follows:
  11253. @table @option
  11254. @item n
  11255. sequential number of the input frame, starting from 1
  11256. @item Y, U, V, R, G, B
  11257. SSIM of the compared frames for the component specified by the suffix.
  11258. @item All
  11259. SSIM of the compared frames for the whole frame.
  11260. @item dB
  11261. Same as above but in dB representation.
  11262. @end table
  11263. This filter also supports the @ref{framesync} options.
  11264. For example:
  11265. @example
  11266. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11267. [main][ref] ssim="stats_file=stats.log" [out]
  11268. @end example
  11269. On this example the input file being processed is compared with the
  11270. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11271. is stored in @file{stats.log}.
  11272. Another example with both psnr and ssim at same time:
  11273. @example
  11274. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11275. @end example
  11276. @section stereo3d
  11277. Convert between different stereoscopic image formats.
  11278. The filters accept the following options:
  11279. @table @option
  11280. @item in
  11281. Set stereoscopic image format of input.
  11282. Available values for input image formats are:
  11283. @table @samp
  11284. @item sbsl
  11285. side by side parallel (left eye left, right eye right)
  11286. @item sbsr
  11287. side by side crosseye (right eye left, left eye right)
  11288. @item sbs2l
  11289. side by side parallel with half width resolution
  11290. (left eye left, right eye right)
  11291. @item sbs2r
  11292. side by side crosseye with half width resolution
  11293. (right eye left, left eye right)
  11294. @item abl
  11295. above-below (left eye above, right eye below)
  11296. @item abr
  11297. above-below (right eye above, left eye below)
  11298. @item ab2l
  11299. above-below with half height resolution
  11300. (left eye above, right eye below)
  11301. @item ab2r
  11302. above-below with half height resolution
  11303. (right eye above, left eye below)
  11304. @item al
  11305. alternating frames (left eye first, right eye second)
  11306. @item ar
  11307. alternating frames (right eye first, left eye second)
  11308. @item irl
  11309. interleaved rows (left eye has top row, right eye starts on next row)
  11310. @item irr
  11311. interleaved rows (right eye has top row, left eye starts on next row)
  11312. @item icl
  11313. interleaved columns, left eye first
  11314. @item icr
  11315. interleaved columns, right eye first
  11316. Default value is @samp{sbsl}.
  11317. @end table
  11318. @item out
  11319. Set stereoscopic image format of output.
  11320. @table @samp
  11321. @item sbsl
  11322. side by side parallel (left eye left, right eye right)
  11323. @item sbsr
  11324. side by side crosseye (right eye left, left eye right)
  11325. @item sbs2l
  11326. side by side parallel with half width resolution
  11327. (left eye left, right eye right)
  11328. @item sbs2r
  11329. side by side crosseye with half width resolution
  11330. (right eye left, left eye right)
  11331. @item abl
  11332. above-below (left eye above, right eye below)
  11333. @item abr
  11334. above-below (right eye above, left eye below)
  11335. @item ab2l
  11336. above-below with half height resolution
  11337. (left eye above, right eye below)
  11338. @item ab2r
  11339. above-below with half height resolution
  11340. (right eye above, left eye below)
  11341. @item al
  11342. alternating frames (left eye first, right eye second)
  11343. @item ar
  11344. alternating frames (right eye first, left eye second)
  11345. @item irl
  11346. interleaved rows (left eye has top row, right eye starts on next row)
  11347. @item irr
  11348. interleaved rows (right eye has top row, left eye starts on next row)
  11349. @item arbg
  11350. anaglyph red/blue gray
  11351. (red filter on left eye, blue filter on right eye)
  11352. @item argg
  11353. anaglyph red/green gray
  11354. (red filter on left eye, green filter on right eye)
  11355. @item arcg
  11356. anaglyph red/cyan gray
  11357. (red filter on left eye, cyan filter on right eye)
  11358. @item arch
  11359. anaglyph red/cyan half colored
  11360. (red filter on left eye, cyan filter on right eye)
  11361. @item arcc
  11362. anaglyph red/cyan color
  11363. (red filter on left eye, cyan filter on right eye)
  11364. @item arcd
  11365. anaglyph red/cyan color optimized with the least squares projection of dubois
  11366. (red filter on left eye, cyan filter on right eye)
  11367. @item agmg
  11368. anaglyph green/magenta gray
  11369. (green filter on left eye, magenta filter on right eye)
  11370. @item agmh
  11371. anaglyph green/magenta half colored
  11372. (green filter on left eye, magenta filter on right eye)
  11373. @item agmc
  11374. anaglyph green/magenta colored
  11375. (green filter on left eye, magenta filter on right eye)
  11376. @item agmd
  11377. anaglyph green/magenta color optimized with the least squares projection of dubois
  11378. (green filter on left eye, magenta filter on right eye)
  11379. @item aybg
  11380. anaglyph yellow/blue gray
  11381. (yellow filter on left eye, blue filter on right eye)
  11382. @item aybh
  11383. anaglyph yellow/blue half colored
  11384. (yellow filter on left eye, blue filter on right eye)
  11385. @item aybc
  11386. anaglyph yellow/blue colored
  11387. (yellow filter on left eye, blue filter on right eye)
  11388. @item aybd
  11389. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11390. (yellow filter on left eye, blue filter on right eye)
  11391. @item ml
  11392. mono output (left eye only)
  11393. @item mr
  11394. mono output (right eye only)
  11395. @item chl
  11396. checkerboard, left eye first
  11397. @item chr
  11398. checkerboard, right eye first
  11399. @item icl
  11400. interleaved columns, left eye first
  11401. @item icr
  11402. interleaved columns, right eye first
  11403. @item hdmi
  11404. HDMI frame pack
  11405. @end table
  11406. Default value is @samp{arcd}.
  11407. @end table
  11408. @subsection Examples
  11409. @itemize
  11410. @item
  11411. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11412. @example
  11413. stereo3d=sbsl:aybd
  11414. @end example
  11415. @item
  11416. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11417. @example
  11418. stereo3d=abl:sbsr
  11419. @end example
  11420. @end itemize
  11421. @section streamselect, astreamselect
  11422. Select video or audio streams.
  11423. The filter accepts the following options:
  11424. @table @option
  11425. @item inputs
  11426. Set number of inputs. Default is 2.
  11427. @item map
  11428. Set input indexes to remap to outputs.
  11429. @end table
  11430. @subsection Commands
  11431. The @code{streamselect} and @code{astreamselect} filter supports the following
  11432. commands:
  11433. @table @option
  11434. @item map
  11435. Set input indexes to remap to outputs.
  11436. @end table
  11437. @subsection Examples
  11438. @itemize
  11439. @item
  11440. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11441. @example
  11442. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11443. @end example
  11444. @item
  11445. Same as above, but for audio:
  11446. @example
  11447. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11448. @end example
  11449. @end itemize
  11450. @section sobel
  11451. Apply sobel operator to input video stream.
  11452. The filter accepts the following option:
  11453. @table @option
  11454. @item planes
  11455. Set which planes will be processed, unprocessed planes will be copied.
  11456. By default value 0xf, all planes will be processed.
  11457. @item scale
  11458. Set value which will be multiplied with filtered result.
  11459. @item delta
  11460. Set value which will be added to filtered result.
  11461. @end table
  11462. @anchor{spp}
  11463. @section spp
  11464. Apply a simple postprocessing filter that compresses and decompresses the image
  11465. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11466. and average the results.
  11467. The filter accepts the following options:
  11468. @table @option
  11469. @item quality
  11470. Set quality. This option defines the number of levels for averaging. It accepts
  11471. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11472. effect. A value of @code{6} means the higher quality. For each increment of
  11473. that value the speed drops by a factor of approximately 2. Default value is
  11474. @code{3}.
  11475. @item qp
  11476. Force a constant quantization parameter. If not set, the filter will use the QP
  11477. from the video stream (if available).
  11478. @item mode
  11479. Set thresholding mode. Available modes are:
  11480. @table @samp
  11481. @item hard
  11482. Set hard thresholding (default).
  11483. @item soft
  11484. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11485. @end table
  11486. @item use_bframe_qp
  11487. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11488. option may cause flicker since the B-Frames have often larger QP. Default is
  11489. @code{0} (not enabled).
  11490. @end table
  11491. @anchor{subtitles}
  11492. @section subtitles
  11493. Draw subtitles on top of input video using the libass library.
  11494. To enable compilation of this filter you need to configure FFmpeg with
  11495. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11496. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11497. Alpha) subtitles format.
  11498. The filter accepts the following options:
  11499. @table @option
  11500. @item filename, f
  11501. Set the filename of the subtitle file to read. It must be specified.
  11502. @item original_size
  11503. Specify the size of the original video, the video for which the ASS file
  11504. was composed. For the syntax of this option, check the
  11505. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11506. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11507. correctly scale the fonts if the aspect ratio has been changed.
  11508. @item fontsdir
  11509. Set a directory path containing fonts that can be used by the filter.
  11510. These fonts will be used in addition to whatever the font provider uses.
  11511. @item alpha
  11512. Process alpha channel, by default alpha channel is untouched.
  11513. @item charenc
  11514. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11515. useful if not UTF-8.
  11516. @item stream_index, si
  11517. Set subtitles stream index. @code{subtitles} filter only.
  11518. @item force_style
  11519. Override default style or script info parameters of the subtitles. It accepts a
  11520. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11521. @end table
  11522. If the first key is not specified, it is assumed that the first value
  11523. specifies the @option{filename}.
  11524. For example, to render the file @file{sub.srt} on top of the input
  11525. video, use the command:
  11526. @example
  11527. subtitles=sub.srt
  11528. @end example
  11529. which is equivalent to:
  11530. @example
  11531. subtitles=filename=sub.srt
  11532. @end example
  11533. To render the default subtitles stream from file @file{video.mkv}, use:
  11534. @example
  11535. subtitles=video.mkv
  11536. @end example
  11537. To render the second subtitles stream from that file, use:
  11538. @example
  11539. subtitles=video.mkv:si=1
  11540. @end example
  11541. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11542. @code{DejaVu Serif}, use:
  11543. @example
  11544. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11545. @end example
  11546. @section super2xsai
  11547. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11548. Interpolate) pixel art scaling algorithm.
  11549. Useful for enlarging pixel art images without reducing sharpness.
  11550. @section swaprect
  11551. Swap two rectangular objects in video.
  11552. This filter accepts the following options:
  11553. @table @option
  11554. @item w
  11555. Set object width.
  11556. @item h
  11557. Set object height.
  11558. @item x1
  11559. Set 1st rect x coordinate.
  11560. @item y1
  11561. Set 1st rect y coordinate.
  11562. @item x2
  11563. Set 2nd rect x coordinate.
  11564. @item y2
  11565. Set 2nd rect y coordinate.
  11566. All expressions are evaluated once for each frame.
  11567. @end table
  11568. The all options are expressions containing the following constants:
  11569. @table @option
  11570. @item w
  11571. @item h
  11572. The input width and height.
  11573. @item a
  11574. same as @var{w} / @var{h}
  11575. @item sar
  11576. input sample aspect ratio
  11577. @item dar
  11578. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11579. @item n
  11580. The number of the input frame, starting from 0.
  11581. @item t
  11582. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11583. @item pos
  11584. the position in the file of the input frame, NAN if unknown
  11585. @end table
  11586. @section swapuv
  11587. Swap U & V plane.
  11588. @section telecine
  11589. Apply telecine process to the video.
  11590. This filter accepts the following options:
  11591. @table @option
  11592. @item first_field
  11593. @table @samp
  11594. @item top, t
  11595. top field first
  11596. @item bottom, b
  11597. bottom field first
  11598. The default value is @code{top}.
  11599. @end table
  11600. @item pattern
  11601. A string of numbers representing the pulldown pattern you wish to apply.
  11602. The default value is @code{23}.
  11603. @end table
  11604. @example
  11605. Some typical patterns:
  11606. NTSC output (30i):
  11607. 27.5p: 32222
  11608. 24p: 23 (classic)
  11609. 24p: 2332 (preferred)
  11610. 20p: 33
  11611. 18p: 334
  11612. 16p: 3444
  11613. PAL output (25i):
  11614. 27.5p: 12222
  11615. 24p: 222222222223 ("Euro pulldown")
  11616. 16.67p: 33
  11617. 16p: 33333334
  11618. @end example
  11619. @section threshold
  11620. Apply threshold effect to video stream.
  11621. This filter needs four video streams to perform thresholding.
  11622. First stream is stream we are filtering.
  11623. Second stream is holding threshold values, third stream is holding min values,
  11624. and last, fourth stream is holding max values.
  11625. The filter accepts the following option:
  11626. @table @option
  11627. @item planes
  11628. Set which planes will be processed, unprocessed planes will be copied.
  11629. By default value 0xf, all planes will be processed.
  11630. @end table
  11631. For example if first stream pixel's component value is less then threshold value
  11632. of pixel component from 2nd threshold stream, third stream value will picked,
  11633. otherwise fourth stream pixel component value will be picked.
  11634. Using color source filter one can perform various types of thresholding:
  11635. @subsection Examples
  11636. @itemize
  11637. @item
  11638. Binary threshold, using gray color as threshold:
  11639. @example
  11640. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11641. @end example
  11642. @item
  11643. Inverted binary threshold, using gray color as threshold:
  11644. @example
  11645. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11646. @end example
  11647. @item
  11648. Truncate binary threshold, using gray color as threshold:
  11649. @example
  11650. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11651. @end example
  11652. @item
  11653. Threshold to zero, using gray color as threshold:
  11654. @example
  11655. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11656. @end example
  11657. @item
  11658. Inverted threshold to zero, using gray color as threshold:
  11659. @example
  11660. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11661. @end example
  11662. @end itemize
  11663. @section thumbnail
  11664. Select the most representative frame in a given sequence of consecutive frames.
  11665. The filter accepts the following options:
  11666. @table @option
  11667. @item n
  11668. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11669. will pick one of them, and then handle the next batch of @var{n} frames until
  11670. the end. Default is @code{100}.
  11671. @end table
  11672. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11673. value will result in a higher memory usage, so a high value is not recommended.
  11674. @subsection Examples
  11675. @itemize
  11676. @item
  11677. Extract one picture each 50 frames:
  11678. @example
  11679. thumbnail=50
  11680. @end example
  11681. @item
  11682. Complete example of a thumbnail creation with @command{ffmpeg}:
  11683. @example
  11684. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11685. @end example
  11686. @end itemize
  11687. @section tile
  11688. Tile several successive frames together.
  11689. The filter accepts the following options:
  11690. @table @option
  11691. @item layout
  11692. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11693. this option, check the
  11694. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11695. @item nb_frames
  11696. Set the maximum number of frames to render in the given area. It must be less
  11697. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11698. the area will be used.
  11699. @item margin
  11700. Set the outer border margin in pixels.
  11701. @item padding
  11702. Set the inner border thickness (i.e. the number of pixels between frames). For
  11703. more advanced padding options (such as having different values for the edges),
  11704. refer to the pad video filter.
  11705. @item color
  11706. Specify the color of the unused area. For the syntax of this option, check the
  11707. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11708. The default value of @var{color} is "black".
  11709. @item overlap
  11710. Set the number of frames to overlap when tiling several successive frames together.
  11711. The value must be between @code{0} and @var{nb_frames - 1}.
  11712. @item init_padding
  11713. Set the number of frames to initially be empty before displaying first output frame.
  11714. This controls how soon will one get first output frame.
  11715. The value must be between @code{0} and @var{nb_frames - 1}.
  11716. @end table
  11717. @subsection Examples
  11718. @itemize
  11719. @item
  11720. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11721. @example
  11722. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11723. @end example
  11724. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11725. duplicating each output frame to accommodate the originally detected frame
  11726. rate.
  11727. @item
  11728. Display @code{5} pictures in an area of @code{3x2} frames,
  11729. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11730. mixed flat and named options:
  11731. @example
  11732. tile=3x2:nb_frames=5:padding=7:margin=2
  11733. @end example
  11734. @end itemize
  11735. @section tinterlace
  11736. Perform various types of temporal field interlacing.
  11737. Frames are counted starting from 1, so the first input frame is
  11738. considered odd.
  11739. The filter accepts the following options:
  11740. @table @option
  11741. @item mode
  11742. Specify the mode of the interlacing. This option can also be specified
  11743. as a value alone. See below for a list of values for this option.
  11744. Available values are:
  11745. @table @samp
  11746. @item merge, 0
  11747. Move odd frames into the upper field, even into the lower field,
  11748. generating a double height frame at half frame rate.
  11749. @example
  11750. ------> time
  11751. Input:
  11752. Frame 1 Frame 2 Frame 3 Frame 4
  11753. 11111 22222 33333 44444
  11754. 11111 22222 33333 44444
  11755. 11111 22222 33333 44444
  11756. 11111 22222 33333 44444
  11757. Output:
  11758. 11111 33333
  11759. 22222 44444
  11760. 11111 33333
  11761. 22222 44444
  11762. 11111 33333
  11763. 22222 44444
  11764. 11111 33333
  11765. 22222 44444
  11766. @end example
  11767. @item drop_even, 1
  11768. Only output odd frames, even frames are dropped, generating a frame with
  11769. unchanged height at half frame rate.
  11770. @example
  11771. ------> time
  11772. Input:
  11773. Frame 1 Frame 2 Frame 3 Frame 4
  11774. 11111 22222 33333 44444
  11775. 11111 22222 33333 44444
  11776. 11111 22222 33333 44444
  11777. 11111 22222 33333 44444
  11778. Output:
  11779. 11111 33333
  11780. 11111 33333
  11781. 11111 33333
  11782. 11111 33333
  11783. @end example
  11784. @item drop_odd, 2
  11785. Only output even frames, odd frames are dropped, generating a frame with
  11786. unchanged height at half frame rate.
  11787. @example
  11788. ------> time
  11789. Input:
  11790. Frame 1 Frame 2 Frame 3 Frame 4
  11791. 11111 22222 33333 44444
  11792. 11111 22222 33333 44444
  11793. 11111 22222 33333 44444
  11794. 11111 22222 33333 44444
  11795. Output:
  11796. 22222 44444
  11797. 22222 44444
  11798. 22222 44444
  11799. 22222 44444
  11800. @end example
  11801. @item pad, 3
  11802. Expand each frame to full height, but pad alternate lines with black,
  11803. generating a frame with double height at the same input frame rate.
  11804. @example
  11805. ------> time
  11806. Input:
  11807. Frame 1 Frame 2 Frame 3 Frame 4
  11808. 11111 22222 33333 44444
  11809. 11111 22222 33333 44444
  11810. 11111 22222 33333 44444
  11811. 11111 22222 33333 44444
  11812. Output:
  11813. 11111 ..... 33333 .....
  11814. ..... 22222 ..... 44444
  11815. 11111 ..... 33333 .....
  11816. ..... 22222 ..... 44444
  11817. 11111 ..... 33333 .....
  11818. ..... 22222 ..... 44444
  11819. 11111 ..... 33333 .....
  11820. ..... 22222 ..... 44444
  11821. @end example
  11822. @item interleave_top, 4
  11823. Interleave the upper field from odd frames with the lower field from
  11824. even frames, generating a frame with unchanged height at half frame rate.
  11825. @example
  11826. ------> time
  11827. Input:
  11828. Frame 1 Frame 2 Frame 3 Frame 4
  11829. 11111<- 22222 33333<- 44444
  11830. 11111 22222<- 33333 44444<-
  11831. 11111<- 22222 33333<- 44444
  11832. 11111 22222<- 33333 44444<-
  11833. Output:
  11834. 11111 33333
  11835. 22222 44444
  11836. 11111 33333
  11837. 22222 44444
  11838. @end example
  11839. @item interleave_bottom, 5
  11840. Interleave the lower field from odd frames with the upper field from
  11841. even frames, generating a frame with unchanged height at half frame rate.
  11842. @example
  11843. ------> time
  11844. Input:
  11845. Frame 1 Frame 2 Frame 3 Frame 4
  11846. 11111 22222<- 33333 44444<-
  11847. 11111<- 22222 33333<- 44444
  11848. 11111 22222<- 33333 44444<-
  11849. 11111<- 22222 33333<- 44444
  11850. Output:
  11851. 22222 44444
  11852. 11111 33333
  11853. 22222 44444
  11854. 11111 33333
  11855. @end example
  11856. @item interlacex2, 6
  11857. Double frame rate with unchanged height. Frames are inserted each
  11858. containing the second temporal field from the previous input frame and
  11859. the first temporal field from the next input frame. This mode relies on
  11860. the top_field_first flag. Useful for interlaced video displays with no
  11861. field synchronisation.
  11862. @example
  11863. ------> time
  11864. Input:
  11865. Frame 1 Frame 2 Frame 3 Frame 4
  11866. 11111 22222 33333 44444
  11867. 11111 22222 33333 44444
  11868. 11111 22222 33333 44444
  11869. 11111 22222 33333 44444
  11870. Output:
  11871. 11111 22222 22222 33333 33333 44444 44444
  11872. 11111 11111 22222 22222 33333 33333 44444
  11873. 11111 22222 22222 33333 33333 44444 44444
  11874. 11111 11111 22222 22222 33333 33333 44444
  11875. @end example
  11876. @item mergex2, 7
  11877. Move odd frames into the upper field, even into the lower field,
  11878. generating a double height frame at same frame rate.
  11879. @example
  11880. ------> time
  11881. Input:
  11882. Frame 1 Frame 2 Frame 3 Frame 4
  11883. 11111 22222 33333 44444
  11884. 11111 22222 33333 44444
  11885. 11111 22222 33333 44444
  11886. 11111 22222 33333 44444
  11887. Output:
  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. 11111 33333 33333 55555
  11895. 22222 22222 44444 44444
  11896. @end example
  11897. @end table
  11898. Numeric values are deprecated but are accepted for backward
  11899. compatibility reasons.
  11900. Default mode is @code{merge}.
  11901. @item flags
  11902. Specify flags influencing the filter process.
  11903. Available value for @var{flags} is:
  11904. @table @option
  11905. @item low_pass_filter, vlfp
  11906. Enable linear vertical low-pass filtering in the filter.
  11907. Vertical low-pass filtering is required when creating an interlaced
  11908. destination from a progressive source which contains high-frequency
  11909. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11910. patterning.
  11911. @item complex_filter, cvlfp
  11912. Enable complex vertical low-pass filtering.
  11913. This will slightly less reduce interlace 'twitter' and Moire
  11914. patterning but better retain detail and subjective sharpness impression.
  11915. @end table
  11916. Vertical low-pass filtering can only be enabled for @option{mode}
  11917. @var{interleave_top} and @var{interleave_bottom}.
  11918. @end table
  11919. @section tmix
  11920. Mix successive video frames.
  11921. A description of the accepted options follows.
  11922. @table @option
  11923. @item frames
  11924. The number of successive frames to mix. If unspecified, it defaults to 3.
  11925. @item weights
  11926. Specify weight of each input video frame.
  11927. Each weight is separated by space. If number of weights is smaller than
  11928. number of @var{frames} last specified weight will be used for all remaining
  11929. unset weights.
  11930. @item scale
  11931. Specify scale, if it is set it will be multiplied with sum
  11932. of each weight multiplied with pixel values to give final destination
  11933. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11934. @end table
  11935. @subsection Examples
  11936. @itemize
  11937. @item
  11938. Average 7 successive frames:
  11939. @example
  11940. tmix=frames=7:weights="1 1 1 1 1 1 1"
  11941. @end example
  11942. @item
  11943. Apply simple temporal convolution:
  11944. @example
  11945. tmix=frames=3:weights="-1 3 -1"
  11946. @end example
  11947. @item
  11948. Similar as above but only showing temporal differences:
  11949. @example
  11950. tmix=frames=3:weights="-1 2 -1":scale=1
  11951. @end example
  11952. @end itemize
  11953. @section tonemap
  11954. Tone map colors from different dynamic ranges.
  11955. This filter expects data in single precision floating point, as it needs to
  11956. operate on (and can output) out-of-range values. Another filter, such as
  11957. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11958. The tonemapping algorithms implemented only work on linear light, so input
  11959. data should be linearized beforehand (and possibly correctly tagged).
  11960. @example
  11961. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11962. @end example
  11963. @subsection Options
  11964. The filter accepts the following options.
  11965. @table @option
  11966. @item tonemap
  11967. Set the tone map algorithm to use.
  11968. Possible values are:
  11969. @table @var
  11970. @item none
  11971. Do not apply any tone map, only desaturate overbright pixels.
  11972. @item clip
  11973. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11974. in-range values, while distorting out-of-range values.
  11975. @item linear
  11976. Stretch the entire reference gamut to a linear multiple of the display.
  11977. @item gamma
  11978. Fit a logarithmic transfer between the tone curves.
  11979. @item reinhard
  11980. Preserve overall image brightness with a simple curve, using nonlinear
  11981. contrast, which results in flattening details and degrading color accuracy.
  11982. @item hable
  11983. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11984. of slightly darkening everything. Use it when detail preservation is more
  11985. important than color and brightness accuracy.
  11986. @item mobius
  11987. Smoothly map out-of-range values, while retaining contrast and colors for
  11988. in-range material as much as possible. Use it when color accuracy is more
  11989. important than detail preservation.
  11990. @end table
  11991. Default is none.
  11992. @item param
  11993. Tune the tone mapping algorithm.
  11994. This affects the following algorithms:
  11995. @table @var
  11996. @item none
  11997. Ignored.
  11998. @item linear
  11999. Specifies the scale factor to use while stretching.
  12000. Default to 1.0.
  12001. @item gamma
  12002. Specifies the exponent of the function.
  12003. Default to 1.8.
  12004. @item clip
  12005. Specify an extra linear coefficient to multiply into the signal before clipping.
  12006. Default to 1.0.
  12007. @item reinhard
  12008. Specify the local contrast coefficient at the display peak.
  12009. Default to 0.5, which means that in-gamut values will be about half as bright
  12010. as when clipping.
  12011. @item hable
  12012. Ignored.
  12013. @item mobius
  12014. Specify the transition point from linear to mobius transform. Every value
  12015. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12016. more accurate the result will be, at the cost of losing bright details.
  12017. Default to 0.3, which due to the steep initial slope still preserves in-range
  12018. colors fairly accurately.
  12019. @end table
  12020. @item desat
  12021. Apply desaturation for highlights that exceed this level of brightness. The
  12022. higher the parameter, the more color information will be preserved. This
  12023. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12024. (smoothly) turning into white instead. This makes images feel more natural,
  12025. at the cost of reducing information about out-of-range colors.
  12026. The default of 2.0 is somewhat conservative and will mostly just apply to
  12027. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12028. This option works only if the input frame has a supported color tag.
  12029. @item peak
  12030. Override signal/nominal/reference peak with this value. Useful when the
  12031. embedded peak information in display metadata is not reliable or when tone
  12032. mapping from a lower range to a higher range.
  12033. @end table
  12034. @section transpose
  12035. Transpose rows with columns in the input video and optionally flip it.
  12036. It accepts the following parameters:
  12037. @table @option
  12038. @item dir
  12039. Specify the transposition direction.
  12040. Can assume the following values:
  12041. @table @samp
  12042. @item 0, 4, cclock_flip
  12043. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12044. @example
  12045. L.R L.l
  12046. . . -> . .
  12047. l.r R.r
  12048. @end example
  12049. @item 1, 5, clock
  12050. Rotate by 90 degrees clockwise, that is:
  12051. @example
  12052. L.R l.L
  12053. . . -> . .
  12054. l.r r.R
  12055. @end example
  12056. @item 2, 6, cclock
  12057. Rotate by 90 degrees counterclockwise, that is:
  12058. @example
  12059. L.R R.r
  12060. . . -> . .
  12061. l.r L.l
  12062. @end example
  12063. @item 3, 7, clock_flip
  12064. Rotate by 90 degrees clockwise and vertically flip, that is:
  12065. @example
  12066. L.R r.R
  12067. . . -> . .
  12068. l.r l.L
  12069. @end example
  12070. @end table
  12071. For values between 4-7, the transposition is only done if the input
  12072. video geometry is portrait and not landscape. These values are
  12073. deprecated, the @code{passthrough} option should be used instead.
  12074. Numerical values are deprecated, and should be dropped in favor of
  12075. symbolic constants.
  12076. @item passthrough
  12077. Do not apply the transposition if the input geometry matches the one
  12078. specified by the specified value. It accepts the following values:
  12079. @table @samp
  12080. @item none
  12081. Always apply transposition.
  12082. @item portrait
  12083. Preserve portrait geometry (when @var{height} >= @var{width}).
  12084. @item landscape
  12085. Preserve landscape geometry (when @var{width} >= @var{height}).
  12086. @end table
  12087. Default value is @code{none}.
  12088. @end table
  12089. For example to rotate by 90 degrees clockwise and preserve portrait
  12090. layout:
  12091. @example
  12092. transpose=dir=1:passthrough=portrait
  12093. @end example
  12094. The command above can also be specified as:
  12095. @example
  12096. transpose=1:portrait
  12097. @end example
  12098. @section trim
  12099. Trim the input so that the output contains one continuous subpart of the input.
  12100. It accepts the following parameters:
  12101. @table @option
  12102. @item start
  12103. Specify the time of the start of the kept section, i.e. the frame with the
  12104. timestamp @var{start} will be the first frame in the output.
  12105. @item end
  12106. Specify the time of the first frame that will be dropped, i.e. the frame
  12107. immediately preceding the one with the timestamp @var{end} will be the last
  12108. frame in the output.
  12109. @item start_pts
  12110. This is the same as @var{start}, except this option sets the start timestamp
  12111. in timebase units instead of seconds.
  12112. @item end_pts
  12113. This is the same as @var{end}, except this option sets the end timestamp
  12114. in timebase units instead of seconds.
  12115. @item duration
  12116. The maximum duration of the output in seconds.
  12117. @item start_frame
  12118. The number of the first frame that should be passed to the output.
  12119. @item end_frame
  12120. The number of the first frame that should be dropped.
  12121. @end table
  12122. @option{start}, @option{end}, and @option{duration} are expressed as time
  12123. duration specifications; see
  12124. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12125. for the accepted syntax.
  12126. Note that the first two sets of the start/end options and the @option{duration}
  12127. option look at the frame timestamp, while the _frame variants simply count the
  12128. frames that pass through the filter. Also note that this filter does not modify
  12129. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12130. setpts filter after the trim filter.
  12131. If multiple start or end options are set, this filter tries to be greedy and
  12132. keep all the frames that match at least one of the specified constraints. To keep
  12133. only the part that matches all the constraints at once, chain multiple trim
  12134. filters.
  12135. The defaults are such that all the input is kept. So it is possible to set e.g.
  12136. just the end values to keep everything before the specified time.
  12137. Examples:
  12138. @itemize
  12139. @item
  12140. Drop everything except the second minute of input:
  12141. @example
  12142. ffmpeg -i INPUT -vf trim=60:120
  12143. @end example
  12144. @item
  12145. Keep only the first second:
  12146. @example
  12147. ffmpeg -i INPUT -vf trim=duration=1
  12148. @end example
  12149. @end itemize
  12150. @section unpremultiply
  12151. Apply alpha unpremultiply effect to input video stream using first plane
  12152. of second stream as alpha.
  12153. Both streams must have same dimensions and same pixel format.
  12154. The filter accepts the following option:
  12155. @table @option
  12156. @item planes
  12157. Set which planes will be processed, unprocessed planes will be copied.
  12158. By default value 0xf, all planes will be processed.
  12159. If the format has 1 or 2 components, then luma is bit 0.
  12160. If the format has 3 or 4 components:
  12161. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12162. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12163. If present, the alpha channel is always the last bit.
  12164. @item inplace
  12165. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12166. @end table
  12167. @anchor{unsharp}
  12168. @section unsharp
  12169. Sharpen or blur the input video.
  12170. It accepts the following parameters:
  12171. @table @option
  12172. @item luma_msize_x, lx
  12173. Set the luma matrix horizontal size. It must be an odd integer between
  12174. 3 and 23. The default value is 5.
  12175. @item luma_msize_y, ly
  12176. Set the luma matrix vertical size. It must be an odd integer between 3
  12177. and 23. The default value is 5.
  12178. @item luma_amount, la
  12179. Set the luma effect strength. It must be a floating point number, reasonable
  12180. values lay between -1.5 and 1.5.
  12181. Negative values will blur the input video, while positive values will
  12182. sharpen it, a value of zero will disable the effect.
  12183. Default value is 1.0.
  12184. @item chroma_msize_x, cx
  12185. Set the chroma matrix horizontal size. It must be an odd integer
  12186. between 3 and 23. The default value is 5.
  12187. @item chroma_msize_y, cy
  12188. Set the chroma matrix vertical size. It must be an odd integer
  12189. between 3 and 23. The default value is 5.
  12190. @item chroma_amount, ca
  12191. Set the chroma effect strength. It must be a floating point number, reasonable
  12192. values lay between -1.5 and 1.5.
  12193. Negative values will blur the input video, while positive values will
  12194. sharpen it, a value of zero will disable the effect.
  12195. Default value is 0.0.
  12196. @end table
  12197. All parameters are optional and default to the equivalent of the
  12198. string '5:5:1.0:5:5:0.0'.
  12199. @subsection Examples
  12200. @itemize
  12201. @item
  12202. Apply strong luma sharpen effect:
  12203. @example
  12204. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12205. @end example
  12206. @item
  12207. Apply a strong blur of both luma and chroma parameters:
  12208. @example
  12209. unsharp=7:7:-2:7:7:-2
  12210. @end example
  12211. @end itemize
  12212. @section uspp
  12213. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12214. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12215. shifts and average the results.
  12216. The way this differs from the behavior of spp is that uspp actually encodes &
  12217. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12218. DCT similar to MJPEG.
  12219. The filter accepts the following options:
  12220. @table @option
  12221. @item quality
  12222. Set quality. This option defines the number of levels for averaging. It accepts
  12223. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12224. effect. A value of @code{8} means the higher quality. For each increment of
  12225. that value the speed drops by a factor of approximately 2. Default value is
  12226. @code{3}.
  12227. @item qp
  12228. Force a constant quantization parameter. If not set, the filter will use the QP
  12229. from the video stream (if available).
  12230. @end table
  12231. @section vaguedenoiser
  12232. Apply a wavelet based denoiser.
  12233. It transforms each frame from the video input into the wavelet domain,
  12234. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12235. the obtained coefficients. It does an inverse wavelet transform after.
  12236. Due to wavelet properties, it should give a nice smoothed result, and
  12237. reduced noise, without blurring picture features.
  12238. This filter accepts the following options:
  12239. @table @option
  12240. @item threshold
  12241. The filtering strength. The higher, the more filtered the video will be.
  12242. Hard thresholding can use a higher threshold than soft thresholding
  12243. before the video looks overfiltered. Default value is 2.
  12244. @item method
  12245. The filtering method the filter will use.
  12246. It accepts the following values:
  12247. @table @samp
  12248. @item hard
  12249. All values under the threshold will be zeroed.
  12250. @item soft
  12251. All values under the threshold will be zeroed. All values above will be
  12252. reduced by the threshold.
  12253. @item garrote
  12254. Scales or nullifies coefficients - intermediary between (more) soft and
  12255. (less) hard thresholding.
  12256. @end table
  12257. Default is garrote.
  12258. @item nsteps
  12259. Number of times, the wavelet will decompose the picture. Picture can't
  12260. be decomposed beyond a particular point (typically, 8 for a 640x480
  12261. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12262. @item percent
  12263. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12264. @item planes
  12265. A list of the planes to process. By default all planes are processed.
  12266. @end table
  12267. @section vectorscope
  12268. Display 2 color component values in the two dimensional graph (which is called
  12269. a vectorscope).
  12270. This filter accepts the following options:
  12271. @table @option
  12272. @item mode, m
  12273. Set vectorscope mode.
  12274. It accepts the following values:
  12275. @table @samp
  12276. @item gray
  12277. Gray values are displayed on graph, higher brightness means more pixels have
  12278. same component color value on location in graph. This is the default mode.
  12279. @item color
  12280. Gray values are displayed on graph. Surrounding pixels values which are not
  12281. present in video frame are drawn in gradient of 2 color components which are
  12282. set by option @code{x} and @code{y}. The 3rd color component is static.
  12283. @item color2
  12284. Actual color components values present in video frame are displayed on graph.
  12285. @item color3
  12286. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12287. on graph increases value of another color component, which is luminance by
  12288. default values of @code{x} and @code{y}.
  12289. @item color4
  12290. Actual colors present in video frame are displayed on graph. If two different
  12291. colors map to same position on graph then color with higher value of component
  12292. not present in graph is picked.
  12293. @item color5
  12294. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12295. component picked from radial gradient.
  12296. @end table
  12297. @item x
  12298. Set which color component will be represented on X-axis. Default is @code{1}.
  12299. @item y
  12300. Set which color component will be represented on Y-axis. Default is @code{2}.
  12301. @item intensity, i
  12302. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12303. of color component which represents frequency of (X, Y) location in graph.
  12304. @item envelope, e
  12305. @table @samp
  12306. @item none
  12307. No envelope, this is default.
  12308. @item instant
  12309. Instant envelope, even darkest single pixel will be clearly highlighted.
  12310. @item peak
  12311. Hold maximum and minimum values presented in graph over time. This way you
  12312. can still spot out of range values without constantly looking at vectorscope.
  12313. @item peak+instant
  12314. Peak and instant envelope combined together.
  12315. @end table
  12316. @item graticule, g
  12317. Set what kind of graticule to draw.
  12318. @table @samp
  12319. @item none
  12320. @item green
  12321. @item color
  12322. @end table
  12323. @item opacity, o
  12324. Set graticule opacity.
  12325. @item flags, f
  12326. Set graticule flags.
  12327. @table @samp
  12328. @item white
  12329. Draw graticule for white point.
  12330. @item black
  12331. Draw graticule for black point.
  12332. @item name
  12333. Draw color points short names.
  12334. @end table
  12335. @item bgopacity, b
  12336. Set background opacity.
  12337. @item lthreshold, l
  12338. Set low threshold for color component not represented on X or Y axis.
  12339. Values lower than this value will be ignored. Default is 0.
  12340. Note this value is multiplied with actual max possible value one pixel component
  12341. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12342. is 0.1 * 255 = 25.
  12343. @item hthreshold, h
  12344. Set high threshold for color component not represented on X or Y axis.
  12345. Values higher than this value will be ignored. Default is 1.
  12346. Note this value is multiplied with actual max possible value one pixel component
  12347. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12348. is 0.9 * 255 = 230.
  12349. @item colorspace, c
  12350. Set what kind of colorspace to use when drawing graticule.
  12351. @table @samp
  12352. @item auto
  12353. @item 601
  12354. @item 709
  12355. @end table
  12356. Default is auto.
  12357. @end table
  12358. @anchor{vidstabdetect}
  12359. @section vidstabdetect
  12360. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12361. @ref{vidstabtransform} for pass 2.
  12362. This filter generates a file with relative translation and rotation
  12363. transform information about subsequent frames, which is then used by
  12364. the @ref{vidstabtransform} filter.
  12365. To enable compilation of this filter you need to configure FFmpeg with
  12366. @code{--enable-libvidstab}.
  12367. This filter accepts the following options:
  12368. @table @option
  12369. @item result
  12370. Set the path to the file used to write the transforms information.
  12371. Default value is @file{transforms.trf}.
  12372. @item shakiness
  12373. Set how shaky the video is and how quick the camera is. It accepts an
  12374. integer in the range 1-10, a value of 1 means little shakiness, a
  12375. value of 10 means strong shakiness. Default value is 5.
  12376. @item accuracy
  12377. Set the accuracy of the detection process. It must be a value in the
  12378. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12379. accuracy. Default value is 15.
  12380. @item stepsize
  12381. Set stepsize of the search process. The region around minimum is
  12382. scanned with 1 pixel resolution. Default value is 6.
  12383. @item mincontrast
  12384. Set minimum contrast. Below this value a local measurement field is
  12385. discarded. Must be a floating point value in the range 0-1. Default
  12386. value is 0.3.
  12387. @item tripod
  12388. Set reference frame number for tripod mode.
  12389. If enabled, the motion of the frames is compared to a reference frame
  12390. in the filtered stream, identified by the specified number. The idea
  12391. is to compensate all movements in a more-or-less static scene and keep
  12392. the camera view absolutely still.
  12393. If set to 0, it is disabled. The frames are counted starting from 1.
  12394. @item show
  12395. Show fields and transforms in the resulting frames. It accepts an
  12396. integer in the range 0-2. Default value is 0, which disables any
  12397. visualization.
  12398. @end table
  12399. @subsection Examples
  12400. @itemize
  12401. @item
  12402. Use default values:
  12403. @example
  12404. vidstabdetect
  12405. @end example
  12406. @item
  12407. Analyze strongly shaky movie and put the results in file
  12408. @file{mytransforms.trf}:
  12409. @example
  12410. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12411. @end example
  12412. @item
  12413. Visualize the result of internal transformations in the resulting
  12414. video:
  12415. @example
  12416. vidstabdetect=show=1
  12417. @end example
  12418. @item
  12419. Analyze a video with medium shakiness using @command{ffmpeg}:
  12420. @example
  12421. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12422. @end example
  12423. @end itemize
  12424. @anchor{vidstabtransform}
  12425. @section vidstabtransform
  12426. Video stabilization/deshaking: pass 2 of 2,
  12427. see @ref{vidstabdetect} for pass 1.
  12428. Read a file with transform information for each frame and
  12429. apply/compensate them. Together with the @ref{vidstabdetect}
  12430. filter this can be used to deshake videos. See also
  12431. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12432. the @ref{unsharp} filter, see below.
  12433. To enable compilation of this filter you need to configure FFmpeg with
  12434. @code{--enable-libvidstab}.
  12435. @subsection Options
  12436. @table @option
  12437. @item input
  12438. Set path to the file used to read the transforms. Default value is
  12439. @file{transforms.trf}.
  12440. @item smoothing
  12441. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12442. camera movements. Default value is 10.
  12443. For example a number of 10 means that 21 frames are used (10 in the
  12444. past and 10 in the future) to smoothen the motion in the video. A
  12445. larger value leads to a smoother video, but limits the acceleration of
  12446. the camera (pan/tilt movements). 0 is a special case where a static
  12447. camera is simulated.
  12448. @item optalgo
  12449. Set the camera path optimization algorithm.
  12450. Accepted values are:
  12451. @table @samp
  12452. @item gauss
  12453. gaussian kernel low-pass filter on camera motion (default)
  12454. @item avg
  12455. averaging on transformations
  12456. @end table
  12457. @item maxshift
  12458. Set maximal number of pixels to translate frames. Default value is -1,
  12459. meaning no limit.
  12460. @item maxangle
  12461. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12462. value is -1, meaning no limit.
  12463. @item crop
  12464. Specify how to deal with borders that may be visible due to movement
  12465. compensation.
  12466. Available values are:
  12467. @table @samp
  12468. @item keep
  12469. keep image information from previous frame (default)
  12470. @item black
  12471. fill the border black
  12472. @end table
  12473. @item invert
  12474. Invert transforms if set to 1. Default value is 0.
  12475. @item relative
  12476. Consider transforms as relative to previous frame if set to 1,
  12477. absolute if set to 0. Default value is 0.
  12478. @item zoom
  12479. Set percentage to zoom. A positive value will result in a zoom-in
  12480. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12481. zoom).
  12482. @item optzoom
  12483. Set optimal zooming to avoid borders.
  12484. Accepted values are:
  12485. @table @samp
  12486. @item 0
  12487. disabled
  12488. @item 1
  12489. optimal static zoom value is determined (only very strong movements
  12490. will lead to visible borders) (default)
  12491. @item 2
  12492. optimal adaptive zoom value is determined (no borders will be
  12493. visible), see @option{zoomspeed}
  12494. @end table
  12495. Note that the value given at zoom is added to the one calculated here.
  12496. @item zoomspeed
  12497. Set percent to zoom maximally each frame (enabled when
  12498. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12499. 0.25.
  12500. @item interpol
  12501. Specify type of interpolation.
  12502. Available values are:
  12503. @table @samp
  12504. @item no
  12505. no interpolation
  12506. @item linear
  12507. linear only horizontal
  12508. @item bilinear
  12509. linear in both directions (default)
  12510. @item bicubic
  12511. cubic in both directions (slow)
  12512. @end table
  12513. @item tripod
  12514. Enable virtual tripod mode if set to 1, which is equivalent to
  12515. @code{relative=0:smoothing=0}. Default value is 0.
  12516. Use also @code{tripod} option of @ref{vidstabdetect}.
  12517. @item debug
  12518. Increase log verbosity if set to 1. Also the detected global motions
  12519. are written to the temporary file @file{global_motions.trf}. Default
  12520. value is 0.
  12521. @end table
  12522. @subsection Examples
  12523. @itemize
  12524. @item
  12525. Use @command{ffmpeg} for a typical stabilization with default values:
  12526. @example
  12527. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12528. @end example
  12529. Note the use of the @ref{unsharp} filter which is always recommended.
  12530. @item
  12531. Zoom in a bit more and load transform data from a given file:
  12532. @example
  12533. vidstabtransform=zoom=5:input="mytransforms.trf"
  12534. @end example
  12535. @item
  12536. Smoothen the video even more:
  12537. @example
  12538. vidstabtransform=smoothing=30
  12539. @end example
  12540. @end itemize
  12541. @section vflip
  12542. Flip the input video vertically.
  12543. For example, to vertically flip a video with @command{ffmpeg}:
  12544. @example
  12545. ffmpeg -i in.avi -vf "vflip" out.avi
  12546. @end example
  12547. @section vfrdet
  12548. Detect variable frame rate video.
  12549. This filter tries to detect if the input is variable or constant frame rate.
  12550. At end it will output number of frames detected as having variable delta pts,
  12551. and ones with constant delta pts.
  12552. If there was frames with variable delta, than it will also show min and max delta
  12553. encountered.
  12554. @anchor{vignette}
  12555. @section vignette
  12556. Make or reverse a natural vignetting effect.
  12557. The filter accepts the following options:
  12558. @table @option
  12559. @item angle, a
  12560. Set lens angle expression as a number of radians.
  12561. The value is clipped in the @code{[0,PI/2]} range.
  12562. Default value: @code{"PI/5"}
  12563. @item x0
  12564. @item y0
  12565. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12566. by default.
  12567. @item mode
  12568. Set forward/backward mode.
  12569. Available modes are:
  12570. @table @samp
  12571. @item forward
  12572. The larger the distance from the central point, the darker the image becomes.
  12573. @item backward
  12574. The larger the distance from the central point, the brighter the image becomes.
  12575. This can be used to reverse a vignette effect, though there is no automatic
  12576. detection to extract the lens @option{angle} and other settings (yet). It can
  12577. also be used to create a burning effect.
  12578. @end table
  12579. Default value is @samp{forward}.
  12580. @item eval
  12581. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12582. It accepts the following values:
  12583. @table @samp
  12584. @item init
  12585. Evaluate expressions only once during the filter initialization.
  12586. @item frame
  12587. Evaluate expressions for each incoming frame. This is way slower than the
  12588. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12589. allows advanced dynamic expressions.
  12590. @end table
  12591. Default value is @samp{init}.
  12592. @item dither
  12593. Set dithering to reduce the circular banding effects. Default is @code{1}
  12594. (enabled).
  12595. @item aspect
  12596. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12597. Setting this value to the SAR of the input will make a rectangular vignetting
  12598. following the dimensions of the video.
  12599. Default is @code{1/1}.
  12600. @end table
  12601. @subsection Expressions
  12602. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12603. following parameters.
  12604. @table @option
  12605. @item w
  12606. @item h
  12607. input width and height
  12608. @item n
  12609. the number of input frame, starting from 0
  12610. @item pts
  12611. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12612. @var{TB} units, NAN if undefined
  12613. @item r
  12614. frame rate of the input video, NAN if the input frame rate is unknown
  12615. @item t
  12616. the PTS (Presentation TimeStamp) of the filtered video frame,
  12617. expressed in seconds, NAN if undefined
  12618. @item tb
  12619. time base of the input video
  12620. @end table
  12621. @subsection Examples
  12622. @itemize
  12623. @item
  12624. Apply simple strong vignetting effect:
  12625. @example
  12626. vignette=PI/4
  12627. @end example
  12628. @item
  12629. Make a flickering vignetting:
  12630. @example
  12631. vignette='PI/4+random(1)*PI/50':eval=frame
  12632. @end example
  12633. @end itemize
  12634. @section vmafmotion
  12635. Obtain the average vmaf motion score of a video.
  12636. It is one of the component filters of VMAF.
  12637. The obtained average motion score is printed through the logging system.
  12638. In the below example the input file @file{ref.mpg} is being processed and score
  12639. is computed.
  12640. @example
  12641. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12642. @end example
  12643. @section vstack
  12644. Stack input videos vertically.
  12645. All streams must be of same pixel format and of same width.
  12646. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12647. to create same output.
  12648. The filter accept the following option:
  12649. @table @option
  12650. @item inputs
  12651. Set number of input streams. Default is 2.
  12652. @item shortest
  12653. If set to 1, force the output to terminate when the shortest input
  12654. terminates. Default value is 0.
  12655. @end table
  12656. @section w3fdif
  12657. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12658. Deinterlacing Filter").
  12659. Based on the process described by Martin Weston for BBC R&D, and
  12660. implemented based on the de-interlace algorithm written by Jim
  12661. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12662. uses filter coefficients calculated by BBC R&D.
  12663. There are two sets of filter coefficients, so called "simple":
  12664. and "complex". Which set of filter coefficients is used can
  12665. be set by passing an optional parameter:
  12666. @table @option
  12667. @item filter
  12668. Set the interlacing filter coefficients. Accepts one of the following values:
  12669. @table @samp
  12670. @item simple
  12671. Simple filter coefficient set.
  12672. @item complex
  12673. More-complex filter coefficient set.
  12674. @end table
  12675. Default value is @samp{complex}.
  12676. @item deint
  12677. Specify which frames to deinterlace. Accept one of the following values:
  12678. @table @samp
  12679. @item all
  12680. Deinterlace all frames,
  12681. @item interlaced
  12682. Only deinterlace frames marked as interlaced.
  12683. @end table
  12684. Default value is @samp{all}.
  12685. @end table
  12686. @section waveform
  12687. Video waveform monitor.
  12688. The waveform monitor plots color component intensity. By default luminance
  12689. only. Each column of the waveform corresponds to a column of pixels in the
  12690. source video.
  12691. It accepts the following options:
  12692. @table @option
  12693. @item mode, m
  12694. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12695. In row mode, the graph on the left side represents color component value 0 and
  12696. the right side represents value = 255. In column mode, the top side represents
  12697. color component value = 0 and bottom side represents value = 255.
  12698. @item intensity, i
  12699. Set intensity. Smaller values are useful to find out how many values of the same
  12700. luminance are distributed across input rows/columns.
  12701. Default value is @code{0.04}. Allowed range is [0, 1].
  12702. @item mirror, r
  12703. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12704. In mirrored mode, higher values will be represented on the left
  12705. side for @code{row} mode and at the top for @code{column} mode. Default is
  12706. @code{1} (mirrored).
  12707. @item display, d
  12708. Set display mode.
  12709. It accepts the following values:
  12710. @table @samp
  12711. @item overlay
  12712. Presents information identical to that in the @code{parade}, except
  12713. that the graphs representing color components are superimposed directly
  12714. over one another.
  12715. This display mode makes it easier to spot relative differences or similarities
  12716. in overlapping areas of the color components that are supposed to be identical,
  12717. such as neutral whites, grays, or blacks.
  12718. @item stack
  12719. Display separate graph for the color components side by side in
  12720. @code{row} mode or one below the other in @code{column} mode.
  12721. @item parade
  12722. Display separate graph for the color components side by side in
  12723. @code{column} mode or one below the other in @code{row} mode.
  12724. Using this display mode makes it easy to spot color casts in the highlights
  12725. and shadows of an image, by comparing the contours of the top and the bottom
  12726. graphs of each waveform. Since whites, grays, and blacks are characterized
  12727. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12728. should display three waveforms of roughly equal width/height. If not, the
  12729. correction is easy to perform by making level adjustments the three waveforms.
  12730. @end table
  12731. Default is @code{stack}.
  12732. @item components, c
  12733. Set which color components to display. Default is 1, which means only luminance
  12734. or red color component if input is in RGB colorspace. If is set for example to
  12735. 7 it will display all 3 (if) available color components.
  12736. @item envelope, e
  12737. @table @samp
  12738. @item none
  12739. No envelope, this is default.
  12740. @item instant
  12741. Instant envelope, minimum and maximum values presented in graph will be easily
  12742. visible even with small @code{step} value.
  12743. @item peak
  12744. Hold minimum and maximum values presented in graph across time. This way you
  12745. can still spot out of range values without constantly looking at waveforms.
  12746. @item peak+instant
  12747. Peak and instant envelope combined together.
  12748. @end table
  12749. @item filter, f
  12750. @table @samp
  12751. @item lowpass
  12752. No filtering, this is default.
  12753. @item flat
  12754. Luma and chroma combined together.
  12755. @item aflat
  12756. Similar as above, but shows difference between blue and red chroma.
  12757. @item xflat
  12758. Similar as above, but use different colors.
  12759. @item chroma
  12760. Displays only chroma.
  12761. @item color
  12762. Displays actual color value on waveform.
  12763. @item acolor
  12764. Similar as above, but with luma showing frequency of chroma values.
  12765. @end table
  12766. @item graticule, g
  12767. Set which graticule to display.
  12768. @table @samp
  12769. @item none
  12770. Do not display graticule.
  12771. @item green
  12772. Display green graticule showing legal broadcast ranges.
  12773. @item orange
  12774. Display orange graticule showing legal broadcast ranges.
  12775. @end table
  12776. @item opacity, o
  12777. Set graticule opacity.
  12778. @item flags, fl
  12779. Set graticule flags.
  12780. @table @samp
  12781. @item numbers
  12782. Draw numbers above lines. By default enabled.
  12783. @item dots
  12784. Draw dots instead of lines.
  12785. @end table
  12786. @item scale, s
  12787. Set scale used for displaying graticule.
  12788. @table @samp
  12789. @item digital
  12790. @item millivolts
  12791. @item ire
  12792. @end table
  12793. Default is digital.
  12794. @item bgopacity, b
  12795. Set background opacity.
  12796. @end table
  12797. @section weave, doubleweave
  12798. The @code{weave} takes a field-based video input and join
  12799. each two sequential fields into single frame, producing a new double
  12800. height clip with half the frame rate and half the frame count.
  12801. The @code{doubleweave} works same as @code{weave} but without
  12802. halving frame rate and frame count.
  12803. It accepts the following option:
  12804. @table @option
  12805. @item first_field
  12806. Set first field. Available values are:
  12807. @table @samp
  12808. @item top, t
  12809. Set the frame as top-field-first.
  12810. @item bottom, b
  12811. Set the frame as bottom-field-first.
  12812. @end table
  12813. @end table
  12814. @subsection Examples
  12815. @itemize
  12816. @item
  12817. Interlace video using @ref{select} and @ref{separatefields} filter:
  12818. @example
  12819. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12820. @end example
  12821. @end itemize
  12822. @section xbr
  12823. Apply the xBR high-quality magnification filter which is designed for pixel
  12824. art. It follows a set of edge-detection rules, see
  12825. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12826. It accepts the following option:
  12827. @table @option
  12828. @item n
  12829. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12830. @code{3xBR} and @code{4} for @code{4xBR}.
  12831. Default is @code{3}.
  12832. @end table
  12833. @anchor{yadif}
  12834. @section yadif
  12835. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12836. filter").
  12837. It accepts the following parameters:
  12838. @table @option
  12839. @item mode
  12840. The interlacing mode to adopt. It accepts one of the following values:
  12841. @table @option
  12842. @item 0, send_frame
  12843. Output one frame for each frame.
  12844. @item 1, send_field
  12845. Output one frame for each field.
  12846. @item 2, send_frame_nospatial
  12847. Like @code{send_frame}, but it skips the spatial interlacing check.
  12848. @item 3, send_field_nospatial
  12849. Like @code{send_field}, but it skips the spatial interlacing check.
  12850. @end table
  12851. The default value is @code{send_frame}.
  12852. @item parity
  12853. The picture field parity assumed for the input interlaced video. It accepts one
  12854. of the following values:
  12855. @table @option
  12856. @item 0, tff
  12857. Assume the top field is first.
  12858. @item 1, bff
  12859. Assume the bottom field is first.
  12860. @item -1, auto
  12861. Enable automatic detection of field parity.
  12862. @end table
  12863. The default value is @code{auto}.
  12864. If the interlacing is unknown or the decoder does not export this information,
  12865. top field first will be assumed.
  12866. @item deint
  12867. Specify which frames to deinterlace. Accept one of the following
  12868. values:
  12869. @table @option
  12870. @item 0, all
  12871. Deinterlace all frames.
  12872. @item 1, interlaced
  12873. Only deinterlace frames marked as interlaced.
  12874. @end table
  12875. The default value is @code{all}.
  12876. @end table
  12877. @section zoompan
  12878. Apply Zoom & Pan effect.
  12879. This filter accepts the following options:
  12880. @table @option
  12881. @item zoom, z
  12882. Set the zoom expression. Default is 1.
  12883. @item x
  12884. @item y
  12885. Set the x and y expression. Default is 0.
  12886. @item d
  12887. Set the duration expression in number of frames.
  12888. This sets for how many number of frames effect will last for
  12889. single input image.
  12890. @item s
  12891. Set the output image size, default is 'hd720'.
  12892. @item fps
  12893. Set the output frame rate, default is '25'.
  12894. @end table
  12895. Each expression can contain the following constants:
  12896. @table @option
  12897. @item in_w, iw
  12898. Input width.
  12899. @item in_h, ih
  12900. Input height.
  12901. @item out_w, ow
  12902. Output width.
  12903. @item out_h, oh
  12904. Output height.
  12905. @item in
  12906. Input frame count.
  12907. @item on
  12908. Output frame count.
  12909. @item x
  12910. @item y
  12911. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12912. for current input frame.
  12913. @item px
  12914. @item py
  12915. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12916. not yet such frame (first input frame).
  12917. @item zoom
  12918. Last calculated zoom from 'z' expression for current input frame.
  12919. @item pzoom
  12920. Last calculated zoom of last output frame of previous input frame.
  12921. @item duration
  12922. Number of output frames for current input frame. Calculated from 'd' expression
  12923. for each input frame.
  12924. @item pduration
  12925. number of output frames created for previous input frame
  12926. @item a
  12927. Rational number: input width / input height
  12928. @item sar
  12929. sample aspect ratio
  12930. @item dar
  12931. display aspect ratio
  12932. @end table
  12933. @subsection Examples
  12934. @itemize
  12935. @item
  12936. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12937. @example
  12938. 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
  12939. @end example
  12940. @item
  12941. Zoom-in up to 1.5 and pan always at center of picture:
  12942. @example
  12943. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12944. @end example
  12945. @item
  12946. Same as above but without pausing:
  12947. @example
  12948. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12949. @end example
  12950. @end itemize
  12951. @anchor{zscale}
  12952. @section zscale
  12953. Scale (resize) the input video, using the z.lib library:
  12954. https://github.com/sekrit-twc/zimg.
  12955. The zscale filter forces the output display aspect ratio to be the same
  12956. as the input, by changing the output sample aspect ratio.
  12957. If the input image format is different from the format requested by
  12958. the next filter, the zscale filter will convert the input to the
  12959. requested format.
  12960. @subsection Options
  12961. The filter accepts the following options.
  12962. @table @option
  12963. @item width, w
  12964. @item height, h
  12965. Set the output video dimension expression. Default value is the input
  12966. dimension.
  12967. If the @var{width} or @var{w} value is 0, the input width is used for
  12968. the output. If the @var{height} or @var{h} value is 0, the input height
  12969. is used for the output.
  12970. If one and only one of the values is -n with n >= 1, the zscale filter
  12971. will use a value that maintains the aspect ratio of the input image,
  12972. calculated from the other specified dimension. After that it will,
  12973. however, make sure that the calculated dimension is divisible by n and
  12974. adjust the value if necessary.
  12975. If both values are -n with n >= 1, the behavior will be identical to
  12976. both values being set to 0 as previously detailed.
  12977. See below for the list of accepted constants for use in the dimension
  12978. expression.
  12979. @item size, s
  12980. Set the video size. For the syntax of this option, check the
  12981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12982. @item dither, d
  12983. Set the dither type.
  12984. Possible values are:
  12985. @table @var
  12986. @item none
  12987. @item ordered
  12988. @item random
  12989. @item error_diffusion
  12990. @end table
  12991. Default is none.
  12992. @item filter, f
  12993. Set the resize filter type.
  12994. Possible values are:
  12995. @table @var
  12996. @item point
  12997. @item bilinear
  12998. @item bicubic
  12999. @item spline16
  13000. @item spline36
  13001. @item lanczos
  13002. @end table
  13003. Default is bilinear.
  13004. @item range, r
  13005. Set the color range.
  13006. Possible values are:
  13007. @table @var
  13008. @item input
  13009. @item limited
  13010. @item full
  13011. @end table
  13012. Default is same as input.
  13013. @item primaries, p
  13014. Set the color primaries.
  13015. Possible values are:
  13016. @table @var
  13017. @item input
  13018. @item 709
  13019. @item unspecified
  13020. @item 170m
  13021. @item 240m
  13022. @item 2020
  13023. @end table
  13024. Default is same as input.
  13025. @item transfer, t
  13026. Set the transfer characteristics.
  13027. Possible values are:
  13028. @table @var
  13029. @item input
  13030. @item 709
  13031. @item unspecified
  13032. @item 601
  13033. @item linear
  13034. @item 2020_10
  13035. @item 2020_12
  13036. @item smpte2084
  13037. @item iec61966-2-1
  13038. @item arib-std-b67
  13039. @end table
  13040. Default is same as input.
  13041. @item matrix, m
  13042. Set the colorspace matrix.
  13043. Possible value are:
  13044. @table @var
  13045. @item input
  13046. @item 709
  13047. @item unspecified
  13048. @item 470bg
  13049. @item 170m
  13050. @item 2020_ncl
  13051. @item 2020_cl
  13052. @end table
  13053. Default is same as input.
  13054. @item rangein, rin
  13055. Set the input color range.
  13056. Possible values are:
  13057. @table @var
  13058. @item input
  13059. @item limited
  13060. @item full
  13061. @end table
  13062. Default is same as input.
  13063. @item primariesin, pin
  13064. Set the input color primaries.
  13065. Possible values are:
  13066. @table @var
  13067. @item input
  13068. @item 709
  13069. @item unspecified
  13070. @item 170m
  13071. @item 240m
  13072. @item 2020
  13073. @end table
  13074. Default is same as input.
  13075. @item transferin, tin
  13076. Set the input transfer characteristics.
  13077. Possible values are:
  13078. @table @var
  13079. @item input
  13080. @item 709
  13081. @item unspecified
  13082. @item 601
  13083. @item linear
  13084. @item 2020_10
  13085. @item 2020_12
  13086. @end table
  13087. Default is same as input.
  13088. @item matrixin, min
  13089. Set the input colorspace matrix.
  13090. Possible value are:
  13091. @table @var
  13092. @item input
  13093. @item 709
  13094. @item unspecified
  13095. @item 470bg
  13096. @item 170m
  13097. @item 2020_ncl
  13098. @item 2020_cl
  13099. @end table
  13100. @item chromal, c
  13101. Set the output chroma location.
  13102. Possible values are:
  13103. @table @var
  13104. @item input
  13105. @item left
  13106. @item center
  13107. @item topleft
  13108. @item top
  13109. @item bottomleft
  13110. @item bottom
  13111. @end table
  13112. @item chromalin, cin
  13113. Set the input chroma location.
  13114. Possible values are:
  13115. @table @var
  13116. @item input
  13117. @item left
  13118. @item center
  13119. @item topleft
  13120. @item top
  13121. @item bottomleft
  13122. @item bottom
  13123. @end table
  13124. @item npl
  13125. Set the nominal peak luminance.
  13126. @end table
  13127. The values of the @option{w} and @option{h} options are expressions
  13128. containing the following constants:
  13129. @table @var
  13130. @item in_w
  13131. @item in_h
  13132. The input width and height
  13133. @item iw
  13134. @item ih
  13135. These are the same as @var{in_w} and @var{in_h}.
  13136. @item out_w
  13137. @item out_h
  13138. The output (scaled) width and height
  13139. @item ow
  13140. @item oh
  13141. These are the same as @var{out_w} and @var{out_h}
  13142. @item a
  13143. The same as @var{iw} / @var{ih}
  13144. @item sar
  13145. input sample aspect ratio
  13146. @item dar
  13147. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13148. @item hsub
  13149. @item vsub
  13150. horizontal and vertical input chroma subsample values. For example for the
  13151. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13152. @item ohsub
  13153. @item ovsub
  13154. horizontal and vertical output chroma subsample values. For example for the
  13155. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13156. @end table
  13157. @table @option
  13158. @end table
  13159. @c man end VIDEO FILTERS
  13160. @chapter Video Sources
  13161. @c man begin VIDEO SOURCES
  13162. Below is a description of the currently available video sources.
  13163. @section buffer
  13164. Buffer video frames, and make them available to the filter chain.
  13165. This source is mainly intended for a programmatic use, in particular
  13166. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13167. It accepts the following parameters:
  13168. @table @option
  13169. @item video_size
  13170. Specify the size (width and height) of the buffered video frames. For the
  13171. syntax of this option, check the
  13172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13173. @item width
  13174. The input video width.
  13175. @item height
  13176. The input video height.
  13177. @item pix_fmt
  13178. A string representing the pixel format of the buffered video frames.
  13179. It may be a number corresponding to a pixel format, or a pixel format
  13180. name.
  13181. @item time_base
  13182. Specify the timebase assumed by the timestamps of the buffered frames.
  13183. @item frame_rate
  13184. Specify the frame rate expected for the video stream.
  13185. @item pixel_aspect, sar
  13186. The sample (pixel) aspect ratio of the input video.
  13187. @item sws_param
  13188. Specify the optional parameters to be used for the scale filter which
  13189. is automatically inserted when an input change is detected in the
  13190. input size or format.
  13191. @item hw_frames_ctx
  13192. When using a hardware pixel format, this should be a reference to an
  13193. AVHWFramesContext describing input frames.
  13194. @end table
  13195. For example:
  13196. @example
  13197. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13198. @end example
  13199. will instruct the source to accept video frames with size 320x240 and
  13200. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13201. square pixels (1:1 sample aspect ratio).
  13202. Since the pixel format with name "yuv410p" corresponds to the number 6
  13203. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13204. this example corresponds to:
  13205. @example
  13206. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13207. @end example
  13208. Alternatively, the options can be specified as a flat string, but this
  13209. syntax is deprecated:
  13210. @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}]
  13211. @section cellauto
  13212. Create a pattern generated by an elementary cellular automaton.
  13213. The initial state of the cellular automaton can be defined through the
  13214. @option{filename} and @option{pattern} options. If such options are
  13215. not specified an initial state is created randomly.
  13216. At each new frame a new row in the video is filled with the result of
  13217. the cellular automaton next generation. The behavior when the whole
  13218. frame is filled is defined by the @option{scroll} option.
  13219. This source accepts the following options:
  13220. @table @option
  13221. @item filename, f
  13222. Read the initial cellular automaton state, i.e. the starting row, from
  13223. the specified file.
  13224. In the file, each non-whitespace character is considered an alive
  13225. cell, a newline will terminate the row, and further characters in the
  13226. file will be ignored.
  13227. @item pattern, p
  13228. Read the initial cellular automaton state, i.e. the starting row, from
  13229. the specified string.
  13230. Each non-whitespace character in the string is considered an alive
  13231. cell, a newline will terminate the row, and further characters in the
  13232. string will be ignored.
  13233. @item rate, r
  13234. Set the video rate, that is the number of frames generated per second.
  13235. Default is 25.
  13236. @item random_fill_ratio, ratio
  13237. Set the random fill ratio for the initial cellular automaton row. It
  13238. is a floating point number value ranging from 0 to 1, defaults to
  13239. 1/PHI.
  13240. This option is ignored when a file or a pattern is specified.
  13241. @item random_seed, seed
  13242. Set the seed for filling randomly the initial row, must be an integer
  13243. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13244. set to -1, the filter will try to use a good random seed on a best
  13245. effort basis.
  13246. @item rule
  13247. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13248. Default value is 110.
  13249. @item size, s
  13250. Set the size of the output video. For the syntax of this option, check the
  13251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13252. If @option{filename} or @option{pattern} is specified, the size is set
  13253. by default to the width of the specified initial state row, and the
  13254. height is set to @var{width} * PHI.
  13255. If @option{size} is set, it must contain the width of the specified
  13256. pattern string, and the specified pattern will be centered in the
  13257. larger row.
  13258. If a filename or a pattern string is not specified, the size value
  13259. defaults to "320x518" (used for a randomly generated initial state).
  13260. @item scroll
  13261. If set to 1, scroll the output upward when all the rows in the output
  13262. have been already filled. If set to 0, the new generated row will be
  13263. written over the top row just after the bottom row is filled.
  13264. Defaults to 1.
  13265. @item start_full, full
  13266. If set to 1, completely fill the output with generated rows before
  13267. outputting the first frame.
  13268. This is the default behavior, for disabling set the value to 0.
  13269. @item stitch
  13270. If set to 1, stitch the left and right row edges together.
  13271. This is the default behavior, for disabling set the value to 0.
  13272. @end table
  13273. @subsection Examples
  13274. @itemize
  13275. @item
  13276. Read the initial state from @file{pattern}, and specify an output of
  13277. size 200x400.
  13278. @example
  13279. cellauto=f=pattern:s=200x400
  13280. @end example
  13281. @item
  13282. Generate a random initial row with a width of 200 cells, with a fill
  13283. ratio of 2/3:
  13284. @example
  13285. cellauto=ratio=2/3:s=200x200
  13286. @end example
  13287. @item
  13288. Create a pattern generated by rule 18 starting by a single alive cell
  13289. centered on an initial row with width 100:
  13290. @example
  13291. cellauto=p=@@:s=100x400:full=0:rule=18
  13292. @end example
  13293. @item
  13294. Specify a more elaborated initial pattern:
  13295. @example
  13296. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13297. @end example
  13298. @end itemize
  13299. @anchor{coreimagesrc}
  13300. @section coreimagesrc
  13301. Video source generated on GPU using Apple's CoreImage API on OSX.
  13302. This video source is a specialized version of the @ref{coreimage} video filter.
  13303. Use a core image generator at the beginning of the applied filterchain to
  13304. generate the content.
  13305. The coreimagesrc video source accepts the following options:
  13306. @table @option
  13307. @item list_generators
  13308. List all available generators along with all their respective options as well as
  13309. possible minimum and maximum values along with the default values.
  13310. @example
  13311. list_generators=true
  13312. @end example
  13313. @item size, s
  13314. Specify the size of the sourced video. For the syntax of this option, check the
  13315. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13316. The default value is @code{320x240}.
  13317. @item rate, r
  13318. Specify the frame rate of the sourced video, as the number of frames
  13319. generated per second. It has to be a string in the format
  13320. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13321. number or a valid video frame rate abbreviation. The default value is
  13322. "25".
  13323. @item sar
  13324. Set the sample aspect ratio of the sourced video.
  13325. @item duration, d
  13326. Set the duration of the sourced video. See
  13327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13328. for the accepted syntax.
  13329. If not specified, or the expressed duration is negative, the video is
  13330. supposed to be generated forever.
  13331. @end table
  13332. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13333. A complete filterchain can be used for further processing of the
  13334. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13335. and examples for details.
  13336. @subsection Examples
  13337. @itemize
  13338. @item
  13339. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13340. given as complete and escaped command-line for Apple's standard bash shell:
  13341. @example
  13342. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13343. @end example
  13344. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13345. need for a nullsrc video source.
  13346. @end itemize
  13347. @section mandelbrot
  13348. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13349. point specified with @var{start_x} and @var{start_y}.
  13350. This source accepts the following options:
  13351. @table @option
  13352. @item end_pts
  13353. Set the terminal pts value. Default value is 400.
  13354. @item end_scale
  13355. Set the terminal scale value.
  13356. Must be a floating point value. Default value is 0.3.
  13357. @item inner
  13358. Set the inner coloring mode, that is the algorithm used to draw the
  13359. Mandelbrot fractal internal region.
  13360. It shall assume one of the following values:
  13361. @table @option
  13362. @item black
  13363. Set black mode.
  13364. @item convergence
  13365. Show time until convergence.
  13366. @item mincol
  13367. Set color based on point closest to the origin of the iterations.
  13368. @item period
  13369. Set period mode.
  13370. @end table
  13371. Default value is @var{mincol}.
  13372. @item bailout
  13373. Set the bailout value. Default value is 10.0.
  13374. @item maxiter
  13375. Set the maximum of iterations performed by the rendering
  13376. algorithm. Default value is 7189.
  13377. @item outer
  13378. Set outer coloring mode.
  13379. It shall assume one of following values:
  13380. @table @option
  13381. @item iteration_count
  13382. Set iteration cound mode.
  13383. @item normalized_iteration_count
  13384. set normalized iteration count mode.
  13385. @end table
  13386. Default value is @var{normalized_iteration_count}.
  13387. @item rate, r
  13388. Set frame rate, expressed as number of frames per second. Default
  13389. value is "25".
  13390. @item size, s
  13391. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13392. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13393. @item start_scale
  13394. Set the initial scale value. Default value is 3.0.
  13395. @item start_x
  13396. Set the initial x position. Must be a floating point value between
  13397. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13398. @item start_y
  13399. Set the initial y position. Must be a floating point value between
  13400. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13401. @end table
  13402. @section mptestsrc
  13403. Generate various test patterns, as generated by the MPlayer test filter.
  13404. The size of the generated video is fixed, and is 256x256.
  13405. This source is useful in particular for testing encoding features.
  13406. This source accepts the following options:
  13407. @table @option
  13408. @item rate, r
  13409. Specify the frame rate of the sourced video, as the number of frames
  13410. generated per second. It has to be a string in the format
  13411. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13412. number or a valid video frame rate abbreviation. The default value is
  13413. "25".
  13414. @item duration, d
  13415. Set the duration of the sourced video. See
  13416. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13417. for the accepted syntax.
  13418. If not specified, or the expressed duration is negative, the video is
  13419. supposed to be generated forever.
  13420. @item test, t
  13421. Set the number or the name of the test to perform. Supported tests are:
  13422. @table @option
  13423. @item dc_luma
  13424. @item dc_chroma
  13425. @item freq_luma
  13426. @item freq_chroma
  13427. @item amp_luma
  13428. @item amp_chroma
  13429. @item cbp
  13430. @item mv
  13431. @item ring1
  13432. @item ring2
  13433. @item all
  13434. @end table
  13435. Default value is "all", which will cycle through the list of all tests.
  13436. @end table
  13437. Some examples:
  13438. @example
  13439. mptestsrc=t=dc_luma
  13440. @end example
  13441. will generate a "dc_luma" test pattern.
  13442. @section frei0r_src
  13443. Provide a frei0r source.
  13444. To enable compilation of this filter you need to install the frei0r
  13445. header and configure FFmpeg with @code{--enable-frei0r}.
  13446. This source accepts the following parameters:
  13447. @table @option
  13448. @item size
  13449. The size of the video to generate. For the syntax of this option, check the
  13450. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13451. @item framerate
  13452. The framerate of the generated video. It may be a string of the form
  13453. @var{num}/@var{den} or a frame rate abbreviation.
  13454. @item filter_name
  13455. The name to the frei0r source to load. For more information regarding frei0r and
  13456. how to set the parameters, read the @ref{frei0r} section in the video filters
  13457. documentation.
  13458. @item filter_params
  13459. A '|'-separated list of parameters to pass to the frei0r source.
  13460. @end table
  13461. For example, to generate a frei0r partik0l source with size 200x200
  13462. and frame rate 10 which is overlaid on the overlay filter main input:
  13463. @example
  13464. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13465. @end example
  13466. @section life
  13467. Generate a life pattern.
  13468. This source is based on a generalization of John Conway's life game.
  13469. The sourced input represents a life grid, each pixel represents a cell
  13470. which can be in one of two possible states, alive or dead. Every cell
  13471. interacts with its eight neighbours, which are the cells that are
  13472. horizontally, vertically, or diagonally adjacent.
  13473. At each interaction the grid evolves according to the adopted rule,
  13474. which specifies the number of neighbor alive cells which will make a
  13475. cell stay alive or born. The @option{rule} option allows one to specify
  13476. the rule to adopt.
  13477. This source accepts the following options:
  13478. @table @option
  13479. @item filename, f
  13480. Set the file from which to read the initial grid state. In the file,
  13481. each non-whitespace character is considered an alive cell, and newline
  13482. is used to delimit the end of each row.
  13483. If this option is not specified, the initial grid is generated
  13484. randomly.
  13485. @item rate, r
  13486. Set the video rate, that is the number of frames generated per second.
  13487. Default is 25.
  13488. @item random_fill_ratio, ratio
  13489. Set the random fill ratio for the initial random grid. It is a
  13490. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13491. It is ignored when a file is specified.
  13492. @item random_seed, seed
  13493. Set the seed for filling the initial random grid, must be an integer
  13494. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13495. set to -1, the filter will try to use a good random seed on a best
  13496. effort basis.
  13497. @item rule
  13498. Set the life rule.
  13499. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13500. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13501. @var{NS} specifies the number of alive neighbor cells which make a
  13502. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13503. which make a dead cell to become alive (i.e. to "born").
  13504. "s" and "b" can be used in place of "S" and "B", respectively.
  13505. Alternatively a rule can be specified by an 18-bits integer. The 9
  13506. high order bits are used to encode the next cell state if it is alive
  13507. for each number of neighbor alive cells, the low order bits specify
  13508. the rule for "borning" new cells. Higher order bits encode for an
  13509. higher number of neighbor cells.
  13510. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13511. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13512. Default value is "S23/B3", which is the original Conway's game of life
  13513. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13514. cells, and will born a new cell if there are three alive cells around
  13515. a dead cell.
  13516. @item size, s
  13517. Set the size of the output video. For the syntax of this option, check the
  13518. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13519. If @option{filename} is specified, the size is set by default to the
  13520. same size of the input file. If @option{size} is set, it must contain
  13521. the size specified in the input file, and the initial grid defined in
  13522. that file is centered in the larger resulting area.
  13523. If a filename is not specified, the size value defaults to "320x240"
  13524. (used for a randomly generated initial grid).
  13525. @item stitch
  13526. If set to 1, stitch the left and right grid edges together, and the
  13527. top and bottom edges also. Defaults to 1.
  13528. @item mold
  13529. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13530. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13531. value from 0 to 255.
  13532. @item life_color
  13533. Set the color of living (or new born) cells.
  13534. @item death_color
  13535. Set the color of dead cells. If @option{mold} is set, this is the first color
  13536. used to represent a dead cell.
  13537. @item mold_color
  13538. Set mold color, for definitely dead and moldy cells.
  13539. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13540. ffmpeg-utils manual,ffmpeg-utils}.
  13541. @end table
  13542. @subsection Examples
  13543. @itemize
  13544. @item
  13545. Read a grid from @file{pattern}, and center it on a grid of size
  13546. 300x300 pixels:
  13547. @example
  13548. life=f=pattern:s=300x300
  13549. @end example
  13550. @item
  13551. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13552. @example
  13553. life=ratio=2/3:s=200x200
  13554. @end example
  13555. @item
  13556. Specify a custom rule for evolving a randomly generated grid:
  13557. @example
  13558. life=rule=S14/B34
  13559. @end example
  13560. @item
  13561. Full example with slow death effect (mold) using @command{ffplay}:
  13562. @example
  13563. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13564. @end example
  13565. @end itemize
  13566. @anchor{allrgb}
  13567. @anchor{allyuv}
  13568. @anchor{color}
  13569. @anchor{haldclutsrc}
  13570. @anchor{nullsrc}
  13571. @anchor{rgbtestsrc}
  13572. @anchor{smptebars}
  13573. @anchor{smptehdbars}
  13574. @anchor{testsrc}
  13575. @anchor{testsrc2}
  13576. @anchor{yuvtestsrc}
  13577. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13578. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13579. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13580. The @code{color} source provides an uniformly colored input.
  13581. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13582. @ref{haldclut} filter.
  13583. The @code{nullsrc} source returns unprocessed video frames. It is
  13584. mainly useful to be employed in analysis / debugging tools, or as the
  13585. source for filters which ignore the input data.
  13586. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13587. detecting RGB vs BGR issues. You should see a red, green and blue
  13588. stripe from top to bottom.
  13589. The @code{smptebars} source generates a color bars pattern, based on
  13590. the SMPTE Engineering Guideline EG 1-1990.
  13591. The @code{smptehdbars} source generates a color bars pattern, based on
  13592. the SMPTE RP 219-2002.
  13593. The @code{testsrc} source generates a test video pattern, showing a
  13594. color pattern, a scrolling gradient and a timestamp. This is mainly
  13595. intended for testing purposes.
  13596. The @code{testsrc2} source is similar to testsrc, but supports more
  13597. pixel formats instead of just @code{rgb24}. This allows using it as an
  13598. input for other tests without requiring a format conversion.
  13599. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13600. see a y, cb and cr stripe from top to bottom.
  13601. The sources accept the following parameters:
  13602. @table @option
  13603. @item level
  13604. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13605. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13606. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13607. coded on a @code{1/(N*N)} scale.
  13608. @item color, c
  13609. Specify the color of the source, only available in the @code{color}
  13610. source. For the syntax of this option, check the
  13611. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13612. @item size, s
  13613. Specify the size of the sourced video. For the syntax of this option, check the
  13614. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13615. The default value is @code{320x240}.
  13616. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13617. @code{haldclutsrc} filters.
  13618. @item rate, r
  13619. Specify the frame rate of the sourced video, as the number of frames
  13620. generated per second. It has to be a string in the format
  13621. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13622. number or a valid video frame rate abbreviation. The default value is
  13623. "25".
  13624. @item duration, d
  13625. Set the duration of the sourced video. See
  13626. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13627. for the accepted syntax.
  13628. If not specified, or the expressed duration is negative, the video is
  13629. supposed to be generated forever.
  13630. @item sar
  13631. Set the sample aspect ratio of the sourced video.
  13632. @item alpha
  13633. Specify the alpha (opacity) of the background, only available in the
  13634. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13635. 255 (fully opaque, the default).
  13636. @item decimals, n
  13637. Set the number of decimals to show in the timestamp, only available in the
  13638. @code{testsrc} source.
  13639. The displayed timestamp value will correspond to the original
  13640. timestamp value multiplied by the power of 10 of the specified
  13641. value. Default value is 0.
  13642. @end table
  13643. @subsection Examples
  13644. @itemize
  13645. @item
  13646. Generate a video with a duration of 5.3 seconds, with size
  13647. 176x144 and a frame rate of 10 frames per second:
  13648. @example
  13649. testsrc=duration=5.3:size=qcif:rate=10
  13650. @end example
  13651. @item
  13652. The following graph description will generate a red source
  13653. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13654. frames per second:
  13655. @example
  13656. color=c=red@@0.2:s=qcif:r=10
  13657. @end example
  13658. @item
  13659. If the input content is to be ignored, @code{nullsrc} can be used. The
  13660. following command generates noise in the luminance plane by employing
  13661. the @code{geq} filter:
  13662. @example
  13663. nullsrc=s=256x256, geq=random(1)*255:128:128
  13664. @end example
  13665. @end itemize
  13666. @subsection Commands
  13667. The @code{color} source supports the following commands:
  13668. @table @option
  13669. @item c, color
  13670. Set the color of the created image. Accepts the same syntax of the
  13671. corresponding @option{color} option.
  13672. @end table
  13673. @section openclsrc
  13674. Generate video using an OpenCL program.
  13675. @table @option
  13676. @item source
  13677. OpenCL program source file.
  13678. @item kernel
  13679. Kernel name in program.
  13680. @item size, s
  13681. Size of frames to generate. This must be set.
  13682. @item format
  13683. Pixel format to use for the generated frames. This must be set.
  13684. @item rate, r
  13685. Number of frames generated every second. Default value is '25'.
  13686. @end table
  13687. For details of how the program loading works, see the @ref{program_opencl}
  13688. filter.
  13689. Example programs:
  13690. @itemize
  13691. @item
  13692. Generate a colour ramp by setting pixel values from the position of the pixel
  13693. in the output image. (Note that this will work with all pixel formats, but
  13694. the generated output will not be the same.)
  13695. @verbatim
  13696. __kernel void ramp(__write_only image2d_t dst,
  13697. unsigned int index)
  13698. {
  13699. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13700. float4 val;
  13701. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13702. write_imagef(dst, loc, val);
  13703. }
  13704. @end verbatim
  13705. @item
  13706. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13707. @verbatim
  13708. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13709. unsigned int index)
  13710. {
  13711. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13712. float4 value = 0.0f;
  13713. int x = loc.x + index;
  13714. int y = loc.y + index;
  13715. while (x > 0 || y > 0) {
  13716. if (x % 3 == 1 && y % 3 == 1) {
  13717. value = 1.0f;
  13718. break;
  13719. }
  13720. x /= 3;
  13721. y /= 3;
  13722. }
  13723. write_imagef(dst, loc, value);
  13724. }
  13725. @end verbatim
  13726. @end itemize
  13727. @c man end VIDEO SOURCES
  13728. @chapter Video Sinks
  13729. @c man begin VIDEO SINKS
  13730. Below is a description of the currently available video sinks.
  13731. @section buffersink
  13732. Buffer video frames, and make them available to the end of the filter
  13733. graph.
  13734. This sink is mainly intended for programmatic use, in particular
  13735. through the interface defined in @file{libavfilter/buffersink.h}
  13736. or the options system.
  13737. It accepts a pointer to an AVBufferSinkContext structure, which
  13738. defines the incoming buffers' formats, to be passed as the opaque
  13739. parameter to @code{avfilter_init_filter} for initialization.
  13740. @section nullsink
  13741. Null video sink: do absolutely nothing with the input video. It is
  13742. mainly useful as a template and for use in analysis / debugging
  13743. tools.
  13744. @c man end VIDEO SINKS
  13745. @chapter Multimedia Filters
  13746. @c man begin MULTIMEDIA FILTERS
  13747. Below is a description of the currently available multimedia filters.
  13748. @section abitscope
  13749. Convert input audio to a video output, displaying the audio bit scope.
  13750. The filter accepts the following options:
  13751. @table @option
  13752. @item rate, r
  13753. Set frame rate, expressed as number of frames per second. Default
  13754. value is "25".
  13755. @item size, s
  13756. Specify the video size for the output. For the syntax of this option, check the
  13757. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13758. Default value is @code{1024x256}.
  13759. @item colors
  13760. Specify list of colors separated by space or by '|' which will be used to
  13761. draw channels. Unrecognized or missing colors will be replaced
  13762. by white color.
  13763. @end table
  13764. @section ahistogram
  13765. Convert input audio to a video output, displaying the volume histogram.
  13766. The filter accepts the following options:
  13767. @table @option
  13768. @item dmode
  13769. Specify how histogram is calculated.
  13770. It accepts the following values:
  13771. @table @samp
  13772. @item single
  13773. Use single histogram for all channels.
  13774. @item separate
  13775. Use separate histogram for each channel.
  13776. @end table
  13777. Default is @code{single}.
  13778. @item rate, r
  13779. Set frame rate, expressed as number of frames per second. Default
  13780. value is "25".
  13781. @item size, s
  13782. Specify the video size for the output. For the syntax of this option, check the
  13783. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13784. Default value is @code{hd720}.
  13785. @item scale
  13786. Set display scale.
  13787. It accepts the following values:
  13788. @table @samp
  13789. @item log
  13790. logarithmic
  13791. @item sqrt
  13792. square root
  13793. @item cbrt
  13794. cubic root
  13795. @item lin
  13796. linear
  13797. @item rlog
  13798. reverse logarithmic
  13799. @end table
  13800. Default is @code{log}.
  13801. @item ascale
  13802. Set amplitude scale.
  13803. It accepts the following values:
  13804. @table @samp
  13805. @item log
  13806. logarithmic
  13807. @item lin
  13808. linear
  13809. @end table
  13810. Default is @code{log}.
  13811. @item acount
  13812. Set how much frames to accumulate in histogram.
  13813. Defauls is 1. Setting this to -1 accumulates all frames.
  13814. @item rheight
  13815. Set histogram ratio of window height.
  13816. @item slide
  13817. Set sonogram sliding.
  13818. It accepts the following values:
  13819. @table @samp
  13820. @item replace
  13821. replace old rows with new ones.
  13822. @item scroll
  13823. scroll from top to bottom.
  13824. @end table
  13825. Default is @code{replace}.
  13826. @end table
  13827. @section aphasemeter
  13828. Convert input audio to a video output, displaying the audio phase.
  13829. The filter accepts the following options:
  13830. @table @option
  13831. @item rate, r
  13832. Set the output frame rate. Default value is @code{25}.
  13833. @item size, s
  13834. Set the video size for the output. For the syntax of this option, check the
  13835. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13836. Default value is @code{800x400}.
  13837. @item rc
  13838. @item gc
  13839. @item bc
  13840. Specify the red, green, blue contrast. Default values are @code{2},
  13841. @code{7} and @code{1}.
  13842. Allowed range is @code{[0, 255]}.
  13843. @item mpc
  13844. Set color which will be used for drawing median phase. If color is
  13845. @code{none} which is default, no median phase value will be drawn.
  13846. @item video
  13847. Enable video output. Default is enabled.
  13848. @end table
  13849. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13850. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13851. The @code{-1} means left and right channels are completely out of phase and
  13852. @code{1} means channels are in phase.
  13853. @section avectorscope
  13854. Convert input audio to a video output, representing the audio vector
  13855. scope.
  13856. The filter is used to measure the difference between channels of stereo
  13857. audio stream. A monoaural signal, consisting of identical left and right
  13858. signal, results in straight vertical line. Any stereo separation is visible
  13859. as a deviation from this line, creating a Lissajous figure.
  13860. If the straight (or deviation from it) but horizontal line appears this
  13861. indicates that the left and right channels are out of phase.
  13862. The filter accepts the following options:
  13863. @table @option
  13864. @item mode, m
  13865. Set the vectorscope mode.
  13866. Available values are:
  13867. @table @samp
  13868. @item lissajous
  13869. Lissajous rotated by 45 degrees.
  13870. @item lissajous_xy
  13871. Same as above but not rotated.
  13872. @item polar
  13873. Shape resembling half of circle.
  13874. @end table
  13875. Default value is @samp{lissajous}.
  13876. @item size, s
  13877. Set the video size for the output. For the syntax of this option, check the
  13878. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13879. Default value is @code{400x400}.
  13880. @item rate, r
  13881. Set the output frame rate. Default value is @code{25}.
  13882. @item rc
  13883. @item gc
  13884. @item bc
  13885. @item ac
  13886. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13887. @code{160}, @code{80} and @code{255}.
  13888. Allowed range is @code{[0, 255]}.
  13889. @item rf
  13890. @item gf
  13891. @item bf
  13892. @item af
  13893. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13894. @code{10}, @code{5} and @code{5}.
  13895. Allowed range is @code{[0, 255]}.
  13896. @item zoom
  13897. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13898. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13899. @item draw
  13900. Set the vectorscope drawing mode.
  13901. Available values are:
  13902. @table @samp
  13903. @item dot
  13904. Draw dot for each sample.
  13905. @item line
  13906. Draw line between previous and current sample.
  13907. @end table
  13908. Default value is @samp{dot}.
  13909. @item scale
  13910. Specify amplitude scale of audio samples.
  13911. Available values are:
  13912. @table @samp
  13913. @item lin
  13914. Linear.
  13915. @item sqrt
  13916. Square root.
  13917. @item cbrt
  13918. Cubic root.
  13919. @item log
  13920. Logarithmic.
  13921. @end table
  13922. @item swap
  13923. Swap left channel axis with right channel axis.
  13924. @item mirror
  13925. Mirror axis.
  13926. @table @samp
  13927. @item none
  13928. No mirror.
  13929. @item x
  13930. Mirror only x axis.
  13931. @item y
  13932. Mirror only y axis.
  13933. @item xy
  13934. Mirror both axis.
  13935. @end table
  13936. @end table
  13937. @subsection Examples
  13938. @itemize
  13939. @item
  13940. Complete example using @command{ffplay}:
  13941. @example
  13942. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13943. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13944. @end example
  13945. @end itemize
  13946. @section bench, abench
  13947. Benchmark part of a filtergraph.
  13948. The filter accepts the following options:
  13949. @table @option
  13950. @item action
  13951. Start or stop a timer.
  13952. Available values are:
  13953. @table @samp
  13954. @item start
  13955. Get the current time, set it as frame metadata (using the key
  13956. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13957. @item stop
  13958. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13959. the input frame metadata to get the time difference. Time difference, average,
  13960. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13961. @code{min}) are then printed. The timestamps are expressed in seconds.
  13962. @end table
  13963. @end table
  13964. @subsection Examples
  13965. @itemize
  13966. @item
  13967. Benchmark @ref{selectivecolor} filter:
  13968. @example
  13969. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13970. @end example
  13971. @end itemize
  13972. @section concat
  13973. Concatenate audio and video streams, joining them together one after the
  13974. other.
  13975. The filter works on segments of synchronized video and audio streams. All
  13976. segments must have the same number of streams of each type, and that will
  13977. also be the number of streams at output.
  13978. The filter accepts the following options:
  13979. @table @option
  13980. @item n
  13981. Set the number of segments. Default is 2.
  13982. @item v
  13983. Set the number of output video streams, that is also the number of video
  13984. streams in each segment. Default is 1.
  13985. @item a
  13986. Set the number of output audio streams, that is also the number of audio
  13987. streams in each segment. Default is 0.
  13988. @item unsafe
  13989. Activate unsafe mode: do not fail if segments have a different format.
  13990. @end table
  13991. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13992. @var{a} audio outputs.
  13993. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13994. segment, in the same order as the outputs, then the inputs for the second
  13995. segment, etc.
  13996. Related streams do not always have exactly the same duration, for various
  13997. reasons including codec frame size or sloppy authoring. For that reason,
  13998. related synchronized streams (e.g. a video and its audio track) should be
  13999. concatenated at once. The concat filter will use the duration of the longest
  14000. stream in each segment (except the last one), and if necessary pad shorter
  14001. audio streams with silence.
  14002. For this filter to work correctly, all segments must start at timestamp 0.
  14003. All corresponding streams must have the same parameters in all segments; the
  14004. filtering system will automatically select a common pixel format for video
  14005. streams, and a common sample format, sample rate and channel layout for
  14006. audio streams, but other settings, such as resolution, must be converted
  14007. explicitly by the user.
  14008. Different frame rates are acceptable but will result in variable frame rate
  14009. at output; be sure to configure the output file to handle it.
  14010. @subsection Examples
  14011. @itemize
  14012. @item
  14013. Concatenate an opening, an episode and an ending, all in bilingual version
  14014. (video in stream 0, audio in streams 1 and 2):
  14015. @example
  14016. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14017. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14018. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14019. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14020. @end example
  14021. @item
  14022. Concatenate two parts, handling audio and video separately, using the
  14023. (a)movie sources, and adjusting the resolution:
  14024. @example
  14025. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14026. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14027. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14028. @end example
  14029. Note that a desync will happen at the stitch if the audio and video streams
  14030. do not have exactly the same duration in the first file.
  14031. @end itemize
  14032. @subsection Commands
  14033. This filter supports the following commands:
  14034. @table @option
  14035. @item next
  14036. Close the current segment and step to the next one
  14037. @end table
  14038. @section drawgraph, adrawgraph
  14039. Draw a graph using input video or audio metadata.
  14040. It accepts the following parameters:
  14041. @table @option
  14042. @item m1
  14043. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14044. @item fg1
  14045. Set 1st foreground color expression.
  14046. @item m2
  14047. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14048. @item fg2
  14049. Set 2nd foreground color expression.
  14050. @item m3
  14051. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14052. @item fg3
  14053. Set 3rd foreground color expression.
  14054. @item m4
  14055. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14056. @item fg4
  14057. Set 4th foreground color expression.
  14058. @item min
  14059. Set minimal value of metadata value.
  14060. @item max
  14061. Set maximal value of metadata value.
  14062. @item bg
  14063. Set graph background color. Default is white.
  14064. @item mode
  14065. Set graph mode.
  14066. Available values for mode is:
  14067. @table @samp
  14068. @item bar
  14069. @item dot
  14070. @item line
  14071. @end table
  14072. Default is @code{line}.
  14073. @item slide
  14074. Set slide mode.
  14075. Available values for slide is:
  14076. @table @samp
  14077. @item frame
  14078. Draw new frame when right border is reached.
  14079. @item replace
  14080. Replace old columns with new ones.
  14081. @item scroll
  14082. Scroll from right to left.
  14083. @item rscroll
  14084. Scroll from left to right.
  14085. @item picture
  14086. Draw single picture.
  14087. @end table
  14088. Default is @code{frame}.
  14089. @item size
  14090. Set size of graph video. For the syntax of this option, check the
  14091. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14092. The default value is @code{900x256}.
  14093. The foreground color expressions can use the following variables:
  14094. @table @option
  14095. @item MIN
  14096. Minimal value of metadata value.
  14097. @item MAX
  14098. Maximal value of metadata value.
  14099. @item VAL
  14100. Current metadata key value.
  14101. @end table
  14102. The color is defined as 0xAABBGGRR.
  14103. @end table
  14104. Example using metadata from @ref{signalstats} filter:
  14105. @example
  14106. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14107. @end example
  14108. Example using metadata from @ref{ebur128} filter:
  14109. @example
  14110. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14111. @end example
  14112. @anchor{ebur128}
  14113. @section ebur128
  14114. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14115. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14116. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14117. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14118. The filter also has a video output (see the @var{video} option) with a real
  14119. time graph to observe the loudness evolution. The graphic contains the logged
  14120. message mentioned above, so it is not printed anymore when this option is set,
  14121. unless the verbose logging is set. The main graphing area contains the
  14122. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14123. the momentary loudness (400 milliseconds).
  14124. More information about the Loudness Recommendation EBU R128 on
  14125. @url{http://tech.ebu.ch/loudness}.
  14126. The filter accepts the following options:
  14127. @table @option
  14128. @item video
  14129. Activate the video output. The audio stream is passed unchanged whether this
  14130. option is set or no. The video stream will be the first output stream if
  14131. activated. Default is @code{0}.
  14132. @item size
  14133. Set the video size. This option is for video only. For the syntax of this
  14134. option, check the
  14135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14136. Default and minimum resolution is @code{640x480}.
  14137. @item meter
  14138. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14139. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14140. other integer value between this range is allowed.
  14141. @item metadata
  14142. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14143. into 100ms output frames, each of them containing various loudness information
  14144. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14145. Default is @code{0}.
  14146. @item framelog
  14147. Force the frame logging level.
  14148. Available values are:
  14149. @table @samp
  14150. @item info
  14151. information logging level
  14152. @item verbose
  14153. verbose logging level
  14154. @end table
  14155. By default, the logging level is set to @var{info}. If the @option{video} or
  14156. the @option{metadata} options are set, it switches to @var{verbose}.
  14157. @item peak
  14158. Set peak mode(s).
  14159. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14160. values are:
  14161. @table @samp
  14162. @item none
  14163. Disable any peak mode (default).
  14164. @item sample
  14165. Enable sample-peak mode.
  14166. Simple peak mode looking for the higher sample value. It logs a message
  14167. for sample-peak (identified by @code{SPK}).
  14168. @item true
  14169. Enable true-peak mode.
  14170. If enabled, the peak lookup is done on an over-sampled version of the input
  14171. stream for better peak accuracy. It logs a message for true-peak.
  14172. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14173. This mode requires a build with @code{libswresample}.
  14174. @end table
  14175. @item dualmono
  14176. Treat mono input files as "dual mono". If a mono file is intended for playback
  14177. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14178. If set to @code{true}, this option will compensate for this effect.
  14179. Multi-channel input files are not affected by this option.
  14180. @item panlaw
  14181. Set a specific pan law to be used for the measurement of dual mono files.
  14182. This parameter is optional, and has a default value of -3.01dB.
  14183. @end table
  14184. @subsection Examples
  14185. @itemize
  14186. @item
  14187. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14188. @example
  14189. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14190. @end example
  14191. @item
  14192. Run an analysis with @command{ffmpeg}:
  14193. @example
  14194. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14195. @end example
  14196. @end itemize
  14197. @section interleave, ainterleave
  14198. Temporally interleave frames from several inputs.
  14199. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14200. These filters read frames from several inputs and send the oldest
  14201. queued frame to the output.
  14202. Input streams must have well defined, monotonically increasing frame
  14203. timestamp values.
  14204. In order to submit one frame to output, these filters need to enqueue
  14205. at least one frame for each input, so they cannot work in case one
  14206. input is not yet terminated and will not receive incoming frames.
  14207. For example consider the case when one input is a @code{select} filter
  14208. which always drops input frames. The @code{interleave} filter will keep
  14209. reading from that input, but it will never be able to send new frames
  14210. to output until the input sends an end-of-stream signal.
  14211. Also, depending on inputs synchronization, the filters will drop
  14212. frames in case one input receives more frames than the other ones, and
  14213. the queue is already filled.
  14214. These filters accept the following options:
  14215. @table @option
  14216. @item nb_inputs, n
  14217. Set the number of different inputs, it is 2 by default.
  14218. @end table
  14219. @subsection Examples
  14220. @itemize
  14221. @item
  14222. Interleave frames belonging to different streams using @command{ffmpeg}:
  14223. @example
  14224. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14225. @end example
  14226. @item
  14227. Add flickering blur effect:
  14228. @example
  14229. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14230. @end example
  14231. @end itemize
  14232. @section metadata, ametadata
  14233. Manipulate frame metadata.
  14234. This filter accepts the following options:
  14235. @table @option
  14236. @item mode
  14237. Set mode of operation of the filter.
  14238. Can be one of the following:
  14239. @table @samp
  14240. @item select
  14241. If both @code{value} and @code{key} is set, select frames
  14242. which have such metadata. If only @code{key} is set, select
  14243. every frame that has such key in metadata.
  14244. @item add
  14245. Add new metadata @code{key} and @code{value}. If key is already available
  14246. do nothing.
  14247. @item modify
  14248. Modify value of already present key.
  14249. @item delete
  14250. If @code{value} is set, delete only keys that have such value.
  14251. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14252. the frame.
  14253. @item print
  14254. Print key and its value if metadata was found. If @code{key} is not set print all
  14255. metadata values available in frame.
  14256. @end table
  14257. @item key
  14258. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14259. @item value
  14260. Set metadata value which will be used. This option is mandatory for
  14261. @code{modify} and @code{add} mode.
  14262. @item function
  14263. Which function to use when comparing metadata value and @code{value}.
  14264. Can be one of following:
  14265. @table @samp
  14266. @item same_str
  14267. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14268. @item starts_with
  14269. Values are interpreted as strings, returns true if metadata value starts with
  14270. the @code{value} option string.
  14271. @item less
  14272. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14273. @item equal
  14274. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14275. @item greater
  14276. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14277. @item expr
  14278. Values are interpreted as floats, returns true if expression from option @code{expr}
  14279. evaluates to true.
  14280. @end table
  14281. @item expr
  14282. Set expression which is used when @code{function} is set to @code{expr}.
  14283. The expression is evaluated through the eval API and can contain the following
  14284. constants:
  14285. @table @option
  14286. @item VALUE1
  14287. Float representation of @code{value} from metadata key.
  14288. @item VALUE2
  14289. Float representation of @code{value} as supplied by user in @code{value} option.
  14290. @end table
  14291. @item file
  14292. If specified in @code{print} mode, output is written to the named file. Instead of
  14293. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14294. for standard output. If @code{file} option is not set, output is written to the log
  14295. with AV_LOG_INFO loglevel.
  14296. @end table
  14297. @subsection Examples
  14298. @itemize
  14299. @item
  14300. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14301. between 0 and 1.
  14302. @example
  14303. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14304. @end example
  14305. @item
  14306. Print silencedetect output to file @file{metadata.txt}.
  14307. @example
  14308. silencedetect,ametadata=mode=print:file=metadata.txt
  14309. @end example
  14310. @item
  14311. Direct all metadata to a pipe with file descriptor 4.
  14312. @example
  14313. metadata=mode=print:file='pipe\:4'
  14314. @end example
  14315. @end itemize
  14316. @section perms, aperms
  14317. Set read/write permissions for the output frames.
  14318. These filters are mainly aimed at developers to test direct path in the
  14319. following filter in the filtergraph.
  14320. The filters accept the following options:
  14321. @table @option
  14322. @item mode
  14323. Select the permissions mode.
  14324. It accepts the following values:
  14325. @table @samp
  14326. @item none
  14327. Do nothing. This is the default.
  14328. @item ro
  14329. Set all the output frames read-only.
  14330. @item rw
  14331. Set all the output frames directly writable.
  14332. @item toggle
  14333. Make the frame read-only if writable, and writable if read-only.
  14334. @item random
  14335. Set each output frame read-only or writable randomly.
  14336. @end table
  14337. @item seed
  14338. Set the seed for the @var{random} mode, must be an integer included between
  14339. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14340. @code{-1}, the filter will try to use a good random seed on a best effort
  14341. basis.
  14342. @end table
  14343. Note: in case of auto-inserted filter between the permission filter and the
  14344. following one, the permission might not be received as expected in that
  14345. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14346. perms/aperms filter can avoid this problem.
  14347. @section realtime, arealtime
  14348. Slow down filtering to match real time approximately.
  14349. These filters will pause the filtering for a variable amount of time to
  14350. match the output rate with the input timestamps.
  14351. They are similar to the @option{re} option to @code{ffmpeg}.
  14352. They accept the following options:
  14353. @table @option
  14354. @item limit
  14355. Time limit for the pauses. Any pause longer than that will be considered
  14356. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14357. @end table
  14358. @anchor{select}
  14359. @section select, aselect
  14360. Select frames to pass in output.
  14361. This filter accepts the following options:
  14362. @table @option
  14363. @item expr, e
  14364. Set expression, which is evaluated for each input frame.
  14365. If the expression is evaluated to zero, the frame is discarded.
  14366. If the evaluation result is negative or NaN, the frame is sent to the
  14367. first output; otherwise it is sent to the output with index
  14368. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14369. For example a value of @code{1.2} corresponds to the output with index
  14370. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14371. @item outputs, n
  14372. Set the number of outputs. The output to which to send the selected
  14373. frame is based on the result of the evaluation. Default value is 1.
  14374. @end table
  14375. The expression can contain the following constants:
  14376. @table @option
  14377. @item n
  14378. The (sequential) number of the filtered frame, starting from 0.
  14379. @item selected_n
  14380. The (sequential) number of the selected frame, starting from 0.
  14381. @item prev_selected_n
  14382. The sequential number of the last selected frame. It's NAN if undefined.
  14383. @item TB
  14384. The timebase of the input timestamps.
  14385. @item pts
  14386. The PTS (Presentation TimeStamp) of the filtered video frame,
  14387. expressed in @var{TB} units. It's NAN if undefined.
  14388. @item t
  14389. The PTS of the filtered video frame,
  14390. expressed in seconds. It's NAN if undefined.
  14391. @item prev_pts
  14392. The PTS of the previously filtered video frame. It's NAN if undefined.
  14393. @item prev_selected_pts
  14394. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14395. @item prev_selected_t
  14396. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14397. @item start_pts
  14398. The PTS of the first video frame in the video. It's NAN if undefined.
  14399. @item start_t
  14400. The time of the first video frame in the video. It's NAN if undefined.
  14401. @item pict_type @emph{(video only)}
  14402. The type of the filtered frame. It can assume one of the following
  14403. values:
  14404. @table @option
  14405. @item I
  14406. @item P
  14407. @item B
  14408. @item S
  14409. @item SI
  14410. @item SP
  14411. @item BI
  14412. @end table
  14413. @item interlace_type @emph{(video only)}
  14414. The frame interlace type. It can assume one of the following values:
  14415. @table @option
  14416. @item PROGRESSIVE
  14417. The frame is progressive (not interlaced).
  14418. @item TOPFIRST
  14419. The frame is top-field-first.
  14420. @item BOTTOMFIRST
  14421. The frame is bottom-field-first.
  14422. @end table
  14423. @item consumed_sample_n @emph{(audio only)}
  14424. the number of selected samples before the current frame
  14425. @item samples_n @emph{(audio only)}
  14426. the number of samples in the current frame
  14427. @item sample_rate @emph{(audio only)}
  14428. the input sample rate
  14429. @item key
  14430. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14431. @item pos
  14432. the position in the file of the filtered frame, -1 if the information
  14433. is not available (e.g. for synthetic video)
  14434. @item scene @emph{(video only)}
  14435. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14436. probability for the current frame to introduce a new scene, while a higher
  14437. value means the current frame is more likely to be one (see the example below)
  14438. @item concatdec_select
  14439. The concat demuxer can select only part of a concat input file by setting an
  14440. inpoint and an outpoint, but the output packets may not be entirely contained
  14441. in the selected interval. By using this variable, it is possible to skip frames
  14442. generated by the concat demuxer which are not exactly contained in the selected
  14443. interval.
  14444. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14445. and the @var{lavf.concat.duration} packet metadata values which are also
  14446. present in the decoded frames.
  14447. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14448. start_time and either the duration metadata is missing or the frame pts is less
  14449. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14450. missing.
  14451. That basically means that an input frame is selected if its pts is within the
  14452. interval set by the concat demuxer.
  14453. @end table
  14454. The default value of the select expression is "1".
  14455. @subsection Examples
  14456. @itemize
  14457. @item
  14458. Select all frames in input:
  14459. @example
  14460. select
  14461. @end example
  14462. The example above is the same as:
  14463. @example
  14464. select=1
  14465. @end example
  14466. @item
  14467. Skip all frames:
  14468. @example
  14469. select=0
  14470. @end example
  14471. @item
  14472. Select only I-frames:
  14473. @example
  14474. select='eq(pict_type\,I)'
  14475. @end example
  14476. @item
  14477. Select one frame every 100:
  14478. @example
  14479. select='not(mod(n\,100))'
  14480. @end example
  14481. @item
  14482. Select only frames contained in the 10-20 time interval:
  14483. @example
  14484. select=between(t\,10\,20)
  14485. @end example
  14486. @item
  14487. Select only I-frames contained in the 10-20 time interval:
  14488. @example
  14489. select=between(t\,10\,20)*eq(pict_type\,I)
  14490. @end example
  14491. @item
  14492. Select frames with a minimum distance of 10 seconds:
  14493. @example
  14494. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14495. @end example
  14496. @item
  14497. Use aselect to select only audio frames with samples number > 100:
  14498. @example
  14499. aselect='gt(samples_n\,100)'
  14500. @end example
  14501. @item
  14502. Create a mosaic of the first scenes:
  14503. @example
  14504. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14505. @end example
  14506. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14507. choice.
  14508. @item
  14509. Send even and odd frames to separate outputs, and compose them:
  14510. @example
  14511. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14512. @end example
  14513. @item
  14514. Select useful frames from an ffconcat file which is using inpoints and
  14515. outpoints but where the source files are not intra frame only.
  14516. @example
  14517. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14518. @end example
  14519. @end itemize
  14520. @section sendcmd, asendcmd
  14521. Send commands to filters in the filtergraph.
  14522. These filters read commands to be sent to other filters in the
  14523. filtergraph.
  14524. @code{sendcmd} must be inserted between two video filters,
  14525. @code{asendcmd} must be inserted between two audio filters, but apart
  14526. from that they act the same way.
  14527. The specification of commands can be provided in the filter arguments
  14528. with the @var{commands} option, or in a file specified by the
  14529. @var{filename} option.
  14530. These filters accept the following options:
  14531. @table @option
  14532. @item commands, c
  14533. Set the commands to be read and sent to the other filters.
  14534. @item filename, f
  14535. Set the filename of the commands to be read and sent to the other
  14536. filters.
  14537. @end table
  14538. @subsection Commands syntax
  14539. A commands description consists of a sequence of interval
  14540. specifications, comprising a list of commands to be executed when a
  14541. particular event related to that interval occurs. The occurring event
  14542. is typically the current frame time entering or leaving a given time
  14543. interval.
  14544. An interval is specified by the following syntax:
  14545. @example
  14546. @var{START}[-@var{END}] @var{COMMANDS};
  14547. @end example
  14548. The time interval is specified by the @var{START} and @var{END} times.
  14549. @var{END} is optional and defaults to the maximum time.
  14550. The current frame time is considered within the specified interval if
  14551. it is included in the interval [@var{START}, @var{END}), that is when
  14552. the time is greater or equal to @var{START} and is lesser than
  14553. @var{END}.
  14554. @var{COMMANDS} consists of a sequence of one or more command
  14555. specifications, separated by ",", relating to that interval. The
  14556. syntax of a command specification is given by:
  14557. @example
  14558. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14559. @end example
  14560. @var{FLAGS} is optional and specifies the type of events relating to
  14561. the time interval which enable sending the specified command, and must
  14562. be a non-null sequence of identifier flags separated by "+" or "|" and
  14563. enclosed between "[" and "]".
  14564. The following flags are recognized:
  14565. @table @option
  14566. @item enter
  14567. The command is sent when the current frame timestamp enters the
  14568. specified interval. In other words, the command is sent when the
  14569. previous frame timestamp was not in the given interval, and the
  14570. current is.
  14571. @item leave
  14572. The command is sent when the current frame timestamp leaves the
  14573. specified interval. In other words, the command is sent when the
  14574. previous frame timestamp was in the given interval, and the
  14575. current is not.
  14576. @end table
  14577. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14578. assumed.
  14579. @var{TARGET} specifies the target of the command, usually the name of
  14580. the filter class or a specific filter instance name.
  14581. @var{COMMAND} specifies the name of the command for the target filter.
  14582. @var{ARG} is optional and specifies the optional list of argument for
  14583. the given @var{COMMAND}.
  14584. Between one interval specification and another, whitespaces, or
  14585. sequences of characters starting with @code{#} until the end of line,
  14586. are ignored and can be used to annotate comments.
  14587. A simplified BNF description of the commands specification syntax
  14588. follows:
  14589. @example
  14590. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14591. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14592. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14593. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14594. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14595. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14596. @end example
  14597. @subsection Examples
  14598. @itemize
  14599. @item
  14600. Specify audio tempo change at second 4:
  14601. @example
  14602. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14603. @end example
  14604. @item
  14605. Target a specific filter instance:
  14606. @example
  14607. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14608. @end example
  14609. @item
  14610. Specify a list of drawtext and hue commands in a file.
  14611. @example
  14612. # show text in the interval 5-10
  14613. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14614. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14615. # desaturate the image in the interval 15-20
  14616. 15.0-20.0 [enter] hue s 0,
  14617. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14618. [leave] hue s 1,
  14619. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14620. # apply an exponential saturation fade-out effect, starting from time 25
  14621. 25 [enter] hue s exp(25-t)
  14622. @end example
  14623. A filtergraph allowing to read and process the above command list
  14624. stored in a file @file{test.cmd}, can be specified with:
  14625. @example
  14626. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14627. @end example
  14628. @end itemize
  14629. @anchor{setpts}
  14630. @section setpts, asetpts
  14631. Change the PTS (presentation timestamp) of the input frames.
  14632. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14633. This filter accepts the following options:
  14634. @table @option
  14635. @item expr
  14636. The expression which is evaluated for each frame to construct its timestamp.
  14637. @end table
  14638. The expression is evaluated through the eval API and can contain the following
  14639. constants:
  14640. @table @option
  14641. @item FRAME_RATE
  14642. frame rate, only defined for constant frame-rate video
  14643. @item PTS
  14644. The presentation timestamp in input
  14645. @item N
  14646. The count of the input frame for video or the number of consumed samples,
  14647. not including the current frame for audio, starting from 0.
  14648. @item NB_CONSUMED_SAMPLES
  14649. The number of consumed samples, not including the current frame (only
  14650. audio)
  14651. @item NB_SAMPLES, S
  14652. The number of samples in the current frame (only audio)
  14653. @item SAMPLE_RATE, SR
  14654. The audio sample rate.
  14655. @item STARTPTS
  14656. The PTS of the first frame.
  14657. @item STARTT
  14658. the time in seconds of the first frame
  14659. @item INTERLACED
  14660. State whether the current frame is interlaced.
  14661. @item T
  14662. the time in seconds of the current frame
  14663. @item POS
  14664. original position in the file of the frame, or undefined if undefined
  14665. for the current frame
  14666. @item PREV_INPTS
  14667. The previous input PTS.
  14668. @item PREV_INT
  14669. previous input time in seconds
  14670. @item PREV_OUTPTS
  14671. The previous output PTS.
  14672. @item PREV_OUTT
  14673. previous output time in seconds
  14674. @item RTCTIME
  14675. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14676. instead.
  14677. @item RTCSTART
  14678. The wallclock (RTC) time at the start of the movie in microseconds.
  14679. @item TB
  14680. The timebase of the input timestamps.
  14681. @end table
  14682. @subsection Examples
  14683. @itemize
  14684. @item
  14685. Start counting PTS from zero
  14686. @example
  14687. setpts=PTS-STARTPTS
  14688. @end example
  14689. @item
  14690. Apply fast motion effect:
  14691. @example
  14692. setpts=0.5*PTS
  14693. @end example
  14694. @item
  14695. Apply slow motion effect:
  14696. @example
  14697. setpts=2.0*PTS
  14698. @end example
  14699. @item
  14700. Set fixed rate of 25 frames per second:
  14701. @example
  14702. setpts=N/(25*TB)
  14703. @end example
  14704. @item
  14705. Set fixed rate 25 fps with some jitter:
  14706. @example
  14707. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14708. @end example
  14709. @item
  14710. Apply an offset of 10 seconds to the input PTS:
  14711. @example
  14712. setpts=PTS+10/TB
  14713. @end example
  14714. @item
  14715. Generate timestamps from a "live source" and rebase onto the current timebase:
  14716. @example
  14717. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14718. @end example
  14719. @item
  14720. Generate timestamps by counting samples:
  14721. @example
  14722. asetpts=N/SR/TB
  14723. @end example
  14724. @end itemize
  14725. @section setrange
  14726. Force color range for the output video frame.
  14727. The @code{setrange} filter marks the color range property for the
  14728. output frames. It does not change the input frame, but only sets the
  14729. corresponding property, which affects how the frame is treated by
  14730. following filters.
  14731. The filter accepts the following options:
  14732. @table @option
  14733. @item range
  14734. Available values are:
  14735. @table @samp
  14736. @item auto
  14737. Keep the same color range property.
  14738. @item unspecified, unknown
  14739. Set the color range as unspecified.
  14740. @item limited, tv, mpeg
  14741. Set the color range as limited.
  14742. @item full, pc, jpeg
  14743. Set the color range as full.
  14744. @end table
  14745. @end table
  14746. @section settb, asettb
  14747. Set the timebase to use for the output frames timestamps.
  14748. It is mainly useful for testing timebase configuration.
  14749. It accepts the following parameters:
  14750. @table @option
  14751. @item expr, tb
  14752. The expression which is evaluated into the output timebase.
  14753. @end table
  14754. The value for @option{tb} is an arithmetic expression representing a
  14755. rational. The expression can contain the constants "AVTB" (the default
  14756. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14757. audio only). Default value is "intb".
  14758. @subsection Examples
  14759. @itemize
  14760. @item
  14761. Set the timebase to 1/25:
  14762. @example
  14763. settb=expr=1/25
  14764. @end example
  14765. @item
  14766. Set the timebase to 1/10:
  14767. @example
  14768. settb=expr=0.1
  14769. @end example
  14770. @item
  14771. Set the timebase to 1001/1000:
  14772. @example
  14773. settb=1+0.001
  14774. @end example
  14775. @item
  14776. Set the timebase to 2*intb:
  14777. @example
  14778. settb=2*intb
  14779. @end example
  14780. @item
  14781. Set the default timebase value:
  14782. @example
  14783. settb=AVTB
  14784. @end example
  14785. @end itemize
  14786. @section showcqt
  14787. Convert input audio to a video output representing frequency spectrum
  14788. logarithmically using Brown-Puckette constant Q transform algorithm with
  14789. direct frequency domain coefficient calculation (but the transform itself
  14790. is not really constant Q, instead the Q factor is actually variable/clamped),
  14791. with musical tone scale, from E0 to D#10.
  14792. The filter accepts the following options:
  14793. @table @option
  14794. @item size, s
  14795. Specify the video size for the output. It must be even. For the syntax of this option,
  14796. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14797. Default value is @code{1920x1080}.
  14798. @item fps, rate, r
  14799. Set the output frame rate. Default value is @code{25}.
  14800. @item bar_h
  14801. Set the bargraph height. It must be even. Default value is @code{-1} which
  14802. computes the bargraph height automatically.
  14803. @item axis_h
  14804. Set the axis height. It must be even. Default value is @code{-1} which computes
  14805. the axis height automatically.
  14806. @item sono_h
  14807. Set the sonogram height. It must be even. Default value is @code{-1} which
  14808. computes the sonogram height automatically.
  14809. @item fullhd
  14810. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14811. instead. Default value is @code{1}.
  14812. @item sono_v, volume
  14813. Specify the sonogram volume expression. It can contain variables:
  14814. @table @option
  14815. @item bar_v
  14816. the @var{bar_v} evaluated expression
  14817. @item frequency, freq, f
  14818. the frequency where it is evaluated
  14819. @item timeclamp, tc
  14820. the value of @var{timeclamp} option
  14821. @end table
  14822. and functions:
  14823. @table @option
  14824. @item a_weighting(f)
  14825. A-weighting of equal loudness
  14826. @item b_weighting(f)
  14827. B-weighting of equal loudness
  14828. @item c_weighting(f)
  14829. C-weighting of equal loudness.
  14830. @end table
  14831. Default value is @code{16}.
  14832. @item bar_v, volume2
  14833. Specify the bargraph volume expression. It can contain variables:
  14834. @table @option
  14835. @item sono_v
  14836. the @var{sono_v} evaluated expression
  14837. @item frequency, freq, f
  14838. the frequency where it is evaluated
  14839. @item timeclamp, tc
  14840. the value of @var{timeclamp} option
  14841. @end table
  14842. and functions:
  14843. @table @option
  14844. @item a_weighting(f)
  14845. A-weighting of equal loudness
  14846. @item b_weighting(f)
  14847. B-weighting of equal loudness
  14848. @item c_weighting(f)
  14849. C-weighting of equal loudness.
  14850. @end table
  14851. Default value is @code{sono_v}.
  14852. @item sono_g, gamma
  14853. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14854. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14855. Acceptable range is @code{[1, 7]}.
  14856. @item bar_g, gamma2
  14857. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14858. @code{[1, 7]}.
  14859. @item bar_t
  14860. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14861. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14862. @item timeclamp, tc
  14863. Specify the transform timeclamp. At low frequency, there is trade-off between
  14864. accuracy in time domain and frequency domain. If timeclamp is lower,
  14865. event in time domain is represented more accurately (such as fast bass drum),
  14866. otherwise event in frequency domain is represented more accurately
  14867. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14868. @item attack
  14869. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14870. limits future samples by applying asymmetric windowing in time domain, useful
  14871. when low latency is required. Accepted range is @code{[0, 1]}.
  14872. @item basefreq
  14873. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14874. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14875. @item endfreq
  14876. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14877. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14878. @item coeffclamp
  14879. This option is deprecated and ignored.
  14880. @item tlength
  14881. Specify the transform length in time domain. Use this option to control accuracy
  14882. trade-off between time domain and frequency domain at every frequency sample.
  14883. It can contain variables:
  14884. @table @option
  14885. @item frequency, freq, f
  14886. the frequency where it is evaluated
  14887. @item timeclamp, tc
  14888. the value of @var{timeclamp} option.
  14889. @end table
  14890. Default value is @code{384*tc/(384+tc*f)}.
  14891. @item count
  14892. Specify the transform count for every video frame. Default value is @code{6}.
  14893. Acceptable range is @code{[1, 30]}.
  14894. @item fcount
  14895. Specify the transform count for every single pixel. Default value is @code{0},
  14896. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14897. @item fontfile
  14898. Specify font file for use with freetype to draw the axis. If not specified,
  14899. use embedded font. Note that drawing with font file or embedded font is not
  14900. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14901. option instead.
  14902. @item font
  14903. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14904. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14905. @item fontcolor
  14906. Specify font color expression. This is arithmetic expression that should return
  14907. integer value 0xRRGGBB. It can contain variables:
  14908. @table @option
  14909. @item frequency, freq, f
  14910. the frequency where it is evaluated
  14911. @item timeclamp, tc
  14912. the value of @var{timeclamp} option
  14913. @end table
  14914. and functions:
  14915. @table @option
  14916. @item midi(f)
  14917. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14918. @item r(x), g(x), b(x)
  14919. red, green, and blue value of intensity x.
  14920. @end table
  14921. Default value is @code{st(0, (midi(f)-59.5)/12);
  14922. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14923. r(1-ld(1)) + b(ld(1))}.
  14924. @item axisfile
  14925. Specify image file to draw the axis. This option override @var{fontfile} and
  14926. @var{fontcolor} option.
  14927. @item axis, text
  14928. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14929. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14930. Default value is @code{1}.
  14931. @item csp
  14932. Set colorspace. The accepted values are:
  14933. @table @samp
  14934. @item unspecified
  14935. Unspecified (default)
  14936. @item bt709
  14937. BT.709
  14938. @item fcc
  14939. FCC
  14940. @item bt470bg
  14941. BT.470BG or BT.601-6 625
  14942. @item smpte170m
  14943. SMPTE-170M or BT.601-6 525
  14944. @item smpte240m
  14945. SMPTE-240M
  14946. @item bt2020ncl
  14947. BT.2020 with non-constant luminance
  14948. @end table
  14949. @item cscheme
  14950. Set spectrogram color scheme. This is list of floating point values with format
  14951. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14952. The default is @code{1|0.5|0|0|0.5|1}.
  14953. @end table
  14954. @subsection Examples
  14955. @itemize
  14956. @item
  14957. Playing audio while showing the spectrum:
  14958. @example
  14959. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14960. @end example
  14961. @item
  14962. Same as above, but with frame rate 30 fps:
  14963. @example
  14964. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14965. @end example
  14966. @item
  14967. Playing at 1280x720:
  14968. @example
  14969. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14970. @end example
  14971. @item
  14972. Disable sonogram display:
  14973. @example
  14974. sono_h=0
  14975. @end example
  14976. @item
  14977. A1 and its harmonics: A1, A2, (near)E3, A3:
  14978. @example
  14979. 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),
  14980. asplit[a][out1]; [a] showcqt [out0]'
  14981. @end example
  14982. @item
  14983. Same as above, but with more accuracy in frequency domain:
  14984. @example
  14985. 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),
  14986. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14987. @end example
  14988. @item
  14989. Custom volume:
  14990. @example
  14991. bar_v=10:sono_v=bar_v*a_weighting(f)
  14992. @end example
  14993. @item
  14994. Custom gamma, now spectrum is linear to the amplitude.
  14995. @example
  14996. bar_g=2:sono_g=2
  14997. @end example
  14998. @item
  14999. Custom tlength equation:
  15000. @example
  15001. 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)))'
  15002. @end example
  15003. @item
  15004. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15005. @example
  15006. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15007. @end example
  15008. @item
  15009. Custom font using fontconfig:
  15010. @example
  15011. font='Courier New,Monospace,mono|bold'
  15012. @end example
  15013. @item
  15014. Custom frequency range with custom axis using image file:
  15015. @example
  15016. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15017. @end example
  15018. @end itemize
  15019. @section showfreqs
  15020. Convert input audio to video output representing the audio power spectrum.
  15021. Audio amplitude is on Y-axis while frequency is on X-axis.
  15022. The filter accepts the following options:
  15023. @table @option
  15024. @item size, s
  15025. Specify size of video. For the syntax of this option, check the
  15026. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15027. Default is @code{1024x512}.
  15028. @item mode
  15029. Set display mode.
  15030. This set how each frequency bin will be represented.
  15031. It accepts the following values:
  15032. @table @samp
  15033. @item line
  15034. @item bar
  15035. @item dot
  15036. @end table
  15037. Default is @code{bar}.
  15038. @item ascale
  15039. Set amplitude scale.
  15040. It accepts the following values:
  15041. @table @samp
  15042. @item lin
  15043. Linear scale.
  15044. @item sqrt
  15045. Square root scale.
  15046. @item cbrt
  15047. Cubic root scale.
  15048. @item log
  15049. Logarithmic scale.
  15050. @end table
  15051. Default is @code{log}.
  15052. @item fscale
  15053. Set frequency scale.
  15054. It accepts the following values:
  15055. @table @samp
  15056. @item lin
  15057. Linear scale.
  15058. @item log
  15059. Logarithmic scale.
  15060. @item rlog
  15061. Reverse logarithmic scale.
  15062. @end table
  15063. Default is @code{lin}.
  15064. @item win_size
  15065. Set window size.
  15066. It accepts the following values:
  15067. @table @samp
  15068. @item w16
  15069. @item w32
  15070. @item w64
  15071. @item w128
  15072. @item w256
  15073. @item w512
  15074. @item w1024
  15075. @item w2048
  15076. @item w4096
  15077. @item w8192
  15078. @item w16384
  15079. @item w32768
  15080. @item w65536
  15081. @end table
  15082. Default is @code{w2048}
  15083. @item win_func
  15084. Set windowing function.
  15085. It accepts the following values:
  15086. @table @samp
  15087. @item rect
  15088. @item bartlett
  15089. @item hanning
  15090. @item hamming
  15091. @item blackman
  15092. @item welch
  15093. @item flattop
  15094. @item bharris
  15095. @item bnuttall
  15096. @item bhann
  15097. @item sine
  15098. @item nuttall
  15099. @item lanczos
  15100. @item gauss
  15101. @item tukey
  15102. @item dolph
  15103. @item cauchy
  15104. @item parzen
  15105. @item poisson
  15106. @end table
  15107. Default is @code{hanning}.
  15108. @item overlap
  15109. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15110. which means optimal overlap for selected window function will be picked.
  15111. @item averaging
  15112. Set time averaging. Setting this to 0 will display current maximal peaks.
  15113. Default is @code{1}, which means time averaging is disabled.
  15114. @item colors
  15115. Specify list of colors separated by space or by '|' which will be used to
  15116. draw channel frequencies. Unrecognized or missing colors will be replaced
  15117. by white color.
  15118. @item cmode
  15119. Set channel display mode.
  15120. It accepts the following values:
  15121. @table @samp
  15122. @item combined
  15123. @item separate
  15124. @end table
  15125. Default is @code{combined}.
  15126. @item minamp
  15127. Set minimum amplitude used in @code{log} amplitude scaler.
  15128. @end table
  15129. @anchor{showspectrum}
  15130. @section showspectrum
  15131. Convert input audio to a video output, representing the audio frequency
  15132. spectrum.
  15133. The filter accepts the following options:
  15134. @table @option
  15135. @item size, s
  15136. Specify the video size for the output. For the syntax of this option, check the
  15137. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15138. Default value is @code{640x512}.
  15139. @item slide
  15140. Specify how the spectrum should slide along the window.
  15141. It accepts the following values:
  15142. @table @samp
  15143. @item replace
  15144. the samples start again on the left when they reach the right
  15145. @item scroll
  15146. the samples scroll from right to left
  15147. @item fullframe
  15148. frames are only produced when the samples reach the right
  15149. @item rscroll
  15150. the samples scroll from left to right
  15151. @end table
  15152. Default value is @code{replace}.
  15153. @item mode
  15154. Specify display mode.
  15155. It accepts the following values:
  15156. @table @samp
  15157. @item combined
  15158. all channels are displayed in the same row
  15159. @item separate
  15160. all channels are displayed in separate rows
  15161. @end table
  15162. Default value is @samp{combined}.
  15163. @item color
  15164. Specify display color mode.
  15165. It accepts the following values:
  15166. @table @samp
  15167. @item channel
  15168. each channel is displayed in a separate color
  15169. @item intensity
  15170. each channel is displayed using the same color scheme
  15171. @item rainbow
  15172. each channel is displayed using the rainbow color scheme
  15173. @item moreland
  15174. each channel is displayed using the moreland color scheme
  15175. @item nebulae
  15176. each channel is displayed using the nebulae color scheme
  15177. @item fire
  15178. each channel is displayed using the fire color scheme
  15179. @item fiery
  15180. each channel is displayed using the fiery color scheme
  15181. @item fruit
  15182. each channel is displayed using the fruit color scheme
  15183. @item cool
  15184. each channel is displayed using the cool color scheme
  15185. @end table
  15186. Default value is @samp{channel}.
  15187. @item scale
  15188. Specify scale used for calculating intensity color values.
  15189. It accepts the following values:
  15190. @table @samp
  15191. @item lin
  15192. linear
  15193. @item sqrt
  15194. square root, default
  15195. @item cbrt
  15196. cubic root
  15197. @item log
  15198. logarithmic
  15199. @item 4thrt
  15200. 4th root
  15201. @item 5thrt
  15202. 5th root
  15203. @end table
  15204. Default value is @samp{sqrt}.
  15205. @item saturation
  15206. Set saturation modifier for displayed colors. Negative values provide
  15207. alternative color scheme. @code{0} is no saturation at all.
  15208. Saturation must be in [-10.0, 10.0] range.
  15209. Default value is @code{1}.
  15210. @item win_func
  15211. Set window function.
  15212. It accepts the following values:
  15213. @table @samp
  15214. @item rect
  15215. @item bartlett
  15216. @item hann
  15217. @item hanning
  15218. @item hamming
  15219. @item blackman
  15220. @item welch
  15221. @item flattop
  15222. @item bharris
  15223. @item bnuttall
  15224. @item bhann
  15225. @item sine
  15226. @item nuttall
  15227. @item lanczos
  15228. @item gauss
  15229. @item tukey
  15230. @item dolph
  15231. @item cauchy
  15232. @item parzen
  15233. @item poisson
  15234. @end table
  15235. Default value is @code{hann}.
  15236. @item orientation
  15237. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15238. @code{horizontal}. Default is @code{vertical}.
  15239. @item overlap
  15240. Set ratio of overlap window. Default value is @code{0}.
  15241. When value is @code{1} overlap is set to recommended size for specific
  15242. window function currently used.
  15243. @item gain
  15244. Set scale gain for calculating intensity color values.
  15245. Default value is @code{1}.
  15246. @item data
  15247. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15248. @item rotation
  15249. Set color rotation, must be in [-1.0, 1.0] range.
  15250. Default value is @code{0}.
  15251. @end table
  15252. The usage is very similar to the showwaves filter; see the examples in that
  15253. section.
  15254. @subsection Examples
  15255. @itemize
  15256. @item
  15257. Large window with logarithmic color scaling:
  15258. @example
  15259. showspectrum=s=1280x480:scale=log
  15260. @end example
  15261. @item
  15262. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15263. @example
  15264. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15265. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15266. @end example
  15267. @end itemize
  15268. @section showspectrumpic
  15269. Convert input audio to a single video frame, representing the audio frequency
  15270. spectrum.
  15271. The filter accepts the following options:
  15272. @table @option
  15273. @item size, s
  15274. Specify the video size for the output. For the syntax of this option, check the
  15275. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15276. Default value is @code{4096x2048}.
  15277. @item mode
  15278. Specify display mode.
  15279. It accepts the following values:
  15280. @table @samp
  15281. @item combined
  15282. all channels are displayed in the same row
  15283. @item separate
  15284. all channels are displayed in separate rows
  15285. @end table
  15286. Default value is @samp{combined}.
  15287. @item color
  15288. Specify display color mode.
  15289. It accepts the following values:
  15290. @table @samp
  15291. @item channel
  15292. each channel is displayed in a separate color
  15293. @item intensity
  15294. each channel is displayed using the same color scheme
  15295. @item rainbow
  15296. each channel is displayed using the rainbow color scheme
  15297. @item moreland
  15298. each channel is displayed using the moreland color scheme
  15299. @item nebulae
  15300. each channel is displayed using the nebulae color scheme
  15301. @item fire
  15302. each channel is displayed using the fire color scheme
  15303. @item fiery
  15304. each channel is displayed using the fiery color scheme
  15305. @item fruit
  15306. each channel is displayed using the fruit color scheme
  15307. @item cool
  15308. each channel is displayed using the cool color scheme
  15309. @end table
  15310. Default value is @samp{intensity}.
  15311. @item scale
  15312. Specify scale used for calculating intensity color values.
  15313. It accepts the following values:
  15314. @table @samp
  15315. @item lin
  15316. linear
  15317. @item sqrt
  15318. square root, default
  15319. @item cbrt
  15320. cubic root
  15321. @item log
  15322. logarithmic
  15323. @item 4thrt
  15324. 4th root
  15325. @item 5thrt
  15326. 5th root
  15327. @end table
  15328. Default value is @samp{log}.
  15329. @item saturation
  15330. Set saturation modifier for displayed colors. Negative values provide
  15331. alternative color scheme. @code{0} is no saturation at all.
  15332. Saturation must be in [-10.0, 10.0] range.
  15333. Default value is @code{1}.
  15334. @item win_func
  15335. Set window function.
  15336. It accepts the following values:
  15337. @table @samp
  15338. @item rect
  15339. @item bartlett
  15340. @item hann
  15341. @item hanning
  15342. @item hamming
  15343. @item blackman
  15344. @item welch
  15345. @item flattop
  15346. @item bharris
  15347. @item bnuttall
  15348. @item bhann
  15349. @item sine
  15350. @item nuttall
  15351. @item lanczos
  15352. @item gauss
  15353. @item tukey
  15354. @item dolph
  15355. @item cauchy
  15356. @item parzen
  15357. @item poisson
  15358. @end table
  15359. Default value is @code{hann}.
  15360. @item orientation
  15361. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15362. @code{horizontal}. Default is @code{vertical}.
  15363. @item gain
  15364. Set scale gain for calculating intensity color values.
  15365. Default value is @code{1}.
  15366. @item legend
  15367. Draw time and frequency axes and legends. Default is enabled.
  15368. @item rotation
  15369. Set color rotation, must be in [-1.0, 1.0] range.
  15370. Default value is @code{0}.
  15371. @end table
  15372. @subsection Examples
  15373. @itemize
  15374. @item
  15375. Extract an audio spectrogram of a whole audio track
  15376. in a 1024x1024 picture using @command{ffmpeg}:
  15377. @example
  15378. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15379. @end example
  15380. @end itemize
  15381. @section showvolume
  15382. Convert input audio volume to a video output.
  15383. The filter accepts the following options:
  15384. @table @option
  15385. @item rate, r
  15386. Set video rate.
  15387. @item b
  15388. Set border width, allowed range is [0, 5]. Default is 1.
  15389. @item w
  15390. Set channel width, allowed range is [80, 8192]. Default is 400.
  15391. @item h
  15392. Set channel height, allowed range is [1, 900]. Default is 20.
  15393. @item f
  15394. Set fade, allowed range is [0, 1]. Default is 0.95.
  15395. @item c
  15396. Set volume color expression.
  15397. The expression can use the following variables:
  15398. @table @option
  15399. @item VOLUME
  15400. Current max volume of channel in dB.
  15401. @item PEAK
  15402. Current peak.
  15403. @item CHANNEL
  15404. Current channel number, starting from 0.
  15405. @end table
  15406. @item t
  15407. If set, displays channel names. Default is enabled.
  15408. @item v
  15409. If set, displays volume values. Default is enabled.
  15410. @item o
  15411. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15412. default is @code{h}.
  15413. @item s
  15414. Set step size, allowed range is [0, 5]. Default is 0, which means
  15415. step is disabled.
  15416. @item p
  15417. Set background opacity, allowed range is [0, 1]. Default is 0.
  15418. @item m
  15419. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15420. default is @code{p}.
  15421. @item ds
  15422. Set display scale, can be linear: @code{lin} or log: @code{log},
  15423. default is @code{lin}.
  15424. @item dm
  15425. In second.
  15426. If set to > 0., display a line for the max level
  15427. in the previous seconds.
  15428. default is disabled: @code{0.}
  15429. @item dmc
  15430. The color of the max line. Use when @code{dm} option is set to > 0.
  15431. default is: @code{orange}
  15432. @end table
  15433. @section showwaves
  15434. Convert input audio to a video output, representing the samples waves.
  15435. The filter accepts the following options:
  15436. @table @option
  15437. @item size, s
  15438. Specify the video size for the output. For the syntax of this option, check the
  15439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15440. Default value is @code{600x240}.
  15441. @item mode
  15442. Set display mode.
  15443. Available values are:
  15444. @table @samp
  15445. @item point
  15446. Draw a point for each sample.
  15447. @item line
  15448. Draw a vertical line for each sample.
  15449. @item p2p
  15450. Draw a point for each sample and a line between them.
  15451. @item cline
  15452. Draw a centered vertical line for each sample.
  15453. @end table
  15454. Default value is @code{point}.
  15455. @item n
  15456. Set the number of samples which are printed on the same column. A
  15457. larger value will decrease the frame rate. Must be a positive
  15458. integer. This option can be set only if the value for @var{rate}
  15459. is not explicitly specified.
  15460. @item rate, r
  15461. Set the (approximate) output frame rate. This is done by setting the
  15462. option @var{n}. Default value is "25".
  15463. @item split_channels
  15464. Set if channels should be drawn separately or overlap. Default value is 0.
  15465. @item colors
  15466. Set colors separated by '|' which are going to be used for drawing of each channel.
  15467. @item scale
  15468. Set amplitude scale.
  15469. Available values are:
  15470. @table @samp
  15471. @item lin
  15472. Linear.
  15473. @item log
  15474. Logarithmic.
  15475. @item sqrt
  15476. Square root.
  15477. @item cbrt
  15478. Cubic root.
  15479. @end table
  15480. Default is linear.
  15481. @item draw
  15482. Set the draw mode. This is mostly useful to set for high @var{n}.
  15483. Available values are:
  15484. @table @samp
  15485. @item scale
  15486. Scale pixel values for each drawn sample.
  15487. @item full
  15488. Draw every sample directly.
  15489. @end table
  15490. Default value is @code{scale}.
  15491. @end table
  15492. @subsection Examples
  15493. @itemize
  15494. @item
  15495. Output the input file audio and the corresponding video representation
  15496. at the same time:
  15497. @example
  15498. amovie=a.mp3,asplit[out0],showwaves[out1]
  15499. @end example
  15500. @item
  15501. Create a synthetic signal and show it with showwaves, forcing a
  15502. frame rate of 30 frames per second:
  15503. @example
  15504. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15505. @end example
  15506. @end itemize
  15507. @section showwavespic
  15508. Convert input audio to a single video frame, representing the samples waves.
  15509. The filter accepts the following options:
  15510. @table @option
  15511. @item size, s
  15512. Specify the video size for the output. For the syntax of this option, check the
  15513. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15514. Default value is @code{600x240}.
  15515. @item split_channels
  15516. Set if channels should be drawn separately or overlap. Default value is 0.
  15517. @item colors
  15518. Set colors separated by '|' which are going to be used for drawing of each channel.
  15519. @item scale
  15520. Set amplitude scale.
  15521. Available values are:
  15522. @table @samp
  15523. @item lin
  15524. Linear.
  15525. @item log
  15526. Logarithmic.
  15527. @item sqrt
  15528. Square root.
  15529. @item cbrt
  15530. Cubic root.
  15531. @end table
  15532. Default is linear.
  15533. @end table
  15534. @subsection Examples
  15535. @itemize
  15536. @item
  15537. Extract a channel split representation of the wave form of a whole audio track
  15538. in a 1024x800 picture using @command{ffmpeg}:
  15539. @example
  15540. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15541. @end example
  15542. @end itemize
  15543. @section sidedata, asidedata
  15544. Delete frame side data, or select frames based on it.
  15545. This filter accepts the following options:
  15546. @table @option
  15547. @item mode
  15548. Set mode of operation of the filter.
  15549. Can be one of the following:
  15550. @table @samp
  15551. @item select
  15552. Select every frame with side data of @code{type}.
  15553. @item delete
  15554. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15555. data in the frame.
  15556. @end table
  15557. @item type
  15558. Set side data type used with all modes. Must be set for @code{select} mode. For
  15559. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15560. in @file{libavutil/frame.h}. For example, to choose
  15561. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15562. @end table
  15563. @section spectrumsynth
  15564. Sythesize audio from 2 input video spectrums, first input stream represents
  15565. magnitude across time and second represents phase across time.
  15566. The filter will transform from frequency domain as displayed in videos back
  15567. to time domain as presented in audio output.
  15568. This filter is primarily created for reversing processed @ref{showspectrum}
  15569. filter outputs, but can synthesize sound from other spectrograms too.
  15570. But in such case results are going to be poor if the phase data is not
  15571. available, because in such cases phase data need to be recreated, usually
  15572. its just recreated from random noise.
  15573. For best results use gray only output (@code{channel} color mode in
  15574. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15575. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15576. @code{data} option. Inputs videos should generally use @code{fullframe}
  15577. slide mode as that saves resources needed for decoding video.
  15578. The filter accepts the following options:
  15579. @table @option
  15580. @item sample_rate
  15581. Specify sample rate of output audio, the sample rate of audio from which
  15582. spectrum was generated may differ.
  15583. @item channels
  15584. Set number of channels represented in input video spectrums.
  15585. @item scale
  15586. Set scale which was used when generating magnitude input spectrum.
  15587. Can be @code{lin} or @code{log}. Default is @code{log}.
  15588. @item slide
  15589. Set slide which was used when generating inputs spectrums.
  15590. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15591. Default is @code{fullframe}.
  15592. @item win_func
  15593. Set window function used for resynthesis.
  15594. @item overlap
  15595. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15596. which means optimal overlap for selected window function will be picked.
  15597. @item orientation
  15598. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15599. Default is @code{vertical}.
  15600. @end table
  15601. @subsection Examples
  15602. @itemize
  15603. @item
  15604. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15605. then resynthesize videos back to audio with spectrumsynth:
  15606. @example
  15607. 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
  15608. 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
  15609. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15610. @end example
  15611. @end itemize
  15612. @section split, asplit
  15613. Split input into several identical outputs.
  15614. @code{asplit} works with audio input, @code{split} with video.
  15615. The filter accepts a single parameter which specifies the number of outputs. If
  15616. unspecified, it defaults to 2.
  15617. @subsection Examples
  15618. @itemize
  15619. @item
  15620. Create two separate outputs from the same input:
  15621. @example
  15622. [in] split [out0][out1]
  15623. @end example
  15624. @item
  15625. To create 3 or more outputs, you need to specify the number of
  15626. outputs, like in:
  15627. @example
  15628. [in] asplit=3 [out0][out1][out2]
  15629. @end example
  15630. @item
  15631. Create two separate outputs from the same input, one cropped and
  15632. one padded:
  15633. @example
  15634. [in] split [splitout1][splitout2];
  15635. [splitout1] crop=100:100:0:0 [cropout];
  15636. [splitout2] pad=200:200:100:100 [padout];
  15637. @end example
  15638. @item
  15639. Create 5 copies of the input audio with @command{ffmpeg}:
  15640. @example
  15641. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15642. @end example
  15643. @end itemize
  15644. @section zmq, azmq
  15645. Receive commands sent through a libzmq client, and forward them to
  15646. filters in the filtergraph.
  15647. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15648. must be inserted between two video filters, @code{azmq} between two
  15649. audio filters. Both are capable to send messages to any filter type.
  15650. To enable these filters you need to install the libzmq library and
  15651. headers and configure FFmpeg with @code{--enable-libzmq}.
  15652. For more information about libzmq see:
  15653. @url{http://www.zeromq.org/}
  15654. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15655. receives messages sent through a network interface defined by the
  15656. @option{bind_address} (or the abbreviation "@option{b}") option.
  15657. Default value of this option is @file{tcp://localhost:5555}. You may
  15658. want to alter this value to your needs, but do not forget to escape any
  15659. ':' signs (see @ref{filtergraph escaping}).
  15660. The received message must be in the form:
  15661. @example
  15662. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15663. @end example
  15664. @var{TARGET} specifies the target of the command, usually the name of
  15665. the filter class or a specific filter instance name. The default
  15666. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15667. but you can override this by using the @samp{filter_name@@id} syntax
  15668. (see @ref{Filtergraph syntax}).
  15669. @var{COMMAND} specifies the name of the command for the target filter.
  15670. @var{ARG} is optional and specifies the optional argument list for the
  15671. given @var{COMMAND}.
  15672. Upon reception, the message is processed and the corresponding command
  15673. is injected into the filtergraph. Depending on the result, the filter
  15674. will send a reply to the client, adopting the format:
  15675. @example
  15676. @var{ERROR_CODE} @var{ERROR_REASON}
  15677. @var{MESSAGE}
  15678. @end example
  15679. @var{MESSAGE} is optional.
  15680. @subsection Examples
  15681. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15682. be used to send commands processed by these filters.
  15683. Consider the following filtergraph generated by @command{ffplay}.
  15684. In this example the last overlay filter has an instance name. All other
  15685. filters will have default instance names.
  15686. @example
  15687. ffplay -dumpgraph 1 -f lavfi "
  15688. color=s=100x100:c=red [l];
  15689. color=s=100x100:c=blue [r];
  15690. nullsrc=s=200x100, zmq [bg];
  15691. [bg][l] overlay [bg+l];
  15692. [bg+l][r] overlay@@my=x=100 "
  15693. @end example
  15694. To change the color of the left side of the video, the following
  15695. command can be used:
  15696. @example
  15697. echo Parsed_color_0 c yellow | tools/zmqsend
  15698. @end example
  15699. To change the right side:
  15700. @example
  15701. echo Parsed_color_1 c pink | tools/zmqsend
  15702. @end example
  15703. To change the position of the right side:
  15704. @example
  15705. echo overlay@@my x 150 | tools/zmqsend
  15706. @end example
  15707. @c man end MULTIMEDIA FILTERS
  15708. @chapter Multimedia Sources
  15709. @c man begin MULTIMEDIA SOURCES
  15710. Below is a description of the currently available multimedia sources.
  15711. @section amovie
  15712. This is the same as @ref{movie} source, except it selects an audio
  15713. stream by default.
  15714. @anchor{movie}
  15715. @section movie
  15716. Read audio and/or video stream(s) from a movie container.
  15717. It accepts the following parameters:
  15718. @table @option
  15719. @item filename
  15720. The name of the resource to read (not necessarily a file; it can also be a
  15721. device or a stream accessed through some protocol).
  15722. @item format_name, f
  15723. Specifies the format assumed for the movie to read, and can be either
  15724. the name of a container or an input device. If not specified, the
  15725. format is guessed from @var{movie_name} or by probing.
  15726. @item seek_point, sp
  15727. Specifies the seek point in seconds. The frames will be output
  15728. starting from this seek point. The parameter is evaluated with
  15729. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15730. postfix. The default value is "0".
  15731. @item streams, s
  15732. Specifies the streams to read. Several streams can be specified,
  15733. separated by "+". The source will then have as many outputs, in the
  15734. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15735. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15736. respectively the default (best suited) video and audio stream. Default
  15737. is "dv", or "da" if the filter is called as "amovie".
  15738. @item stream_index, si
  15739. Specifies the index of the video stream to read. If the value is -1,
  15740. the most suitable video stream will be automatically selected. The default
  15741. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15742. audio instead of video.
  15743. @item loop
  15744. Specifies how many times to read the stream in sequence.
  15745. If the value is 0, the stream will be looped infinitely.
  15746. Default value is "1".
  15747. Note that when the movie is looped the source timestamps are not
  15748. changed, so it will generate non monotonically increasing timestamps.
  15749. @item discontinuity
  15750. Specifies the time difference between frames above which the point is
  15751. considered a timestamp discontinuity which is removed by adjusting the later
  15752. timestamps.
  15753. @end table
  15754. It allows overlaying a second video on top of the main input of
  15755. a filtergraph, as shown in this graph:
  15756. @example
  15757. input -----------> deltapts0 --> overlay --> output
  15758. ^
  15759. |
  15760. movie --> scale--> deltapts1 -------+
  15761. @end example
  15762. @subsection Examples
  15763. @itemize
  15764. @item
  15765. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15766. on top of the input labelled "in":
  15767. @example
  15768. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15769. [in] setpts=PTS-STARTPTS [main];
  15770. [main][over] overlay=16:16 [out]
  15771. @end example
  15772. @item
  15773. Read from a video4linux2 device, and overlay it on top of the input
  15774. labelled "in":
  15775. @example
  15776. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15777. [in] setpts=PTS-STARTPTS [main];
  15778. [main][over] overlay=16:16 [out]
  15779. @end example
  15780. @item
  15781. Read the first video stream and the audio stream with id 0x81 from
  15782. dvd.vob; the video is connected to the pad named "video" and the audio is
  15783. connected to the pad named "audio":
  15784. @example
  15785. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15786. @end example
  15787. @end itemize
  15788. @subsection Commands
  15789. Both movie and amovie support the following commands:
  15790. @table @option
  15791. @item seek
  15792. Perform seek using "av_seek_frame".
  15793. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15794. @itemize
  15795. @item
  15796. @var{stream_index}: If stream_index is -1, a default
  15797. stream is selected, and @var{timestamp} is automatically converted
  15798. from AV_TIME_BASE units to the stream specific time_base.
  15799. @item
  15800. @var{timestamp}: Timestamp in AVStream.time_base units
  15801. or, if no stream is specified, in AV_TIME_BASE units.
  15802. @item
  15803. @var{flags}: Flags which select direction and seeking mode.
  15804. @end itemize
  15805. @item get_duration
  15806. Get movie duration in AV_TIME_BASE units.
  15807. @end table
  15808. @c man end MULTIMEDIA SOURCES