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.

19740 lines
524KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @end table
  885. @item width, w
  886. Specify the band-width of a filter in width_type units.
  887. @item channels, c
  888. Specify which channels to filter, by default all available are filtered.
  889. @end table
  890. @section aloop
  891. Loop audio samples.
  892. The filter accepts the following options:
  893. @table @option
  894. @item loop
  895. Set the number of loops. Setting this value to -1 will result in infinite loops.
  896. Default is 0.
  897. @item size
  898. Set maximal number of samples. Default is 0.
  899. @item start
  900. Set first sample of loop. Default is 0.
  901. @end table
  902. @anchor{amerge}
  903. @section amerge
  904. Merge two or more audio streams into a single multi-channel stream.
  905. The filter accepts the following options:
  906. @table @option
  907. @item inputs
  908. Set the number of inputs. Default is 2.
  909. @end table
  910. If the channel layouts of the inputs are disjoint, and therefore compatible,
  911. the channel layout of the output will be set accordingly and the channels
  912. will be reordered as necessary. If the channel layouts of the inputs are not
  913. disjoint, the output will have all the channels of the first input then all
  914. the channels of the second input, in that order, and the channel layout of
  915. the output will be the default value corresponding to the total number of
  916. channels.
  917. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  918. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  919. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  920. first input, b1 is the first channel of the second input).
  921. On the other hand, if both input are in stereo, the output channels will be
  922. in the default order: a1, a2, b1, b2, and the channel layout will be
  923. arbitrarily set to 4.0, which may or may not be the expected value.
  924. All inputs must have the same sample rate, and format.
  925. If inputs do not have the same duration, the output will stop with the
  926. shortest.
  927. @subsection Examples
  928. @itemize
  929. @item
  930. Merge two mono files into a stereo stream:
  931. @example
  932. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  933. @end example
  934. @item
  935. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  936. @example
  937. 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
  938. @end example
  939. @end itemize
  940. @section amix
  941. Mixes multiple audio inputs into a single output.
  942. Note that this filter only supports float samples (the @var{amerge}
  943. and @var{pan} audio filters support many formats). If the @var{amix}
  944. input has integer samples then @ref{aresample} will be automatically
  945. inserted to perform the conversion to float samples.
  946. For example
  947. @example
  948. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  949. @end example
  950. will mix 3 input audio streams to a single output with the same duration as the
  951. first input and a dropout transition time of 3 seconds.
  952. It accepts the following parameters:
  953. @table @option
  954. @item inputs
  955. The number of inputs. If unspecified, it defaults to 2.
  956. @item duration
  957. How to determine the end-of-stream.
  958. @table @option
  959. @item longest
  960. The duration of the longest input. (default)
  961. @item shortest
  962. The duration of the shortest input.
  963. @item first
  964. The duration of the first input.
  965. @end table
  966. @item dropout_transition
  967. The transition time, in seconds, for volume renormalization when an input
  968. stream ends. The default value is 2 seconds.
  969. @end table
  970. @section anequalizer
  971. High-order parametric multiband equalizer for each channel.
  972. It accepts the following parameters:
  973. @table @option
  974. @item params
  975. This option string is in format:
  976. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  977. Each equalizer band is separated by '|'.
  978. @table @option
  979. @item chn
  980. Set channel number to which equalization will be applied.
  981. If input doesn't have that channel the entry is ignored.
  982. @item f
  983. Set central frequency for band.
  984. If input doesn't have that frequency the entry is ignored.
  985. @item w
  986. Set band width in hertz.
  987. @item g
  988. Set band gain in dB.
  989. @item t
  990. Set filter type for band, optional, can be:
  991. @table @samp
  992. @item 0
  993. Butterworth, this is default.
  994. @item 1
  995. Chebyshev type 1.
  996. @item 2
  997. Chebyshev type 2.
  998. @end table
  999. @end table
  1000. @item curves
  1001. With this option activated frequency response of anequalizer is displayed
  1002. in video stream.
  1003. @item size
  1004. Set video stream size. Only useful if curves option is activated.
  1005. @item mgain
  1006. Set max gain that will be displayed. Only useful if curves option is activated.
  1007. Setting this to a reasonable value makes it possible to display gain which is derived from
  1008. neighbour bands which are too close to each other and thus produce higher gain
  1009. when both are activated.
  1010. @item fscale
  1011. Set frequency scale used to draw frequency response in video output.
  1012. Can be linear or logarithmic. Default is logarithmic.
  1013. @item colors
  1014. Set color for each channel curve which is going to be displayed in video stream.
  1015. This is list of color names separated by space or by '|'.
  1016. Unrecognised or missing colors will be replaced by white color.
  1017. @end table
  1018. @subsection Examples
  1019. @itemize
  1020. @item
  1021. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1022. for first 2 channels using Chebyshev type 1 filter:
  1023. @example
  1024. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1025. @end example
  1026. @end itemize
  1027. @subsection Commands
  1028. This filter supports the following commands:
  1029. @table @option
  1030. @item change
  1031. Alter existing filter parameters.
  1032. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1033. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1034. error is returned.
  1035. @var{freq} set new frequency parameter.
  1036. @var{width} set new width parameter in herz.
  1037. @var{gain} set new gain parameter in dB.
  1038. Full filter invocation with asendcmd may look like this:
  1039. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1040. @end table
  1041. @section anull
  1042. Pass the audio source unchanged to the output.
  1043. @section apad
  1044. Pad the end of an audio stream with silence.
  1045. This can be used together with @command{ffmpeg} @option{-shortest} to
  1046. extend audio streams to the same length as the video stream.
  1047. A description of the accepted options follows.
  1048. @table @option
  1049. @item packet_size
  1050. Set silence packet size. Default value is 4096.
  1051. @item pad_len
  1052. Set the number of samples of silence to add to the end. After the
  1053. value is reached, the stream is terminated. This option is mutually
  1054. exclusive with @option{whole_len}.
  1055. @item whole_len
  1056. Set the minimum total number of samples in the output audio stream. If
  1057. the value is longer than the input audio length, silence is added to
  1058. the end, until the value is reached. This option is mutually exclusive
  1059. with @option{pad_len}.
  1060. @end table
  1061. If neither the @option{pad_len} nor the @option{whole_len} option is
  1062. set, the filter will add silence to the end of the input stream
  1063. indefinitely.
  1064. @subsection Examples
  1065. @itemize
  1066. @item
  1067. Add 1024 samples of silence to the end of the input:
  1068. @example
  1069. apad=pad_len=1024
  1070. @end example
  1071. @item
  1072. Make sure the audio output will contain at least 10000 samples, pad
  1073. the input with silence if required:
  1074. @example
  1075. apad=whole_len=10000
  1076. @end example
  1077. @item
  1078. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1079. video stream will always result the shortest and will be converted
  1080. until the end in the output file when using the @option{shortest}
  1081. option:
  1082. @example
  1083. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1084. @end example
  1085. @end itemize
  1086. @section aphaser
  1087. Add a phasing effect to the input audio.
  1088. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1089. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1090. A description of the accepted parameters follows.
  1091. @table @option
  1092. @item in_gain
  1093. Set input gain. Default is 0.4.
  1094. @item out_gain
  1095. Set output gain. Default is 0.74
  1096. @item delay
  1097. Set delay in milliseconds. Default is 3.0.
  1098. @item decay
  1099. Set decay. Default is 0.4.
  1100. @item speed
  1101. Set modulation speed in Hz. Default is 0.5.
  1102. @item type
  1103. Set modulation type. Default is triangular.
  1104. It accepts the following values:
  1105. @table @samp
  1106. @item triangular, t
  1107. @item sinusoidal, s
  1108. @end table
  1109. @end table
  1110. @section apulsator
  1111. Audio pulsator is something between an autopanner and a tremolo.
  1112. But it can produce funny stereo effects as well. Pulsator changes the volume
  1113. of the left and right channel based on a LFO (low frequency oscillator) with
  1114. different waveforms and shifted phases.
  1115. This filter have the ability to define an offset between left and right
  1116. channel. An offset of 0 means that both LFO shapes match each other.
  1117. The left and right channel are altered equally - a conventional tremolo.
  1118. An offset of 50% means that the shape of the right channel is exactly shifted
  1119. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1120. an autopanner. At 1 both curves match again. Every setting in between moves the
  1121. phase shift gapless between all stages and produces some "bypassing" sounds with
  1122. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1123. the 0.5) the faster the signal passes from the left to the right speaker.
  1124. The filter accepts the following options:
  1125. @table @option
  1126. @item level_in
  1127. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1128. @item level_out
  1129. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1130. @item mode
  1131. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1132. sawup or sawdown. Default is sine.
  1133. @item amount
  1134. Set modulation. Define how much of original signal is affected by the LFO.
  1135. @item offset_l
  1136. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1137. @item offset_r
  1138. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1139. @item width
  1140. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1141. @item timing
  1142. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1143. @item bpm
  1144. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1145. is set to bpm.
  1146. @item ms
  1147. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1148. is set to ms.
  1149. @item hz
  1150. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1151. if timing is set to hz.
  1152. @end table
  1153. @anchor{aresample}
  1154. @section aresample
  1155. Resample the input audio to the specified parameters, using the
  1156. libswresample library. If none are specified then the filter will
  1157. automatically convert between its input and output.
  1158. This filter is also able to stretch/squeeze the audio data to make it match
  1159. the timestamps or to inject silence / cut out audio to make it match the
  1160. timestamps, do a combination of both or do neither.
  1161. The filter accepts the syntax
  1162. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1163. expresses a sample rate and @var{resampler_options} is a list of
  1164. @var{key}=@var{value} pairs, separated by ":". See the
  1165. @ref{Resampler Options,,the "Resampler Options" section in the
  1166. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1167. for the complete list of supported options.
  1168. @subsection Examples
  1169. @itemize
  1170. @item
  1171. Resample the input audio to 44100Hz:
  1172. @example
  1173. aresample=44100
  1174. @end example
  1175. @item
  1176. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1177. samples per second compensation:
  1178. @example
  1179. aresample=async=1000
  1180. @end example
  1181. @end itemize
  1182. @section areverse
  1183. Reverse an audio clip.
  1184. Warning: This filter requires memory to buffer the entire clip, so trimming
  1185. is suggested.
  1186. @subsection Examples
  1187. @itemize
  1188. @item
  1189. Take the first 5 seconds of a clip, and reverse it.
  1190. @example
  1191. atrim=end=5,areverse
  1192. @end example
  1193. @end itemize
  1194. @section asetnsamples
  1195. Set the number of samples per each output audio frame.
  1196. The last output packet may contain a different number of samples, as
  1197. the filter will flush all the remaining samples when the input audio
  1198. signals its end.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item nb_out_samples, n
  1202. Set the number of frames per each output audio frame. The number is
  1203. intended as the number of samples @emph{per each channel}.
  1204. Default value is 1024.
  1205. @item pad, p
  1206. If set to 1, the filter will pad the last audio frame with zeroes, so
  1207. that the last frame will contain the same number of samples as the
  1208. previous ones. Default value is 1.
  1209. @end table
  1210. For example, to set the number of per-frame samples to 1234 and
  1211. disable padding for the last frame, use:
  1212. @example
  1213. asetnsamples=n=1234:p=0
  1214. @end example
  1215. @section asetrate
  1216. Set the sample rate without altering the PCM data.
  1217. This will result in a change of speed and pitch.
  1218. The filter accepts the following options:
  1219. @table @option
  1220. @item sample_rate, r
  1221. Set the output sample rate. Default is 44100 Hz.
  1222. @end table
  1223. @section ashowinfo
  1224. Show a line containing various information for each input audio frame.
  1225. The input audio is not modified.
  1226. The shown line contains a sequence of key/value pairs of the form
  1227. @var{key}:@var{value}.
  1228. The following values are shown in the output:
  1229. @table @option
  1230. @item n
  1231. The (sequential) number of the input frame, starting from 0.
  1232. @item pts
  1233. The presentation timestamp of the input frame, in time base units; the time base
  1234. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1235. @item pts_time
  1236. The presentation timestamp of the input frame in seconds.
  1237. @item pos
  1238. position of the frame in the input stream, -1 if this information in
  1239. unavailable and/or meaningless (for example in case of synthetic audio)
  1240. @item fmt
  1241. The sample format.
  1242. @item chlayout
  1243. The channel layout.
  1244. @item rate
  1245. The sample rate for the audio frame.
  1246. @item nb_samples
  1247. The number of samples (per channel) in the frame.
  1248. @item checksum
  1249. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1250. audio, the data is treated as if all the planes were concatenated.
  1251. @item plane_checksums
  1252. A list of Adler-32 checksums for each data plane.
  1253. @end table
  1254. @anchor{astats}
  1255. @section astats
  1256. Display time domain statistical information about the audio channels.
  1257. Statistics are calculated and displayed for each audio channel and,
  1258. where applicable, an overall figure is also given.
  1259. It accepts the following option:
  1260. @table @option
  1261. @item length
  1262. Short window length in seconds, used for peak and trough RMS measurement.
  1263. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1264. @item metadata
  1265. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1266. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1267. disabled.
  1268. Available keys for each channel are:
  1269. DC_offset
  1270. Min_level
  1271. Max_level
  1272. Min_difference
  1273. Max_difference
  1274. Mean_difference
  1275. RMS_difference
  1276. Peak_level
  1277. RMS_peak
  1278. RMS_trough
  1279. Crest_factor
  1280. Flat_factor
  1281. Peak_count
  1282. Bit_depth
  1283. Dynamic_range
  1284. and for Overall:
  1285. DC_offset
  1286. Min_level
  1287. Max_level
  1288. Min_difference
  1289. Max_difference
  1290. Mean_difference
  1291. RMS_difference
  1292. Peak_level
  1293. RMS_level
  1294. RMS_peak
  1295. RMS_trough
  1296. Flat_factor
  1297. Peak_count
  1298. Bit_depth
  1299. Number_of_samples
  1300. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1301. this @code{lavfi.astats.Overall.Peak_count}.
  1302. For description what each key means read below.
  1303. @item reset
  1304. Set number of frame after which stats are going to be recalculated.
  1305. Default is disabled.
  1306. @end table
  1307. A description of each shown parameter follows:
  1308. @table @option
  1309. @item DC offset
  1310. Mean amplitude displacement from zero.
  1311. @item Min level
  1312. Minimal sample level.
  1313. @item Max level
  1314. Maximal sample level.
  1315. @item Min difference
  1316. Minimal difference between two consecutive samples.
  1317. @item Max difference
  1318. Maximal difference between two consecutive samples.
  1319. @item Mean difference
  1320. Mean difference between two consecutive samples.
  1321. The average of each difference between two consecutive samples.
  1322. @item RMS difference
  1323. Root Mean Square difference between two consecutive samples.
  1324. @item Peak level dB
  1325. @item RMS level dB
  1326. Standard peak and RMS level measured in dBFS.
  1327. @item RMS peak dB
  1328. @item RMS trough dB
  1329. Peak and trough values for RMS level measured over a short window.
  1330. @item Crest factor
  1331. Standard ratio of peak to RMS level (note: not in dB).
  1332. @item Flat factor
  1333. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1334. (i.e. either @var{Min level} or @var{Max level}).
  1335. @item Peak count
  1336. Number of occasions (not the number of samples) that the signal attained either
  1337. @var{Min level} or @var{Max level}.
  1338. @item Bit depth
  1339. Overall bit depth of audio. Number of bits used for each sample.
  1340. @item Dynamic range
  1341. Measured dynamic range of audio in dB.
  1342. @end table
  1343. @section atempo
  1344. Adjust audio tempo.
  1345. The filter accepts exactly one parameter, the audio tempo. If not
  1346. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1347. be in the [0.5, 2.0] range.
  1348. @subsection Examples
  1349. @itemize
  1350. @item
  1351. Slow down audio to 80% tempo:
  1352. @example
  1353. atempo=0.8
  1354. @end example
  1355. @item
  1356. To speed up audio to 125% tempo:
  1357. @example
  1358. atempo=1.25
  1359. @end example
  1360. @end itemize
  1361. @section atrim
  1362. Trim the input so that the output contains one continuous subpart of the input.
  1363. It accepts the following parameters:
  1364. @table @option
  1365. @item start
  1366. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1367. sample with the timestamp @var{start} will be the first sample in the output.
  1368. @item end
  1369. Specify time of the first audio sample that will be dropped, i.e. the
  1370. audio sample immediately preceding the one with the timestamp @var{end} will be
  1371. the last sample in the output.
  1372. @item start_pts
  1373. Same as @var{start}, except this option sets the start timestamp in samples
  1374. instead of seconds.
  1375. @item end_pts
  1376. Same as @var{end}, except this option sets the end timestamp in samples instead
  1377. of seconds.
  1378. @item duration
  1379. The maximum duration of the output in seconds.
  1380. @item start_sample
  1381. The number of the first sample that should be output.
  1382. @item end_sample
  1383. The number of the first sample that should be dropped.
  1384. @end table
  1385. @option{start}, @option{end}, and @option{duration} are expressed as time
  1386. duration specifications; see
  1387. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1388. Note that the first two sets of the start/end options and the @option{duration}
  1389. option look at the frame timestamp, while the _sample options simply count the
  1390. samples that pass through the filter. So start/end_pts and start/end_sample will
  1391. give different results when the timestamps are wrong, inexact or do not start at
  1392. zero. Also note that this filter does not modify the timestamps. If you wish
  1393. to have the output timestamps start at zero, insert the asetpts filter after the
  1394. atrim filter.
  1395. If multiple start or end options are set, this filter tries to be greedy and
  1396. keep all samples that match at least one of the specified constraints. To keep
  1397. only the part that matches all the constraints at once, chain multiple atrim
  1398. filters.
  1399. The defaults are such that all the input is kept. So it is possible to set e.g.
  1400. just the end values to keep everything before the specified time.
  1401. Examples:
  1402. @itemize
  1403. @item
  1404. Drop everything except the second minute of input:
  1405. @example
  1406. ffmpeg -i INPUT -af atrim=60:120
  1407. @end example
  1408. @item
  1409. Keep only the first 1000 samples:
  1410. @example
  1411. ffmpeg -i INPUT -af atrim=end_sample=1000
  1412. @end example
  1413. @end itemize
  1414. @section bandpass
  1415. Apply a two-pole Butterworth band-pass filter with central
  1416. frequency @var{frequency}, and (3dB-point) band-width width.
  1417. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1418. instead of the default: constant 0dB peak gain.
  1419. The filter roll off at 6dB per octave (20dB per decade).
  1420. The filter accepts the following options:
  1421. @table @option
  1422. @item frequency, f
  1423. Set the filter's central frequency. Default is @code{3000}.
  1424. @item csg
  1425. Constant skirt gain if set to 1. Defaults to 0.
  1426. @item width_type, t
  1427. Set method to specify band-width of filter.
  1428. @table @option
  1429. @item h
  1430. Hz
  1431. @item q
  1432. Q-Factor
  1433. @item o
  1434. octave
  1435. @item s
  1436. slope
  1437. @end table
  1438. @item width, w
  1439. Specify the band-width of a filter in width_type units.
  1440. @item channels, c
  1441. Specify which channels to filter, by default all available are filtered.
  1442. @end table
  1443. @section bandreject
  1444. Apply a two-pole Butterworth band-reject filter with central
  1445. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1446. The filter roll off at 6dB per octave (20dB per decade).
  1447. The filter accepts the following options:
  1448. @table @option
  1449. @item frequency, f
  1450. Set the filter's central frequency. Default is @code{3000}.
  1451. @item width_type, t
  1452. Set method to specify band-width of filter.
  1453. @table @option
  1454. @item h
  1455. Hz
  1456. @item q
  1457. Q-Factor
  1458. @item o
  1459. octave
  1460. @item s
  1461. slope
  1462. @end table
  1463. @item width, w
  1464. Specify the band-width of a filter in width_type units.
  1465. @item channels, c
  1466. Specify which channels to filter, by default all available are filtered.
  1467. @end table
  1468. @section bass
  1469. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1470. shelving filter with a response similar to that of a standard
  1471. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1472. The filter accepts the following options:
  1473. @table @option
  1474. @item gain, g
  1475. Give the gain at 0 Hz. Its useful range is about -20
  1476. (for a large cut) to +20 (for a large boost).
  1477. Beware of clipping when using a positive gain.
  1478. @item frequency, f
  1479. Set the filter's central frequency and so can be used
  1480. to extend or reduce the frequency range to be boosted or cut.
  1481. The default value is @code{100} Hz.
  1482. @item width_type, t
  1483. Set method to specify band-width of filter.
  1484. @table @option
  1485. @item h
  1486. Hz
  1487. @item q
  1488. Q-Factor
  1489. @item o
  1490. octave
  1491. @item s
  1492. slope
  1493. @end table
  1494. @item width, w
  1495. Determine how steep is the filter's shelf transition.
  1496. @item channels, c
  1497. Specify which channels to filter, by default all available are filtered.
  1498. @end table
  1499. @section biquad
  1500. Apply a biquad IIR filter with the given coefficients.
  1501. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1502. are the numerator and denominator coefficients respectively.
  1503. and @var{channels}, @var{c} specify which channels to filter, by default all
  1504. available are filtered.
  1505. @section bs2b
  1506. Bauer stereo to binaural transformation, which improves headphone listening of
  1507. stereo audio records.
  1508. To enable compilation of this filter you need to configure FFmpeg with
  1509. @code{--enable-libbs2b}.
  1510. It accepts the following parameters:
  1511. @table @option
  1512. @item profile
  1513. Pre-defined crossfeed level.
  1514. @table @option
  1515. @item default
  1516. Default level (fcut=700, feed=50).
  1517. @item cmoy
  1518. Chu Moy circuit (fcut=700, feed=60).
  1519. @item jmeier
  1520. Jan Meier circuit (fcut=650, feed=95).
  1521. @end table
  1522. @item fcut
  1523. Cut frequency (in Hz).
  1524. @item feed
  1525. Feed level (in Hz).
  1526. @end table
  1527. @section channelmap
  1528. Remap input channels to new locations.
  1529. It accepts the following parameters:
  1530. @table @option
  1531. @item map
  1532. Map channels from input to output. The argument is a '|'-separated list of
  1533. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1534. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1535. channel (e.g. FL for front left) or its index in the input channel layout.
  1536. @var{out_channel} is the name of the output channel or its index in the output
  1537. channel layout. If @var{out_channel} is not given then it is implicitly an
  1538. index, starting with zero and increasing by one for each mapping.
  1539. @item channel_layout
  1540. The channel layout of the output stream.
  1541. @end table
  1542. If no mapping is present, the filter will implicitly map input channels to
  1543. output channels, preserving indices.
  1544. For example, assuming a 5.1+downmix input MOV file,
  1545. @example
  1546. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1547. @end example
  1548. will create an output WAV file tagged as stereo from the downmix channels of
  1549. the input.
  1550. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1551. @example
  1552. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1553. @end example
  1554. @section channelsplit
  1555. Split each channel from an input audio stream into a separate output stream.
  1556. It accepts the following parameters:
  1557. @table @option
  1558. @item channel_layout
  1559. The channel layout of the input stream. The default is "stereo".
  1560. @end table
  1561. For example, assuming a stereo input MP3 file,
  1562. @example
  1563. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1564. @end example
  1565. will create an output Matroska file with two audio streams, one containing only
  1566. the left channel and the other the right channel.
  1567. Split a 5.1 WAV file into per-channel files:
  1568. @example
  1569. ffmpeg -i in.wav -filter_complex
  1570. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1571. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1572. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1573. side_right.wav
  1574. @end example
  1575. @section chorus
  1576. Add a chorus effect to the audio.
  1577. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1578. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1579. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1580. The modulation depth defines the range the modulated delay is played before or after
  1581. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1582. sound tuned around the original one, like in a chorus where some vocals are slightly
  1583. off key.
  1584. It accepts the following parameters:
  1585. @table @option
  1586. @item in_gain
  1587. Set input gain. Default is 0.4.
  1588. @item out_gain
  1589. Set output gain. Default is 0.4.
  1590. @item delays
  1591. Set delays. A typical delay is around 40ms to 60ms.
  1592. @item decays
  1593. Set decays.
  1594. @item speeds
  1595. Set speeds.
  1596. @item depths
  1597. Set depths.
  1598. @end table
  1599. @subsection Examples
  1600. @itemize
  1601. @item
  1602. A single delay:
  1603. @example
  1604. chorus=0.7:0.9:55:0.4:0.25:2
  1605. @end example
  1606. @item
  1607. Two delays:
  1608. @example
  1609. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1610. @end example
  1611. @item
  1612. Fuller sounding chorus with three delays:
  1613. @example
  1614. 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
  1615. @end example
  1616. @end itemize
  1617. @section compand
  1618. Compress or expand the audio's dynamic range.
  1619. It accepts the following parameters:
  1620. @table @option
  1621. @item attacks
  1622. @item decays
  1623. A list of times in seconds for each channel over which the instantaneous level
  1624. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1625. increase of volume and @var{decays} refers to decrease of volume. For most
  1626. situations, the attack time (response to the audio getting louder) should be
  1627. shorter than the decay time, because the human ear is more sensitive to sudden
  1628. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1629. a typical value for decay is 0.8 seconds.
  1630. If specified number of attacks & decays is lower than number of channels, the last
  1631. set attack/decay will be used for all remaining channels.
  1632. @item points
  1633. A list of points for the transfer function, specified in dB relative to the
  1634. maximum possible signal amplitude. Each key points list must be defined using
  1635. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1636. @code{x0/y0 x1/y1 x2/y2 ....}
  1637. The input values must be in strictly increasing order but the transfer function
  1638. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1639. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1640. function are @code{-70/-70|-60/-20|1/0}.
  1641. @item soft-knee
  1642. Set the curve radius in dB for all joints. It defaults to 0.01.
  1643. @item gain
  1644. Set the additional gain in dB to be applied at all points on the transfer
  1645. function. This allows for easy adjustment of the overall gain.
  1646. It defaults to 0.
  1647. @item volume
  1648. Set an initial volume, in dB, to be assumed for each channel when filtering
  1649. starts. This permits the user to supply a nominal level initially, so that, for
  1650. example, a very large gain is not applied to initial signal levels before the
  1651. companding has begun to operate. A typical value for audio which is initially
  1652. quiet is -90 dB. It defaults to 0.
  1653. @item delay
  1654. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1655. delayed before being fed to the volume adjuster. Specifying a delay
  1656. approximately equal to the attack/decay times allows the filter to effectively
  1657. operate in predictive rather than reactive mode. It defaults to 0.
  1658. @end table
  1659. @subsection Examples
  1660. @itemize
  1661. @item
  1662. Make music with both quiet and loud passages suitable for listening to in a
  1663. noisy environment:
  1664. @example
  1665. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1666. @end example
  1667. Another example for audio with whisper and explosion parts:
  1668. @example
  1669. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1670. @end example
  1671. @item
  1672. A noise gate for when the noise is at a lower level than the signal:
  1673. @example
  1674. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1675. @end example
  1676. @item
  1677. Here is another noise gate, this time for when the noise is at a higher level
  1678. than the signal (making it, in some ways, similar to squelch):
  1679. @example
  1680. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1681. @end example
  1682. @item
  1683. 2:1 compression starting at -6dB:
  1684. @example
  1685. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1686. @end example
  1687. @item
  1688. 2:1 compression starting at -9dB:
  1689. @example
  1690. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1691. @end example
  1692. @item
  1693. 2:1 compression starting at -12dB:
  1694. @example
  1695. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1696. @end example
  1697. @item
  1698. 2:1 compression starting at -18dB:
  1699. @example
  1700. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1701. @end example
  1702. @item
  1703. 3:1 compression starting at -15dB:
  1704. @example
  1705. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1706. @end example
  1707. @item
  1708. Compressor/Gate:
  1709. @example
  1710. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1711. @end example
  1712. @item
  1713. Expander:
  1714. @example
  1715. 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
  1716. @end example
  1717. @item
  1718. Hard limiter at -6dB:
  1719. @example
  1720. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1721. @end example
  1722. @item
  1723. Hard limiter at -12dB:
  1724. @example
  1725. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1726. @end example
  1727. @item
  1728. Hard noise gate at -35 dB:
  1729. @example
  1730. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1731. @end example
  1732. @item
  1733. Soft limiter:
  1734. @example
  1735. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1736. @end example
  1737. @end itemize
  1738. @section compensationdelay
  1739. Compensation Delay Line is a metric based delay to compensate differing
  1740. positions of microphones or speakers.
  1741. For example, you have recorded guitar with two microphones placed in
  1742. different location. Because the front of sound wave has fixed speed in
  1743. normal conditions, the phasing of microphones can vary and depends on
  1744. their location and interposition. The best sound mix can be achieved when
  1745. these microphones are in phase (synchronized). Note that distance of
  1746. ~30 cm between microphones makes one microphone to capture signal in
  1747. antiphase to another microphone. That makes the final mix sounding moody.
  1748. This filter helps to solve phasing problems by adding different delays
  1749. to each microphone track and make them synchronized.
  1750. The best result can be reached when you take one track as base and
  1751. synchronize other tracks one by one with it.
  1752. Remember that synchronization/delay tolerance depends on sample rate, too.
  1753. Higher sample rates will give more tolerance.
  1754. It accepts the following parameters:
  1755. @table @option
  1756. @item mm
  1757. Set millimeters distance. This is compensation distance for fine tuning.
  1758. Default is 0.
  1759. @item cm
  1760. Set cm distance. This is compensation distance for tightening distance setup.
  1761. Default is 0.
  1762. @item m
  1763. Set meters distance. This is compensation distance for hard distance setup.
  1764. Default is 0.
  1765. @item dry
  1766. Set dry amount. Amount of unprocessed (dry) signal.
  1767. Default is 0.
  1768. @item wet
  1769. Set wet amount. Amount of processed (wet) signal.
  1770. Default is 1.
  1771. @item temp
  1772. Set temperature degree in Celsius. This is the temperature of the environment.
  1773. Default is 20.
  1774. @end table
  1775. @section crossfeed
  1776. Apply headphone crossfeed filter.
  1777. Crossfeed is the process of blending the left and right channels of stereo
  1778. audio recording.
  1779. It is mainly used to reduce extreme stereo separation of low frequencies.
  1780. The intent is to produce more speaker like sound to the listener.
  1781. The filter accepts the following options:
  1782. @table @option
  1783. @item strength
  1784. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1785. This sets gain of low shelf filter for side part of stereo image.
  1786. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1787. @item range
  1788. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1789. This sets cut off frequency of low shelf filter. Default is cut off near
  1790. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1791. @item level_in
  1792. Set input gain. Default is 0.9.
  1793. @item level_out
  1794. Set output gain. Default is 1.
  1795. @end table
  1796. @section crystalizer
  1797. Simple algorithm to expand audio dynamic range.
  1798. The filter accepts the following options:
  1799. @table @option
  1800. @item i
  1801. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1802. (unchanged sound) to 10.0 (maximum effect).
  1803. @item c
  1804. Enable clipping. By default is enabled.
  1805. @end table
  1806. @section dcshift
  1807. Apply a DC shift to the audio.
  1808. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1809. in the recording chain) from the audio. The effect of a DC offset is reduced
  1810. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1811. a signal has a DC offset.
  1812. @table @option
  1813. @item shift
  1814. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1815. the audio.
  1816. @item limitergain
  1817. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1818. used to prevent clipping.
  1819. @end table
  1820. @section dynaudnorm
  1821. Dynamic Audio Normalizer.
  1822. This filter applies a certain amount of gain to the input audio in order
  1823. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1824. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1825. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1826. This allows for applying extra gain to the "quiet" sections of the audio
  1827. while avoiding distortions or clipping the "loud" sections. In other words:
  1828. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1829. sections, in the sense that the volume of each section is brought to the
  1830. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1831. this goal *without* applying "dynamic range compressing". It will retain 100%
  1832. of the dynamic range *within* each section of the audio file.
  1833. @table @option
  1834. @item f
  1835. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1836. Default is 500 milliseconds.
  1837. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1838. referred to as frames. This is required, because a peak magnitude has no
  1839. meaning for just a single sample value. Instead, we need to determine the
  1840. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1841. normalizer would simply use the peak magnitude of the complete file, the
  1842. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1843. frame. The length of a frame is specified in milliseconds. By default, the
  1844. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1845. been found to give good results with most files.
  1846. Note that the exact frame length, in number of samples, will be determined
  1847. automatically, based on the sampling rate of the individual input audio file.
  1848. @item g
  1849. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1850. number. Default is 31.
  1851. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1852. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1853. is specified in frames, centered around the current frame. For the sake of
  1854. simplicity, this must be an odd number. Consequently, the default value of 31
  1855. takes into account the current frame, as well as the 15 preceding frames and
  1856. the 15 subsequent frames. Using a larger window results in a stronger
  1857. smoothing effect and thus in less gain variation, i.e. slower gain
  1858. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1859. effect and thus in more gain variation, i.e. faster gain adaptation.
  1860. In other words, the more you increase this value, the more the Dynamic Audio
  1861. Normalizer will behave like a "traditional" normalization filter. On the
  1862. contrary, the more you decrease this value, the more the Dynamic Audio
  1863. Normalizer will behave like a dynamic range compressor.
  1864. @item p
  1865. Set the target peak value. This specifies the highest permissible magnitude
  1866. level for the normalized audio input. This filter will try to approach the
  1867. target peak magnitude as closely as possible, but at the same time it also
  1868. makes sure that the normalized signal will never exceed the peak magnitude.
  1869. A frame's maximum local gain factor is imposed directly by the target peak
  1870. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1871. It is not recommended to go above this value.
  1872. @item m
  1873. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1874. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1875. factor for each input frame, i.e. the maximum gain factor that does not
  1876. result in clipping or distortion. The maximum gain factor is determined by
  1877. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1878. additionally bounds the frame's maximum gain factor by a predetermined
  1879. (global) maximum gain factor. This is done in order to avoid excessive gain
  1880. factors in "silent" or almost silent frames. By default, the maximum gain
  1881. factor is 10.0, For most inputs the default value should be sufficient and
  1882. it usually is not recommended to increase this value. Though, for input
  1883. with an extremely low overall volume level, it may be necessary to allow even
  1884. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1885. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1886. Instead, a "sigmoid" threshold function will be applied. This way, the
  1887. gain factors will smoothly approach the threshold value, but never exceed that
  1888. value.
  1889. @item r
  1890. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1891. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1892. This means that the maximum local gain factor for each frame is defined
  1893. (only) by the frame's highest magnitude sample. This way, the samples can
  1894. be amplified as much as possible without exceeding the maximum signal
  1895. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1896. Normalizer can also take into account the frame's root mean square,
  1897. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1898. determine the power of a time-varying signal. It is therefore considered
  1899. that the RMS is a better approximation of the "perceived loudness" than
  1900. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1901. frames to a constant RMS value, a uniform "perceived loudness" can be
  1902. established. If a target RMS value has been specified, a frame's local gain
  1903. factor is defined as the factor that would result in exactly that RMS value.
  1904. Note, however, that the maximum local gain factor is still restricted by the
  1905. frame's highest magnitude sample, in order to prevent clipping.
  1906. @item n
  1907. Enable channels coupling. By default is enabled.
  1908. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1909. amount. This means the same gain factor will be applied to all channels, i.e.
  1910. the maximum possible gain factor is determined by the "loudest" channel.
  1911. However, in some recordings, it may happen that the volume of the different
  1912. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1913. In this case, this option can be used to disable the channel coupling. This way,
  1914. the gain factor will be determined independently for each channel, depending
  1915. only on the individual channel's highest magnitude sample. This allows for
  1916. harmonizing the volume of the different channels.
  1917. @item c
  1918. Enable DC bias correction. By default is disabled.
  1919. An audio signal (in the time domain) is a sequence of sample values.
  1920. In the Dynamic Audio Normalizer these sample values are represented in the
  1921. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1922. audio signal, or "waveform", should be centered around the zero point.
  1923. That means if we calculate the mean value of all samples in a file, or in a
  1924. single frame, then the result should be 0.0 or at least very close to that
  1925. value. If, however, there is a significant deviation of the mean value from
  1926. 0.0, in either positive or negative direction, this is referred to as a
  1927. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1928. Audio Normalizer provides optional DC bias correction.
  1929. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1930. the mean value, or "DC correction" offset, of each input frame and subtract
  1931. that value from all of the frame's sample values which ensures those samples
  1932. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1933. boundaries, the DC correction offset values will be interpolated smoothly
  1934. between neighbouring frames.
  1935. @item b
  1936. Enable alternative boundary mode. By default is disabled.
  1937. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1938. around each frame. This includes the preceding frames as well as the
  1939. subsequent frames. However, for the "boundary" frames, located at the very
  1940. beginning and at the very end of the audio file, not all neighbouring
  1941. frames are available. In particular, for the first few frames in the audio
  1942. file, the preceding frames are not known. And, similarly, for the last few
  1943. frames in the audio file, the subsequent frames are not known. Thus, the
  1944. question arises which gain factors should be assumed for the missing frames
  1945. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1946. to deal with this situation. The default boundary mode assumes a gain factor
  1947. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1948. "fade out" at the beginning and at the end of the input, respectively.
  1949. @item s
  1950. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1951. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1952. compression. This means that signal peaks will not be pruned and thus the
  1953. full dynamic range will be retained within each local neighbourhood. However,
  1954. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1955. normalization algorithm with a more "traditional" compression.
  1956. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1957. (thresholding) function. If (and only if) the compression feature is enabled,
  1958. all input frames will be processed by a soft knee thresholding function prior
  1959. to the actual normalization process. Put simply, the thresholding function is
  1960. going to prune all samples whose magnitude exceeds a certain threshold value.
  1961. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1962. value. Instead, the threshold value will be adjusted for each individual
  1963. frame.
  1964. In general, smaller parameters result in stronger compression, and vice versa.
  1965. Values below 3.0 are not recommended, because audible distortion may appear.
  1966. @end table
  1967. @section earwax
  1968. Make audio easier to listen to on headphones.
  1969. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1970. so that when listened to on headphones the stereo image is moved from
  1971. inside your head (standard for headphones) to outside and in front of
  1972. the listener (standard for speakers).
  1973. Ported from SoX.
  1974. @section equalizer
  1975. Apply a two-pole peaking equalisation (EQ) filter. With this
  1976. filter, the signal-level at and around a selected frequency can
  1977. be increased or decreased, whilst (unlike bandpass and bandreject
  1978. filters) that at all other frequencies is unchanged.
  1979. In order to produce complex equalisation curves, this filter can
  1980. be given several times, each with a different central frequency.
  1981. The filter accepts the following options:
  1982. @table @option
  1983. @item frequency, f
  1984. Set the filter's central frequency in Hz.
  1985. @item width_type, t
  1986. Set method to specify band-width of filter.
  1987. @table @option
  1988. @item h
  1989. Hz
  1990. @item q
  1991. Q-Factor
  1992. @item o
  1993. octave
  1994. @item s
  1995. slope
  1996. @end table
  1997. @item width, w
  1998. Specify the band-width of a filter in width_type units.
  1999. @item gain, g
  2000. Set the required gain or attenuation in dB.
  2001. Beware of clipping when using a positive gain.
  2002. @item channels, c
  2003. Specify which channels to filter, by default all available are filtered.
  2004. @end table
  2005. @subsection Examples
  2006. @itemize
  2007. @item
  2008. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2009. @example
  2010. equalizer=f=1000:t=h:width=200:g=-10
  2011. @end example
  2012. @item
  2013. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2014. @example
  2015. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2016. @end example
  2017. @end itemize
  2018. @section extrastereo
  2019. Linearly increases the difference between left and right channels which
  2020. adds some sort of "live" effect to playback.
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item m
  2024. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2025. (average of both channels), with 1.0 sound will be unchanged, with
  2026. -1.0 left and right channels will be swapped.
  2027. @item c
  2028. Enable clipping. By default is enabled.
  2029. @end table
  2030. @section firequalizer
  2031. Apply FIR Equalization using arbitrary frequency response.
  2032. The filter accepts the following option:
  2033. @table @option
  2034. @item gain
  2035. Set gain curve equation (in dB). The expression can contain variables:
  2036. @table @option
  2037. @item f
  2038. the evaluated frequency
  2039. @item sr
  2040. sample rate
  2041. @item ch
  2042. channel number, set to 0 when multichannels evaluation is disabled
  2043. @item chid
  2044. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2045. multichannels evaluation is disabled
  2046. @item chs
  2047. number of channels
  2048. @item chlayout
  2049. channel_layout, see libavutil/channel_layout.h
  2050. @end table
  2051. and functions:
  2052. @table @option
  2053. @item gain_interpolate(f)
  2054. interpolate gain on frequency f based on gain_entry
  2055. @item cubic_interpolate(f)
  2056. same as gain_interpolate, but smoother
  2057. @end table
  2058. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2059. @item gain_entry
  2060. Set gain entry for gain_interpolate function. The expression can
  2061. contain functions:
  2062. @table @option
  2063. @item entry(f, g)
  2064. store gain entry at frequency f with value g
  2065. @end table
  2066. This option is also available as command.
  2067. @item delay
  2068. Set filter delay in seconds. Higher value means more accurate.
  2069. Default is @code{0.01}.
  2070. @item accuracy
  2071. Set filter accuracy in Hz. Lower value means more accurate.
  2072. Default is @code{5}.
  2073. @item wfunc
  2074. Set window function. Acceptable values are:
  2075. @table @option
  2076. @item rectangular
  2077. rectangular window, useful when gain curve is already smooth
  2078. @item hann
  2079. hann window (default)
  2080. @item hamming
  2081. hamming window
  2082. @item blackman
  2083. blackman window
  2084. @item nuttall3
  2085. 3-terms continuous 1st derivative nuttall window
  2086. @item mnuttall3
  2087. minimum 3-terms discontinuous nuttall window
  2088. @item nuttall
  2089. 4-terms continuous 1st derivative nuttall window
  2090. @item bnuttall
  2091. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2092. @item bharris
  2093. blackman-harris window
  2094. @item tukey
  2095. tukey window
  2096. @end table
  2097. @item fixed
  2098. If enabled, use fixed number of audio samples. This improves speed when
  2099. filtering with large delay. Default is disabled.
  2100. @item multi
  2101. Enable multichannels evaluation on gain. Default is disabled.
  2102. @item zero_phase
  2103. Enable zero phase mode by subtracting timestamp to compensate delay.
  2104. Default is disabled.
  2105. @item scale
  2106. Set scale used by gain. Acceptable values are:
  2107. @table @option
  2108. @item linlin
  2109. linear frequency, linear gain
  2110. @item linlog
  2111. linear frequency, logarithmic (in dB) gain (default)
  2112. @item loglin
  2113. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2114. @item loglog
  2115. logarithmic frequency, logarithmic gain
  2116. @end table
  2117. @item dumpfile
  2118. Set file for dumping, suitable for gnuplot.
  2119. @item dumpscale
  2120. Set scale for dumpfile. Acceptable values are same with scale option.
  2121. Default is linlog.
  2122. @item fft2
  2123. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2124. Default is disabled.
  2125. @item min_phase
  2126. Enable minimum phase impulse response. Default is disabled.
  2127. @end table
  2128. @subsection Examples
  2129. @itemize
  2130. @item
  2131. lowpass at 1000 Hz:
  2132. @example
  2133. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2134. @end example
  2135. @item
  2136. lowpass at 1000 Hz with gain_entry:
  2137. @example
  2138. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2139. @end example
  2140. @item
  2141. custom equalization:
  2142. @example
  2143. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2144. @end example
  2145. @item
  2146. higher delay with zero phase to compensate delay:
  2147. @example
  2148. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2149. @end example
  2150. @item
  2151. lowpass on left channel, highpass on right channel:
  2152. @example
  2153. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2154. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2155. @end example
  2156. @end itemize
  2157. @section flanger
  2158. Apply a flanging effect to the audio.
  2159. The filter accepts the following options:
  2160. @table @option
  2161. @item delay
  2162. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2163. @item depth
  2164. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2165. @item regen
  2166. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2167. Default value is 0.
  2168. @item width
  2169. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2170. Default value is 71.
  2171. @item speed
  2172. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2173. @item shape
  2174. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2175. Default value is @var{sinusoidal}.
  2176. @item phase
  2177. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2178. Default value is 25.
  2179. @item interp
  2180. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2181. Default is @var{linear}.
  2182. @end table
  2183. @section haas
  2184. Apply Haas effect to audio.
  2185. Note that this makes most sense to apply on mono signals.
  2186. With this filter applied to mono signals it give some directionality and
  2187. stretches its stereo image.
  2188. The filter accepts the following options:
  2189. @table @option
  2190. @item level_in
  2191. Set input level. By default is @var{1}, or 0dB
  2192. @item level_out
  2193. Set output level. By default is @var{1}, or 0dB.
  2194. @item side_gain
  2195. Set gain applied to side part of signal. By default is @var{1}.
  2196. @item middle_source
  2197. Set kind of middle source. Can be one of the following:
  2198. @table @samp
  2199. @item left
  2200. Pick left channel.
  2201. @item right
  2202. Pick right channel.
  2203. @item mid
  2204. Pick middle part signal of stereo image.
  2205. @item side
  2206. Pick side part signal of stereo image.
  2207. @end table
  2208. @item middle_phase
  2209. Change middle phase. By default is disabled.
  2210. @item left_delay
  2211. Set left channel delay. By default is @var{2.05} milliseconds.
  2212. @item left_balance
  2213. Set left channel balance. By default is @var{-1}.
  2214. @item left_gain
  2215. Set left channel gain. By default is @var{1}.
  2216. @item left_phase
  2217. Change left phase. By default is disabled.
  2218. @item right_delay
  2219. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2220. @item right_balance
  2221. Set right channel balance. By default is @var{1}.
  2222. @item right_gain
  2223. Set right channel gain. By default is @var{1}.
  2224. @item right_phase
  2225. Change right phase. By default is enabled.
  2226. @end table
  2227. @section hdcd
  2228. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2229. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2230. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2231. of HDCD, and detects the Transient Filter flag.
  2232. @example
  2233. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2234. @end example
  2235. When using the filter with wav, note the default encoding for wav is 16-bit,
  2236. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2237. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2238. @example
  2239. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2240. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2241. @end example
  2242. The filter accepts the following options:
  2243. @table @option
  2244. @item disable_autoconvert
  2245. Disable any automatic format conversion or resampling in the filter graph.
  2246. @item process_stereo
  2247. Process the stereo channels together. If target_gain does not match between
  2248. channels, consider it invalid and use the last valid target_gain.
  2249. @item cdt_ms
  2250. Set the code detect timer period in ms.
  2251. @item force_pe
  2252. Always extend peaks above -3dBFS even if PE isn't signaled.
  2253. @item analyze_mode
  2254. Replace audio with a solid tone and adjust the amplitude to signal some
  2255. specific aspect of the decoding process. The output file can be loaded in
  2256. an audio editor alongside the original to aid analysis.
  2257. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2258. Modes are:
  2259. @table @samp
  2260. @item 0, off
  2261. Disabled
  2262. @item 1, lle
  2263. Gain adjustment level at each sample
  2264. @item 2, pe
  2265. Samples where peak extend occurs
  2266. @item 3, cdt
  2267. Samples where the code detect timer is active
  2268. @item 4, tgm
  2269. Samples where the target gain does not match between channels
  2270. @end table
  2271. @end table
  2272. @section headphone
  2273. Apply head-related transfer functions (HRTFs) to create virtual
  2274. loudspeakers around the user for binaural listening via headphones.
  2275. The HRIRs are provided via additional streams, for each channel
  2276. one stereo input stream is needed.
  2277. The filter accepts the following options:
  2278. @table @option
  2279. @item map
  2280. Set mapping of input streams for convolution.
  2281. The argument is a '|'-separated list of channel names in order as they
  2282. are given as additional stream inputs for filter.
  2283. This also specify number of input streams. Number of input streams
  2284. must be not less than number of channels in first stream plus one.
  2285. @item gain
  2286. Set gain applied to audio. Value is in dB. Default is 0.
  2287. @item type
  2288. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2289. processing audio in time domain which is slow.
  2290. @var{freq} is processing audio in frequency domain which is fast.
  2291. Default is @var{freq}.
  2292. @item lfe
  2293. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2294. @end table
  2295. @subsection Examples
  2296. @itemize
  2297. @item
  2298. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2299. each amovie filter use stereo file with IR coefficients as input.
  2300. The files give coefficients for each position of virtual loudspeaker:
  2301. @example
  2302. 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"
  2303. output.wav
  2304. @end example
  2305. @end itemize
  2306. @section highpass
  2307. Apply a high-pass filter with 3dB point frequency.
  2308. The filter can be either single-pole, or double-pole (the default).
  2309. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2310. The filter accepts the following options:
  2311. @table @option
  2312. @item frequency, f
  2313. Set frequency in Hz. Default is 3000.
  2314. @item poles, p
  2315. Set number of poles. Default is 2.
  2316. @item width_type, t
  2317. Set method to specify band-width of filter.
  2318. @table @option
  2319. @item h
  2320. Hz
  2321. @item q
  2322. Q-Factor
  2323. @item o
  2324. octave
  2325. @item s
  2326. slope
  2327. @end table
  2328. @item width, w
  2329. Specify the band-width of a filter in width_type units.
  2330. Applies only to double-pole filter.
  2331. The default is 0.707q and gives a Butterworth response.
  2332. @item channels, c
  2333. Specify which channels to filter, by default all available are filtered.
  2334. @end table
  2335. @section join
  2336. Join multiple input streams into one multi-channel stream.
  2337. It accepts the following parameters:
  2338. @table @option
  2339. @item inputs
  2340. The number of input streams. It defaults to 2.
  2341. @item channel_layout
  2342. The desired output channel layout. It defaults to stereo.
  2343. @item map
  2344. Map channels from inputs to output. The argument is a '|'-separated list of
  2345. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2346. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2347. can be either the name of the input channel (e.g. FL for front left) or its
  2348. index in the specified input stream. @var{out_channel} is the name of the output
  2349. channel.
  2350. @end table
  2351. The filter will attempt to guess the mappings when they are not specified
  2352. explicitly. It does so by first trying to find an unused matching input channel
  2353. and if that fails it picks the first unused input channel.
  2354. Join 3 inputs (with properly set channel layouts):
  2355. @example
  2356. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2357. @end example
  2358. Build a 5.1 output from 6 single-channel streams:
  2359. @example
  2360. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2361. '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'
  2362. out
  2363. @end example
  2364. @section ladspa
  2365. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2366. To enable compilation of this filter you need to configure FFmpeg with
  2367. @code{--enable-ladspa}.
  2368. @table @option
  2369. @item file, f
  2370. Specifies the name of LADSPA plugin library to load. If the environment
  2371. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2372. each one of the directories specified by the colon separated list in
  2373. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2374. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2375. @file{/usr/lib/ladspa/}.
  2376. @item plugin, p
  2377. Specifies the plugin within the library. Some libraries contain only
  2378. one plugin, but others contain many of them. If this is not set filter
  2379. will list all available plugins within the specified library.
  2380. @item controls, c
  2381. Set the '|' separated list of controls which are zero or more floating point
  2382. values that determine the behavior of the loaded plugin (for example delay,
  2383. threshold or gain).
  2384. Controls need to be defined using the following syntax:
  2385. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2386. @var{valuei} is the value set on the @var{i}-th control.
  2387. Alternatively they can be also defined using the following syntax:
  2388. @var{value0}|@var{value1}|@var{value2}|..., where
  2389. @var{valuei} is the value set on the @var{i}-th control.
  2390. If @option{controls} is set to @code{help}, all available controls and
  2391. their valid ranges are printed.
  2392. @item sample_rate, s
  2393. Specify the sample rate, default to 44100. Only used if plugin have
  2394. zero inputs.
  2395. @item nb_samples, n
  2396. Set the number of samples per channel per each output frame, default
  2397. is 1024. Only used if plugin have zero inputs.
  2398. @item duration, d
  2399. Set the minimum duration of the sourced audio. See
  2400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2401. for the accepted syntax.
  2402. Note that the resulting duration may be greater than the specified duration,
  2403. as the generated audio is always cut at the end of a complete frame.
  2404. If not specified, or the expressed duration is negative, the audio is
  2405. supposed to be generated forever.
  2406. Only used if plugin have zero inputs.
  2407. @end table
  2408. @subsection Examples
  2409. @itemize
  2410. @item
  2411. List all available plugins within amp (LADSPA example plugin) library:
  2412. @example
  2413. ladspa=file=amp
  2414. @end example
  2415. @item
  2416. List all available controls and their valid ranges for @code{vcf_notch}
  2417. plugin from @code{VCF} library:
  2418. @example
  2419. ladspa=f=vcf:p=vcf_notch:c=help
  2420. @end example
  2421. @item
  2422. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2423. plugin library:
  2424. @example
  2425. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2426. @end example
  2427. @item
  2428. Add reverberation to the audio using TAP-plugins
  2429. (Tom's Audio Processing plugins):
  2430. @example
  2431. ladspa=file=tap_reverb:tap_reverb
  2432. @end example
  2433. @item
  2434. Generate white noise, with 0.2 amplitude:
  2435. @example
  2436. ladspa=file=cmt:noise_source_white:c=c0=.2
  2437. @end example
  2438. @item
  2439. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2440. @code{C* Audio Plugin Suite} (CAPS) library:
  2441. @example
  2442. ladspa=file=caps:Click:c=c1=20'
  2443. @end example
  2444. @item
  2445. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2446. @example
  2447. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2448. @end example
  2449. @item
  2450. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2451. @code{SWH Plugins} collection:
  2452. @example
  2453. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2454. @end example
  2455. @item
  2456. Attenuate low frequencies using Multiband EQ from Steve Harris
  2457. @code{SWH Plugins} collection:
  2458. @example
  2459. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2460. @end example
  2461. @item
  2462. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2463. (CAPS) library:
  2464. @example
  2465. ladspa=caps:Narrower
  2466. @end example
  2467. @item
  2468. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2469. @example
  2470. ladspa=caps:White:.2
  2471. @end example
  2472. @item
  2473. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2474. @example
  2475. ladspa=caps:Fractal:c=c1=1
  2476. @end example
  2477. @item
  2478. Dynamic volume normalization using @code{VLevel} plugin:
  2479. @example
  2480. ladspa=vlevel-ladspa:vlevel_mono
  2481. @end example
  2482. @end itemize
  2483. @subsection Commands
  2484. This filter supports the following commands:
  2485. @table @option
  2486. @item cN
  2487. Modify the @var{N}-th control value.
  2488. If the specified value is not valid, it is ignored and prior one is kept.
  2489. @end table
  2490. @section loudnorm
  2491. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2492. Support for both single pass (livestreams, files) and double pass (files) modes.
  2493. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2494. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2495. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2496. The filter accepts the following options:
  2497. @table @option
  2498. @item I, i
  2499. Set integrated loudness target.
  2500. Range is -70.0 - -5.0. Default value is -24.0.
  2501. @item LRA, lra
  2502. Set loudness range target.
  2503. Range is 1.0 - 20.0. Default value is 7.0.
  2504. @item TP, tp
  2505. Set maximum true peak.
  2506. Range is -9.0 - +0.0. Default value is -2.0.
  2507. @item measured_I, measured_i
  2508. Measured IL of input file.
  2509. Range is -99.0 - +0.0.
  2510. @item measured_LRA, measured_lra
  2511. Measured LRA of input file.
  2512. Range is 0.0 - 99.0.
  2513. @item measured_TP, measured_tp
  2514. Measured true peak of input file.
  2515. Range is -99.0 - +99.0.
  2516. @item measured_thresh
  2517. Measured threshold of input file.
  2518. Range is -99.0 - +0.0.
  2519. @item offset
  2520. Set offset gain. Gain is applied before the true-peak limiter.
  2521. Range is -99.0 - +99.0. Default is +0.0.
  2522. @item linear
  2523. Normalize linearly if possible.
  2524. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2525. to be specified in order to use this mode.
  2526. Options are true or false. Default is true.
  2527. @item dual_mono
  2528. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2529. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2530. If set to @code{true}, this option will compensate for this effect.
  2531. Multi-channel input files are not affected by this option.
  2532. Options are true or false. Default is false.
  2533. @item print_format
  2534. Set print format for stats. Options are summary, json, or none.
  2535. Default value is none.
  2536. @end table
  2537. @section lowpass
  2538. Apply a low-pass filter with 3dB point frequency.
  2539. The filter can be either single-pole or double-pole (the default).
  2540. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2541. The filter accepts the following options:
  2542. @table @option
  2543. @item frequency, f
  2544. Set frequency in Hz. Default is 500.
  2545. @item poles, p
  2546. Set number of poles. Default is 2.
  2547. @item width_type, t
  2548. Set method to specify band-width of filter.
  2549. @table @option
  2550. @item h
  2551. Hz
  2552. @item q
  2553. Q-Factor
  2554. @item o
  2555. octave
  2556. @item s
  2557. slope
  2558. @end table
  2559. @item width, w
  2560. Specify the band-width of a filter in width_type units.
  2561. Applies only to double-pole filter.
  2562. The default is 0.707q and gives a Butterworth response.
  2563. @item channels, c
  2564. Specify which channels to filter, by default all available are filtered.
  2565. @end table
  2566. @subsection Examples
  2567. @itemize
  2568. @item
  2569. Lowpass only LFE channel, it LFE is not present it does nothing:
  2570. @example
  2571. lowpass=c=LFE
  2572. @end example
  2573. @end itemize
  2574. @section lv2
  2575. Load a LV2 (LADSPA Version 2) plugin.
  2576. To enable compilation of this filter you need to configure FFmpeg with
  2577. @code{--enable-lv2}.
  2578. @table @option
  2579. @item plugin, p
  2580. Specifies the plugin URI. You may need to escape ':'.
  2581. @item controls, c
  2582. Set the '|' separated list of controls which are zero or more floating point
  2583. values that determine the behavior of the loaded plugin (for example delay,
  2584. threshold or gain).
  2585. If @option{controls} is set to @code{help}, all available controls and
  2586. their valid ranges are printed.
  2587. @item sample_rate, s
  2588. Specify the sample rate, default to 44100. Only used if plugin have
  2589. zero inputs.
  2590. @item nb_samples, n
  2591. Set the number of samples per channel per each output frame, default
  2592. is 1024. Only used if plugin have zero inputs.
  2593. @item duration, d
  2594. Set the minimum duration of the sourced audio. See
  2595. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2596. for the accepted syntax.
  2597. Note that the resulting duration may be greater than the specified duration,
  2598. as the generated audio is always cut at the end of a complete frame.
  2599. If not specified, or the expressed duration is negative, the audio is
  2600. supposed to be generated forever.
  2601. Only used if plugin have zero inputs.
  2602. @end table
  2603. @subsection Examples
  2604. @itemize
  2605. @item
  2606. Apply bass enhancer plugin from Calf:
  2607. @example
  2608. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2609. @end example
  2610. @item
  2611. Apply bass vinyl plugin from Calf:
  2612. @example
  2613. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2614. @end example
  2615. @item
  2616. Apply bit crusher plugin from ArtyFX:
  2617. @example
  2618. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2619. @end example
  2620. @end itemize
  2621. @section mcompand
  2622. Multiband Compress or expand the audio's dynamic range.
  2623. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2624. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2625. response when absent compander action.
  2626. It accepts the following parameters:
  2627. @table @option
  2628. @item args
  2629. This option syntax is:
  2630. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2631. For explanation of each item refer to compand filter documentation.
  2632. @end table
  2633. @anchor{pan}
  2634. @section pan
  2635. Mix channels with specific gain levels. The filter accepts the output
  2636. channel layout followed by a set of channels definitions.
  2637. This filter is also designed to efficiently remap the channels of an audio
  2638. stream.
  2639. The filter accepts parameters of the form:
  2640. "@var{l}|@var{outdef}|@var{outdef}|..."
  2641. @table @option
  2642. @item l
  2643. output channel layout or number of channels
  2644. @item outdef
  2645. output channel specification, of the form:
  2646. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2647. @item out_name
  2648. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2649. number (c0, c1, etc.)
  2650. @item gain
  2651. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2652. @item in_name
  2653. input channel to use, see out_name for details; it is not possible to mix
  2654. named and numbered input channels
  2655. @end table
  2656. If the `=' in a channel specification is replaced by `<', then the gains for
  2657. that specification will be renormalized so that the total is 1, thus
  2658. avoiding clipping noise.
  2659. @subsection Mixing examples
  2660. For example, if you want to down-mix from stereo to mono, but with a bigger
  2661. factor for the left channel:
  2662. @example
  2663. pan=1c|c0=0.9*c0+0.1*c1
  2664. @end example
  2665. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2666. 7-channels surround:
  2667. @example
  2668. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2669. @end example
  2670. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2671. that should be preferred (see "-ac" option) unless you have very specific
  2672. needs.
  2673. @subsection Remapping examples
  2674. The channel remapping will be effective if, and only if:
  2675. @itemize
  2676. @item gain coefficients are zeroes or ones,
  2677. @item only one input per channel output,
  2678. @end itemize
  2679. If all these conditions are satisfied, the filter will notify the user ("Pure
  2680. channel mapping detected"), and use an optimized and lossless method to do the
  2681. remapping.
  2682. For example, if you have a 5.1 source and want a stereo audio stream by
  2683. dropping the extra channels:
  2684. @example
  2685. pan="stereo| c0=FL | c1=FR"
  2686. @end example
  2687. Given the same source, you can also switch front left and front right channels
  2688. and keep the input channel layout:
  2689. @example
  2690. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2691. @end example
  2692. If the input is a stereo audio stream, you can mute the front left channel (and
  2693. still keep the stereo channel layout) with:
  2694. @example
  2695. pan="stereo|c1=c1"
  2696. @end example
  2697. Still with a stereo audio stream input, you can copy the right channel in both
  2698. front left and right:
  2699. @example
  2700. pan="stereo| c0=FR | c1=FR"
  2701. @end example
  2702. @section replaygain
  2703. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2704. outputs it unchanged.
  2705. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2706. @section resample
  2707. Convert the audio sample format, sample rate and channel layout. It is
  2708. not meant to be used directly.
  2709. @section rubberband
  2710. Apply time-stretching and pitch-shifting with librubberband.
  2711. The filter accepts the following options:
  2712. @table @option
  2713. @item tempo
  2714. Set tempo scale factor.
  2715. @item pitch
  2716. Set pitch scale factor.
  2717. @item transients
  2718. Set transients detector.
  2719. Possible values are:
  2720. @table @var
  2721. @item crisp
  2722. @item mixed
  2723. @item smooth
  2724. @end table
  2725. @item detector
  2726. Set detector.
  2727. Possible values are:
  2728. @table @var
  2729. @item compound
  2730. @item percussive
  2731. @item soft
  2732. @end table
  2733. @item phase
  2734. Set phase.
  2735. Possible values are:
  2736. @table @var
  2737. @item laminar
  2738. @item independent
  2739. @end table
  2740. @item window
  2741. Set processing window size.
  2742. Possible values are:
  2743. @table @var
  2744. @item standard
  2745. @item short
  2746. @item long
  2747. @end table
  2748. @item smoothing
  2749. Set smoothing.
  2750. Possible values are:
  2751. @table @var
  2752. @item off
  2753. @item on
  2754. @end table
  2755. @item formant
  2756. Enable formant preservation when shift pitching.
  2757. Possible values are:
  2758. @table @var
  2759. @item shifted
  2760. @item preserved
  2761. @end table
  2762. @item pitchq
  2763. Set pitch quality.
  2764. Possible values are:
  2765. @table @var
  2766. @item quality
  2767. @item speed
  2768. @item consistency
  2769. @end table
  2770. @item channels
  2771. Set channels.
  2772. Possible values are:
  2773. @table @var
  2774. @item apart
  2775. @item together
  2776. @end table
  2777. @end table
  2778. @section sidechaincompress
  2779. This filter acts like normal compressor but has the ability to compress
  2780. detected signal using second input signal.
  2781. It needs two input streams and returns one output stream.
  2782. First input stream will be processed depending on second stream signal.
  2783. The filtered signal then can be filtered with other filters in later stages of
  2784. processing. See @ref{pan} and @ref{amerge} filter.
  2785. The filter accepts the following options:
  2786. @table @option
  2787. @item level_in
  2788. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2789. @item threshold
  2790. If a signal of second stream raises above this level it will affect the gain
  2791. reduction of first stream.
  2792. By default is 0.125. Range is between 0.00097563 and 1.
  2793. @item ratio
  2794. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2795. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2796. Default is 2. Range is between 1 and 20.
  2797. @item attack
  2798. Amount of milliseconds the signal has to rise above the threshold before gain
  2799. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2800. @item release
  2801. Amount of milliseconds the signal has to fall below the threshold before
  2802. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2803. @item makeup
  2804. Set the amount by how much signal will be amplified after processing.
  2805. Default is 1. Range is from 1 to 64.
  2806. @item knee
  2807. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2808. Default is 2.82843. Range is between 1 and 8.
  2809. @item link
  2810. Choose if the @code{average} level between all channels of side-chain stream
  2811. or the louder(@code{maximum}) channel of side-chain stream affects the
  2812. reduction. Default is @code{average}.
  2813. @item detection
  2814. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2815. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2816. @item level_sc
  2817. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2818. @item mix
  2819. How much to use compressed signal in output. Default is 1.
  2820. Range is between 0 and 1.
  2821. @end table
  2822. @subsection Examples
  2823. @itemize
  2824. @item
  2825. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2826. depending on the signal of 2nd input and later compressed signal to be
  2827. merged with 2nd input:
  2828. @example
  2829. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2830. @end example
  2831. @end itemize
  2832. @section sidechaingate
  2833. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2834. filter the detected signal before sending it to the gain reduction stage.
  2835. Normally a gate uses the full range signal to detect a level above the
  2836. threshold.
  2837. For example: If you cut all lower frequencies from your sidechain signal
  2838. the gate will decrease the volume of your track only if not enough highs
  2839. appear. With this technique you are able to reduce the resonation of a
  2840. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2841. guitar.
  2842. It needs two input streams and returns one output stream.
  2843. First input stream will be processed depending on second stream signal.
  2844. The filter accepts the following options:
  2845. @table @option
  2846. @item level_in
  2847. Set input level before filtering.
  2848. Default is 1. Allowed range is from 0.015625 to 64.
  2849. @item range
  2850. Set the level of gain reduction when the signal is below the threshold.
  2851. Default is 0.06125. Allowed range is from 0 to 1.
  2852. @item threshold
  2853. If a signal rises above this level the gain reduction is released.
  2854. Default is 0.125. Allowed range is from 0 to 1.
  2855. @item ratio
  2856. Set a ratio about which the signal is reduced.
  2857. Default is 2. Allowed range is from 1 to 9000.
  2858. @item attack
  2859. Amount of milliseconds the signal has to rise above the threshold before gain
  2860. reduction stops.
  2861. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2862. @item release
  2863. Amount of milliseconds the signal has to fall below the threshold before the
  2864. reduction is increased again. Default is 250 milliseconds.
  2865. Allowed range is from 0.01 to 9000.
  2866. @item makeup
  2867. Set amount of amplification of signal after processing.
  2868. Default is 1. Allowed range is from 1 to 64.
  2869. @item knee
  2870. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2871. Default is 2.828427125. Allowed range is from 1 to 8.
  2872. @item detection
  2873. Choose if exact signal should be taken for detection or an RMS like one.
  2874. Default is rms. Can be peak or rms.
  2875. @item link
  2876. Choose if the average level between all channels or the louder channel affects
  2877. the reduction.
  2878. Default is average. Can be average or maximum.
  2879. @item level_sc
  2880. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2881. @end table
  2882. @section silencedetect
  2883. Detect silence in an audio stream.
  2884. This filter logs a message when it detects that the input audio volume is less
  2885. or equal to a noise tolerance value for a duration greater or equal to the
  2886. minimum detected noise duration.
  2887. The printed times and duration are expressed in seconds.
  2888. The filter accepts the following options:
  2889. @table @option
  2890. @item duration, d
  2891. Set silence duration until notification (default is 2 seconds).
  2892. @item noise, n
  2893. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2894. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2895. @end table
  2896. @subsection Examples
  2897. @itemize
  2898. @item
  2899. Detect 5 seconds of silence with -50dB noise tolerance:
  2900. @example
  2901. silencedetect=n=-50dB:d=5
  2902. @end example
  2903. @item
  2904. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2905. tolerance in @file{silence.mp3}:
  2906. @example
  2907. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2908. @end example
  2909. @end itemize
  2910. @section silenceremove
  2911. Remove silence from the beginning, middle or end of the audio.
  2912. The filter accepts the following options:
  2913. @table @option
  2914. @item start_periods
  2915. This value is used to indicate if audio should be trimmed at beginning of
  2916. the audio. A value of zero indicates no silence should be trimmed from the
  2917. beginning. When specifying a non-zero value, it trims audio up until it
  2918. finds non-silence. Normally, when trimming silence from beginning of audio
  2919. the @var{start_periods} will be @code{1} but it can be increased to higher
  2920. values to trim all audio up to specific count of non-silence periods.
  2921. Default value is @code{0}.
  2922. @item start_duration
  2923. Specify the amount of time that non-silence must be detected before it stops
  2924. trimming audio. By increasing the duration, bursts of noises can be treated
  2925. as silence and trimmed off. Default value is @code{0}.
  2926. @item start_threshold
  2927. This indicates what sample value should be treated as silence. For digital
  2928. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2929. you may wish to increase the value to account for background noise.
  2930. Can be specified in dB (in case "dB" is appended to the specified value)
  2931. or amplitude ratio. Default value is @code{0}.
  2932. @item stop_periods
  2933. Set the count for trimming silence from the end of audio.
  2934. To remove silence from the middle of a file, specify a @var{stop_periods}
  2935. that is negative. This value is then treated as a positive value and is
  2936. used to indicate the effect should restart processing as specified by
  2937. @var{start_periods}, making it suitable for removing periods of silence
  2938. in the middle of the audio.
  2939. Default value is @code{0}.
  2940. @item stop_duration
  2941. Specify a duration of silence that must exist before audio is not copied any
  2942. more. By specifying a higher duration, silence that is wanted can be left in
  2943. the audio.
  2944. Default value is @code{0}.
  2945. @item stop_threshold
  2946. This is the same as @option{start_threshold} but for trimming silence from
  2947. the end of audio.
  2948. Can be specified in dB (in case "dB" is appended to the specified value)
  2949. or amplitude ratio. Default value is @code{0}.
  2950. @item leave_silence
  2951. This indicates that @var{stop_duration} length of audio should be left intact
  2952. at the beginning of each period of silence.
  2953. For example, if you want to remove long pauses between words but do not want
  2954. to remove the pauses completely. Default value is @code{0}.
  2955. @item detection
  2956. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2957. and works better with digital silence which is exactly 0.
  2958. Default value is @code{rms}.
  2959. @item window
  2960. Set ratio used to calculate size of window for detecting silence.
  2961. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2962. @end table
  2963. @subsection Examples
  2964. @itemize
  2965. @item
  2966. The following example shows how this filter can be used to start a recording
  2967. that does not contain the delay at the start which usually occurs between
  2968. pressing the record button and the start of the performance:
  2969. @example
  2970. silenceremove=1:5:0.02
  2971. @end example
  2972. @item
  2973. Trim all silence encountered from beginning to end where there is more than 1
  2974. second of silence in audio:
  2975. @example
  2976. silenceremove=0:0:0:-1:1:-90dB
  2977. @end example
  2978. @end itemize
  2979. @section sofalizer
  2980. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2981. loudspeakers around the user for binaural listening via headphones (audio
  2982. formats up to 9 channels supported).
  2983. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2984. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2985. Austrian Academy of Sciences.
  2986. To enable compilation of this filter you need to configure FFmpeg with
  2987. @code{--enable-libmysofa}.
  2988. The filter accepts the following options:
  2989. @table @option
  2990. @item sofa
  2991. Set the SOFA file used for rendering.
  2992. @item gain
  2993. Set gain applied to audio. Value is in dB. Default is 0.
  2994. @item rotation
  2995. Set rotation of virtual loudspeakers in deg. Default is 0.
  2996. @item elevation
  2997. Set elevation of virtual speakers in deg. Default is 0.
  2998. @item radius
  2999. Set distance in meters between loudspeakers and the listener with near-field
  3000. HRTFs. Default is 1.
  3001. @item type
  3002. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3003. processing audio in time domain which is slow.
  3004. @var{freq} is processing audio in frequency domain which is fast.
  3005. Default is @var{freq}.
  3006. @item speakers
  3007. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3008. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3009. Each virtual loudspeaker is described with short channel name following with
  3010. azimuth and elevation in degrees.
  3011. Each virtual loudspeaker description is separated by '|'.
  3012. For example to override front left and front right channel positions use:
  3013. 'speakers=FL 45 15|FR 345 15'.
  3014. Descriptions with unrecognised channel names are ignored.
  3015. @item lfegain
  3016. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3017. @end table
  3018. @subsection Examples
  3019. @itemize
  3020. @item
  3021. Using ClubFritz6 sofa file:
  3022. @example
  3023. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3024. @end example
  3025. @item
  3026. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3027. @example
  3028. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3029. @end example
  3030. @item
  3031. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3032. and also with custom gain:
  3033. @example
  3034. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3035. @end example
  3036. @end itemize
  3037. @section stereotools
  3038. This filter has some handy utilities to manage stereo signals, for converting
  3039. M/S stereo recordings to L/R signal while having control over the parameters
  3040. or spreading the stereo image of master track.
  3041. The filter accepts the following options:
  3042. @table @option
  3043. @item level_in
  3044. Set input level before filtering for both channels. Defaults is 1.
  3045. Allowed range is from 0.015625 to 64.
  3046. @item level_out
  3047. Set output level after filtering for both channels. Defaults is 1.
  3048. Allowed range is from 0.015625 to 64.
  3049. @item balance_in
  3050. Set input balance between both channels. Default is 0.
  3051. Allowed range is from -1 to 1.
  3052. @item balance_out
  3053. Set output balance between both channels. Default is 0.
  3054. Allowed range is from -1 to 1.
  3055. @item softclip
  3056. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3057. clipping. Disabled by default.
  3058. @item mutel
  3059. Mute the left channel. Disabled by default.
  3060. @item muter
  3061. Mute the right channel. Disabled by default.
  3062. @item phasel
  3063. Change the phase of the left channel. Disabled by default.
  3064. @item phaser
  3065. Change the phase of the right channel. Disabled by default.
  3066. @item mode
  3067. Set stereo mode. Available values are:
  3068. @table @samp
  3069. @item lr>lr
  3070. Left/Right to Left/Right, this is default.
  3071. @item lr>ms
  3072. Left/Right to Mid/Side.
  3073. @item ms>lr
  3074. Mid/Side to Left/Right.
  3075. @item lr>ll
  3076. Left/Right to Left/Left.
  3077. @item lr>rr
  3078. Left/Right to Right/Right.
  3079. @item lr>l+r
  3080. Left/Right to Left + Right.
  3081. @item lr>rl
  3082. Left/Right to Right/Left.
  3083. @item ms>ll
  3084. Mid/Side to Left/Left.
  3085. @item ms>rr
  3086. Mid/Side to Right/Right.
  3087. @end table
  3088. @item slev
  3089. Set level of side signal. Default is 1.
  3090. Allowed range is from 0.015625 to 64.
  3091. @item sbal
  3092. Set balance of side signal. Default is 0.
  3093. Allowed range is from -1 to 1.
  3094. @item mlev
  3095. Set level of the middle signal. Default is 1.
  3096. Allowed range is from 0.015625 to 64.
  3097. @item mpan
  3098. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3099. @item base
  3100. Set stereo base between mono and inversed channels. Default is 0.
  3101. Allowed range is from -1 to 1.
  3102. @item delay
  3103. Set delay in milliseconds how much to delay left from right channel and
  3104. vice versa. Default is 0. Allowed range is from -20 to 20.
  3105. @item sclevel
  3106. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3107. @item phase
  3108. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3109. @item bmode_in, bmode_out
  3110. Set balance mode for balance_in/balance_out option.
  3111. Can be one of the following:
  3112. @table @samp
  3113. @item balance
  3114. Classic balance mode. Attenuate one channel at time.
  3115. Gain is raised up to 1.
  3116. @item amplitude
  3117. Similar as classic mode above but gain is raised up to 2.
  3118. @item power
  3119. Equal power distribution, from -6dB to +6dB range.
  3120. @end table
  3121. @end table
  3122. @subsection Examples
  3123. @itemize
  3124. @item
  3125. Apply karaoke like effect:
  3126. @example
  3127. stereotools=mlev=0.015625
  3128. @end example
  3129. @item
  3130. Convert M/S signal to L/R:
  3131. @example
  3132. "stereotools=mode=ms>lr"
  3133. @end example
  3134. @end itemize
  3135. @section stereowiden
  3136. This filter enhance the stereo effect by suppressing signal common to both
  3137. channels and by delaying the signal of left into right and vice versa,
  3138. thereby widening the stereo effect.
  3139. The filter accepts the following options:
  3140. @table @option
  3141. @item delay
  3142. Time in milliseconds of the delay of left signal into right and vice versa.
  3143. Default is 20 milliseconds.
  3144. @item feedback
  3145. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3146. effect of left signal in right output and vice versa which gives widening
  3147. effect. Default is 0.3.
  3148. @item crossfeed
  3149. Cross feed of left into right with inverted phase. This helps in suppressing
  3150. the mono. If the value is 1 it will cancel all the signal common to both
  3151. channels. Default is 0.3.
  3152. @item drymix
  3153. Set level of input signal of original channel. Default is 0.8.
  3154. @end table
  3155. @section superequalizer
  3156. Apply 18 band equalizer.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item 1b
  3160. Set 65Hz band gain.
  3161. @item 2b
  3162. Set 92Hz band gain.
  3163. @item 3b
  3164. Set 131Hz band gain.
  3165. @item 4b
  3166. Set 185Hz band gain.
  3167. @item 5b
  3168. Set 262Hz band gain.
  3169. @item 6b
  3170. Set 370Hz band gain.
  3171. @item 7b
  3172. Set 523Hz band gain.
  3173. @item 8b
  3174. Set 740Hz band gain.
  3175. @item 9b
  3176. Set 1047Hz band gain.
  3177. @item 10b
  3178. Set 1480Hz band gain.
  3179. @item 11b
  3180. Set 2093Hz band gain.
  3181. @item 12b
  3182. Set 2960Hz band gain.
  3183. @item 13b
  3184. Set 4186Hz band gain.
  3185. @item 14b
  3186. Set 5920Hz band gain.
  3187. @item 15b
  3188. Set 8372Hz band gain.
  3189. @item 16b
  3190. Set 11840Hz band gain.
  3191. @item 17b
  3192. Set 16744Hz band gain.
  3193. @item 18b
  3194. Set 20000Hz band gain.
  3195. @end table
  3196. @section surround
  3197. Apply audio surround upmix filter.
  3198. This filter allows to produce multichannel output from audio stream.
  3199. The filter accepts the following options:
  3200. @table @option
  3201. @item chl_out
  3202. Set output channel layout. By default, this is @var{5.1}.
  3203. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3204. for the required syntax.
  3205. @item chl_in
  3206. Set input channel layout. By default, this is @var{stereo}.
  3207. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3208. for the required syntax.
  3209. @item level_in
  3210. Set input volume level. By default, this is @var{1}.
  3211. @item level_out
  3212. Set output volume level. By default, this is @var{1}.
  3213. @item lfe
  3214. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3215. @item lfe_low
  3216. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3217. @item lfe_high
  3218. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3219. @item fc_in
  3220. Set front center input volume. By default, this is @var{1}.
  3221. @item fc_out
  3222. Set front center output volume. By default, this is @var{1}.
  3223. @item lfe_in
  3224. Set LFE input volume. By default, this is @var{1}.
  3225. @item lfe_out
  3226. Set LFE output volume. By default, this is @var{1}.
  3227. @end table
  3228. @section treble
  3229. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3230. shelving filter with a response similar to that of a standard
  3231. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3232. The filter accepts the following options:
  3233. @table @option
  3234. @item gain, g
  3235. Give the gain at whichever is the lower of ~22 kHz and the
  3236. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3237. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3238. @item frequency, f
  3239. Set the filter's central frequency and so can be used
  3240. to extend or reduce the frequency range to be boosted or cut.
  3241. The default value is @code{3000} Hz.
  3242. @item width_type, t
  3243. Set method to specify band-width of filter.
  3244. @table @option
  3245. @item h
  3246. Hz
  3247. @item q
  3248. Q-Factor
  3249. @item o
  3250. octave
  3251. @item s
  3252. slope
  3253. @end table
  3254. @item width, w
  3255. Determine how steep is the filter's shelf transition.
  3256. @item channels, c
  3257. Specify which channels to filter, by default all available are filtered.
  3258. @end table
  3259. @section tremolo
  3260. Sinusoidal amplitude modulation.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item f
  3264. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3265. (20 Hz or lower) will result in a tremolo effect.
  3266. This filter may also be used as a ring modulator by specifying
  3267. a modulation frequency higher than 20 Hz.
  3268. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3269. @item d
  3270. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3271. Default value is 0.5.
  3272. @end table
  3273. @section vibrato
  3274. Sinusoidal phase modulation.
  3275. The filter accepts the following options:
  3276. @table @option
  3277. @item f
  3278. Modulation frequency in Hertz.
  3279. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3280. @item d
  3281. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3282. Default value is 0.5.
  3283. @end table
  3284. @section volume
  3285. Adjust the input audio volume.
  3286. It accepts the following parameters:
  3287. @table @option
  3288. @item volume
  3289. Set audio volume expression.
  3290. Output values are clipped to the maximum value.
  3291. The output audio volume is given by the relation:
  3292. @example
  3293. @var{output_volume} = @var{volume} * @var{input_volume}
  3294. @end example
  3295. The default value for @var{volume} is "1.0".
  3296. @item precision
  3297. This parameter represents the mathematical precision.
  3298. It determines which input sample formats will be allowed, which affects the
  3299. precision of the volume scaling.
  3300. @table @option
  3301. @item fixed
  3302. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3303. @item float
  3304. 32-bit floating-point; this limits input sample format to FLT. (default)
  3305. @item double
  3306. 64-bit floating-point; this limits input sample format to DBL.
  3307. @end table
  3308. @item replaygain
  3309. Choose the behaviour on encountering ReplayGain side data in input frames.
  3310. @table @option
  3311. @item drop
  3312. Remove ReplayGain side data, ignoring its contents (the default).
  3313. @item ignore
  3314. Ignore ReplayGain side data, but leave it in the frame.
  3315. @item track
  3316. Prefer the track gain, if present.
  3317. @item album
  3318. Prefer the album gain, if present.
  3319. @end table
  3320. @item replaygain_preamp
  3321. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3322. Default value for @var{replaygain_preamp} is 0.0.
  3323. @item eval
  3324. Set when the volume expression is evaluated.
  3325. It accepts the following values:
  3326. @table @samp
  3327. @item once
  3328. only evaluate expression once during the filter initialization, or
  3329. when the @samp{volume} command is sent
  3330. @item frame
  3331. evaluate expression for each incoming frame
  3332. @end table
  3333. Default value is @samp{once}.
  3334. @end table
  3335. The volume expression can contain the following parameters.
  3336. @table @option
  3337. @item n
  3338. frame number (starting at zero)
  3339. @item nb_channels
  3340. number of channels
  3341. @item nb_consumed_samples
  3342. number of samples consumed by the filter
  3343. @item nb_samples
  3344. number of samples in the current frame
  3345. @item pos
  3346. original frame position in the file
  3347. @item pts
  3348. frame PTS
  3349. @item sample_rate
  3350. sample rate
  3351. @item startpts
  3352. PTS at start of stream
  3353. @item startt
  3354. time at start of stream
  3355. @item t
  3356. frame time
  3357. @item tb
  3358. timestamp timebase
  3359. @item volume
  3360. last set volume value
  3361. @end table
  3362. Note that when @option{eval} is set to @samp{once} only the
  3363. @var{sample_rate} and @var{tb} variables are available, all other
  3364. variables will evaluate to NAN.
  3365. @subsection Commands
  3366. This filter supports the following commands:
  3367. @table @option
  3368. @item volume
  3369. Modify the volume expression.
  3370. The command accepts the same syntax of the corresponding option.
  3371. If the specified expression is not valid, it is kept at its current
  3372. value.
  3373. @item replaygain_noclip
  3374. Prevent clipping by limiting the gain applied.
  3375. Default value for @var{replaygain_noclip} is 1.
  3376. @end table
  3377. @subsection Examples
  3378. @itemize
  3379. @item
  3380. Halve the input audio volume:
  3381. @example
  3382. volume=volume=0.5
  3383. volume=volume=1/2
  3384. volume=volume=-6.0206dB
  3385. @end example
  3386. In all the above example the named key for @option{volume} can be
  3387. omitted, for example like in:
  3388. @example
  3389. volume=0.5
  3390. @end example
  3391. @item
  3392. Increase input audio power by 6 decibels using fixed-point precision:
  3393. @example
  3394. volume=volume=6dB:precision=fixed
  3395. @end example
  3396. @item
  3397. Fade volume after time 10 with an annihilation period of 5 seconds:
  3398. @example
  3399. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3400. @end example
  3401. @end itemize
  3402. @section volumedetect
  3403. Detect the volume of the input video.
  3404. The filter has no parameters. The input is not modified. Statistics about
  3405. the volume will be printed in the log when the input stream end is reached.
  3406. In particular it will show the mean volume (root mean square), maximum
  3407. volume (on a per-sample basis), and the beginning of a histogram of the
  3408. registered volume values (from the maximum value to a cumulated 1/1000 of
  3409. the samples).
  3410. All volumes are in decibels relative to the maximum PCM value.
  3411. @subsection Examples
  3412. Here is an excerpt of the output:
  3413. @example
  3414. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3415. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3416. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3417. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3418. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3419. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3420. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3421. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3422. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3423. @end example
  3424. It means that:
  3425. @itemize
  3426. @item
  3427. The mean square energy is approximately -27 dB, or 10^-2.7.
  3428. @item
  3429. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3430. @item
  3431. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3432. @end itemize
  3433. In other words, raising the volume by +4 dB does not cause any clipping,
  3434. raising it by +5 dB causes clipping for 6 samples, etc.
  3435. @c man end AUDIO FILTERS
  3436. @chapter Audio Sources
  3437. @c man begin AUDIO SOURCES
  3438. Below is a description of the currently available audio sources.
  3439. @section abuffer
  3440. Buffer audio frames, and make them available to the filter chain.
  3441. This source is mainly intended for a programmatic use, in particular
  3442. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3443. It accepts the following parameters:
  3444. @table @option
  3445. @item time_base
  3446. The timebase which will be used for timestamps of submitted frames. It must be
  3447. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3448. @item sample_rate
  3449. The sample rate of the incoming audio buffers.
  3450. @item sample_fmt
  3451. The sample format of the incoming audio buffers.
  3452. Either a sample format name or its corresponding integer representation from
  3453. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3454. @item channel_layout
  3455. The channel layout of the incoming audio buffers.
  3456. Either a channel layout name from channel_layout_map in
  3457. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3458. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3459. @item channels
  3460. The number of channels of the incoming audio buffers.
  3461. If both @var{channels} and @var{channel_layout} are specified, then they
  3462. must be consistent.
  3463. @end table
  3464. @subsection Examples
  3465. @example
  3466. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3467. @end example
  3468. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3469. Since the sample format with name "s16p" corresponds to the number
  3470. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3471. equivalent to:
  3472. @example
  3473. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3474. @end example
  3475. @section aevalsrc
  3476. Generate an audio signal specified by an expression.
  3477. This source accepts in input one or more expressions (one for each
  3478. channel), which are evaluated and used to generate a corresponding
  3479. audio signal.
  3480. This source accepts the following options:
  3481. @table @option
  3482. @item exprs
  3483. Set the '|'-separated expressions list for each separate channel. In case the
  3484. @option{channel_layout} option is not specified, the selected channel layout
  3485. depends on the number of provided expressions. Otherwise the last
  3486. specified expression is applied to the remaining output channels.
  3487. @item channel_layout, c
  3488. Set the channel layout. The number of channels in the specified layout
  3489. must be equal to the number of specified expressions.
  3490. @item duration, d
  3491. Set the minimum duration of the sourced audio. See
  3492. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3493. for the accepted syntax.
  3494. Note that the resulting duration may be greater than the specified
  3495. duration, as the generated audio is always cut at the end of a
  3496. complete frame.
  3497. If not specified, or the expressed duration is negative, the audio is
  3498. supposed to be generated forever.
  3499. @item nb_samples, n
  3500. Set the number of samples per channel per each output frame,
  3501. default to 1024.
  3502. @item sample_rate, s
  3503. Specify the sample rate, default to 44100.
  3504. @end table
  3505. Each expression in @var{exprs} can contain the following constants:
  3506. @table @option
  3507. @item n
  3508. number of the evaluated sample, starting from 0
  3509. @item t
  3510. time of the evaluated sample expressed in seconds, starting from 0
  3511. @item s
  3512. sample rate
  3513. @end table
  3514. @subsection Examples
  3515. @itemize
  3516. @item
  3517. Generate silence:
  3518. @example
  3519. aevalsrc=0
  3520. @end example
  3521. @item
  3522. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3523. 8000 Hz:
  3524. @example
  3525. aevalsrc="sin(440*2*PI*t):s=8000"
  3526. @end example
  3527. @item
  3528. Generate a two channels signal, specify the channel layout (Front
  3529. Center + Back Center) explicitly:
  3530. @example
  3531. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3532. @end example
  3533. @item
  3534. Generate white noise:
  3535. @example
  3536. aevalsrc="-2+random(0)"
  3537. @end example
  3538. @item
  3539. Generate an amplitude modulated signal:
  3540. @example
  3541. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3542. @end example
  3543. @item
  3544. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3545. @example
  3546. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3547. @end example
  3548. @end itemize
  3549. @section anullsrc
  3550. The null audio source, return unprocessed audio frames. It is mainly useful
  3551. as a template and to be employed in analysis / debugging tools, or as
  3552. the source for filters which ignore the input data (for example the sox
  3553. synth filter).
  3554. This source accepts the following options:
  3555. @table @option
  3556. @item channel_layout, cl
  3557. Specifies the channel layout, and can be either an integer or a string
  3558. representing a channel layout. The default value of @var{channel_layout}
  3559. is "stereo".
  3560. Check the channel_layout_map definition in
  3561. @file{libavutil/channel_layout.c} for the mapping between strings and
  3562. channel layout values.
  3563. @item sample_rate, r
  3564. Specifies the sample rate, and defaults to 44100.
  3565. @item nb_samples, n
  3566. Set the number of samples per requested frames.
  3567. @end table
  3568. @subsection Examples
  3569. @itemize
  3570. @item
  3571. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3572. @example
  3573. anullsrc=r=48000:cl=4
  3574. @end example
  3575. @item
  3576. Do the same operation with a more obvious syntax:
  3577. @example
  3578. anullsrc=r=48000:cl=mono
  3579. @end example
  3580. @end itemize
  3581. All the parameters need to be explicitly defined.
  3582. @section flite
  3583. Synthesize a voice utterance using the libflite library.
  3584. To enable compilation of this filter you need to configure FFmpeg with
  3585. @code{--enable-libflite}.
  3586. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3587. The filter accepts the following options:
  3588. @table @option
  3589. @item list_voices
  3590. If set to 1, list the names of the available voices and exit
  3591. immediately. Default value is 0.
  3592. @item nb_samples, n
  3593. Set the maximum number of samples per frame. Default value is 512.
  3594. @item textfile
  3595. Set the filename containing the text to speak.
  3596. @item text
  3597. Set the text to speak.
  3598. @item voice, v
  3599. Set the voice to use for the speech synthesis. Default value is
  3600. @code{kal}. See also the @var{list_voices} option.
  3601. @end table
  3602. @subsection Examples
  3603. @itemize
  3604. @item
  3605. Read from file @file{speech.txt}, and synthesize the text using the
  3606. standard flite voice:
  3607. @example
  3608. flite=textfile=speech.txt
  3609. @end example
  3610. @item
  3611. Read the specified text selecting the @code{slt} voice:
  3612. @example
  3613. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3614. @end example
  3615. @item
  3616. Input text to ffmpeg:
  3617. @example
  3618. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3619. @end example
  3620. @item
  3621. Make @file{ffplay} speak the specified text, using @code{flite} and
  3622. the @code{lavfi} device:
  3623. @example
  3624. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3625. @end example
  3626. @end itemize
  3627. For more information about libflite, check:
  3628. @url{http://www.festvox.org/flite/}
  3629. @section anoisesrc
  3630. Generate a noise audio signal.
  3631. The filter accepts the following options:
  3632. @table @option
  3633. @item sample_rate, r
  3634. Specify the sample rate. Default value is 48000 Hz.
  3635. @item amplitude, a
  3636. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3637. is 1.0.
  3638. @item duration, d
  3639. Specify the duration of the generated audio stream. Not specifying this option
  3640. results in noise with an infinite length.
  3641. @item color, colour, c
  3642. Specify the color of noise. Available noise colors are white, pink, brown,
  3643. blue and violet. Default color is white.
  3644. @item seed, s
  3645. Specify a value used to seed the PRNG.
  3646. @item nb_samples, n
  3647. Set the number of samples per each output frame, default is 1024.
  3648. @end table
  3649. @subsection Examples
  3650. @itemize
  3651. @item
  3652. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3653. @example
  3654. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3655. @end example
  3656. @end itemize
  3657. @section sine
  3658. Generate an audio signal made of a sine wave with amplitude 1/8.
  3659. The audio signal is bit-exact.
  3660. The filter accepts the following options:
  3661. @table @option
  3662. @item frequency, f
  3663. Set the carrier frequency. Default is 440 Hz.
  3664. @item beep_factor, b
  3665. Enable a periodic beep every second with frequency @var{beep_factor} times
  3666. the carrier frequency. Default is 0, meaning the beep is disabled.
  3667. @item sample_rate, r
  3668. Specify the sample rate, default is 44100.
  3669. @item duration, d
  3670. Specify the duration of the generated audio stream.
  3671. @item samples_per_frame
  3672. Set the number of samples per output frame.
  3673. The expression can contain the following constants:
  3674. @table @option
  3675. @item n
  3676. The (sequential) number of the output audio frame, starting from 0.
  3677. @item pts
  3678. The PTS (Presentation TimeStamp) of the output audio frame,
  3679. expressed in @var{TB} units.
  3680. @item t
  3681. The PTS of the output audio frame, expressed in seconds.
  3682. @item TB
  3683. The timebase of the output audio frames.
  3684. @end table
  3685. Default is @code{1024}.
  3686. @end table
  3687. @subsection Examples
  3688. @itemize
  3689. @item
  3690. Generate a simple 440 Hz sine wave:
  3691. @example
  3692. sine
  3693. @end example
  3694. @item
  3695. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3696. @example
  3697. sine=220:4:d=5
  3698. sine=f=220:b=4:d=5
  3699. sine=frequency=220:beep_factor=4:duration=5
  3700. @end example
  3701. @item
  3702. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3703. pattern:
  3704. @example
  3705. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3706. @end example
  3707. @end itemize
  3708. @c man end AUDIO SOURCES
  3709. @chapter Audio Sinks
  3710. @c man begin AUDIO SINKS
  3711. Below is a description of the currently available audio sinks.
  3712. @section abuffersink
  3713. Buffer audio frames, and make them available to the end of filter chain.
  3714. This sink is mainly intended for programmatic use, in particular
  3715. through the interface defined in @file{libavfilter/buffersink.h}
  3716. or the options system.
  3717. It accepts a pointer to an AVABufferSinkContext structure, which
  3718. defines the incoming buffers' formats, to be passed as the opaque
  3719. parameter to @code{avfilter_init_filter} for initialization.
  3720. @section anullsink
  3721. Null audio sink; do absolutely nothing with the input audio. It is
  3722. mainly useful as a template and for use in analysis / debugging
  3723. tools.
  3724. @c man end AUDIO SINKS
  3725. @chapter Video Filters
  3726. @c man begin VIDEO FILTERS
  3727. When you configure your FFmpeg build, you can disable any of the
  3728. existing filters using @code{--disable-filters}.
  3729. The configure output will show the video filters included in your
  3730. build.
  3731. Below is a description of the currently available video filters.
  3732. @section alphaextract
  3733. Extract the alpha component from the input as a grayscale video. This
  3734. is especially useful with the @var{alphamerge} filter.
  3735. @section alphamerge
  3736. Add or replace the alpha component of the primary input with the
  3737. grayscale value of a second input. This is intended for use with
  3738. @var{alphaextract} to allow the transmission or storage of frame
  3739. sequences that have alpha in a format that doesn't support an alpha
  3740. channel.
  3741. For example, to reconstruct full frames from a normal YUV-encoded video
  3742. and a separate video created with @var{alphaextract}, you might use:
  3743. @example
  3744. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3745. @end example
  3746. Since this filter is designed for reconstruction, it operates on frame
  3747. sequences without considering timestamps, and terminates when either
  3748. input reaches end of stream. This will cause problems if your encoding
  3749. pipeline drops frames. If you're trying to apply an image as an
  3750. overlay to a video stream, consider the @var{overlay} filter instead.
  3751. @section ass
  3752. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3753. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3754. Substation Alpha) subtitles files.
  3755. This filter accepts the following option in addition to the common options from
  3756. the @ref{subtitles} filter:
  3757. @table @option
  3758. @item shaping
  3759. Set the shaping engine
  3760. Available values are:
  3761. @table @samp
  3762. @item auto
  3763. The default libass shaping engine, which is the best available.
  3764. @item simple
  3765. Fast, font-agnostic shaper that can do only substitutions
  3766. @item complex
  3767. Slower shaper using OpenType for substitutions and positioning
  3768. @end table
  3769. The default is @code{auto}.
  3770. @end table
  3771. @section atadenoise
  3772. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3773. The filter accepts the following options:
  3774. @table @option
  3775. @item 0a
  3776. Set threshold A for 1st plane. Default is 0.02.
  3777. Valid range is 0 to 0.3.
  3778. @item 0b
  3779. Set threshold B for 1st plane. Default is 0.04.
  3780. Valid range is 0 to 5.
  3781. @item 1a
  3782. Set threshold A for 2nd plane. Default is 0.02.
  3783. Valid range is 0 to 0.3.
  3784. @item 1b
  3785. Set threshold B for 2nd plane. Default is 0.04.
  3786. Valid range is 0 to 5.
  3787. @item 2a
  3788. Set threshold A for 3rd plane. Default is 0.02.
  3789. Valid range is 0 to 0.3.
  3790. @item 2b
  3791. Set threshold B for 3rd plane. Default is 0.04.
  3792. Valid range is 0 to 5.
  3793. Threshold A is designed to react on abrupt changes in the input signal and
  3794. threshold B is designed to react on continuous changes in the input signal.
  3795. @item s
  3796. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3797. number in range [5, 129].
  3798. @item p
  3799. Set what planes of frame filter will use for averaging. Default is all.
  3800. @end table
  3801. @section avgblur
  3802. Apply average blur filter.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item sizeX
  3806. Set horizontal kernel size.
  3807. @item planes
  3808. Set which planes to filter. By default all planes are filtered.
  3809. @item sizeY
  3810. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3811. Default is @code{0}.
  3812. @end table
  3813. @section bbox
  3814. Compute the bounding box for the non-black pixels in the input frame
  3815. luminance plane.
  3816. This filter computes the bounding box containing all the pixels with a
  3817. luminance value greater than the minimum allowed value.
  3818. The parameters describing the bounding box are printed on the filter
  3819. log.
  3820. The filter accepts the following option:
  3821. @table @option
  3822. @item min_val
  3823. Set the minimal luminance value. Default is @code{16}.
  3824. @end table
  3825. @section bitplanenoise
  3826. Show and measure bit plane noise.
  3827. The filter accepts the following options:
  3828. @table @option
  3829. @item bitplane
  3830. Set which plane to analyze. Default is @code{1}.
  3831. @item filter
  3832. Filter out noisy pixels from @code{bitplane} set above.
  3833. Default is disabled.
  3834. @end table
  3835. @section blackdetect
  3836. Detect video intervals that are (almost) completely black. Can be
  3837. useful to detect chapter transitions, commercials, or invalid
  3838. recordings. Output lines contains the time for the start, end and
  3839. duration of the detected black interval expressed in seconds.
  3840. In order to display the output lines, you need to set the loglevel at
  3841. least to the AV_LOG_INFO value.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item black_min_duration, d
  3845. Set the minimum detected black duration expressed in seconds. It must
  3846. be a non-negative floating point number.
  3847. Default value is 2.0.
  3848. @item picture_black_ratio_th, pic_th
  3849. Set the threshold for considering a picture "black".
  3850. Express the minimum value for the ratio:
  3851. @example
  3852. @var{nb_black_pixels} / @var{nb_pixels}
  3853. @end example
  3854. for which a picture is considered black.
  3855. Default value is 0.98.
  3856. @item pixel_black_th, pix_th
  3857. Set the threshold for considering a pixel "black".
  3858. The threshold expresses the maximum pixel luminance value for which a
  3859. pixel is considered "black". The provided value is scaled according to
  3860. the following equation:
  3861. @example
  3862. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3863. @end example
  3864. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3865. the input video format, the range is [0-255] for YUV full-range
  3866. formats and [16-235] for YUV non full-range formats.
  3867. Default value is 0.10.
  3868. @end table
  3869. The following example sets the maximum pixel threshold to the minimum
  3870. value, and detects only black intervals of 2 or more seconds:
  3871. @example
  3872. blackdetect=d=2:pix_th=0.00
  3873. @end example
  3874. @section blackframe
  3875. Detect frames that are (almost) completely black. Can be useful to
  3876. detect chapter transitions or commercials. Output lines consist of
  3877. the frame number of the detected frame, the percentage of blackness,
  3878. the position in the file if known or -1 and the timestamp in seconds.
  3879. In order to display the output lines, you need to set the loglevel at
  3880. least to the AV_LOG_INFO value.
  3881. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3882. The value represents the percentage of pixels in the picture that
  3883. are below the threshold value.
  3884. It accepts the following parameters:
  3885. @table @option
  3886. @item amount
  3887. The percentage of the pixels that have to be below the threshold; it defaults to
  3888. @code{98}.
  3889. @item threshold, thresh
  3890. The threshold below which a pixel value is considered black; it defaults to
  3891. @code{32}.
  3892. @end table
  3893. @section blend, tblend
  3894. Blend two video frames into each other.
  3895. The @code{blend} filter takes two input streams and outputs one
  3896. stream, the first input is the "top" layer and second input is
  3897. "bottom" layer. By default, the output terminates when the longest input terminates.
  3898. The @code{tblend} (time blend) filter takes two consecutive frames
  3899. from one single stream, and outputs the result obtained by blending
  3900. the new frame on top of the old frame.
  3901. A description of the accepted options follows.
  3902. @table @option
  3903. @item c0_mode
  3904. @item c1_mode
  3905. @item c2_mode
  3906. @item c3_mode
  3907. @item all_mode
  3908. Set blend mode for specific pixel component or all pixel components in case
  3909. of @var{all_mode}. Default value is @code{normal}.
  3910. Available values for component modes are:
  3911. @table @samp
  3912. @item addition
  3913. @item grainmerge
  3914. @item and
  3915. @item average
  3916. @item burn
  3917. @item darken
  3918. @item difference
  3919. @item grainextract
  3920. @item divide
  3921. @item dodge
  3922. @item freeze
  3923. @item exclusion
  3924. @item extremity
  3925. @item glow
  3926. @item hardlight
  3927. @item hardmix
  3928. @item heat
  3929. @item lighten
  3930. @item linearlight
  3931. @item multiply
  3932. @item multiply128
  3933. @item negation
  3934. @item normal
  3935. @item or
  3936. @item overlay
  3937. @item phoenix
  3938. @item pinlight
  3939. @item reflect
  3940. @item screen
  3941. @item softlight
  3942. @item subtract
  3943. @item vividlight
  3944. @item xor
  3945. @end table
  3946. @item c0_opacity
  3947. @item c1_opacity
  3948. @item c2_opacity
  3949. @item c3_opacity
  3950. @item all_opacity
  3951. Set blend opacity for specific pixel component or all pixel components in case
  3952. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3953. @item c0_expr
  3954. @item c1_expr
  3955. @item c2_expr
  3956. @item c3_expr
  3957. @item all_expr
  3958. Set blend expression for specific pixel component or all pixel components in case
  3959. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3960. The expressions can use the following variables:
  3961. @table @option
  3962. @item N
  3963. The sequential number of the filtered frame, starting from @code{0}.
  3964. @item X
  3965. @item Y
  3966. the coordinates of the current sample
  3967. @item W
  3968. @item H
  3969. the width and height of currently filtered plane
  3970. @item SW
  3971. @item SH
  3972. Width and height scale depending on the currently filtered plane. It is the
  3973. ratio between the corresponding luma plane number of pixels and the current
  3974. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3975. @code{0.5,0.5} for chroma planes.
  3976. @item T
  3977. Time of the current frame, expressed in seconds.
  3978. @item TOP, A
  3979. Value of pixel component at current location for first video frame (top layer).
  3980. @item BOTTOM, B
  3981. Value of pixel component at current location for second video frame (bottom layer).
  3982. @end table
  3983. @end table
  3984. The @code{blend} filter also supports the @ref{framesync} options.
  3985. @subsection Examples
  3986. @itemize
  3987. @item
  3988. Apply transition from bottom layer to top layer in first 10 seconds:
  3989. @example
  3990. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3991. @end example
  3992. @item
  3993. Apply linear horizontal transition from top layer to bottom layer:
  3994. @example
  3995. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3996. @end example
  3997. @item
  3998. Apply 1x1 checkerboard effect:
  3999. @example
  4000. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4001. @end example
  4002. @item
  4003. Apply uncover left effect:
  4004. @example
  4005. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4006. @end example
  4007. @item
  4008. Apply uncover down effect:
  4009. @example
  4010. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4011. @end example
  4012. @item
  4013. Apply uncover up-left effect:
  4014. @example
  4015. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4016. @end example
  4017. @item
  4018. Split diagonally video and shows top and bottom layer on each side:
  4019. @example
  4020. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4021. @end example
  4022. @item
  4023. Display differences between the current and the previous frame:
  4024. @example
  4025. tblend=all_mode=grainextract
  4026. @end example
  4027. @end itemize
  4028. @section boxblur
  4029. Apply a boxblur algorithm to the input video.
  4030. It accepts the following parameters:
  4031. @table @option
  4032. @item luma_radius, lr
  4033. @item luma_power, lp
  4034. @item chroma_radius, cr
  4035. @item chroma_power, cp
  4036. @item alpha_radius, ar
  4037. @item alpha_power, ap
  4038. @end table
  4039. A description of the accepted options follows.
  4040. @table @option
  4041. @item luma_radius, lr
  4042. @item chroma_radius, cr
  4043. @item alpha_radius, ar
  4044. Set an expression for the box radius in pixels used for blurring the
  4045. corresponding input plane.
  4046. The radius value must be a non-negative number, and must not be
  4047. greater than the value of the expression @code{min(w,h)/2} for the
  4048. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4049. planes.
  4050. Default value for @option{luma_radius} is "2". If not specified,
  4051. @option{chroma_radius} and @option{alpha_radius} default to the
  4052. corresponding value set for @option{luma_radius}.
  4053. The expressions can contain the following constants:
  4054. @table @option
  4055. @item w
  4056. @item h
  4057. The input width and height in pixels.
  4058. @item cw
  4059. @item ch
  4060. The input chroma image width and height in pixels.
  4061. @item hsub
  4062. @item vsub
  4063. The horizontal and vertical chroma subsample values. For example, for the
  4064. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4065. @end table
  4066. @item luma_power, lp
  4067. @item chroma_power, cp
  4068. @item alpha_power, ap
  4069. Specify how many times the boxblur filter is applied to the
  4070. corresponding plane.
  4071. Default value for @option{luma_power} is 2. If not specified,
  4072. @option{chroma_power} and @option{alpha_power} default to the
  4073. corresponding value set for @option{luma_power}.
  4074. A value of 0 will disable the effect.
  4075. @end table
  4076. @subsection Examples
  4077. @itemize
  4078. @item
  4079. Apply a boxblur filter with the luma, chroma, and alpha radii
  4080. set to 2:
  4081. @example
  4082. boxblur=luma_radius=2:luma_power=1
  4083. boxblur=2:1
  4084. @end example
  4085. @item
  4086. Set the luma radius to 2, and alpha and chroma radius to 0:
  4087. @example
  4088. boxblur=2:1:cr=0:ar=0
  4089. @end example
  4090. @item
  4091. Set the luma and chroma radii to a fraction of the video dimension:
  4092. @example
  4093. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4094. @end example
  4095. @end itemize
  4096. @section bwdif
  4097. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4098. Deinterlacing Filter").
  4099. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4100. interpolation algorithms.
  4101. It accepts the following parameters:
  4102. @table @option
  4103. @item mode
  4104. The interlacing mode to adopt. It accepts one of the following values:
  4105. @table @option
  4106. @item 0, send_frame
  4107. Output one frame for each frame.
  4108. @item 1, send_field
  4109. Output one frame for each field.
  4110. @end table
  4111. The default value is @code{send_field}.
  4112. @item parity
  4113. The picture field parity assumed for the input interlaced video. It accepts one
  4114. of the following values:
  4115. @table @option
  4116. @item 0, tff
  4117. Assume the top field is first.
  4118. @item 1, bff
  4119. Assume the bottom field is first.
  4120. @item -1, auto
  4121. Enable automatic detection of field parity.
  4122. @end table
  4123. The default value is @code{auto}.
  4124. If the interlacing is unknown or the decoder does not export this information,
  4125. top field first will be assumed.
  4126. @item deint
  4127. Specify which frames to deinterlace. Accept one of the following
  4128. values:
  4129. @table @option
  4130. @item 0, all
  4131. Deinterlace all frames.
  4132. @item 1, interlaced
  4133. Only deinterlace frames marked as interlaced.
  4134. @end table
  4135. The default value is @code{all}.
  4136. @end table
  4137. @section chromakey
  4138. YUV colorspace color/chroma keying.
  4139. The filter accepts the following options:
  4140. @table @option
  4141. @item color
  4142. The color which will be replaced with transparency.
  4143. @item similarity
  4144. Similarity percentage with the key color.
  4145. 0.01 matches only the exact key color, while 1.0 matches everything.
  4146. @item blend
  4147. Blend percentage.
  4148. 0.0 makes pixels either fully transparent, or not transparent at all.
  4149. Higher values result in semi-transparent pixels, with a higher transparency
  4150. the more similar the pixels color is to the key color.
  4151. @item yuv
  4152. Signals that the color passed is already in YUV instead of RGB.
  4153. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4154. This can be used to pass exact YUV values as hexadecimal numbers.
  4155. @end table
  4156. @subsection Examples
  4157. @itemize
  4158. @item
  4159. Make every green pixel in the input image transparent:
  4160. @example
  4161. ffmpeg -i input.png -vf chromakey=green out.png
  4162. @end example
  4163. @item
  4164. Overlay a greenscreen-video on top of a static black background.
  4165. @example
  4166. 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
  4167. @end example
  4168. @end itemize
  4169. @section ciescope
  4170. Display CIE color diagram with pixels overlaid onto it.
  4171. The filter accepts the following options:
  4172. @table @option
  4173. @item system
  4174. Set color system.
  4175. @table @samp
  4176. @item ntsc, 470m
  4177. @item ebu, 470bg
  4178. @item smpte
  4179. @item 240m
  4180. @item apple
  4181. @item widergb
  4182. @item cie1931
  4183. @item rec709, hdtv
  4184. @item uhdtv, rec2020
  4185. @end table
  4186. @item cie
  4187. Set CIE system.
  4188. @table @samp
  4189. @item xyy
  4190. @item ucs
  4191. @item luv
  4192. @end table
  4193. @item gamuts
  4194. Set what gamuts to draw.
  4195. See @code{system} option for available values.
  4196. @item size, s
  4197. Set ciescope size, by default set to 512.
  4198. @item intensity, i
  4199. Set intensity used to map input pixel values to CIE diagram.
  4200. @item contrast
  4201. Set contrast used to draw tongue colors that are out of active color system gamut.
  4202. @item corrgamma
  4203. Correct gamma displayed on scope, by default enabled.
  4204. @item showwhite
  4205. Show white point on CIE diagram, by default disabled.
  4206. @item gamma
  4207. Set input gamma. Used only with XYZ input color space.
  4208. @end table
  4209. @section codecview
  4210. Visualize information exported by some codecs.
  4211. Some codecs can export information through frames using side-data or other
  4212. means. For example, some MPEG based codecs export motion vectors through the
  4213. @var{export_mvs} flag in the codec @option{flags2} option.
  4214. The filter accepts the following option:
  4215. @table @option
  4216. @item mv
  4217. Set motion vectors to visualize.
  4218. Available flags for @var{mv} are:
  4219. @table @samp
  4220. @item pf
  4221. forward predicted MVs of P-frames
  4222. @item bf
  4223. forward predicted MVs of B-frames
  4224. @item bb
  4225. backward predicted MVs of B-frames
  4226. @end table
  4227. @item qp
  4228. Display quantization parameters using the chroma planes.
  4229. @item mv_type, mvt
  4230. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4231. Available flags for @var{mv_type} are:
  4232. @table @samp
  4233. @item fp
  4234. forward predicted MVs
  4235. @item bp
  4236. backward predicted MVs
  4237. @end table
  4238. @item frame_type, ft
  4239. Set frame type to visualize motion vectors of.
  4240. Available flags for @var{frame_type} are:
  4241. @table @samp
  4242. @item if
  4243. intra-coded frames (I-frames)
  4244. @item pf
  4245. predicted frames (P-frames)
  4246. @item bf
  4247. bi-directionally predicted frames (B-frames)
  4248. @end table
  4249. @end table
  4250. @subsection Examples
  4251. @itemize
  4252. @item
  4253. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4254. @example
  4255. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4256. @end example
  4257. @item
  4258. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4259. @example
  4260. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4261. @end example
  4262. @end itemize
  4263. @section colorbalance
  4264. Modify intensity of primary colors (red, green and blue) of input frames.
  4265. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4266. regions for the red-cyan, green-magenta or blue-yellow balance.
  4267. A positive adjustment value shifts the balance towards the primary color, a negative
  4268. value towards the complementary color.
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item rs
  4272. @item gs
  4273. @item bs
  4274. Adjust red, green and blue shadows (darkest pixels).
  4275. @item rm
  4276. @item gm
  4277. @item bm
  4278. Adjust red, green and blue midtones (medium pixels).
  4279. @item rh
  4280. @item gh
  4281. @item bh
  4282. Adjust red, green and blue highlights (brightest pixels).
  4283. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4284. @end table
  4285. @subsection Examples
  4286. @itemize
  4287. @item
  4288. Add red color cast to shadows:
  4289. @example
  4290. colorbalance=rs=.3
  4291. @end example
  4292. @end itemize
  4293. @section colorkey
  4294. RGB colorspace color keying.
  4295. The filter accepts the following options:
  4296. @table @option
  4297. @item color
  4298. The color which will be replaced with transparency.
  4299. @item similarity
  4300. Similarity percentage with the key color.
  4301. 0.01 matches only the exact key color, while 1.0 matches everything.
  4302. @item blend
  4303. Blend percentage.
  4304. 0.0 makes pixels either fully transparent, or not transparent at all.
  4305. Higher values result in semi-transparent pixels, with a higher transparency
  4306. the more similar the pixels color is to the key color.
  4307. @end table
  4308. @subsection Examples
  4309. @itemize
  4310. @item
  4311. Make every green pixel in the input image transparent:
  4312. @example
  4313. ffmpeg -i input.png -vf colorkey=green out.png
  4314. @end example
  4315. @item
  4316. Overlay a greenscreen-video on top of a static background image.
  4317. @example
  4318. 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
  4319. @end example
  4320. @end itemize
  4321. @section colorlevels
  4322. Adjust video input frames using levels.
  4323. The filter accepts the following options:
  4324. @table @option
  4325. @item rimin
  4326. @item gimin
  4327. @item bimin
  4328. @item aimin
  4329. Adjust red, green, blue and alpha input black point.
  4330. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4331. @item rimax
  4332. @item gimax
  4333. @item bimax
  4334. @item aimax
  4335. Adjust red, green, blue and alpha input white point.
  4336. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4337. Input levels are used to lighten highlights (bright tones), darken shadows
  4338. (dark tones), change the balance of bright and dark tones.
  4339. @item romin
  4340. @item gomin
  4341. @item bomin
  4342. @item aomin
  4343. Adjust red, green, blue and alpha output black point.
  4344. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4345. @item romax
  4346. @item gomax
  4347. @item bomax
  4348. @item aomax
  4349. Adjust red, green, blue and alpha output white point.
  4350. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4351. Output levels allows manual selection of a constrained output level range.
  4352. @end table
  4353. @subsection Examples
  4354. @itemize
  4355. @item
  4356. Make video output darker:
  4357. @example
  4358. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4359. @end example
  4360. @item
  4361. Increase contrast:
  4362. @example
  4363. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4364. @end example
  4365. @item
  4366. Make video output lighter:
  4367. @example
  4368. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4369. @end example
  4370. @item
  4371. Increase brightness:
  4372. @example
  4373. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4374. @end example
  4375. @end itemize
  4376. @section colorchannelmixer
  4377. Adjust video input frames by re-mixing color channels.
  4378. This filter modifies a color channel by adding the values associated to
  4379. the other channels of the same pixels. For example if the value to
  4380. modify is red, the output value will be:
  4381. @example
  4382. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4383. @end example
  4384. The filter accepts the following options:
  4385. @table @option
  4386. @item rr
  4387. @item rg
  4388. @item rb
  4389. @item ra
  4390. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4391. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4392. @item gr
  4393. @item gg
  4394. @item gb
  4395. @item ga
  4396. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4397. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4398. @item br
  4399. @item bg
  4400. @item bb
  4401. @item ba
  4402. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4403. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4404. @item ar
  4405. @item ag
  4406. @item ab
  4407. @item aa
  4408. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4409. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4410. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4411. @end table
  4412. @subsection Examples
  4413. @itemize
  4414. @item
  4415. Convert source to grayscale:
  4416. @example
  4417. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4418. @end example
  4419. @item
  4420. Simulate sepia tones:
  4421. @example
  4422. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4423. @end example
  4424. @end itemize
  4425. @section colormatrix
  4426. Convert color matrix.
  4427. The filter accepts the following options:
  4428. @table @option
  4429. @item src
  4430. @item dst
  4431. Specify the source and destination color matrix. Both values must be
  4432. specified.
  4433. The accepted values are:
  4434. @table @samp
  4435. @item bt709
  4436. BT.709
  4437. @item fcc
  4438. FCC
  4439. @item bt601
  4440. BT.601
  4441. @item bt470
  4442. BT.470
  4443. @item bt470bg
  4444. BT.470BG
  4445. @item smpte170m
  4446. SMPTE-170M
  4447. @item smpte240m
  4448. SMPTE-240M
  4449. @item bt2020
  4450. BT.2020
  4451. @end table
  4452. @end table
  4453. For example to convert from BT.601 to SMPTE-240M, use the command:
  4454. @example
  4455. colormatrix=bt601:smpte240m
  4456. @end example
  4457. @section colorspace
  4458. Convert colorspace, transfer characteristics or color primaries.
  4459. Input video needs to have an even size.
  4460. The filter accepts the following options:
  4461. @table @option
  4462. @anchor{all}
  4463. @item all
  4464. Specify all color properties at once.
  4465. The accepted values are:
  4466. @table @samp
  4467. @item bt470m
  4468. BT.470M
  4469. @item bt470bg
  4470. BT.470BG
  4471. @item bt601-6-525
  4472. BT.601-6 525
  4473. @item bt601-6-625
  4474. BT.601-6 625
  4475. @item bt709
  4476. BT.709
  4477. @item smpte170m
  4478. SMPTE-170M
  4479. @item smpte240m
  4480. SMPTE-240M
  4481. @item bt2020
  4482. BT.2020
  4483. @end table
  4484. @anchor{space}
  4485. @item space
  4486. Specify output colorspace.
  4487. The accepted values are:
  4488. @table @samp
  4489. @item bt709
  4490. BT.709
  4491. @item fcc
  4492. FCC
  4493. @item bt470bg
  4494. BT.470BG or BT.601-6 625
  4495. @item smpte170m
  4496. SMPTE-170M or BT.601-6 525
  4497. @item smpte240m
  4498. SMPTE-240M
  4499. @item ycgco
  4500. YCgCo
  4501. @item bt2020ncl
  4502. BT.2020 with non-constant luminance
  4503. @end table
  4504. @anchor{trc}
  4505. @item trc
  4506. Specify output transfer characteristics.
  4507. The accepted values are:
  4508. @table @samp
  4509. @item bt709
  4510. BT.709
  4511. @item bt470m
  4512. BT.470M
  4513. @item bt470bg
  4514. BT.470BG
  4515. @item gamma22
  4516. Constant gamma of 2.2
  4517. @item gamma28
  4518. Constant gamma of 2.8
  4519. @item smpte170m
  4520. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4521. @item smpte240m
  4522. SMPTE-240M
  4523. @item srgb
  4524. SRGB
  4525. @item iec61966-2-1
  4526. iec61966-2-1
  4527. @item iec61966-2-4
  4528. iec61966-2-4
  4529. @item xvycc
  4530. xvycc
  4531. @item bt2020-10
  4532. BT.2020 for 10-bits content
  4533. @item bt2020-12
  4534. BT.2020 for 12-bits content
  4535. @end table
  4536. @anchor{primaries}
  4537. @item primaries
  4538. Specify output color primaries.
  4539. The accepted values are:
  4540. @table @samp
  4541. @item bt709
  4542. BT.709
  4543. @item bt470m
  4544. BT.470M
  4545. @item bt470bg
  4546. BT.470BG or BT.601-6 625
  4547. @item smpte170m
  4548. SMPTE-170M or BT.601-6 525
  4549. @item smpte240m
  4550. SMPTE-240M
  4551. @item film
  4552. film
  4553. @item smpte431
  4554. SMPTE-431
  4555. @item smpte432
  4556. SMPTE-432
  4557. @item bt2020
  4558. BT.2020
  4559. @item jedec-p22
  4560. JEDEC P22 phosphors
  4561. @end table
  4562. @anchor{range}
  4563. @item range
  4564. Specify output color range.
  4565. The accepted values are:
  4566. @table @samp
  4567. @item tv
  4568. TV (restricted) range
  4569. @item mpeg
  4570. MPEG (restricted) range
  4571. @item pc
  4572. PC (full) range
  4573. @item jpeg
  4574. JPEG (full) range
  4575. @end table
  4576. @item format
  4577. Specify output color format.
  4578. The accepted values are:
  4579. @table @samp
  4580. @item yuv420p
  4581. YUV 4:2:0 planar 8-bits
  4582. @item yuv420p10
  4583. YUV 4:2:0 planar 10-bits
  4584. @item yuv420p12
  4585. YUV 4:2:0 planar 12-bits
  4586. @item yuv422p
  4587. YUV 4:2:2 planar 8-bits
  4588. @item yuv422p10
  4589. YUV 4:2:2 planar 10-bits
  4590. @item yuv422p12
  4591. YUV 4:2:2 planar 12-bits
  4592. @item yuv444p
  4593. YUV 4:4:4 planar 8-bits
  4594. @item yuv444p10
  4595. YUV 4:4:4 planar 10-bits
  4596. @item yuv444p12
  4597. YUV 4:4:4 planar 12-bits
  4598. @end table
  4599. @item fast
  4600. Do a fast conversion, which skips gamma/primary correction. This will take
  4601. significantly less CPU, but will be mathematically incorrect. To get output
  4602. compatible with that produced by the colormatrix filter, use fast=1.
  4603. @item dither
  4604. Specify dithering mode.
  4605. The accepted values are:
  4606. @table @samp
  4607. @item none
  4608. No dithering
  4609. @item fsb
  4610. Floyd-Steinberg dithering
  4611. @end table
  4612. @item wpadapt
  4613. Whitepoint adaptation mode.
  4614. The accepted values are:
  4615. @table @samp
  4616. @item bradford
  4617. Bradford whitepoint adaptation
  4618. @item vonkries
  4619. von Kries whitepoint adaptation
  4620. @item identity
  4621. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4622. @end table
  4623. @item iall
  4624. Override all input properties at once. Same accepted values as @ref{all}.
  4625. @item ispace
  4626. Override input colorspace. Same accepted values as @ref{space}.
  4627. @item iprimaries
  4628. Override input color primaries. Same accepted values as @ref{primaries}.
  4629. @item itrc
  4630. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4631. @item irange
  4632. Override input color range. Same accepted values as @ref{range}.
  4633. @end table
  4634. The filter converts the transfer characteristics, color space and color
  4635. primaries to the specified user values. The output value, if not specified,
  4636. is set to a default value based on the "all" property. If that property is
  4637. also not specified, the filter will log an error. The output color range and
  4638. format default to the same value as the input color range and format. The
  4639. input transfer characteristics, color space, color primaries and color range
  4640. should be set on the input data. If any of these are missing, the filter will
  4641. log an error and no conversion will take place.
  4642. For example to convert the input to SMPTE-240M, use the command:
  4643. @example
  4644. colorspace=smpte240m
  4645. @end example
  4646. @section convolution
  4647. Apply convolution 3x3 or 5x5 filter.
  4648. The filter accepts the following options:
  4649. @table @option
  4650. @item 0m
  4651. @item 1m
  4652. @item 2m
  4653. @item 3m
  4654. Set matrix for each plane.
  4655. Matrix is sequence of 9 or 25 signed integers.
  4656. @item 0rdiv
  4657. @item 1rdiv
  4658. @item 2rdiv
  4659. @item 3rdiv
  4660. Set multiplier for calculated value for each plane.
  4661. @item 0bias
  4662. @item 1bias
  4663. @item 2bias
  4664. @item 3bias
  4665. Set bias for each plane. This value is added to the result of the multiplication.
  4666. Useful for making the overall image brighter or darker. Default is 0.0.
  4667. @end table
  4668. @subsection Examples
  4669. @itemize
  4670. @item
  4671. Apply sharpen:
  4672. @example
  4673. 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"
  4674. @end example
  4675. @item
  4676. Apply blur:
  4677. @example
  4678. 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"
  4679. @end example
  4680. @item
  4681. Apply edge enhance:
  4682. @example
  4683. 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"
  4684. @end example
  4685. @item
  4686. Apply edge detect:
  4687. @example
  4688. 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"
  4689. @end example
  4690. @item
  4691. Apply laplacian edge detector which includes diagonals:
  4692. @example
  4693. 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"
  4694. @end example
  4695. @item
  4696. Apply emboss:
  4697. @example
  4698. 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"
  4699. @end example
  4700. @end itemize
  4701. @section convolve
  4702. Apply 2D convolution of video stream in frequency domain using second stream
  4703. as impulse.
  4704. The filter accepts the following options:
  4705. @table @option
  4706. @item planes
  4707. Set which planes to process.
  4708. @item impulse
  4709. Set which impulse video frames will be processed, can be @var{first}
  4710. or @var{all}. Default is @var{all}.
  4711. @end table
  4712. The @code{convolve} filter also supports the @ref{framesync} options.
  4713. @section copy
  4714. Copy the input video source unchanged to the output. This is mainly useful for
  4715. testing purposes.
  4716. @anchor{coreimage}
  4717. @section coreimage
  4718. Video filtering on GPU using Apple's CoreImage API on OSX.
  4719. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4720. processed by video hardware. However, software-based OpenGL implementations
  4721. exist which means there is no guarantee for hardware processing. It depends on
  4722. the respective OSX.
  4723. There are many filters and image generators provided by Apple that come with a
  4724. large variety of options. The filter has to be referenced by its name along
  4725. with its options.
  4726. The coreimage filter accepts the following options:
  4727. @table @option
  4728. @item list_filters
  4729. List all available filters and generators along with all their respective
  4730. options as well as possible minimum and maximum values along with the default
  4731. values.
  4732. @example
  4733. list_filters=true
  4734. @end example
  4735. @item filter
  4736. Specify all filters by their respective name and options.
  4737. Use @var{list_filters} to determine all valid filter names and options.
  4738. Numerical options are specified by a float value and are automatically clamped
  4739. to their respective value range. Vector and color options have to be specified
  4740. by a list of space separated float values. Character escaping has to be done.
  4741. A special option name @code{default} is available to use default options for a
  4742. filter.
  4743. It is required to specify either @code{default} or at least one of the filter options.
  4744. All omitted options are used with their default values.
  4745. The syntax of the filter string is as follows:
  4746. @example
  4747. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4748. @end example
  4749. @item output_rect
  4750. Specify a rectangle where the output of the filter chain is copied into the
  4751. input image. It is given by a list of space separated float values:
  4752. @example
  4753. output_rect=x\ y\ width\ height
  4754. @end example
  4755. If not given, the output rectangle equals the dimensions of the input image.
  4756. The output rectangle is automatically cropped at the borders of the input
  4757. image. Negative values are valid for each component.
  4758. @example
  4759. output_rect=25\ 25\ 100\ 100
  4760. @end example
  4761. @end table
  4762. Several filters can be chained for successive processing without GPU-HOST
  4763. transfers allowing for fast processing of complex filter chains.
  4764. Currently, only filters with zero (generators) or exactly one (filters) input
  4765. image and one output image are supported. Also, transition filters are not yet
  4766. usable as intended.
  4767. Some filters generate output images with additional padding depending on the
  4768. respective filter kernel. The padding is automatically removed to ensure the
  4769. filter output has the same size as the input image.
  4770. For image generators, the size of the output image is determined by the
  4771. previous output image of the filter chain or the input image of the whole
  4772. filterchain, respectively. The generators do not use the pixel information of
  4773. this image to generate their output. However, the generated output is
  4774. blended onto this image, resulting in partial or complete coverage of the
  4775. output image.
  4776. The @ref{coreimagesrc} video source can be used for generating input images
  4777. which are directly fed into the filter chain. By using it, providing input
  4778. images by another video source or an input video is not required.
  4779. @subsection Examples
  4780. @itemize
  4781. @item
  4782. List all filters available:
  4783. @example
  4784. coreimage=list_filters=true
  4785. @end example
  4786. @item
  4787. Use the CIBoxBlur filter with default options to blur an image:
  4788. @example
  4789. coreimage=filter=CIBoxBlur@@default
  4790. @end example
  4791. @item
  4792. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4793. its center at 100x100 and a radius of 50 pixels:
  4794. @example
  4795. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4796. @end example
  4797. @item
  4798. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4799. given as complete and escaped command-line for Apple's standard bash shell:
  4800. @example
  4801. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4802. @end example
  4803. @end itemize
  4804. @section crop
  4805. Crop the input video to given dimensions.
  4806. It accepts the following parameters:
  4807. @table @option
  4808. @item w, out_w
  4809. The width of the output video. It defaults to @code{iw}.
  4810. This expression is evaluated only once during the filter
  4811. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4812. @item h, out_h
  4813. The height of the output video. It defaults to @code{ih}.
  4814. This expression is evaluated only once during the filter
  4815. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4816. @item x
  4817. The horizontal position, in the input video, of the left edge of the output
  4818. video. It defaults to @code{(in_w-out_w)/2}.
  4819. This expression is evaluated per-frame.
  4820. @item y
  4821. The vertical position, in the input video, of the top edge of the output video.
  4822. It defaults to @code{(in_h-out_h)/2}.
  4823. This expression is evaluated per-frame.
  4824. @item keep_aspect
  4825. If set to 1 will force the output display aspect ratio
  4826. to be the same of the input, by changing the output sample aspect
  4827. ratio. It defaults to 0.
  4828. @item exact
  4829. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4830. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4831. It defaults to 0.
  4832. @end table
  4833. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4834. expressions containing the following constants:
  4835. @table @option
  4836. @item x
  4837. @item y
  4838. The computed values for @var{x} and @var{y}. They are evaluated for
  4839. each new frame.
  4840. @item in_w
  4841. @item in_h
  4842. The input width and height.
  4843. @item iw
  4844. @item ih
  4845. These are the same as @var{in_w} and @var{in_h}.
  4846. @item out_w
  4847. @item out_h
  4848. The output (cropped) width and height.
  4849. @item ow
  4850. @item oh
  4851. These are the same as @var{out_w} and @var{out_h}.
  4852. @item a
  4853. same as @var{iw} / @var{ih}
  4854. @item sar
  4855. input sample aspect ratio
  4856. @item dar
  4857. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4858. @item hsub
  4859. @item vsub
  4860. horizontal and vertical chroma subsample values. For example for the
  4861. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4862. @item n
  4863. The number of the input frame, starting from 0.
  4864. @item pos
  4865. the position in the file of the input frame, NAN if unknown
  4866. @item t
  4867. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4868. @end table
  4869. The expression for @var{out_w} may depend on the value of @var{out_h},
  4870. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4871. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4872. evaluated after @var{out_w} and @var{out_h}.
  4873. The @var{x} and @var{y} parameters specify the expressions for the
  4874. position of the top-left corner of the output (non-cropped) area. They
  4875. are evaluated for each frame. If the evaluated value is not valid, it
  4876. is approximated to the nearest valid value.
  4877. The expression for @var{x} may depend on @var{y}, and the expression
  4878. for @var{y} may depend on @var{x}.
  4879. @subsection Examples
  4880. @itemize
  4881. @item
  4882. Crop area with size 100x100 at position (12,34).
  4883. @example
  4884. crop=100:100:12:34
  4885. @end example
  4886. Using named options, the example above becomes:
  4887. @example
  4888. crop=w=100:h=100:x=12:y=34
  4889. @end example
  4890. @item
  4891. Crop the central input area with size 100x100:
  4892. @example
  4893. crop=100:100
  4894. @end example
  4895. @item
  4896. Crop the central input area with size 2/3 of the input video:
  4897. @example
  4898. crop=2/3*in_w:2/3*in_h
  4899. @end example
  4900. @item
  4901. Crop the input video central square:
  4902. @example
  4903. crop=out_w=in_h
  4904. crop=in_h
  4905. @end example
  4906. @item
  4907. Delimit the rectangle with the top-left corner placed at position
  4908. 100:100 and the right-bottom corner corresponding to the right-bottom
  4909. corner of the input image.
  4910. @example
  4911. crop=in_w-100:in_h-100:100:100
  4912. @end example
  4913. @item
  4914. Crop 10 pixels from the left and right borders, and 20 pixels from
  4915. the top and bottom borders
  4916. @example
  4917. crop=in_w-2*10:in_h-2*20
  4918. @end example
  4919. @item
  4920. Keep only the bottom right quarter of the input image:
  4921. @example
  4922. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4923. @end example
  4924. @item
  4925. Crop height for getting Greek harmony:
  4926. @example
  4927. crop=in_w:1/PHI*in_w
  4928. @end example
  4929. @item
  4930. Apply trembling effect:
  4931. @example
  4932. 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)
  4933. @end example
  4934. @item
  4935. Apply erratic camera effect depending on timestamp:
  4936. @example
  4937. 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)"
  4938. @end example
  4939. @item
  4940. Set x depending on the value of y:
  4941. @example
  4942. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4943. @end example
  4944. @end itemize
  4945. @subsection Commands
  4946. This filter supports the following commands:
  4947. @table @option
  4948. @item w, out_w
  4949. @item h, out_h
  4950. @item x
  4951. @item y
  4952. Set width/height of the output video and the horizontal/vertical position
  4953. in the input video.
  4954. The command accepts the same syntax of the corresponding option.
  4955. If the specified expression is not valid, it is kept at its current
  4956. value.
  4957. @end table
  4958. @section cropdetect
  4959. Auto-detect the crop size.
  4960. It calculates the necessary cropping parameters and prints the
  4961. recommended parameters via the logging system. The detected dimensions
  4962. correspond to the non-black area of the input video.
  4963. It accepts the following parameters:
  4964. @table @option
  4965. @item limit
  4966. Set higher black value threshold, which can be optionally specified
  4967. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4968. value greater to the set value is considered non-black. It defaults to 24.
  4969. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4970. on the bitdepth of the pixel format.
  4971. @item round
  4972. The value which the width/height should be divisible by. It defaults to
  4973. 16. The offset is automatically adjusted to center the video. Use 2 to
  4974. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4975. encoding to most video codecs.
  4976. @item reset_count, reset
  4977. Set the counter that determines after how many frames cropdetect will
  4978. reset the previously detected largest video area and start over to
  4979. detect the current optimal crop area. Default value is 0.
  4980. This can be useful when channel logos distort the video area. 0
  4981. indicates 'never reset', and returns the largest area encountered during
  4982. playback.
  4983. @end table
  4984. @anchor{curves}
  4985. @section curves
  4986. Apply color adjustments using curves.
  4987. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4988. component (red, green and blue) has its values defined by @var{N} key points
  4989. tied from each other using a smooth curve. The x-axis represents the pixel
  4990. values from the input frame, and the y-axis the new pixel values to be set for
  4991. the output frame.
  4992. By default, a component curve is defined by the two points @var{(0;0)} and
  4993. @var{(1;1)}. This creates a straight line where each original pixel value is
  4994. "adjusted" to its own value, which means no change to the image.
  4995. The filter allows you to redefine these two points and add some more. A new
  4996. curve (using a natural cubic spline interpolation) will be define to pass
  4997. smoothly through all these new coordinates. The new defined points needs to be
  4998. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4999. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5000. the vector spaces, the values will be clipped accordingly.
  5001. The filter accepts the following options:
  5002. @table @option
  5003. @item preset
  5004. Select one of the available color presets. This option can be used in addition
  5005. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5006. options takes priority on the preset values.
  5007. Available presets are:
  5008. @table @samp
  5009. @item none
  5010. @item color_negative
  5011. @item cross_process
  5012. @item darker
  5013. @item increase_contrast
  5014. @item lighter
  5015. @item linear_contrast
  5016. @item medium_contrast
  5017. @item negative
  5018. @item strong_contrast
  5019. @item vintage
  5020. @end table
  5021. Default is @code{none}.
  5022. @item master, m
  5023. Set the master key points. These points will define a second pass mapping. It
  5024. is sometimes called a "luminance" or "value" mapping. It can be used with
  5025. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5026. post-processing LUT.
  5027. @item red, r
  5028. Set the key points for the red component.
  5029. @item green, g
  5030. Set the key points for the green component.
  5031. @item blue, b
  5032. Set the key points for the blue component.
  5033. @item all
  5034. Set the key points for all components (not including master).
  5035. Can be used in addition to the other key points component
  5036. options. In this case, the unset component(s) will fallback on this
  5037. @option{all} setting.
  5038. @item psfile
  5039. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5040. @item plot
  5041. Save Gnuplot script of the curves in specified file.
  5042. @end table
  5043. To avoid some filtergraph syntax conflicts, each key points list need to be
  5044. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5045. @subsection Examples
  5046. @itemize
  5047. @item
  5048. Increase slightly the middle level of blue:
  5049. @example
  5050. curves=blue='0/0 0.5/0.58 1/1'
  5051. @end example
  5052. @item
  5053. Vintage effect:
  5054. @example
  5055. 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'
  5056. @end example
  5057. Here we obtain the following coordinates for each components:
  5058. @table @var
  5059. @item red
  5060. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5061. @item green
  5062. @code{(0;0) (0.50;0.48) (1;1)}
  5063. @item blue
  5064. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5065. @end table
  5066. @item
  5067. The previous example can also be achieved with the associated built-in preset:
  5068. @example
  5069. curves=preset=vintage
  5070. @end example
  5071. @item
  5072. Or simply:
  5073. @example
  5074. curves=vintage
  5075. @end example
  5076. @item
  5077. Use a Photoshop preset and redefine the points of the green component:
  5078. @example
  5079. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5080. @end example
  5081. @item
  5082. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5083. and @command{gnuplot}:
  5084. @example
  5085. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5086. gnuplot -p /tmp/curves.plt
  5087. @end example
  5088. @end itemize
  5089. @section datascope
  5090. Video data analysis filter.
  5091. This filter shows hexadecimal pixel values of part of video.
  5092. The filter accepts the following options:
  5093. @table @option
  5094. @item size, s
  5095. Set output video size.
  5096. @item x
  5097. Set x offset from where to pick pixels.
  5098. @item y
  5099. Set y offset from where to pick pixels.
  5100. @item mode
  5101. Set scope mode, can be one of the following:
  5102. @table @samp
  5103. @item mono
  5104. Draw hexadecimal pixel values with white color on black background.
  5105. @item color
  5106. Draw hexadecimal pixel values with input video pixel color on black
  5107. background.
  5108. @item color2
  5109. Draw hexadecimal pixel values on color background picked from input video,
  5110. the text color is picked in such way so its always visible.
  5111. @end table
  5112. @item axis
  5113. Draw rows and columns numbers on left and top of video.
  5114. @item opacity
  5115. Set background opacity.
  5116. @end table
  5117. @section dctdnoiz
  5118. Denoise frames using 2D DCT (frequency domain filtering).
  5119. This filter is not designed for real time.
  5120. The filter accepts the following options:
  5121. @table @option
  5122. @item sigma, s
  5123. Set the noise sigma constant.
  5124. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5125. coefficient (absolute value) below this threshold with be dropped.
  5126. If you need a more advanced filtering, see @option{expr}.
  5127. Default is @code{0}.
  5128. @item overlap
  5129. Set number overlapping pixels for each block. Since the filter can be slow, you
  5130. may want to reduce this value, at the cost of a less effective filter and the
  5131. risk of various artefacts.
  5132. If the overlapping value doesn't permit processing the whole input width or
  5133. height, a warning will be displayed and according borders won't be denoised.
  5134. Default value is @var{blocksize}-1, which is the best possible setting.
  5135. @item expr, e
  5136. Set the coefficient factor expression.
  5137. For each coefficient of a DCT block, this expression will be evaluated as a
  5138. multiplier value for the coefficient.
  5139. If this is option is set, the @option{sigma} option will be ignored.
  5140. The absolute value of the coefficient can be accessed through the @var{c}
  5141. variable.
  5142. @item n
  5143. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5144. @var{blocksize}, which is the width and height of the processed blocks.
  5145. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5146. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5147. on the speed processing. Also, a larger block size does not necessarily means a
  5148. better de-noising.
  5149. @end table
  5150. @subsection Examples
  5151. Apply a denoise with a @option{sigma} of @code{4.5}:
  5152. @example
  5153. dctdnoiz=4.5
  5154. @end example
  5155. The same operation can be achieved using the expression system:
  5156. @example
  5157. dctdnoiz=e='gte(c, 4.5*3)'
  5158. @end example
  5159. Violent denoise using a block size of @code{16x16}:
  5160. @example
  5161. dctdnoiz=15:n=4
  5162. @end example
  5163. @section deband
  5164. Remove banding artifacts from input video.
  5165. It works by replacing banded pixels with average value of referenced pixels.
  5166. The filter accepts the following options:
  5167. @table @option
  5168. @item 1thr
  5169. @item 2thr
  5170. @item 3thr
  5171. @item 4thr
  5172. Set banding detection threshold for each plane. Default is 0.02.
  5173. Valid range is 0.00003 to 0.5.
  5174. If difference between current pixel and reference pixel is less than threshold,
  5175. it will be considered as banded.
  5176. @item range, r
  5177. Banding detection range in pixels. Default is 16. If positive, random number
  5178. in range 0 to set value will be used. If negative, exact absolute value
  5179. will be used.
  5180. The range defines square of four pixels around current pixel.
  5181. @item direction, d
  5182. Set direction in radians from which four pixel will be compared. If positive,
  5183. random direction from 0 to set direction will be picked. If negative, exact of
  5184. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5185. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5186. column.
  5187. @item blur, b
  5188. If enabled, current pixel is compared with average value of all four
  5189. surrounding pixels. The default is enabled. If disabled current pixel is
  5190. compared with all four surrounding pixels. The pixel is considered banded
  5191. if only all four differences with surrounding pixels are less than threshold.
  5192. @item coupling, c
  5193. If enabled, current pixel is changed if and only if all pixel components are banded,
  5194. e.g. banding detection threshold is triggered for all color components.
  5195. The default is disabled.
  5196. @end table
  5197. @anchor{decimate}
  5198. @section decimate
  5199. Drop duplicated frames at regular intervals.
  5200. The filter accepts the following options:
  5201. @table @option
  5202. @item cycle
  5203. Set the number of frames from which one will be dropped. Setting this to
  5204. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5205. Default is @code{5}.
  5206. @item dupthresh
  5207. Set the threshold for duplicate detection. If the difference metric for a frame
  5208. is less than or equal to this value, then it is declared as duplicate. Default
  5209. is @code{1.1}
  5210. @item scthresh
  5211. Set scene change threshold. Default is @code{15}.
  5212. @item blockx
  5213. @item blocky
  5214. Set the size of the x and y-axis blocks used during metric calculations.
  5215. Larger blocks give better noise suppression, but also give worse detection of
  5216. small movements. Must be a power of two. Default is @code{32}.
  5217. @item ppsrc
  5218. Mark main input as a pre-processed input and activate clean source input
  5219. stream. This allows the input to be pre-processed with various filters to help
  5220. the metrics calculation while keeping the frame selection lossless. When set to
  5221. @code{1}, the first stream is for the pre-processed input, and the second
  5222. stream is the clean source from where the kept frames are chosen. Default is
  5223. @code{0}.
  5224. @item chroma
  5225. Set whether or not chroma is considered in the metric calculations. Default is
  5226. @code{1}.
  5227. @end table
  5228. @section deflate
  5229. Apply deflate effect to the video.
  5230. This filter replaces the pixel by the local(3x3) average by taking into account
  5231. only values lower than the pixel.
  5232. It accepts the following options:
  5233. @table @option
  5234. @item threshold0
  5235. @item threshold1
  5236. @item threshold2
  5237. @item threshold3
  5238. Limit the maximum change for each plane, default is 65535.
  5239. If 0, plane will remain unchanged.
  5240. @end table
  5241. @section deflicker
  5242. Remove temporal frame luminance variations.
  5243. It accepts the following options:
  5244. @table @option
  5245. @item size, s
  5246. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5247. @item mode, m
  5248. Set averaging mode to smooth temporal luminance variations.
  5249. Available values are:
  5250. @table @samp
  5251. @item am
  5252. Arithmetic mean
  5253. @item gm
  5254. Geometric mean
  5255. @item hm
  5256. Harmonic mean
  5257. @item qm
  5258. Quadratic mean
  5259. @item cm
  5260. Cubic mean
  5261. @item pm
  5262. Power mean
  5263. @item median
  5264. Median
  5265. @end table
  5266. @item bypass
  5267. Do not actually modify frame. Useful when one only wants metadata.
  5268. @end table
  5269. @section dejudder
  5270. Remove judder produced by partially interlaced telecined content.
  5271. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5272. source was partially telecined content then the output of @code{pullup,dejudder}
  5273. will have a variable frame rate. May change the recorded frame rate of the
  5274. container. Aside from that change, this filter will not affect constant frame
  5275. rate video.
  5276. The option available in this filter is:
  5277. @table @option
  5278. @item cycle
  5279. Specify the length of the window over which the judder repeats.
  5280. Accepts any integer greater than 1. Useful values are:
  5281. @table @samp
  5282. @item 4
  5283. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5284. @item 5
  5285. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5286. @item 20
  5287. If a mixture of the two.
  5288. @end table
  5289. The default is @samp{4}.
  5290. @end table
  5291. @section delogo
  5292. Suppress a TV station logo by a simple interpolation of the surrounding
  5293. pixels. Just set a rectangle covering the logo and watch it disappear
  5294. (and sometimes something even uglier appear - your mileage may vary).
  5295. It accepts the following parameters:
  5296. @table @option
  5297. @item x
  5298. @item y
  5299. Specify the top left corner coordinates of the logo. They must be
  5300. specified.
  5301. @item w
  5302. @item h
  5303. Specify the width and height of the logo to clear. They must be
  5304. specified.
  5305. @item band, t
  5306. Specify the thickness of the fuzzy edge of the rectangle (added to
  5307. @var{w} and @var{h}). The default value is 1. This option is
  5308. deprecated, setting higher values should no longer be necessary and
  5309. is not recommended.
  5310. @item show
  5311. When set to 1, a green rectangle is drawn on the screen to simplify
  5312. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5313. The default value is 0.
  5314. The rectangle is drawn on the outermost pixels which will be (partly)
  5315. replaced with interpolated values. The values of the next pixels
  5316. immediately outside this rectangle in each direction will be used to
  5317. compute the interpolated pixel values inside the rectangle.
  5318. @end table
  5319. @subsection Examples
  5320. @itemize
  5321. @item
  5322. Set a rectangle covering the area with top left corner coordinates 0,0
  5323. and size 100x77, and a band of size 10:
  5324. @example
  5325. delogo=x=0:y=0:w=100:h=77:band=10
  5326. @end example
  5327. @end itemize
  5328. @section deshake
  5329. Attempt to fix small changes in horizontal and/or vertical shift. This
  5330. filter helps remove camera shake from hand-holding a camera, bumping a
  5331. tripod, moving on a vehicle, etc.
  5332. The filter accepts the following options:
  5333. @table @option
  5334. @item x
  5335. @item y
  5336. @item w
  5337. @item h
  5338. Specify a rectangular area where to limit the search for motion
  5339. vectors.
  5340. If desired the search for motion vectors can be limited to a
  5341. rectangular area of the frame defined by its top left corner, width
  5342. and height. These parameters have the same meaning as the drawbox
  5343. filter which can be used to visualise the position of the bounding
  5344. box.
  5345. This is useful when simultaneous movement of subjects within the frame
  5346. might be confused for camera motion by the motion vector search.
  5347. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5348. then the full frame is used. This allows later options to be set
  5349. without specifying the bounding box for the motion vector search.
  5350. Default - search the whole frame.
  5351. @item rx
  5352. @item ry
  5353. Specify the maximum extent of movement in x and y directions in the
  5354. range 0-64 pixels. Default 16.
  5355. @item edge
  5356. Specify how to generate pixels to fill blanks at the edge of the
  5357. frame. Available values are:
  5358. @table @samp
  5359. @item blank, 0
  5360. Fill zeroes at blank locations
  5361. @item original, 1
  5362. Original image at blank locations
  5363. @item clamp, 2
  5364. Extruded edge value at blank locations
  5365. @item mirror, 3
  5366. Mirrored edge at blank locations
  5367. @end table
  5368. Default value is @samp{mirror}.
  5369. @item blocksize
  5370. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5371. default 8.
  5372. @item contrast
  5373. Specify the contrast threshold for blocks. Only blocks with more than
  5374. the specified contrast (difference between darkest and lightest
  5375. pixels) will be considered. Range 1-255, default 125.
  5376. @item search
  5377. Specify the search strategy. Available values are:
  5378. @table @samp
  5379. @item exhaustive, 0
  5380. Set exhaustive search
  5381. @item less, 1
  5382. Set less exhaustive search.
  5383. @end table
  5384. Default value is @samp{exhaustive}.
  5385. @item filename
  5386. If set then a detailed log of the motion search is written to the
  5387. specified file.
  5388. @end table
  5389. @section despill
  5390. Remove unwanted contamination of foreground colors, caused by reflected color of
  5391. greenscreen or bluescreen.
  5392. This filter accepts the following options:
  5393. @table @option
  5394. @item type
  5395. Set what type of despill to use.
  5396. @item mix
  5397. Set how spillmap will be generated.
  5398. @item expand
  5399. Set how much to get rid of still remaining spill.
  5400. @item red
  5401. Controls amount of red in spill area.
  5402. @item green
  5403. Controls amount of green in spill area.
  5404. Should be -1 for greenscreen.
  5405. @item blue
  5406. Controls amount of blue in spill area.
  5407. Should be -1 for bluescreen.
  5408. @item brightness
  5409. Controls brightness of spill area, preserving colors.
  5410. @item alpha
  5411. Modify alpha from generated spillmap.
  5412. @end table
  5413. @section detelecine
  5414. Apply an exact inverse of the telecine operation. It requires a predefined
  5415. pattern specified using the pattern option which must be the same as that passed
  5416. to the telecine filter.
  5417. This filter accepts the following options:
  5418. @table @option
  5419. @item first_field
  5420. @table @samp
  5421. @item top, t
  5422. top field first
  5423. @item bottom, b
  5424. bottom field first
  5425. The default value is @code{top}.
  5426. @end table
  5427. @item pattern
  5428. A string of numbers representing the pulldown pattern you wish to apply.
  5429. The default value is @code{23}.
  5430. @item start_frame
  5431. A number representing position of the first frame with respect to the telecine
  5432. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5433. @end table
  5434. @section dilation
  5435. Apply dilation effect to the video.
  5436. This filter replaces the pixel by the local(3x3) maximum.
  5437. It accepts the following options:
  5438. @table @option
  5439. @item threshold0
  5440. @item threshold1
  5441. @item threshold2
  5442. @item threshold3
  5443. Limit the maximum change for each plane, default is 65535.
  5444. If 0, plane will remain unchanged.
  5445. @item coordinates
  5446. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5447. pixels are used.
  5448. Flags to local 3x3 coordinates maps like this:
  5449. 1 2 3
  5450. 4 5
  5451. 6 7 8
  5452. @end table
  5453. @section displace
  5454. Displace pixels as indicated by second and third input stream.
  5455. It takes three input streams and outputs one stream, the first input is the
  5456. source, and second and third input are displacement maps.
  5457. The second input specifies how much to displace pixels along the
  5458. x-axis, while the third input specifies how much to displace pixels
  5459. along the y-axis.
  5460. If one of displacement map streams terminates, last frame from that
  5461. displacement map will be used.
  5462. Note that once generated, displacements maps can be reused over and over again.
  5463. A description of the accepted options follows.
  5464. @table @option
  5465. @item edge
  5466. Set displace behavior for pixels that are out of range.
  5467. Available values are:
  5468. @table @samp
  5469. @item blank
  5470. Missing pixels are replaced by black pixels.
  5471. @item smear
  5472. Adjacent pixels will spread out to replace missing pixels.
  5473. @item wrap
  5474. Out of range pixels are wrapped so they point to pixels of other side.
  5475. @item mirror
  5476. Out of range pixels will be replaced with mirrored pixels.
  5477. @end table
  5478. Default is @samp{smear}.
  5479. @end table
  5480. @subsection Examples
  5481. @itemize
  5482. @item
  5483. Add ripple effect to rgb input of video size hd720:
  5484. @example
  5485. 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
  5486. @end example
  5487. @item
  5488. Add wave effect to rgb input of video size hd720:
  5489. @example
  5490. 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
  5491. @end example
  5492. @end itemize
  5493. @section drawbox
  5494. Draw a colored box on the input image.
  5495. It accepts the following parameters:
  5496. @table @option
  5497. @item x
  5498. @item y
  5499. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5500. @item width, w
  5501. @item height, h
  5502. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5503. the input width and height. It defaults to 0.
  5504. @item color, c
  5505. Specify the color of the box to write. For the general syntax of this option,
  5506. check the "Color" section in the ffmpeg-utils manual. If the special
  5507. value @code{invert} is used, the box edge color is the same as the
  5508. video with inverted luma.
  5509. @item thickness, t
  5510. The expression which sets the thickness of the box edge.
  5511. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5512. See below for the list of accepted constants.
  5513. @end table
  5514. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5515. following constants:
  5516. @table @option
  5517. @item dar
  5518. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5519. @item hsub
  5520. @item vsub
  5521. horizontal and vertical chroma subsample values. For example for the
  5522. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5523. @item in_h, ih
  5524. @item in_w, iw
  5525. The input width and height.
  5526. @item sar
  5527. The input sample aspect ratio.
  5528. @item x
  5529. @item y
  5530. The x and y offset coordinates where the box is drawn.
  5531. @item w
  5532. @item h
  5533. The width and height of the drawn box.
  5534. @item t
  5535. The thickness of the drawn box.
  5536. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5537. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5538. @end table
  5539. @subsection Examples
  5540. @itemize
  5541. @item
  5542. Draw a black box around the edge of the input image:
  5543. @example
  5544. drawbox
  5545. @end example
  5546. @item
  5547. Draw a box with color red and an opacity of 50%:
  5548. @example
  5549. drawbox=10:20:200:60:red@@0.5
  5550. @end example
  5551. The previous example can be specified as:
  5552. @example
  5553. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5554. @end example
  5555. @item
  5556. Fill the box with pink color:
  5557. @example
  5558. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5559. @end example
  5560. @item
  5561. Draw a 2-pixel red 2.40:1 mask:
  5562. @example
  5563. 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
  5564. @end example
  5565. @end itemize
  5566. @section drawgrid
  5567. Draw a grid on the input image.
  5568. It accepts the following parameters:
  5569. @table @option
  5570. @item x
  5571. @item y
  5572. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5573. @item width, w
  5574. @item height, h
  5575. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5576. input width and height, respectively, minus @code{thickness}, so image gets
  5577. framed. Default to 0.
  5578. @item color, c
  5579. Specify the color of the grid. For the general syntax of this option,
  5580. check the "Color" section in the ffmpeg-utils manual. If the special
  5581. value @code{invert} is used, the grid color is the same as the
  5582. video with inverted luma.
  5583. @item thickness, t
  5584. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5585. See below for the list of accepted constants.
  5586. @end table
  5587. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5588. following constants:
  5589. @table @option
  5590. @item dar
  5591. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5592. @item hsub
  5593. @item vsub
  5594. horizontal and vertical chroma subsample values. For example for the
  5595. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5596. @item in_h, ih
  5597. @item in_w, iw
  5598. The input grid cell width and height.
  5599. @item sar
  5600. The input sample aspect ratio.
  5601. @item x
  5602. @item y
  5603. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5604. @item w
  5605. @item h
  5606. The width and height of the drawn cell.
  5607. @item t
  5608. The thickness of the drawn cell.
  5609. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5610. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5611. @end table
  5612. @subsection Examples
  5613. @itemize
  5614. @item
  5615. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5616. @example
  5617. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5618. @end example
  5619. @item
  5620. Draw a white 3x3 grid with an opacity of 50%:
  5621. @example
  5622. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5623. @end example
  5624. @end itemize
  5625. @anchor{drawtext}
  5626. @section drawtext
  5627. Draw a text string or text from a specified file on top of a video, using the
  5628. libfreetype library.
  5629. To enable compilation of this filter, you need to configure FFmpeg with
  5630. @code{--enable-libfreetype}.
  5631. To enable default font fallback and the @var{font} option you need to
  5632. configure FFmpeg with @code{--enable-libfontconfig}.
  5633. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5634. @code{--enable-libfribidi}.
  5635. @subsection Syntax
  5636. It accepts the following parameters:
  5637. @table @option
  5638. @item box
  5639. Used to draw a box around text using the background color.
  5640. The value must be either 1 (enable) or 0 (disable).
  5641. The default value of @var{box} is 0.
  5642. @item boxborderw
  5643. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5644. The default value of @var{boxborderw} is 0.
  5645. @item boxcolor
  5646. The color to be used for drawing box around text. For the syntax of this
  5647. option, check the "Color" section in the ffmpeg-utils manual.
  5648. The default value of @var{boxcolor} is "white".
  5649. @item line_spacing
  5650. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5651. The default value of @var{line_spacing} is 0.
  5652. @item borderw
  5653. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5654. The default value of @var{borderw} is 0.
  5655. @item bordercolor
  5656. Set the color to be used for drawing border around text. For the syntax of this
  5657. option, check the "Color" section in the ffmpeg-utils manual.
  5658. The default value of @var{bordercolor} is "black".
  5659. @item expansion
  5660. Select how the @var{text} is expanded. Can be either @code{none},
  5661. @code{strftime} (deprecated) or
  5662. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5663. below for details.
  5664. @item basetime
  5665. Set a start time for the count. Value is in microseconds. Only applied
  5666. in the deprecated strftime expansion mode. To emulate in normal expansion
  5667. mode use the @code{pts} function, supplying the start time (in seconds)
  5668. as the second argument.
  5669. @item fix_bounds
  5670. If true, check and fix text coords to avoid clipping.
  5671. @item fontcolor
  5672. The color to be used for drawing fonts. For the syntax of this option, check
  5673. the "Color" section in the ffmpeg-utils manual.
  5674. The default value of @var{fontcolor} is "black".
  5675. @item fontcolor_expr
  5676. String which is expanded the same way as @var{text} to obtain dynamic
  5677. @var{fontcolor} value. By default this option has empty value and is not
  5678. processed. When this option is set, it overrides @var{fontcolor} option.
  5679. @item font
  5680. The font family to be used for drawing text. By default Sans.
  5681. @item fontfile
  5682. The font file to be used for drawing text. The path must be included.
  5683. This parameter is mandatory if the fontconfig support is disabled.
  5684. @item alpha
  5685. Draw the text applying alpha blending. The value can
  5686. be a number between 0.0 and 1.0.
  5687. The expression accepts the same variables @var{x, y} as well.
  5688. The default value is 1.
  5689. Please see @var{fontcolor_expr}.
  5690. @item fontsize
  5691. The font size to be used for drawing text.
  5692. The default value of @var{fontsize} is 16.
  5693. @item text_shaping
  5694. If set to 1, attempt to shape the text (for example, reverse the order of
  5695. right-to-left text and join Arabic characters) before drawing it.
  5696. Otherwise, just draw the text exactly as given.
  5697. By default 1 (if supported).
  5698. @item ft_load_flags
  5699. The flags to be used for loading the fonts.
  5700. The flags map the corresponding flags supported by libfreetype, and are
  5701. a combination of the following values:
  5702. @table @var
  5703. @item default
  5704. @item no_scale
  5705. @item no_hinting
  5706. @item render
  5707. @item no_bitmap
  5708. @item vertical_layout
  5709. @item force_autohint
  5710. @item crop_bitmap
  5711. @item pedantic
  5712. @item ignore_global_advance_width
  5713. @item no_recurse
  5714. @item ignore_transform
  5715. @item monochrome
  5716. @item linear_design
  5717. @item no_autohint
  5718. @end table
  5719. Default value is "default".
  5720. For more information consult the documentation for the FT_LOAD_*
  5721. libfreetype flags.
  5722. @item shadowcolor
  5723. The color to be used for drawing a shadow behind the drawn text. For the
  5724. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5725. The default value of @var{shadowcolor} is "black".
  5726. @item shadowx
  5727. @item shadowy
  5728. The x and y offsets for the text shadow position with respect to the
  5729. position of the text. They can be either positive or negative
  5730. values. The default value for both is "0".
  5731. @item start_number
  5732. The starting frame number for the n/frame_num variable. The default value
  5733. is "0".
  5734. @item tabsize
  5735. The size in number of spaces to use for rendering the tab.
  5736. Default value is 4.
  5737. @item timecode
  5738. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5739. format. It can be used with or without text parameter. @var{timecode_rate}
  5740. option must be specified.
  5741. @item timecode_rate, rate, r
  5742. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5743. integer. Minimum value is "1".
  5744. Drop-frame timecode is supported for frame rates 30 & 60.
  5745. @item tc24hmax
  5746. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5747. Default is 0 (disabled).
  5748. @item text
  5749. The text string to be drawn. The text must be a sequence of UTF-8
  5750. encoded characters.
  5751. This parameter is mandatory if no file is specified with the parameter
  5752. @var{textfile}.
  5753. @item textfile
  5754. A text file containing text to be drawn. The text must be a sequence
  5755. of UTF-8 encoded characters.
  5756. This parameter is mandatory if no text string is specified with the
  5757. parameter @var{text}.
  5758. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5759. @item reload
  5760. If set to 1, the @var{textfile} will be reloaded before each frame.
  5761. Be sure to update it atomically, or it may be read partially, or even fail.
  5762. @item x
  5763. @item y
  5764. The expressions which specify the offsets where text will be drawn
  5765. within the video frame. They are relative to the top/left border of the
  5766. output image.
  5767. The default value of @var{x} and @var{y} is "0".
  5768. See below for the list of accepted constants and functions.
  5769. @end table
  5770. The parameters for @var{x} and @var{y} are expressions containing the
  5771. following constants and functions:
  5772. @table @option
  5773. @item dar
  5774. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5775. @item hsub
  5776. @item vsub
  5777. horizontal and vertical chroma subsample values. For example for the
  5778. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5779. @item line_h, lh
  5780. the height of each text line
  5781. @item main_h, h, H
  5782. the input height
  5783. @item main_w, w, W
  5784. the input width
  5785. @item max_glyph_a, ascent
  5786. the maximum distance from the baseline to the highest/upper grid
  5787. coordinate used to place a glyph outline point, for all the rendered
  5788. glyphs.
  5789. It is a positive value, due to the grid's orientation with the Y axis
  5790. upwards.
  5791. @item max_glyph_d, descent
  5792. the maximum distance from the baseline to the lowest grid coordinate
  5793. used to place a glyph outline point, for all the rendered glyphs.
  5794. This is a negative value, due to the grid's orientation, with the Y axis
  5795. upwards.
  5796. @item max_glyph_h
  5797. maximum glyph height, that is the maximum height for all the glyphs
  5798. contained in the rendered text, it is equivalent to @var{ascent} -
  5799. @var{descent}.
  5800. @item max_glyph_w
  5801. maximum glyph width, that is the maximum width for all the glyphs
  5802. contained in the rendered text
  5803. @item n
  5804. the number of input frame, starting from 0
  5805. @item rand(min, max)
  5806. return a random number included between @var{min} and @var{max}
  5807. @item sar
  5808. The input sample aspect ratio.
  5809. @item t
  5810. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5811. @item text_h, th
  5812. the height of the rendered text
  5813. @item text_w, tw
  5814. the width of the rendered text
  5815. @item x
  5816. @item y
  5817. the x and y offset coordinates where the text is drawn.
  5818. These parameters allow the @var{x} and @var{y} expressions to refer
  5819. each other, so you can for example specify @code{y=x/dar}.
  5820. @end table
  5821. @anchor{drawtext_expansion}
  5822. @subsection Text expansion
  5823. If @option{expansion} is set to @code{strftime},
  5824. the filter recognizes strftime() sequences in the provided text and
  5825. expands them accordingly. Check the documentation of strftime(). This
  5826. feature is deprecated.
  5827. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5828. If @option{expansion} is set to @code{normal} (which is the default),
  5829. the following expansion mechanism is used.
  5830. The backslash character @samp{\}, followed by any character, always expands to
  5831. the second character.
  5832. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5833. braces is a function name, possibly followed by arguments separated by ':'.
  5834. If the arguments contain special characters or delimiters (':' or '@}'),
  5835. they should be escaped.
  5836. Note that they probably must also be escaped as the value for the
  5837. @option{text} option in the filter argument string and as the filter
  5838. argument in the filtergraph description, and possibly also for the shell,
  5839. that makes up to four levels of escaping; using a text file avoids these
  5840. problems.
  5841. The following functions are available:
  5842. @table @command
  5843. @item expr, e
  5844. The expression evaluation result.
  5845. It must take one argument specifying the expression to be evaluated,
  5846. which accepts the same constants and functions as the @var{x} and
  5847. @var{y} values. Note that not all constants should be used, for
  5848. example the text size is not known when evaluating the expression, so
  5849. the constants @var{text_w} and @var{text_h} will have an undefined
  5850. value.
  5851. @item expr_int_format, eif
  5852. Evaluate the expression's value and output as formatted integer.
  5853. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5854. The second argument specifies the output format. Allowed values are @samp{x},
  5855. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5856. @code{printf} function.
  5857. The third parameter is optional and sets the number of positions taken by the output.
  5858. It can be used to add padding with zeros from the left.
  5859. @item gmtime
  5860. The time at which the filter is running, expressed in UTC.
  5861. It can accept an argument: a strftime() format string.
  5862. @item localtime
  5863. The time at which the filter is running, expressed in the local time zone.
  5864. It can accept an argument: a strftime() format string.
  5865. @item metadata
  5866. Frame metadata. Takes one or two arguments.
  5867. The first argument is mandatory and specifies the metadata key.
  5868. The second argument is optional and specifies a default value, used when the
  5869. metadata key is not found or empty.
  5870. @item n, frame_num
  5871. The frame number, starting from 0.
  5872. @item pict_type
  5873. A 1 character description of the current picture type.
  5874. @item pts
  5875. The timestamp of the current frame.
  5876. It can take up to three arguments.
  5877. The first argument is the format of the timestamp; it defaults to @code{flt}
  5878. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5879. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5880. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5881. @code{localtime} stands for the timestamp of the frame formatted as
  5882. local time zone time.
  5883. The second argument is an offset added to the timestamp.
  5884. If the format is set to @code{localtime} or @code{gmtime},
  5885. a third argument may be supplied: a strftime() format string.
  5886. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5887. @end table
  5888. @subsection Examples
  5889. @itemize
  5890. @item
  5891. Draw "Test Text" with font FreeSerif, using the default values for the
  5892. optional parameters.
  5893. @example
  5894. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5895. @end example
  5896. @item
  5897. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5898. and y=50 (counting from the top-left corner of the screen), text is
  5899. yellow with a red box around it. Both the text and the box have an
  5900. opacity of 20%.
  5901. @example
  5902. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5903. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5904. @end example
  5905. Note that the double quotes are not necessary if spaces are not used
  5906. within the parameter list.
  5907. @item
  5908. Show the text at the center of the video frame:
  5909. @example
  5910. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5911. @end example
  5912. @item
  5913. Show the text at a random position, switching to a new position every 30 seconds:
  5914. @example
  5915. 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)"
  5916. @end example
  5917. @item
  5918. Show a text line sliding from right to left in the last row of the video
  5919. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5920. with no newlines.
  5921. @example
  5922. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5923. @end example
  5924. @item
  5925. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5926. @example
  5927. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5928. @end example
  5929. @item
  5930. Draw a single green letter "g", at the center of the input video.
  5931. The glyph baseline is placed at half screen height.
  5932. @example
  5933. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5934. @end example
  5935. @item
  5936. Show text for 1 second every 3 seconds:
  5937. @example
  5938. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5939. @end example
  5940. @item
  5941. Use fontconfig to set the font. Note that the colons need to be escaped.
  5942. @example
  5943. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5944. @end example
  5945. @item
  5946. Print the date of a real-time encoding (see strftime(3)):
  5947. @example
  5948. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5949. @end example
  5950. @item
  5951. Show text fading in and out (appearing/disappearing):
  5952. @example
  5953. #!/bin/sh
  5954. DS=1.0 # display start
  5955. DE=10.0 # display end
  5956. FID=1.5 # fade in duration
  5957. FOD=5 # fade out duration
  5958. 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 @}"
  5959. @end example
  5960. @item
  5961. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5962. and the @option{fontsize} value are included in the @option{y} offset.
  5963. @example
  5964. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5965. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5966. @end example
  5967. @end itemize
  5968. For more information about libfreetype, check:
  5969. @url{http://www.freetype.org/}.
  5970. For more information about fontconfig, check:
  5971. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5972. For more information about libfribidi, check:
  5973. @url{http://fribidi.org/}.
  5974. @section edgedetect
  5975. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5976. The filter accepts the following options:
  5977. @table @option
  5978. @item low
  5979. @item high
  5980. Set low and high threshold values used by the Canny thresholding
  5981. algorithm.
  5982. The high threshold selects the "strong" edge pixels, which are then
  5983. connected through 8-connectivity with the "weak" edge pixels selected
  5984. by the low threshold.
  5985. @var{low} and @var{high} threshold values must be chosen in the range
  5986. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5987. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5988. is @code{50/255}.
  5989. @item mode
  5990. Define the drawing mode.
  5991. @table @samp
  5992. @item wires
  5993. Draw white/gray wires on black background.
  5994. @item colormix
  5995. Mix the colors to create a paint/cartoon effect.
  5996. @end table
  5997. Default value is @var{wires}.
  5998. @end table
  5999. @subsection Examples
  6000. @itemize
  6001. @item
  6002. Standard edge detection with custom values for the hysteresis thresholding:
  6003. @example
  6004. edgedetect=low=0.1:high=0.4
  6005. @end example
  6006. @item
  6007. Painting effect without thresholding:
  6008. @example
  6009. edgedetect=mode=colormix:high=0
  6010. @end example
  6011. @end itemize
  6012. @section eq
  6013. Set brightness, contrast, saturation and approximate gamma adjustment.
  6014. The filter accepts the following options:
  6015. @table @option
  6016. @item contrast
  6017. Set the contrast expression. The value must be a float value in range
  6018. @code{-2.0} to @code{2.0}. The default value is "1".
  6019. @item brightness
  6020. Set the brightness expression. The value must be a float value in
  6021. range @code{-1.0} to @code{1.0}. The default value is "0".
  6022. @item saturation
  6023. Set the saturation expression. The value must be a float in
  6024. range @code{0.0} to @code{3.0}. The default value is "1".
  6025. @item gamma
  6026. Set the gamma expression. The value must be a float in range
  6027. @code{0.1} to @code{10.0}. The default value is "1".
  6028. @item gamma_r
  6029. Set the gamma expression for red. The value must be a float in
  6030. range @code{0.1} to @code{10.0}. The default value is "1".
  6031. @item gamma_g
  6032. Set the gamma expression for green. The value must be a float in range
  6033. @code{0.1} to @code{10.0}. The default value is "1".
  6034. @item gamma_b
  6035. Set the gamma expression for blue. The value must be a float in range
  6036. @code{0.1} to @code{10.0}. The default value is "1".
  6037. @item gamma_weight
  6038. Set the gamma weight expression. It can be used to reduce the effect
  6039. of a high gamma value on bright image areas, e.g. keep them from
  6040. getting overamplified and just plain white. The value must be a float
  6041. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6042. gamma correction all the way down while @code{1.0} leaves it at its
  6043. full strength. Default is "1".
  6044. @item eval
  6045. Set when the expressions for brightness, contrast, saturation and
  6046. gamma expressions are evaluated.
  6047. It accepts the following values:
  6048. @table @samp
  6049. @item init
  6050. only evaluate expressions once during the filter initialization or
  6051. when a command is processed
  6052. @item frame
  6053. evaluate expressions for each incoming frame
  6054. @end table
  6055. Default value is @samp{init}.
  6056. @end table
  6057. The expressions accept the following parameters:
  6058. @table @option
  6059. @item n
  6060. frame count of the input frame starting from 0
  6061. @item pos
  6062. byte position of the corresponding packet in the input file, NAN if
  6063. unspecified
  6064. @item r
  6065. frame rate of the input video, NAN if the input frame rate is unknown
  6066. @item t
  6067. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6068. @end table
  6069. @subsection Commands
  6070. The filter supports the following commands:
  6071. @table @option
  6072. @item contrast
  6073. Set the contrast expression.
  6074. @item brightness
  6075. Set the brightness expression.
  6076. @item saturation
  6077. Set the saturation expression.
  6078. @item gamma
  6079. Set the gamma expression.
  6080. @item gamma_r
  6081. Set the gamma_r expression.
  6082. @item gamma_g
  6083. Set gamma_g expression.
  6084. @item gamma_b
  6085. Set gamma_b expression.
  6086. @item gamma_weight
  6087. Set gamma_weight expression.
  6088. The command accepts the same syntax of the corresponding option.
  6089. If the specified expression is not valid, it is kept at its current
  6090. value.
  6091. @end table
  6092. @section erosion
  6093. Apply erosion effect to the video.
  6094. This filter replaces the pixel by the local(3x3) minimum.
  6095. It accepts the following options:
  6096. @table @option
  6097. @item threshold0
  6098. @item threshold1
  6099. @item threshold2
  6100. @item threshold3
  6101. Limit the maximum change for each plane, default is 65535.
  6102. If 0, plane will remain unchanged.
  6103. @item coordinates
  6104. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6105. pixels are used.
  6106. Flags to local 3x3 coordinates maps like this:
  6107. 1 2 3
  6108. 4 5
  6109. 6 7 8
  6110. @end table
  6111. @section extractplanes
  6112. Extract color channel components from input video stream into
  6113. separate grayscale video streams.
  6114. The filter accepts the following option:
  6115. @table @option
  6116. @item planes
  6117. Set plane(s) to extract.
  6118. Available values for planes are:
  6119. @table @samp
  6120. @item y
  6121. @item u
  6122. @item v
  6123. @item a
  6124. @item r
  6125. @item g
  6126. @item b
  6127. @end table
  6128. Choosing planes not available in the input will result in an error.
  6129. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6130. with @code{y}, @code{u}, @code{v} planes at same time.
  6131. @end table
  6132. @subsection Examples
  6133. @itemize
  6134. @item
  6135. Extract luma, u and v color channel component from input video frame
  6136. into 3 grayscale outputs:
  6137. @example
  6138. 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
  6139. @end example
  6140. @end itemize
  6141. @section elbg
  6142. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6143. For each input image, the filter will compute the optimal mapping from
  6144. the input to the output given the codebook length, that is the number
  6145. of distinct output colors.
  6146. This filter accepts the following options.
  6147. @table @option
  6148. @item codebook_length, l
  6149. Set codebook length. The value must be a positive integer, and
  6150. represents the number of distinct output colors. Default value is 256.
  6151. @item nb_steps, n
  6152. Set the maximum number of iterations to apply for computing the optimal
  6153. mapping. The higher the value the better the result and the higher the
  6154. computation time. Default value is 1.
  6155. @item seed, s
  6156. Set a random seed, must be an integer included between 0 and
  6157. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6158. will try to use a good random seed on a best effort basis.
  6159. @item pal8
  6160. Set pal8 output pixel format. This option does not work with codebook
  6161. length greater than 256.
  6162. @end table
  6163. @section fade
  6164. Apply a fade-in/out effect to the input video.
  6165. It accepts the following parameters:
  6166. @table @option
  6167. @item type, t
  6168. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6169. effect.
  6170. Default is @code{in}.
  6171. @item start_frame, s
  6172. Specify the number of the frame to start applying the fade
  6173. effect at. Default is 0.
  6174. @item nb_frames, n
  6175. The number of frames that the fade effect lasts. At the end of the
  6176. fade-in effect, the output video will have the same intensity as the input video.
  6177. At the end of the fade-out transition, the output video will be filled with the
  6178. selected @option{color}.
  6179. Default is 25.
  6180. @item alpha
  6181. If set to 1, fade only alpha channel, if one exists on the input.
  6182. Default value is 0.
  6183. @item start_time, st
  6184. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6185. effect. If both start_frame and start_time are specified, the fade will start at
  6186. whichever comes last. Default is 0.
  6187. @item duration, d
  6188. The number of seconds for which the fade effect has to last. At the end of the
  6189. fade-in effect the output video will have the same intensity as the input video,
  6190. at the end of the fade-out transition the output video will be filled with the
  6191. selected @option{color}.
  6192. If both duration and nb_frames are specified, duration is used. Default is 0
  6193. (nb_frames is used by default).
  6194. @item color, c
  6195. Specify the color of the fade. Default is "black".
  6196. @end table
  6197. @subsection Examples
  6198. @itemize
  6199. @item
  6200. Fade in the first 30 frames of video:
  6201. @example
  6202. fade=in:0:30
  6203. @end example
  6204. The command above is equivalent to:
  6205. @example
  6206. fade=t=in:s=0:n=30
  6207. @end example
  6208. @item
  6209. Fade out the last 45 frames of a 200-frame video:
  6210. @example
  6211. fade=out:155:45
  6212. fade=type=out:start_frame=155:nb_frames=45
  6213. @end example
  6214. @item
  6215. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6216. @example
  6217. fade=in:0:25, fade=out:975:25
  6218. @end example
  6219. @item
  6220. Make the first 5 frames yellow, then fade in from frame 5-24:
  6221. @example
  6222. fade=in:5:20:color=yellow
  6223. @end example
  6224. @item
  6225. Fade in alpha over first 25 frames of video:
  6226. @example
  6227. fade=in:0:25:alpha=1
  6228. @end example
  6229. @item
  6230. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6231. @example
  6232. fade=t=in:st=5.5:d=0.5
  6233. @end example
  6234. @end itemize
  6235. @section fftfilt
  6236. Apply arbitrary expressions to samples in frequency domain
  6237. @table @option
  6238. @item dc_Y
  6239. Adjust the dc value (gain) of the luma plane of the image. The filter
  6240. accepts an integer value in range @code{0} to @code{1000}. The default
  6241. value is set to @code{0}.
  6242. @item dc_U
  6243. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6244. filter accepts an integer value in range @code{0} to @code{1000}. The
  6245. default value is set to @code{0}.
  6246. @item dc_V
  6247. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6248. filter accepts an integer value in range @code{0} to @code{1000}. The
  6249. default value is set to @code{0}.
  6250. @item weight_Y
  6251. Set the frequency domain weight expression for the luma plane.
  6252. @item weight_U
  6253. Set the frequency domain weight expression for the 1st chroma plane.
  6254. @item weight_V
  6255. Set the frequency domain weight expression for the 2nd chroma plane.
  6256. @item eval
  6257. Set when the expressions are evaluated.
  6258. It accepts the following values:
  6259. @table @samp
  6260. @item init
  6261. Only evaluate expressions once during the filter initialization.
  6262. @item frame
  6263. Evaluate expressions for each incoming frame.
  6264. @end table
  6265. Default value is @samp{init}.
  6266. The filter accepts the following variables:
  6267. @item X
  6268. @item Y
  6269. The coordinates of the current sample.
  6270. @item W
  6271. @item H
  6272. The width and height of the image.
  6273. @item N
  6274. The number of input frame, starting from 0.
  6275. @end table
  6276. @subsection Examples
  6277. @itemize
  6278. @item
  6279. High-pass:
  6280. @example
  6281. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6282. @end example
  6283. @item
  6284. Low-pass:
  6285. @example
  6286. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6287. @end example
  6288. @item
  6289. Sharpen:
  6290. @example
  6291. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6292. @end example
  6293. @item
  6294. Blur:
  6295. @example
  6296. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6297. @end example
  6298. @end itemize
  6299. @section field
  6300. Extract a single field from an interlaced image using stride
  6301. arithmetic to avoid wasting CPU time. The output frames are marked as
  6302. non-interlaced.
  6303. The filter accepts the following options:
  6304. @table @option
  6305. @item type
  6306. Specify whether to extract the top (if the value is @code{0} or
  6307. @code{top}) or the bottom field (if the value is @code{1} or
  6308. @code{bottom}).
  6309. @end table
  6310. @section fieldhint
  6311. Create new frames by copying the top and bottom fields from surrounding frames
  6312. supplied as numbers by the hint file.
  6313. @table @option
  6314. @item hint
  6315. Set file containing hints: absolute/relative frame numbers.
  6316. There must be one line for each frame in a clip. Each line must contain two
  6317. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6318. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6319. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6320. for @code{relative} mode. First number tells from which frame to pick up top
  6321. field and second number tells from which frame to pick up bottom field.
  6322. If optionally followed by @code{+} output frame will be marked as interlaced,
  6323. else if followed by @code{-} output frame will be marked as progressive, else
  6324. it will be marked same as input frame.
  6325. If line starts with @code{#} or @code{;} that line is skipped.
  6326. @item mode
  6327. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6328. @end table
  6329. Example of first several lines of @code{hint} file for @code{relative} mode:
  6330. @example
  6331. 0,0 - # first frame
  6332. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6333. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6334. 1,0 -
  6335. 0,0 -
  6336. 0,0 -
  6337. 1,0 -
  6338. 1,0 -
  6339. 1,0 -
  6340. 0,0 -
  6341. 0,0 -
  6342. 1,0 -
  6343. 1,0 -
  6344. 1,0 -
  6345. 0,0 -
  6346. @end example
  6347. @section fieldmatch
  6348. Field matching filter for inverse telecine. It is meant to reconstruct the
  6349. progressive frames from a telecined stream. The filter does not drop duplicated
  6350. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6351. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6352. The separation of the field matching and the decimation is notably motivated by
  6353. the possibility of inserting a de-interlacing filter fallback between the two.
  6354. If the source has mixed telecined and real interlaced content,
  6355. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6356. But these remaining combed frames will be marked as interlaced, and thus can be
  6357. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6358. In addition to the various configuration options, @code{fieldmatch} can take an
  6359. optional second stream, activated through the @option{ppsrc} option. If
  6360. enabled, the frames reconstruction will be based on the fields and frames from
  6361. this second stream. This allows the first input to be pre-processed in order to
  6362. help the various algorithms of the filter, while keeping the output lossless
  6363. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6364. or brightness/contrast adjustments can help.
  6365. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6366. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6367. which @code{fieldmatch} is based on. While the semantic and usage are very
  6368. close, some behaviour and options names can differ.
  6369. The @ref{decimate} filter currently only works for constant frame rate input.
  6370. If your input has mixed telecined (30fps) and progressive content with a lower
  6371. framerate like 24fps use the following filterchain to produce the necessary cfr
  6372. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6373. The filter accepts the following options:
  6374. @table @option
  6375. @item order
  6376. Specify the assumed field order of the input stream. Available values are:
  6377. @table @samp
  6378. @item auto
  6379. Auto detect parity (use FFmpeg's internal parity value).
  6380. @item bff
  6381. Assume bottom field first.
  6382. @item tff
  6383. Assume top field first.
  6384. @end table
  6385. Note that it is sometimes recommended not to trust the parity announced by the
  6386. stream.
  6387. Default value is @var{auto}.
  6388. @item mode
  6389. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6390. sense that it won't risk creating jerkiness due to duplicate frames when
  6391. possible, but if there are bad edits or blended fields it will end up
  6392. outputting combed frames when a good match might actually exist. On the other
  6393. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6394. but will almost always find a good frame if there is one. The other values are
  6395. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6396. jerkiness and creating duplicate frames versus finding good matches in sections
  6397. with bad edits, orphaned fields, blended fields, etc.
  6398. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6399. Available values are:
  6400. @table @samp
  6401. @item pc
  6402. 2-way matching (p/c)
  6403. @item pc_n
  6404. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6405. @item pc_u
  6406. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6407. @item pc_n_ub
  6408. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6409. still combed (p/c + n + u/b)
  6410. @item pcn
  6411. 3-way matching (p/c/n)
  6412. @item pcn_ub
  6413. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6414. detected as combed (p/c/n + u/b)
  6415. @end table
  6416. The parenthesis at the end indicate the matches that would be used for that
  6417. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6418. @var{top}).
  6419. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6420. the slowest.
  6421. Default value is @var{pc_n}.
  6422. @item ppsrc
  6423. Mark the main input stream as a pre-processed input, and enable the secondary
  6424. input stream as the clean source to pick the fields from. See the filter
  6425. introduction for more details. It is similar to the @option{clip2} feature from
  6426. VFM/TFM.
  6427. Default value is @code{0} (disabled).
  6428. @item field
  6429. Set the field to match from. It is recommended to set this to the same value as
  6430. @option{order} unless you experience matching failures with that setting. In
  6431. certain circumstances changing the field that is used to match from can have a
  6432. large impact on matching performance. Available values are:
  6433. @table @samp
  6434. @item auto
  6435. Automatic (same value as @option{order}).
  6436. @item bottom
  6437. Match from the bottom field.
  6438. @item top
  6439. Match from the top field.
  6440. @end table
  6441. Default value is @var{auto}.
  6442. @item mchroma
  6443. Set whether or not chroma is included during the match comparisons. In most
  6444. cases it is recommended to leave this enabled. You should set this to @code{0}
  6445. only if your clip has bad chroma problems such as heavy rainbowing or other
  6446. artifacts. Setting this to @code{0} could also be used to speed things up at
  6447. the cost of some accuracy.
  6448. Default value is @code{1}.
  6449. @item y0
  6450. @item y1
  6451. These define an exclusion band which excludes the lines between @option{y0} and
  6452. @option{y1} from being included in the field matching decision. An exclusion
  6453. band can be used to ignore subtitles, a logo, or other things that may
  6454. interfere with the matching. @option{y0} sets the starting scan line and
  6455. @option{y1} sets the ending line; all lines in between @option{y0} and
  6456. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6457. @option{y0} and @option{y1} to the same value will disable the feature.
  6458. @option{y0} and @option{y1} defaults to @code{0}.
  6459. @item scthresh
  6460. Set the scene change detection threshold as a percentage of maximum change on
  6461. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6462. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6463. @option{scthresh} is @code{[0.0, 100.0]}.
  6464. Default value is @code{12.0}.
  6465. @item combmatch
  6466. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6467. account the combed scores of matches when deciding what match to use as the
  6468. final match. Available values are:
  6469. @table @samp
  6470. @item none
  6471. No final matching based on combed scores.
  6472. @item sc
  6473. Combed scores are only used when a scene change is detected.
  6474. @item full
  6475. Use combed scores all the time.
  6476. @end table
  6477. Default is @var{sc}.
  6478. @item combdbg
  6479. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6480. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6481. Available values are:
  6482. @table @samp
  6483. @item none
  6484. No forced calculation.
  6485. @item pcn
  6486. Force p/c/n calculations.
  6487. @item pcnub
  6488. Force p/c/n/u/b calculations.
  6489. @end table
  6490. Default value is @var{none}.
  6491. @item cthresh
  6492. This is the area combing threshold used for combed frame detection. This
  6493. essentially controls how "strong" or "visible" combing must be to be detected.
  6494. Larger values mean combing must be more visible and smaller values mean combing
  6495. can be less visible or strong and still be detected. Valid settings are from
  6496. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6497. be detected as combed). This is basically a pixel difference value. A good
  6498. range is @code{[8, 12]}.
  6499. Default value is @code{9}.
  6500. @item chroma
  6501. Sets whether or not chroma is considered in the combed frame decision. Only
  6502. disable this if your source has chroma problems (rainbowing, etc.) that are
  6503. causing problems for the combed frame detection with chroma enabled. Actually,
  6504. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6505. where there is chroma only combing in the source.
  6506. Default value is @code{0}.
  6507. @item blockx
  6508. @item blocky
  6509. Respectively set the x-axis and y-axis size of the window used during combed
  6510. frame detection. This has to do with the size of the area in which
  6511. @option{combpel} pixels are required to be detected as combed for a frame to be
  6512. declared combed. See the @option{combpel} parameter description for more info.
  6513. Possible values are any number that is a power of 2 starting at 4 and going up
  6514. to 512.
  6515. Default value is @code{16}.
  6516. @item combpel
  6517. The number of combed pixels inside any of the @option{blocky} by
  6518. @option{blockx} size blocks on the frame for the frame to be detected as
  6519. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6520. setting controls "how much" combing there must be in any localized area (a
  6521. window defined by the @option{blockx} and @option{blocky} settings) on the
  6522. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6523. which point no frames will ever be detected as combed). This setting is known
  6524. as @option{MI} in TFM/VFM vocabulary.
  6525. Default value is @code{80}.
  6526. @end table
  6527. @anchor{p/c/n/u/b meaning}
  6528. @subsection p/c/n/u/b meaning
  6529. @subsubsection p/c/n
  6530. We assume the following telecined stream:
  6531. @example
  6532. Top fields: 1 2 2 3 4
  6533. Bottom fields: 1 2 3 4 4
  6534. @end example
  6535. The numbers correspond to the progressive frame the fields relate to. Here, the
  6536. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6537. When @code{fieldmatch} is configured to run a matching from bottom
  6538. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6539. @example
  6540. Input stream:
  6541. T 1 2 2 3 4
  6542. B 1 2 3 4 4 <-- matching reference
  6543. Matches: c c n n c
  6544. Output stream:
  6545. T 1 2 3 4 4
  6546. B 1 2 3 4 4
  6547. @end example
  6548. As a result of the field matching, we can see that some frames get duplicated.
  6549. To perform a complete inverse telecine, you need to rely on a decimation filter
  6550. after this operation. See for instance the @ref{decimate} filter.
  6551. The same operation now matching from top fields (@option{field}=@var{top})
  6552. looks like this:
  6553. @example
  6554. Input stream:
  6555. T 1 2 2 3 4 <-- matching reference
  6556. B 1 2 3 4 4
  6557. Matches: c c p p c
  6558. Output stream:
  6559. T 1 2 2 3 4
  6560. B 1 2 2 3 4
  6561. @end example
  6562. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6563. basically, they refer to the frame and field of the opposite parity:
  6564. @itemize
  6565. @item @var{p} matches the field of the opposite parity in the previous frame
  6566. @item @var{c} matches the field of the opposite parity in the current frame
  6567. @item @var{n} matches the field of the opposite parity in the next frame
  6568. @end itemize
  6569. @subsubsection u/b
  6570. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6571. from the opposite parity flag. In the following examples, we assume that we are
  6572. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6573. 'x' is placed above and below each matched fields.
  6574. With bottom matching (@option{field}=@var{bottom}):
  6575. @example
  6576. Match: c p n b u
  6577. x x x x x
  6578. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6579. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6580. x x x x x
  6581. Output frames:
  6582. 2 1 2 2 2
  6583. 2 2 2 1 3
  6584. @end example
  6585. With top matching (@option{field}=@var{top}):
  6586. @example
  6587. Match: c p n b u
  6588. x x x x x
  6589. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6590. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6591. x x x x x
  6592. Output frames:
  6593. 2 2 2 1 2
  6594. 2 1 3 2 2
  6595. @end example
  6596. @subsection Examples
  6597. Simple IVTC of a top field first telecined stream:
  6598. @example
  6599. fieldmatch=order=tff:combmatch=none, decimate
  6600. @end example
  6601. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6602. @example
  6603. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6604. @end example
  6605. @section fieldorder
  6606. Transform the field order of the input video.
  6607. It accepts the following parameters:
  6608. @table @option
  6609. @item order
  6610. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6611. for bottom field first.
  6612. @end table
  6613. The default value is @samp{tff}.
  6614. The transformation is done by shifting the picture content up or down
  6615. by one line, and filling the remaining line with appropriate picture content.
  6616. This method is consistent with most broadcast field order converters.
  6617. If the input video is not flagged as being interlaced, or it is already
  6618. flagged as being of the required output field order, then this filter does
  6619. not alter the incoming video.
  6620. It is very useful when converting to or from PAL DV material,
  6621. which is bottom field first.
  6622. For example:
  6623. @example
  6624. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6625. @end example
  6626. @section fifo, afifo
  6627. Buffer input images and send them when they are requested.
  6628. It is mainly useful when auto-inserted by the libavfilter
  6629. framework.
  6630. It does not take parameters.
  6631. @section find_rect
  6632. Find a rectangular object
  6633. It accepts the following options:
  6634. @table @option
  6635. @item object
  6636. Filepath of the object image, needs to be in gray8.
  6637. @item threshold
  6638. Detection threshold, default is 0.5.
  6639. @item mipmaps
  6640. Number of mipmaps, default is 3.
  6641. @item xmin, ymin, xmax, ymax
  6642. Specifies the rectangle in which to search.
  6643. @end table
  6644. @subsection Examples
  6645. @itemize
  6646. @item
  6647. Generate a representative palette of a given video using @command{ffmpeg}:
  6648. @example
  6649. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6650. @end example
  6651. @end itemize
  6652. @section cover_rect
  6653. Cover a rectangular object
  6654. It accepts the following options:
  6655. @table @option
  6656. @item cover
  6657. Filepath of the optional cover image, needs to be in yuv420.
  6658. @item mode
  6659. Set covering mode.
  6660. It accepts the following values:
  6661. @table @samp
  6662. @item cover
  6663. cover it by the supplied image
  6664. @item blur
  6665. cover it by interpolating the surrounding pixels
  6666. @end table
  6667. Default value is @var{blur}.
  6668. @end table
  6669. @subsection Examples
  6670. @itemize
  6671. @item
  6672. Generate a representative palette of a given video using @command{ffmpeg}:
  6673. @example
  6674. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6675. @end example
  6676. @end itemize
  6677. @section floodfill
  6678. Flood area with values of same pixel components with another values.
  6679. It accepts the following options:
  6680. @table @option
  6681. @item x
  6682. Set pixel x coordinate.
  6683. @item y
  6684. Set pixel y coordinate.
  6685. @item s0
  6686. Set source #0 component value.
  6687. @item s1
  6688. Set source #1 component value.
  6689. @item s2
  6690. Set source #2 component value.
  6691. @item s3
  6692. Set source #3 component value.
  6693. @item d0
  6694. Set destination #0 component value.
  6695. @item d1
  6696. Set destination #1 component value.
  6697. @item d2
  6698. Set destination #2 component value.
  6699. @item d3
  6700. Set destination #3 component value.
  6701. @end table
  6702. @anchor{format}
  6703. @section format
  6704. Convert the input video to one of the specified pixel formats.
  6705. Libavfilter will try to pick one that is suitable as input to
  6706. the next filter.
  6707. It accepts the following parameters:
  6708. @table @option
  6709. @item pix_fmts
  6710. A '|'-separated list of pixel format names, such as
  6711. "pix_fmts=yuv420p|monow|rgb24".
  6712. @end table
  6713. @subsection Examples
  6714. @itemize
  6715. @item
  6716. Convert the input video to the @var{yuv420p} format
  6717. @example
  6718. format=pix_fmts=yuv420p
  6719. @end example
  6720. Convert the input video to any of the formats in the list
  6721. @example
  6722. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6723. @end example
  6724. @end itemize
  6725. @anchor{fps}
  6726. @section fps
  6727. Convert the video to specified constant frame rate by duplicating or dropping
  6728. frames as necessary.
  6729. It accepts the following parameters:
  6730. @table @option
  6731. @item fps
  6732. The desired output frame rate. The default is @code{25}.
  6733. @item start_time
  6734. Assume the first PTS should be the given value, in seconds. This allows for
  6735. padding/trimming at the start of stream. By default, no assumption is made
  6736. about the first frame's expected PTS, so no padding or trimming is done.
  6737. For example, this could be set to 0 to pad the beginning with duplicates of
  6738. the first frame if a video stream starts after the audio stream or to trim any
  6739. frames with a negative PTS.
  6740. @item round
  6741. Timestamp (PTS) rounding method.
  6742. Possible values are:
  6743. @table @option
  6744. @item zero
  6745. round towards 0
  6746. @item inf
  6747. round away from 0
  6748. @item down
  6749. round towards -infinity
  6750. @item up
  6751. round towards +infinity
  6752. @item near
  6753. round to nearest
  6754. @end table
  6755. The default is @code{near}.
  6756. @item eof_action
  6757. Action performed when reading the last frame.
  6758. Possible values are:
  6759. @table @option
  6760. @item round
  6761. Use same timestamp rounding method as used for other frames.
  6762. @item pass
  6763. Pass through last frame if input duration has not been reached yet.
  6764. @end table
  6765. The default is @code{round}.
  6766. @end table
  6767. Alternatively, the options can be specified as a flat string:
  6768. @var{fps}[:@var{start_time}[:@var{round}]].
  6769. See also the @ref{setpts} filter.
  6770. @subsection Examples
  6771. @itemize
  6772. @item
  6773. A typical usage in order to set the fps to 25:
  6774. @example
  6775. fps=fps=25
  6776. @end example
  6777. @item
  6778. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6779. @example
  6780. fps=fps=film:round=near
  6781. @end example
  6782. @end itemize
  6783. @section framepack
  6784. Pack two different video streams into a stereoscopic video, setting proper
  6785. metadata on supported codecs. The two views should have the same size and
  6786. framerate and processing will stop when the shorter video ends. Please note
  6787. that you may conveniently adjust view properties with the @ref{scale} and
  6788. @ref{fps} filters.
  6789. It accepts the following parameters:
  6790. @table @option
  6791. @item format
  6792. The desired packing format. Supported values are:
  6793. @table @option
  6794. @item sbs
  6795. The views are next to each other (default).
  6796. @item tab
  6797. The views are on top of each other.
  6798. @item lines
  6799. The views are packed by line.
  6800. @item columns
  6801. The views are packed by column.
  6802. @item frameseq
  6803. The views are temporally interleaved.
  6804. @end table
  6805. @end table
  6806. Some examples:
  6807. @example
  6808. # Convert left and right views into a frame-sequential video
  6809. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6810. # Convert views into a side-by-side video with the same output resolution as the input
  6811. 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
  6812. @end example
  6813. @section framerate
  6814. Change the frame rate by interpolating new video output frames from the source
  6815. frames.
  6816. This filter is not designed to function correctly with interlaced media. If
  6817. you wish to change the frame rate of interlaced media then you are required
  6818. to deinterlace before this filter and re-interlace after this filter.
  6819. A description of the accepted options follows.
  6820. @table @option
  6821. @item fps
  6822. Specify the output frames per second. This option can also be specified
  6823. as a value alone. The default is @code{50}.
  6824. @item interp_start
  6825. Specify the start of a range where the output frame will be created as a
  6826. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6827. the default is @code{15}.
  6828. @item interp_end
  6829. Specify the end of a range where the output frame will be created as a
  6830. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6831. the default is @code{240}.
  6832. @item scene
  6833. Specify the level at which a scene change is detected as a value between
  6834. 0 and 100 to indicate a new scene; a low value reflects a low
  6835. probability for the current frame to introduce a new scene, while a higher
  6836. value means the current frame is more likely to be one.
  6837. The default is @code{7}.
  6838. @item flags
  6839. Specify flags influencing the filter process.
  6840. Available value for @var{flags} is:
  6841. @table @option
  6842. @item scene_change_detect, scd
  6843. Enable scene change detection using the value of the option @var{scene}.
  6844. This flag is enabled by default.
  6845. @end table
  6846. @end table
  6847. @section framestep
  6848. Select one frame every N-th frame.
  6849. This filter accepts the following option:
  6850. @table @option
  6851. @item step
  6852. Select frame after every @code{step} frames.
  6853. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6854. @end table
  6855. @anchor{frei0r}
  6856. @section frei0r
  6857. Apply a frei0r effect to the input video.
  6858. To enable the compilation of this filter, you need to install the frei0r
  6859. header and configure FFmpeg with @code{--enable-frei0r}.
  6860. It accepts the following parameters:
  6861. @table @option
  6862. @item filter_name
  6863. The name of the frei0r effect to load. If the environment variable
  6864. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6865. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6866. Otherwise, the standard frei0r paths are searched, in this order:
  6867. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6868. @file{/usr/lib/frei0r-1/}.
  6869. @item filter_params
  6870. A '|'-separated list of parameters to pass to the frei0r effect.
  6871. @end table
  6872. A frei0r effect parameter can be a boolean (its value is either
  6873. "y" or "n"), a double, a color (specified as
  6874. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6875. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6876. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6877. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6878. The number and types of parameters depend on the loaded effect. If an
  6879. effect parameter is not specified, the default value is set.
  6880. @subsection Examples
  6881. @itemize
  6882. @item
  6883. Apply the distort0r effect, setting the first two double parameters:
  6884. @example
  6885. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6886. @end example
  6887. @item
  6888. Apply the colordistance effect, taking a color as the first parameter:
  6889. @example
  6890. frei0r=colordistance:0.2/0.3/0.4
  6891. frei0r=colordistance:violet
  6892. frei0r=colordistance:0x112233
  6893. @end example
  6894. @item
  6895. Apply the perspective effect, specifying the top left and top right image
  6896. positions:
  6897. @example
  6898. frei0r=perspective:0.2/0.2|0.8/0.2
  6899. @end example
  6900. @end itemize
  6901. For more information, see
  6902. @url{http://frei0r.dyne.org}
  6903. @section fspp
  6904. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6905. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6906. processing filter, one of them is performed once per block, not per pixel.
  6907. This allows for much higher speed.
  6908. The filter accepts the following options:
  6909. @table @option
  6910. @item quality
  6911. Set quality. This option defines the number of levels for averaging. It accepts
  6912. an integer in the range 4-5. Default value is @code{4}.
  6913. @item qp
  6914. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6915. If not set, the filter will use the QP from the video stream (if available).
  6916. @item strength
  6917. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6918. more details but also more artifacts, while higher values make the image smoother
  6919. but also blurrier. Default value is @code{0} − PSNR optimal.
  6920. @item use_bframe_qp
  6921. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6922. option may cause flicker since the B-Frames have often larger QP. Default is
  6923. @code{0} (not enabled).
  6924. @end table
  6925. @section gblur
  6926. Apply Gaussian blur filter.
  6927. The filter accepts the following options:
  6928. @table @option
  6929. @item sigma
  6930. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6931. @item steps
  6932. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6933. @item planes
  6934. Set which planes to filter. By default all planes are filtered.
  6935. @item sigmaV
  6936. Set vertical sigma, if negative it will be same as @code{sigma}.
  6937. Default is @code{-1}.
  6938. @end table
  6939. @section geq
  6940. The filter accepts the following options:
  6941. @table @option
  6942. @item lum_expr, lum
  6943. Set the luminance expression.
  6944. @item cb_expr, cb
  6945. Set the chrominance blue expression.
  6946. @item cr_expr, cr
  6947. Set the chrominance red expression.
  6948. @item alpha_expr, a
  6949. Set the alpha expression.
  6950. @item red_expr, r
  6951. Set the red expression.
  6952. @item green_expr, g
  6953. Set the green expression.
  6954. @item blue_expr, b
  6955. Set the blue expression.
  6956. @end table
  6957. The colorspace is selected according to the specified options. If one
  6958. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6959. options is specified, the filter will automatically select a YCbCr
  6960. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6961. @option{blue_expr} options is specified, it will select an RGB
  6962. colorspace.
  6963. If one of the chrominance expression is not defined, it falls back on the other
  6964. one. If no alpha expression is specified it will evaluate to opaque value.
  6965. If none of chrominance expressions are specified, they will evaluate
  6966. to the luminance expression.
  6967. The expressions can use the following variables and functions:
  6968. @table @option
  6969. @item N
  6970. The sequential number of the filtered frame, starting from @code{0}.
  6971. @item X
  6972. @item Y
  6973. The coordinates of the current sample.
  6974. @item W
  6975. @item H
  6976. The width and height of the image.
  6977. @item SW
  6978. @item SH
  6979. Width and height scale depending on the currently filtered plane. It is the
  6980. ratio between the corresponding luma plane number of pixels and the current
  6981. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6982. @code{0.5,0.5} for chroma planes.
  6983. @item T
  6984. Time of the current frame, expressed in seconds.
  6985. @item p(x, y)
  6986. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6987. plane.
  6988. @item lum(x, y)
  6989. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6990. plane.
  6991. @item cb(x, y)
  6992. Return the value of the pixel at location (@var{x},@var{y}) of the
  6993. blue-difference chroma plane. Return 0 if there is no such plane.
  6994. @item cr(x, y)
  6995. Return the value of the pixel at location (@var{x},@var{y}) of the
  6996. red-difference chroma plane. Return 0 if there is no such plane.
  6997. @item r(x, y)
  6998. @item g(x, y)
  6999. @item b(x, y)
  7000. Return the value of the pixel at location (@var{x},@var{y}) of the
  7001. red/green/blue component. Return 0 if there is no such component.
  7002. @item alpha(x, y)
  7003. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7004. plane. Return 0 if there is no such plane.
  7005. @end table
  7006. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7007. automatically clipped to the closer edge.
  7008. @subsection Examples
  7009. @itemize
  7010. @item
  7011. Flip the image horizontally:
  7012. @example
  7013. geq=p(W-X\,Y)
  7014. @end example
  7015. @item
  7016. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7017. wavelength of 100 pixels:
  7018. @example
  7019. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7020. @end example
  7021. @item
  7022. Generate a fancy enigmatic moving light:
  7023. @example
  7024. 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
  7025. @end example
  7026. @item
  7027. Generate a quick emboss effect:
  7028. @example
  7029. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7030. @end example
  7031. @item
  7032. Modify RGB components depending on pixel position:
  7033. @example
  7034. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7035. @end example
  7036. @item
  7037. Create a radial gradient that is the same size as the input (also see
  7038. the @ref{vignette} filter):
  7039. @example
  7040. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7041. @end example
  7042. @end itemize
  7043. @section gradfun
  7044. Fix the banding artifacts that are sometimes introduced into nearly flat
  7045. regions by truncation to 8-bit color depth.
  7046. Interpolate the gradients that should go where the bands are, and
  7047. dither them.
  7048. It is designed for playback only. Do not use it prior to
  7049. lossy compression, because compression tends to lose the dither and
  7050. bring back the bands.
  7051. It accepts the following parameters:
  7052. @table @option
  7053. @item strength
  7054. The maximum amount by which the filter will change any one pixel. This is also
  7055. the threshold for detecting nearly flat regions. Acceptable values range from
  7056. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7057. valid range.
  7058. @item radius
  7059. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7060. gradients, but also prevents the filter from modifying the pixels near detailed
  7061. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7062. values will be clipped to the valid range.
  7063. @end table
  7064. Alternatively, the options can be specified as a flat string:
  7065. @var{strength}[:@var{radius}]
  7066. @subsection Examples
  7067. @itemize
  7068. @item
  7069. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7070. @example
  7071. gradfun=3.5:8
  7072. @end example
  7073. @item
  7074. Specify radius, omitting the strength (which will fall-back to the default
  7075. value):
  7076. @example
  7077. gradfun=radius=8
  7078. @end example
  7079. @end itemize
  7080. @anchor{haldclut}
  7081. @section haldclut
  7082. Apply a Hald CLUT to a video stream.
  7083. First input is the video stream to process, and second one is the Hald CLUT.
  7084. The Hald CLUT input can be a simple picture or a complete video stream.
  7085. The filter accepts the following options:
  7086. @table @option
  7087. @item shortest
  7088. Force termination when the shortest input terminates. Default is @code{0}.
  7089. @item repeatlast
  7090. Continue applying the last CLUT after the end of the stream. A value of
  7091. @code{0} disable the filter after the last frame of the CLUT is reached.
  7092. Default is @code{1}.
  7093. @end table
  7094. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7095. filters share the same internals).
  7096. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7097. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7098. @subsection Workflow examples
  7099. @subsubsection Hald CLUT video stream
  7100. Generate an identity Hald CLUT stream altered with various effects:
  7101. @example
  7102. 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
  7103. @end example
  7104. Note: make sure you use a lossless codec.
  7105. Then use it with @code{haldclut} to apply it on some random stream:
  7106. @example
  7107. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7108. @end example
  7109. The Hald CLUT will be applied to the 10 first seconds (duration of
  7110. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7111. to the remaining frames of the @code{mandelbrot} stream.
  7112. @subsubsection Hald CLUT with preview
  7113. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7114. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7115. biggest possible square starting at the top left of the picture. The remaining
  7116. padding pixels (bottom or right) will be ignored. This area can be used to add
  7117. a preview of the Hald CLUT.
  7118. Typically, the following generated Hald CLUT will be supported by the
  7119. @code{haldclut} filter:
  7120. @example
  7121. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7122. pad=iw+320 [padded_clut];
  7123. smptebars=s=320x256, split [a][b];
  7124. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7125. [main][b] overlay=W-320" -frames:v 1 clut.png
  7126. @end example
  7127. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7128. bars are displayed on the right-top, and below the same color bars processed by
  7129. the color changes.
  7130. Then, the effect of this Hald CLUT can be visualized with:
  7131. @example
  7132. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7133. @end example
  7134. @section hflip
  7135. Flip the input video horizontally.
  7136. For example, to horizontally flip the input video with @command{ffmpeg}:
  7137. @example
  7138. ffmpeg -i in.avi -vf "hflip" out.avi
  7139. @end example
  7140. @section histeq
  7141. This filter applies a global color histogram equalization on a
  7142. per-frame basis.
  7143. It can be used to correct video that has a compressed range of pixel
  7144. intensities. The filter redistributes the pixel intensities to
  7145. equalize their distribution across the intensity range. It may be
  7146. viewed as an "automatically adjusting contrast filter". This filter is
  7147. useful only for correcting degraded or poorly captured source
  7148. video.
  7149. The filter accepts the following options:
  7150. @table @option
  7151. @item strength
  7152. Determine the amount of equalization to be applied. As the strength
  7153. is reduced, the distribution of pixel intensities more-and-more
  7154. approaches that of the input frame. The value must be a float number
  7155. in the range [0,1] and defaults to 0.200.
  7156. @item intensity
  7157. Set the maximum intensity that can generated and scale the output
  7158. values appropriately. The strength should be set as desired and then
  7159. the intensity can be limited if needed to avoid washing-out. The value
  7160. must be a float number in the range [0,1] and defaults to 0.210.
  7161. @item antibanding
  7162. Set the antibanding level. If enabled the filter will randomly vary
  7163. the luminance of output pixels by a small amount to avoid banding of
  7164. the histogram. Possible values are @code{none}, @code{weak} or
  7165. @code{strong}. It defaults to @code{none}.
  7166. @end table
  7167. @section histogram
  7168. Compute and draw a color distribution histogram for the input video.
  7169. The computed histogram is a representation of the color component
  7170. distribution in an image.
  7171. Standard histogram displays the color components distribution in an image.
  7172. Displays color graph for each color component. Shows distribution of
  7173. the Y, U, V, A or R, G, B components, depending on input format, in the
  7174. current frame. Below each graph a color component scale meter is shown.
  7175. The filter accepts the following options:
  7176. @table @option
  7177. @item level_height
  7178. Set height of level. Default value is @code{200}.
  7179. Allowed range is [50, 2048].
  7180. @item scale_height
  7181. Set height of color scale. Default value is @code{12}.
  7182. Allowed range is [0, 40].
  7183. @item display_mode
  7184. Set display mode.
  7185. It accepts the following values:
  7186. @table @samp
  7187. @item stack
  7188. Per color component graphs are placed below each other.
  7189. @item parade
  7190. Per color component graphs are placed side by side.
  7191. @item overlay
  7192. Presents information identical to that in the @code{parade}, except
  7193. that the graphs representing color components are superimposed directly
  7194. over one another.
  7195. @end table
  7196. Default is @code{stack}.
  7197. @item levels_mode
  7198. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7199. Default is @code{linear}.
  7200. @item components
  7201. Set what color components to display.
  7202. Default is @code{7}.
  7203. @item fgopacity
  7204. Set foreground opacity. Default is @code{0.7}.
  7205. @item bgopacity
  7206. Set background opacity. Default is @code{0.5}.
  7207. @end table
  7208. @subsection Examples
  7209. @itemize
  7210. @item
  7211. Calculate and draw histogram:
  7212. @example
  7213. ffplay -i input -vf histogram
  7214. @end example
  7215. @end itemize
  7216. @anchor{hqdn3d}
  7217. @section hqdn3d
  7218. This is a high precision/quality 3d denoise filter. It aims to reduce
  7219. image noise, producing smooth images and making still images really
  7220. still. It should enhance compressibility.
  7221. It accepts the following optional parameters:
  7222. @table @option
  7223. @item luma_spatial
  7224. A non-negative floating point number which specifies spatial luma strength.
  7225. It defaults to 4.0.
  7226. @item chroma_spatial
  7227. A non-negative floating point number which specifies spatial chroma strength.
  7228. It defaults to 3.0*@var{luma_spatial}/4.0.
  7229. @item luma_tmp
  7230. A floating point number which specifies luma temporal strength. It defaults to
  7231. 6.0*@var{luma_spatial}/4.0.
  7232. @item chroma_tmp
  7233. A floating point number which specifies chroma temporal strength. It defaults to
  7234. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7235. @end table
  7236. @section hwdownload
  7237. Download hardware frames to system memory.
  7238. The input must be in hardware frames, and the output a non-hardware format.
  7239. Not all formats will be supported on the output - it may be necessary to insert
  7240. an additional @option{format} filter immediately following in the graph to get
  7241. the output in a supported format.
  7242. @section hwmap
  7243. Map hardware frames to system memory or to another device.
  7244. This filter has several different modes of operation; which one is used depends
  7245. on the input and output formats:
  7246. @itemize
  7247. @item
  7248. Hardware frame input, normal frame output
  7249. Map the input frames to system memory and pass them to the output. If the
  7250. original hardware frame is later required (for example, after overlaying
  7251. something else on part of it), the @option{hwmap} filter can be used again
  7252. in the next mode to retrieve it.
  7253. @item
  7254. Normal frame input, hardware frame output
  7255. If the input is actually a software-mapped hardware frame, then unmap it -
  7256. that is, return the original hardware frame.
  7257. Otherwise, a device must be provided. Create new hardware surfaces on that
  7258. device for the output, then map them back to the software format at the input
  7259. and give those frames to the preceding filter. This will then act like the
  7260. @option{hwupload} filter, but may be able to avoid an additional copy when
  7261. the input is already in a compatible format.
  7262. @item
  7263. Hardware frame input and output
  7264. A device must be supplied for the output, either directly or with the
  7265. @option{derive_device} option. The input and output devices must be of
  7266. different types and compatible - the exact meaning of this is
  7267. system-dependent, but typically it means that they must refer to the same
  7268. underlying hardware context (for example, refer to the same graphics card).
  7269. If the input frames were originally created on the output device, then unmap
  7270. to retrieve the original frames.
  7271. Otherwise, map the frames to the output device - create new hardware frames
  7272. on the output corresponding to the frames on the input.
  7273. @end itemize
  7274. The following additional parameters are accepted:
  7275. @table @option
  7276. @item mode
  7277. Set the frame mapping mode. Some combination of:
  7278. @table @var
  7279. @item read
  7280. The mapped frame should be readable.
  7281. @item write
  7282. The mapped frame should be writeable.
  7283. @item overwrite
  7284. The mapping will always overwrite the entire frame.
  7285. This may improve performance in some cases, as the original contents of the
  7286. frame need not be loaded.
  7287. @item direct
  7288. The mapping must not involve any copying.
  7289. Indirect mappings to copies of frames are created in some cases where either
  7290. direct mapping is not possible or it would have unexpected properties.
  7291. Setting this flag ensures that the mapping is direct and will fail if that is
  7292. not possible.
  7293. @end table
  7294. Defaults to @var{read+write} if not specified.
  7295. @item derive_device @var{type}
  7296. Rather than using the device supplied at initialisation, instead derive a new
  7297. device of type @var{type} from the device the input frames exist on.
  7298. @item reverse
  7299. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7300. and map them back to the source. This may be necessary in some cases where
  7301. a mapping in one direction is required but only the opposite direction is
  7302. supported by the devices being used.
  7303. This option is dangerous - it may break the preceding filter in undefined
  7304. ways if there are any additional constraints on that filter's output.
  7305. Do not use it without fully understanding the implications of its use.
  7306. @end table
  7307. @section hwupload
  7308. Upload system memory frames to hardware surfaces.
  7309. The device to upload to must be supplied when the filter is initialised. If
  7310. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7311. option.
  7312. @anchor{hwupload_cuda}
  7313. @section hwupload_cuda
  7314. Upload system memory frames to a CUDA device.
  7315. It accepts the following optional parameters:
  7316. @table @option
  7317. @item device
  7318. The number of the CUDA device to use
  7319. @end table
  7320. @section hqx
  7321. Apply a high-quality magnification filter designed for pixel art. This filter
  7322. was originally created by Maxim Stepin.
  7323. It accepts the following option:
  7324. @table @option
  7325. @item n
  7326. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7327. @code{hq3x} and @code{4} for @code{hq4x}.
  7328. Default is @code{3}.
  7329. @end table
  7330. @section hstack
  7331. Stack input videos horizontally.
  7332. All streams must be of same pixel format and of same height.
  7333. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7334. to create same output.
  7335. The filter accept the following option:
  7336. @table @option
  7337. @item inputs
  7338. Set number of input streams. Default is 2.
  7339. @item shortest
  7340. If set to 1, force the output to terminate when the shortest input
  7341. terminates. Default value is 0.
  7342. @end table
  7343. @section hue
  7344. Modify the hue and/or the saturation of the input.
  7345. It accepts the following parameters:
  7346. @table @option
  7347. @item h
  7348. Specify the hue angle as a number of degrees. It accepts an expression,
  7349. and defaults to "0".
  7350. @item s
  7351. Specify the saturation in the [-10,10] range. It accepts an expression and
  7352. defaults to "1".
  7353. @item H
  7354. Specify the hue angle as a number of radians. It accepts an
  7355. expression, and defaults to "0".
  7356. @item b
  7357. Specify the brightness in the [-10,10] range. It accepts an expression and
  7358. defaults to "0".
  7359. @end table
  7360. @option{h} and @option{H} are mutually exclusive, and can't be
  7361. specified at the same time.
  7362. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7363. expressions containing the following constants:
  7364. @table @option
  7365. @item n
  7366. frame count of the input frame starting from 0
  7367. @item pts
  7368. presentation timestamp of the input frame expressed in time base units
  7369. @item r
  7370. frame rate of the input video, NAN if the input frame rate is unknown
  7371. @item t
  7372. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7373. @item tb
  7374. time base of the input video
  7375. @end table
  7376. @subsection Examples
  7377. @itemize
  7378. @item
  7379. Set the hue to 90 degrees and the saturation to 1.0:
  7380. @example
  7381. hue=h=90:s=1
  7382. @end example
  7383. @item
  7384. Same command but expressing the hue in radians:
  7385. @example
  7386. hue=H=PI/2:s=1
  7387. @end example
  7388. @item
  7389. Rotate hue and make the saturation swing between 0
  7390. and 2 over a period of 1 second:
  7391. @example
  7392. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7393. @end example
  7394. @item
  7395. Apply a 3 seconds saturation fade-in effect starting at 0:
  7396. @example
  7397. hue="s=min(t/3\,1)"
  7398. @end example
  7399. The general fade-in expression can be written as:
  7400. @example
  7401. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7402. @end example
  7403. @item
  7404. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7405. @example
  7406. hue="s=max(0\, min(1\, (8-t)/3))"
  7407. @end example
  7408. The general fade-out expression can be written as:
  7409. @example
  7410. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7411. @end example
  7412. @end itemize
  7413. @subsection Commands
  7414. This filter supports the following commands:
  7415. @table @option
  7416. @item b
  7417. @item s
  7418. @item h
  7419. @item H
  7420. Modify the hue and/or the saturation and/or brightness of the input video.
  7421. The command accepts the same syntax of the corresponding option.
  7422. If the specified expression is not valid, it is kept at its current
  7423. value.
  7424. @end table
  7425. @section hysteresis
  7426. Grow first stream into second stream by connecting components.
  7427. This makes it possible to build more robust edge masks.
  7428. This filter accepts the following options:
  7429. @table @option
  7430. @item planes
  7431. Set which planes will be processed as bitmap, unprocessed planes will be
  7432. copied from first stream.
  7433. By default value 0xf, all planes will be processed.
  7434. @item threshold
  7435. Set threshold which is used in filtering. If pixel component value is higher than
  7436. this value filter algorithm for connecting components is activated.
  7437. By default value is 0.
  7438. @end table
  7439. @section idet
  7440. Detect video interlacing type.
  7441. This filter tries to detect if the input frames are interlaced, progressive,
  7442. top or bottom field first. It will also try to detect fields that are
  7443. repeated between adjacent frames (a sign of telecine).
  7444. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7445. Multiple frame detection incorporates the classification history of previous frames.
  7446. The filter will log these metadata values:
  7447. @table @option
  7448. @item single.current_frame
  7449. Detected type of current frame using single-frame detection. One of:
  7450. ``tff'' (top field first), ``bff'' (bottom field first),
  7451. ``progressive'', or ``undetermined''
  7452. @item single.tff
  7453. Cumulative number of frames detected as top field first using single-frame detection.
  7454. @item multiple.tff
  7455. Cumulative number of frames detected as top field first using multiple-frame detection.
  7456. @item single.bff
  7457. Cumulative number of frames detected as bottom field first using single-frame detection.
  7458. @item multiple.current_frame
  7459. Detected type of current frame using multiple-frame detection. One of:
  7460. ``tff'' (top field first), ``bff'' (bottom field first),
  7461. ``progressive'', or ``undetermined''
  7462. @item multiple.bff
  7463. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7464. @item single.progressive
  7465. Cumulative number of frames detected as progressive using single-frame detection.
  7466. @item multiple.progressive
  7467. Cumulative number of frames detected as progressive using multiple-frame detection.
  7468. @item single.undetermined
  7469. Cumulative number of frames that could not be classified using single-frame detection.
  7470. @item multiple.undetermined
  7471. Cumulative number of frames that could not be classified using multiple-frame detection.
  7472. @item repeated.current_frame
  7473. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7474. @item repeated.neither
  7475. Cumulative number of frames with no repeated field.
  7476. @item repeated.top
  7477. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7478. @item repeated.bottom
  7479. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7480. @end table
  7481. The filter accepts the following options:
  7482. @table @option
  7483. @item intl_thres
  7484. Set interlacing threshold.
  7485. @item prog_thres
  7486. Set progressive threshold.
  7487. @item rep_thres
  7488. Threshold for repeated field detection.
  7489. @item half_life
  7490. Number of frames after which a given frame's contribution to the
  7491. statistics is halved (i.e., it contributes only 0.5 to its
  7492. classification). The default of 0 means that all frames seen are given
  7493. full weight of 1.0 forever.
  7494. @item analyze_interlaced_flag
  7495. When this is not 0 then idet will use the specified number of frames to determine
  7496. if the interlaced flag is accurate, it will not count undetermined frames.
  7497. If the flag is found to be accurate it will be used without any further
  7498. computations, if it is found to be inaccurate it will be cleared without any
  7499. further computations. This allows inserting the idet filter as a low computational
  7500. method to clean up the interlaced flag
  7501. @end table
  7502. @section il
  7503. Deinterleave or interleave fields.
  7504. This filter allows one to process interlaced images fields without
  7505. deinterlacing them. Deinterleaving splits the input frame into 2
  7506. fields (so called half pictures). Odd lines are moved to the top
  7507. half of the output image, even lines to the bottom half.
  7508. You can process (filter) them independently and then re-interleave them.
  7509. The filter accepts the following options:
  7510. @table @option
  7511. @item luma_mode, l
  7512. @item chroma_mode, c
  7513. @item alpha_mode, a
  7514. Available values for @var{luma_mode}, @var{chroma_mode} and
  7515. @var{alpha_mode} are:
  7516. @table @samp
  7517. @item none
  7518. Do nothing.
  7519. @item deinterleave, d
  7520. Deinterleave fields, placing one above the other.
  7521. @item interleave, i
  7522. Interleave fields. Reverse the effect of deinterleaving.
  7523. @end table
  7524. Default value is @code{none}.
  7525. @item luma_swap, ls
  7526. @item chroma_swap, cs
  7527. @item alpha_swap, as
  7528. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7529. @end table
  7530. @section inflate
  7531. Apply inflate effect to the video.
  7532. This filter replaces the pixel by the local(3x3) average by taking into account
  7533. only values higher than the pixel.
  7534. It accepts the following options:
  7535. @table @option
  7536. @item threshold0
  7537. @item threshold1
  7538. @item threshold2
  7539. @item threshold3
  7540. Limit the maximum change for each plane, default is 65535.
  7541. If 0, plane will remain unchanged.
  7542. @end table
  7543. @section interlace
  7544. Simple interlacing filter from progressive contents. This interleaves upper (or
  7545. lower) lines from odd frames with lower (or upper) lines from even frames,
  7546. halving the frame rate and preserving image height.
  7547. @example
  7548. Original Original New Frame
  7549. Frame 'j' Frame 'j+1' (tff)
  7550. ========== =========== ==================
  7551. Line 0 --------------------> Frame 'j' Line 0
  7552. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7553. Line 2 ---------------------> Frame 'j' Line 2
  7554. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7555. ... ... ...
  7556. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7557. @end example
  7558. It accepts the following optional parameters:
  7559. @table @option
  7560. @item scan
  7561. This determines whether the interlaced frame is taken from the even
  7562. (tff - default) or odd (bff) lines of the progressive frame.
  7563. @item lowpass
  7564. Vertical lowpass filter to avoid twitter interlacing and
  7565. reduce moire patterns.
  7566. @table @samp
  7567. @item 0, off
  7568. Disable vertical lowpass filter
  7569. @item 1, linear
  7570. Enable linear filter (default)
  7571. @item 2, complex
  7572. Enable complex filter. This will slightly less reduce twitter and moire
  7573. but better retain detail and subjective sharpness impression.
  7574. @end table
  7575. @end table
  7576. @section kerndeint
  7577. Deinterlace input video by applying Donald Graft's adaptive kernel
  7578. deinterling. Work on interlaced parts of a video to produce
  7579. progressive frames.
  7580. The description of the accepted parameters follows.
  7581. @table @option
  7582. @item thresh
  7583. Set the threshold which affects the filter's tolerance when
  7584. determining if a pixel line must be processed. It must be an integer
  7585. in the range [0,255] and defaults to 10. A value of 0 will result in
  7586. applying the process on every pixels.
  7587. @item map
  7588. Paint pixels exceeding the threshold value to white if set to 1.
  7589. Default is 0.
  7590. @item order
  7591. Set the fields order. Swap fields if set to 1, leave fields alone if
  7592. 0. Default is 0.
  7593. @item sharp
  7594. Enable additional sharpening if set to 1. Default is 0.
  7595. @item twoway
  7596. Enable twoway sharpening if set to 1. Default is 0.
  7597. @end table
  7598. @subsection Examples
  7599. @itemize
  7600. @item
  7601. Apply default values:
  7602. @example
  7603. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7604. @end example
  7605. @item
  7606. Enable additional sharpening:
  7607. @example
  7608. kerndeint=sharp=1
  7609. @end example
  7610. @item
  7611. Paint processed pixels in white:
  7612. @example
  7613. kerndeint=map=1
  7614. @end example
  7615. @end itemize
  7616. @section lenscorrection
  7617. Correct radial lens distortion
  7618. This filter can be used to correct for radial distortion as can result from the use
  7619. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7620. one can use tools available for example as part of opencv or simply trial-and-error.
  7621. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7622. and extract the k1 and k2 coefficients from the resulting matrix.
  7623. Note that effectively the same filter is available in the open-source tools Krita and
  7624. Digikam from the KDE project.
  7625. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7626. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7627. brightness distribution, so you may want to use both filters together in certain
  7628. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7629. be applied before or after lens correction.
  7630. @subsection Options
  7631. The filter accepts the following options:
  7632. @table @option
  7633. @item cx
  7634. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7635. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7636. width.
  7637. @item cy
  7638. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7639. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7640. height.
  7641. @item k1
  7642. Coefficient of the quadratic correction term. 0.5 means no correction.
  7643. @item k2
  7644. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7645. @end table
  7646. The formula that generates the correction is:
  7647. @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)
  7648. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7649. distances from the focal point in the source and target images, respectively.
  7650. @section libvmaf
  7651. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7652. score between two input videos.
  7653. The obtained VMAF score is printed through the logging system.
  7654. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7655. After installing the library it can be enabled using:
  7656. @code{./configure --enable-libvmaf}.
  7657. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7658. The filter has following options:
  7659. @table @option
  7660. @item model_path
  7661. Set the model path which is to be used for SVM.
  7662. Default value: @code{"vmaf_v0.6.1.pkl"}
  7663. @item log_path
  7664. Set the file path to be used to store logs.
  7665. @item log_fmt
  7666. Set the format of the log file (xml or json).
  7667. @item enable_transform
  7668. Enables transform for computing vmaf.
  7669. @item phone_model
  7670. Invokes the phone model which will generate VMAF scores higher than in the
  7671. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7672. @item psnr
  7673. Enables computing psnr along with vmaf.
  7674. @item ssim
  7675. Enables computing ssim along with vmaf.
  7676. @item ms_ssim
  7677. Enables computing ms_ssim along with vmaf.
  7678. @item pool
  7679. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7680. @end table
  7681. This filter also supports the @ref{framesync} options.
  7682. On the below examples the input file @file{main.mpg} being processed is
  7683. compared with the reference file @file{ref.mpg}.
  7684. @example
  7685. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7686. @end example
  7687. Example with options:
  7688. @example
  7689. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7690. @end example
  7691. @section limiter
  7692. Limits the pixel components values to the specified range [min, max].
  7693. The filter accepts the following options:
  7694. @table @option
  7695. @item min
  7696. Lower bound. Defaults to the lowest allowed value for the input.
  7697. @item max
  7698. Upper bound. Defaults to the highest allowed value for the input.
  7699. @item planes
  7700. Specify which planes will be processed. Defaults to all available.
  7701. @end table
  7702. @section loop
  7703. Loop video frames.
  7704. The filter accepts the following options:
  7705. @table @option
  7706. @item loop
  7707. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7708. Default is 0.
  7709. @item size
  7710. Set maximal size in number of frames. Default is 0.
  7711. @item start
  7712. Set first frame of loop. Default is 0.
  7713. @end table
  7714. @anchor{lut3d}
  7715. @section lut3d
  7716. Apply a 3D LUT to an input video.
  7717. The filter accepts the following options:
  7718. @table @option
  7719. @item file
  7720. Set the 3D LUT file name.
  7721. Currently supported formats:
  7722. @table @samp
  7723. @item 3dl
  7724. AfterEffects
  7725. @item cube
  7726. Iridas
  7727. @item dat
  7728. DaVinci
  7729. @item m3d
  7730. Pandora
  7731. @end table
  7732. @item interp
  7733. Select interpolation mode.
  7734. Available values are:
  7735. @table @samp
  7736. @item nearest
  7737. Use values from the nearest defined point.
  7738. @item trilinear
  7739. Interpolate values using the 8 points defining a cube.
  7740. @item tetrahedral
  7741. Interpolate values using a tetrahedron.
  7742. @end table
  7743. @end table
  7744. This filter also supports the @ref{framesync} options.
  7745. @section lumakey
  7746. Turn certain luma values into transparency.
  7747. The filter accepts the following options:
  7748. @table @option
  7749. @item threshold
  7750. Set the luma which will be used as base for transparency.
  7751. Default value is @code{0}.
  7752. @item tolerance
  7753. Set the range of luma values to be keyed out.
  7754. Default value is @code{0}.
  7755. @item softness
  7756. Set the range of softness. Default value is @code{0}.
  7757. Use this to control gradual transition from zero to full transparency.
  7758. @end table
  7759. @section lut, lutrgb, lutyuv
  7760. Compute a look-up table for binding each pixel component input value
  7761. to an output value, and apply it to the input video.
  7762. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7763. to an RGB input video.
  7764. These filters accept the following parameters:
  7765. @table @option
  7766. @item c0
  7767. set first pixel component expression
  7768. @item c1
  7769. set second pixel component expression
  7770. @item c2
  7771. set third pixel component expression
  7772. @item c3
  7773. set fourth pixel component expression, corresponds to the alpha component
  7774. @item r
  7775. set red component expression
  7776. @item g
  7777. set green component expression
  7778. @item b
  7779. set blue component expression
  7780. @item a
  7781. alpha component expression
  7782. @item y
  7783. set Y/luminance component expression
  7784. @item u
  7785. set U/Cb component expression
  7786. @item v
  7787. set V/Cr component expression
  7788. @end table
  7789. Each of them specifies the expression to use for computing the lookup table for
  7790. the corresponding pixel component values.
  7791. The exact component associated to each of the @var{c*} options depends on the
  7792. format in input.
  7793. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7794. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7795. The expressions can contain the following constants and functions:
  7796. @table @option
  7797. @item w
  7798. @item h
  7799. The input width and height.
  7800. @item val
  7801. The input value for the pixel component.
  7802. @item clipval
  7803. The input value, clipped to the @var{minval}-@var{maxval} range.
  7804. @item maxval
  7805. The maximum value for the pixel component.
  7806. @item minval
  7807. The minimum value for the pixel component.
  7808. @item negval
  7809. The negated value for the pixel component value, clipped to the
  7810. @var{minval}-@var{maxval} range; it corresponds to the expression
  7811. "maxval-clipval+minval".
  7812. @item clip(val)
  7813. The computed value in @var{val}, clipped to the
  7814. @var{minval}-@var{maxval} range.
  7815. @item gammaval(gamma)
  7816. The computed gamma correction value of the pixel component value,
  7817. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7818. expression
  7819. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7820. @end table
  7821. All expressions default to "val".
  7822. @subsection Examples
  7823. @itemize
  7824. @item
  7825. Negate input video:
  7826. @example
  7827. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7828. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7829. @end example
  7830. The above is the same as:
  7831. @example
  7832. lutrgb="r=negval:g=negval:b=negval"
  7833. lutyuv="y=negval:u=negval:v=negval"
  7834. @end example
  7835. @item
  7836. Negate luminance:
  7837. @example
  7838. lutyuv=y=negval
  7839. @end example
  7840. @item
  7841. Remove chroma components, turning the video into a graytone image:
  7842. @example
  7843. lutyuv="u=128:v=128"
  7844. @end example
  7845. @item
  7846. Apply a luma burning effect:
  7847. @example
  7848. lutyuv="y=2*val"
  7849. @end example
  7850. @item
  7851. Remove green and blue components:
  7852. @example
  7853. lutrgb="g=0:b=0"
  7854. @end example
  7855. @item
  7856. Set a constant alpha channel value on input:
  7857. @example
  7858. format=rgba,lutrgb=a="maxval-minval/2"
  7859. @end example
  7860. @item
  7861. Correct luminance gamma by a factor of 0.5:
  7862. @example
  7863. lutyuv=y=gammaval(0.5)
  7864. @end example
  7865. @item
  7866. Discard least significant bits of luma:
  7867. @example
  7868. lutyuv=y='bitand(val, 128+64+32)'
  7869. @end example
  7870. @item
  7871. Technicolor like effect:
  7872. @example
  7873. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7874. @end example
  7875. @end itemize
  7876. @section lut2, tlut2
  7877. The @code{lut2} filter takes two input streams and outputs one
  7878. stream.
  7879. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7880. from one single stream.
  7881. This filter accepts the following parameters:
  7882. @table @option
  7883. @item c0
  7884. set first pixel component expression
  7885. @item c1
  7886. set second pixel component expression
  7887. @item c2
  7888. set third pixel component expression
  7889. @item c3
  7890. set fourth pixel component expression, corresponds to the alpha component
  7891. @end table
  7892. Each of them specifies the expression to use for computing the lookup table for
  7893. the corresponding pixel component values.
  7894. The exact component associated to each of the @var{c*} options depends on the
  7895. format in inputs.
  7896. The expressions can contain the following constants:
  7897. @table @option
  7898. @item w
  7899. @item h
  7900. The input width and height.
  7901. @item x
  7902. The first input value for the pixel component.
  7903. @item y
  7904. The second input value for the pixel component.
  7905. @item bdx
  7906. The first input video bit depth.
  7907. @item bdy
  7908. The second input video bit depth.
  7909. @end table
  7910. All expressions default to "x".
  7911. @subsection Examples
  7912. @itemize
  7913. @item
  7914. Highlight differences between two RGB video streams:
  7915. @example
  7916. 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)'
  7917. @end example
  7918. @item
  7919. Highlight differences between two YUV video streams:
  7920. @example
  7921. 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)'
  7922. @end example
  7923. @item
  7924. Show max difference between two video streams:
  7925. @example
  7926. 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)))'
  7927. @end example
  7928. @end itemize
  7929. @section maskedclamp
  7930. Clamp the first input stream with the second input and third input stream.
  7931. Returns the value of first stream to be between second input
  7932. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7933. This filter accepts the following options:
  7934. @table @option
  7935. @item undershoot
  7936. Default value is @code{0}.
  7937. @item overshoot
  7938. Default value is @code{0}.
  7939. @item planes
  7940. Set which planes will be processed as bitmap, unprocessed planes will be
  7941. copied from first stream.
  7942. By default value 0xf, all planes will be processed.
  7943. @end table
  7944. @section maskedmerge
  7945. Merge the first input stream with the second input stream using per pixel
  7946. weights in the third input stream.
  7947. A value of 0 in the third stream pixel component means that pixel component
  7948. from first stream is returned unchanged, while maximum value (eg. 255 for
  7949. 8-bit videos) means that pixel component from second stream is returned
  7950. unchanged. Intermediate values define the amount of merging between both
  7951. input stream's pixel components.
  7952. This filter accepts the following options:
  7953. @table @option
  7954. @item planes
  7955. Set which planes will be processed as bitmap, unprocessed planes will be
  7956. copied from first stream.
  7957. By default value 0xf, all planes will be processed.
  7958. @end table
  7959. @section mcdeint
  7960. Apply motion-compensation deinterlacing.
  7961. It needs one field per frame as input and must thus be used together
  7962. with yadif=1/3 or equivalent.
  7963. This filter accepts the following options:
  7964. @table @option
  7965. @item mode
  7966. Set the deinterlacing mode.
  7967. It accepts one of the following values:
  7968. @table @samp
  7969. @item fast
  7970. @item medium
  7971. @item slow
  7972. use iterative motion estimation
  7973. @item extra_slow
  7974. like @samp{slow}, but use multiple reference frames.
  7975. @end table
  7976. Default value is @samp{fast}.
  7977. @item parity
  7978. Set the picture field parity assumed for the input video. It must be
  7979. one of the following values:
  7980. @table @samp
  7981. @item 0, tff
  7982. assume top field first
  7983. @item 1, bff
  7984. assume bottom field first
  7985. @end table
  7986. Default value is @samp{bff}.
  7987. @item qp
  7988. Set per-block quantization parameter (QP) used by the internal
  7989. encoder.
  7990. Higher values should result in a smoother motion vector field but less
  7991. optimal individual vectors. Default value is 1.
  7992. @end table
  7993. @section mergeplanes
  7994. Merge color channel components from several video streams.
  7995. The filter accepts up to 4 input streams, and merge selected input
  7996. planes to the output video.
  7997. This filter accepts the following options:
  7998. @table @option
  7999. @item mapping
  8000. Set input to output plane mapping. Default is @code{0}.
  8001. The mappings is specified as a bitmap. It should be specified as a
  8002. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8003. mapping for the first plane of the output stream. 'A' sets the number of
  8004. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8005. corresponding input to use (from 0 to 3). The rest of the mappings is
  8006. similar, 'Bb' describes the mapping for the output stream second
  8007. plane, 'Cc' describes the mapping for the output stream third plane and
  8008. 'Dd' describes the mapping for the output stream fourth plane.
  8009. @item format
  8010. Set output pixel format. Default is @code{yuva444p}.
  8011. @end table
  8012. @subsection Examples
  8013. @itemize
  8014. @item
  8015. Merge three gray video streams of same width and height into single video stream:
  8016. @example
  8017. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8018. @end example
  8019. @item
  8020. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8021. @example
  8022. [a0][a1]mergeplanes=0x00010210:yuva444p
  8023. @end example
  8024. @item
  8025. Swap Y and A plane in yuva444p stream:
  8026. @example
  8027. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8028. @end example
  8029. @item
  8030. Swap U and V plane in yuv420p stream:
  8031. @example
  8032. format=yuv420p,mergeplanes=0x000201:yuv420p
  8033. @end example
  8034. @item
  8035. Cast a rgb24 clip to yuv444p:
  8036. @example
  8037. format=rgb24,mergeplanes=0x000102:yuv444p
  8038. @end example
  8039. @end itemize
  8040. @section mestimate
  8041. Estimate and export motion vectors using block matching algorithms.
  8042. Motion vectors are stored in frame side data to be used by other filters.
  8043. This filter accepts the following options:
  8044. @table @option
  8045. @item method
  8046. Specify the motion estimation method. Accepts one of the following values:
  8047. @table @samp
  8048. @item esa
  8049. Exhaustive search algorithm.
  8050. @item tss
  8051. Three step search algorithm.
  8052. @item tdls
  8053. Two dimensional logarithmic search algorithm.
  8054. @item ntss
  8055. New three step search algorithm.
  8056. @item fss
  8057. Four step search algorithm.
  8058. @item ds
  8059. Diamond search algorithm.
  8060. @item hexbs
  8061. Hexagon-based search algorithm.
  8062. @item epzs
  8063. Enhanced predictive zonal search algorithm.
  8064. @item umh
  8065. Uneven multi-hexagon search algorithm.
  8066. @end table
  8067. Default value is @samp{esa}.
  8068. @item mb_size
  8069. Macroblock size. Default @code{16}.
  8070. @item search_param
  8071. Search parameter. Default @code{7}.
  8072. @end table
  8073. @section midequalizer
  8074. Apply Midway Image Equalization effect using two video streams.
  8075. Midway Image Equalization adjusts a pair of images to have the same
  8076. histogram, while maintaining their dynamics as much as possible. It's
  8077. useful for e.g. matching exposures from a pair of stereo cameras.
  8078. This filter has two inputs and one output, which must be of same pixel format, but
  8079. may be of different sizes. The output of filter is first input adjusted with
  8080. midway histogram of both inputs.
  8081. This filter accepts the following option:
  8082. @table @option
  8083. @item planes
  8084. Set which planes to process. Default is @code{15}, which is all available planes.
  8085. @end table
  8086. @section minterpolate
  8087. Convert the video to specified frame rate using motion interpolation.
  8088. This filter accepts the following options:
  8089. @table @option
  8090. @item fps
  8091. 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}.
  8092. @item mi_mode
  8093. Motion interpolation mode. Following values are accepted:
  8094. @table @samp
  8095. @item dup
  8096. Duplicate previous or next frame for interpolating new ones.
  8097. @item blend
  8098. Blend source frames. Interpolated frame is mean of previous and next frames.
  8099. @item mci
  8100. Motion compensated interpolation. Following options are effective when this mode is selected:
  8101. @table @samp
  8102. @item mc_mode
  8103. Motion compensation mode. Following values are accepted:
  8104. @table @samp
  8105. @item obmc
  8106. Overlapped block motion compensation.
  8107. @item aobmc
  8108. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8109. @end table
  8110. Default mode is @samp{obmc}.
  8111. @item me_mode
  8112. Motion estimation mode. Following values are accepted:
  8113. @table @samp
  8114. @item bidir
  8115. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8116. @item bilat
  8117. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8118. @end table
  8119. Default mode is @samp{bilat}.
  8120. @item me
  8121. The algorithm to be used for motion estimation. Following values are accepted:
  8122. @table @samp
  8123. @item esa
  8124. Exhaustive search algorithm.
  8125. @item tss
  8126. Three step search algorithm.
  8127. @item tdls
  8128. Two dimensional logarithmic search algorithm.
  8129. @item ntss
  8130. New three step search algorithm.
  8131. @item fss
  8132. Four step search algorithm.
  8133. @item ds
  8134. Diamond search algorithm.
  8135. @item hexbs
  8136. Hexagon-based search algorithm.
  8137. @item epzs
  8138. Enhanced predictive zonal search algorithm.
  8139. @item umh
  8140. Uneven multi-hexagon search algorithm.
  8141. @end table
  8142. Default algorithm is @samp{epzs}.
  8143. @item mb_size
  8144. Macroblock size. Default @code{16}.
  8145. @item search_param
  8146. Motion estimation search parameter. Default @code{32}.
  8147. @item vsbmc
  8148. 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).
  8149. @end table
  8150. @end table
  8151. @item scd
  8152. 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:
  8153. @table @samp
  8154. @item none
  8155. Disable scene change detection.
  8156. @item fdiff
  8157. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8158. @end table
  8159. Default method is @samp{fdiff}.
  8160. @item scd_threshold
  8161. Scene change detection threshold. Default is @code{5.0}.
  8162. @end table
  8163. @section mix
  8164. Mix several video input streams into one video stream.
  8165. A description of the accepted options follows.
  8166. @table @option
  8167. @item nb_inputs
  8168. The number of inputs. If unspecified, it defaults to 2.
  8169. @item weights
  8170. Specify weight of each input video stream as sequence.
  8171. Each weight is separated by space.
  8172. @item duration
  8173. Specify how end of stream is determined.
  8174. @table @samp
  8175. @item longest
  8176. The duration of the longest input. (default)
  8177. @item shortest
  8178. The duration of the shortest input.
  8179. @item first
  8180. The duration of the first input.
  8181. @end table
  8182. @end table
  8183. @section mpdecimate
  8184. Drop frames that do not differ greatly from the previous frame in
  8185. order to reduce frame rate.
  8186. The main use of this filter is for very-low-bitrate encoding
  8187. (e.g. streaming over dialup modem), but it could in theory be used for
  8188. fixing movies that were inverse-telecined incorrectly.
  8189. A description of the accepted options follows.
  8190. @table @option
  8191. @item max
  8192. Set the maximum number of consecutive frames which can be dropped (if
  8193. positive), or the minimum interval between dropped frames (if
  8194. negative). If the value is 0, the frame is dropped disregarding the
  8195. number of previous sequentially dropped frames.
  8196. Default value is 0.
  8197. @item hi
  8198. @item lo
  8199. @item frac
  8200. Set the dropping threshold values.
  8201. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8202. represent actual pixel value differences, so a threshold of 64
  8203. corresponds to 1 unit of difference for each pixel, or the same spread
  8204. out differently over the block.
  8205. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8206. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8207. meaning the whole image) differ by more than a threshold of @option{lo}.
  8208. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8209. 64*5, and default value for @option{frac} is 0.33.
  8210. @end table
  8211. @section negate
  8212. Negate input video.
  8213. It accepts an integer in input; if non-zero it negates the
  8214. alpha component (if available). The default value in input is 0.
  8215. @section nlmeans
  8216. Denoise frames using Non-Local Means algorithm.
  8217. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8218. context similarity is defined by comparing their surrounding patches of size
  8219. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8220. around the pixel.
  8221. Note that the research area defines centers for patches, which means some
  8222. patches will be made of pixels outside that research area.
  8223. The filter accepts the following options.
  8224. @table @option
  8225. @item s
  8226. Set denoising strength.
  8227. @item p
  8228. Set patch size.
  8229. @item pc
  8230. Same as @option{p} but for chroma planes.
  8231. The default value is @var{0} and means automatic.
  8232. @item r
  8233. Set research size.
  8234. @item rc
  8235. Same as @option{r} but for chroma planes.
  8236. The default value is @var{0} and means automatic.
  8237. @end table
  8238. @section nnedi
  8239. Deinterlace video using neural network edge directed interpolation.
  8240. This filter accepts the following options:
  8241. @table @option
  8242. @item weights
  8243. Mandatory option, without binary file filter can not work.
  8244. Currently file can be found here:
  8245. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8246. @item deint
  8247. Set which frames to deinterlace, by default it is @code{all}.
  8248. Can be @code{all} or @code{interlaced}.
  8249. @item field
  8250. Set mode of operation.
  8251. Can be one of the following:
  8252. @table @samp
  8253. @item af
  8254. Use frame flags, both fields.
  8255. @item a
  8256. Use frame flags, single field.
  8257. @item t
  8258. Use top field only.
  8259. @item b
  8260. Use bottom field only.
  8261. @item tf
  8262. Use both fields, top first.
  8263. @item bf
  8264. Use both fields, bottom first.
  8265. @end table
  8266. @item planes
  8267. Set which planes to process, by default filter process all frames.
  8268. @item nsize
  8269. Set size of local neighborhood around each pixel, used by the predictor neural
  8270. network.
  8271. Can be one of the following:
  8272. @table @samp
  8273. @item s8x6
  8274. @item s16x6
  8275. @item s32x6
  8276. @item s48x6
  8277. @item s8x4
  8278. @item s16x4
  8279. @item s32x4
  8280. @end table
  8281. @item nns
  8282. Set the number of neurons in predictor neural network.
  8283. Can be one of the following:
  8284. @table @samp
  8285. @item n16
  8286. @item n32
  8287. @item n64
  8288. @item n128
  8289. @item n256
  8290. @end table
  8291. @item qual
  8292. Controls the number of different neural network predictions that are blended
  8293. together to compute the final output value. Can be @code{fast}, default or
  8294. @code{slow}.
  8295. @item etype
  8296. Set which set of weights to use in the predictor.
  8297. Can be one of the following:
  8298. @table @samp
  8299. @item a
  8300. weights trained to minimize absolute error
  8301. @item s
  8302. weights trained to minimize squared error
  8303. @end table
  8304. @item pscrn
  8305. Controls whether or not the prescreener neural network is used to decide
  8306. which pixels should be processed by the predictor neural network and which
  8307. can be handled by simple cubic interpolation.
  8308. The prescreener is trained to know whether cubic interpolation will be
  8309. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8310. The computational complexity of the prescreener nn is much less than that of
  8311. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8312. using the prescreener generally results in much faster processing.
  8313. The prescreener is pretty accurate, so the difference between using it and not
  8314. using it is almost always unnoticeable.
  8315. Can be one of the following:
  8316. @table @samp
  8317. @item none
  8318. @item original
  8319. @item new
  8320. @end table
  8321. Default is @code{new}.
  8322. @item fapprox
  8323. Set various debugging flags.
  8324. @end table
  8325. @section noformat
  8326. Force libavfilter not to use any of the specified pixel formats for the
  8327. input to the next filter.
  8328. It accepts the following parameters:
  8329. @table @option
  8330. @item pix_fmts
  8331. A '|'-separated list of pixel format names, such as
  8332. pix_fmts=yuv420p|monow|rgb24".
  8333. @end table
  8334. @subsection Examples
  8335. @itemize
  8336. @item
  8337. Force libavfilter to use a format different from @var{yuv420p} for the
  8338. input to the vflip filter:
  8339. @example
  8340. noformat=pix_fmts=yuv420p,vflip
  8341. @end example
  8342. @item
  8343. Convert the input video to any of the formats not contained in the list:
  8344. @example
  8345. noformat=yuv420p|yuv444p|yuv410p
  8346. @end example
  8347. @end itemize
  8348. @section noise
  8349. Add noise on video input frame.
  8350. The filter accepts the following options:
  8351. @table @option
  8352. @item all_seed
  8353. @item c0_seed
  8354. @item c1_seed
  8355. @item c2_seed
  8356. @item c3_seed
  8357. Set noise seed for specific pixel component or all pixel components in case
  8358. of @var{all_seed}. Default value is @code{123457}.
  8359. @item all_strength, alls
  8360. @item c0_strength, c0s
  8361. @item c1_strength, c1s
  8362. @item c2_strength, c2s
  8363. @item c3_strength, c3s
  8364. Set noise strength for specific pixel component or all pixel components in case
  8365. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8366. @item all_flags, allf
  8367. @item c0_flags, c0f
  8368. @item c1_flags, c1f
  8369. @item c2_flags, c2f
  8370. @item c3_flags, c3f
  8371. Set pixel component flags or set flags for all components if @var{all_flags}.
  8372. Available values for component flags are:
  8373. @table @samp
  8374. @item a
  8375. averaged temporal noise (smoother)
  8376. @item p
  8377. mix random noise with a (semi)regular pattern
  8378. @item t
  8379. temporal noise (noise pattern changes between frames)
  8380. @item u
  8381. uniform noise (gaussian otherwise)
  8382. @end table
  8383. @end table
  8384. @subsection Examples
  8385. Add temporal and uniform noise to input video:
  8386. @example
  8387. noise=alls=20:allf=t+u
  8388. @end example
  8389. @section normalize
  8390. Normalize RGB video (aka histogram stretching, contrast stretching).
  8391. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8392. For each channel of each frame, the filter computes the input range and maps
  8393. it linearly to the user-specified output range. The output range defaults
  8394. to the full dynamic range from pure black to pure white.
  8395. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8396. changes in brightness) caused when small dark or bright objects enter or leave
  8397. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8398. video camera, and, like a video camera, it may cause a period of over- or
  8399. under-exposure of the video.
  8400. The R,G,B channels can be normalized independently, which may cause some
  8401. color shifting, or linked together as a single channel, which prevents
  8402. color shifting. Linked normalization preserves hue. Independent normalization
  8403. does not, so it can be used to remove some color casts. Independent and linked
  8404. normalization can be combined in any ratio.
  8405. The normalize filter accepts the following options:
  8406. @table @option
  8407. @item blackpt
  8408. @item whitept
  8409. Colors which define the output range. The minimum input value is mapped to
  8410. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8411. The defaults are black and white respectively. Specifying white for
  8412. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8413. normalized video. Shades of grey can be used to reduce the dynamic range
  8414. (contrast). Specifying saturated colors here can create some interesting
  8415. effects.
  8416. @item smoothing
  8417. The number of previous frames to use for temporal smoothing. The input range
  8418. of each channel is smoothed using a rolling average over the current frame
  8419. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8420. smoothing).
  8421. @item independence
  8422. Controls the ratio of independent (color shifting) channel normalization to
  8423. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8424. independent. Defaults to 1.0 (fully independent).
  8425. @item strength
  8426. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8427. expensive no-op. Defaults to 1.0 (full strength).
  8428. @end table
  8429. @subsection Examples
  8430. Stretch video contrast to use the full dynamic range, with no temporal
  8431. smoothing; may flicker depending on the source content:
  8432. @example
  8433. normalize=blackpt=black:whitept=white:smoothing=0
  8434. @end example
  8435. As above, but with 50 frames of temporal smoothing; flicker should be
  8436. reduced, depending on the source content:
  8437. @example
  8438. normalize=blackpt=black:whitept=white:smoothing=50
  8439. @end example
  8440. As above, but with hue-preserving linked channel normalization:
  8441. @example
  8442. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8443. @end example
  8444. As above, but with half strength:
  8445. @example
  8446. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8447. @end example
  8448. Map the darkest input color to red, the brightest input color to cyan:
  8449. @example
  8450. normalize=blackpt=red:whitept=cyan
  8451. @end example
  8452. @section null
  8453. Pass the video source unchanged to the output.
  8454. @section ocr
  8455. Optical Character Recognition
  8456. This filter uses Tesseract for optical character recognition.
  8457. It accepts the following options:
  8458. @table @option
  8459. @item datapath
  8460. Set datapath to tesseract data. Default is to use whatever was
  8461. set at installation.
  8462. @item language
  8463. Set language, default is "eng".
  8464. @item whitelist
  8465. Set character whitelist.
  8466. @item blacklist
  8467. Set character blacklist.
  8468. @end table
  8469. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8470. @section ocv
  8471. Apply a video transform using libopencv.
  8472. To enable this filter, install the libopencv library and headers and
  8473. configure FFmpeg with @code{--enable-libopencv}.
  8474. It accepts the following parameters:
  8475. @table @option
  8476. @item filter_name
  8477. The name of the libopencv filter to apply.
  8478. @item filter_params
  8479. The parameters to pass to the libopencv filter. If not specified, the default
  8480. values are assumed.
  8481. @end table
  8482. Refer to the official libopencv documentation for more precise
  8483. information:
  8484. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8485. Several libopencv filters are supported; see the following subsections.
  8486. @anchor{dilate}
  8487. @subsection dilate
  8488. Dilate an image by using a specific structuring element.
  8489. It corresponds to the libopencv function @code{cvDilate}.
  8490. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8491. @var{struct_el} represents a structuring element, and has the syntax:
  8492. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8493. @var{cols} and @var{rows} represent the number of columns and rows of
  8494. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8495. point, and @var{shape} the shape for the structuring element. @var{shape}
  8496. must be "rect", "cross", "ellipse", or "custom".
  8497. If the value for @var{shape} is "custom", it must be followed by a
  8498. string of the form "=@var{filename}". The file with name
  8499. @var{filename} is assumed to represent a binary image, with each
  8500. printable character corresponding to a bright pixel. When a custom
  8501. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8502. or columns and rows of the read file are assumed instead.
  8503. The default value for @var{struct_el} is "3x3+0x0/rect".
  8504. @var{nb_iterations} specifies the number of times the transform is
  8505. applied to the image, and defaults to 1.
  8506. Some examples:
  8507. @example
  8508. # Use the default values
  8509. ocv=dilate
  8510. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8511. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8512. # Read the shape from the file diamond.shape, iterating two times.
  8513. # The file diamond.shape may contain a pattern of characters like this
  8514. # *
  8515. # ***
  8516. # *****
  8517. # ***
  8518. # *
  8519. # The specified columns and rows are ignored
  8520. # but the anchor point coordinates are not
  8521. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8522. @end example
  8523. @subsection erode
  8524. Erode an image by using a specific structuring element.
  8525. It corresponds to the libopencv function @code{cvErode}.
  8526. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8527. with the same syntax and semantics as the @ref{dilate} filter.
  8528. @subsection smooth
  8529. Smooth the input video.
  8530. The filter takes the following parameters:
  8531. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8532. @var{type} is the type of smooth filter to apply, and must be one of
  8533. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8534. or "bilateral". The default value is "gaussian".
  8535. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8536. depend on the smooth type. @var{param1} and
  8537. @var{param2} accept integer positive values or 0. @var{param3} and
  8538. @var{param4} accept floating point values.
  8539. The default value for @var{param1} is 3. The default value for the
  8540. other parameters is 0.
  8541. These parameters correspond to the parameters assigned to the
  8542. libopencv function @code{cvSmooth}.
  8543. @section oscilloscope
  8544. 2D Video Oscilloscope.
  8545. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8546. It accepts the following parameters:
  8547. @table @option
  8548. @item x
  8549. Set scope center x position.
  8550. @item y
  8551. Set scope center y position.
  8552. @item s
  8553. Set scope size, relative to frame diagonal.
  8554. @item t
  8555. Set scope tilt/rotation.
  8556. @item o
  8557. Set trace opacity.
  8558. @item tx
  8559. Set trace center x position.
  8560. @item ty
  8561. Set trace center y position.
  8562. @item tw
  8563. Set trace width, relative to width of frame.
  8564. @item th
  8565. Set trace height, relative to height of frame.
  8566. @item c
  8567. Set which components to trace. By default it traces first three components.
  8568. @item g
  8569. Draw trace grid. By default is enabled.
  8570. @item st
  8571. Draw some statistics. By default is enabled.
  8572. @item sc
  8573. Draw scope. By default is enabled.
  8574. @end table
  8575. @subsection Examples
  8576. @itemize
  8577. @item
  8578. Inspect full first row of video frame.
  8579. @example
  8580. oscilloscope=x=0.5:y=0:s=1
  8581. @end example
  8582. @item
  8583. Inspect full last row of video frame.
  8584. @example
  8585. oscilloscope=x=0.5:y=1:s=1
  8586. @end example
  8587. @item
  8588. Inspect full 5th line of video frame of height 1080.
  8589. @example
  8590. oscilloscope=x=0.5:y=5/1080:s=1
  8591. @end example
  8592. @item
  8593. Inspect full last column of video frame.
  8594. @example
  8595. oscilloscope=x=1:y=0.5:s=1:t=1
  8596. @end example
  8597. @end itemize
  8598. @anchor{overlay}
  8599. @section overlay
  8600. Overlay one video on top of another.
  8601. It takes two inputs and has one output. The first input is the "main"
  8602. video on which the second input is overlaid.
  8603. It accepts the following parameters:
  8604. A description of the accepted options follows.
  8605. @table @option
  8606. @item x
  8607. @item y
  8608. Set the expression for the x and y coordinates of the overlaid video
  8609. on the main video. Default value is "0" for both expressions. In case
  8610. the expression is invalid, it is set to a huge value (meaning that the
  8611. overlay will not be displayed within the output visible area).
  8612. @item eof_action
  8613. See @ref{framesync}.
  8614. @item eval
  8615. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8616. It accepts the following values:
  8617. @table @samp
  8618. @item init
  8619. only evaluate expressions once during the filter initialization or
  8620. when a command is processed
  8621. @item frame
  8622. evaluate expressions for each incoming frame
  8623. @end table
  8624. Default value is @samp{frame}.
  8625. @item shortest
  8626. See @ref{framesync}.
  8627. @item format
  8628. Set the format for the output video.
  8629. It accepts the following values:
  8630. @table @samp
  8631. @item yuv420
  8632. force YUV420 output
  8633. @item yuv422
  8634. force YUV422 output
  8635. @item yuv444
  8636. force YUV444 output
  8637. @item rgb
  8638. force packed RGB output
  8639. @item gbrp
  8640. force planar RGB output
  8641. @item auto
  8642. automatically pick format
  8643. @end table
  8644. Default value is @samp{yuv420}.
  8645. @item repeatlast
  8646. See @ref{framesync}.
  8647. @end table
  8648. The @option{x}, and @option{y} expressions can contain the following
  8649. parameters.
  8650. @table @option
  8651. @item main_w, W
  8652. @item main_h, H
  8653. The main input width and height.
  8654. @item overlay_w, w
  8655. @item overlay_h, h
  8656. The overlay input width and height.
  8657. @item x
  8658. @item y
  8659. The computed values for @var{x} and @var{y}. They are evaluated for
  8660. each new frame.
  8661. @item hsub
  8662. @item vsub
  8663. horizontal and vertical chroma subsample values of the output
  8664. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8665. @var{vsub} is 1.
  8666. @item n
  8667. the number of input frame, starting from 0
  8668. @item pos
  8669. the position in the file of the input frame, NAN if unknown
  8670. @item t
  8671. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8672. @end table
  8673. This filter also supports the @ref{framesync} options.
  8674. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8675. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8676. when @option{eval} is set to @samp{init}.
  8677. Be aware that frames are taken from each input video in timestamp
  8678. order, hence, if their initial timestamps differ, it is a good idea
  8679. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8680. have them begin in the same zero timestamp, as the example for
  8681. the @var{movie} filter does.
  8682. You can chain together more overlays but you should test the
  8683. efficiency of such approach.
  8684. @subsection Commands
  8685. This filter supports the following commands:
  8686. @table @option
  8687. @item x
  8688. @item y
  8689. Modify the x and y of the overlay input.
  8690. The command accepts the same syntax of the corresponding option.
  8691. If the specified expression is not valid, it is kept at its current
  8692. value.
  8693. @end table
  8694. @subsection Examples
  8695. @itemize
  8696. @item
  8697. Draw the overlay at 10 pixels from the bottom right corner of the main
  8698. video:
  8699. @example
  8700. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8701. @end example
  8702. Using named options the example above becomes:
  8703. @example
  8704. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8705. @end example
  8706. @item
  8707. Insert a transparent PNG logo in the bottom left corner of the input,
  8708. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8709. @example
  8710. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8711. @end example
  8712. @item
  8713. Insert 2 different transparent PNG logos (second logo on bottom
  8714. right corner) using the @command{ffmpeg} tool:
  8715. @example
  8716. 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
  8717. @end example
  8718. @item
  8719. Add a transparent color layer on top of the main video; @code{WxH}
  8720. must specify the size of the main input to the overlay filter:
  8721. @example
  8722. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8723. @end example
  8724. @item
  8725. Play an original video and a filtered version (here with the deshake
  8726. filter) side by side using the @command{ffplay} tool:
  8727. @example
  8728. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8729. @end example
  8730. The above command is the same as:
  8731. @example
  8732. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8733. @end example
  8734. @item
  8735. Make a sliding overlay appearing from the left to the right top part of the
  8736. screen starting since time 2:
  8737. @example
  8738. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8739. @end example
  8740. @item
  8741. Compose output by putting two input videos side to side:
  8742. @example
  8743. ffmpeg -i left.avi -i right.avi -filter_complex "
  8744. nullsrc=size=200x100 [background];
  8745. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8746. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8747. [background][left] overlay=shortest=1 [background+left];
  8748. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8749. "
  8750. @end example
  8751. @item
  8752. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8753. @example
  8754. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8755. -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]'
  8756. masked.avi
  8757. @end example
  8758. @item
  8759. Chain several overlays in cascade:
  8760. @example
  8761. nullsrc=s=200x200 [bg];
  8762. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8763. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8764. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8765. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8766. [in3] null, [mid2] overlay=100:100 [out0]
  8767. @end example
  8768. @end itemize
  8769. @section owdenoise
  8770. Apply Overcomplete Wavelet denoiser.
  8771. The filter accepts the following options:
  8772. @table @option
  8773. @item depth
  8774. Set depth.
  8775. Larger depth values will denoise lower frequency components more, but
  8776. slow down filtering.
  8777. Must be an int in the range 8-16, default is @code{8}.
  8778. @item luma_strength, ls
  8779. Set luma strength.
  8780. Must be a double value in the range 0-1000, default is @code{1.0}.
  8781. @item chroma_strength, cs
  8782. Set chroma strength.
  8783. Must be a double value in the range 0-1000, default is @code{1.0}.
  8784. @end table
  8785. @anchor{pad}
  8786. @section pad
  8787. Add paddings to the input image, and place the original input at the
  8788. provided @var{x}, @var{y} coordinates.
  8789. It accepts the following parameters:
  8790. @table @option
  8791. @item width, w
  8792. @item height, h
  8793. Specify an expression for the size of the output image with the
  8794. paddings added. If the value for @var{width} or @var{height} is 0, the
  8795. corresponding input size is used for the output.
  8796. The @var{width} expression can reference the value set by the
  8797. @var{height} expression, and vice versa.
  8798. The default value of @var{width} and @var{height} is 0.
  8799. @item x
  8800. @item y
  8801. Specify the offsets to place the input image at within the padded area,
  8802. with respect to the top/left border of the output image.
  8803. The @var{x} expression can reference the value set by the @var{y}
  8804. expression, and vice versa.
  8805. The default value of @var{x} and @var{y} is 0.
  8806. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8807. so the input image is centered on the padded area.
  8808. @item color
  8809. Specify the color of the padded area. For the syntax of this option,
  8810. check the "Color" section in the ffmpeg-utils manual.
  8811. The default value of @var{color} is "black".
  8812. @item eval
  8813. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8814. It accepts the following values:
  8815. @table @samp
  8816. @item init
  8817. Only evaluate expressions once during the filter initialization or when
  8818. a command is processed.
  8819. @item frame
  8820. Evaluate expressions for each incoming frame.
  8821. @end table
  8822. Default value is @samp{init}.
  8823. @item aspect
  8824. Pad to aspect instead to a resolution.
  8825. @end table
  8826. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8827. options are expressions containing the following constants:
  8828. @table @option
  8829. @item in_w
  8830. @item in_h
  8831. The input video width and height.
  8832. @item iw
  8833. @item ih
  8834. These are the same as @var{in_w} and @var{in_h}.
  8835. @item out_w
  8836. @item out_h
  8837. The output width and height (the size of the padded area), as
  8838. specified by the @var{width} and @var{height} expressions.
  8839. @item ow
  8840. @item oh
  8841. These are the same as @var{out_w} and @var{out_h}.
  8842. @item x
  8843. @item y
  8844. The x and y offsets as specified by the @var{x} and @var{y}
  8845. expressions, or NAN if not yet specified.
  8846. @item a
  8847. same as @var{iw} / @var{ih}
  8848. @item sar
  8849. input sample aspect ratio
  8850. @item dar
  8851. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8852. @item hsub
  8853. @item vsub
  8854. The horizontal and vertical chroma subsample values. For example for the
  8855. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8856. @end table
  8857. @subsection Examples
  8858. @itemize
  8859. @item
  8860. Add paddings with the color "violet" to the input video. The output video
  8861. size is 640x480, and the top-left corner of the input video is placed at
  8862. column 0, row 40
  8863. @example
  8864. pad=640:480:0:40:violet
  8865. @end example
  8866. The example above is equivalent to the following command:
  8867. @example
  8868. pad=width=640:height=480:x=0:y=40:color=violet
  8869. @end example
  8870. @item
  8871. Pad the input to get an output with dimensions increased by 3/2,
  8872. and put the input video at the center of the padded area:
  8873. @example
  8874. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8875. @end example
  8876. @item
  8877. Pad the input to get a squared output with size equal to the maximum
  8878. value between the input width and height, and put the input video at
  8879. the center of the padded area:
  8880. @example
  8881. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8882. @end example
  8883. @item
  8884. Pad the input to get a final w/h ratio of 16:9:
  8885. @example
  8886. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8887. @end example
  8888. @item
  8889. In case of anamorphic video, in order to set the output display aspect
  8890. correctly, it is necessary to use @var{sar} in the expression,
  8891. according to the relation:
  8892. @example
  8893. (ih * X / ih) * sar = output_dar
  8894. X = output_dar / sar
  8895. @end example
  8896. Thus the previous example needs to be modified to:
  8897. @example
  8898. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8899. @end example
  8900. @item
  8901. Double the output size and put the input video in the bottom-right
  8902. corner of the output padded area:
  8903. @example
  8904. pad="2*iw:2*ih:ow-iw:oh-ih"
  8905. @end example
  8906. @end itemize
  8907. @anchor{palettegen}
  8908. @section palettegen
  8909. Generate one palette for a whole video stream.
  8910. It accepts the following options:
  8911. @table @option
  8912. @item max_colors
  8913. Set the maximum number of colors to quantize in the palette.
  8914. Note: the palette will still contain 256 colors; the unused palette entries
  8915. will be black.
  8916. @item reserve_transparent
  8917. Create a palette of 255 colors maximum and reserve the last one for
  8918. transparency. Reserving the transparency color is useful for GIF optimization.
  8919. If not set, the maximum of colors in the palette will be 256. You probably want
  8920. to disable this option for a standalone image.
  8921. Set by default.
  8922. @item transparency_color
  8923. Set the color that will be used as background for transparency.
  8924. @item stats_mode
  8925. Set statistics mode.
  8926. It accepts the following values:
  8927. @table @samp
  8928. @item full
  8929. Compute full frame histograms.
  8930. @item diff
  8931. Compute histograms only for the part that differs from previous frame. This
  8932. might be relevant to give more importance to the moving part of your input if
  8933. the background is static.
  8934. @item single
  8935. Compute new histogram for each frame.
  8936. @end table
  8937. Default value is @var{full}.
  8938. @end table
  8939. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8940. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8941. color quantization of the palette. This information is also visible at
  8942. @var{info} logging level.
  8943. @subsection Examples
  8944. @itemize
  8945. @item
  8946. Generate a representative palette of a given video using @command{ffmpeg}:
  8947. @example
  8948. ffmpeg -i input.mkv -vf palettegen palette.png
  8949. @end example
  8950. @end itemize
  8951. @section paletteuse
  8952. Use a palette to downsample an input video stream.
  8953. The filter takes two inputs: one video stream and a palette. The palette must
  8954. be a 256 pixels image.
  8955. It accepts the following options:
  8956. @table @option
  8957. @item dither
  8958. Select dithering mode. Available algorithms are:
  8959. @table @samp
  8960. @item bayer
  8961. Ordered 8x8 bayer dithering (deterministic)
  8962. @item heckbert
  8963. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8964. Note: this dithering is sometimes considered "wrong" and is included as a
  8965. reference.
  8966. @item floyd_steinberg
  8967. Floyd and Steingberg dithering (error diffusion)
  8968. @item sierra2
  8969. Frankie Sierra dithering v2 (error diffusion)
  8970. @item sierra2_4a
  8971. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8972. @end table
  8973. Default is @var{sierra2_4a}.
  8974. @item bayer_scale
  8975. When @var{bayer} dithering is selected, this option defines the scale of the
  8976. pattern (how much the crosshatch pattern is visible). A low value means more
  8977. visible pattern for less banding, and higher value means less visible pattern
  8978. at the cost of more banding.
  8979. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8980. @item diff_mode
  8981. If set, define the zone to process
  8982. @table @samp
  8983. @item rectangle
  8984. Only the changing rectangle will be reprocessed. This is similar to GIF
  8985. cropping/offsetting compression mechanism. This option can be useful for speed
  8986. if only a part of the image is changing, and has use cases such as limiting the
  8987. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8988. moving scene (it leads to more deterministic output if the scene doesn't change
  8989. much, and as a result less moving noise and better GIF compression).
  8990. @end table
  8991. Default is @var{none}.
  8992. @item new
  8993. Take new palette for each output frame.
  8994. @item alpha_threshold
  8995. Sets the alpha threshold for transparency. Alpha values above this threshold
  8996. will be treated as completely opaque, and values below this threshold will be
  8997. treated as completely transparent.
  8998. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8999. @end table
  9000. @subsection Examples
  9001. @itemize
  9002. @item
  9003. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9004. using @command{ffmpeg}:
  9005. @example
  9006. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9007. @end example
  9008. @end itemize
  9009. @section perspective
  9010. Correct perspective of video not recorded perpendicular to the screen.
  9011. A description of the accepted parameters follows.
  9012. @table @option
  9013. @item x0
  9014. @item y0
  9015. @item x1
  9016. @item y1
  9017. @item x2
  9018. @item y2
  9019. @item x3
  9020. @item y3
  9021. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9022. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9023. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9024. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9025. then the corners of the source will be sent to the specified coordinates.
  9026. The expressions can use the following variables:
  9027. @table @option
  9028. @item W
  9029. @item H
  9030. the width and height of video frame.
  9031. @item in
  9032. Input frame count.
  9033. @item on
  9034. Output frame count.
  9035. @end table
  9036. @item interpolation
  9037. Set interpolation for perspective correction.
  9038. It accepts the following values:
  9039. @table @samp
  9040. @item linear
  9041. @item cubic
  9042. @end table
  9043. Default value is @samp{linear}.
  9044. @item sense
  9045. Set interpretation of coordinate options.
  9046. It accepts the following values:
  9047. @table @samp
  9048. @item 0, source
  9049. Send point in the source specified by the given coordinates to
  9050. the corners of the destination.
  9051. @item 1, destination
  9052. Send the corners of the source to the point in the destination specified
  9053. by the given coordinates.
  9054. Default value is @samp{source}.
  9055. @end table
  9056. @item eval
  9057. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9058. It accepts the following values:
  9059. @table @samp
  9060. @item init
  9061. only evaluate expressions once during the filter initialization or
  9062. when a command is processed
  9063. @item frame
  9064. evaluate expressions for each incoming frame
  9065. @end table
  9066. Default value is @samp{init}.
  9067. @end table
  9068. @section phase
  9069. Delay interlaced video by one field time so that the field order changes.
  9070. The intended use is to fix PAL movies that have been captured with the
  9071. opposite field order to the film-to-video transfer.
  9072. A description of the accepted parameters follows.
  9073. @table @option
  9074. @item mode
  9075. Set phase mode.
  9076. It accepts the following values:
  9077. @table @samp
  9078. @item t
  9079. Capture field order top-first, transfer bottom-first.
  9080. Filter will delay the bottom field.
  9081. @item b
  9082. Capture field order bottom-first, transfer top-first.
  9083. Filter will delay the top field.
  9084. @item p
  9085. Capture and transfer with the same field order. This mode only exists
  9086. for the documentation of the other options to refer to, but if you
  9087. actually select it, the filter will faithfully do nothing.
  9088. @item a
  9089. Capture field order determined automatically by field flags, transfer
  9090. opposite.
  9091. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9092. basis using field flags. If no field information is available,
  9093. then this works just like @samp{u}.
  9094. @item u
  9095. Capture unknown or varying, transfer opposite.
  9096. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9097. analyzing the images and selecting the alternative that produces best
  9098. match between the fields.
  9099. @item T
  9100. Capture top-first, transfer unknown or varying.
  9101. Filter selects among @samp{t} and @samp{p} using image analysis.
  9102. @item B
  9103. Capture bottom-first, transfer unknown or varying.
  9104. Filter selects among @samp{b} and @samp{p} using image analysis.
  9105. @item A
  9106. Capture determined by field flags, transfer unknown or varying.
  9107. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9108. image analysis. If no field information is available, then this works just
  9109. like @samp{U}. This is the default mode.
  9110. @item U
  9111. Both capture and transfer unknown or varying.
  9112. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9113. @end table
  9114. @end table
  9115. @section pixdesctest
  9116. Pixel format descriptor test filter, mainly useful for internal
  9117. testing. The output video should be equal to the input video.
  9118. For example:
  9119. @example
  9120. format=monow, pixdesctest
  9121. @end example
  9122. can be used to test the monowhite pixel format descriptor definition.
  9123. @section pixscope
  9124. Display sample values of color channels. Mainly useful for checking color
  9125. and levels. Minimum supported resolution is 640x480.
  9126. The filters accept the following options:
  9127. @table @option
  9128. @item x
  9129. Set scope X position, relative offset on X axis.
  9130. @item y
  9131. Set scope Y position, relative offset on Y axis.
  9132. @item w
  9133. Set scope width.
  9134. @item h
  9135. Set scope height.
  9136. @item o
  9137. Set window opacity. This window also holds statistics about pixel area.
  9138. @item wx
  9139. Set window X position, relative offset on X axis.
  9140. @item wy
  9141. Set window Y position, relative offset on Y axis.
  9142. @end table
  9143. @section pp
  9144. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9145. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9146. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9147. Each subfilter and some options have a short and a long name that can be used
  9148. interchangeably, i.e. dr/dering are the same.
  9149. The filters accept the following options:
  9150. @table @option
  9151. @item subfilters
  9152. Set postprocessing subfilters string.
  9153. @end table
  9154. All subfilters share common options to determine their scope:
  9155. @table @option
  9156. @item a/autoq
  9157. Honor the quality commands for this subfilter.
  9158. @item c/chrom
  9159. Do chrominance filtering, too (default).
  9160. @item y/nochrom
  9161. Do luminance filtering only (no chrominance).
  9162. @item n/noluma
  9163. Do chrominance filtering only (no luminance).
  9164. @end table
  9165. These options can be appended after the subfilter name, separated by a '|'.
  9166. Available subfilters are:
  9167. @table @option
  9168. @item hb/hdeblock[|difference[|flatness]]
  9169. Horizontal deblocking filter
  9170. @table @option
  9171. @item difference
  9172. Difference factor where higher values mean more deblocking (default: @code{32}).
  9173. @item flatness
  9174. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9175. @end table
  9176. @item vb/vdeblock[|difference[|flatness]]
  9177. Vertical deblocking filter
  9178. @table @option
  9179. @item difference
  9180. Difference factor where higher values mean more deblocking (default: @code{32}).
  9181. @item flatness
  9182. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9183. @end table
  9184. @item ha/hadeblock[|difference[|flatness]]
  9185. Accurate horizontal deblocking filter
  9186. @table @option
  9187. @item difference
  9188. Difference factor where higher values mean more deblocking (default: @code{32}).
  9189. @item flatness
  9190. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9191. @end table
  9192. @item va/vadeblock[|difference[|flatness]]
  9193. Accurate vertical deblocking filter
  9194. @table @option
  9195. @item difference
  9196. Difference factor where higher values mean more deblocking (default: @code{32}).
  9197. @item flatness
  9198. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9199. @end table
  9200. @end table
  9201. The horizontal and vertical deblocking filters share the difference and
  9202. flatness values so you cannot set different horizontal and vertical
  9203. thresholds.
  9204. @table @option
  9205. @item h1/x1hdeblock
  9206. Experimental horizontal deblocking filter
  9207. @item v1/x1vdeblock
  9208. Experimental vertical deblocking filter
  9209. @item dr/dering
  9210. Deringing filter
  9211. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9212. @table @option
  9213. @item threshold1
  9214. larger -> stronger filtering
  9215. @item threshold2
  9216. larger -> stronger filtering
  9217. @item threshold3
  9218. larger -> stronger filtering
  9219. @end table
  9220. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9221. @table @option
  9222. @item f/fullyrange
  9223. Stretch luminance to @code{0-255}.
  9224. @end table
  9225. @item lb/linblenddeint
  9226. Linear blend deinterlacing filter that deinterlaces the given block by
  9227. filtering all lines with a @code{(1 2 1)} filter.
  9228. @item li/linipoldeint
  9229. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9230. linearly interpolating every second line.
  9231. @item ci/cubicipoldeint
  9232. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9233. cubically interpolating every second line.
  9234. @item md/mediandeint
  9235. Median deinterlacing filter that deinterlaces the given block by applying a
  9236. median filter to every second line.
  9237. @item fd/ffmpegdeint
  9238. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9239. second line with a @code{(-1 4 2 4 -1)} filter.
  9240. @item l5/lowpass5
  9241. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9242. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9243. @item fq/forceQuant[|quantizer]
  9244. Overrides the quantizer table from the input with the constant quantizer you
  9245. specify.
  9246. @table @option
  9247. @item quantizer
  9248. Quantizer to use
  9249. @end table
  9250. @item de/default
  9251. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9252. @item fa/fast
  9253. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9254. @item ac
  9255. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9256. @end table
  9257. @subsection Examples
  9258. @itemize
  9259. @item
  9260. Apply horizontal and vertical deblocking, deringing and automatic
  9261. brightness/contrast:
  9262. @example
  9263. pp=hb/vb/dr/al
  9264. @end example
  9265. @item
  9266. Apply default filters without brightness/contrast correction:
  9267. @example
  9268. pp=de/-al
  9269. @end example
  9270. @item
  9271. Apply default filters and temporal denoiser:
  9272. @example
  9273. pp=default/tmpnoise|1|2|3
  9274. @end example
  9275. @item
  9276. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9277. automatically depending on available CPU time:
  9278. @example
  9279. pp=hb|y/vb|a
  9280. @end example
  9281. @end itemize
  9282. @section pp7
  9283. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9284. similar to spp = 6 with 7 point DCT, where only the center sample is
  9285. used after IDCT.
  9286. The filter accepts the following options:
  9287. @table @option
  9288. @item qp
  9289. Force a constant quantization parameter. It accepts an integer in range
  9290. 0 to 63. If not set, the filter will use the QP from the video stream
  9291. (if available).
  9292. @item mode
  9293. Set thresholding mode. Available modes are:
  9294. @table @samp
  9295. @item hard
  9296. Set hard thresholding.
  9297. @item soft
  9298. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9299. @item medium
  9300. Set medium thresholding (good results, default).
  9301. @end table
  9302. @end table
  9303. @section premultiply
  9304. Apply alpha premultiply effect to input video stream using first plane
  9305. of second stream as alpha.
  9306. Both streams must have same dimensions and same pixel format.
  9307. The filter accepts the following option:
  9308. @table @option
  9309. @item planes
  9310. Set which planes will be processed, unprocessed planes will be copied.
  9311. By default value 0xf, all planes will be processed.
  9312. @item inplace
  9313. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9314. @end table
  9315. @section prewitt
  9316. Apply prewitt operator to input video stream.
  9317. The filter accepts the following option:
  9318. @table @option
  9319. @item planes
  9320. Set which planes will be processed, unprocessed planes will be copied.
  9321. By default value 0xf, all planes will be processed.
  9322. @item scale
  9323. Set value which will be multiplied with filtered result.
  9324. @item delta
  9325. Set value which will be added to filtered result.
  9326. @end table
  9327. @section pseudocolor
  9328. Alter frame colors in video with pseudocolors.
  9329. This filter accept the following options:
  9330. @table @option
  9331. @item c0
  9332. set pixel first component expression
  9333. @item c1
  9334. set pixel second component expression
  9335. @item c2
  9336. set pixel third component expression
  9337. @item c3
  9338. set pixel fourth component expression, corresponds to the alpha component
  9339. @item i
  9340. set component to use as base for altering colors
  9341. @end table
  9342. Each of them specifies the expression to use for computing the lookup table for
  9343. the corresponding pixel component values.
  9344. The expressions can contain the following constants and functions:
  9345. @table @option
  9346. @item w
  9347. @item h
  9348. The input width and height.
  9349. @item val
  9350. The input value for the pixel component.
  9351. @item ymin, umin, vmin, amin
  9352. The minimum allowed component value.
  9353. @item ymax, umax, vmax, amax
  9354. The maximum allowed component value.
  9355. @end table
  9356. All expressions default to "val".
  9357. @subsection Examples
  9358. @itemize
  9359. @item
  9360. Change too high luma values to gradient:
  9361. @example
  9362. 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'"
  9363. @end example
  9364. @end itemize
  9365. @section psnr
  9366. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9367. Ratio) between two input videos.
  9368. This filter takes in input two input videos, the first input is
  9369. considered the "main" source and is passed unchanged to the
  9370. output. The second input is used as a "reference" video for computing
  9371. the PSNR.
  9372. Both video inputs must have the same resolution and pixel format for
  9373. this filter to work correctly. Also it assumes that both inputs
  9374. have the same number of frames, which are compared one by one.
  9375. The obtained average PSNR is printed through the logging system.
  9376. The filter stores the accumulated MSE (mean squared error) of each
  9377. frame, and at the end of the processing it is averaged across all frames
  9378. equally, and the following formula is applied to obtain the PSNR:
  9379. @example
  9380. PSNR = 10*log10(MAX^2/MSE)
  9381. @end example
  9382. Where MAX is the average of the maximum values of each component of the
  9383. image.
  9384. The description of the accepted parameters follows.
  9385. @table @option
  9386. @item stats_file, f
  9387. If specified the filter will use the named file to save the PSNR of
  9388. each individual frame. When filename equals "-" the data is sent to
  9389. standard output.
  9390. @item stats_version
  9391. Specifies which version of the stats file format to use. Details of
  9392. each format are written below.
  9393. Default value is 1.
  9394. @item stats_add_max
  9395. Determines whether the max value is output to the stats log.
  9396. Default value is 0.
  9397. Requires stats_version >= 2. If this is set and stats_version < 2,
  9398. the filter will return an error.
  9399. @end table
  9400. This filter also supports the @ref{framesync} options.
  9401. The file printed if @var{stats_file} is selected, contains a sequence of
  9402. key/value pairs of the form @var{key}:@var{value} for each compared
  9403. couple of frames.
  9404. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9405. the list of per-frame-pair stats, with key value pairs following the frame
  9406. format with the following parameters:
  9407. @table @option
  9408. @item psnr_log_version
  9409. The version of the log file format. Will match @var{stats_version}.
  9410. @item fields
  9411. A comma separated list of the per-frame-pair parameters included in
  9412. the log.
  9413. @end table
  9414. A description of each shown per-frame-pair parameter follows:
  9415. @table @option
  9416. @item n
  9417. sequential number of the input frame, starting from 1
  9418. @item mse_avg
  9419. Mean Square Error pixel-by-pixel average difference of the compared
  9420. frames, averaged over all the image components.
  9421. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9422. Mean Square Error pixel-by-pixel average difference of the compared
  9423. frames for the component specified by the suffix.
  9424. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9425. Peak Signal to Noise ratio of the compared frames for the component
  9426. specified by the suffix.
  9427. @item max_avg, max_y, max_u, max_v
  9428. Maximum allowed value for each channel, and average over all
  9429. channels.
  9430. @end table
  9431. For example:
  9432. @example
  9433. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9434. [main][ref] psnr="stats_file=stats.log" [out]
  9435. @end example
  9436. On this example the input file being processed is compared with the
  9437. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9438. is stored in @file{stats.log}.
  9439. @anchor{pullup}
  9440. @section pullup
  9441. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9442. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9443. content.
  9444. The pullup filter is designed to take advantage of future context in making
  9445. its decisions. This filter is stateless in the sense that it does not lock
  9446. onto a pattern to follow, but it instead looks forward to the following
  9447. fields in order to identify matches and rebuild progressive frames.
  9448. To produce content with an even framerate, insert the fps filter after
  9449. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9450. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9451. The filter accepts the following options:
  9452. @table @option
  9453. @item jl
  9454. @item jr
  9455. @item jt
  9456. @item jb
  9457. These options set the amount of "junk" to ignore at the left, right, top, and
  9458. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9459. while top and bottom are in units of 2 lines.
  9460. The default is 8 pixels on each side.
  9461. @item sb
  9462. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9463. filter generating an occasional mismatched frame, but it may also cause an
  9464. excessive number of frames to be dropped during high motion sequences.
  9465. Conversely, setting it to -1 will make filter match fields more easily.
  9466. This may help processing of video where there is slight blurring between
  9467. the fields, but may also cause there to be interlaced frames in the output.
  9468. Default value is @code{0}.
  9469. @item mp
  9470. Set the metric plane to use. It accepts the following values:
  9471. @table @samp
  9472. @item l
  9473. Use luma plane.
  9474. @item u
  9475. Use chroma blue plane.
  9476. @item v
  9477. Use chroma red plane.
  9478. @end table
  9479. This option may be set to use chroma plane instead of the default luma plane
  9480. for doing filter's computations. This may improve accuracy on very clean
  9481. source material, but more likely will decrease accuracy, especially if there
  9482. is chroma noise (rainbow effect) or any grayscale video.
  9483. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9484. load and make pullup usable in realtime on slow machines.
  9485. @end table
  9486. For best results (without duplicated frames in the output file) it is
  9487. necessary to change the output frame rate. For example, to inverse
  9488. telecine NTSC input:
  9489. @example
  9490. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9491. @end example
  9492. @section qp
  9493. Change video quantization parameters (QP).
  9494. The filter accepts the following option:
  9495. @table @option
  9496. @item qp
  9497. Set expression for quantization parameter.
  9498. @end table
  9499. The expression is evaluated through the eval API and can contain, among others,
  9500. the following constants:
  9501. @table @var
  9502. @item known
  9503. 1 if index is not 129, 0 otherwise.
  9504. @item qp
  9505. Sequential index starting from -129 to 128.
  9506. @end table
  9507. @subsection Examples
  9508. @itemize
  9509. @item
  9510. Some equation like:
  9511. @example
  9512. qp=2+2*sin(PI*qp)
  9513. @end example
  9514. @end itemize
  9515. @section random
  9516. Flush video frames from internal cache of frames into a random order.
  9517. No frame is discarded.
  9518. Inspired by @ref{frei0r} nervous filter.
  9519. @table @option
  9520. @item frames
  9521. Set size in number of frames of internal cache, in range from @code{2} to
  9522. @code{512}. Default is @code{30}.
  9523. @item seed
  9524. Set seed for random number generator, must be an integer included between
  9525. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9526. less than @code{0}, the filter will try to use a good random seed on a
  9527. best effort basis.
  9528. @end table
  9529. @section readeia608
  9530. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9531. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9532. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9533. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9534. @table @option
  9535. @item lavfi.readeia608.X.cc
  9536. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9537. @item lavfi.readeia608.X.line
  9538. The number of the line on which the EIA-608 data was identified and read.
  9539. @end table
  9540. This filter accepts the following options:
  9541. @table @option
  9542. @item scan_min
  9543. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9544. @item scan_max
  9545. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9546. @item mac
  9547. Set minimal acceptable amplitude change for sync codes detection.
  9548. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9549. @item spw
  9550. Set the ratio of width reserved for sync code detection.
  9551. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9552. @item mhd
  9553. Set the max peaks height difference for sync code detection.
  9554. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9555. @item mpd
  9556. Set max peaks period difference for sync code detection.
  9557. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9558. @item msd
  9559. Set the first two max start code bits differences.
  9560. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9561. @item bhd
  9562. Set the minimum ratio of bits height compared to 3rd start code bit.
  9563. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9564. @item th_w
  9565. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9566. @item th_b
  9567. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9568. @item chp
  9569. Enable checking the parity bit. In the event of a parity error, the filter will output
  9570. @code{0x00} for that character. Default is false.
  9571. @end table
  9572. @subsection Examples
  9573. @itemize
  9574. @item
  9575. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9576. @example
  9577. 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
  9578. @end example
  9579. @end itemize
  9580. @section readvitc
  9581. Read vertical interval timecode (VITC) information from the top lines of a
  9582. video frame.
  9583. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9584. timecode value, if a valid timecode has been detected. Further metadata key
  9585. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9586. timecode data has been found or not.
  9587. This filter accepts the following options:
  9588. @table @option
  9589. @item scan_max
  9590. Set the maximum number of lines to scan for VITC data. If the value is set to
  9591. @code{-1} the full video frame is scanned. Default is @code{45}.
  9592. @item thr_b
  9593. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9594. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9595. @item thr_w
  9596. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9597. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9598. @end table
  9599. @subsection Examples
  9600. @itemize
  9601. @item
  9602. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9603. draw @code{--:--:--:--} as a placeholder:
  9604. @example
  9605. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9606. @end example
  9607. @end itemize
  9608. @section remap
  9609. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9610. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9611. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9612. value for pixel will be used for destination pixel.
  9613. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9614. will have Xmap/Ymap video stream dimensions.
  9615. Xmap and Ymap input video streams are 16bit depth, single channel.
  9616. @section removegrain
  9617. The removegrain filter is a spatial denoiser for progressive video.
  9618. @table @option
  9619. @item m0
  9620. Set mode for the first plane.
  9621. @item m1
  9622. Set mode for the second plane.
  9623. @item m2
  9624. Set mode for the third plane.
  9625. @item m3
  9626. Set mode for the fourth plane.
  9627. @end table
  9628. Range of mode is from 0 to 24. Description of each mode follows:
  9629. @table @var
  9630. @item 0
  9631. Leave input plane unchanged. Default.
  9632. @item 1
  9633. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9634. @item 2
  9635. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9636. @item 3
  9637. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9638. @item 4
  9639. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9640. This is equivalent to a median filter.
  9641. @item 5
  9642. Line-sensitive clipping giving the minimal change.
  9643. @item 6
  9644. Line-sensitive clipping, intermediate.
  9645. @item 7
  9646. Line-sensitive clipping, intermediate.
  9647. @item 8
  9648. Line-sensitive clipping, intermediate.
  9649. @item 9
  9650. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9651. @item 10
  9652. Replaces the target pixel with the closest neighbour.
  9653. @item 11
  9654. [1 2 1] horizontal and vertical kernel blur.
  9655. @item 12
  9656. Same as mode 11.
  9657. @item 13
  9658. Bob mode, interpolates top field from the line where the neighbours
  9659. pixels are the closest.
  9660. @item 14
  9661. Bob mode, interpolates bottom field from the line where the neighbours
  9662. pixels are the closest.
  9663. @item 15
  9664. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9665. interpolation formula.
  9666. @item 16
  9667. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9668. interpolation formula.
  9669. @item 17
  9670. Clips the pixel with the minimum and maximum of respectively the maximum and
  9671. minimum of each pair of opposite neighbour pixels.
  9672. @item 18
  9673. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9674. the current pixel is minimal.
  9675. @item 19
  9676. Replaces the pixel with the average of its 8 neighbours.
  9677. @item 20
  9678. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9679. @item 21
  9680. Clips pixels using the averages of opposite neighbour.
  9681. @item 22
  9682. Same as mode 21 but simpler and faster.
  9683. @item 23
  9684. Small edge and halo removal, but reputed useless.
  9685. @item 24
  9686. Similar as 23.
  9687. @end table
  9688. @section removelogo
  9689. Suppress a TV station logo, using an image file to determine which
  9690. pixels comprise the logo. It works by filling in the pixels that
  9691. comprise the logo with neighboring pixels.
  9692. The filter accepts the following options:
  9693. @table @option
  9694. @item filename, f
  9695. Set the filter bitmap file, which can be any image format supported by
  9696. libavformat. The width and height of the image file must match those of the
  9697. video stream being processed.
  9698. @end table
  9699. Pixels in the provided bitmap image with a value of zero are not
  9700. considered part of the logo, non-zero pixels are considered part of
  9701. the logo. If you use white (255) for the logo and black (0) for the
  9702. rest, you will be safe. For making the filter bitmap, it is
  9703. recommended to take a screen capture of a black frame with the logo
  9704. visible, and then using a threshold filter followed by the erode
  9705. filter once or twice.
  9706. If needed, little splotches can be fixed manually. Remember that if
  9707. logo pixels are not covered, the filter quality will be much
  9708. reduced. Marking too many pixels as part of the logo does not hurt as
  9709. much, but it will increase the amount of blurring needed to cover over
  9710. the image and will destroy more information than necessary, and extra
  9711. pixels will slow things down on a large logo.
  9712. @section repeatfields
  9713. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9714. fields based on its value.
  9715. @section reverse
  9716. Reverse a video clip.
  9717. Warning: This filter requires memory to buffer the entire clip, so trimming
  9718. is suggested.
  9719. @subsection Examples
  9720. @itemize
  9721. @item
  9722. Take the first 5 seconds of a clip, and reverse it.
  9723. @example
  9724. trim=end=5,reverse
  9725. @end example
  9726. @end itemize
  9727. @section roberts
  9728. Apply roberts cross operator to input video stream.
  9729. The filter accepts the following option:
  9730. @table @option
  9731. @item planes
  9732. Set which planes will be processed, unprocessed planes will be copied.
  9733. By default value 0xf, all planes will be processed.
  9734. @item scale
  9735. Set value which will be multiplied with filtered result.
  9736. @item delta
  9737. Set value which will be added to filtered result.
  9738. @end table
  9739. @section rotate
  9740. Rotate video by an arbitrary angle expressed in radians.
  9741. The filter accepts the following options:
  9742. A description of the optional parameters follows.
  9743. @table @option
  9744. @item angle, a
  9745. Set an expression for the angle by which to rotate the input video
  9746. clockwise, expressed as a number of radians. A negative value will
  9747. result in a counter-clockwise rotation. By default it is set to "0".
  9748. This expression is evaluated for each frame.
  9749. @item out_w, ow
  9750. Set the output width expression, default value is "iw".
  9751. This expression is evaluated just once during configuration.
  9752. @item out_h, oh
  9753. Set the output height expression, default value is "ih".
  9754. This expression is evaluated just once during configuration.
  9755. @item bilinear
  9756. Enable bilinear interpolation if set to 1, a value of 0 disables
  9757. it. Default value is 1.
  9758. @item fillcolor, c
  9759. Set the color used to fill the output area not covered by the rotated
  9760. image. For the general syntax of this option, check the "Color" section in the
  9761. ffmpeg-utils manual. If the special value "none" is selected then no
  9762. background is printed (useful for example if the background is never shown).
  9763. Default value is "black".
  9764. @end table
  9765. The expressions for the angle and the output size can contain the
  9766. following constants and functions:
  9767. @table @option
  9768. @item n
  9769. sequential number of the input frame, starting from 0. It is always NAN
  9770. before the first frame is filtered.
  9771. @item t
  9772. time in seconds of the input frame, it is set to 0 when the filter is
  9773. configured. It is always NAN before the first frame is filtered.
  9774. @item hsub
  9775. @item vsub
  9776. horizontal and vertical chroma subsample values. For example for the
  9777. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9778. @item in_w, iw
  9779. @item in_h, ih
  9780. the input video width and height
  9781. @item out_w, ow
  9782. @item out_h, oh
  9783. the output width and height, that is the size of the padded area as
  9784. specified by the @var{width} and @var{height} expressions
  9785. @item rotw(a)
  9786. @item roth(a)
  9787. the minimal width/height required for completely containing the input
  9788. video rotated by @var{a} radians.
  9789. These are only available when computing the @option{out_w} and
  9790. @option{out_h} expressions.
  9791. @end table
  9792. @subsection Examples
  9793. @itemize
  9794. @item
  9795. Rotate the input by PI/6 radians clockwise:
  9796. @example
  9797. rotate=PI/6
  9798. @end example
  9799. @item
  9800. Rotate the input by PI/6 radians counter-clockwise:
  9801. @example
  9802. rotate=-PI/6
  9803. @end example
  9804. @item
  9805. Rotate the input by 45 degrees clockwise:
  9806. @example
  9807. rotate=45*PI/180
  9808. @end example
  9809. @item
  9810. Apply a constant rotation with period T, starting from an angle of PI/3:
  9811. @example
  9812. rotate=PI/3+2*PI*t/T
  9813. @end example
  9814. @item
  9815. Make the input video rotation oscillating with a period of T
  9816. seconds and an amplitude of A radians:
  9817. @example
  9818. rotate=A*sin(2*PI/T*t)
  9819. @end example
  9820. @item
  9821. Rotate the video, output size is chosen so that the whole rotating
  9822. input video is always completely contained in the output:
  9823. @example
  9824. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9825. @end example
  9826. @item
  9827. Rotate the video, reduce the output size so that no background is ever
  9828. shown:
  9829. @example
  9830. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9831. @end example
  9832. @end itemize
  9833. @subsection Commands
  9834. The filter supports the following commands:
  9835. @table @option
  9836. @item a, angle
  9837. Set the angle expression.
  9838. The command accepts the same syntax of the corresponding option.
  9839. If the specified expression is not valid, it is kept at its current
  9840. value.
  9841. @end table
  9842. @section sab
  9843. Apply Shape Adaptive Blur.
  9844. The filter accepts the following options:
  9845. @table @option
  9846. @item luma_radius, lr
  9847. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9848. value is 1.0. A greater value will result in a more blurred image, and
  9849. in slower processing.
  9850. @item luma_pre_filter_radius, lpfr
  9851. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9852. value is 1.0.
  9853. @item luma_strength, ls
  9854. Set luma maximum difference between pixels to still be considered, must
  9855. be a value in the 0.1-100.0 range, default value is 1.0.
  9856. @item chroma_radius, cr
  9857. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9858. greater value will result in a more blurred image, and in slower
  9859. processing.
  9860. @item chroma_pre_filter_radius, cpfr
  9861. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9862. @item chroma_strength, cs
  9863. Set chroma maximum difference between pixels to still be considered,
  9864. must be a value in the -0.9-100.0 range.
  9865. @end table
  9866. Each chroma option value, if not explicitly specified, is set to the
  9867. corresponding luma option value.
  9868. @anchor{scale}
  9869. @section scale
  9870. Scale (resize) the input video, using the libswscale library.
  9871. The scale filter forces the output display aspect ratio to be the same
  9872. of the input, by changing the output sample aspect ratio.
  9873. If the input image format is different from the format requested by
  9874. the next filter, the scale filter will convert the input to the
  9875. requested format.
  9876. @subsection Options
  9877. The filter accepts the following options, or any of the options
  9878. supported by the libswscale scaler.
  9879. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9880. the complete list of scaler options.
  9881. @table @option
  9882. @item width, w
  9883. @item height, h
  9884. Set the output video dimension expression. Default value is the input
  9885. dimension.
  9886. If the @var{width} or @var{w} value is 0, the input width is used for
  9887. the output. If the @var{height} or @var{h} value is 0, the input height
  9888. is used for the output.
  9889. If one and only one of the values is -n with n >= 1, the scale filter
  9890. will use a value that maintains the aspect ratio of the input image,
  9891. calculated from the other specified dimension. After that it will,
  9892. however, make sure that the calculated dimension is divisible by n and
  9893. adjust the value if necessary.
  9894. If both values are -n with n >= 1, the behavior will be identical to
  9895. both values being set to 0 as previously detailed.
  9896. See below for the list of accepted constants for use in the dimension
  9897. expression.
  9898. @item eval
  9899. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9900. @table @samp
  9901. @item init
  9902. Only evaluate expressions once during the filter initialization or when a command is processed.
  9903. @item frame
  9904. Evaluate expressions for each incoming frame.
  9905. @end table
  9906. Default value is @samp{init}.
  9907. @item interl
  9908. Set the interlacing mode. It accepts the following values:
  9909. @table @samp
  9910. @item 1
  9911. Force interlaced aware scaling.
  9912. @item 0
  9913. Do not apply interlaced scaling.
  9914. @item -1
  9915. Select interlaced aware scaling depending on whether the source frames
  9916. are flagged as interlaced or not.
  9917. @end table
  9918. Default value is @samp{0}.
  9919. @item flags
  9920. Set libswscale scaling flags. See
  9921. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9922. complete list of values. If not explicitly specified the filter applies
  9923. the default flags.
  9924. @item param0, param1
  9925. Set libswscale input parameters for scaling algorithms that need them. See
  9926. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9927. complete documentation. If not explicitly specified the filter applies
  9928. empty parameters.
  9929. @item size, s
  9930. Set the video size. For the syntax of this option, check the
  9931. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9932. @item in_color_matrix
  9933. @item out_color_matrix
  9934. Set in/output YCbCr color space type.
  9935. This allows the autodetected value to be overridden as well as allows forcing
  9936. a specific value used for the output and encoder.
  9937. If not specified, the color space type depends on the pixel format.
  9938. Possible values:
  9939. @table @samp
  9940. @item auto
  9941. Choose automatically.
  9942. @item bt709
  9943. Format conforming to International Telecommunication Union (ITU)
  9944. Recommendation BT.709.
  9945. @item fcc
  9946. Set color space conforming to the United States Federal Communications
  9947. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9948. @item bt601
  9949. Set color space conforming to:
  9950. @itemize
  9951. @item
  9952. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9953. @item
  9954. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9955. @item
  9956. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9957. @end itemize
  9958. @item smpte240m
  9959. Set color space conforming to SMPTE ST 240:1999.
  9960. @end table
  9961. @item in_range
  9962. @item out_range
  9963. Set in/output YCbCr sample range.
  9964. This allows the autodetected value to be overridden as well as allows forcing
  9965. a specific value used for the output and encoder. If not specified, the
  9966. range depends on the pixel format. Possible values:
  9967. @table @samp
  9968. @item auto
  9969. Choose automatically.
  9970. @item jpeg/full/pc
  9971. Set full range (0-255 in case of 8-bit luma).
  9972. @item mpeg/tv
  9973. Set "MPEG" range (16-235 in case of 8-bit luma).
  9974. @end table
  9975. @item force_original_aspect_ratio
  9976. Enable decreasing or increasing output video width or height if necessary to
  9977. keep the original aspect ratio. Possible values:
  9978. @table @samp
  9979. @item disable
  9980. Scale the video as specified and disable this feature.
  9981. @item decrease
  9982. The output video dimensions will automatically be decreased if needed.
  9983. @item increase
  9984. The output video dimensions will automatically be increased if needed.
  9985. @end table
  9986. One useful instance of this option is that when you know a specific device's
  9987. maximum allowed resolution, you can use this to limit the output video to
  9988. that, while retaining the aspect ratio. For example, device A allows
  9989. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9990. decrease) and specifying 1280x720 to the command line makes the output
  9991. 1280x533.
  9992. Please note that this is a different thing than specifying -1 for @option{w}
  9993. or @option{h}, you still need to specify the output resolution for this option
  9994. to work.
  9995. @end table
  9996. The values of the @option{w} and @option{h} options are expressions
  9997. containing the following constants:
  9998. @table @var
  9999. @item in_w
  10000. @item in_h
  10001. The input width and height
  10002. @item iw
  10003. @item ih
  10004. These are the same as @var{in_w} and @var{in_h}.
  10005. @item out_w
  10006. @item out_h
  10007. The output (scaled) width and height
  10008. @item ow
  10009. @item oh
  10010. These are the same as @var{out_w} and @var{out_h}
  10011. @item a
  10012. The same as @var{iw} / @var{ih}
  10013. @item sar
  10014. input sample aspect ratio
  10015. @item dar
  10016. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10017. @item hsub
  10018. @item vsub
  10019. horizontal and vertical input chroma subsample values. For example for the
  10020. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10021. @item ohsub
  10022. @item ovsub
  10023. horizontal and vertical output chroma subsample values. For example for the
  10024. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10025. @end table
  10026. @subsection Examples
  10027. @itemize
  10028. @item
  10029. Scale the input video to a size of 200x100
  10030. @example
  10031. scale=w=200:h=100
  10032. @end example
  10033. This is equivalent to:
  10034. @example
  10035. scale=200:100
  10036. @end example
  10037. or:
  10038. @example
  10039. scale=200x100
  10040. @end example
  10041. @item
  10042. Specify a size abbreviation for the output size:
  10043. @example
  10044. scale=qcif
  10045. @end example
  10046. which can also be written as:
  10047. @example
  10048. scale=size=qcif
  10049. @end example
  10050. @item
  10051. Scale the input to 2x:
  10052. @example
  10053. scale=w=2*iw:h=2*ih
  10054. @end example
  10055. @item
  10056. The above is the same as:
  10057. @example
  10058. scale=2*in_w:2*in_h
  10059. @end example
  10060. @item
  10061. Scale the input to 2x with forced interlaced scaling:
  10062. @example
  10063. scale=2*iw:2*ih:interl=1
  10064. @end example
  10065. @item
  10066. Scale the input to half size:
  10067. @example
  10068. scale=w=iw/2:h=ih/2
  10069. @end example
  10070. @item
  10071. Increase the width, and set the height to the same size:
  10072. @example
  10073. scale=3/2*iw:ow
  10074. @end example
  10075. @item
  10076. Seek Greek harmony:
  10077. @example
  10078. scale=iw:1/PHI*iw
  10079. scale=ih*PHI:ih
  10080. @end example
  10081. @item
  10082. Increase the height, and set the width to 3/2 of the height:
  10083. @example
  10084. scale=w=3/2*oh:h=3/5*ih
  10085. @end example
  10086. @item
  10087. Increase the size, making the size a multiple of the chroma
  10088. subsample values:
  10089. @example
  10090. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10091. @end example
  10092. @item
  10093. Increase the width to a maximum of 500 pixels,
  10094. keeping the same aspect ratio as the input:
  10095. @example
  10096. scale=w='min(500\, iw*3/2):h=-1'
  10097. @end example
  10098. @end itemize
  10099. @subsection Commands
  10100. This filter supports the following commands:
  10101. @table @option
  10102. @item width, w
  10103. @item height, h
  10104. Set the output video dimension expression.
  10105. The command accepts the same syntax of the corresponding option.
  10106. If the specified expression is not valid, it is kept at its current
  10107. value.
  10108. @end table
  10109. @section scale_npp
  10110. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10111. format conversion on CUDA video frames. Setting the output width and height
  10112. works in the same way as for the @var{scale} filter.
  10113. The following additional options are accepted:
  10114. @table @option
  10115. @item format
  10116. The pixel format of the output CUDA frames. If set to the string "same" (the
  10117. default), the input format will be kept. Note that automatic format negotiation
  10118. and conversion is not yet supported for hardware frames
  10119. @item interp_algo
  10120. The interpolation algorithm used for resizing. One of the following:
  10121. @table @option
  10122. @item nn
  10123. Nearest neighbour.
  10124. @item linear
  10125. @item cubic
  10126. @item cubic2p_bspline
  10127. 2-parameter cubic (B=1, C=0)
  10128. @item cubic2p_catmullrom
  10129. 2-parameter cubic (B=0, C=1/2)
  10130. @item cubic2p_b05c03
  10131. 2-parameter cubic (B=1/2, C=3/10)
  10132. @item super
  10133. Supersampling
  10134. @item lanczos
  10135. @end table
  10136. @end table
  10137. @section scale2ref
  10138. Scale (resize) the input video, based on a reference video.
  10139. See the scale filter for available options, scale2ref supports the same but
  10140. uses the reference video instead of the main input as basis. scale2ref also
  10141. supports the following additional constants for the @option{w} and
  10142. @option{h} options:
  10143. @table @var
  10144. @item main_w
  10145. @item main_h
  10146. The main input video's width and height
  10147. @item main_a
  10148. The same as @var{main_w} / @var{main_h}
  10149. @item main_sar
  10150. The main input video's sample aspect ratio
  10151. @item main_dar, mdar
  10152. The main input video's display aspect ratio. Calculated from
  10153. @code{(main_w / main_h) * main_sar}.
  10154. @item main_hsub
  10155. @item main_vsub
  10156. The main input video's horizontal and vertical chroma subsample values.
  10157. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10158. is 1.
  10159. @end table
  10160. @subsection Examples
  10161. @itemize
  10162. @item
  10163. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10164. @example
  10165. 'scale2ref[b][a];[a][b]overlay'
  10166. @end example
  10167. @end itemize
  10168. @anchor{selectivecolor}
  10169. @section selectivecolor
  10170. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10171. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10172. by the "purity" of the color (that is, how saturated it already is).
  10173. This filter is similar to the Adobe Photoshop Selective Color tool.
  10174. The filter accepts the following options:
  10175. @table @option
  10176. @item correction_method
  10177. Select color correction method.
  10178. Available values are:
  10179. @table @samp
  10180. @item absolute
  10181. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10182. component value).
  10183. @item relative
  10184. Specified adjustments are relative to the original component value.
  10185. @end table
  10186. Default is @code{absolute}.
  10187. @item reds
  10188. Adjustments for red pixels (pixels where the red component is the maximum)
  10189. @item yellows
  10190. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10191. @item greens
  10192. Adjustments for green pixels (pixels where the green component is the maximum)
  10193. @item cyans
  10194. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10195. @item blues
  10196. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10197. @item magentas
  10198. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10199. @item whites
  10200. Adjustments for white pixels (pixels where all components are greater than 128)
  10201. @item neutrals
  10202. Adjustments for all pixels except pure black and pure white
  10203. @item blacks
  10204. Adjustments for black pixels (pixels where all components are lesser than 128)
  10205. @item psfile
  10206. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10207. @end table
  10208. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10209. 4 space separated floating point adjustment values in the [-1,1] range,
  10210. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10211. pixels of its range.
  10212. @subsection Examples
  10213. @itemize
  10214. @item
  10215. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10216. increase magenta by 27% in blue areas:
  10217. @example
  10218. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10219. @end example
  10220. @item
  10221. Use a Photoshop selective color preset:
  10222. @example
  10223. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10224. @end example
  10225. @end itemize
  10226. @anchor{separatefields}
  10227. @section separatefields
  10228. The @code{separatefields} takes a frame-based video input and splits
  10229. each frame into its components fields, producing a new half height clip
  10230. with twice the frame rate and twice the frame count.
  10231. This filter use field-dominance information in frame to decide which
  10232. of each pair of fields to place first in the output.
  10233. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10234. @section setdar, setsar
  10235. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10236. output video.
  10237. This is done by changing the specified Sample (aka Pixel) Aspect
  10238. Ratio, according to the following equation:
  10239. @example
  10240. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10241. @end example
  10242. Keep in mind that the @code{setdar} filter does not modify the pixel
  10243. dimensions of the video frame. Also, the display aspect ratio set by
  10244. this filter may be changed by later filters in the filterchain,
  10245. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10246. applied.
  10247. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10248. the filter output video.
  10249. Note that as a consequence of the application of this filter, the
  10250. output display aspect ratio will change according to the equation
  10251. above.
  10252. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10253. filter may be changed by later filters in the filterchain, e.g. if
  10254. another "setsar" or a "setdar" filter is applied.
  10255. It accepts the following parameters:
  10256. @table @option
  10257. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10258. Set the aspect ratio used by the filter.
  10259. The parameter can be a floating point number string, an expression, or
  10260. a string of the form @var{num}:@var{den}, where @var{num} and
  10261. @var{den} are the numerator and denominator of the aspect ratio. If
  10262. the parameter is not specified, it is assumed the value "0".
  10263. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10264. should be escaped.
  10265. @item max
  10266. Set the maximum integer value to use for expressing numerator and
  10267. denominator when reducing the expressed aspect ratio to a rational.
  10268. Default value is @code{100}.
  10269. @end table
  10270. The parameter @var{sar} is an expression containing
  10271. the following constants:
  10272. @table @option
  10273. @item E, PI, PHI
  10274. These are approximated values for the mathematical constants e
  10275. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10276. @item w, h
  10277. The input width and height.
  10278. @item a
  10279. These are the same as @var{w} / @var{h}.
  10280. @item sar
  10281. The input sample aspect ratio.
  10282. @item dar
  10283. The input display aspect ratio. It is the same as
  10284. (@var{w} / @var{h}) * @var{sar}.
  10285. @item hsub, vsub
  10286. Horizontal and vertical chroma subsample values. For example, for the
  10287. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10288. @end table
  10289. @subsection Examples
  10290. @itemize
  10291. @item
  10292. To change the display aspect ratio to 16:9, specify one of the following:
  10293. @example
  10294. setdar=dar=1.77777
  10295. setdar=dar=16/9
  10296. @end example
  10297. @item
  10298. To change the sample aspect ratio to 10:11, specify:
  10299. @example
  10300. setsar=sar=10/11
  10301. @end example
  10302. @item
  10303. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10304. 1000 in the aspect ratio reduction, use the command:
  10305. @example
  10306. setdar=ratio=16/9:max=1000
  10307. @end example
  10308. @end itemize
  10309. @anchor{setfield}
  10310. @section setfield
  10311. Force field for the output video frame.
  10312. The @code{setfield} filter marks the interlace type field for the
  10313. output frames. It does not change the input frame, but only sets the
  10314. corresponding property, which affects how the frame is treated by
  10315. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10316. The filter accepts the following options:
  10317. @table @option
  10318. @item mode
  10319. Available values are:
  10320. @table @samp
  10321. @item auto
  10322. Keep the same field property.
  10323. @item bff
  10324. Mark the frame as bottom-field-first.
  10325. @item tff
  10326. Mark the frame as top-field-first.
  10327. @item prog
  10328. Mark the frame as progressive.
  10329. @end table
  10330. @end table
  10331. @section showinfo
  10332. Show a line containing various information for each input video frame.
  10333. The input video is not modified.
  10334. The shown line contains a sequence of key/value pairs of the form
  10335. @var{key}:@var{value}.
  10336. The following values are shown in the output:
  10337. @table @option
  10338. @item n
  10339. The (sequential) number of the input frame, starting from 0.
  10340. @item pts
  10341. The Presentation TimeStamp of the input frame, expressed as a number of
  10342. time base units. The time base unit depends on the filter input pad.
  10343. @item pts_time
  10344. The Presentation TimeStamp of the input frame, expressed as a number of
  10345. seconds.
  10346. @item pos
  10347. The position of the frame in the input stream, or -1 if this information is
  10348. unavailable and/or meaningless (for example in case of synthetic video).
  10349. @item fmt
  10350. The pixel format name.
  10351. @item sar
  10352. The sample aspect ratio of the input frame, expressed in the form
  10353. @var{num}/@var{den}.
  10354. @item s
  10355. The size of the input frame. For the syntax of this option, check the
  10356. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10357. @item i
  10358. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10359. for bottom field first).
  10360. @item iskey
  10361. This is 1 if the frame is a key frame, 0 otherwise.
  10362. @item type
  10363. The picture type of the input frame ("I" for an I-frame, "P" for a
  10364. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10365. Also refer to the documentation of the @code{AVPictureType} enum and of
  10366. the @code{av_get_picture_type_char} function defined in
  10367. @file{libavutil/avutil.h}.
  10368. @item checksum
  10369. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10370. @item plane_checksum
  10371. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10372. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10373. @end table
  10374. @section showpalette
  10375. Displays the 256 colors palette of each frame. This filter is only relevant for
  10376. @var{pal8} pixel format frames.
  10377. It accepts the following option:
  10378. @table @option
  10379. @item s
  10380. Set the size of the box used to represent one palette color entry. Default is
  10381. @code{30} (for a @code{30x30} pixel box).
  10382. @end table
  10383. @section shuffleframes
  10384. Reorder and/or duplicate and/or drop video frames.
  10385. It accepts the following parameters:
  10386. @table @option
  10387. @item mapping
  10388. Set the destination indexes of input frames.
  10389. This is space or '|' separated list of indexes that maps input frames to output
  10390. frames. Number of indexes also sets maximal value that each index may have.
  10391. '-1' index have special meaning and that is to drop frame.
  10392. @end table
  10393. The first frame has the index 0. The default is to keep the input unchanged.
  10394. @subsection Examples
  10395. @itemize
  10396. @item
  10397. Swap second and third frame of every three frames of the input:
  10398. @example
  10399. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10400. @end example
  10401. @item
  10402. Swap 10th and 1st frame of every ten frames of the input:
  10403. @example
  10404. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10405. @end example
  10406. @end itemize
  10407. @section shuffleplanes
  10408. Reorder and/or duplicate video planes.
  10409. It accepts the following parameters:
  10410. @table @option
  10411. @item map0
  10412. The index of the input plane to be used as the first output plane.
  10413. @item map1
  10414. The index of the input plane to be used as the second output plane.
  10415. @item map2
  10416. The index of the input plane to be used as the third output plane.
  10417. @item map3
  10418. The index of the input plane to be used as the fourth output plane.
  10419. @end table
  10420. The first plane has the index 0. The default is to keep the input unchanged.
  10421. @subsection Examples
  10422. @itemize
  10423. @item
  10424. Swap the second and third planes of the input:
  10425. @example
  10426. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10427. @end example
  10428. @end itemize
  10429. @anchor{signalstats}
  10430. @section signalstats
  10431. Evaluate various visual metrics that assist in determining issues associated
  10432. with the digitization of analog video media.
  10433. By default the filter will log these metadata values:
  10434. @table @option
  10435. @item YMIN
  10436. Display the minimal Y value contained within the input frame. Expressed in
  10437. range of [0-255].
  10438. @item YLOW
  10439. Display the Y value at the 10% percentile within the input frame. Expressed in
  10440. range of [0-255].
  10441. @item YAVG
  10442. Display the average Y value within the input frame. Expressed in range of
  10443. [0-255].
  10444. @item YHIGH
  10445. Display the Y value at the 90% percentile within the input frame. Expressed in
  10446. range of [0-255].
  10447. @item YMAX
  10448. Display the maximum Y value contained within the input frame. Expressed in
  10449. range of [0-255].
  10450. @item UMIN
  10451. Display the minimal U value contained within the input frame. Expressed in
  10452. range of [0-255].
  10453. @item ULOW
  10454. Display the U value at the 10% percentile within the input frame. Expressed in
  10455. range of [0-255].
  10456. @item UAVG
  10457. Display the average U value within the input frame. Expressed in range of
  10458. [0-255].
  10459. @item UHIGH
  10460. Display the U value at the 90% percentile within the input frame. Expressed in
  10461. range of [0-255].
  10462. @item UMAX
  10463. Display the maximum U value contained within the input frame. Expressed in
  10464. range of [0-255].
  10465. @item VMIN
  10466. Display the minimal V value contained within the input frame. Expressed in
  10467. range of [0-255].
  10468. @item VLOW
  10469. Display the V value at the 10% percentile within the input frame. Expressed in
  10470. range of [0-255].
  10471. @item VAVG
  10472. Display the average V value within the input frame. Expressed in range of
  10473. [0-255].
  10474. @item VHIGH
  10475. Display the V value at the 90% percentile within the input frame. Expressed in
  10476. range of [0-255].
  10477. @item VMAX
  10478. Display the maximum V value contained within the input frame. Expressed in
  10479. range of [0-255].
  10480. @item SATMIN
  10481. Display the minimal saturation value contained within the input frame.
  10482. Expressed in range of [0-~181.02].
  10483. @item SATLOW
  10484. Display the saturation value at the 10% percentile within the input frame.
  10485. Expressed in range of [0-~181.02].
  10486. @item SATAVG
  10487. Display the average saturation value within the input frame. Expressed in range
  10488. of [0-~181.02].
  10489. @item SATHIGH
  10490. Display the saturation value at the 90% percentile within the input frame.
  10491. Expressed in range of [0-~181.02].
  10492. @item SATMAX
  10493. Display the maximum saturation value contained within the input frame.
  10494. Expressed in range of [0-~181.02].
  10495. @item HUEMED
  10496. Display the median value for hue within the input frame. Expressed in range of
  10497. [0-360].
  10498. @item HUEAVG
  10499. Display the average value for hue within the input frame. Expressed in range of
  10500. [0-360].
  10501. @item YDIF
  10502. Display the average of sample value difference between all values of the Y
  10503. plane in the current frame and corresponding values of the previous input frame.
  10504. Expressed in range of [0-255].
  10505. @item UDIF
  10506. Display the average of sample value difference between all values of the U
  10507. plane in the current frame and corresponding values of the previous input frame.
  10508. Expressed in range of [0-255].
  10509. @item VDIF
  10510. Display the average of sample value difference between all values of the V
  10511. plane in the current frame and corresponding values of the previous input frame.
  10512. Expressed in range of [0-255].
  10513. @item YBITDEPTH
  10514. Display bit depth of Y plane in current frame.
  10515. Expressed in range of [0-16].
  10516. @item UBITDEPTH
  10517. Display bit depth of U plane in current frame.
  10518. Expressed in range of [0-16].
  10519. @item VBITDEPTH
  10520. Display bit depth of V plane in current frame.
  10521. Expressed in range of [0-16].
  10522. @end table
  10523. The filter accepts the following options:
  10524. @table @option
  10525. @item stat
  10526. @item out
  10527. @option{stat} specify an additional form of image analysis.
  10528. @option{out} output video with the specified type of pixel highlighted.
  10529. Both options accept the following values:
  10530. @table @samp
  10531. @item tout
  10532. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10533. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10534. include the results of video dropouts, head clogs, or tape tracking issues.
  10535. @item vrep
  10536. Identify @var{vertical line repetition}. Vertical line repetition includes
  10537. similar rows of pixels within a frame. In born-digital video vertical line
  10538. repetition is common, but this pattern is uncommon in video digitized from an
  10539. analog source. When it occurs in video that results from the digitization of an
  10540. analog source it can indicate concealment from a dropout compensator.
  10541. @item brng
  10542. Identify pixels that fall outside of legal broadcast range.
  10543. @end table
  10544. @item color, c
  10545. Set the highlight color for the @option{out} option. The default color is
  10546. yellow.
  10547. @end table
  10548. @subsection Examples
  10549. @itemize
  10550. @item
  10551. Output data of various video metrics:
  10552. @example
  10553. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10554. @end example
  10555. @item
  10556. Output specific data about the minimum and maximum values of the Y plane per frame:
  10557. @example
  10558. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10559. @end example
  10560. @item
  10561. Playback video while highlighting pixels that are outside of broadcast range in red.
  10562. @example
  10563. ffplay example.mov -vf signalstats="out=brng:color=red"
  10564. @end example
  10565. @item
  10566. Playback video with signalstats metadata drawn over the frame.
  10567. @example
  10568. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10569. @end example
  10570. The contents of signalstat_drawtext.txt used in the command are:
  10571. @example
  10572. time %@{pts:hms@}
  10573. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10574. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10575. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10576. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10577. @end example
  10578. @end itemize
  10579. @anchor{signature}
  10580. @section signature
  10581. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10582. input. In this case the matching between the inputs can be calculated additionally.
  10583. The filter always passes through the first input. The signature of each stream can
  10584. be written into a file.
  10585. It accepts the following options:
  10586. @table @option
  10587. @item detectmode
  10588. Enable or disable the matching process.
  10589. Available values are:
  10590. @table @samp
  10591. @item off
  10592. Disable the calculation of a matching (default).
  10593. @item full
  10594. Calculate the matching for the whole video and output whether the whole video
  10595. matches or only parts.
  10596. @item fast
  10597. Calculate only until a matching is found or the video ends. Should be faster in
  10598. some cases.
  10599. @end table
  10600. @item nb_inputs
  10601. Set the number of inputs. The option value must be a non negative integer.
  10602. Default value is 1.
  10603. @item filename
  10604. Set the path to which the output is written. If there is more than one input,
  10605. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10606. integer), that will be replaced with the input number. If no filename is
  10607. specified, no output will be written. This is the default.
  10608. @item format
  10609. Choose the output format.
  10610. Available values are:
  10611. @table @samp
  10612. @item binary
  10613. Use the specified binary representation (default).
  10614. @item xml
  10615. Use the specified xml representation.
  10616. @end table
  10617. @item th_d
  10618. Set threshold to detect one word as similar. The option value must be an integer
  10619. greater than zero. The default value is 9000.
  10620. @item th_dc
  10621. Set threshold to detect all words as similar. The option value must be an integer
  10622. greater than zero. The default value is 60000.
  10623. @item th_xh
  10624. Set threshold to detect frames as similar. The option value must be an integer
  10625. greater than zero. The default value is 116.
  10626. @item th_di
  10627. Set the minimum length of a sequence in frames to recognize it as matching
  10628. sequence. The option value must be a non negative integer value.
  10629. The default value is 0.
  10630. @item th_it
  10631. Set the minimum relation, that matching frames to all frames must have.
  10632. The option value must be a double value between 0 and 1. The default value is 0.5.
  10633. @end table
  10634. @subsection Examples
  10635. @itemize
  10636. @item
  10637. To calculate the signature of an input video and store it in signature.bin:
  10638. @example
  10639. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10640. @end example
  10641. @item
  10642. To detect whether two videos match and store the signatures in XML format in
  10643. signature0.xml and signature1.xml:
  10644. @example
  10645. 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 -
  10646. @end example
  10647. @end itemize
  10648. @anchor{smartblur}
  10649. @section smartblur
  10650. Blur the input video without impacting the outlines.
  10651. It accepts the following options:
  10652. @table @option
  10653. @item luma_radius, lr
  10654. Set the luma radius. The option value must be a float number in
  10655. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10656. used to blur the image (slower if larger). Default value is 1.0.
  10657. @item luma_strength, ls
  10658. Set the luma strength. The option value must be a float number
  10659. in the range [-1.0,1.0] that configures the blurring. A value included
  10660. in [0.0,1.0] will blur the image whereas a value included in
  10661. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10662. @item luma_threshold, lt
  10663. Set the luma threshold used as a coefficient to determine
  10664. whether a pixel should be blurred or not. The option value must be an
  10665. integer in the range [-30,30]. A value of 0 will filter all the image,
  10666. a value included in [0,30] will filter flat areas and a value included
  10667. in [-30,0] will filter edges. Default value is 0.
  10668. @item chroma_radius, cr
  10669. Set the chroma radius. The option value must be a float number in
  10670. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10671. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10672. @item chroma_strength, cs
  10673. Set the chroma strength. The option value must be a float number
  10674. in the range [-1.0,1.0] that configures the blurring. A value included
  10675. in [0.0,1.0] will blur the image whereas a value included in
  10676. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10677. @item chroma_threshold, ct
  10678. Set the chroma threshold used as a coefficient to determine
  10679. whether a pixel should be blurred or not. The option value must be an
  10680. integer in the range [-30,30]. A value of 0 will filter all the image,
  10681. a value included in [0,30] will filter flat areas and a value included
  10682. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10683. @end table
  10684. If a chroma option is not explicitly set, the corresponding luma value
  10685. is set.
  10686. @section ssim
  10687. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10688. This filter takes in input two input videos, the first input is
  10689. considered the "main" source and is passed unchanged to the
  10690. output. The second input is used as a "reference" video for computing
  10691. the SSIM.
  10692. Both video inputs must have the same resolution and pixel format for
  10693. this filter to work correctly. Also it assumes that both inputs
  10694. have the same number of frames, which are compared one by one.
  10695. The filter stores the calculated SSIM of each frame.
  10696. The description of the accepted parameters follows.
  10697. @table @option
  10698. @item stats_file, f
  10699. If specified the filter will use the named file to save the SSIM of
  10700. each individual frame. When filename equals "-" the data is sent to
  10701. standard output.
  10702. @end table
  10703. The file printed if @var{stats_file} is selected, contains a sequence of
  10704. key/value pairs of the form @var{key}:@var{value} for each compared
  10705. couple of frames.
  10706. A description of each shown parameter follows:
  10707. @table @option
  10708. @item n
  10709. sequential number of the input frame, starting from 1
  10710. @item Y, U, V, R, G, B
  10711. SSIM of the compared frames for the component specified by the suffix.
  10712. @item All
  10713. SSIM of the compared frames for the whole frame.
  10714. @item dB
  10715. Same as above but in dB representation.
  10716. @end table
  10717. This filter also supports the @ref{framesync} options.
  10718. For example:
  10719. @example
  10720. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10721. [main][ref] ssim="stats_file=stats.log" [out]
  10722. @end example
  10723. On this example the input file being processed is compared with the
  10724. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10725. is stored in @file{stats.log}.
  10726. Another example with both psnr and ssim at same time:
  10727. @example
  10728. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10729. @end example
  10730. @section stereo3d
  10731. Convert between different stereoscopic image formats.
  10732. The filters accept the following options:
  10733. @table @option
  10734. @item in
  10735. Set stereoscopic image format of input.
  10736. Available values for input image formats are:
  10737. @table @samp
  10738. @item sbsl
  10739. side by side parallel (left eye left, right eye right)
  10740. @item sbsr
  10741. side by side crosseye (right eye left, left eye right)
  10742. @item sbs2l
  10743. side by side parallel with half width resolution
  10744. (left eye left, right eye right)
  10745. @item sbs2r
  10746. side by side crosseye with half width resolution
  10747. (right eye left, left eye right)
  10748. @item abl
  10749. above-below (left eye above, right eye below)
  10750. @item abr
  10751. above-below (right eye above, left eye below)
  10752. @item ab2l
  10753. above-below with half height resolution
  10754. (left eye above, right eye below)
  10755. @item ab2r
  10756. above-below with half height resolution
  10757. (right eye above, left eye below)
  10758. @item al
  10759. alternating frames (left eye first, right eye second)
  10760. @item ar
  10761. alternating frames (right eye first, left eye second)
  10762. @item irl
  10763. interleaved rows (left eye has top row, right eye starts on next row)
  10764. @item irr
  10765. interleaved rows (right eye has top row, left eye starts on next row)
  10766. @item icl
  10767. interleaved columns, left eye first
  10768. @item icr
  10769. interleaved columns, right eye first
  10770. Default value is @samp{sbsl}.
  10771. @end table
  10772. @item out
  10773. Set stereoscopic image format of output.
  10774. @table @samp
  10775. @item sbsl
  10776. side by side parallel (left eye left, right eye right)
  10777. @item sbsr
  10778. side by side crosseye (right eye left, left eye right)
  10779. @item sbs2l
  10780. side by side parallel with half width resolution
  10781. (left eye left, right eye right)
  10782. @item sbs2r
  10783. side by side crosseye with half width resolution
  10784. (right eye left, left eye right)
  10785. @item abl
  10786. above-below (left eye above, right eye below)
  10787. @item abr
  10788. above-below (right eye above, left eye below)
  10789. @item ab2l
  10790. above-below with half height resolution
  10791. (left eye above, right eye below)
  10792. @item ab2r
  10793. above-below with half height resolution
  10794. (right eye above, left eye below)
  10795. @item al
  10796. alternating frames (left eye first, right eye second)
  10797. @item ar
  10798. alternating frames (right eye first, left eye second)
  10799. @item irl
  10800. interleaved rows (left eye has top row, right eye starts on next row)
  10801. @item irr
  10802. interleaved rows (right eye has top row, left eye starts on next row)
  10803. @item arbg
  10804. anaglyph red/blue gray
  10805. (red filter on left eye, blue filter on right eye)
  10806. @item argg
  10807. anaglyph red/green gray
  10808. (red filter on left eye, green filter on right eye)
  10809. @item arcg
  10810. anaglyph red/cyan gray
  10811. (red filter on left eye, cyan filter on right eye)
  10812. @item arch
  10813. anaglyph red/cyan half colored
  10814. (red filter on left eye, cyan filter on right eye)
  10815. @item arcc
  10816. anaglyph red/cyan color
  10817. (red filter on left eye, cyan filter on right eye)
  10818. @item arcd
  10819. anaglyph red/cyan color optimized with the least squares projection of dubois
  10820. (red filter on left eye, cyan filter on right eye)
  10821. @item agmg
  10822. anaglyph green/magenta gray
  10823. (green filter on left eye, magenta filter on right eye)
  10824. @item agmh
  10825. anaglyph green/magenta half colored
  10826. (green filter on left eye, magenta filter on right eye)
  10827. @item agmc
  10828. anaglyph green/magenta colored
  10829. (green filter on left eye, magenta filter on right eye)
  10830. @item agmd
  10831. anaglyph green/magenta color optimized with the least squares projection of dubois
  10832. (green filter on left eye, magenta filter on right eye)
  10833. @item aybg
  10834. anaglyph yellow/blue gray
  10835. (yellow filter on left eye, blue filter on right eye)
  10836. @item aybh
  10837. anaglyph yellow/blue half colored
  10838. (yellow filter on left eye, blue filter on right eye)
  10839. @item aybc
  10840. anaglyph yellow/blue colored
  10841. (yellow filter on left eye, blue filter on right eye)
  10842. @item aybd
  10843. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10844. (yellow filter on left eye, blue filter on right eye)
  10845. @item ml
  10846. mono output (left eye only)
  10847. @item mr
  10848. mono output (right eye only)
  10849. @item chl
  10850. checkerboard, left eye first
  10851. @item chr
  10852. checkerboard, right eye first
  10853. @item icl
  10854. interleaved columns, left eye first
  10855. @item icr
  10856. interleaved columns, right eye first
  10857. @item hdmi
  10858. HDMI frame pack
  10859. @end table
  10860. Default value is @samp{arcd}.
  10861. @end table
  10862. @subsection Examples
  10863. @itemize
  10864. @item
  10865. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10866. @example
  10867. stereo3d=sbsl:aybd
  10868. @end example
  10869. @item
  10870. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10871. @example
  10872. stereo3d=abl:sbsr
  10873. @end example
  10874. @end itemize
  10875. @section streamselect, astreamselect
  10876. Select video or audio streams.
  10877. The filter accepts the following options:
  10878. @table @option
  10879. @item inputs
  10880. Set number of inputs. Default is 2.
  10881. @item map
  10882. Set input indexes to remap to outputs.
  10883. @end table
  10884. @subsection Commands
  10885. The @code{streamselect} and @code{astreamselect} filter supports the following
  10886. commands:
  10887. @table @option
  10888. @item map
  10889. Set input indexes to remap to outputs.
  10890. @end table
  10891. @subsection Examples
  10892. @itemize
  10893. @item
  10894. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10895. @example
  10896. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10897. @end example
  10898. @item
  10899. Same as above, but for audio:
  10900. @example
  10901. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10902. @end example
  10903. @end itemize
  10904. @section sobel
  10905. Apply sobel operator to input video stream.
  10906. The filter accepts the following option:
  10907. @table @option
  10908. @item planes
  10909. Set which planes will be processed, unprocessed planes will be copied.
  10910. By default value 0xf, all planes will be processed.
  10911. @item scale
  10912. Set value which will be multiplied with filtered result.
  10913. @item delta
  10914. Set value which will be added to filtered result.
  10915. @end table
  10916. @anchor{spp}
  10917. @section spp
  10918. Apply a simple postprocessing filter that compresses and decompresses the image
  10919. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10920. and average the results.
  10921. The filter accepts the following options:
  10922. @table @option
  10923. @item quality
  10924. Set quality. This option defines the number of levels for averaging. It accepts
  10925. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10926. effect. A value of @code{6} means the higher quality. For each increment of
  10927. that value the speed drops by a factor of approximately 2. Default value is
  10928. @code{3}.
  10929. @item qp
  10930. Force a constant quantization parameter. If not set, the filter will use the QP
  10931. from the video stream (if available).
  10932. @item mode
  10933. Set thresholding mode. Available modes are:
  10934. @table @samp
  10935. @item hard
  10936. Set hard thresholding (default).
  10937. @item soft
  10938. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10939. @end table
  10940. @item use_bframe_qp
  10941. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10942. option may cause flicker since the B-Frames have often larger QP. Default is
  10943. @code{0} (not enabled).
  10944. @end table
  10945. @anchor{subtitles}
  10946. @section subtitles
  10947. Draw subtitles on top of input video using the libass library.
  10948. To enable compilation of this filter you need to configure FFmpeg with
  10949. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10950. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10951. Alpha) subtitles format.
  10952. The filter accepts the following options:
  10953. @table @option
  10954. @item filename, f
  10955. Set the filename of the subtitle file to read. It must be specified.
  10956. @item original_size
  10957. Specify the size of the original video, the video for which the ASS file
  10958. was composed. For the syntax of this option, check the
  10959. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10960. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10961. correctly scale the fonts if the aspect ratio has been changed.
  10962. @item fontsdir
  10963. Set a directory path containing fonts that can be used by the filter.
  10964. These fonts will be used in addition to whatever the font provider uses.
  10965. @item alpha
  10966. Process alpha channel, by default alpha channel is untouched.
  10967. @item charenc
  10968. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10969. useful if not UTF-8.
  10970. @item stream_index, si
  10971. Set subtitles stream index. @code{subtitles} filter only.
  10972. @item force_style
  10973. Override default style or script info parameters of the subtitles. It accepts a
  10974. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10975. @end table
  10976. If the first key is not specified, it is assumed that the first value
  10977. specifies the @option{filename}.
  10978. For example, to render the file @file{sub.srt} on top of the input
  10979. video, use the command:
  10980. @example
  10981. subtitles=sub.srt
  10982. @end example
  10983. which is equivalent to:
  10984. @example
  10985. subtitles=filename=sub.srt
  10986. @end example
  10987. To render the default subtitles stream from file @file{video.mkv}, use:
  10988. @example
  10989. subtitles=video.mkv
  10990. @end example
  10991. To render the second subtitles stream from that file, use:
  10992. @example
  10993. subtitles=video.mkv:si=1
  10994. @end example
  10995. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10996. @code{DejaVu Serif}, use:
  10997. @example
  10998. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10999. @end example
  11000. @section super2xsai
  11001. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11002. Interpolate) pixel art scaling algorithm.
  11003. Useful for enlarging pixel art images without reducing sharpness.
  11004. @section swaprect
  11005. Swap two rectangular objects in video.
  11006. This filter accepts the following options:
  11007. @table @option
  11008. @item w
  11009. Set object width.
  11010. @item h
  11011. Set object height.
  11012. @item x1
  11013. Set 1st rect x coordinate.
  11014. @item y1
  11015. Set 1st rect y coordinate.
  11016. @item x2
  11017. Set 2nd rect x coordinate.
  11018. @item y2
  11019. Set 2nd rect y coordinate.
  11020. All expressions are evaluated once for each frame.
  11021. @end table
  11022. The all options are expressions containing the following constants:
  11023. @table @option
  11024. @item w
  11025. @item h
  11026. The input width and height.
  11027. @item a
  11028. same as @var{w} / @var{h}
  11029. @item sar
  11030. input sample aspect ratio
  11031. @item dar
  11032. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11033. @item n
  11034. The number of the input frame, starting from 0.
  11035. @item t
  11036. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11037. @item pos
  11038. the position in the file of the input frame, NAN if unknown
  11039. @end table
  11040. @section swapuv
  11041. Swap U & V plane.
  11042. @section telecine
  11043. Apply telecine process to the video.
  11044. This filter accepts the following options:
  11045. @table @option
  11046. @item first_field
  11047. @table @samp
  11048. @item top, t
  11049. top field first
  11050. @item bottom, b
  11051. bottom field first
  11052. The default value is @code{top}.
  11053. @end table
  11054. @item pattern
  11055. A string of numbers representing the pulldown pattern you wish to apply.
  11056. The default value is @code{23}.
  11057. @end table
  11058. @example
  11059. Some typical patterns:
  11060. NTSC output (30i):
  11061. 27.5p: 32222
  11062. 24p: 23 (classic)
  11063. 24p: 2332 (preferred)
  11064. 20p: 33
  11065. 18p: 334
  11066. 16p: 3444
  11067. PAL output (25i):
  11068. 27.5p: 12222
  11069. 24p: 222222222223 ("Euro pulldown")
  11070. 16.67p: 33
  11071. 16p: 33333334
  11072. @end example
  11073. @section threshold
  11074. Apply threshold effect to video stream.
  11075. This filter needs four video streams to perform thresholding.
  11076. First stream is stream we are filtering.
  11077. Second stream is holding threshold values, third stream is holding min values,
  11078. and last, fourth stream is holding max values.
  11079. The filter accepts the following option:
  11080. @table @option
  11081. @item planes
  11082. Set which planes will be processed, unprocessed planes will be copied.
  11083. By default value 0xf, all planes will be processed.
  11084. @end table
  11085. For example if first stream pixel's component value is less then threshold value
  11086. of pixel component from 2nd threshold stream, third stream value will picked,
  11087. otherwise fourth stream pixel component value will be picked.
  11088. Using color source filter one can perform various types of thresholding:
  11089. @subsection Examples
  11090. @itemize
  11091. @item
  11092. Binary threshold, using gray color as threshold:
  11093. @example
  11094. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11095. @end example
  11096. @item
  11097. Inverted binary threshold, using gray color as threshold:
  11098. @example
  11099. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11100. @end example
  11101. @item
  11102. Truncate binary threshold, using gray color as threshold:
  11103. @example
  11104. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11105. @end example
  11106. @item
  11107. Threshold to zero, using gray color as threshold:
  11108. @example
  11109. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11110. @end example
  11111. @item
  11112. Inverted threshold to zero, using gray color as threshold:
  11113. @example
  11114. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11115. @end example
  11116. @end itemize
  11117. @section thumbnail
  11118. Select the most representative frame in a given sequence of consecutive frames.
  11119. The filter accepts the following options:
  11120. @table @option
  11121. @item n
  11122. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11123. will pick one of them, and then handle the next batch of @var{n} frames until
  11124. the end. Default is @code{100}.
  11125. @end table
  11126. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11127. value will result in a higher memory usage, so a high value is not recommended.
  11128. @subsection Examples
  11129. @itemize
  11130. @item
  11131. Extract one picture each 50 frames:
  11132. @example
  11133. thumbnail=50
  11134. @end example
  11135. @item
  11136. Complete example of a thumbnail creation with @command{ffmpeg}:
  11137. @example
  11138. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11139. @end example
  11140. @end itemize
  11141. @section tile
  11142. Tile several successive frames together.
  11143. The filter accepts the following options:
  11144. @table @option
  11145. @item layout
  11146. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11147. this option, check the
  11148. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11149. @item nb_frames
  11150. Set the maximum number of frames to render in the given area. It must be less
  11151. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11152. the area will be used.
  11153. @item margin
  11154. Set the outer border margin in pixels.
  11155. @item padding
  11156. Set the inner border thickness (i.e. the number of pixels between frames). For
  11157. more advanced padding options (such as having different values for the edges),
  11158. refer to the pad video filter.
  11159. @item color
  11160. Specify the color of the unused area. For the syntax of this option, check the
  11161. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11162. is "black".
  11163. @item overlap
  11164. Set the number of frames to overlap when tiling several successive frames together.
  11165. The value must be between @code{0} and @var{nb_frames - 1}.
  11166. @end table
  11167. @subsection Examples
  11168. @itemize
  11169. @item
  11170. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11171. @example
  11172. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11173. @end example
  11174. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11175. duplicating each output frame to accommodate the originally detected frame
  11176. rate.
  11177. @item
  11178. Display @code{5} pictures in an area of @code{3x2} frames,
  11179. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11180. mixed flat and named options:
  11181. @example
  11182. tile=3x2:nb_frames=5:padding=7:margin=2
  11183. @end example
  11184. @end itemize
  11185. @section tinterlace
  11186. Perform various types of temporal field interlacing.
  11187. Frames are counted starting from 1, so the first input frame is
  11188. considered odd.
  11189. The filter accepts the following options:
  11190. @table @option
  11191. @item mode
  11192. Specify the mode of the interlacing. This option can also be specified
  11193. as a value alone. See below for a list of values for this option.
  11194. Available values are:
  11195. @table @samp
  11196. @item merge, 0
  11197. Move odd frames into the upper field, even into the lower field,
  11198. generating a double height frame at half frame rate.
  11199. @example
  11200. ------> time
  11201. Input:
  11202. Frame 1 Frame 2 Frame 3 Frame 4
  11203. 11111 22222 33333 44444
  11204. 11111 22222 33333 44444
  11205. 11111 22222 33333 44444
  11206. 11111 22222 33333 44444
  11207. Output:
  11208. 11111 33333
  11209. 22222 44444
  11210. 11111 33333
  11211. 22222 44444
  11212. 11111 33333
  11213. 22222 44444
  11214. 11111 33333
  11215. 22222 44444
  11216. @end example
  11217. @item drop_even, 1
  11218. Only output odd frames, even frames are dropped, generating a frame with
  11219. unchanged height at half frame rate.
  11220. @example
  11221. ------> time
  11222. Input:
  11223. Frame 1 Frame 2 Frame 3 Frame 4
  11224. 11111 22222 33333 44444
  11225. 11111 22222 33333 44444
  11226. 11111 22222 33333 44444
  11227. 11111 22222 33333 44444
  11228. Output:
  11229. 11111 33333
  11230. 11111 33333
  11231. 11111 33333
  11232. 11111 33333
  11233. @end example
  11234. @item drop_odd, 2
  11235. Only output even frames, odd frames are dropped, generating a frame with
  11236. unchanged height at half frame rate.
  11237. @example
  11238. ------> time
  11239. Input:
  11240. Frame 1 Frame 2 Frame 3 Frame 4
  11241. 11111 22222 33333 44444
  11242. 11111 22222 33333 44444
  11243. 11111 22222 33333 44444
  11244. 11111 22222 33333 44444
  11245. Output:
  11246. 22222 44444
  11247. 22222 44444
  11248. 22222 44444
  11249. 22222 44444
  11250. @end example
  11251. @item pad, 3
  11252. Expand each frame to full height, but pad alternate lines with black,
  11253. generating a frame with double height at the same input frame rate.
  11254. @example
  11255. ------> time
  11256. Input:
  11257. Frame 1 Frame 2 Frame 3 Frame 4
  11258. 11111 22222 33333 44444
  11259. 11111 22222 33333 44444
  11260. 11111 22222 33333 44444
  11261. 11111 22222 33333 44444
  11262. Output:
  11263. 11111 ..... 33333 .....
  11264. ..... 22222 ..... 44444
  11265. 11111 ..... 33333 .....
  11266. ..... 22222 ..... 44444
  11267. 11111 ..... 33333 .....
  11268. ..... 22222 ..... 44444
  11269. 11111 ..... 33333 .....
  11270. ..... 22222 ..... 44444
  11271. @end example
  11272. @item interleave_top, 4
  11273. Interleave the upper field from odd frames with the lower field from
  11274. even frames, generating a frame with unchanged height at half frame rate.
  11275. @example
  11276. ------> time
  11277. Input:
  11278. Frame 1 Frame 2 Frame 3 Frame 4
  11279. 11111<- 22222 33333<- 44444
  11280. 11111 22222<- 33333 44444<-
  11281. 11111<- 22222 33333<- 44444
  11282. 11111 22222<- 33333 44444<-
  11283. Output:
  11284. 11111 33333
  11285. 22222 44444
  11286. 11111 33333
  11287. 22222 44444
  11288. @end example
  11289. @item interleave_bottom, 5
  11290. Interleave the lower field from odd frames with the upper field from
  11291. even frames, generating a frame with unchanged height at half frame rate.
  11292. @example
  11293. ------> time
  11294. Input:
  11295. Frame 1 Frame 2 Frame 3 Frame 4
  11296. 11111 22222<- 33333 44444<-
  11297. 11111<- 22222 33333<- 44444
  11298. 11111 22222<- 33333 44444<-
  11299. 11111<- 22222 33333<- 44444
  11300. Output:
  11301. 22222 44444
  11302. 11111 33333
  11303. 22222 44444
  11304. 11111 33333
  11305. @end example
  11306. @item interlacex2, 6
  11307. Double frame rate with unchanged height. Frames are inserted each
  11308. containing the second temporal field from the previous input frame and
  11309. the first temporal field from the next input frame. This mode relies on
  11310. the top_field_first flag. Useful for interlaced video displays with no
  11311. field synchronisation.
  11312. @example
  11313. ------> time
  11314. Input:
  11315. Frame 1 Frame 2 Frame 3 Frame 4
  11316. 11111 22222 33333 44444
  11317. 11111 22222 33333 44444
  11318. 11111 22222 33333 44444
  11319. 11111 22222 33333 44444
  11320. Output:
  11321. 11111 22222 22222 33333 33333 44444 44444
  11322. 11111 11111 22222 22222 33333 33333 44444
  11323. 11111 22222 22222 33333 33333 44444 44444
  11324. 11111 11111 22222 22222 33333 33333 44444
  11325. @end example
  11326. @item mergex2, 7
  11327. Move odd frames into the upper field, even into the lower field,
  11328. generating a double height frame at same frame rate.
  11329. @example
  11330. ------> time
  11331. Input:
  11332. Frame 1 Frame 2 Frame 3 Frame 4
  11333. 11111 22222 33333 44444
  11334. 11111 22222 33333 44444
  11335. 11111 22222 33333 44444
  11336. 11111 22222 33333 44444
  11337. Output:
  11338. 11111 33333 33333 55555
  11339. 22222 22222 44444 44444
  11340. 11111 33333 33333 55555
  11341. 22222 22222 44444 44444
  11342. 11111 33333 33333 55555
  11343. 22222 22222 44444 44444
  11344. 11111 33333 33333 55555
  11345. 22222 22222 44444 44444
  11346. @end example
  11347. @end table
  11348. Numeric values are deprecated but are accepted for backward
  11349. compatibility reasons.
  11350. Default mode is @code{merge}.
  11351. @item flags
  11352. Specify flags influencing the filter process.
  11353. Available value for @var{flags} is:
  11354. @table @option
  11355. @item low_pass_filter, vlfp
  11356. Enable linear vertical low-pass filtering in the filter.
  11357. Vertical low-pass filtering is required when creating an interlaced
  11358. destination from a progressive source which contains high-frequency
  11359. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11360. patterning.
  11361. @item complex_filter, cvlfp
  11362. Enable complex vertical low-pass filtering.
  11363. This will slightly less reduce interlace 'twitter' and Moire
  11364. patterning but better retain detail and subjective sharpness impression.
  11365. @end table
  11366. Vertical low-pass filtering can only be enabled for @option{mode}
  11367. @var{interleave_top} and @var{interleave_bottom}.
  11368. @end table
  11369. @section tonemap
  11370. Tone map colors from different dynamic ranges.
  11371. This filter expects data in single precision floating point, as it needs to
  11372. operate on (and can output) out-of-range values. Another filter, such as
  11373. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11374. The tonemapping algorithms implemented only work on linear light, so input
  11375. data should be linearized beforehand (and possibly correctly tagged).
  11376. @example
  11377. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11378. @end example
  11379. @subsection Options
  11380. The filter accepts the following options.
  11381. @table @option
  11382. @item tonemap
  11383. Set the tone map algorithm to use.
  11384. Possible values are:
  11385. @table @var
  11386. @item none
  11387. Do not apply any tone map, only desaturate overbright pixels.
  11388. @item clip
  11389. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11390. in-range values, while distorting out-of-range values.
  11391. @item linear
  11392. Stretch the entire reference gamut to a linear multiple of the display.
  11393. @item gamma
  11394. Fit a logarithmic transfer between the tone curves.
  11395. @item reinhard
  11396. Preserve overall image brightness with a simple curve, using nonlinear
  11397. contrast, which results in flattening details and degrading color accuracy.
  11398. @item hable
  11399. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11400. of slightly darkening everything. Use it when detail preservation is more
  11401. important than color and brightness accuracy.
  11402. @item mobius
  11403. Smoothly map out-of-range values, while retaining contrast and colors for
  11404. in-range material as much as possible. Use it when color accuracy is more
  11405. important than detail preservation.
  11406. @end table
  11407. Default is none.
  11408. @item param
  11409. Tune the tone mapping algorithm.
  11410. This affects the following algorithms:
  11411. @table @var
  11412. @item none
  11413. Ignored.
  11414. @item linear
  11415. Specifies the scale factor to use while stretching.
  11416. Default to 1.0.
  11417. @item gamma
  11418. Specifies the exponent of the function.
  11419. Default to 1.8.
  11420. @item clip
  11421. Specify an extra linear coefficient to multiply into the signal before clipping.
  11422. Default to 1.0.
  11423. @item reinhard
  11424. Specify the local contrast coefficient at the display peak.
  11425. Default to 0.5, which means that in-gamut values will be about half as bright
  11426. as when clipping.
  11427. @item hable
  11428. Ignored.
  11429. @item mobius
  11430. Specify the transition point from linear to mobius transform. Every value
  11431. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11432. more accurate the result will be, at the cost of losing bright details.
  11433. Default to 0.3, which due to the steep initial slope still preserves in-range
  11434. colors fairly accurately.
  11435. @end table
  11436. @item desat
  11437. Apply desaturation for highlights that exceed this level of brightness. The
  11438. higher the parameter, the more color information will be preserved. This
  11439. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11440. (smoothly) turning into white instead. This makes images feel more natural,
  11441. at the cost of reducing information about out-of-range colors.
  11442. The default of 2.0 is somewhat conservative and will mostly just apply to
  11443. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11444. This option works only if the input frame has a supported color tag.
  11445. @item peak
  11446. Override signal/nominal/reference peak with this value. Useful when the
  11447. embedded peak information in display metadata is not reliable or when tone
  11448. mapping from a lower range to a higher range.
  11449. @end table
  11450. @section transpose
  11451. Transpose rows with columns in the input video and optionally flip it.
  11452. It accepts the following parameters:
  11453. @table @option
  11454. @item dir
  11455. Specify the transposition direction.
  11456. Can assume the following values:
  11457. @table @samp
  11458. @item 0, 4, cclock_flip
  11459. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11460. @example
  11461. L.R L.l
  11462. . . -> . .
  11463. l.r R.r
  11464. @end example
  11465. @item 1, 5, clock
  11466. Rotate by 90 degrees clockwise, that is:
  11467. @example
  11468. L.R l.L
  11469. . . -> . .
  11470. l.r r.R
  11471. @end example
  11472. @item 2, 6, cclock
  11473. Rotate by 90 degrees counterclockwise, that is:
  11474. @example
  11475. L.R R.r
  11476. . . -> . .
  11477. l.r L.l
  11478. @end example
  11479. @item 3, 7, clock_flip
  11480. Rotate by 90 degrees clockwise and vertically flip, that is:
  11481. @example
  11482. L.R r.R
  11483. . . -> . .
  11484. l.r l.L
  11485. @end example
  11486. @end table
  11487. For values between 4-7, the transposition is only done if the input
  11488. video geometry is portrait and not landscape. These values are
  11489. deprecated, the @code{passthrough} option should be used instead.
  11490. Numerical values are deprecated, and should be dropped in favor of
  11491. symbolic constants.
  11492. @item passthrough
  11493. Do not apply the transposition if the input geometry matches the one
  11494. specified by the specified value. It accepts the following values:
  11495. @table @samp
  11496. @item none
  11497. Always apply transposition.
  11498. @item portrait
  11499. Preserve portrait geometry (when @var{height} >= @var{width}).
  11500. @item landscape
  11501. Preserve landscape geometry (when @var{width} >= @var{height}).
  11502. @end table
  11503. Default value is @code{none}.
  11504. @end table
  11505. For example to rotate by 90 degrees clockwise and preserve portrait
  11506. layout:
  11507. @example
  11508. transpose=dir=1:passthrough=portrait
  11509. @end example
  11510. The command above can also be specified as:
  11511. @example
  11512. transpose=1:portrait
  11513. @end example
  11514. @section trim
  11515. Trim the input so that the output contains one continuous subpart of the input.
  11516. It accepts the following parameters:
  11517. @table @option
  11518. @item start
  11519. Specify the time of the start of the kept section, i.e. the frame with the
  11520. timestamp @var{start} will be the first frame in the output.
  11521. @item end
  11522. Specify the time of the first frame that will be dropped, i.e. the frame
  11523. immediately preceding the one with the timestamp @var{end} will be the last
  11524. frame in the output.
  11525. @item start_pts
  11526. This is the same as @var{start}, except this option sets the start timestamp
  11527. in timebase units instead of seconds.
  11528. @item end_pts
  11529. This is the same as @var{end}, except this option sets the end timestamp
  11530. in timebase units instead of seconds.
  11531. @item duration
  11532. The maximum duration of the output in seconds.
  11533. @item start_frame
  11534. The number of the first frame that should be passed to the output.
  11535. @item end_frame
  11536. The number of the first frame that should be dropped.
  11537. @end table
  11538. @option{start}, @option{end}, and @option{duration} are expressed as time
  11539. duration specifications; see
  11540. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11541. for the accepted syntax.
  11542. Note that the first two sets of the start/end options and the @option{duration}
  11543. option look at the frame timestamp, while the _frame variants simply count the
  11544. frames that pass through the filter. Also note that this filter does not modify
  11545. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11546. setpts filter after the trim filter.
  11547. If multiple start or end options are set, this filter tries to be greedy and
  11548. keep all the frames that match at least one of the specified constraints. To keep
  11549. only the part that matches all the constraints at once, chain multiple trim
  11550. filters.
  11551. The defaults are such that all the input is kept. So it is possible to set e.g.
  11552. just the end values to keep everything before the specified time.
  11553. Examples:
  11554. @itemize
  11555. @item
  11556. Drop everything except the second minute of input:
  11557. @example
  11558. ffmpeg -i INPUT -vf trim=60:120
  11559. @end example
  11560. @item
  11561. Keep only the first second:
  11562. @example
  11563. ffmpeg -i INPUT -vf trim=duration=1
  11564. @end example
  11565. @end itemize
  11566. @section unpremultiply
  11567. Apply alpha unpremultiply effect to input video stream using first plane
  11568. of second stream as alpha.
  11569. Both streams must have same dimensions and same pixel format.
  11570. The filter accepts the following option:
  11571. @table @option
  11572. @item planes
  11573. Set which planes will be processed, unprocessed planes will be copied.
  11574. By default value 0xf, all planes will be processed.
  11575. If the format has 1 or 2 components, then luma is bit 0.
  11576. If the format has 3 or 4 components:
  11577. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11578. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11579. If present, the alpha channel is always the last bit.
  11580. @item inplace
  11581. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11582. @end table
  11583. @anchor{unsharp}
  11584. @section unsharp
  11585. Sharpen or blur the input video.
  11586. It accepts the following parameters:
  11587. @table @option
  11588. @item luma_msize_x, lx
  11589. Set the luma matrix horizontal size. It must be an odd integer between
  11590. 3 and 23. The default value is 5.
  11591. @item luma_msize_y, ly
  11592. Set the luma matrix vertical size. It must be an odd integer between 3
  11593. and 23. The default value is 5.
  11594. @item luma_amount, la
  11595. Set the luma effect strength. It must be a floating point number, reasonable
  11596. values lay between -1.5 and 1.5.
  11597. Negative values will blur the input video, while positive values will
  11598. sharpen it, a value of zero will disable the effect.
  11599. Default value is 1.0.
  11600. @item chroma_msize_x, cx
  11601. Set the chroma matrix horizontal size. It must be an odd integer
  11602. between 3 and 23. The default value is 5.
  11603. @item chroma_msize_y, cy
  11604. Set the chroma matrix vertical size. It must be an odd integer
  11605. between 3 and 23. The default value is 5.
  11606. @item chroma_amount, ca
  11607. Set the chroma effect strength. It must be a floating point number, reasonable
  11608. values lay between -1.5 and 1.5.
  11609. Negative values will blur the input video, while positive values will
  11610. sharpen it, a value of zero will disable the effect.
  11611. Default value is 0.0.
  11612. @end table
  11613. All parameters are optional and default to the equivalent of the
  11614. string '5:5:1.0:5:5:0.0'.
  11615. @subsection Examples
  11616. @itemize
  11617. @item
  11618. Apply strong luma sharpen effect:
  11619. @example
  11620. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11621. @end example
  11622. @item
  11623. Apply a strong blur of both luma and chroma parameters:
  11624. @example
  11625. unsharp=7:7:-2:7:7:-2
  11626. @end example
  11627. @end itemize
  11628. @section uspp
  11629. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11630. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11631. shifts and average the results.
  11632. The way this differs from the behavior of spp is that uspp actually encodes &
  11633. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11634. DCT similar to MJPEG.
  11635. The filter accepts the following options:
  11636. @table @option
  11637. @item quality
  11638. Set quality. This option defines the number of levels for averaging. It accepts
  11639. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11640. effect. A value of @code{8} means the higher quality. For each increment of
  11641. that value the speed drops by a factor of approximately 2. Default value is
  11642. @code{3}.
  11643. @item qp
  11644. Force a constant quantization parameter. If not set, the filter will use the QP
  11645. from the video stream (if available).
  11646. @end table
  11647. @section vaguedenoiser
  11648. Apply a wavelet based denoiser.
  11649. It transforms each frame from the video input into the wavelet domain,
  11650. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11651. the obtained coefficients. It does an inverse wavelet transform after.
  11652. Due to wavelet properties, it should give a nice smoothed result, and
  11653. reduced noise, without blurring picture features.
  11654. This filter accepts the following options:
  11655. @table @option
  11656. @item threshold
  11657. The filtering strength. The higher, the more filtered the video will be.
  11658. Hard thresholding can use a higher threshold than soft thresholding
  11659. before the video looks overfiltered. Default value is 2.
  11660. @item method
  11661. The filtering method the filter will use.
  11662. It accepts the following values:
  11663. @table @samp
  11664. @item hard
  11665. All values under the threshold will be zeroed.
  11666. @item soft
  11667. All values under the threshold will be zeroed. All values above will be
  11668. reduced by the threshold.
  11669. @item garrote
  11670. Scales or nullifies coefficients - intermediary between (more) soft and
  11671. (less) hard thresholding.
  11672. @end table
  11673. Default is garrote.
  11674. @item nsteps
  11675. Number of times, the wavelet will decompose the picture. Picture can't
  11676. be decomposed beyond a particular point (typically, 8 for a 640x480
  11677. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11678. @item percent
  11679. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11680. @item planes
  11681. A list of the planes to process. By default all planes are processed.
  11682. @end table
  11683. @section vectorscope
  11684. Display 2 color component values in the two dimensional graph (which is called
  11685. a vectorscope).
  11686. This filter accepts the following options:
  11687. @table @option
  11688. @item mode, m
  11689. Set vectorscope mode.
  11690. It accepts the following values:
  11691. @table @samp
  11692. @item gray
  11693. Gray values are displayed on graph, higher brightness means more pixels have
  11694. same component color value on location in graph. This is the default mode.
  11695. @item color
  11696. Gray values are displayed on graph. Surrounding pixels values which are not
  11697. present in video frame are drawn in gradient of 2 color components which are
  11698. set by option @code{x} and @code{y}. The 3rd color component is static.
  11699. @item color2
  11700. Actual color components values present in video frame are displayed on graph.
  11701. @item color3
  11702. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11703. on graph increases value of another color component, which is luminance by
  11704. default values of @code{x} and @code{y}.
  11705. @item color4
  11706. Actual colors present in video frame are displayed on graph. If two different
  11707. colors map to same position on graph then color with higher value of component
  11708. not present in graph is picked.
  11709. @item color5
  11710. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11711. component picked from radial gradient.
  11712. @end table
  11713. @item x
  11714. Set which color component will be represented on X-axis. Default is @code{1}.
  11715. @item y
  11716. Set which color component will be represented on Y-axis. Default is @code{2}.
  11717. @item intensity, i
  11718. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11719. of color component which represents frequency of (X, Y) location in graph.
  11720. @item envelope, e
  11721. @table @samp
  11722. @item none
  11723. No envelope, this is default.
  11724. @item instant
  11725. Instant envelope, even darkest single pixel will be clearly highlighted.
  11726. @item peak
  11727. Hold maximum and minimum values presented in graph over time. This way you
  11728. can still spot out of range values without constantly looking at vectorscope.
  11729. @item peak+instant
  11730. Peak and instant envelope combined together.
  11731. @end table
  11732. @item graticule, g
  11733. Set what kind of graticule to draw.
  11734. @table @samp
  11735. @item none
  11736. @item green
  11737. @item color
  11738. @end table
  11739. @item opacity, o
  11740. Set graticule opacity.
  11741. @item flags, f
  11742. Set graticule flags.
  11743. @table @samp
  11744. @item white
  11745. Draw graticule for white point.
  11746. @item black
  11747. Draw graticule for black point.
  11748. @item name
  11749. Draw color points short names.
  11750. @end table
  11751. @item bgopacity, b
  11752. Set background opacity.
  11753. @item lthreshold, l
  11754. Set low threshold for color component not represented on X or Y axis.
  11755. Values lower than this value will be ignored. Default is 0.
  11756. Note this value is multiplied with actual max possible value one pixel component
  11757. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11758. is 0.1 * 255 = 25.
  11759. @item hthreshold, h
  11760. Set high threshold for color component not represented on X or Y axis.
  11761. Values higher than this value will be ignored. Default is 1.
  11762. Note this value is multiplied with actual max possible value one pixel component
  11763. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11764. is 0.9 * 255 = 230.
  11765. @item colorspace, c
  11766. Set what kind of colorspace to use when drawing graticule.
  11767. @table @samp
  11768. @item auto
  11769. @item 601
  11770. @item 709
  11771. @end table
  11772. Default is auto.
  11773. @end table
  11774. @anchor{vidstabdetect}
  11775. @section vidstabdetect
  11776. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11777. @ref{vidstabtransform} for pass 2.
  11778. This filter generates a file with relative translation and rotation
  11779. transform information about subsequent frames, which is then used by
  11780. the @ref{vidstabtransform} filter.
  11781. To enable compilation of this filter you need to configure FFmpeg with
  11782. @code{--enable-libvidstab}.
  11783. This filter accepts the following options:
  11784. @table @option
  11785. @item result
  11786. Set the path to the file used to write the transforms information.
  11787. Default value is @file{transforms.trf}.
  11788. @item shakiness
  11789. Set how shaky the video is and how quick the camera is. It accepts an
  11790. integer in the range 1-10, a value of 1 means little shakiness, a
  11791. value of 10 means strong shakiness. Default value is 5.
  11792. @item accuracy
  11793. Set the accuracy of the detection process. It must be a value in the
  11794. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11795. accuracy. Default value is 15.
  11796. @item stepsize
  11797. Set stepsize of the search process. The region around minimum is
  11798. scanned with 1 pixel resolution. Default value is 6.
  11799. @item mincontrast
  11800. Set minimum contrast. Below this value a local measurement field is
  11801. discarded. Must be a floating point value in the range 0-1. Default
  11802. value is 0.3.
  11803. @item tripod
  11804. Set reference frame number for tripod mode.
  11805. If enabled, the motion of the frames is compared to a reference frame
  11806. in the filtered stream, identified by the specified number. The idea
  11807. is to compensate all movements in a more-or-less static scene and keep
  11808. the camera view absolutely still.
  11809. If set to 0, it is disabled. The frames are counted starting from 1.
  11810. @item show
  11811. Show fields and transforms in the resulting frames. It accepts an
  11812. integer in the range 0-2. Default value is 0, which disables any
  11813. visualization.
  11814. @end table
  11815. @subsection Examples
  11816. @itemize
  11817. @item
  11818. Use default values:
  11819. @example
  11820. vidstabdetect
  11821. @end example
  11822. @item
  11823. Analyze strongly shaky movie and put the results in file
  11824. @file{mytransforms.trf}:
  11825. @example
  11826. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11827. @end example
  11828. @item
  11829. Visualize the result of internal transformations in the resulting
  11830. video:
  11831. @example
  11832. vidstabdetect=show=1
  11833. @end example
  11834. @item
  11835. Analyze a video with medium shakiness using @command{ffmpeg}:
  11836. @example
  11837. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11838. @end example
  11839. @end itemize
  11840. @anchor{vidstabtransform}
  11841. @section vidstabtransform
  11842. Video stabilization/deshaking: pass 2 of 2,
  11843. see @ref{vidstabdetect} for pass 1.
  11844. Read a file with transform information for each frame and
  11845. apply/compensate them. Together with the @ref{vidstabdetect}
  11846. filter this can be used to deshake videos. See also
  11847. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11848. the @ref{unsharp} filter, see below.
  11849. To enable compilation of this filter you need to configure FFmpeg with
  11850. @code{--enable-libvidstab}.
  11851. @subsection Options
  11852. @table @option
  11853. @item input
  11854. Set path to the file used to read the transforms. Default value is
  11855. @file{transforms.trf}.
  11856. @item smoothing
  11857. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11858. camera movements. Default value is 10.
  11859. For example a number of 10 means that 21 frames are used (10 in the
  11860. past and 10 in the future) to smoothen the motion in the video. A
  11861. larger value leads to a smoother video, but limits the acceleration of
  11862. the camera (pan/tilt movements). 0 is a special case where a static
  11863. camera is simulated.
  11864. @item optalgo
  11865. Set the camera path optimization algorithm.
  11866. Accepted values are:
  11867. @table @samp
  11868. @item gauss
  11869. gaussian kernel low-pass filter on camera motion (default)
  11870. @item avg
  11871. averaging on transformations
  11872. @end table
  11873. @item maxshift
  11874. Set maximal number of pixels to translate frames. Default value is -1,
  11875. meaning no limit.
  11876. @item maxangle
  11877. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11878. value is -1, meaning no limit.
  11879. @item crop
  11880. Specify how to deal with borders that may be visible due to movement
  11881. compensation.
  11882. Available values are:
  11883. @table @samp
  11884. @item keep
  11885. keep image information from previous frame (default)
  11886. @item black
  11887. fill the border black
  11888. @end table
  11889. @item invert
  11890. Invert transforms if set to 1. Default value is 0.
  11891. @item relative
  11892. Consider transforms as relative to previous frame if set to 1,
  11893. absolute if set to 0. Default value is 0.
  11894. @item zoom
  11895. Set percentage to zoom. A positive value will result in a zoom-in
  11896. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11897. zoom).
  11898. @item optzoom
  11899. Set optimal zooming to avoid borders.
  11900. Accepted values are:
  11901. @table @samp
  11902. @item 0
  11903. disabled
  11904. @item 1
  11905. optimal static zoom value is determined (only very strong movements
  11906. will lead to visible borders) (default)
  11907. @item 2
  11908. optimal adaptive zoom value is determined (no borders will be
  11909. visible), see @option{zoomspeed}
  11910. @end table
  11911. Note that the value given at zoom is added to the one calculated here.
  11912. @item zoomspeed
  11913. Set percent to zoom maximally each frame (enabled when
  11914. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11915. 0.25.
  11916. @item interpol
  11917. Specify type of interpolation.
  11918. Available values are:
  11919. @table @samp
  11920. @item no
  11921. no interpolation
  11922. @item linear
  11923. linear only horizontal
  11924. @item bilinear
  11925. linear in both directions (default)
  11926. @item bicubic
  11927. cubic in both directions (slow)
  11928. @end table
  11929. @item tripod
  11930. Enable virtual tripod mode if set to 1, which is equivalent to
  11931. @code{relative=0:smoothing=0}. Default value is 0.
  11932. Use also @code{tripod} option of @ref{vidstabdetect}.
  11933. @item debug
  11934. Increase log verbosity if set to 1. Also the detected global motions
  11935. are written to the temporary file @file{global_motions.trf}. Default
  11936. value is 0.
  11937. @end table
  11938. @subsection Examples
  11939. @itemize
  11940. @item
  11941. Use @command{ffmpeg} for a typical stabilization with default values:
  11942. @example
  11943. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11944. @end example
  11945. Note the use of the @ref{unsharp} filter which is always recommended.
  11946. @item
  11947. Zoom in a bit more and load transform data from a given file:
  11948. @example
  11949. vidstabtransform=zoom=5:input="mytransforms.trf"
  11950. @end example
  11951. @item
  11952. Smoothen the video even more:
  11953. @example
  11954. vidstabtransform=smoothing=30
  11955. @end example
  11956. @end itemize
  11957. @section vflip
  11958. Flip the input video vertically.
  11959. For example, to vertically flip a video with @command{ffmpeg}:
  11960. @example
  11961. ffmpeg -i in.avi -vf "vflip" out.avi
  11962. @end example
  11963. @anchor{vignette}
  11964. @section vignette
  11965. Make or reverse a natural vignetting effect.
  11966. The filter accepts the following options:
  11967. @table @option
  11968. @item angle, a
  11969. Set lens angle expression as a number of radians.
  11970. The value is clipped in the @code{[0,PI/2]} range.
  11971. Default value: @code{"PI/5"}
  11972. @item x0
  11973. @item y0
  11974. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11975. by default.
  11976. @item mode
  11977. Set forward/backward mode.
  11978. Available modes are:
  11979. @table @samp
  11980. @item forward
  11981. The larger the distance from the central point, the darker the image becomes.
  11982. @item backward
  11983. The larger the distance from the central point, the brighter the image becomes.
  11984. This can be used to reverse a vignette effect, though there is no automatic
  11985. detection to extract the lens @option{angle} and other settings (yet). It can
  11986. also be used to create a burning effect.
  11987. @end table
  11988. Default value is @samp{forward}.
  11989. @item eval
  11990. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11991. It accepts the following values:
  11992. @table @samp
  11993. @item init
  11994. Evaluate expressions only once during the filter initialization.
  11995. @item frame
  11996. Evaluate expressions for each incoming frame. This is way slower than the
  11997. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11998. allows advanced dynamic expressions.
  11999. @end table
  12000. Default value is @samp{init}.
  12001. @item dither
  12002. Set dithering to reduce the circular banding effects. Default is @code{1}
  12003. (enabled).
  12004. @item aspect
  12005. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12006. Setting this value to the SAR of the input will make a rectangular vignetting
  12007. following the dimensions of the video.
  12008. Default is @code{1/1}.
  12009. @end table
  12010. @subsection Expressions
  12011. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12012. following parameters.
  12013. @table @option
  12014. @item w
  12015. @item h
  12016. input width and height
  12017. @item n
  12018. the number of input frame, starting from 0
  12019. @item pts
  12020. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12021. @var{TB} units, NAN if undefined
  12022. @item r
  12023. frame rate of the input video, NAN if the input frame rate is unknown
  12024. @item t
  12025. the PTS (Presentation TimeStamp) of the filtered video frame,
  12026. expressed in seconds, NAN if undefined
  12027. @item tb
  12028. time base of the input video
  12029. @end table
  12030. @subsection Examples
  12031. @itemize
  12032. @item
  12033. Apply simple strong vignetting effect:
  12034. @example
  12035. vignette=PI/4
  12036. @end example
  12037. @item
  12038. Make a flickering vignetting:
  12039. @example
  12040. vignette='PI/4+random(1)*PI/50':eval=frame
  12041. @end example
  12042. @end itemize
  12043. @section vmafmotion
  12044. Obtain the average vmaf motion score of a video.
  12045. It is one of the component filters of VMAF.
  12046. The obtained average motion score is printed through the logging system.
  12047. In the below example the input file @file{ref.mpg} is being processed and score
  12048. is computed.
  12049. @example
  12050. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12051. @end example
  12052. @section vstack
  12053. Stack input videos vertically.
  12054. All streams must be of same pixel format and of same width.
  12055. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12056. to create same output.
  12057. The filter accept the following option:
  12058. @table @option
  12059. @item inputs
  12060. Set number of input streams. Default is 2.
  12061. @item shortest
  12062. If set to 1, force the output to terminate when the shortest input
  12063. terminates. Default value is 0.
  12064. @end table
  12065. @section w3fdif
  12066. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12067. Deinterlacing Filter").
  12068. Based on the process described by Martin Weston for BBC R&D, and
  12069. implemented based on the de-interlace algorithm written by Jim
  12070. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12071. uses filter coefficients calculated by BBC R&D.
  12072. There are two sets of filter coefficients, so called "simple":
  12073. and "complex". Which set of filter coefficients is used can
  12074. be set by passing an optional parameter:
  12075. @table @option
  12076. @item filter
  12077. Set the interlacing filter coefficients. Accepts one of the following values:
  12078. @table @samp
  12079. @item simple
  12080. Simple filter coefficient set.
  12081. @item complex
  12082. More-complex filter coefficient set.
  12083. @end table
  12084. Default value is @samp{complex}.
  12085. @item deint
  12086. Specify which frames to deinterlace. Accept one of the following values:
  12087. @table @samp
  12088. @item all
  12089. Deinterlace all frames,
  12090. @item interlaced
  12091. Only deinterlace frames marked as interlaced.
  12092. @end table
  12093. Default value is @samp{all}.
  12094. @end table
  12095. @section waveform
  12096. Video waveform monitor.
  12097. The waveform monitor plots color component intensity. By default luminance
  12098. only. Each column of the waveform corresponds to a column of pixels in the
  12099. source video.
  12100. It accepts the following options:
  12101. @table @option
  12102. @item mode, m
  12103. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12104. In row mode, the graph on the left side represents color component value 0 and
  12105. the right side represents value = 255. In column mode, the top side represents
  12106. color component value = 0 and bottom side represents value = 255.
  12107. @item intensity, i
  12108. Set intensity. Smaller values are useful to find out how many values of the same
  12109. luminance are distributed across input rows/columns.
  12110. Default value is @code{0.04}. Allowed range is [0, 1].
  12111. @item mirror, r
  12112. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12113. In mirrored mode, higher values will be represented on the left
  12114. side for @code{row} mode and at the top for @code{column} mode. Default is
  12115. @code{1} (mirrored).
  12116. @item display, d
  12117. Set display mode.
  12118. It accepts the following values:
  12119. @table @samp
  12120. @item overlay
  12121. Presents information identical to that in the @code{parade}, except
  12122. that the graphs representing color components are superimposed directly
  12123. over one another.
  12124. This display mode makes it easier to spot relative differences or similarities
  12125. in overlapping areas of the color components that are supposed to be identical,
  12126. such as neutral whites, grays, or blacks.
  12127. @item stack
  12128. Display separate graph for the color components side by side in
  12129. @code{row} mode or one below the other in @code{column} mode.
  12130. @item parade
  12131. Display separate graph for the color components side by side in
  12132. @code{column} mode or one below the other in @code{row} mode.
  12133. Using this display mode makes it easy to spot color casts in the highlights
  12134. and shadows of an image, by comparing the contours of the top and the bottom
  12135. graphs of each waveform. Since whites, grays, and blacks are characterized
  12136. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12137. should display three waveforms of roughly equal width/height. If not, the
  12138. correction is easy to perform by making level adjustments the three waveforms.
  12139. @end table
  12140. Default is @code{stack}.
  12141. @item components, c
  12142. Set which color components to display. Default is 1, which means only luminance
  12143. or red color component if input is in RGB colorspace. If is set for example to
  12144. 7 it will display all 3 (if) available color components.
  12145. @item envelope, e
  12146. @table @samp
  12147. @item none
  12148. No envelope, this is default.
  12149. @item instant
  12150. Instant envelope, minimum and maximum values presented in graph will be easily
  12151. visible even with small @code{step} value.
  12152. @item peak
  12153. Hold minimum and maximum values presented in graph across time. This way you
  12154. can still spot out of range values without constantly looking at waveforms.
  12155. @item peak+instant
  12156. Peak and instant envelope combined together.
  12157. @end table
  12158. @item filter, f
  12159. @table @samp
  12160. @item lowpass
  12161. No filtering, this is default.
  12162. @item flat
  12163. Luma and chroma combined together.
  12164. @item aflat
  12165. Similar as above, but shows difference between blue and red chroma.
  12166. @item chroma
  12167. Displays only chroma.
  12168. @item color
  12169. Displays actual color value on waveform.
  12170. @item acolor
  12171. Similar as above, but with luma showing frequency of chroma values.
  12172. @end table
  12173. @item graticule, g
  12174. Set which graticule to display.
  12175. @table @samp
  12176. @item none
  12177. Do not display graticule.
  12178. @item green
  12179. Display green graticule showing legal broadcast ranges.
  12180. @end table
  12181. @item opacity, o
  12182. Set graticule opacity.
  12183. @item flags, fl
  12184. Set graticule flags.
  12185. @table @samp
  12186. @item numbers
  12187. Draw numbers above lines. By default enabled.
  12188. @item dots
  12189. Draw dots instead of lines.
  12190. @end table
  12191. @item scale, s
  12192. Set scale used for displaying graticule.
  12193. @table @samp
  12194. @item digital
  12195. @item millivolts
  12196. @item ire
  12197. @end table
  12198. Default is digital.
  12199. @item bgopacity, b
  12200. Set background opacity.
  12201. @end table
  12202. @section weave, doubleweave
  12203. The @code{weave} takes a field-based video input and join
  12204. each two sequential fields into single frame, producing a new double
  12205. height clip with half the frame rate and half the frame count.
  12206. The @code{doubleweave} works same as @code{weave} but without
  12207. halving frame rate and frame count.
  12208. It accepts the following option:
  12209. @table @option
  12210. @item first_field
  12211. Set first field. Available values are:
  12212. @table @samp
  12213. @item top, t
  12214. Set the frame as top-field-first.
  12215. @item bottom, b
  12216. Set the frame as bottom-field-first.
  12217. @end table
  12218. @end table
  12219. @subsection Examples
  12220. @itemize
  12221. @item
  12222. Interlace video using @ref{select} and @ref{separatefields} filter:
  12223. @example
  12224. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12225. @end example
  12226. @end itemize
  12227. @section xbr
  12228. Apply the xBR high-quality magnification filter which is designed for pixel
  12229. art. It follows a set of edge-detection rules, see
  12230. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12231. It accepts the following option:
  12232. @table @option
  12233. @item n
  12234. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12235. @code{3xBR} and @code{4} for @code{4xBR}.
  12236. Default is @code{3}.
  12237. @end table
  12238. @anchor{yadif}
  12239. @section yadif
  12240. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12241. filter").
  12242. It accepts the following parameters:
  12243. @table @option
  12244. @item mode
  12245. The interlacing mode to adopt. It accepts one of the following values:
  12246. @table @option
  12247. @item 0, send_frame
  12248. Output one frame for each frame.
  12249. @item 1, send_field
  12250. Output one frame for each field.
  12251. @item 2, send_frame_nospatial
  12252. Like @code{send_frame}, but it skips the spatial interlacing check.
  12253. @item 3, send_field_nospatial
  12254. Like @code{send_field}, but it skips the spatial interlacing check.
  12255. @end table
  12256. The default value is @code{send_frame}.
  12257. @item parity
  12258. The picture field parity assumed for the input interlaced video. It accepts one
  12259. of the following values:
  12260. @table @option
  12261. @item 0, tff
  12262. Assume the top field is first.
  12263. @item 1, bff
  12264. Assume the bottom field is first.
  12265. @item -1, auto
  12266. Enable automatic detection of field parity.
  12267. @end table
  12268. The default value is @code{auto}.
  12269. If the interlacing is unknown or the decoder does not export this information,
  12270. top field first will be assumed.
  12271. @item deint
  12272. Specify which frames to deinterlace. Accept one of the following
  12273. values:
  12274. @table @option
  12275. @item 0, all
  12276. Deinterlace all frames.
  12277. @item 1, interlaced
  12278. Only deinterlace frames marked as interlaced.
  12279. @end table
  12280. The default value is @code{all}.
  12281. @end table
  12282. @section zoompan
  12283. Apply Zoom & Pan effect.
  12284. This filter accepts the following options:
  12285. @table @option
  12286. @item zoom, z
  12287. Set the zoom expression. Default is 1.
  12288. @item x
  12289. @item y
  12290. Set the x and y expression. Default is 0.
  12291. @item d
  12292. Set the duration expression in number of frames.
  12293. This sets for how many number of frames effect will last for
  12294. single input image.
  12295. @item s
  12296. Set the output image size, default is 'hd720'.
  12297. @item fps
  12298. Set the output frame rate, default is '25'.
  12299. @end table
  12300. Each expression can contain the following constants:
  12301. @table @option
  12302. @item in_w, iw
  12303. Input width.
  12304. @item in_h, ih
  12305. Input height.
  12306. @item out_w, ow
  12307. Output width.
  12308. @item out_h, oh
  12309. Output height.
  12310. @item in
  12311. Input frame count.
  12312. @item on
  12313. Output frame count.
  12314. @item x
  12315. @item y
  12316. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12317. for current input frame.
  12318. @item px
  12319. @item py
  12320. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12321. not yet such frame (first input frame).
  12322. @item zoom
  12323. Last calculated zoom from 'z' expression for current input frame.
  12324. @item pzoom
  12325. Last calculated zoom of last output frame of previous input frame.
  12326. @item duration
  12327. Number of output frames for current input frame. Calculated from 'd' expression
  12328. for each input frame.
  12329. @item pduration
  12330. number of output frames created for previous input frame
  12331. @item a
  12332. Rational number: input width / input height
  12333. @item sar
  12334. sample aspect ratio
  12335. @item dar
  12336. display aspect ratio
  12337. @end table
  12338. @subsection Examples
  12339. @itemize
  12340. @item
  12341. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12342. @example
  12343. 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
  12344. @end example
  12345. @item
  12346. Zoom-in up to 1.5 and pan always at center of picture:
  12347. @example
  12348. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12349. @end example
  12350. @item
  12351. Same as above but without pausing:
  12352. @example
  12353. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12354. @end example
  12355. @end itemize
  12356. @anchor{zscale}
  12357. @section zscale
  12358. Scale (resize) the input video, using the z.lib library:
  12359. https://github.com/sekrit-twc/zimg.
  12360. The zscale filter forces the output display aspect ratio to be the same
  12361. as the input, by changing the output sample aspect ratio.
  12362. If the input image format is different from the format requested by
  12363. the next filter, the zscale filter will convert the input to the
  12364. requested format.
  12365. @subsection Options
  12366. The filter accepts the following options.
  12367. @table @option
  12368. @item width, w
  12369. @item height, h
  12370. Set the output video dimension expression. Default value is the input
  12371. dimension.
  12372. If the @var{width} or @var{w} value is 0, the input width is used for
  12373. the output. If the @var{height} or @var{h} value is 0, the input height
  12374. is used for the output.
  12375. If one and only one of the values is -n with n >= 1, the zscale filter
  12376. will use a value that maintains the aspect ratio of the input image,
  12377. calculated from the other specified dimension. After that it will,
  12378. however, make sure that the calculated dimension is divisible by n and
  12379. adjust the value if necessary.
  12380. If both values are -n with n >= 1, the behavior will be identical to
  12381. both values being set to 0 as previously detailed.
  12382. See below for the list of accepted constants for use in the dimension
  12383. expression.
  12384. @item size, s
  12385. Set the video size. For the syntax of this option, check the
  12386. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12387. @item dither, d
  12388. Set the dither type.
  12389. Possible values are:
  12390. @table @var
  12391. @item none
  12392. @item ordered
  12393. @item random
  12394. @item error_diffusion
  12395. @end table
  12396. Default is none.
  12397. @item filter, f
  12398. Set the resize filter type.
  12399. Possible values are:
  12400. @table @var
  12401. @item point
  12402. @item bilinear
  12403. @item bicubic
  12404. @item spline16
  12405. @item spline36
  12406. @item lanczos
  12407. @end table
  12408. Default is bilinear.
  12409. @item range, r
  12410. Set the color range.
  12411. Possible values are:
  12412. @table @var
  12413. @item input
  12414. @item limited
  12415. @item full
  12416. @end table
  12417. Default is same as input.
  12418. @item primaries, p
  12419. Set the color primaries.
  12420. Possible values are:
  12421. @table @var
  12422. @item input
  12423. @item 709
  12424. @item unspecified
  12425. @item 170m
  12426. @item 240m
  12427. @item 2020
  12428. @end table
  12429. Default is same as input.
  12430. @item transfer, t
  12431. Set the transfer characteristics.
  12432. Possible values are:
  12433. @table @var
  12434. @item input
  12435. @item 709
  12436. @item unspecified
  12437. @item 601
  12438. @item linear
  12439. @item 2020_10
  12440. @item 2020_12
  12441. @item smpte2084
  12442. @item iec61966-2-1
  12443. @item arib-std-b67
  12444. @end table
  12445. Default is same as input.
  12446. @item matrix, m
  12447. Set the colorspace matrix.
  12448. Possible value are:
  12449. @table @var
  12450. @item input
  12451. @item 709
  12452. @item unspecified
  12453. @item 470bg
  12454. @item 170m
  12455. @item 2020_ncl
  12456. @item 2020_cl
  12457. @end table
  12458. Default is same as input.
  12459. @item rangein, rin
  12460. Set the input color range.
  12461. Possible values are:
  12462. @table @var
  12463. @item input
  12464. @item limited
  12465. @item full
  12466. @end table
  12467. Default is same as input.
  12468. @item primariesin, pin
  12469. Set the input color primaries.
  12470. Possible values are:
  12471. @table @var
  12472. @item input
  12473. @item 709
  12474. @item unspecified
  12475. @item 170m
  12476. @item 240m
  12477. @item 2020
  12478. @end table
  12479. Default is same as input.
  12480. @item transferin, tin
  12481. Set the input transfer characteristics.
  12482. Possible values are:
  12483. @table @var
  12484. @item input
  12485. @item 709
  12486. @item unspecified
  12487. @item 601
  12488. @item linear
  12489. @item 2020_10
  12490. @item 2020_12
  12491. @end table
  12492. Default is same as input.
  12493. @item matrixin, min
  12494. Set the input colorspace matrix.
  12495. Possible value are:
  12496. @table @var
  12497. @item input
  12498. @item 709
  12499. @item unspecified
  12500. @item 470bg
  12501. @item 170m
  12502. @item 2020_ncl
  12503. @item 2020_cl
  12504. @end table
  12505. @item chromal, c
  12506. Set the output chroma location.
  12507. Possible values are:
  12508. @table @var
  12509. @item input
  12510. @item left
  12511. @item center
  12512. @item topleft
  12513. @item top
  12514. @item bottomleft
  12515. @item bottom
  12516. @end table
  12517. @item chromalin, cin
  12518. Set the input chroma location.
  12519. Possible values are:
  12520. @table @var
  12521. @item input
  12522. @item left
  12523. @item center
  12524. @item topleft
  12525. @item top
  12526. @item bottomleft
  12527. @item bottom
  12528. @end table
  12529. @item npl
  12530. Set the nominal peak luminance.
  12531. @end table
  12532. The values of the @option{w} and @option{h} options are expressions
  12533. containing the following constants:
  12534. @table @var
  12535. @item in_w
  12536. @item in_h
  12537. The input width and height
  12538. @item iw
  12539. @item ih
  12540. These are the same as @var{in_w} and @var{in_h}.
  12541. @item out_w
  12542. @item out_h
  12543. The output (scaled) width and height
  12544. @item ow
  12545. @item oh
  12546. These are the same as @var{out_w} and @var{out_h}
  12547. @item a
  12548. The same as @var{iw} / @var{ih}
  12549. @item sar
  12550. input sample aspect ratio
  12551. @item dar
  12552. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12553. @item hsub
  12554. @item vsub
  12555. horizontal and vertical input chroma subsample values. For example for the
  12556. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12557. @item ohsub
  12558. @item ovsub
  12559. horizontal and vertical output chroma subsample values. For example for the
  12560. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12561. @end table
  12562. @table @option
  12563. @end table
  12564. @c man end VIDEO FILTERS
  12565. @chapter Video Sources
  12566. @c man begin VIDEO SOURCES
  12567. Below is a description of the currently available video sources.
  12568. @section buffer
  12569. Buffer video frames, and make them available to the filter chain.
  12570. This source is mainly intended for a programmatic use, in particular
  12571. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12572. It accepts the following parameters:
  12573. @table @option
  12574. @item video_size
  12575. Specify the size (width and height) of the buffered video frames. For the
  12576. syntax of this option, check the
  12577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12578. @item width
  12579. The input video width.
  12580. @item height
  12581. The input video height.
  12582. @item pix_fmt
  12583. A string representing the pixel format of the buffered video frames.
  12584. It may be a number corresponding to a pixel format, or a pixel format
  12585. name.
  12586. @item time_base
  12587. Specify the timebase assumed by the timestamps of the buffered frames.
  12588. @item frame_rate
  12589. Specify the frame rate expected for the video stream.
  12590. @item pixel_aspect, sar
  12591. The sample (pixel) aspect ratio of the input video.
  12592. @item sws_param
  12593. Specify the optional parameters to be used for the scale filter which
  12594. is automatically inserted when an input change is detected in the
  12595. input size or format.
  12596. @item hw_frames_ctx
  12597. When using a hardware pixel format, this should be a reference to an
  12598. AVHWFramesContext describing input frames.
  12599. @end table
  12600. For example:
  12601. @example
  12602. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12603. @end example
  12604. will instruct the source to accept video frames with size 320x240 and
  12605. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12606. square pixels (1:1 sample aspect ratio).
  12607. Since the pixel format with name "yuv410p" corresponds to the number 6
  12608. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12609. this example corresponds to:
  12610. @example
  12611. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12612. @end example
  12613. Alternatively, the options can be specified as a flat string, but this
  12614. syntax is deprecated:
  12615. @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}]
  12616. @section cellauto
  12617. Create a pattern generated by an elementary cellular automaton.
  12618. The initial state of the cellular automaton can be defined through the
  12619. @option{filename} and @option{pattern} options. If such options are
  12620. not specified an initial state is created randomly.
  12621. At each new frame a new row in the video is filled with the result of
  12622. the cellular automaton next generation. The behavior when the whole
  12623. frame is filled is defined by the @option{scroll} option.
  12624. This source accepts the following options:
  12625. @table @option
  12626. @item filename, f
  12627. Read the initial cellular automaton state, i.e. the starting row, from
  12628. the specified file.
  12629. In the file, each non-whitespace character is considered an alive
  12630. cell, a newline will terminate the row, and further characters in the
  12631. file will be ignored.
  12632. @item pattern, p
  12633. Read the initial cellular automaton state, i.e. the starting row, from
  12634. the specified string.
  12635. Each non-whitespace character in the string is considered an alive
  12636. cell, a newline will terminate the row, and further characters in the
  12637. string will be ignored.
  12638. @item rate, r
  12639. Set the video rate, that is the number of frames generated per second.
  12640. Default is 25.
  12641. @item random_fill_ratio, ratio
  12642. Set the random fill ratio for the initial cellular automaton row. It
  12643. is a floating point number value ranging from 0 to 1, defaults to
  12644. 1/PHI.
  12645. This option is ignored when a file or a pattern is specified.
  12646. @item random_seed, seed
  12647. Set the seed for filling randomly the initial row, must be an integer
  12648. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12649. set to -1, the filter will try to use a good random seed on a best
  12650. effort basis.
  12651. @item rule
  12652. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12653. Default value is 110.
  12654. @item size, s
  12655. Set the size of the output video. For the syntax of this option, check the
  12656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12657. If @option{filename} or @option{pattern} is specified, the size is set
  12658. by default to the width of the specified initial state row, and the
  12659. height is set to @var{width} * PHI.
  12660. If @option{size} is set, it must contain the width of the specified
  12661. pattern string, and the specified pattern will be centered in the
  12662. larger row.
  12663. If a filename or a pattern string is not specified, the size value
  12664. defaults to "320x518" (used for a randomly generated initial state).
  12665. @item scroll
  12666. If set to 1, scroll the output upward when all the rows in the output
  12667. have been already filled. If set to 0, the new generated row will be
  12668. written over the top row just after the bottom row is filled.
  12669. Defaults to 1.
  12670. @item start_full, full
  12671. If set to 1, completely fill the output with generated rows before
  12672. outputting the first frame.
  12673. This is the default behavior, for disabling set the value to 0.
  12674. @item stitch
  12675. If set to 1, stitch the left and right row edges together.
  12676. This is the default behavior, for disabling set the value to 0.
  12677. @end table
  12678. @subsection Examples
  12679. @itemize
  12680. @item
  12681. Read the initial state from @file{pattern}, and specify an output of
  12682. size 200x400.
  12683. @example
  12684. cellauto=f=pattern:s=200x400
  12685. @end example
  12686. @item
  12687. Generate a random initial row with a width of 200 cells, with a fill
  12688. ratio of 2/3:
  12689. @example
  12690. cellauto=ratio=2/3:s=200x200
  12691. @end example
  12692. @item
  12693. Create a pattern generated by rule 18 starting by a single alive cell
  12694. centered on an initial row with width 100:
  12695. @example
  12696. cellauto=p=@@:s=100x400:full=0:rule=18
  12697. @end example
  12698. @item
  12699. Specify a more elaborated initial pattern:
  12700. @example
  12701. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12702. @end example
  12703. @end itemize
  12704. @anchor{coreimagesrc}
  12705. @section coreimagesrc
  12706. Video source generated on GPU using Apple's CoreImage API on OSX.
  12707. This video source is a specialized version of the @ref{coreimage} video filter.
  12708. Use a core image generator at the beginning of the applied filterchain to
  12709. generate the content.
  12710. The coreimagesrc video source accepts the following options:
  12711. @table @option
  12712. @item list_generators
  12713. List all available generators along with all their respective options as well as
  12714. possible minimum and maximum values along with the default values.
  12715. @example
  12716. list_generators=true
  12717. @end example
  12718. @item size, s
  12719. Specify the size of the sourced video. For the syntax of this option, check the
  12720. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12721. The default value is @code{320x240}.
  12722. @item rate, r
  12723. Specify the frame rate of the sourced video, as the number of frames
  12724. generated per second. It has to be a string in the format
  12725. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12726. number or a valid video frame rate abbreviation. The default value is
  12727. "25".
  12728. @item sar
  12729. Set the sample aspect ratio of the sourced video.
  12730. @item duration, d
  12731. Set the duration of the sourced video. See
  12732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12733. for the accepted syntax.
  12734. If not specified, or the expressed duration is negative, the video is
  12735. supposed to be generated forever.
  12736. @end table
  12737. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12738. A complete filterchain can be used for further processing of the
  12739. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12740. and examples for details.
  12741. @subsection Examples
  12742. @itemize
  12743. @item
  12744. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12745. given as complete and escaped command-line for Apple's standard bash shell:
  12746. @example
  12747. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12748. @end example
  12749. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12750. need for a nullsrc video source.
  12751. @end itemize
  12752. @section mandelbrot
  12753. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12754. point specified with @var{start_x} and @var{start_y}.
  12755. This source accepts the following options:
  12756. @table @option
  12757. @item end_pts
  12758. Set the terminal pts value. Default value is 400.
  12759. @item end_scale
  12760. Set the terminal scale value.
  12761. Must be a floating point value. Default value is 0.3.
  12762. @item inner
  12763. Set the inner coloring mode, that is the algorithm used to draw the
  12764. Mandelbrot fractal internal region.
  12765. It shall assume one of the following values:
  12766. @table @option
  12767. @item black
  12768. Set black mode.
  12769. @item convergence
  12770. Show time until convergence.
  12771. @item mincol
  12772. Set color based on point closest to the origin of the iterations.
  12773. @item period
  12774. Set period mode.
  12775. @end table
  12776. Default value is @var{mincol}.
  12777. @item bailout
  12778. Set the bailout value. Default value is 10.0.
  12779. @item maxiter
  12780. Set the maximum of iterations performed by the rendering
  12781. algorithm. Default value is 7189.
  12782. @item outer
  12783. Set outer coloring mode.
  12784. It shall assume one of following values:
  12785. @table @option
  12786. @item iteration_count
  12787. Set iteration cound mode.
  12788. @item normalized_iteration_count
  12789. set normalized iteration count mode.
  12790. @end table
  12791. Default value is @var{normalized_iteration_count}.
  12792. @item rate, r
  12793. Set frame rate, expressed as number of frames per second. Default
  12794. value is "25".
  12795. @item size, s
  12796. Set frame size. For the syntax of this option, check the "Video
  12797. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12798. @item start_scale
  12799. Set the initial scale value. Default value is 3.0.
  12800. @item start_x
  12801. Set the initial x position. Must be a floating point value between
  12802. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12803. @item start_y
  12804. Set the initial y position. Must be a floating point value between
  12805. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12806. @end table
  12807. @section mptestsrc
  12808. Generate various test patterns, as generated by the MPlayer test filter.
  12809. The size of the generated video is fixed, and is 256x256.
  12810. This source is useful in particular for testing encoding features.
  12811. This source accepts the following options:
  12812. @table @option
  12813. @item rate, r
  12814. Specify the frame rate of the sourced video, as the number of frames
  12815. generated per second. It has to be a string in the format
  12816. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12817. number or a valid video frame rate abbreviation. The default value is
  12818. "25".
  12819. @item duration, d
  12820. Set the duration of the sourced video. See
  12821. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12822. for the accepted syntax.
  12823. If not specified, or the expressed duration is negative, the video is
  12824. supposed to be generated forever.
  12825. @item test, t
  12826. Set the number or the name of the test to perform. Supported tests are:
  12827. @table @option
  12828. @item dc_luma
  12829. @item dc_chroma
  12830. @item freq_luma
  12831. @item freq_chroma
  12832. @item amp_luma
  12833. @item amp_chroma
  12834. @item cbp
  12835. @item mv
  12836. @item ring1
  12837. @item ring2
  12838. @item all
  12839. @end table
  12840. Default value is "all", which will cycle through the list of all tests.
  12841. @end table
  12842. Some examples:
  12843. @example
  12844. mptestsrc=t=dc_luma
  12845. @end example
  12846. will generate a "dc_luma" test pattern.
  12847. @section frei0r_src
  12848. Provide a frei0r source.
  12849. To enable compilation of this filter you need to install the frei0r
  12850. header and configure FFmpeg with @code{--enable-frei0r}.
  12851. This source accepts the following parameters:
  12852. @table @option
  12853. @item size
  12854. The size of the video to generate. For the syntax of this option, check the
  12855. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12856. @item framerate
  12857. The framerate of the generated video. It may be a string of the form
  12858. @var{num}/@var{den} or a frame rate abbreviation.
  12859. @item filter_name
  12860. The name to the frei0r source to load. For more information regarding frei0r and
  12861. how to set the parameters, read the @ref{frei0r} section in the video filters
  12862. documentation.
  12863. @item filter_params
  12864. A '|'-separated list of parameters to pass to the frei0r source.
  12865. @end table
  12866. For example, to generate a frei0r partik0l source with size 200x200
  12867. and frame rate 10 which is overlaid on the overlay filter main input:
  12868. @example
  12869. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12870. @end example
  12871. @section life
  12872. Generate a life pattern.
  12873. This source is based on a generalization of John Conway's life game.
  12874. The sourced input represents a life grid, each pixel represents a cell
  12875. which can be in one of two possible states, alive or dead. Every cell
  12876. interacts with its eight neighbours, which are the cells that are
  12877. horizontally, vertically, or diagonally adjacent.
  12878. At each interaction the grid evolves according to the adopted rule,
  12879. which specifies the number of neighbor alive cells which will make a
  12880. cell stay alive or born. The @option{rule} option allows one to specify
  12881. the rule to adopt.
  12882. This source accepts the following options:
  12883. @table @option
  12884. @item filename, f
  12885. Set the file from which to read the initial grid state. In the file,
  12886. each non-whitespace character is considered an alive cell, and newline
  12887. is used to delimit the end of each row.
  12888. If this option is not specified, the initial grid is generated
  12889. randomly.
  12890. @item rate, r
  12891. Set the video rate, that is the number of frames generated per second.
  12892. Default is 25.
  12893. @item random_fill_ratio, ratio
  12894. Set the random fill ratio for the initial random grid. It is a
  12895. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12896. It is ignored when a file is specified.
  12897. @item random_seed, seed
  12898. Set the seed for filling the initial random grid, must be an integer
  12899. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12900. set to -1, the filter will try to use a good random seed on a best
  12901. effort basis.
  12902. @item rule
  12903. Set the life rule.
  12904. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12905. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12906. @var{NS} specifies the number of alive neighbor cells which make a
  12907. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12908. which make a dead cell to become alive (i.e. to "born").
  12909. "s" and "b" can be used in place of "S" and "B", respectively.
  12910. Alternatively a rule can be specified by an 18-bits integer. The 9
  12911. high order bits are used to encode the next cell state if it is alive
  12912. for each number of neighbor alive cells, the low order bits specify
  12913. the rule for "borning" new cells. Higher order bits encode for an
  12914. higher number of neighbor cells.
  12915. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12916. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12917. Default value is "S23/B3", which is the original Conway's game of life
  12918. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12919. cells, and will born a new cell if there are three alive cells around
  12920. a dead cell.
  12921. @item size, s
  12922. Set the size of the output video. For the syntax of this option, check the
  12923. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12924. If @option{filename} is specified, the size is set by default to the
  12925. same size of the input file. If @option{size} is set, it must contain
  12926. the size specified in the input file, and the initial grid defined in
  12927. that file is centered in the larger resulting area.
  12928. If a filename is not specified, the size value defaults to "320x240"
  12929. (used for a randomly generated initial grid).
  12930. @item stitch
  12931. If set to 1, stitch the left and right grid edges together, and the
  12932. top and bottom edges also. Defaults to 1.
  12933. @item mold
  12934. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12935. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12936. value from 0 to 255.
  12937. @item life_color
  12938. Set the color of living (or new born) cells.
  12939. @item death_color
  12940. Set the color of dead cells. If @option{mold} is set, this is the first color
  12941. used to represent a dead cell.
  12942. @item mold_color
  12943. Set mold color, for definitely dead and moldy cells.
  12944. For the syntax of these 3 color options, check the "Color" section in the
  12945. ffmpeg-utils manual.
  12946. @end table
  12947. @subsection Examples
  12948. @itemize
  12949. @item
  12950. Read a grid from @file{pattern}, and center it on a grid of size
  12951. 300x300 pixels:
  12952. @example
  12953. life=f=pattern:s=300x300
  12954. @end example
  12955. @item
  12956. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12957. @example
  12958. life=ratio=2/3:s=200x200
  12959. @end example
  12960. @item
  12961. Specify a custom rule for evolving a randomly generated grid:
  12962. @example
  12963. life=rule=S14/B34
  12964. @end example
  12965. @item
  12966. Full example with slow death effect (mold) using @command{ffplay}:
  12967. @example
  12968. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12969. @end example
  12970. @end itemize
  12971. @anchor{allrgb}
  12972. @anchor{allyuv}
  12973. @anchor{color}
  12974. @anchor{haldclutsrc}
  12975. @anchor{nullsrc}
  12976. @anchor{rgbtestsrc}
  12977. @anchor{smptebars}
  12978. @anchor{smptehdbars}
  12979. @anchor{testsrc}
  12980. @anchor{testsrc2}
  12981. @anchor{yuvtestsrc}
  12982. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12983. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12984. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12985. The @code{color} source provides an uniformly colored input.
  12986. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12987. @ref{haldclut} filter.
  12988. The @code{nullsrc} source returns unprocessed video frames. It is
  12989. mainly useful to be employed in analysis / debugging tools, or as the
  12990. source for filters which ignore the input data.
  12991. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12992. detecting RGB vs BGR issues. You should see a red, green and blue
  12993. stripe from top to bottom.
  12994. The @code{smptebars} source generates a color bars pattern, based on
  12995. the SMPTE Engineering Guideline EG 1-1990.
  12996. The @code{smptehdbars} source generates a color bars pattern, based on
  12997. the SMPTE RP 219-2002.
  12998. The @code{testsrc} source generates a test video pattern, showing a
  12999. color pattern, a scrolling gradient and a timestamp. This is mainly
  13000. intended for testing purposes.
  13001. The @code{testsrc2} source is similar to testsrc, but supports more
  13002. pixel formats instead of just @code{rgb24}. This allows using it as an
  13003. input for other tests without requiring a format conversion.
  13004. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13005. see a y, cb and cr stripe from top to bottom.
  13006. The sources accept the following parameters:
  13007. @table @option
  13008. @item alpha
  13009. Specify the alpha (opacity) of the background, only available in the
  13010. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13011. 255 (fully opaque, the default).
  13012. @item color, c
  13013. Specify the color of the source, only available in the @code{color}
  13014. source. For the syntax of this option, check the "Color" section in the
  13015. ffmpeg-utils manual.
  13016. @item level
  13017. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13018. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13019. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13020. coded on a @code{1/(N*N)} scale.
  13021. @item size, s
  13022. Specify the size of the sourced video. For the syntax of this option, check the
  13023. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13024. The default value is @code{320x240}.
  13025. This option is not available with the @code{haldclutsrc} filter.
  13026. @item rate, r
  13027. Specify the frame rate of the sourced video, as the number of frames
  13028. generated per second. It has to be a string in the format
  13029. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13030. number or a valid video frame rate abbreviation. The default value is
  13031. "25".
  13032. @item sar
  13033. Set the sample aspect ratio of the sourced video.
  13034. @item duration, d
  13035. Set the duration of the sourced video. See
  13036. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13037. for the accepted syntax.
  13038. If not specified, or the expressed duration is negative, the video is
  13039. supposed to be generated forever.
  13040. @item decimals, n
  13041. Set the number of decimals to show in the timestamp, only available in the
  13042. @code{testsrc} source.
  13043. The displayed timestamp value will correspond to the original
  13044. timestamp value multiplied by the power of 10 of the specified
  13045. value. Default value is 0.
  13046. @end table
  13047. For example the following:
  13048. @example
  13049. testsrc=duration=5.3:size=qcif:rate=10
  13050. @end example
  13051. will generate a video with a duration of 5.3 seconds, with size
  13052. 176x144 and a frame rate of 10 frames per second.
  13053. The following graph description will generate a red source
  13054. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13055. frames per second.
  13056. @example
  13057. color=c=red@@0.2:s=qcif:r=10
  13058. @end example
  13059. If the input content is to be ignored, @code{nullsrc} can be used. The
  13060. following command generates noise in the luminance plane by employing
  13061. the @code{geq} filter:
  13062. @example
  13063. nullsrc=s=256x256, geq=random(1)*255:128:128
  13064. @end example
  13065. @subsection Commands
  13066. The @code{color} source supports the following commands:
  13067. @table @option
  13068. @item c, color
  13069. Set the color of the created image. Accepts the same syntax of the
  13070. corresponding @option{color} option.
  13071. @end table
  13072. @c man end VIDEO SOURCES
  13073. @chapter Video Sinks
  13074. @c man begin VIDEO SINKS
  13075. Below is a description of the currently available video sinks.
  13076. @section buffersink
  13077. Buffer video frames, and make them available to the end of the filter
  13078. graph.
  13079. This sink is mainly intended for programmatic use, in particular
  13080. through the interface defined in @file{libavfilter/buffersink.h}
  13081. or the options system.
  13082. It accepts a pointer to an AVBufferSinkContext structure, which
  13083. defines the incoming buffers' formats, to be passed as the opaque
  13084. parameter to @code{avfilter_init_filter} for initialization.
  13085. @section nullsink
  13086. Null video sink: do absolutely nothing with the input video. It is
  13087. mainly useful as a template and for use in analysis / debugging
  13088. tools.
  13089. @c man end VIDEO SINKS
  13090. @chapter Multimedia Filters
  13091. @c man begin MULTIMEDIA FILTERS
  13092. Below is a description of the currently available multimedia filters.
  13093. @section abitscope
  13094. Convert input audio to a video output, displaying the audio bit scope.
  13095. The filter accepts the following options:
  13096. @table @option
  13097. @item rate, r
  13098. Set frame rate, expressed as number of frames per second. Default
  13099. value is "25".
  13100. @item size, s
  13101. Specify the video size for the output. For the syntax of this option, check the
  13102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13103. Default value is @code{1024x256}.
  13104. @item colors
  13105. Specify list of colors separated by space or by '|' which will be used to
  13106. draw channels. Unrecognized or missing colors will be replaced
  13107. by white color.
  13108. @end table
  13109. @section ahistogram
  13110. Convert input audio to a video output, displaying the volume histogram.
  13111. The filter accepts the following options:
  13112. @table @option
  13113. @item dmode
  13114. Specify how histogram is calculated.
  13115. It accepts the following values:
  13116. @table @samp
  13117. @item single
  13118. Use single histogram for all channels.
  13119. @item separate
  13120. Use separate histogram for each channel.
  13121. @end table
  13122. Default is @code{single}.
  13123. @item rate, r
  13124. Set frame rate, expressed as number of frames per second. Default
  13125. value is "25".
  13126. @item size, s
  13127. Specify the video size for the output. For the syntax of this option, check the
  13128. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13129. Default value is @code{hd720}.
  13130. @item scale
  13131. Set display scale.
  13132. It accepts the following values:
  13133. @table @samp
  13134. @item log
  13135. logarithmic
  13136. @item sqrt
  13137. square root
  13138. @item cbrt
  13139. cubic root
  13140. @item lin
  13141. linear
  13142. @item rlog
  13143. reverse logarithmic
  13144. @end table
  13145. Default is @code{log}.
  13146. @item ascale
  13147. Set amplitude scale.
  13148. It accepts the following values:
  13149. @table @samp
  13150. @item log
  13151. logarithmic
  13152. @item lin
  13153. linear
  13154. @end table
  13155. Default is @code{log}.
  13156. @item acount
  13157. Set how much frames to accumulate in histogram.
  13158. Defauls is 1. Setting this to -1 accumulates all frames.
  13159. @item rheight
  13160. Set histogram ratio of window height.
  13161. @item slide
  13162. Set sonogram sliding.
  13163. It accepts the following values:
  13164. @table @samp
  13165. @item replace
  13166. replace old rows with new ones.
  13167. @item scroll
  13168. scroll from top to bottom.
  13169. @end table
  13170. Default is @code{replace}.
  13171. @end table
  13172. @section aphasemeter
  13173. Convert input audio to a video output, displaying the audio phase.
  13174. The filter accepts the following options:
  13175. @table @option
  13176. @item rate, r
  13177. Set the output frame rate. Default value is @code{25}.
  13178. @item size, s
  13179. Set the video size for the output. For the syntax of this option, check the
  13180. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13181. Default value is @code{800x400}.
  13182. @item rc
  13183. @item gc
  13184. @item bc
  13185. Specify the red, green, blue contrast. Default values are @code{2},
  13186. @code{7} and @code{1}.
  13187. Allowed range is @code{[0, 255]}.
  13188. @item mpc
  13189. Set color which will be used for drawing median phase. If color is
  13190. @code{none} which is default, no median phase value will be drawn.
  13191. @item video
  13192. Enable video output. Default is enabled.
  13193. @end table
  13194. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13195. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13196. The @code{-1} means left and right channels are completely out of phase and
  13197. @code{1} means channels are in phase.
  13198. @section avectorscope
  13199. Convert input audio to a video output, representing the audio vector
  13200. scope.
  13201. The filter is used to measure the difference between channels of stereo
  13202. audio stream. A monoaural signal, consisting of identical left and right
  13203. signal, results in straight vertical line. Any stereo separation is visible
  13204. as a deviation from this line, creating a Lissajous figure.
  13205. If the straight (or deviation from it) but horizontal line appears this
  13206. indicates that the left and right channels are out of phase.
  13207. The filter accepts the following options:
  13208. @table @option
  13209. @item mode, m
  13210. Set the vectorscope mode.
  13211. Available values are:
  13212. @table @samp
  13213. @item lissajous
  13214. Lissajous rotated by 45 degrees.
  13215. @item lissajous_xy
  13216. Same as above but not rotated.
  13217. @item polar
  13218. Shape resembling half of circle.
  13219. @end table
  13220. Default value is @samp{lissajous}.
  13221. @item size, s
  13222. Set the video size for the output. For the syntax of this option, check the
  13223. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13224. Default value is @code{400x400}.
  13225. @item rate, r
  13226. Set the output frame rate. Default value is @code{25}.
  13227. @item rc
  13228. @item gc
  13229. @item bc
  13230. @item ac
  13231. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13232. @code{160}, @code{80} and @code{255}.
  13233. Allowed range is @code{[0, 255]}.
  13234. @item rf
  13235. @item gf
  13236. @item bf
  13237. @item af
  13238. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13239. @code{10}, @code{5} and @code{5}.
  13240. Allowed range is @code{[0, 255]}.
  13241. @item zoom
  13242. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13243. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13244. @item draw
  13245. Set the vectorscope drawing mode.
  13246. Available values are:
  13247. @table @samp
  13248. @item dot
  13249. Draw dot for each sample.
  13250. @item line
  13251. Draw line between previous and current sample.
  13252. @end table
  13253. Default value is @samp{dot}.
  13254. @item scale
  13255. Specify amplitude scale of audio samples.
  13256. Available values are:
  13257. @table @samp
  13258. @item lin
  13259. Linear.
  13260. @item sqrt
  13261. Square root.
  13262. @item cbrt
  13263. Cubic root.
  13264. @item log
  13265. Logarithmic.
  13266. @end table
  13267. @item swap
  13268. Swap left channel axis with right channel axis.
  13269. @item mirror
  13270. Mirror axis.
  13271. @table @samp
  13272. @item none
  13273. No mirror.
  13274. @item x
  13275. Mirror only x axis.
  13276. @item y
  13277. Mirror only y axis.
  13278. @item xy
  13279. Mirror both axis.
  13280. @end table
  13281. @end table
  13282. @subsection Examples
  13283. @itemize
  13284. @item
  13285. Complete example using @command{ffplay}:
  13286. @example
  13287. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13288. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13289. @end example
  13290. @end itemize
  13291. @section bench, abench
  13292. Benchmark part of a filtergraph.
  13293. The filter accepts the following options:
  13294. @table @option
  13295. @item action
  13296. Start or stop a timer.
  13297. Available values are:
  13298. @table @samp
  13299. @item start
  13300. Get the current time, set it as frame metadata (using the key
  13301. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13302. @item stop
  13303. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13304. the input frame metadata to get the time difference. Time difference, average,
  13305. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13306. @code{min}) are then printed. The timestamps are expressed in seconds.
  13307. @end table
  13308. @end table
  13309. @subsection Examples
  13310. @itemize
  13311. @item
  13312. Benchmark @ref{selectivecolor} filter:
  13313. @example
  13314. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13315. @end example
  13316. @end itemize
  13317. @section concat
  13318. Concatenate audio and video streams, joining them together one after the
  13319. other.
  13320. The filter works on segments of synchronized video and audio streams. All
  13321. segments must have the same number of streams of each type, and that will
  13322. also be the number of streams at output.
  13323. The filter accepts the following options:
  13324. @table @option
  13325. @item n
  13326. Set the number of segments. Default is 2.
  13327. @item v
  13328. Set the number of output video streams, that is also the number of video
  13329. streams in each segment. Default is 1.
  13330. @item a
  13331. Set the number of output audio streams, that is also the number of audio
  13332. streams in each segment. Default is 0.
  13333. @item unsafe
  13334. Activate unsafe mode: do not fail if segments have a different format.
  13335. @end table
  13336. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13337. @var{a} audio outputs.
  13338. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13339. segment, in the same order as the outputs, then the inputs for the second
  13340. segment, etc.
  13341. Related streams do not always have exactly the same duration, for various
  13342. reasons including codec frame size or sloppy authoring. For that reason,
  13343. related synchronized streams (e.g. a video and its audio track) should be
  13344. concatenated at once. The concat filter will use the duration of the longest
  13345. stream in each segment (except the last one), and if necessary pad shorter
  13346. audio streams with silence.
  13347. For this filter to work correctly, all segments must start at timestamp 0.
  13348. All corresponding streams must have the same parameters in all segments; the
  13349. filtering system will automatically select a common pixel format for video
  13350. streams, and a common sample format, sample rate and channel layout for
  13351. audio streams, but other settings, such as resolution, must be converted
  13352. explicitly by the user.
  13353. Different frame rates are acceptable but will result in variable frame rate
  13354. at output; be sure to configure the output file to handle it.
  13355. @subsection Examples
  13356. @itemize
  13357. @item
  13358. Concatenate an opening, an episode and an ending, all in bilingual version
  13359. (video in stream 0, audio in streams 1 and 2):
  13360. @example
  13361. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13362. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13363. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13364. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13365. @end example
  13366. @item
  13367. Concatenate two parts, handling audio and video separately, using the
  13368. (a)movie sources, and adjusting the resolution:
  13369. @example
  13370. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13371. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13372. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13373. @end example
  13374. Note that a desync will happen at the stitch if the audio and video streams
  13375. do not have exactly the same duration in the first file.
  13376. @end itemize
  13377. @section drawgraph, adrawgraph
  13378. Draw a graph using input video or audio metadata.
  13379. It accepts the following parameters:
  13380. @table @option
  13381. @item m1
  13382. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13383. @item fg1
  13384. Set 1st foreground color expression.
  13385. @item m2
  13386. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13387. @item fg2
  13388. Set 2nd foreground color expression.
  13389. @item m3
  13390. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13391. @item fg3
  13392. Set 3rd foreground color expression.
  13393. @item m4
  13394. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13395. @item fg4
  13396. Set 4th foreground color expression.
  13397. @item min
  13398. Set minimal value of metadata value.
  13399. @item max
  13400. Set maximal value of metadata value.
  13401. @item bg
  13402. Set graph background color. Default is white.
  13403. @item mode
  13404. Set graph mode.
  13405. Available values for mode is:
  13406. @table @samp
  13407. @item bar
  13408. @item dot
  13409. @item line
  13410. @end table
  13411. Default is @code{line}.
  13412. @item slide
  13413. Set slide mode.
  13414. Available values for slide is:
  13415. @table @samp
  13416. @item frame
  13417. Draw new frame when right border is reached.
  13418. @item replace
  13419. Replace old columns with new ones.
  13420. @item scroll
  13421. Scroll from right to left.
  13422. @item rscroll
  13423. Scroll from left to right.
  13424. @item picture
  13425. Draw single picture.
  13426. @end table
  13427. Default is @code{frame}.
  13428. @item size
  13429. Set size of graph video. For the syntax of this option, check the
  13430. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13431. The default value is @code{900x256}.
  13432. The foreground color expressions can use the following variables:
  13433. @table @option
  13434. @item MIN
  13435. Minimal value of metadata value.
  13436. @item MAX
  13437. Maximal value of metadata value.
  13438. @item VAL
  13439. Current metadata key value.
  13440. @end table
  13441. The color is defined as 0xAABBGGRR.
  13442. @end table
  13443. Example using metadata from @ref{signalstats} filter:
  13444. @example
  13445. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13446. @end example
  13447. Example using metadata from @ref{ebur128} filter:
  13448. @example
  13449. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13450. @end example
  13451. @anchor{ebur128}
  13452. @section ebur128
  13453. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13454. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13455. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13456. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13457. The filter also has a video output (see the @var{video} option) with a real
  13458. time graph to observe the loudness evolution. The graphic contains the logged
  13459. message mentioned above, so it is not printed anymore when this option is set,
  13460. unless the verbose logging is set. The main graphing area contains the
  13461. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13462. the momentary loudness (400 milliseconds).
  13463. More information about the Loudness Recommendation EBU R128 on
  13464. @url{http://tech.ebu.ch/loudness}.
  13465. The filter accepts the following options:
  13466. @table @option
  13467. @item video
  13468. Activate the video output. The audio stream is passed unchanged whether this
  13469. option is set or no. The video stream will be the first output stream if
  13470. activated. Default is @code{0}.
  13471. @item size
  13472. Set the video size. This option is for video only. For the syntax of this
  13473. option, check the
  13474. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13475. Default and minimum resolution is @code{640x480}.
  13476. @item meter
  13477. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13478. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13479. other integer value between this range is allowed.
  13480. @item metadata
  13481. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13482. into 100ms output frames, each of them containing various loudness information
  13483. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13484. Default is @code{0}.
  13485. @item framelog
  13486. Force the frame logging level.
  13487. Available values are:
  13488. @table @samp
  13489. @item info
  13490. information logging level
  13491. @item verbose
  13492. verbose logging level
  13493. @end table
  13494. By default, the logging level is set to @var{info}. If the @option{video} or
  13495. the @option{metadata} options are set, it switches to @var{verbose}.
  13496. @item peak
  13497. Set peak mode(s).
  13498. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13499. values are:
  13500. @table @samp
  13501. @item none
  13502. Disable any peak mode (default).
  13503. @item sample
  13504. Enable sample-peak mode.
  13505. Simple peak mode looking for the higher sample value. It logs a message
  13506. for sample-peak (identified by @code{SPK}).
  13507. @item true
  13508. Enable true-peak mode.
  13509. If enabled, the peak lookup is done on an over-sampled version of the input
  13510. stream for better peak accuracy. It logs a message for true-peak.
  13511. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13512. This mode requires a build with @code{libswresample}.
  13513. @end table
  13514. @item dualmono
  13515. Treat mono input files as "dual mono". If a mono file is intended for playback
  13516. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13517. If set to @code{true}, this option will compensate for this effect.
  13518. Multi-channel input files are not affected by this option.
  13519. @item panlaw
  13520. Set a specific pan law to be used for the measurement of dual mono files.
  13521. This parameter is optional, and has a default value of -3.01dB.
  13522. @end table
  13523. @subsection Examples
  13524. @itemize
  13525. @item
  13526. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13527. @example
  13528. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13529. @end example
  13530. @item
  13531. Run an analysis with @command{ffmpeg}:
  13532. @example
  13533. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13534. @end example
  13535. @end itemize
  13536. @section interleave, ainterleave
  13537. Temporally interleave frames from several inputs.
  13538. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13539. These filters read frames from several inputs and send the oldest
  13540. queued frame to the output.
  13541. Input streams must have well defined, monotonically increasing frame
  13542. timestamp values.
  13543. In order to submit one frame to output, these filters need to enqueue
  13544. at least one frame for each input, so they cannot work in case one
  13545. input is not yet terminated and will not receive incoming frames.
  13546. For example consider the case when one input is a @code{select} filter
  13547. which always drops input frames. The @code{interleave} filter will keep
  13548. reading from that input, but it will never be able to send new frames
  13549. to output until the input sends an end-of-stream signal.
  13550. Also, depending on inputs synchronization, the filters will drop
  13551. frames in case one input receives more frames than the other ones, and
  13552. the queue is already filled.
  13553. These filters accept the following options:
  13554. @table @option
  13555. @item nb_inputs, n
  13556. Set the number of different inputs, it is 2 by default.
  13557. @end table
  13558. @subsection Examples
  13559. @itemize
  13560. @item
  13561. Interleave frames belonging to different streams using @command{ffmpeg}:
  13562. @example
  13563. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13564. @end example
  13565. @item
  13566. Add flickering blur effect:
  13567. @example
  13568. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13569. @end example
  13570. @end itemize
  13571. @section metadata, ametadata
  13572. Manipulate frame metadata.
  13573. This filter accepts the following options:
  13574. @table @option
  13575. @item mode
  13576. Set mode of operation of the filter.
  13577. Can be one of the following:
  13578. @table @samp
  13579. @item select
  13580. If both @code{value} and @code{key} is set, select frames
  13581. which have such metadata. If only @code{key} is set, select
  13582. every frame that has such key in metadata.
  13583. @item add
  13584. Add new metadata @code{key} and @code{value}. If key is already available
  13585. do nothing.
  13586. @item modify
  13587. Modify value of already present key.
  13588. @item delete
  13589. If @code{value} is set, delete only keys that have such value.
  13590. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13591. the frame.
  13592. @item print
  13593. Print key and its value if metadata was found. If @code{key} is not set print all
  13594. metadata values available in frame.
  13595. @end table
  13596. @item key
  13597. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13598. @item value
  13599. Set metadata value which will be used. This option is mandatory for
  13600. @code{modify} and @code{add} mode.
  13601. @item function
  13602. Which function to use when comparing metadata value and @code{value}.
  13603. Can be one of following:
  13604. @table @samp
  13605. @item same_str
  13606. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13607. @item starts_with
  13608. Values are interpreted as strings, returns true if metadata value starts with
  13609. the @code{value} option string.
  13610. @item less
  13611. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13612. @item equal
  13613. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13614. @item greater
  13615. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13616. @item expr
  13617. Values are interpreted as floats, returns true if expression from option @code{expr}
  13618. evaluates to true.
  13619. @end table
  13620. @item expr
  13621. Set expression which is used when @code{function} is set to @code{expr}.
  13622. The expression is evaluated through the eval API and can contain the following
  13623. constants:
  13624. @table @option
  13625. @item VALUE1
  13626. Float representation of @code{value} from metadata key.
  13627. @item VALUE2
  13628. Float representation of @code{value} as supplied by user in @code{value} option.
  13629. @end table
  13630. @item file
  13631. If specified in @code{print} mode, output is written to the named file. Instead of
  13632. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13633. for standard output. If @code{file} option is not set, output is written to the log
  13634. with AV_LOG_INFO loglevel.
  13635. @end table
  13636. @subsection Examples
  13637. @itemize
  13638. @item
  13639. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13640. between 0 and 1.
  13641. @example
  13642. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13643. @end example
  13644. @item
  13645. Print silencedetect output to file @file{metadata.txt}.
  13646. @example
  13647. silencedetect,ametadata=mode=print:file=metadata.txt
  13648. @end example
  13649. @item
  13650. Direct all metadata to a pipe with file descriptor 4.
  13651. @example
  13652. metadata=mode=print:file='pipe\:4'
  13653. @end example
  13654. @end itemize
  13655. @section perms, aperms
  13656. Set read/write permissions for the output frames.
  13657. These filters are mainly aimed at developers to test direct path in the
  13658. following filter in the filtergraph.
  13659. The filters accept the following options:
  13660. @table @option
  13661. @item mode
  13662. Select the permissions mode.
  13663. It accepts the following values:
  13664. @table @samp
  13665. @item none
  13666. Do nothing. This is the default.
  13667. @item ro
  13668. Set all the output frames read-only.
  13669. @item rw
  13670. Set all the output frames directly writable.
  13671. @item toggle
  13672. Make the frame read-only if writable, and writable if read-only.
  13673. @item random
  13674. Set each output frame read-only or writable randomly.
  13675. @end table
  13676. @item seed
  13677. Set the seed for the @var{random} mode, must be an integer included between
  13678. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13679. @code{-1}, the filter will try to use a good random seed on a best effort
  13680. basis.
  13681. @end table
  13682. Note: in case of auto-inserted filter between the permission filter and the
  13683. following one, the permission might not be received as expected in that
  13684. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13685. perms/aperms filter can avoid this problem.
  13686. @section realtime, arealtime
  13687. Slow down filtering to match real time approximately.
  13688. These filters will pause the filtering for a variable amount of time to
  13689. match the output rate with the input timestamps.
  13690. They are similar to the @option{re} option to @code{ffmpeg}.
  13691. They accept the following options:
  13692. @table @option
  13693. @item limit
  13694. Time limit for the pauses. Any pause longer than that will be considered
  13695. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13696. @end table
  13697. @anchor{select}
  13698. @section select, aselect
  13699. Select frames to pass in output.
  13700. This filter accepts the following options:
  13701. @table @option
  13702. @item expr, e
  13703. Set expression, which is evaluated for each input frame.
  13704. If the expression is evaluated to zero, the frame is discarded.
  13705. If the evaluation result is negative or NaN, the frame is sent to the
  13706. first output; otherwise it is sent to the output with index
  13707. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13708. For example a value of @code{1.2} corresponds to the output with index
  13709. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13710. @item outputs, n
  13711. Set the number of outputs. The output to which to send the selected
  13712. frame is based on the result of the evaluation. Default value is 1.
  13713. @end table
  13714. The expression can contain the following constants:
  13715. @table @option
  13716. @item n
  13717. The (sequential) number of the filtered frame, starting from 0.
  13718. @item selected_n
  13719. The (sequential) number of the selected frame, starting from 0.
  13720. @item prev_selected_n
  13721. The sequential number of the last selected frame. It's NAN if undefined.
  13722. @item TB
  13723. The timebase of the input timestamps.
  13724. @item pts
  13725. The PTS (Presentation TimeStamp) of the filtered video frame,
  13726. expressed in @var{TB} units. It's NAN if undefined.
  13727. @item t
  13728. The PTS of the filtered video frame,
  13729. expressed in seconds. It's NAN if undefined.
  13730. @item prev_pts
  13731. The PTS of the previously filtered video frame. It's NAN if undefined.
  13732. @item prev_selected_pts
  13733. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13734. @item prev_selected_t
  13735. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13736. @item start_pts
  13737. The PTS of the first video frame in the video. It's NAN if undefined.
  13738. @item start_t
  13739. The time of the first video frame in the video. It's NAN if undefined.
  13740. @item pict_type @emph{(video only)}
  13741. The type of the filtered frame. It can assume one of the following
  13742. values:
  13743. @table @option
  13744. @item I
  13745. @item P
  13746. @item B
  13747. @item S
  13748. @item SI
  13749. @item SP
  13750. @item BI
  13751. @end table
  13752. @item interlace_type @emph{(video only)}
  13753. The frame interlace type. It can assume one of the following values:
  13754. @table @option
  13755. @item PROGRESSIVE
  13756. The frame is progressive (not interlaced).
  13757. @item TOPFIRST
  13758. The frame is top-field-first.
  13759. @item BOTTOMFIRST
  13760. The frame is bottom-field-first.
  13761. @end table
  13762. @item consumed_sample_n @emph{(audio only)}
  13763. the number of selected samples before the current frame
  13764. @item samples_n @emph{(audio only)}
  13765. the number of samples in the current frame
  13766. @item sample_rate @emph{(audio only)}
  13767. the input sample rate
  13768. @item key
  13769. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13770. @item pos
  13771. the position in the file of the filtered frame, -1 if the information
  13772. is not available (e.g. for synthetic video)
  13773. @item scene @emph{(video only)}
  13774. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13775. probability for the current frame to introduce a new scene, while a higher
  13776. value means the current frame is more likely to be one (see the example below)
  13777. @item concatdec_select
  13778. The concat demuxer can select only part of a concat input file by setting an
  13779. inpoint and an outpoint, but the output packets may not be entirely contained
  13780. in the selected interval. By using this variable, it is possible to skip frames
  13781. generated by the concat demuxer which are not exactly contained in the selected
  13782. interval.
  13783. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13784. and the @var{lavf.concat.duration} packet metadata values which are also
  13785. present in the decoded frames.
  13786. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13787. start_time and either the duration metadata is missing or the frame pts is less
  13788. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13789. missing.
  13790. That basically means that an input frame is selected if its pts is within the
  13791. interval set by the concat demuxer.
  13792. @end table
  13793. The default value of the select expression is "1".
  13794. @subsection Examples
  13795. @itemize
  13796. @item
  13797. Select all frames in input:
  13798. @example
  13799. select
  13800. @end example
  13801. The example above is the same as:
  13802. @example
  13803. select=1
  13804. @end example
  13805. @item
  13806. Skip all frames:
  13807. @example
  13808. select=0
  13809. @end example
  13810. @item
  13811. Select only I-frames:
  13812. @example
  13813. select='eq(pict_type\,I)'
  13814. @end example
  13815. @item
  13816. Select one frame every 100:
  13817. @example
  13818. select='not(mod(n\,100))'
  13819. @end example
  13820. @item
  13821. Select only frames contained in the 10-20 time interval:
  13822. @example
  13823. select=between(t\,10\,20)
  13824. @end example
  13825. @item
  13826. Select only I-frames contained in the 10-20 time interval:
  13827. @example
  13828. select=between(t\,10\,20)*eq(pict_type\,I)
  13829. @end example
  13830. @item
  13831. Select frames with a minimum distance of 10 seconds:
  13832. @example
  13833. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13834. @end example
  13835. @item
  13836. Use aselect to select only audio frames with samples number > 100:
  13837. @example
  13838. aselect='gt(samples_n\,100)'
  13839. @end example
  13840. @item
  13841. Create a mosaic of the first scenes:
  13842. @example
  13843. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13844. @end example
  13845. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13846. choice.
  13847. @item
  13848. Send even and odd frames to separate outputs, and compose them:
  13849. @example
  13850. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13851. @end example
  13852. @item
  13853. Select useful frames from an ffconcat file which is using inpoints and
  13854. outpoints but where the source files are not intra frame only.
  13855. @example
  13856. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13857. @end example
  13858. @end itemize
  13859. @section sendcmd, asendcmd
  13860. Send commands to filters in the filtergraph.
  13861. These filters read commands to be sent to other filters in the
  13862. filtergraph.
  13863. @code{sendcmd} must be inserted between two video filters,
  13864. @code{asendcmd} must be inserted between two audio filters, but apart
  13865. from that they act the same way.
  13866. The specification of commands can be provided in the filter arguments
  13867. with the @var{commands} option, or in a file specified by the
  13868. @var{filename} option.
  13869. These filters accept the following options:
  13870. @table @option
  13871. @item commands, c
  13872. Set the commands to be read and sent to the other filters.
  13873. @item filename, f
  13874. Set the filename of the commands to be read and sent to the other
  13875. filters.
  13876. @end table
  13877. @subsection Commands syntax
  13878. A commands description consists of a sequence of interval
  13879. specifications, comprising a list of commands to be executed when a
  13880. particular event related to that interval occurs. The occurring event
  13881. is typically the current frame time entering or leaving a given time
  13882. interval.
  13883. An interval is specified by the following syntax:
  13884. @example
  13885. @var{START}[-@var{END}] @var{COMMANDS};
  13886. @end example
  13887. The time interval is specified by the @var{START} and @var{END} times.
  13888. @var{END} is optional and defaults to the maximum time.
  13889. The current frame time is considered within the specified interval if
  13890. it is included in the interval [@var{START}, @var{END}), that is when
  13891. the time is greater or equal to @var{START} and is lesser than
  13892. @var{END}.
  13893. @var{COMMANDS} consists of a sequence of one or more command
  13894. specifications, separated by ",", relating to that interval. The
  13895. syntax of a command specification is given by:
  13896. @example
  13897. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13898. @end example
  13899. @var{FLAGS} is optional and specifies the type of events relating to
  13900. the time interval which enable sending the specified command, and must
  13901. be a non-null sequence of identifier flags separated by "+" or "|" and
  13902. enclosed between "[" and "]".
  13903. The following flags are recognized:
  13904. @table @option
  13905. @item enter
  13906. The command is sent when the current frame timestamp enters the
  13907. specified interval. In other words, the command is sent when the
  13908. previous frame timestamp was not in the given interval, and the
  13909. current is.
  13910. @item leave
  13911. The command is sent when the current frame timestamp leaves the
  13912. specified interval. In other words, the command is sent when the
  13913. previous frame timestamp was in the given interval, and the
  13914. current is not.
  13915. @end table
  13916. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13917. assumed.
  13918. @var{TARGET} specifies the target of the command, usually the name of
  13919. the filter class or a specific filter instance name.
  13920. @var{COMMAND} specifies the name of the command for the target filter.
  13921. @var{ARG} is optional and specifies the optional list of argument for
  13922. the given @var{COMMAND}.
  13923. Between one interval specification and another, whitespaces, or
  13924. sequences of characters starting with @code{#} until the end of line,
  13925. are ignored and can be used to annotate comments.
  13926. A simplified BNF description of the commands specification syntax
  13927. follows:
  13928. @example
  13929. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13930. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13931. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13932. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13933. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13934. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13935. @end example
  13936. @subsection Examples
  13937. @itemize
  13938. @item
  13939. Specify audio tempo change at second 4:
  13940. @example
  13941. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13942. @end example
  13943. @item
  13944. Target a specific filter instance:
  13945. @example
  13946. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13947. @end example
  13948. @item
  13949. Specify a list of drawtext and hue commands in a file.
  13950. @example
  13951. # show text in the interval 5-10
  13952. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13953. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13954. # desaturate the image in the interval 15-20
  13955. 15.0-20.0 [enter] hue s 0,
  13956. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13957. [leave] hue s 1,
  13958. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13959. # apply an exponential saturation fade-out effect, starting from time 25
  13960. 25 [enter] hue s exp(25-t)
  13961. @end example
  13962. A filtergraph allowing to read and process the above command list
  13963. stored in a file @file{test.cmd}, can be specified with:
  13964. @example
  13965. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13966. @end example
  13967. @end itemize
  13968. @anchor{setpts}
  13969. @section setpts, asetpts
  13970. Change the PTS (presentation timestamp) of the input frames.
  13971. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13972. This filter accepts the following options:
  13973. @table @option
  13974. @item expr
  13975. The expression which is evaluated for each frame to construct its timestamp.
  13976. @end table
  13977. The expression is evaluated through the eval API and can contain the following
  13978. constants:
  13979. @table @option
  13980. @item FRAME_RATE
  13981. frame rate, only defined for constant frame-rate video
  13982. @item PTS
  13983. The presentation timestamp in input
  13984. @item N
  13985. The count of the input frame for video or the number of consumed samples,
  13986. not including the current frame for audio, starting from 0.
  13987. @item NB_CONSUMED_SAMPLES
  13988. The number of consumed samples, not including the current frame (only
  13989. audio)
  13990. @item NB_SAMPLES, S
  13991. The number of samples in the current frame (only audio)
  13992. @item SAMPLE_RATE, SR
  13993. The audio sample rate.
  13994. @item STARTPTS
  13995. The PTS of the first frame.
  13996. @item STARTT
  13997. the time in seconds of the first frame
  13998. @item INTERLACED
  13999. State whether the current frame is interlaced.
  14000. @item T
  14001. the time in seconds of the current frame
  14002. @item POS
  14003. original position in the file of the frame, or undefined if undefined
  14004. for the current frame
  14005. @item PREV_INPTS
  14006. The previous input PTS.
  14007. @item PREV_INT
  14008. previous input time in seconds
  14009. @item PREV_OUTPTS
  14010. The previous output PTS.
  14011. @item PREV_OUTT
  14012. previous output time in seconds
  14013. @item RTCTIME
  14014. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14015. instead.
  14016. @item RTCSTART
  14017. The wallclock (RTC) time at the start of the movie in microseconds.
  14018. @item TB
  14019. The timebase of the input timestamps.
  14020. @end table
  14021. @subsection Examples
  14022. @itemize
  14023. @item
  14024. Start counting PTS from zero
  14025. @example
  14026. setpts=PTS-STARTPTS
  14027. @end example
  14028. @item
  14029. Apply fast motion effect:
  14030. @example
  14031. setpts=0.5*PTS
  14032. @end example
  14033. @item
  14034. Apply slow motion effect:
  14035. @example
  14036. setpts=2.0*PTS
  14037. @end example
  14038. @item
  14039. Set fixed rate of 25 frames per second:
  14040. @example
  14041. setpts=N/(25*TB)
  14042. @end example
  14043. @item
  14044. Set fixed rate 25 fps with some jitter:
  14045. @example
  14046. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14047. @end example
  14048. @item
  14049. Apply an offset of 10 seconds to the input PTS:
  14050. @example
  14051. setpts=PTS+10/TB
  14052. @end example
  14053. @item
  14054. Generate timestamps from a "live source" and rebase onto the current timebase:
  14055. @example
  14056. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14057. @end example
  14058. @item
  14059. Generate timestamps by counting samples:
  14060. @example
  14061. asetpts=N/SR/TB
  14062. @end example
  14063. @end itemize
  14064. @section settb, asettb
  14065. Set the timebase to use for the output frames timestamps.
  14066. It is mainly useful for testing timebase configuration.
  14067. It accepts the following parameters:
  14068. @table @option
  14069. @item expr, tb
  14070. The expression which is evaluated into the output timebase.
  14071. @end table
  14072. The value for @option{tb} is an arithmetic expression representing a
  14073. rational. The expression can contain the constants "AVTB" (the default
  14074. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14075. audio only). Default value is "intb".
  14076. @subsection Examples
  14077. @itemize
  14078. @item
  14079. Set the timebase to 1/25:
  14080. @example
  14081. settb=expr=1/25
  14082. @end example
  14083. @item
  14084. Set the timebase to 1/10:
  14085. @example
  14086. settb=expr=0.1
  14087. @end example
  14088. @item
  14089. Set the timebase to 1001/1000:
  14090. @example
  14091. settb=1+0.001
  14092. @end example
  14093. @item
  14094. Set the timebase to 2*intb:
  14095. @example
  14096. settb=2*intb
  14097. @end example
  14098. @item
  14099. Set the default timebase value:
  14100. @example
  14101. settb=AVTB
  14102. @end example
  14103. @end itemize
  14104. @section showcqt
  14105. Convert input audio to a video output representing frequency spectrum
  14106. logarithmically using Brown-Puckette constant Q transform algorithm with
  14107. direct frequency domain coefficient calculation (but the transform itself
  14108. is not really constant Q, instead the Q factor is actually variable/clamped),
  14109. with musical tone scale, from E0 to D#10.
  14110. The filter accepts the following options:
  14111. @table @option
  14112. @item size, s
  14113. Specify the video size for the output. It must be even. For the syntax of this option,
  14114. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14115. Default value is @code{1920x1080}.
  14116. @item fps, rate, r
  14117. Set the output frame rate. Default value is @code{25}.
  14118. @item bar_h
  14119. Set the bargraph height. It must be even. Default value is @code{-1} which
  14120. computes the bargraph height automatically.
  14121. @item axis_h
  14122. Set the axis height. It must be even. Default value is @code{-1} which computes
  14123. the axis height automatically.
  14124. @item sono_h
  14125. Set the sonogram height. It must be even. Default value is @code{-1} which
  14126. computes the sonogram height automatically.
  14127. @item fullhd
  14128. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14129. instead. Default value is @code{1}.
  14130. @item sono_v, volume
  14131. Specify the sonogram volume expression. It can contain variables:
  14132. @table @option
  14133. @item bar_v
  14134. the @var{bar_v} evaluated expression
  14135. @item frequency, freq, f
  14136. the frequency where it is evaluated
  14137. @item timeclamp, tc
  14138. the value of @var{timeclamp} option
  14139. @end table
  14140. and functions:
  14141. @table @option
  14142. @item a_weighting(f)
  14143. A-weighting of equal loudness
  14144. @item b_weighting(f)
  14145. B-weighting of equal loudness
  14146. @item c_weighting(f)
  14147. C-weighting of equal loudness.
  14148. @end table
  14149. Default value is @code{16}.
  14150. @item bar_v, volume2
  14151. Specify the bargraph volume expression. It can contain variables:
  14152. @table @option
  14153. @item sono_v
  14154. the @var{sono_v} evaluated expression
  14155. @item frequency, freq, f
  14156. the frequency where it is evaluated
  14157. @item timeclamp, tc
  14158. the value of @var{timeclamp} option
  14159. @end table
  14160. and functions:
  14161. @table @option
  14162. @item a_weighting(f)
  14163. A-weighting of equal loudness
  14164. @item b_weighting(f)
  14165. B-weighting of equal loudness
  14166. @item c_weighting(f)
  14167. C-weighting of equal loudness.
  14168. @end table
  14169. Default value is @code{sono_v}.
  14170. @item sono_g, gamma
  14171. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14172. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14173. Acceptable range is @code{[1, 7]}.
  14174. @item bar_g, gamma2
  14175. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14176. @code{[1, 7]}.
  14177. @item bar_t
  14178. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14179. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14180. @item timeclamp, tc
  14181. Specify the transform timeclamp. At low frequency, there is trade-off between
  14182. accuracy in time domain and frequency domain. If timeclamp is lower,
  14183. event in time domain is represented more accurately (such as fast bass drum),
  14184. otherwise event in frequency domain is represented more accurately
  14185. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14186. @item attack
  14187. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14188. limits future samples by applying asymmetric windowing in time domain, useful
  14189. when low latency is required. Accepted range is @code{[0, 1]}.
  14190. @item basefreq
  14191. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14192. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14193. @item endfreq
  14194. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14195. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14196. @item coeffclamp
  14197. This option is deprecated and ignored.
  14198. @item tlength
  14199. Specify the transform length in time domain. Use this option to control accuracy
  14200. trade-off between time domain and frequency domain at every frequency sample.
  14201. It can contain variables:
  14202. @table @option
  14203. @item frequency, freq, f
  14204. the frequency where it is evaluated
  14205. @item timeclamp, tc
  14206. the value of @var{timeclamp} option.
  14207. @end table
  14208. Default value is @code{384*tc/(384+tc*f)}.
  14209. @item count
  14210. Specify the transform count for every video frame. Default value is @code{6}.
  14211. Acceptable range is @code{[1, 30]}.
  14212. @item fcount
  14213. Specify the transform count for every single pixel. Default value is @code{0},
  14214. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14215. @item fontfile
  14216. Specify font file for use with freetype to draw the axis. If not specified,
  14217. use embedded font. Note that drawing with font file or embedded font is not
  14218. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14219. option instead.
  14220. @item font
  14221. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14222. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14223. @item fontcolor
  14224. Specify font color expression. This is arithmetic expression that should return
  14225. integer value 0xRRGGBB. It can contain variables:
  14226. @table @option
  14227. @item frequency, freq, f
  14228. the frequency where it is evaluated
  14229. @item timeclamp, tc
  14230. the value of @var{timeclamp} option
  14231. @end table
  14232. and functions:
  14233. @table @option
  14234. @item midi(f)
  14235. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14236. @item r(x), g(x), b(x)
  14237. red, green, and blue value of intensity x.
  14238. @end table
  14239. Default value is @code{st(0, (midi(f)-59.5)/12);
  14240. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14241. r(1-ld(1)) + b(ld(1))}.
  14242. @item axisfile
  14243. Specify image file to draw the axis. This option override @var{fontfile} and
  14244. @var{fontcolor} option.
  14245. @item axis, text
  14246. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14247. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14248. Default value is @code{1}.
  14249. @item csp
  14250. Set colorspace. The accepted values are:
  14251. @table @samp
  14252. @item unspecified
  14253. Unspecified (default)
  14254. @item bt709
  14255. BT.709
  14256. @item fcc
  14257. FCC
  14258. @item bt470bg
  14259. BT.470BG or BT.601-6 625
  14260. @item smpte170m
  14261. SMPTE-170M or BT.601-6 525
  14262. @item smpte240m
  14263. SMPTE-240M
  14264. @item bt2020ncl
  14265. BT.2020 with non-constant luminance
  14266. @end table
  14267. @item cscheme
  14268. Set spectrogram color scheme. This is list of floating point values with format
  14269. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14270. The default is @code{1|0.5|0|0|0.5|1}.
  14271. @end table
  14272. @subsection Examples
  14273. @itemize
  14274. @item
  14275. Playing audio while showing the spectrum:
  14276. @example
  14277. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14278. @end example
  14279. @item
  14280. Same as above, but with frame rate 30 fps:
  14281. @example
  14282. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14283. @end example
  14284. @item
  14285. Playing at 1280x720:
  14286. @example
  14287. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14288. @end example
  14289. @item
  14290. Disable sonogram display:
  14291. @example
  14292. sono_h=0
  14293. @end example
  14294. @item
  14295. A1 and its harmonics: A1, A2, (near)E3, A3:
  14296. @example
  14297. 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),
  14298. asplit[a][out1]; [a] showcqt [out0]'
  14299. @end example
  14300. @item
  14301. Same as above, but with more accuracy in frequency domain:
  14302. @example
  14303. 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),
  14304. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14305. @end example
  14306. @item
  14307. Custom volume:
  14308. @example
  14309. bar_v=10:sono_v=bar_v*a_weighting(f)
  14310. @end example
  14311. @item
  14312. Custom gamma, now spectrum is linear to the amplitude.
  14313. @example
  14314. bar_g=2:sono_g=2
  14315. @end example
  14316. @item
  14317. Custom tlength equation:
  14318. @example
  14319. 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)))'
  14320. @end example
  14321. @item
  14322. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14323. @example
  14324. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14325. @end example
  14326. @item
  14327. Custom font using fontconfig:
  14328. @example
  14329. font='Courier New,Monospace,mono|bold'
  14330. @end example
  14331. @item
  14332. Custom frequency range with custom axis using image file:
  14333. @example
  14334. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14335. @end example
  14336. @end itemize
  14337. @section showfreqs
  14338. Convert input audio to video output representing the audio power spectrum.
  14339. Audio amplitude is on Y-axis while frequency is on X-axis.
  14340. The filter accepts the following options:
  14341. @table @option
  14342. @item size, s
  14343. Specify size of video. For the syntax of this option, check the
  14344. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14345. Default is @code{1024x512}.
  14346. @item mode
  14347. Set display mode.
  14348. This set how each frequency bin will be represented.
  14349. It accepts the following values:
  14350. @table @samp
  14351. @item line
  14352. @item bar
  14353. @item dot
  14354. @end table
  14355. Default is @code{bar}.
  14356. @item ascale
  14357. Set amplitude scale.
  14358. It accepts the following values:
  14359. @table @samp
  14360. @item lin
  14361. Linear scale.
  14362. @item sqrt
  14363. Square root scale.
  14364. @item cbrt
  14365. Cubic root scale.
  14366. @item log
  14367. Logarithmic scale.
  14368. @end table
  14369. Default is @code{log}.
  14370. @item fscale
  14371. Set frequency scale.
  14372. It accepts the following values:
  14373. @table @samp
  14374. @item lin
  14375. Linear scale.
  14376. @item log
  14377. Logarithmic scale.
  14378. @item rlog
  14379. Reverse logarithmic scale.
  14380. @end table
  14381. Default is @code{lin}.
  14382. @item win_size
  14383. Set window size.
  14384. It accepts the following values:
  14385. @table @samp
  14386. @item w16
  14387. @item w32
  14388. @item w64
  14389. @item w128
  14390. @item w256
  14391. @item w512
  14392. @item w1024
  14393. @item w2048
  14394. @item w4096
  14395. @item w8192
  14396. @item w16384
  14397. @item w32768
  14398. @item w65536
  14399. @end table
  14400. Default is @code{w2048}
  14401. @item win_func
  14402. Set windowing function.
  14403. It accepts the following values:
  14404. @table @samp
  14405. @item rect
  14406. @item bartlett
  14407. @item hanning
  14408. @item hamming
  14409. @item blackman
  14410. @item welch
  14411. @item flattop
  14412. @item bharris
  14413. @item bnuttall
  14414. @item bhann
  14415. @item sine
  14416. @item nuttall
  14417. @item lanczos
  14418. @item gauss
  14419. @item tukey
  14420. @item dolph
  14421. @item cauchy
  14422. @item parzen
  14423. @item poisson
  14424. @end table
  14425. Default is @code{hanning}.
  14426. @item overlap
  14427. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14428. which means optimal overlap for selected window function will be picked.
  14429. @item averaging
  14430. Set time averaging. Setting this to 0 will display current maximal peaks.
  14431. Default is @code{1}, which means time averaging is disabled.
  14432. @item colors
  14433. Specify list of colors separated by space or by '|' which will be used to
  14434. draw channel frequencies. Unrecognized or missing colors will be replaced
  14435. by white color.
  14436. @item cmode
  14437. Set channel display mode.
  14438. It accepts the following values:
  14439. @table @samp
  14440. @item combined
  14441. @item separate
  14442. @end table
  14443. Default is @code{combined}.
  14444. @item minamp
  14445. Set minimum amplitude used in @code{log} amplitude scaler.
  14446. @end table
  14447. @anchor{showspectrum}
  14448. @section showspectrum
  14449. Convert input audio to a video output, representing the audio frequency
  14450. spectrum.
  14451. The filter accepts the following options:
  14452. @table @option
  14453. @item size, s
  14454. Specify the video size for the output. For the syntax of this option, check the
  14455. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14456. Default value is @code{640x512}.
  14457. @item slide
  14458. Specify how the spectrum should slide along the window.
  14459. It accepts the following values:
  14460. @table @samp
  14461. @item replace
  14462. the samples start again on the left when they reach the right
  14463. @item scroll
  14464. the samples scroll from right to left
  14465. @item fullframe
  14466. frames are only produced when the samples reach the right
  14467. @item rscroll
  14468. the samples scroll from left to right
  14469. @end table
  14470. Default value is @code{replace}.
  14471. @item mode
  14472. Specify display mode.
  14473. It accepts the following values:
  14474. @table @samp
  14475. @item combined
  14476. all channels are displayed in the same row
  14477. @item separate
  14478. all channels are displayed in separate rows
  14479. @end table
  14480. Default value is @samp{combined}.
  14481. @item color
  14482. Specify display color mode.
  14483. It accepts the following values:
  14484. @table @samp
  14485. @item channel
  14486. each channel is displayed in a separate color
  14487. @item intensity
  14488. each channel is displayed using the same color scheme
  14489. @item rainbow
  14490. each channel is displayed using the rainbow color scheme
  14491. @item moreland
  14492. each channel is displayed using the moreland color scheme
  14493. @item nebulae
  14494. each channel is displayed using the nebulae color scheme
  14495. @item fire
  14496. each channel is displayed using the fire color scheme
  14497. @item fiery
  14498. each channel is displayed using the fiery color scheme
  14499. @item fruit
  14500. each channel is displayed using the fruit color scheme
  14501. @item cool
  14502. each channel is displayed using the cool color scheme
  14503. @end table
  14504. Default value is @samp{channel}.
  14505. @item scale
  14506. Specify scale used for calculating intensity color values.
  14507. It accepts the following values:
  14508. @table @samp
  14509. @item lin
  14510. linear
  14511. @item sqrt
  14512. square root, default
  14513. @item cbrt
  14514. cubic root
  14515. @item log
  14516. logarithmic
  14517. @item 4thrt
  14518. 4th root
  14519. @item 5thrt
  14520. 5th root
  14521. @end table
  14522. Default value is @samp{sqrt}.
  14523. @item saturation
  14524. Set saturation modifier for displayed colors. Negative values provide
  14525. alternative color scheme. @code{0} is no saturation at all.
  14526. Saturation must be in [-10.0, 10.0] range.
  14527. Default value is @code{1}.
  14528. @item win_func
  14529. Set window function.
  14530. It accepts the following values:
  14531. @table @samp
  14532. @item rect
  14533. @item bartlett
  14534. @item hann
  14535. @item hanning
  14536. @item hamming
  14537. @item blackman
  14538. @item welch
  14539. @item flattop
  14540. @item bharris
  14541. @item bnuttall
  14542. @item bhann
  14543. @item sine
  14544. @item nuttall
  14545. @item lanczos
  14546. @item gauss
  14547. @item tukey
  14548. @item dolph
  14549. @item cauchy
  14550. @item parzen
  14551. @item poisson
  14552. @end table
  14553. Default value is @code{hann}.
  14554. @item orientation
  14555. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14556. @code{horizontal}. Default is @code{vertical}.
  14557. @item overlap
  14558. Set ratio of overlap window. Default value is @code{0}.
  14559. When value is @code{1} overlap is set to recommended size for specific
  14560. window function currently used.
  14561. @item gain
  14562. Set scale gain for calculating intensity color values.
  14563. Default value is @code{1}.
  14564. @item data
  14565. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14566. @item rotation
  14567. Set color rotation, must be in [-1.0, 1.0] range.
  14568. Default value is @code{0}.
  14569. @end table
  14570. The usage is very similar to the showwaves filter; see the examples in that
  14571. section.
  14572. @subsection Examples
  14573. @itemize
  14574. @item
  14575. Large window with logarithmic color scaling:
  14576. @example
  14577. showspectrum=s=1280x480:scale=log
  14578. @end example
  14579. @item
  14580. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14581. @example
  14582. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14583. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14584. @end example
  14585. @end itemize
  14586. @section showspectrumpic
  14587. Convert input audio to a single video frame, representing the audio frequency
  14588. spectrum.
  14589. The filter accepts the following options:
  14590. @table @option
  14591. @item size, s
  14592. Specify the video size for the output. For the syntax of this option, check the
  14593. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14594. Default value is @code{4096x2048}.
  14595. @item mode
  14596. Specify display mode.
  14597. It accepts the following values:
  14598. @table @samp
  14599. @item combined
  14600. all channels are displayed in the same row
  14601. @item separate
  14602. all channels are displayed in separate rows
  14603. @end table
  14604. Default value is @samp{combined}.
  14605. @item color
  14606. Specify display color mode.
  14607. It accepts the following values:
  14608. @table @samp
  14609. @item channel
  14610. each channel is displayed in a separate color
  14611. @item intensity
  14612. each channel is displayed using the same color scheme
  14613. @item rainbow
  14614. each channel is displayed using the rainbow color scheme
  14615. @item moreland
  14616. each channel is displayed using the moreland color scheme
  14617. @item nebulae
  14618. each channel is displayed using the nebulae color scheme
  14619. @item fire
  14620. each channel is displayed using the fire color scheme
  14621. @item fiery
  14622. each channel is displayed using the fiery color scheme
  14623. @item fruit
  14624. each channel is displayed using the fruit color scheme
  14625. @item cool
  14626. each channel is displayed using the cool color scheme
  14627. @end table
  14628. Default value is @samp{intensity}.
  14629. @item scale
  14630. Specify scale used for calculating intensity color values.
  14631. It accepts the following values:
  14632. @table @samp
  14633. @item lin
  14634. linear
  14635. @item sqrt
  14636. square root, default
  14637. @item cbrt
  14638. cubic root
  14639. @item log
  14640. logarithmic
  14641. @item 4thrt
  14642. 4th root
  14643. @item 5thrt
  14644. 5th root
  14645. @end table
  14646. Default value is @samp{log}.
  14647. @item saturation
  14648. Set saturation modifier for displayed colors. Negative values provide
  14649. alternative color scheme. @code{0} is no saturation at all.
  14650. Saturation must be in [-10.0, 10.0] range.
  14651. Default value is @code{1}.
  14652. @item win_func
  14653. Set window function.
  14654. It accepts the following values:
  14655. @table @samp
  14656. @item rect
  14657. @item bartlett
  14658. @item hann
  14659. @item hanning
  14660. @item hamming
  14661. @item blackman
  14662. @item welch
  14663. @item flattop
  14664. @item bharris
  14665. @item bnuttall
  14666. @item bhann
  14667. @item sine
  14668. @item nuttall
  14669. @item lanczos
  14670. @item gauss
  14671. @item tukey
  14672. @item dolph
  14673. @item cauchy
  14674. @item parzen
  14675. @item poisson
  14676. @end table
  14677. Default value is @code{hann}.
  14678. @item orientation
  14679. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14680. @code{horizontal}. Default is @code{vertical}.
  14681. @item gain
  14682. Set scale gain for calculating intensity color values.
  14683. Default value is @code{1}.
  14684. @item legend
  14685. Draw time and frequency axes and legends. Default is enabled.
  14686. @item rotation
  14687. Set color rotation, must be in [-1.0, 1.0] range.
  14688. Default value is @code{0}.
  14689. @end table
  14690. @subsection Examples
  14691. @itemize
  14692. @item
  14693. Extract an audio spectrogram of a whole audio track
  14694. in a 1024x1024 picture using @command{ffmpeg}:
  14695. @example
  14696. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14697. @end example
  14698. @end itemize
  14699. @section showvolume
  14700. Convert input audio volume to a video output.
  14701. The filter accepts the following options:
  14702. @table @option
  14703. @item rate, r
  14704. Set video rate.
  14705. @item b
  14706. Set border width, allowed range is [0, 5]. Default is 1.
  14707. @item w
  14708. Set channel width, allowed range is [80, 8192]. Default is 400.
  14709. @item h
  14710. Set channel height, allowed range is [1, 900]. Default is 20.
  14711. @item f
  14712. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14713. @item c
  14714. Set volume color expression.
  14715. The expression can use the following variables:
  14716. @table @option
  14717. @item VOLUME
  14718. Current max volume of channel in dB.
  14719. @item PEAK
  14720. Current peak.
  14721. @item CHANNEL
  14722. Current channel number, starting from 0.
  14723. @end table
  14724. @item t
  14725. If set, displays channel names. Default is enabled.
  14726. @item v
  14727. If set, displays volume values. Default is enabled.
  14728. @item o
  14729. Set orientation, can be @code{horizontal} or @code{vertical},
  14730. default is @code{horizontal}.
  14731. @item s
  14732. Set step size, allowed range s [0, 5]. Default is 0, which means
  14733. step is disabled.
  14734. @end table
  14735. @section showwaves
  14736. Convert input audio to a video output, representing the samples waves.
  14737. The filter accepts the following options:
  14738. @table @option
  14739. @item size, s
  14740. Specify the video size for the output. For the syntax of this option, check the
  14741. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14742. Default value is @code{600x240}.
  14743. @item mode
  14744. Set display mode.
  14745. Available values are:
  14746. @table @samp
  14747. @item point
  14748. Draw a point for each sample.
  14749. @item line
  14750. Draw a vertical line for each sample.
  14751. @item p2p
  14752. Draw a point for each sample and a line between them.
  14753. @item cline
  14754. Draw a centered vertical line for each sample.
  14755. @end table
  14756. Default value is @code{point}.
  14757. @item n
  14758. Set the number of samples which are printed on the same column. A
  14759. larger value will decrease the frame rate. Must be a positive
  14760. integer. This option can be set only if the value for @var{rate}
  14761. is not explicitly specified.
  14762. @item rate, r
  14763. Set the (approximate) output frame rate. This is done by setting the
  14764. option @var{n}. Default value is "25".
  14765. @item split_channels
  14766. Set if channels should be drawn separately or overlap. Default value is 0.
  14767. @item colors
  14768. Set colors separated by '|' which are going to be used for drawing of each channel.
  14769. @item scale
  14770. Set amplitude scale.
  14771. Available values are:
  14772. @table @samp
  14773. @item lin
  14774. Linear.
  14775. @item log
  14776. Logarithmic.
  14777. @item sqrt
  14778. Square root.
  14779. @item cbrt
  14780. Cubic root.
  14781. @end table
  14782. Default is linear.
  14783. @end table
  14784. @subsection Examples
  14785. @itemize
  14786. @item
  14787. Output the input file audio and the corresponding video representation
  14788. at the same time:
  14789. @example
  14790. amovie=a.mp3,asplit[out0],showwaves[out1]
  14791. @end example
  14792. @item
  14793. Create a synthetic signal and show it with showwaves, forcing a
  14794. frame rate of 30 frames per second:
  14795. @example
  14796. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14797. @end example
  14798. @end itemize
  14799. @section showwavespic
  14800. Convert input audio to a single video frame, representing the samples waves.
  14801. The filter accepts the following options:
  14802. @table @option
  14803. @item size, s
  14804. Specify the video size for the output. For the syntax of this option, check the
  14805. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14806. Default value is @code{600x240}.
  14807. @item split_channels
  14808. Set if channels should be drawn separately or overlap. Default value is 0.
  14809. @item colors
  14810. Set colors separated by '|' which are going to be used for drawing of each channel.
  14811. @item scale
  14812. Set amplitude scale.
  14813. Available values are:
  14814. @table @samp
  14815. @item lin
  14816. Linear.
  14817. @item log
  14818. Logarithmic.
  14819. @item sqrt
  14820. Square root.
  14821. @item cbrt
  14822. Cubic root.
  14823. @end table
  14824. Default is linear.
  14825. @end table
  14826. @subsection Examples
  14827. @itemize
  14828. @item
  14829. Extract a channel split representation of the wave form of a whole audio track
  14830. in a 1024x800 picture using @command{ffmpeg}:
  14831. @example
  14832. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14833. @end example
  14834. @end itemize
  14835. @section sidedata, asidedata
  14836. Delete frame side data, or select frames based on it.
  14837. This filter accepts the following options:
  14838. @table @option
  14839. @item mode
  14840. Set mode of operation of the filter.
  14841. Can be one of the following:
  14842. @table @samp
  14843. @item select
  14844. Select every frame with side data of @code{type}.
  14845. @item delete
  14846. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14847. data in the frame.
  14848. @end table
  14849. @item type
  14850. Set side data type used with all modes. Must be set for @code{select} mode. For
  14851. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14852. in @file{libavutil/frame.h}. For example, to choose
  14853. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14854. @end table
  14855. @section spectrumsynth
  14856. Sythesize audio from 2 input video spectrums, first input stream represents
  14857. magnitude across time and second represents phase across time.
  14858. The filter will transform from frequency domain as displayed in videos back
  14859. to time domain as presented in audio output.
  14860. This filter is primarily created for reversing processed @ref{showspectrum}
  14861. filter outputs, but can synthesize sound from other spectrograms too.
  14862. But in such case results are going to be poor if the phase data is not
  14863. available, because in such cases phase data need to be recreated, usually
  14864. its just recreated from random noise.
  14865. For best results use gray only output (@code{channel} color mode in
  14866. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14867. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14868. @code{data} option. Inputs videos should generally use @code{fullframe}
  14869. slide mode as that saves resources needed for decoding video.
  14870. The filter accepts the following options:
  14871. @table @option
  14872. @item sample_rate
  14873. Specify sample rate of output audio, the sample rate of audio from which
  14874. spectrum was generated may differ.
  14875. @item channels
  14876. Set number of channels represented in input video spectrums.
  14877. @item scale
  14878. Set scale which was used when generating magnitude input spectrum.
  14879. Can be @code{lin} or @code{log}. Default is @code{log}.
  14880. @item slide
  14881. Set slide which was used when generating inputs spectrums.
  14882. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14883. Default is @code{fullframe}.
  14884. @item win_func
  14885. Set window function used for resynthesis.
  14886. @item overlap
  14887. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14888. which means optimal overlap for selected window function will be picked.
  14889. @item orientation
  14890. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14891. Default is @code{vertical}.
  14892. @end table
  14893. @subsection Examples
  14894. @itemize
  14895. @item
  14896. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14897. then resynthesize videos back to audio with spectrumsynth:
  14898. @example
  14899. 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
  14900. 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
  14901. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14902. @end example
  14903. @end itemize
  14904. @section split, asplit
  14905. Split input into several identical outputs.
  14906. @code{asplit} works with audio input, @code{split} with video.
  14907. The filter accepts a single parameter which specifies the number of outputs. If
  14908. unspecified, it defaults to 2.
  14909. @subsection Examples
  14910. @itemize
  14911. @item
  14912. Create two separate outputs from the same input:
  14913. @example
  14914. [in] split [out0][out1]
  14915. @end example
  14916. @item
  14917. To create 3 or more outputs, you need to specify the number of
  14918. outputs, like in:
  14919. @example
  14920. [in] asplit=3 [out0][out1][out2]
  14921. @end example
  14922. @item
  14923. Create two separate outputs from the same input, one cropped and
  14924. one padded:
  14925. @example
  14926. [in] split [splitout1][splitout2];
  14927. [splitout1] crop=100:100:0:0 [cropout];
  14928. [splitout2] pad=200:200:100:100 [padout];
  14929. @end example
  14930. @item
  14931. Create 5 copies of the input audio with @command{ffmpeg}:
  14932. @example
  14933. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14934. @end example
  14935. @end itemize
  14936. @section zmq, azmq
  14937. Receive commands sent through a libzmq client, and forward them to
  14938. filters in the filtergraph.
  14939. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14940. must be inserted between two video filters, @code{azmq} between two
  14941. audio filters.
  14942. To enable these filters you need to install the libzmq library and
  14943. headers and configure FFmpeg with @code{--enable-libzmq}.
  14944. For more information about libzmq see:
  14945. @url{http://www.zeromq.org/}
  14946. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14947. receives messages sent through a network interface defined by the
  14948. @option{bind_address} option.
  14949. The received message must be in the form:
  14950. @example
  14951. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14952. @end example
  14953. @var{TARGET} specifies the target of the command, usually the name of
  14954. the filter class or a specific filter instance name.
  14955. @var{COMMAND} specifies the name of the command for the target filter.
  14956. @var{ARG} is optional and specifies the optional argument list for the
  14957. given @var{COMMAND}.
  14958. Upon reception, the message is processed and the corresponding command
  14959. is injected into the filtergraph. Depending on the result, the filter
  14960. will send a reply to the client, adopting the format:
  14961. @example
  14962. @var{ERROR_CODE} @var{ERROR_REASON}
  14963. @var{MESSAGE}
  14964. @end example
  14965. @var{MESSAGE} is optional.
  14966. @subsection Examples
  14967. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14968. be used to send commands processed by these filters.
  14969. Consider the following filtergraph generated by @command{ffplay}
  14970. @example
  14971. ffplay -dumpgraph 1 -f lavfi "
  14972. color=s=100x100:c=red [l];
  14973. color=s=100x100:c=blue [r];
  14974. nullsrc=s=200x100, zmq [bg];
  14975. [bg][l] overlay [bg+l];
  14976. [bg+l][r] overlay=x=100 "
  14977. @end example
  14978. To change the color of the left side of the video, the following
  14979. command can be used:
  14980. @example
  14981. echo Parsed_color_0 c yellow | tools/zmqsend
  14982. @end example
  14983. To change the right side:
  14984. @example
  14985. echo Parsed_color_1 c pink | tools/zmqsend
  14986. @end example
  14987. @c man end MULTIMEDIA FILTERS
  14988. @chapter Multimedia Sources
  14989. @c man begin MULTIMEDIA SOURCES
  14990. Below is a description of the currently available multimedia sources.
  14991. @section amovie
  14992. This is the same as @ref{movie} source, except it selects an audio
  14993. stream by default.
  14994. @anchor{movie}
  14995. @section movie
  14996. Read audio and/or video stream(s) from a movie container.
  14997. It accepts the following parameters:
  14998. @table @option
  14999. @item filename
  15000. The name of the resource to read (not necessarily a file; it can also be a
  15001. device or a stream accessed through some protocol).
  15002. @item format_name, f
  15003. Specifies the format assumed for the movie to read, and can be either
  15004. the name of a container or an input device. If not specified, the
  15005. format is guessed from @var{movie_name} or by probing.
  15006. @item seek_point, sp
  15007. Specifies the seek point in seconds. The frames will be output
  15008. starting from this seek point. The parameter is evaluated with
  15009. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15010. postfix. The default value is "0".
  15011. @item streams, s
  15012. Specifies the streams to read. Several streams can be specified,
  15013. separated by "+". The source will then have as many outputs, in the
  15014. same order. The syntax is explained in the ``Stream specifiers''
  15015. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15016. respectively the default (best suited) video and audio stream. Default
  15017. is "dv", or "da" if the filter is called as "amovie".
  15018. @item stream_index, si
  15019. Specifies the index of the video stream to read. If the value is -1,
  15020. the most suitable video stream will be automatically selected. The default
  15021. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15022. audio instead of video.
  15023. @item loop
  15024. Specifies how many times to read the stream in sequence.
  15025. If the value is 0, the stream will be looped infinitely.
  15026. Default value is "1".
  15027. Note that when the movie is looped the source timestamps are not
  15028. changed, so it will generate non monotonically increasing timestamps.
  15029. @item discontinuity
  15030. Specifies the time difference between frames above which the point is
  15031. considered a timestamp discontinuity which is removed by adjusting the later
  15032. timestamps.
  15033. @end table
  15034. It allows overlaying a second video on top of the main input of
  15035. a filtergraph, as shown in this graph:
  15036. @example
  15037. input -----------> deltapts0 --> overlay --> output
  15038. ^
  15039. |
  15040. movie --> scale--> deltapts1 -------+
  15041. @end example
  15042. @subsection Examples
  15043. @itemize
  15044. @item
  15045. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15046. on top of the input labelled "in":
  15047. @example
  15048. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15049. [in] setpts=PTS-STARTPTS [main];
  15050. [main][over] overlay=16:16 [out]
  15051. @end example
  15052. @item
  15053. Read from a video4linux2 device, and overlay it on top of the input
  15054. labelled "in":
  15055. @example
  15056. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15057. [in] setpts=PTS-STARTPTS [main];
  15058. [main][over] overlay=16:16 [out]
  15059. @end example
  15060. @item
  15061. Read the first video stream and the audio stream with id 0x81 from
  15062. dvd.vob; the video is connected to the pad named "video" and the audio is
  15063. connected to the pad named "audio":
  15064. @example
  15065. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15066. @end example
  15067. @end itemize
  15068. @subsection Commands
  15069. Both movie and amovie support the following commands:
  15070. @table @option
  15071. @item seek
  15072. Perform seek using "av_seek_frame".
  15073. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15074. @itemize
  15075. @item
  15076. @var{stream_index}: If stream_index is -1, a default
  15077. stream is selected, and @var{timestamp} is automatically converted
  15078. from AV_TIME_BASE units to the stream specific time_base.
  15079. @item
  15080. @var{timestamp}: Timestamp in AVStream.time_base units
  15081. or, if no stream is specified, in AV_TIME_BASE units.
  15082. @item
  15083. @var{flags}: Flags which select direction and seeking mode.
  15084. @end itemize
  15085. @item get_duration
  15086. Get movie duration in AV_TIME_BASE units.
  15087. @end table
  15088. @c man end MULTIMEDIA SOURCES