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.

18558 lines
493KB

  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{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.
  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{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. See @code{ffmpeg -filters} to view which filters have timeline support.
  248. @c man end FILTERGRAPH DESCRIPTION
  249. @chapter Audio Filters
  250. @c man begin AUDIO FILTERS
  251. When you configure your FFmpeg build, you can disable any of the
  252. existing filters using @code{--disable-filters}.
  253. The configure output will show the audio filters included in your
  254. build.
  255. Below is a description of the currently available audio filters.
  256. @section acompressor
  257. A compressor is mainly used to reduce the dynamic range of a signal.
  258. Especially modern music is mostly compressed at a high ratio to
  259. improve the overall loudness. It's done to get the highest attention
  260. of a listener, "fatten" the sound and bring more "power" to the track.
  261. If a signal is compressed too much it may sound dull or "dead"
  262. afterwards or it may start to "pump" (which could be a powerful effect
  263. but can also destroy a track completely).
  264. The right compression is the key to reach a professional sound and is
  265. the high art of mixing and mastering. Because of its complex settings
  266. it may take a long time to get the right feeling for this kind of effect.
  267. Compression is done by detecting the volume above a chosen level
  268. @code{threshold} and dividing it by the factor set with @code{ratio}.
  269. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  270. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  271. the signal would cause distortion of the waveform the reduction can be
  272. levelled over the time. This is done by setting "Attack" and "Release".
  273. @code{attack} determines how long the signal has to rise above the threshold
  274. before any reduction will occur and @code{release} sets the time the signal
  275. has to fall below the threshold to reduce the reduction again. Shorter signals
  276. than the chosen attack time will be left untouched.
  277. The overall reduction of the signal can be made up afterwards with the
  278. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  279. raising the makeup to this level results in a signal twice as loud than the
  280. source. To gain a softer entry in the compression the @code{knee} flattens the
  281. hard edge at the threshold in the range of the chosen decibels.
  282. The filter accepts the following options:
  283. @table @option
  284. @item level_in
  285. Set input gain. Default is 1. Range is between 0.015625 and 64.
  286. @item threshold
  287. If a signal of second stream rises above this level it will affect the gain
  288. reduction of the first stream.
  289. By default it is 0.125. Range is between 0.00097563 and 1.
  290. @item ratio
  291. Set a ratio by which the signal is reduced. 1:2 means that if the level
  292. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  293. Default is 2. Range is between 1 and 20.
  294. @item attack
  295. Amount of milliseconds the signal has to rise above the threshold before gain
  296. reduction starts. Default is 20. Range is between 0.01 and 2000.
  297. @item release
  298. Amount of milliseconds the signal has to fall below the threshold before
  299. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  300. @item makeup
  301. Set the amount by how much signal will be amplified after processing.
  302. Default is 2. Range is from 1 and 64.
  303. @item knee
  304. Curve the sharp knee around the threshold to enter gain reduction more softly.
  305. Default is 2.82843. Range is between 1 and 8.
  306. @item link
  307. Choose if the @code{average} level between all channels of input stream
  308. or the louder(@code{maximum}) channel of input stream affects the
  309. reduction. Default is @code{average}.
  310. @item detection
  311. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  312. of @code{rms}. Default is @code{rms} which is mostly smoother.
  313. @item mix
  314. How much to use compressed signal in output. Default is 1.
  315. Range is between 0 and 1.
  316. @end table
  317. @section acrossfade
  318. Apply cross fade from one input audio stream to another input audio stream.
  319. The cross fade is applied for specified duration near the end of first stream.
  320. The filter accepts the following options:
  321. @table @option
  322. @item nb_samples, ns
  323. Specify the number of samples for which the cross fade effect has to last.
  324. At the end of the cross fade effect the first input audio will be completely
  325. silent. Default is 44100.
  326. @item duration, d
  327. Specify the duration of the cross fade effect. See
  328. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  329. for the accepted syntax.
  330. By default the duration is determined by @var{nb_samples}.
  331. If set this option is used instead of @var{nb_samples}.
  332. @item overlap, o
  333. Should first stream end overlap with second stream start. Default is enabled.
  334. @item curve1
  335. Set curve for cross fade transition for first stream.
  336. @item curve2
  337. Set curve for cross fade transition for second stream.
  338. For description of available curve types see @ref{afade} filter description.
  339. @end table
  340. @subsection Examples
  341. @itemize
  342. @item
  343. Cross fade from one input to another:
  344. @example
  345. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  346. @end example
  347. @item
  348. Cross fade from one input to another but without overlapping:
  349. @example
  350. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  351. @end example
  352. @end itemize
  353. @section acrusher
  354. Reduce audio bit resolution.
  355. This filter is bit crusher with enhanced functionality. A bit crusher
  356. is used to audibly reduce number of bits an audio signal is sampled
  357. with. This doesn't change the bit depth at all, it just produces the
  358. effect. Material reduced in bit depth sounds more harsh and "digital".
  359. This filter is able to even round to continuous values instead of discrete
  360. bit depths.
  361. Additionally it has a D/C offset which results in different crushing of
  362. the lower and the upper half of the signal.
  363. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  364. Another feature of this filter is the logarithmic mode.
  365. This setting switches from linear distances between bits to logarithmic ones.
  366. The result is a much more "natural" sounding crusher which doesn't gate low
  367. signals for example. The human ear has a logarithmic perception, too
  368. so this kind of crushing is much more pleasant.
  369. Logarithmic crushing is also able to get anti-aliased.
  370. The filter accepts the following options:
  371. @table @option
  372. @item level_in
  373. Set level in.
  374. @item level_out
  375. Set level out.
  376. @item bits
  377. Set bit reduction.
  378. @item mix
  379. Set mixing amount.
  380. @item mode
  381. Can be linear: @code{lin} or logarithmic: @code{log}.
  382. @item dc
  383. Set DC.
  384. @item aa
  385. Set anti-aliasing.
  386. @item samples
  387. Set sample reduction.
  388. @item lfo
  389. Enable LFO. By default disabled.
  390. @item lforange
  391. Set LFO range.
  392. @item lforate
  393. Set LFO rate.
  394. @end table
  395. @section adelay
  396. Delay one or more audio channels.
  397. Samples in delayed channel are filled with silence.
  398. The filter accepts the following option:
  399. @table @option
  400. @item delays
  401. Set list of delays in milliseconds for each channel separated by '|'.
  402. At least one delay greater than 0 should be provided.
  403. Unused delays will be silently ignored. If number of given delays is
  404. smaller than number of channels all remaining channels will not be delayed.
  405. If you want to delay exact number of samples, append 'S' to number.
  406. @end table
  407. @subsection Examples
  408. @itemize
  409. @item
  410. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  411. the second channel (and any other channels that may be present) unchanged.
  412. @example
  413. adelay=1500|0|500
  414. @end example
  415. @item
  416. Delay second channel by 500 samples, the third channel by 700 samples and leave
  417. the first channel (and any other channels that may be present) unchanged.
  418. @example
  419. adelay=0|500S|700S
  420. @end example
  421. @end itemize
  422. @section aecho
  423. Apply echoing to the input audio.
  424. Echoes are reflected sound and can occur naturally amongst mountains
  425. (and sometimes large buildings) when talking or shouting; digital echo
  426. effects emulate this behaviour and are often used to help fill out the
  427. sound of a single instrument or vocal. The time difference between the
  428. original signal and the reflection is the @code{delay}, and the
  429. loudness of the reflected signal is the @code{decay}.
  430. Multiple echoes can have different delays and decays.
  431. A description of the accepted parameters follows.
  432. @table @option
  433. @item in_gain
  434. Set input gain of reflected signal. Default is @code{0.6}.
  435. @item out_gain
  436. Set output gain of reflected signal. Default is @code{0.3}.
  437. @item delays
  438. Set list of time intervals in milliseconds between original signal and reflections
  439. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  440. Default is @code{1000}.
  441. @item decays
  442. Set list of loudnesses of reflected signals separated by '|'.
  443. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  444. Default is @code{0.5}.
  445. @end table
  446. @subsection Examples
  447. @itemize
  448. @item
  449. Make it sound as if there are twice as many instruments as are actually playing:
  450. @example
  451. aecho=0.8:0.88:60:0.4
  452. @end example
  453. @item
  454. If delay is very short, then it sound like a (metallic) robot playing music:
  455. @example
  456. aecho=0.8:0.88:6:0.4
  457. @end example
  458. @item
  459. A longer delay will sound like an open air concert in the mountains:
  460. @example
  461. aecho=0.8:0.9:1000:0.3
  462. @end example
  463. @item
  464. Same as above but with one more mountain:
  465. @example
  466. aecho=0.8:0.9:1000|1800:0.3|0.25
  467. @end example
  468. @end itemize
  469. @section aemphasis
  470. Audio emphasis filter creates or restores material directly taken from LPs or
  471. emphased CDs with different filter curves. E.g. to store music on vinyl the
  472. signal has to be altered by a filter first to even out the disadvantages of
  473. this recording medium.
  474. Once the material is played back the inverse filter has to be applied to
  475. restore the distortion of the frequency response.
  476. The filter accepts the following options:
  477. @table @option
  478. @item level_in
  479. Set input gain.
  480. @item level_out
  481. Set output gain.
  482. @item mode
  483. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  484. use @code{production} mode. Default is @code{reproduction} mode.
  485. @item type
  486. Set filter type. Selects medium. Can be one of the following:
  487. @table @option
  488. @item col
  489. select Columbia.
  490. @item emi
  491. select EMI.
  492. @item bsi
  493. select BSI (78RPM).
  494. @item riaa
  495. select RIAA.
  496. @item cd
  497. select Compact Disc (CD).
  498. @item 50fm
  499. select 50µs (FM).
  500. @item 75fm
  501. select 75µs (FM).
  502. @item 50kf
  503. select 50µs (FM-KF).
  504. @item 75kf
  505. select 75µs (FM-KF).
  506. @end table
  507. @end table
  508. @section aeval
  509. Modify an audio signal according to the specified expressions.
  510. This filter accepts one or more expressions (one for each channel),
  511. which are evaluated and used to modify a corresponding audio signal.
  512. It accepts the following parameters:
  513. @table @option
  514. @item exprs
  515. Set the '|'-separated expressions list for each separate channel. If
  516. the number of input channels is greater than the number of
  517. expressions, the last specified expression is used for the remaining
  518. output channels.
  519. @item channel_layout, c
  520. Set output channel layout. If not specified, the channel layout is
  521. specified by the number of expressions. If set to @samp{same}, it will
  522. use by default the same input channel layout.
  523. @end table
  524. Each expression in @var{exprs} can contain the following constants and functions:
  525. @table @option
  526. @item ch
  527. channel number of the current expression
  528. @item n
  529. number of the evaluated sample, starting from 0
  530. @item s
  531. sample rate
  532. @item t
  533. time of the evaluated sample expressed in seconds
  534. @item nb_in_channels
  535. @item nb_out_channels
  536. input and output number of channels
  537. @item val(CH)
  538. the value of input channel with number @var{CH}
  539. @end table
  540. Note: this filter is slow. For faster processing you should use a
  541. dedicated filter.
  542. @subsection Examples
  543. @itemize
  544. @item
  545. Half volume:
  546. @example
  547. aeval=val(ch)/2:c=same
  548. @end example
  549. @item
  550. Invert phase of the second channel:
  551. @example
  552. aeval=val(0)|-val(1)
  553. @end example
  554. @end itemize
  555. @anchor{afade}
  556. @section afade
  557. Apply fade-in/out effect to input audio.
  558. A description of the accepted parameters follows.
  559. @table @option
  560. @item type, t
  561. Specify the effect type, can be either @code{in} for fade-in, or
  562. @code{out} for a fade-out effect. Default is @code{in}.
  563. @item start_sample, ss
  564. Specify the number of the start sample for starting to apply the fade
  565. effect. Default is 0.
  566. @item nb_samples, ns
  567. Specify the number of samples for which the fade effect has to last. At
  568. the end of the fade-in effect the output audio will have the same
  569. volume as the input audio, at the end of the fade-out transition
  570. the output audio will be silence. Default is 44100.
  571. @item start_time, st
  572. Specify the start time of the fade effect. Default is 0.
  573. The value must be specified as a time duration; see
  574. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  575. for the accepted syntax.
  576. If set this option is used instead of @var{start_sample}.
  577. @item duration, d
  578. Specify the duration of the fade effect. See
  579. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  580. for the accepted syntax.
  581. At the end of the fade-in effect the output audio will have the same
  582. volume as the input audio, at the end of the fade-out transition
  583. the output audio will be silence.
  584. By default the duration is determined by @var{nb_samples}.
  585. If set this option is used instead of @var{nb_samples}.
  586. @item curve
  587. Set curve for fade transition.
  588. It accepts the following values:
  589. @table @option
  590. @item tri
  591. select triangular, linear slope (default)
  592. @item qsin
  593. select quarter of sine wave
  594. @item hsin
  595. select half of sine wave
  596. @item esin
  597. select exponential sine wave
  598. @item log
  599. select logarithmic
  600. @item ipar
  601. select inverted parabola
  602. @item qua
  603. select quadratic
  604. @item cub
  605. select cubic
  606. @item squ
  607. select square root
  608. @item cbr
  609. select cubic root
  610. @item par
  611. select parabola
  612. @item exp
  613. select exponential
  614. @item iqsin
  615. select inverted quarter of sine wave
  616. @item ihsin
  617. select inverted half of sine wave
  618. @item dese
  619. select double-exponential seat
  620. @item desi
  621. select double-exponential sigmoid
  622. @end table
  623. @end table
  624. @subsection Examples
  625. @itemize
  626. @item
  627. Fade in first 15 seconds of audio:
  628. @example
  629. afade=t=in:ss=0:d=15
  630. @end example
  631. @item
  632. Fade out last 25 seconds of a 900 seconds audio:
  633. @example
  634. afade=t=out:st=875:d=25
  635. @end example
  636. @end itemize
  637. @section afftfilt
  638. Apply arbitrary expressions to samples in frequency domain.
  639. @table @option
  640. @item real
  641. Set frequency domain real expression for each separate channel separated
  642. by '|'. Default is "1".
  643. If the number of input channels is greater than the number of
  644. expressions, the last specified expression is used for the remaining
  645. output channels.
  646. @item imag
  647. Set frequency domain imaginary expression for each separate channel
  648. separated by '|'. If not set, @var{real} option is used.
  649. Each expression in @var{real} and @var{imag} can contain the following
  650. constants:
  651. @table @option
  652. @item sr
  653. sample rate
  654. @item b
  655. current frequency bin number
  656. @item nb
  657. number of available bins
  658. @item ch
  659. channel number of the current expression
  660. @item chs
  661. number of channels
  662. @item pts
  663. current frame pts
  664. @end table
  665. @item win_size
  666. Set window size.
  667. It accepts the following values:
  668. @table @samp
  669. @item w16
  670. @item w32
  671. @item w64
  672. @item w128
  673. @item w256
  674. @item w512
  675. @item w1024
  676. @item w2048
  677. @item w4096
  678. @item w8192
  679. @item w16384
  680. @item w32768
  681. @item w65536
  682. @end table
  683. Default is @code{w4096}
  684. @item win_func
  685. Set window function. Default is @code{hann}.
  686. @item overlap
  687. Set window overlap. If set to 1, the recommended overlap for selected
  688. window function will be picked. Default is @code{0.75}.
  689. @end table
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Leave almost only low frequencies in audio:
  694. @example
  695. afftfilt="1-clip((b/nb)*b,0,1)"
  696. @end example
  697. @end itemize
  698. @anchor{aformat}
  699. @section aformat
  700. Set output format constraints for the input audio. The framework will
  701. negotiate the most appropriate format to minimize conversions.
  702. It accepts the following parameters:
  703. @table @option
  704. @item sample_fmts
  705. A '|'-separated list of requested sample formats.
  706. @item sample_rates
  707. A '|'-separated list of requested sample rates.
  708. @item channel_layouts
  709. A '|'-separated list of requested channel layouts.
  710. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  711. for the required syntax.
  712. @end table
  713. If a parameter is omitted, all values are allowed.
  714. Force the output to either unsigned 8-bit or signed 16-bit stereo
  715. @example
  716. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  717. @end example
  718. @section agate
  719. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  720. processing reduces disturbing noise between useful signals.
  721. Gating is done by detecting the volume below a chosen level @var{threshold}
  722. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  723. floor is set via @var{range}. Because an exact manipulation of the signal
  724. would cause distortion of the waveform the reduction can be levelled over
  725. time. This is done by setting @var{attack} and @var{release}.
  726. @var{attack} determines how long the signal has to fall below the threshold
  727. before any reduction will occur and @var{release} sets the time the signal
  728. has to rise above the threshold to reduce the reduction again.
  729. Shorter signals than the chosen attack time will be left untouched.
  730. @table @option
  731. @item level_in
  732. Set input level before filtering.
  733. Default is 1. Allowed range is from 0.015625 to 64.
  734. @item range
  735. Set the level of gain reduction when the signal is below the threshold.
  736. Default is 0.06125. Allowed range is from 0 to 1.
  737. @item threshold
  738. If a signal rises above this level the gain reduction is released.
  739. Default is 0.125. Allowed range is from 0 to 1.
  740. @item ratio
  741. Set a ratio by which the signal is reduced.
  742. Default is 2. Allowed range is from 1 to 9000.
  743. @item attack
  744. Amount of milliseconds the signal has to rise above the threshold before gain
  745. reduction stops.
  746. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  747. @item release
  748. Amount of milliseconds the signal has to fall below the threshold before the
  749. reduction is increased again. Default is 250 milliseconds.
  750. Allowed range is from 0.01 to 9000.
  751. @item makeup
  752. Set amount of amplification of signal after processing.
  753. Default is 1. Allowed range is from 1 to 64.
  754. @item knee
  755. Curve the sharp knee around the threshold to enter gain reduction more softly.
  756. Default is 2.828427125. Allowed range is from 1 to 8.
  757. @item detection
  758. Choose if exact signal should be taken for detection or an RMS like one.
  759. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  760. @item link
  761. Choose if the average level between all channels or the louder channel affects
  762. the reduction.
  763. Default is @code{average}. Can be @code{average} or @code{maximum}.
  764. @end table
  765. @section alimiter
  766. The limiter prevents an input signal from rising over a desired threshold.
  767. This limiter uses lookahead technology to prevent your signal from distorting.
  768. It means that there is a small delay after the signal is processed. Keep in mind
  769. that the delay it produces is the attack time you set.
  770. The filter accepts the following options:
  771. @table @option
  772. @item level_in
  773. Set input gain. Default is 1.
  774. @item level_out
  775. Set output gain. Default is 1.
  776. @item limit
  777. Don't let signals above this level pass the limiter. Default is 1.
  778. @item attack
  779. The limiter will reach its attenuation level in this amount of time in
  780. milliseconds. Default is 5 milliseconds.
  781. @item release
  782. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  783. Default is 50 milliseconds.
  784. @item asc
  785. When gain reduction is always needed ASC takes care of releasing to an
  786. average reduction level rather than reaching a reduction of 0 in the release
  787. time.
  788. @item asc_level
  789. Select how much the release time is affected by ASC, 0 means nearly no changes
  790. in release time while 1 produces higher release times.
  791. @item level
  792. Auto level output signal. Default is enabled.
  793. This normalizes audio back to 0dB if enabled.
  794. @end table
  795. Depending on picked setting it is recommended to upsample input 2x or 4x times
  796. with @ref{aresample} before applying this filter.
  797. @section allpass
  798. Apply a two-pole all-pass filter with central frequency (in Hz)
  799. @var{frequency}, and filter-width @var{width}.
  800. An all-pass filter changes the audio's frequency to phase relationship
  801. without changing its frequency to amplitude relationship.
  802. The filter accepts the following options:
  803. @table @option
  804. @item frequency, f
  805. Set frequency in Hz.
  806. @item width_type
  807. Set method to specify band-width of filter.
  808. @table @option
  809. @item h
  810. Hz
  811. @item q
  812. Q-Factor
  813. @item o
  814. octave
  815. @item s
  816. slope
  817. @end table
  818. @item width, w
  819. Specify the band-width of a filter in width_type units.
  820. @item channels, c
  821. Specify which channels to filter, by default all available are filtered.
  822. @end table
  823. @section aloop
  824. Loop audio samples.
  825. The filter accepts the following options:
  826. @table @option
  827. @item loop
  828. Set the number of loops.
  829. @item size
  830. Set maximal number of samples.
  831. @item start
  832. Set first sample of loop.
  833. @end table
  834. @anchor{amerge}
  835. @section amerge
  836. Merge two or more audio streams into a single multi-channel stream.
  837. The filter accepts the following options:
  838. @table @option
  839. @item inputs
  840. Set the number of inputs. Default is 2.
  841. @end table
  842. If the channel layouts of the inputs are disjoint, and therefore compatible,
  843. the channel layout of the output will be set accordingly and the channels
  844. will be reordered as necessary. If the channel layouts of the inputs are not
  845. disjoint, the output will have all the channels of the first input then all
  846. the channels of the second input, in that order, and the channel layout of
  847. the output will be the default value corresponding to the total number of
  848. channels.
  849. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  850. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  851. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  852. first input, b1 is the first channel of the second input).
  853. On the other hand, if both input are in stereo, the output channels will be
  854. in the default order: a1, a2, b1, b2, and the channel layout will be
  855. arbitrarily set to 4.0, which may or may not be the expected value.
  856. All inputs must have the same sample rate, and format.
  857. If inputs do not have the same duration, the output will stop with the
  858. shortest.
  859. @subsection Examples
  860. @itemize
  861. @item
  862. Merge two mono files into a stereo stream:
  863. @example
  864. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  865. @end example
  866. @item
  867. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  868. @example
  869. 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
  870. @end example
  871. @end itemize
  872. @section amix
  873. Mixes multiple audio inputs into a single output.
  874. Note that this filter only supports float samples (the @var{amerge}
  875. and @var{pan} audio filters support many formats). If the @var{amix}
  876. input has integer samples then @ref{aresample} will be automatically
  877. inserted to perform the conversion to float samples.
  878. For example
  879. @example
  880. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  881. @end example
  882. will mix 3 input audio streams to a single output with the same duration as the
  883. first input and a dropout transition time of 3 seconds.
  884. It accepts the following parameters:
  885. @table @option
  886. @item inputs
  887. The number of inputs. If unspecified, it defaults to 2.
  888. @item duration
  889. How to determine the end-of-stream.
  890. @table @option
  891. @item longest
  892. The duration of the longest input. (default)
  893. @item shortest
  894. The duration of the shortest input.
  895. @item first
  896. The duration of the first input.
  897. @end table
  898. @item dropout_transition
  899. The transition time, in seconds, for volume renormalization when an input
  900. stream ends. The default value is 2 seconds.
  901. @end table
  902. @section anequalizer
  903. High-order parametric multiband equalizer for each channel.
  904. It accepts the following parameters:
  905. @table @option
  906. @item params
  907. This option string is in format:
  908. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  909. Each equalizer band is separated by '|'.
  910. @table @option
  911. @item chn
  912. Set channel number to which equalization will be applied.
  913. If input doesn't have that channel the entry is ignored.
  914. @item f
  915. Set central frequency for band.
  916. If input doesn't have that frequency the entry is ignored.
  917. @item w
  918. Set band width in hertz.
  919. @item g
  920. Set band gain in dB.
  921. @item t
  922. Set filter type for band, optional, can be:
  923. @table @samp
  924. @item 0
  925. Butterworth, this is default.
  926. @item 1
  927. Chebyshev type 1.
  928. @item 2
  929. Chebyshev type 2.
  930. @end table
  931. @end table
  932. @item curves
  933. With this option activated frequency response of anequalizer is displayed
  934. in video stream.
  935. @item size
  936. Set video stream size. Only useful if curves option is activated.
  937. @item mgain
  938. Set max gain that will be displayed. Only useful if curves option is activated.
  939. Setting this to a reasonable value makes it possible to display gain which is derived from
  940. neighbour bands which are too close to each other and thus produce higher gain
  941. when both are activated.
  942. @item fscale
  943. Set frequency scale used to draw frequency response in video output.
  944. Can be linear or logarithmic. Default is logarithmic.
  945. @item colors
  946. Set color for each channel curve which is going to be displayed in video stream.
  947. This is list of color names separated by space or by '|'.
  948. Unrecognised or missing colors will be replaced by white color.
  949. @end table
  950. @subsection Examples
  951. @itemize
  952. @item
  953. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  954. for first 2 channels using Chebyshev type 1 filter:
  955. @example
  956. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  957. @end example
  958. @end itemize
  959. @subsection Commands
  960. This filter supports the following commands:
  961. @table @option
  962. @item change
  963. Alter existing filter parameters.
  964. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  965. @var{fN} is existing filter number, starting from 0, if no such filter is available
  966. error is returned.
  967. @var{freq} set new frequency parameter.
  968. @var{width} set new width parameter in herz.
  969. @var{gain} set new gain parameter in dB.
  970. Full filter invocation with asendcmd may look like this:
  971. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  972. @end table
  973. @section anull
  974. Pass the audio source unchanged to the output.
  975. @section apad
  976. Pad the end of an audio stream with silence.
  977. This can be used together with @command{ffmpeg} @option{-shortest} to
  978. extend audio streams to the same length as the video stream.
  979. A description of the accepted options follows.
  980. @table @option
  981. @item packet_size
  982. Set silence packet size. Default value is 4096.
  983. @item pad_len
  984. Set the number of samples of silence to add to the end. After the
  985. value is reached, the stream is terminated. This option is mutually
  986. exclusive with @option{whole_len}.
  987. @item whole_len
  988. Set the minimum total number of samples in the output audio stream. If
  989. the value is longer than the input audio length, silence is added to
  990. the end, until the value is reached. This option is mutually exclusive
  991. with @option{pad_len}.
  992. @end table
  993. If neither the @option{pad_len} nor the @option{whole_len} option is
  994. set, the filter will add silence to the end of the input stream
  995. indefinitely.
  996. @subsection Examples
  997. @itemize
  998. @item
  999. Add 1024 samples of silence to the end of the input:
  1000. @example
  1001. apad=pad_len=1024
  1002. @end example
  1003. @item
  1004. Make sure the audio output will contain at least 10000 samples, pad
  1005. the input with silence if required:
  1006. @example
  1007. apad=whole_len=10000
  1008. @end example
  1009. @item
  1010. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1011. video stream will always result the shortest and will be converted
  1012. until the end in the output file when using the @option{shortest}
  1013. option:
  1014. @example
  1015. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1016. @end example
  1017. @end itemize
  1018. @section aphaser
  1019. Add a phasing effect to the input audio.
  1020. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1021. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1022. A description of the accepted parameters follows.
  1023. @table @option
  1024. @item in_gain
  1025. Set input gain. Default is 0.4.
  1026. @item out_gain
  1027. Set output gain. Default is 0.74
  1028. @item delay
  1029. Set delay in milliseconds. Default is 3.0.
  1030. @item decay
  1031. Set decay. Default is 0.4.
  1032. @item speed
  1033. Set modulation speed in Hz. Default is 0.5.
  1034. @item type
  1035. Set modulation type. Default is triangular.
  1036. It accepts the following values:
  1037. @table @samp
  1038. @item triangular, t
  1039. @item sinusoidal, s
  1040. @end table
  1041. @end table
  1042. @section apulsator
  1043. Audio pulsator is something between an autopanner and a tremolo.
  1044. But it can produce funny stereo effects as well. Pulsator changes the volume
  1045. of the left and right channel based on a LFO (low frequency oscillator) with
  1046. different waveforms and shifted phases.
  1047. This filter have the ability to define an offset between left and right
  1048. channel. An offset of 0 means that both LFO shapes match each other.
  1049. The left and right channel are altered equally - a conventional tremolo.
  1050. An offset of 50% means that the shape of the right channel is exactly shifted
  1051. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1052. an autopanner. At 1 both curves match again. Every setting in between moves the
  1053. phase shift gapless between all stages and produces some "bypassing" sounds with
  1054. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1055. the 0.5) the faster the signal passes from the left to the right speaker.
  1056. The filter accepts the following options:
  1057. @table @option
  1058. @item level_in
  1059. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1060. @item level_out
  1061. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1062. @item mode
  1063. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1064. sawup or sawdown. Default is sine.
  1065. @item amount
  1066. Set modulation. Define how much of original signal is affected by the LFO.
  1067. @item offset_l
  1068. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1069. @item offset_r
  1070. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1071. @item width
  1072. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1073. @item timing
  1074. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1075. @item bpm
  1076. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1077. is set to bpm.
  1078. @item ms
  1079. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1080. is set to ms.
  1081. @item hz
  1082. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1083. if timing is set to hz.
  1084. @end table
  1085. @anchor{aresample}
  1086. @section aresample
  1087. Resample the input audio to the specified parameters, using the
  1088. libswresample library. If none are specified then the filter will
  1089. automatically convert between its input and output.
  1090. This filter is also able to stretch/squeeze the audio data to make it match
  1091. the timestamps or to inject silence / cut out audio to make it match the
  1092. timestamps, do a combination of both or do neither.
  1093. The filter accepts the syntax
  1094. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1095. expresses a sample rate and @var{resampler_options} is a list of
  1096. @var{key}=@var{value} pairs, separated by ":". See the
  1097. @ref{Resampler Options,,the "Resampler Options" section in the
  1098. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1099. for the complete list of supported options.
  1100. @subsection Examples
  1101. @itemize
  1102. @item
  1103. Resample the input audio to 44100Hz:
  1104. @example
  1105. aresample=44100
  1106. @end example
  1107. @item
  1108. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1109. samples per second compensation:
  1110. @example
  1111. aresample=async=1000
  1112. @end example
  1113. @end itemize
  1114. @section areverse
  1115. Reverse an audio clip.
  1116. Warning: This filter requires memory to buffer the entire clip, so trimming
  1117. is suggested.
  1118. @subsection Examples
  1119. @itemize
  1120. @item
  1121. Take the first 5 seconds of a clip, and reverse it.
  1122. @example
  1123. atrim=end=5,areverse
  1124. @end example
  1125. @end itemize
  1126. @section asetnsamples
  1127. Set the number of samples per each output audio frame.
  1128. The last output packet may contain a different number of samples, as
  1129. the filter will flush all the remaining samples when the input audio
  1130. signals its end.
  1131. The filter accepts the following options:
  1132. @table @option
  1133. @item nb_out_samples, n
  1134. Set the number of frames per each output audio frame. The number is
  1135. intended as the number of samples @emph{per each channel}.
  1136. Default value is 1024.
  1137. @item pad, p
  1138. If set to 1, the filter will pad the last audio frame with zeroes, so
  1139. that the last frame will contain the same number of samples as the
  1140. previous ones. Default value is 1.
  1141. @end table
  1142. For example, to set the number of per-frame samples to 1234 and
  1143. disable padding for the last frame, use:
  1144. @example
  1145. asetnsamples=n=1234:p=0
  1146. @end example
  1147. @section asetrate
  1148. Set the sample rate without altering the PCM data.
  1149. This will result in a change of speed and pitch.
  1150. The filter accepts the following options:
  1151. @table @option
  1152. @item sample_rate, r
  1153. Set the output sample rate. Default is 44100 Hz.
  1154. @end table
  1155. @section ashowinfo
  1156. Show a line containing various information for each input audio frame.
  1157. The input audio is not modified.
  1158. The shown line contains a sequence of key/value pairs of the form
  1159. @var{key}:@var{value}.
  1160. The following values are shown in the output:
  1161. @table @option
  1162. @item n
  1163. The (sequential) number of the input frame, starting from 0.
  1164. @item pts
  1165. The presentation timestamp of the input frame, in time base units; the time base
  1166. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1167. @item pts_time
  1168. The presentation timestamp of the input frame in seconds.
  1169. @item pos
  1170. position of the frame in the input stream, -1 if this information in
  1171. unavailable and/or meaningless (for example in case of synthetic audio)
  1172. @item fmt
  1173. The sample format.
  1174. @item chlayout
  1175. The channel layout.
  1176. @item rate
  1177. The sample rate for the audio frame.
  1178. @item nb_samples
  1179. The number of samples (per channel) in the frame.
  1180. @item checksum
  1181. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1182. audio, the data is treated as if all the planes were concatenated.
  1183. @item plane_checksums
  1184. A list of Adler-32 checksums for each data plane.
  1185. @end table
  1186. @anchor{astats}
  1187. @section astats
  1188. Display time domain statistical information about the audio channels.
  1189. Statistics are calculated and displayed for each audio channel and,
  1190. where applicable, an overall figure is also given.
  1191. It accepts the following option:
  1192. @table @option
  1193. @item length
  1194. Short window length in seconds, used for peak and trough RMS measurement.
  1195. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1196. @item metadata
  1197. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1198. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1199. disabled.
  1200. Available keys for each channel are:
  1201. DC_offset
  1202. Min_level
  1203. Max_level
  1204. Min_difference
  1205. Max_difference
  1206. Mean_difference
  1207. Peak_level
  1208. RMS_peak
  1209. RMS_trough
  1210. Crest_factor
  1211. Flat_factor
  1212. Peak_count
  1213. Bit_depth
  1214. and for Overall:
  1215. DC_offset
  1216. Min_level
  1217. Max_level
  1218. Min_difference
  1219. Max_difference
  1220. Mean_difference
  1221. Peak_level
  1222. RMS_level
  1223. RMS_peak
  1224. RMS_trough
  1225. Flat_factor
  1226. Peak_count
  1227. Bit_depth
  1228. Number_of_samples
  1229. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1230. this @code{lavfi.astats.Overall.Peak_count}.
  1231. For description what each key means read below.
  1232. @item reset
  1233. Set number of frame after which stats are going to be recalculated.
  1234. Default is disabled.
  1235. @end table
  1236. A description of each shown parameter follows:
  1237. @table @option
  1238. @item DC offset
  1239. Mean amplitude displacement from zero.
  1240. @item Min level
  1241. Minimal sample level.
  1242. @item Max level
  1243. Maximal sample level.
  1244. @item Min difference
  1245. Minimal difference between two consecutive samples.
  1246. @item Max difference
  1247. Maximal difference between two consecutive samples.
  1248. @item Mean difference
  1249. Mean difference between two consecutive samples.
  1250. The average of each difference between two consecutive samples.
  1251. @item Peak level dB
  1252. @item RMS level dB
  1253. Standard peak and RMS level measured in dBFS.
  1254. @item RMS peak dB
  1255. @item RMS trough dB
  1256. Peak and trough values for RMS level measured over a short window.
  1257. @item Crest factor
  1258. Standard ratio of peak to RMS level (note: not in dB).
  1259. @item Flat factor
  1260. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1261. (i.e. either @var{Min level} or @var{Max level}).
  1262. @item Peak count
  1263. Number of occasions (not the number of samples) that the signal attained either
  1264. @var{Min level} or @var{Max level}.
  1265. @item Bit depth
  1266. Overall bit depth of audio. Number of bits used for each sample.
  1267. @end table
  1268. @section atempo
  1269. Adjust audio tempo.
  1270. The filter accepts exactly one parameter, the audio tempo. If not
  1271. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1272. be in the [0.5, 2.0] range.
  1273. @subsection Examples
  1274. @itemize
  1275. @item
  1276. Slow down audio to 80% tempo:
  1277. @example
  1278. atempo=0.8
  1279. @end example
  1280. @item
  1281. To speed up audio to 125% tempo:
  1282. @example
  1283. atempo=1.25
  1284. @end example
  1285. @end itemize
  1286. @section atrim
  1287. Trim the input so that the output contains one continuous subpart of the input.
  1288. It accepts the following parameters:
  1289. @table @option
  1290. @item start
  1291. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1292. sample with the timestamp @var{start} will be the first sample in the output.
  1293. @item end
  1294. Specify time of the first audio sample that will be dropped, i.e. the
  1295. audio sample immediately preceding the one with the timestamp @var{end} will be
  1296. the last sample in the output.
  1297. @item start_pts
  1298. Same as @var{start}, except this option sets the start timestamp in samples
  1299. instead of seconds.
  1300. @item end_pts
  1301. Same as @var{end}, except this option sets the end timestamp in samples instead
  1302. of seconds.
  1303. @item duration
  1304. The maximum duration of the output in seconds.
  1305. @item start_sample
  1306. The number of the first sample that should be output.
  1307. @item end_sample
  1308. The number of the first sample that should be dropped.
  1309. @end table
  1310. @option{start}, @option{end}, and @option{duration} are expressed as time
  1311. duration specifications; see
  1312. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1313. Note that the first two sets of the start/end options and the @option{duration}
  1314. option look at the frame timestamp, while the _sample options simply count the
  1315. samples that pass through the filter. So start/end_pts and start/end_sample will
  1316. give different results when the timestamps are wrong, inexact or do not start at
  1317. zero. Also note that this filter does not modify the timestamps. If you wish
  1318. to have the output timestamps start at zero, insert the asetpts filter after the
  1319. atrim filter.
  1320. If multiple start or end options are set, this filter tries to be greedy and
  1321. keep all samples that match at least one of the specified constraints. To keep
  1322. only the part that matches all the constraints at once, chain multiple atrim
  1323. filters.
  1324. The defaults are such that all the input is kept. So it is possible to set e.g.
  1325. just the end values to keep everything before the specified time.
  1326. Examples:
  1327. @itemize
  1328. @item
  1329. Drop everything except the second minute of input:
  1330. @example
  1331. ffmpeg -i INPUT -af atrim=60:120
  1332. @end example
  1333. @item
  1334. Keep only the first 1000 samples:
  1335. @example
  1336. ffmpeg -i INPUT -af atrim=end_sample=1000
  1337. @end example
  1338. @end itemize
  1339. @section bandpass
  1340. Apply a two-pole Butterworth band-pass filter with central
  1341. frequency @var{frequency}, and (3dB-point) band-width width.
  1342. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1343. instead of the default: constant 0dB peak gain.
  1344. The filter roll off at 6dB per octave (20dB per decade).
  1345. The filter accepts the following options:
  1346. @table @option
  1347. @item frequency, f
  1348. Set the filter's central frequency. Default is @code{3000}.
  1349. @item csg
  1350. Constant skirt gain if set to 1. Defaults to 0.
  1351. @item width_type
  1352. Set method to specify band-width of filter.
  1353. @table @option
  1354. @item h
  1355. Hz
  1356. @item q
  1357. Q-Factor
  1358. @item o
  1359. octave
  1360. @item s
  1361. slope
  1362. @end table
  1363. @item width, w
  1364. Specify the band-width of a filter in width_type units.
  1365. @item channels, c
  1366. Specify which channels to filter, by default all available are filtered.
  1367. @end table
  1368. @section bandreject
  1369. Apply a two-pole Butterworth band-reject filter with central
  1370. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1371. The filter roll off at 6dB per octave (20dB per decade).
  1372. The filter accepts the following options:
  1373. @table @option
  1374. @item frequency, f
  1375. Set the filter's central frequency. Default is @code{3000}.
  1376. @item width_type
  1377. Set method to specify band-width of filter.
  1378. @table @option
  1379. @item h
  1380. Hz
  1381. @item q
  1382. Q-Factor
  1383. @item o
  1384. octave
  1385. @item s
  1386. slope
  1387. @end table
  1388. @item width, w
  1389. Specify the band-width of a filter in width_type units.
  1390. @item channels, c
  1391. Specify which channels to filter, by default all available are filtered.
  1392. @end table
  1393. @section bass
  1394. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1395. shelving filter with a response similar to that of a standard
  1396. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1397. The filter accepts the following options:
  1398. @table @option
  1399. @item gain, g
  1400. Give the gain at 0 Hz. Its useful range is about -20
  1401. (for a large cut) to +20 (for a large boost).
  1402. Beware of clipping when using a positive gain.
  1403. @item frequency, f
  1404. Set the filter's central frequency and so can be used
  1405. to extend or reduce the frequency range to be boosted or cut.
  1406. The default value is @code{100} Hz.
  1407. @item width_type
  1408. Set method to specify band-width of filter.
  1409. @table @option
  1410. @item h
  1411. Hz
  1412. @item q
  1413. Q-Factor
  1414. @item o
  1415. octave
  1416. @item s
  1417. slope
  1418. @end table
  1419. @item width, w
  1420. Determine how steep is the filter's shelf transition.
  1421. @item channels, c
  1422. Specify which channels to filter, by default all available are filtered.
  1423. @end table
  1424. @section biquad
  1425. Apply a biquad IIR filter with the given coefficients.
  1426. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1427. are the numerator and denominator coefficients respectively.
  1428. and @var{channels}, @var{c} specify which channels to filter, by default all
  1429. available are filtered.
  1430. @section bs2b
  1431. Bauer stereo to binaural transformation, which improves headphone listening of
  1432. stereo audio records.
  1433. It accepts the following parameters:
  1434. @table @option
  1435. @item profile
  1436. Pre-defined crossfeed level.
  1437. @table @option
  1438. @item default
  1439. Default level (fcut=700, feed=50).
  1440. @item cmoy
  1441. Chu Moy circuit (fcut=700, feed=60).
  1442. @item jmeier
  1443. Jan Meier circuit (fcut=650, feed=95).
  1444. @end table
  1445. @item fcut
  1446. Cut frequency (in Hz).
  1447. @item feed
  1448. Feed level (in Hz).
  1449. @end table
  1450. @section channelmap
  1451. Remap input channels to new locations.
  1452. It accepts the following parameters:
  1453. @table @option
  1454. @item map
  1455. Map channels from input to output. The argument is a '|'-separated list of
  1456. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1457. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1458. channel (e.g. FL for front left) or its index in the input channel layout.
  1459. @var{out_channel} is the name of the output channel or its index in the output
  1460. channel layout. If @var{out_channel} is not given then it is implicitly an
  1461. index, starting with zero and increasing by one for each mapping.
  1462. @item channel_layout
  1463. The channel layout of the output stream.
  1464. @end table
  1465. If no mapping is present, the filter will implicitly map input channels to
  1466. output channels, preserving indices.
  1467. For example, assuming a 5.1+downmix input MOV file,
  1468. @example
  1469. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1470. @end example
  1471. will create an output WAV file tagged as stereo from the downmix channels of
  1472. the input.
  1473. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1474. @example
  1475. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1476. @end example
  1477. @section channelsplit
  1478. Split each channel from an input audio stream into a separate output stream.
  1479. It accepts the following parameters:
  1480. @table @option
  1481. @item channel_layout
  1482. The channel layout of the input stream. The default is "stereo".
  1483. @end table
  1484. For example, assuming a stereo input MP3 file,
  1485. @example
  1486. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1487. @end example
  1488. will create an output Matroska file with two audio streams, one containing only
  1489. the left channel and the other the right channel.
  1490. Split a 5.1 WAV file into per-channel files:
  1491. @example
  1492. ffmpeg -i in.wav -filter_complex
  1493. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1494. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1495. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1496. side_right.wav
  1497. @end example
  1498. @section chorus
  1499. Add a chorus effect to the audio.
  1500. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1501. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1502. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1503. The modulation depth defines the range the modulated delay is played before or after
  1504. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1505. sound tuned around the original one, like in a chorus where some vocals are slightly
  1506. off key.
  1507. It accepts the following parameters:
  1508. @table @option
  1509. @item in_gain
  1510. Set input gain. Default is 0.4.
  1511. @item out_gain
  1512. Set output gain. Default is 0.4.
  1513. @item delays
  1514. Set delays. A typical delay is around 40ms to 60ms.
  1515. @item decays
  1516. Set decays.
  1517. @item speeds
  1518. Set speeds.
  1519. @item depths
  1520. Set depths.
  1521. @end table
  1522. @subsection Examples
  1523. @itemize
  1524. @item
  1525. A single delay:
  1526. @example
  1527. chorus=0.7:0.9:55:0.4:0.25:2
  1528. @end example
  1529. @item
  1530. Two delays:
  1531. @example
  1532. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1533. @end example
  1534. @item
  1535. Fuller sounding chorus with three delays:
  1536. @example
  1537. 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
  1538. @end example
  1539. @end itemize
  1540. @section compand
  1541. Compress or expand the audio's dynamic range.
  1542. It accepts the following parameters:
  1543. @table @option
  1544. @item attacks
  1545. @item decays
  1546. A list of times in seconds for each channel over which the instantaneous level
  1547. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1548. increase of volume and @var{decays} refers to decrease of volume. For most
  1549. situations, the attack time (response to the audio getting louder) should be
  1550. shorter than the decay time, because the human ear is more sensitive to sudden
  1551. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1552. a typical value for decay is 0.8 seconds.
  1553. If specified number of attacks & decays is lower than number of channels, the last
  1554. set attack/decay will be used for all remaining channels.
  1555. @item points
  1556. A list of points for the transfer function, specified in dB relative to the
  1557. maximum possible signal amplitude. Each key points list must be defined using
  1558. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1559. @code{x0/y0 x1/y1 x2/y2 ....}
  1560. The input values must be in strictly increasing order but the transfer function
  1561. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1562. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1563. function are @code{-70/-70|-60/-20}.
  1564. @item soft-knee
  1565. Set the curve radius in dB for all joints. It defaults to 0.01.
  1566. @item gain
  1567. Set the additional gain in dB to be applied at all points on the transfer
  1568. function. This allows for easy adjustment of the overall gain.
  1569. It defaults to 0.
  1570. @item volume
  1571. Set an initial volume, in dB, to be assumed for each channel when filtering
  1572. starts. This permits the user to supply a nominal level initially, so that, for
  1573. example, a very large gain is not applied to initial signal levels before the
  1574. companding has begun to operate. A typical value for audio which is initially
  1575. quiet is -90 dB. It defaults to 0.
  1576. @item delay
  1577. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1578. delayed before being fed to the volume adjuster. Specifying a delay
  1579. approximately equal to the attack/decay times allows the filter to effectively
  1580. operate in predictive rather than reactive mode. It defaults to 0.
  1581. @end table
  1582. @subsection Examples
  1583. @itemize
  1584. @item
  1585. Make music with both quiet and loud passages suitable for listening to in a
  1586. noisy environment:
  1587. @example
  1588. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1589. @end example
  1590. Another example for audio with whisper and explosion parts:
  1591. @example
  1592. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1593. @end example
  1594. @item
  1595. A noise gate for when the noise is at a lower level than the signal:
  1596. @example
  1597. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1598. @end example
  1599. @item
  1600. Here is another noise gate, this time for when the noise is at a higher level
  1601. than the signal (making it, in some ways, similar to squelch):
  1602. @example
  1603. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1604. @end example
  1605. @item
  1606. 2:1 compression starting at -6dB:
  1607. @example
  1608. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1609. @end example
  1610. @item
  1611. 2:1 compression starting at -9dB:
  1612. @example
  1613. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1614. @end example
  1615. @item
  1616. 2:1 compression starting at -12dB:
  1617. @example
  1618. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1619. @end example
  1620. @item
  1621. 2:1 compression starting at -18dB:
  1622. @example
  1623. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1624. @end example
  1625. @item
  1626. 3:1 compression starting at -15dB:
  1627. @example
  1628. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1629. @end example
  1630. @item
  1631. Compressor/Gate:
  1632. @example
  1633. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1634. @end example
  1635. @item
  1636. Expander:
  1637. @example
  1638. 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
  1639. @end example
  1640. @item
  1641. Hard limiter at -6dB:
  1642. @example
  1643. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1644. @end example
  1645. @item
  1646. Hard limiter at -12dB:
  1647. @example
  1648. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1649. @end example
  1650. @item
  1651. Hard noise gate at -35 dB:
  1652. @example
  1653. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1654. @end example
  1655. @item
  1656. Soft limiter:
  1657. @example
  1658. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1659. @end example
  1660. @end itemize
  1661. @section compensationdelay
  1662. Compensation Delay Line is a metric based delay to compensate differing
  1663. positions of microphones or speakers.
  1664. For example, you have recorded guitar with two microphones placed in
  1665. different location. Because the front of sound wave has fixed speed in
  1666. normal conditions, the phasing of microphones can vary and depends on
  1667. their location and interposition. The best sound mix can be achieved when
  1668. these microphones are in phase (synchronized). Note that distance of
  1669. ~30 cm between microphones makes one microphone to capture signal in
  1670. antiphase to another microphone. That makes the final mix sounding moody.
  1671. This filter helps to solve phasing problems by adding different delays
  1672. to each microphone track and make them synchronized.
  1673. The best result can be reached when you take one track as base and
  1674. synchronize other tracks one by one with it.
  1675. Remember that synchronization/delay tolerance depends on sample rate, too.
  1676. Higher sample rates will give more tolerance.
  1677. It accepts the following parameters:
  1678. @table @option
  1679. @item mm
  1680. Set millimeters distance. This is compensation distance for fine tuning.
  1681. Default is 0.
  1682. @item cm
  1683. Set cm distance. This is compensation distance for tightening distance setup.
  1684. Default is 0.
  1685. @item m
  1686. Set meters distance. This is compensation distance for hard distance setup.
  1687. Default is 0.
  1688. @item dry
  1689. Set dry amount. Amount of unprocessed (dry) signal.
  1690. Default is 0.
  1691. @item wet
  1692. Set wet amount. Amount of processed (wet) signal.
  1693. Default is 1.
  1694. @item temp
  1695. Set temperature degree in Celsius. This is the temperature of the environment.
  1696. Default is 20.
  1697. @end table
  1698. @section crystalizer
  1699. Simple algorithm to expand audio dynamic range.
  1700. The filter accepts the following options:
  1701. @table @option
  1702. @item i
  1703. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1704. (unchanged sound) to 10.0 (maximum effect).
  1705. @item c
  1706. Enable clipping. By default is enabled.
  1707. @end table
  1708. @section dcshift
  1709. Apply a DC shift to the audio.
  1710. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1711. in the recording chain) from the audio. The effect of a DC offset is reduced
  1712. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1713. a signal has a DC offset.
  1714. @table @option
  1715. @item shift
  1716. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1717. the audio.
  1718. @item limitergain
  1719. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1720. used to prevent clipping.
  1721. @end table
  1722. @section dynaudnorm
  1723. Dynamic Audio Normalizer.
  1724. This filter applies a certain amount of gain to the input audio in order
  1725. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1726. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1727. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1728. This allows for applying extra gain to the "quiet" sections of the audio
  1729. while avoiding distortions or clipping the "loud" sections. In other words:
  1730. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1731. sections, in the sense that the volume of each section is brought to the
  1732. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1733. this goal *without* applying "dynamic range compressing". It will retain 100%
  1734. of the dynamic range *within* each section of the audio file.
  1735. @table @option
  1736. @item f
  1737. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1738. Default is 500 milliseconds.
  1739. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1740. referred to as frames. This is required, because a peak magnitude has no
  1741. meaning for just a single sample value. Instead, we need to determine the
  1742. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1743. normalizer would simply use the peak magnitude of the complete file, the
  1744. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1745. frame. The length of a frame is specified in milliseconds. By default, the
  1746. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1747. been found to give good results with most files.
  1748. Note that the exact frame length, in number of samples, will be determined
  1749. automatically, based on the sampling rate of the individual input audio file.
  1750. @item g
  1751. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1752. number. Default is 31.
  1753. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1754. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1755. is specified in frames, centered around the current frame. For the sake of
  1756. simplicity, this must be an odd number. Consequently, the default value of 31
  1757. takes into account the current frame, as well as the 15 preceding frames and
  1758. the 15 subsequent frames. Using a larger window results in a stronger
  1759. smoothing effect and thus in less gain variation, i.e. slower gain
  1760. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1761. effect and thus in more gain variation, i.e. faster gain adaptation.
  1762. In other words, the more you increase this value, the more the Dynamic Audio
  1763. Normalizer will behave like a "traditional" normalization filter. On the
  1764. contrary, the more you decrease this value, the more the Dynamic Audio
  1765. Normalizer will behave like a dynamic range compressor.
  1766. @item p
  1767. Set the target peak value. This specifies the highest permissible magnitude
  1768. level for the normalized audio input. This filter will try to approach the
  1769. target peak magnitude as closely as possible, but at the same time it also
  1770. makes sure that the normalized signal will never exceed the peak magnitude.
  1771. A frame's maximum local gain factor is imposed directly by the target peak
  1772. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1773. It is not recommended to go above this value.
  1774. @item m
  1775. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1776. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1777. factor for each input frame, i.e. the maximum gain factor that does not
  1778. result in clipping or distortion. The maximum gain factor is determined by
  1779. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1780. additionally bounds the frame's maximum gain factor by a predetermined
  1781. (global) maximum gain factor. This is done in order to avoid excessive gain
  1782. factors in "silent" or almost silent frames. By default, the maximum gain
  1783. factor is 10.0, For most inputs the default value should be sufficient and
  1784. it usually is not recommended to increase this value. Though, for input
  1785. with an extremely low overall volume level, it may be necessary to allow even
  1786. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1787. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1788. Instead, a "sigmoid" threshold function will be applied. This way, the
  1789. gain factors will smoothly approach the threshold value, but never exceed that
  1790. value.
  1791. @item r
  1792. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1793. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1794. This means that the maximum local gain factor for each frame is defined
  1795. (only) by the frame's highest magnitude sample. This way, the samples can
  1796. be amplified as much as possible without exceeding the maximum signal
  1797. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1798. Normalizer can also take into account the frame's root mean square,
  1799. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1800. determine the power of a time-varying signal. It is therefore considered
  1801. that the RMS is a better approximation of the "perceived loudness" than
  1802. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1803. frames to a constant RMS value, a uniform "perceived loudness" can be
  1804. established. If a target RMS value has been specified, a frame's local gain
  1805. factor is defined as the factor that would result in exactly that RMS value.
  1806. Note, however, that the maximum local gain factor is still restricted by the
  1807. frame's highest magnitude sample, in order to prevent clipping.
  1808. @item n
  1809. Enable channels coupling. By default is enabled.
  1810. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1811. amount. This means the same gain factor will be applied to all channels, i.e.
  1812. the maximum possible gain factor is determined by the "loudest" channel.
  1813. However, in some recordings, it may happen that the volume of the different
  1814. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1815. In this case, this option can be used to disable the channel coupling. This way,
  1816. the gain factor will be determined independently for each channel, depending
  1817. only on the individual channel's highest magnitude sample. This allows for
  1818. harmonizing the volume of the different channels.
  1819. @item c
  1820. Enable DC bias correction. By default is disabled.
  1821. An audio signal (in the time domain) is a sequence of sample values.
  1822. In the Dynamic Audio Normalizer these sample values are represented in the
  1823. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1824. audio signal, or "waveform", should be centered around the zero point.
  1825. That means if we calculate the mean value of all samples in a file, or in a
  1826. single frame, then the result should be 0.0 or at least very close to that
  1827. value. If, however, there is a significant deviation of the mean value from
  1828. 0.0, in either positive or negative direction, this is referred to as a
  1829. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1830. Audio Normalizer provides optional DC bias correction.
  1831. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1832. the mean value, or "DC correction" offset, of each input frame and subtract
  1833. that value from all of the frame's sample values which ensures those samples
  1834. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1835. boundaries, the DC correction offset values will be interpolated smoothly
  1836. between neighbouring frames.
  1837. @item b
  1838. Enable alternative boundary mode. By default is disabled.
  1839. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1840. around each frame. This includes the preceding frames as well as the
  1841. subsequent frames. However, for the "boundary" frames, located at the very
  1842. beginning and at the very end of the audio file, not all neighbouring
  1843. frames are available. In particular, for the first few frames in the audio
  1844. file, the preceding frames are not known. And, similarly, for the last few
  1845. frames in the audio file, the subsequent frames are not known. Thus, the
  1846. question arises which gain factors should be assumed for the missing frames
  1847. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1848. to deal with this situation. The default boundary mode assumes a gain factor
  1849. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1850. "fade out" at the beginning and at the end of the input, respectively.
  1851. @item s
  1852. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1853. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1854. compression. This means that signal peaks will not be pruned and thus the
  1855. full dynamic range will be retained within each local neighbourhood. However,
  1856. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1857. normalization algorithm with a more "traditional" compression.
  1858. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1859. (thresholding) function. If (and only if) the compression feature is enabled,
  1860. all input frames will be processed by a soft knee thresholding function prior
  1861. to the actual normalization process. Put simply, the thresholding function is
  1862. going to prune all samples whose magnitude exceeds a certain threshold value.
  1863. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1864. value. Instead, the threshold value will be adjusted for each individual
  1865. frame.
  1866. In general, smaller parameters result in stronger compression, and vice versa.
  1867. Values below 3.0 are not recommended, because audible distortion may appear.
  1868. @end table
  1869. @section earwax
  1870. Make audio easier to listen to on headphones.
  1871. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1872. so that when listened to on headphones the stereo image is moved from
  1873. inside your head (standard for headphones) to outside and in front of
  1874. the listener (standard for speakers).
  1875. Ported from SoX.
  1876. @section equalizer
  1877. Apply a two-pole peaking equalisation (EQ) filter. With this
  1878. filter, the signal-level at and around a selected frequency can
  1879. be increased or decreased, whilst (unlike bandpass and bandreject
  1880. filters) that at all other frequencies is unchanged.
  1881. In order to produce complex equalisation curves, this filter can
  1882. be given several times, each with a different central frequency.
  1883. The filter accepts the following options:
  1884. @table @option
  1885. @item frequency, f
  1886. Set the filter's central frequency in Hz.
  1887. @item width_type
  1888. Set method to specify band-width of filter.
  1889. @table @option
  1890. @item h
  1891. Hz
  1892. @item q
  1893. Q-Factor
  1894. @item o
  1895. octave
  1896. @item s
  1897. slope
  1898. @end table
  1899. @item width, w
  1900. Specify the band-width of a filter in width_type units.
  1901. @item gain, g
  1902. Set the required gain or attenuation in dB.
  1903. Beware of clipping when using a positive gain.
  1904. @item channels, c
  1905. Specify which channels to filter, by default all available are filtered.
  1906. @end table
  1907. @subsection Examples
  1908. @itemize
  1909. @item
  1910. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1911. @example
  1912. equalizer=f=1000:width_type=h:width=200:g=-10
  1913. @end example
  1914. @item
  1915. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1916. @example
  1917. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1918. @end example
  1919. @end itemize
  1920. @section extrastereo
  1921. Linearly increases the difference between left and right channels which
  1922. adds some sort of "live" effect to playback.
  1923. The filter accepts the following options:
  1924. @table @option
  1925. @item m
  1926. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1927. (average of both channels), with 1.0 sound will be unchanged, with
  1928. -1.0 left and right channels will be swapped.
  1929. @item c
  1930. Enable clipping. By default is enabled.
  1931. @end table
  1932. @section firequalizer
  1933. Apply FIR Equalization using arbitrary frequency response.
  1934. The filter accepts the following option:
  1935. @table @option
  1936. @item gain
  1937. Set gain curve equation (in dB). The expression can contain variables:
  1938. @table @option
  1939. @item f
  1940. the evaluated frequency
  1941. @item sr
  1942. sample rate
  1943. @item ch
  1944. channel number, set to 0 when multichannels evaluation is disabled
  1945. @item chid
  1946. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1947. multichannels evaluation is disabled
  1948. @item chs
  1949. number of channels
  1950. @item chlayout
  1951. channel_layout, see libavutil/channel_layout.h
  1952. @end table
  1953. and functions:
  1954. @table @option
  1955. @item gain_interpolate(f)
  1956. interpolate gain on frequency f based on gain_entry
  1957. @item cubic_interpolate(f)
  1958. same as gain_interpolate, but smoother
  1959. @end table
  1960. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1961. @item gain_entry
  1962. Set gain entry for gain_interpolate function. The expression can
  1963. contain functions:
  1964. @table @option
  1965. @item entry(f, g)
  1966. store gain entry at frequency f with value g
  1967. @end table
  1968. This option is also available as command.
  1969. @item delay
  1970. Set filter delay in seconds. Higher value means more accurate.
  1971. Default is @code{0.01}.
  1972. @item accuracy
  1973. Set filter accuracy in Hz. Lower value means more accurate.
  1974. Default is @code{5}.
  1975. @item wfunc
  1976. Set window function. Acceptable values are:
  1977. @table @option
  1978. @item rectangular
  1979. rectangular window, useful when gain curve is already smooth
  1980. @item hann
  1981. hann window (default)
  1982. @item hamming
  1983. hamming window
  1984. @item blackman
  1985. blackman window
  1986. @item nuttall3
  1987. 3-terms continuous 1st derivative nuttall window
  1988. @item mnuttall3
  1989. minimum 3-terms discontinuous nuttall window
  1990. @item nuttall
  1991. 4-terms continuous 1st derivative nuttall window
  1992. @item bnuttall
  1993. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1994. @item bharris
  1995. blackman-harris window
  1996. @item tukey
  1997. tukey window
  1998. @end table
  1999. @item fixed
  2000. If enabled, use fixed number of audio samples. This improves speed when
  2001. filtering with large delay. Default is disabled.
  2002. @item multi
  2003. Enable multichannels evaluation on gain. Default is disabled.
  2004. @item zero_phase
  2005. Enable zero phase mode by subtracting timestamp to compensate delay.
  2006. Default is disabled.
  2007. @item scale
  2008. Set scale used by gain. Acceptable values are:
  2009. @table @option
  2010. @item linlin
  2011. linear frequency, linear gain
  2012. @item linlog
  2013. linear frequency, logarithmic (in dB) gain (default)
  2014. @item loglin
  2015. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2016. @item loglog
  2017. logarithmic frequency, logarithmic gain
  2018. @end table
  2019. @item dumpfile
  2020. Set file for dumping, suitable for gnuplot.
  2021. @item dumpscale
  2022. Set scale for dumpfile. Acceptable values are same with scale option.
  2023. Default is linlog.
  2024. @item fft2
  2025. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2026. Default is disabled.
  2027. @end table
  2028. @subsection Examples
  2029. @itemize
  2030. @item
  2031. lowpass at 1000 Hz:
  2032. @example
  2033. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2034. @end example
  2035. @item
  2036. lowpass at 1000 Hz with gain_entry:
  2037. @example
  2038. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2039. @end example
  2040. @item
  2041. custom equalization:
  2042. @example
  2043. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2044. @end example
  2045. @item
  2046. higher delay with zero phase to compensate delay:
  2047. @example
  2048. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2049. @end example
  2050. @item
  2051. lowpass on left channel, highpass on right channel:
  2052. @example
  2053. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2054. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2055. @end example
  2056. @end itemize
  2057. @section flanger
  2058. Apply a flanging effect to the audio.
  2059. The filter accepts the following options:
  2060. @table @option
  2061. @item delay
  2062. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2063. @item depth
  2064. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2065. @item regen
  2066. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2067. Default value is 0.
  2068. @item width
  2069. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2070. Default value is 71.
  2071. @item speed
  2072. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2073. @item shape
  2074. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2075. Default value is @var{sinusoidal}.
  2076. @item phase
  2077. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2078. Default value is 25.
  2079. @item interp
  2080. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2081. Default is @var{linear}.
  2082. @end table
  2083. @section hdcd
  2084. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2085. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2086. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2087. of HDCD, and detects the Transient Filter flag.
  2088. @example
  2089. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2090. @end example
  2091. When using the filter with wav, note the default encoding for wav is 16-bit,
  2092. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2093. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2094. @example
  2095. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2096. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2097. @end example
  2098. The filter accepts the following options:
  2099. @table @option
  2100. @item disable_autoconvert
  2101. Disable any automatic format conversion or resampling in the filter graph.
  2102. @item process_stereo
  2103. Process the stereo channels together. If target_gain does not match between
  2104. channels, consider it invalid and use the last valid target_gain.
  2105. @item cdt_ms
  2106. Set the code detect timer period in ms.
  2107. @item force_pe
  2108. Always extend peaks above -3dBFS even if PE isn't signaled.
  2109. @item analyze_mode
  2110. Replace audio with a solid tone and adjust the amplitude to signal some
  2111. specific aspect of the decoding process. The output file can be loaded in
  2112. an audio editor alongside the original to aid analysis.
  2113. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2114. Modes are:
  2115. @table @samp
  2116. @item 0, off
  2117. Disabled
  2118. @item 1, lle
  2119. Gain adjustment level at each sample
  2120. @item 2, pe
  2121. Samples where peak extend occurs
  2122. @item 3, cdt
  2123. Samples where the code detect timer is active
  2124. @item 4, tgm
  2125. Samples where the target gain does not match between channels
  2126. @end table
  2127. @end table
  2128. @section highpass
  2129. Apply a high-pass filter with 3dB point frequency.
  2130. The filter can be either single-pole, or double-pole (the default).
  2131. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2132. The filter accepts the following options:
  2133. @table @option
  2134. @item frequency, f
  2135. Set frequency in Hz. Default is 3000.
  2136. @item poles, p
  2137. Set number of poles. Default is 2.
  2138. @item width_type
  2139. Set method to specify band-width of filter.
  2140. @table @option
  2141. @item h
  2142. Hz
  2143. @item q
  2144. Q-Factor
  2145. @item o
  2146. octave
  2147. @item s
  2148. slope
  2149. @end table
  2150. @item width, w
  2151. Specify the band-width of a filter in width_type units.
  2152. Applies only to double-pole filter.
  2153. The default is 0.707q and gives a Butterworth response.
  2154. @item channels, c
  2155. Specify which channels to filter, by default all available are filtered.
  2156. @end table
  2157. @section join
  2158. Join multiple input streams into one multi-channel stream.
  2159. It accepts the following parameters:
  2160. @table @option
  2161. @item inputs
  2162. The number of input streams. It defaults to 2.
  2163. @item channel_layout
  2164. The desired output channel layout. It defaults to stereo.
  2165. @item map
  2166. Map channels from inputs to output. The argument is a '|'-separated list of
  2167. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2168. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2169. can be either the name of the input channel (e.g. FL for front left) or its
  2170. index in the specified input stream. @var{out_channel} is the name of the output
  2171. channel.
  2172. @end table
  2173. The filter will attempt to guess the mappings when they are not specified
  2174. explicitly. It does so by first trying to find an unused matching input channel
  2175. and if that fails it picks the first unused input channel.
  2176. Join 3 inputs (with properly set channel layouts):
  2177. @example
  2178. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2179. @end example
  2180. Build a 5.1 output from 6 single-channel streams:
  2181. @example
  2182. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2183. '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'
  2184. out
  2185. @end example
  2186. @section ladspa
  2187. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2188. To enable compilation of this filter you need to configure FFmpeg with
  2189. @code{--enable-ladspa}.
  2190. @table @option
  2191. @item file, f
  2192. Specifies the name of LADSPA plugin library to load. If the environment
  2193. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2194. each one of the directories specified by the colon separated list in
  2195. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2196. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2197. @file{/usr/lib/ladspa/}.
  2198. @item plugin, p
  2199. Specifies the plugin within the library. Some libraries contain only
  2200. one plugin, but others contain many of them. If this is not set filter
  2201. will list all available plugins within the specified library.
  2202. @item controls, c
  2203. Set the '|' separated list of controls which are zero or more floating point
  2204. values that determine the behavior of the loaded plugin (for example delay,
  2205. threshold or gain).
  2206. Controls need to be defined using the following syntax:
  2207. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2208. @var{valuei} is the value set on the @var{i}-th control.
  2209. Alternatively they can be also defined using the following syntax:
  2210. @var{value0}|@var{value1}|@var{value2}|..., where
  2211. @var{valuei} is the value set on the @var{i}-th control.
  2212. If @option{controls} is set to @code{help}, all available controls and
  2213. their valid ranges are printed.
  2214. @item sample_rate, s
  2215. Specify the sample rate, default to 44100. Only used if plugin have
  2216. zero inputs.
  2217. @item nb_samples, n
  2218. Set the number of samples per channel per each output frame, default
  2219. is 1024. Only used if plugin have zero inputs.
  2220. @item duration, d
  2221. Set the minimum duration of the sourced audio. See
  2222. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2223. for the accepted syntax.
  2224. Note that the resulting duration may be greater than the specified duration,
  2225. as the generated audio is always cut at the end of a complete frame.
  2226. If not specified, or the expressed duration is negative, the audio is
  2227. supposed to be generated forever.
  2228. Only used if plugin have zero inputs.
  2229. @end table
  2230. @subsection Examples
  2231. @itemize
  2232. @item
  2233. List all available plugins within amp (LADSPA example plugin) library:
  2234. @example
  2235. ladspa=file=amp
  2236. @end example
  2237. @item
  2238. List all available controls and their valid ranges for @code{vcf_notch}
  2239. plugin from @code{VCF} library:
  2240. @example
  2241. ladspa=f=vcf:p=vcf_notch:c=help
  2242. @end example
  2243. @item
  2244. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2245. plugin library:
  2246. @example
  2247. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2248. @end example
  2249. @item
  2250. Add reverberation to the audio using TAP-plugins
  2251. (Tom's Audio Processing plugins):
  2252. @example
  2253. ladspa=file=tap_reverb:tap_reverb
  2254. @end example
  2255. @item
  2256. Generate white noise, with 0.2 amplitude:
  2257. @example
  2258. ladspa=file=cmt:noise_source_white:c=c0=.2
  2259. @end example
  2260. @item
  2261. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2262. @code{C* Audio Plugin Suite} (CAPS) library:
  2263. @example
  2264. ladspa=file=caps:Click:c=c1=20'
  2265. @end example
  2266. @item
  2267. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2268. @example
  2269. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2270. @end example
  2271. @item
  2272. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2273. @code{SWH Plugins} collection:
  2274. @example
  2275. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2276. @end example
  2277. @item
  2278. Attenuate low frequencies using Multiband EQ from Steve Harris
  2279. @code{SWH Plugins} collection:
  2280. @example
  2281. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2282. @end example
  2283. @end itemize
  2284. @subsection Commands
  2285. This filter supports the following commands:
  2286. @table @option
  2287. @item cN
  2288. Modify the @var{N}-th control value.
  2289. If the specified value is not valid, it is ignored and prior one is kept.
  2290. @end table
  2291. @section loudnorm
  2292. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2293. Support for both single pass (livestreams, files) and double pass (files) modes.
  2294. This algorithm can target IL, LRA, and maximum true peak.
  2295. The filter accepts the following options:
  2296. @table @option
  2297. @item I, i
  2298. Set integrated loudness target.
  2299. Range is -70.0 - -5.0. Default value is -24.0.
  2300. @item LRA, lra
  2301. Set loudness range target.
  2302. Range is 1.0 - 20.0. Default value is 7.0.
  2303. @item TP, tp
  2304. Set maximum true peak.
  2305. Range is -9.0 - +0.0. Default value is -2.0.
  2306. @item measured_I, measured_i
  2307. Measured IL of input file.
  2308. Range is -99.0 - +0.0.
  2309. @item measured_LRA, measured_lra
  2310. Measured LRA of input file.
  2311. Range is 0.0 - 99.0.
  2312. @item measured_TP, measured_tp
  2313. Measured true peak of input file.
  2314. Range is -99.0 - +99.0.
  2315. @item measured_thresh
  2316. Measured threshold of input file.
  2317. Range is -99.0 - +0.0.
  2318. @item offset
  2319. Set offset gain. Gain is applied before the true-peak limiter.
  2320. Range is -99.0 - +99.0. Default is +0.0.
  2321. @item linear
  2322. Normalize linearly if possible.
  2323. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2324. to be specified in order to use this mode.
  2325. Options are true or false. Default is true.
  2326. @item dual_mono
  2327. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2328. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2329. If set to @code{true}, this option will compensate for this effect.
  2330. Multi-channel input files are not affected by this option.
  2331. Options are true or false. Default is false.
  2332. @item print_format
  2333. Set print format for stats. Options are summary, json, or none.
  2334. Default value is none.
  2335. @end table
  2336. @section lowpass
  2337. Apply a low-pass filter with 3dB point frequency.
  2338. The filter can be either single-pole or double-pole (the default).
  2339. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2340. The filter accepts the following options:
  2341. @table @option
  2342. @item frequency, f
  2343. Set frequency in Hz. Default is 500.
  2344. @item poles, p
  2345. Set number of poles. Default is 2.
  2346. @item width_type
  2347. Set method to specify band-width of filter.
  2348. @table @option
  2349. @item h
  2350. Hz
  2351. @item q
  2352. Q-Factor
  2353. @item o
  2354. octave
  2355. @item s
  2356. slope
  2357. @end table
  2358. @item width, w
  2359. Specify the band-width of a filter in width_type units.
  2360. Applies only to double-pole filter.
  2361. The default is 0.707q and gives a Butterworth response.
  2362. @item channels, c
  2363. Specify which channels to filter, by default all available are filtered.
  2364. @end table
  2365. @subsection Examples
  2366. @itemize
  2367. @item
  2368. Lowpass only LFE channel, it LFE is not present it does nothing:
  2369. @example
  2370. lowpass=c=LFE
  2371. @end example
  2372. @end itemize
  2373. @anchor{pan}
  2374. @section pan
  2375. Mix channels with specific gain levels. The filter accepts the output
  2376. channel layout followed by a set of channels definitions.
  2377. This filter is also designed to efficiently remap the channels of an audio
  2378. stream.
  2379. The filter accepts parameters of the form:
  2380. "@var{l}|@var{outdef}|@var{outdef}|..."
  2381. @table @option
  2382. @item l
  2383. output channel layout or number of channels
  2384. @item outdef
  2385. output channel specification, of the form:
  2386. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2387. @item out_name
  2388. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2389. number (c0, c1, etc.)
  2390. @item gain
  2391. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2392. @item in_name
  2393. input channel to use, see out_name for details; it is not possible to mix
  2394. named and numbered input channels
  2395. @end table
  2396. If the `=' in a channel specification is replaced by `<', then the gains for
  2397. that specification will be renormalized so that the total is 1, thus
  2398. avoiding clipping noise.
  2399. @subsection Mixing examples
  2400. For example, if you want to down-mix from stereo to mono, but with a bigger
  2401. factor for the left channel:
  2402. @example
  2403. pan=1c|c0=0.9*c0+0.1*c1
  2404. @end example
  2405. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2406. 7-channels surround:
  2407. @example
  2408. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2409. @end example
  2410. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2411. that should be preferred (see "-ac" option) unless you have very specific
  2412. needs.
  2413. @subsection Remapping examples
  2414. The channel remapping will be effective if, and only if:
  2415. @itemize
  2416. @item gain coefficients are zeroes or ones,
  2417. @item only one input per channel output,
  2418. @end itemize
  2419. If all these conditions are satisfied, the filter will notify the user ("Pure
  2420. channel mapping detected"), and use an optimized and lossless method to do the
  2421. remapping.
  2422. For example, if you have a 5.1 source and want a stereo audio stream by
  2423. dropping the extra channels:
  2424. @example
  2425. pan="stereo| c0=FL | c1=FR"
  2426. @end example
  2427. Given the same source, you can also switch front left and front right channels
  2428. and keep the input channel layout:
  2429. @example
  2430. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2431. @end example
  2432. If the input is a stereo audio stream, you can mute the front left channel (and
  2433. still keep the stereo channel layout) with:
  2434. @example
  2435. pan="stereo|c1=c1"
  2436. @end example
  2437. Still with a stereo audio stream input, you can copy the right channel in both
  2438. front left and right:
  2439. @example
  2440. pan="stereo| c0=FR | c1=FR"
  2441. @end example
  2442. @section replaygain
  2443. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2444. outputs it unchanged.
  2445. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2446. @section resample
  2447. Convert the audio sample format, sample rate and channel layout. It is
  2448. not meant to be used directly.
  2449. @section rubberband
  2450. Apply time-stretching and pitch-shifting with librubberband.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item tempo
  2454. Set tempo scale factor.
  2455. @item pitch
  2456. Set pitch scale factor.
  2457. @item transients
  2458. Set transients detector.
  2459. Possible values are:
  2460. @table @var
  2461. @item crisp
  2462. @item mixed
  2463. @item smooth
  2464. @end table
  2465. @item detector
  2466. Set detector.
  2467. Possible values are:
  2468. @table @var
  2469. @item compound
  2470. @item percussive
  2471. @item soft
  2472. @end table
  2473. @item phase
  2474. Set phase.
  2475. Possible values are:
  2476. @table @var
  2477. @item laminar
  2478. @item independent
  2479. @end table
  2480. @item window
  2481. Set processing window size.
  2482. Possible values are:
  2483. @table @var
  2484. @item standard
  2485. @item short
  2486. @item long
  2487. @end table
  2488. @item smoothing
  2489. Set smoothing.
  2490. Possible values are:
  2491. @table @var
  2492. @item off
  2493. @item on
  2494. @end table
  2495. @item formant
  2496. Enable formant preservation when shift pitching.
  2497. Possible values are:
  2498. @table @var
  2499. @item shifted
  2500. @item preserved
  2501. @end table
  2502. @item pitchq
  2503. Set pitch quality.
  2504. Possible values are:
  2505. @table @var
  2506. @item quality
  2507. @item speed
  2508. @item consistency
  2509. @end table
  2510. @item channels
  2511. Set channels.
  2512. Possible values are:
  2513. @table @var
  2514. @item apart
  2515. @item together
  2516. @end table
  2517. @end table
  2518. @section sidechaincompress
  2519. This filter acts like normal compressor but has the ability to compress
  2520. detected signal using second input signal.
  2521. It needs two input streams and returns one output stream.
  2522. First input stream will be processed depending on second stream signal.
  2523. The filtered signal then can be filtered with other filters in later stages of
  2524. processing. See @ref{pan} and @ref{amerge} filter.
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item level_in
  2528. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2529. @item threshold
  2530. If a signal of second stream raises above this level it will affect the gain
  2531. reduction of first stream.
  2532. By default is 0.125. Range is between 0.00097563 and 1.
  2533. @item ratio
  2534. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2535. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2536. Default is 2. Range is between 1 and 20.
  2537. @item attack
  2538. Amount of milliseconds the signal has to rise above the threshold before gain
  2539. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2540. @item release
  2541. Amount of milliseconds the signal has to fall below the threshold before
  2542. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2543. @item makeup
  2544. Set the amount by how much signal will be amplified after processing.
  2545. Default is 2. Range is from 1 and 64.
  2546. @item knee
  2547. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2548. Default is 2.82843. Range is between 1 and 8.
  2549. @item link
  2550. Choose if the @code{average} level between all channels of side-chain stream
  2551. or the louder(@code{maximum}) channel of side-chain stream affects the
  2552. reduction. Default is @code{average}.
  2553. @item detection
  2554. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2555. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2556. @item level_sc
  2557. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2558. @item mix
  2559. How much to use compressed signal in output. Default is 1.
  2560. Range is between 0 and 1.
  2561. @end table
  2562. @subsection Examples
  2563. @itemize
  2564. @item
  2565. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2566. depending on the signal of 2nd input and later compressed signal to be
  2567. merged with 2nd input:
  2568. @example
  2569. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2570. @end example
  2571. @end itemize
  2572. @section sidechaingate
  2573. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2574. filter the detected signal before sending it to the gain reduction stage.
  2575. Normally a gate uses the full range signal to detect a level above the
  2576. threshold.
  2577. For example: If you cut all lower frequencies from your sidechain signal
  2578. the gate will decrease the volume of your track only if not enough highs
  2579. appear. With this technique you are able to reduce the resonation of a
  2580. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2581. guitar.
  2582. It needs two input streams and returns one output stream.
  2583. First input stream will be processed depending on second stream signal.
  2584. The filter accepts the following options:
  2585. @table @option
  2586. @item level_in
  2587. Set input level before filtering.
  2588. Default is 1. Allowed range is from 0.015625 to 64.
  2589. @item range
  2590. Set the level of gain reduction when the signal is below the threshold.
  2591. Default is 0.06125. Allowed range is from 0 to 1.
  2592. @item threshold
  2593. If a signal rises above this level the gain reduction is released.
  2594. Default is 0.125. Allowed range is from 0 to 1.
  2595. @item ratio
  2596. Set a ratio about which the signal is reduced.
  2597. Default is 2. Allowed range is from 1 to 9000.
  2598. @item attack
  2599. Amount of milliseconds the signal has to rise above the threshold before gain
  2600. reduction stops.
  2601. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2602. @item release
  2603. Amount of milliseconds the signal has to fall below the threshold before the
  2604. reduction is increased again. Default is 250 milliseconds.
  2605. Allowed range is from 0.01 to 9000.
  2606. @item makeup
  2607. Set amount of amplification of signal after processing.
  2608. Default is 1. Allowed range is from 1 to 64.
  2609. @item knee
  2610. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2611. Default is 2.828427125. Allowed range is from 1 to 8.
  2612. @item detection
  2613. Choose if exact signal should be taken for detection or an RMS like one.
  2614. Default is rms. Can be peak or rms.
  2615. @item link
  2616. Choose if the average level between all channels or the louder channel affects
  2617. the reduction.
  2618. Default is average. Can be average or maximum.
  2619. @item level_sc
  2620. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2621. @end table
  2622. @section silencedetect
  2623. Detect silence in an audio stream.
  2624. This filter logs a message when it detects that the input audio volume is less
  2625. or equal to a noise tolerance value for a duration greater or equal to the
  2626. minimum detected noise duration.
  2627. The printed times and duration are expressed in seconds.
  2628. The filter accepts the following options:
  2629. @table @option
  2630. @item duration, d
  2631. Set silence duration until notification (default is 2 seconds).
  2632. @item noise, n
  2633. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2634. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2635. @end table
  2636. @subsection Examples
  2637. @itemize
  2638. @item
  2639. Detect 5 seconds of silence with -50dB noise tolerance:
  2640. @example
  2641. silencedetect=n=-50dB:d=5
  2642. @end example
  2643. @item
  2644. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2645. tolerance in @file{silence.mp3}:
  2646. @example
  2647. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2648. @end example
  2649. @end itemize
  2650. @section silenceremove
  2651. Remove silence from the beginning, middle or end of the audio.
  2652. The filter accepts the following options:
  2653. @table @option
  2654. @item start_periods
  2655. This value is used to indicate if audio should be trimmed at beginning of
  2656. the audio. A value of zero indicates no silence should be trimmed from the
  2657. beginning. When specifying a non-zero value, it trims audio up until it
  2658. finds non-silence. Normally, when trimming silence from beginning of audio
  2659. the @var{start_periods} will be @code{1} but it can be increased to higher
  2660. values to trim all audio up to specific count of non-silence periods.
  2661. Default value is @code{0}.
  2662. @item start_duration
  2663. Specify the amount of time that non-silence must be detected before it stops
  2664. trimming audio. By increasing the duration, bursts of noises can be treated
  2665. as silence and trimmed off. Default value is @code{0}.
  2666. @item start_threshold
  2667. This indicates what sample value should be treated as silence. For digital
  2668. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2669. you may wish to increase the value to account for background noise.
  2670. Can be specified in dB (in case "dB" is appended to the specified value)
  2671. or amplitude ratio. Default value is @code{0}.
  2672. @item stop_periods
  2673. Set the count for trimming silence from the end of audio.
  2674. To remove silence from the middle of a file, specify a @var{stop_periods}
  2675. that is negative. This value is then treated as a positive value and is
  2676. used to indicate the effect should restart processing as specified by
  2677. @var{start_periods}, making it suitable for removing periods of silence
  2678. in the middle of the audio.
  2679. Default value is @code{0}.
  2680. @item stop_duration
  2681. Specify a duration of silence that must exist before audio is not copied any
  2682. more. By specifying a higher duration, silence that is wanted can be left in
  2683. the audio.
  2684. Default value is @code{0}.
  2685. @item stop_threshold
  2686. This is the same as @option{start_threshold} but for trimming silence from
  2687. the end of audio.
  2688. Can be specified in dB (in case "dB" is appended to the specified value)
  2689. or amplitude ratio. Default value is @code{0}.
  2690. @item leave_silence
  2691. This indicates that @var{stop_duration} length of audio should be left intact
  2692. at the beginning of each period of silence.
  2693. For example, if you want to remove long pauses between words but do not want
  2694. to remove the pauses completely. Default value is @code{0}.
  2695. @item detection
  2696. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2697. and works better with digital silence which is exactly 0.
  2698. Default value is @code{rms}.
  2699. @item window
  2700. Set ratio used to calculate size of window for detecting silence.
  2701. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2702. @end table
  2703. @subsection Examples
  2704. @itemize
  2705. @item
  2706. The following example shows how this filter can be used to start a recording
  2707. that does not contain the delay at the start which usually occurs between
  2708. pressing the record button and the start of the performance:
  2709. @example
  2710. silenceremove=1:5:0.02
  2711. @end example
  2712. @item
  2713. Trim all silence encountered from beginning to end where there is more than 1
  2714. second of silence in audio:
  2715. @example
  2716. silenceremove=0:0:0:-1:1:-90dB
  2717. @end example
  2718. @end itemize
  2719. @section sofalizer
  2720. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2721. loudspeakers around the user for binaural listening via headphones (audio
  2722. formats up to 9 channels supported).
  2723. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2724. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2725. Austrian Academy of Sciences.
  2726. To enable compilation of this filter you need to configure FFmpeg with
  2727. @code{--enable-netcdf}.
  2728. The filter accepts the following options:
  2729. @table @option
  2730. @item sofa
  2731. Set the SOFA file used for rendering.
  2732. @item gain
  2733. Set gain applied to audio. Value is in dB. Default is 0.
  2734. @item rotation
  2735. Set rotation of virtual loudspeakers in deg. Default is 0.
  2736. @item elevation
  2737. Set elevation of virtual speakers in deg. Default is 0.
  2738. @item radius
  2739. Set distance in meters between loudspeakers and the listener with near-field
  2740. HRTFs. Default is 1.
  2741. @item type
  2742. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2743. processing audio in time domain which is slow.
  2744. @var{freq} is processing audio in frequency domain which is fast.
  2745. Default is @var{freq}.
  2746. @item speakers
  2747. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2748. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2749. Each virtual loudspeaker is described with short channel name following with
  2750. azimuth and elevation in degreees.
  2751. Each virtual loudspeaker description is separated by '|'.
  2752. For example to override front left and front right channel positions use:
  2753. 'speakers=FL 45 15|FR 345 15'.
  2754. Descriptions with unrecognised channel names are ignored.
  2755. @end table
  2756. @subsection Examples
  2757. @itemize
  2758. @item
  2759. Using ClubFritz6 sofa file:
  2760. @example
  2761. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2762. @end example
  2763. @item
  2764. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2765. @example
  2766. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2767. @end example
  2768. @item
  2769. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2770. and also with custom gain:
  2771. @example
  2772. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2773. @end example
  2774. @end itemize
  2775. @section stereotools
  2776. This filter has some handy utilities to manage stereo signals, for converting
  2777. M/S stereo recordings to L/R signal while having control over the parameters
  2778. or spreading the stereo image of master track.
  2779. The filter accepts the following options:
  2780. @table @option
  2781. @item level_in
  2782. Set input level before filtering for both channels. Defaults is 1.
  2783. Allowed range is from 0.015625 to 64.
  2784. @item level_out
  2785. Set output level after filtering for both channels. Defaults is 1.
  2786. Allowed range is from 0.015625 to 64.
  2787. @item balance_in
  2788. Set input balance between both channels. Default is 0.
  2789. Allowed range is from -1 to 1.
  2790. @item balance_out
  2791. Set output balance between both channels. Default is 0.
  2792. Allowed range is from -1 to 1.
  2793. @item softclip
  2794. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2795. clipping. Disabled by default.
  2796. @item mutel
  2797. Mute the left channel. Disabled by default.
  2798. @item muter
  2799. Mute the right channel. Disabled by default.
  2800. @item phasel
  2801. Change the phase of the left channel. Disabled by default.
  2802. @item phaser
  2803. Change the phase of the right channel. Disabled by default.
  2804. @item mode
  2805. Set stereo mode. Available values are:
  2806. @table @samp
  2807. @item lr>lr
  2808. Left/Right to Left/Right, this is default.
  2809. @item lr>ms
  2810. Left/Right to Mid/Side.
  2811. @item ms>lr
  2812. Mid/Side to Left/Right.
  2813. @item lr>ll
  2814. Left/Right to Left/Left.
  2815. @item lr>rr
  2816. Left/Right to Right/Right.
  2817. @item lr>l+r
  2818. Left/Right to Left + Right.
  2819. @item lr>rl
  2820. Left/Right to Right/Left.
  2821. @end table
  2822. @item slev
  2823. Set level of side signal. Default is 1.
  2824. Allowed range is from 0.015625 to 64.
  2825. @item sbal
  2826. Set balance of side signal. Default is 0.
  2827. Allowed range is from -1 to 1.
  2828. @item mlev
  2829. Set level of the middle signal. Default is 1.
  2830. Allowed range is from 0.015625 to 64.
  2831. @item mpan
  2832. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2833. @item base
  2834. Set stereo base between mono and inversed channels. Default is 0.
  2835. Allowed range is from -1 to 1.
  2836. @item delay
  2837. Set delay in milliseconds how much to delay left from right channel and
  2838. vice versa. Default is 0. Allowed range is from -20 to 20.
  2839. @item sclevel
  2840. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2841. @item phase
  2842. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2843. @end table
  2844. @subsection Examples
  2845. @itemize
  2846. @item
  2847. Apply karaoke like effect:
  2848. @example
  2849. stereotools=mlev=0.015625
  2850. @end example
  2851. @item
  2852. Convert M/S signal to L/R:
  2853. @example
  2854. "stereotools=mode=ms>lr"
  2855. @end example
  2856. @end itemize
  2857. @section stereowiden
  2858. This filter enhance the stereo effect by suppressing signal common to both
  2859. channels and by delaying the signal of left into right and vice versa,
  2860. thereby widening the stereo effect.
  2861. The filter accepts the following options:
  2862. @table @option
  2863. @item delay
  2864. Time in milliseconds of the delay of left signal into right and vice versa.
  2865. Default is 20 milliseconds.
  2866. @item feedback
  2867. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2868. effect of left signal in right output and vice versa which gives widening
  2869. effect. Default is 0.3.
  2870. @item crossfeed
  2871. Cross feed of left into right with inverted phase. This helps in suppressing
  2872. the mono. If the value is 1 it will cancel all the signal common to both
  2873. channels. Default is 0.3.
  2874. @item drymix
  2875. Set level of input signal of original channel. Default is 0.8.
  2876. @end table
  2877. @section treble
  2878. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2879. shelving filter with a response similar to that of a standard
  2880. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2881. The filter accepts the following options:
  2882. @table @option
  2883. @item gain, g
  2884. Give the gain at whichever is the lower of ~22 kHz and the
  2885. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2886. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2887. @item frequency, f
  2888. Set the filter's central frequency and so can be used
  2889. to extend or reduce the frequency range to be boosted or cut.
  2890. The default value is @code{3000} Hz.
  2891. @item width_type
  2892. Set method to specify band-width of filter.
  2893. @table @option
  2894. @item h
  2895. Hz
  2896. @item q
  2897. Q-Factor
  2898. @item o
  2899. octave
  2900. @item s
  2901. slope
  2902. @end table
  2903. @item width, w
  2904. Determine how steep is the filter's shelf transition.
  2905. @item channels, c
  2906. Specify which channels to filter, by default all available are filtered.
  2907. @end table
  2908. @section tremolo
  2909. Sinusoidal amplitude modulation.
  2910. The filter accepts the following options:
  2911. @table @option
  2912. @item f
  2913. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2914. (20 Hz or lower) will result in a tremolo effect.
  2915. This filter may also be used as a ring modulator by specifying
  2916. a modulation frequency higher than 20 Hz.
  2917. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2918. @item d
  2919. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2920. Default value is 0.5.
  2921. @end table
  2922. @section vibrato
  2923. Sinusoidal phase modulation.
  2924. The filter accepts the following options:
  2925. @table @option
  2926. @item f
  2927. Modulation frequency in Hertz.
  2928. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2929. @item d
  2930. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2931. Default value is 0.5.
  2932. @end table
  2933. @section volume
  2934. Adjust the input audio volume.
  2935. It accepts the following parameters:
  2936. @table @option
  2937. @item volume
  2938. Set audio volume expression.
  2939. Output values are clipped to the maximum value.
  2940. The output audio volume is given by the relation:
  2941. @example
  2942. @var{output_volume} = @var{volume} * @var{input_volume}
  2943. @end example
  2944. The default value for @var{volume} is "1.0".
  2945. @item precision
  2946. This parameter represents the mathematical precision.
  2947. It determines which input sample formats will be allowed, which affects the
  2948. precision of the volume scaling.
  2949. @table @option
  2950. @item fixed
  2951. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2952. @item float
  2953. 32-bit floating-point; this limits input sample format to FLT. (default)
  2954. @item double
  2955. 64-bit floating-point; this limits input sample format to DBL.
  2956. @end table
  2957. @item replaygain
  2958. Choose the behaviour on encountering ReplayGain side data in input frames.
  2959. @table @option
  2960. @item drop
  2961. Remove ReplayGain side data, ignoring its contents (the default).
  2962. @item ignore
  2963. Ignore ReplayGain side data, but leave it in the frame.
  2964. @item track
  2965. Prefer the track gain, if present.
  2966. @item album
  2967. Prefer the album gain, if present.
  2968. @end table
  2969. @item replaygain_preamp
  2970. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2971. Default value for @var{replaygain_preamp} is 0.0.
  2972. @item eval
  2973. Set when the volume expression is evaluated.
  2974. It accepts the following values:
  2975. @table @samp
  2976. @item once
  2977. only evaluate expression once during the filter initialization, or
  2978. when the @samp{volume} command is sent
  2979. @item frame
  2980. evaluate expression for each incoming frame
  2981. @end table
  2982. Default value is @samp{once}.
  2983. @end table
  2984. The volume expression can contain the following parameters.
  2985. @table @option
  2986. @item n
  2987. frame number (starting at zero)
  2988. @item nb_channels
  2989. number of channels
  2990. @item nb_consumed_samples
  2991. number of samples consumed by the filter
  2992. @item nb_samples
  2993. number of samples in the current frame
  2994. @item pos
  2995. original frame position in the file
  2996. @item pts
  2997. frame PTS
  2998. @item sample_rate
  2999. sample rate
  3000. @item startpts
  3001. PTS at start of stream
  3002. @item startt
  3003. time at start of stream
  3004. @item t
  3005. frame time
  3006. @item tb
  3007. timestamp timebase
  3008. @item volume
  3009. last set volume value
  3010. @end table
  3011. Note that when @option{eval} is set to @samp{once} only the
  3012. @var{sample_rate} and @var{tb} variables are available, all other
  3013. variables will evaluate to NAN.
  3014. @subsection Commands
  3015. This filter supports the following commands:
  3016. @table @option
  3017. @item volume
  3018. Modify the volume expression.
  3019. The command accepts the same syntax of the corresponding option.
  3020. If the specified expression is not valid, it is kept at its current
  3021. value.
  3022. @item replaygain_noclip
  3023. Prevent clipping by limiting the gain applied.
  3024. Default value for @var{replaygain_noclip} is 1.
  3025. @end table
  3026. @subsection Examples
  3027. @itemize
  3028. @item
  3029. Halve the input audio volume:
  3030. @example
  3031. volume=volume=0.5
  3032. volume=volume=1/2
  3033. volume=volume=-6.0206dB
  3034. @end example
  3035. In all the above example the named key for @option{volume} can be
  3036. omitted, for example like in:
  3037. @example
  3038. volume=0.5
  3039. @end example
  3040. @item
  3041. Increase input audio power by 6 decibels using fixed-point precision:
  3042. @example
  3043. volume=volume=6dB:precision=fixed
  3044. @end example
  3045. @item
  3046. Fade volume after time 10 with an annihilation period of 5 seconds:
  3047. @example
  3048. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3049. @end example
  3050. @end itemize
  3051. @section volumedetect
  3052. Detect the volume of the input video.
  3053. The filter has no parameters. The input is not modified. Statistics about
  3054. the volume will be printed in the log when the input stream end is reached.
  3055. In particular it will show the mean volume (root mean square), maximum
  3056. volume (on a per-sample basis), and the beginning of a histogram of the
  3057. registered volume values (from the maximum value to a cumulated 1/1000 of
  3058. the samples).
  3059. All volumes are in decibels relative to the maximum PCM value.
  3060. @subsection Examples
  3061. Here is an excerpt of the output:
  3062. @example
  3063. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3064. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3067. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3068. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3069. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3070. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3071. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3072. @end example
  3073. It means that:
  3074. @itemize
  3075. @item
  3076. The mean square energy is approximately -27 dB, or 10^-2.7.
  3077. @item
  3078. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3079. @item
  3080. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3081. @end itemize
  3082. In other words, raising the volume by +4 dB does not cause any clipping,
  3083. raising it by +5 dB causes clipping for 6 samples, etc.
  3084. @c man end AUDIO FILTERS
  3085. @chapter Audio Sources
  3086. @c man begin AUDIO SOURCES
  3087. Below is a description of the currently available audio sources.
  3088. @section abuffer
  3089. Buffer audio frames, and make them available to the filter chain.
  3090. This source is mainly intended for a programmatic use, in particular
  3091. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3092. It accepts the following parameters:
  3093. @table @option
  3094. @item time_base
  3095. The timebase which will be used for timestamps of submitted frames. It must be
  3096. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3097. @item sample_rate
  3098. The sample rate of the incoming audio buffers.
  3099. @item sample_fmt
  3100. The sample format of the incoming audio buffers.
  3101. Either a sample format name or its corresponding integer representation from
  3102. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3103. @item channel_layout
  3104. The channel layout of the incoming audio buffers.
  3105. Either a channel layout name from channel_layout_map in
  3106. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3107. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3108. @item channels
  3109. The number of channels of the incoming audio buffers.
  3110. If both @var{channels} and @var{channel_layout} are specified, then they
  3111. must be consistent.
  3112. @end table
  3113. @subsection Examples
  3114. @example
  3115. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3116. @end example
  3117. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3118. Since the sample format with name "s16p" corresponds to the number
  3119. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3120. equivalent to:
  3121. @example
  3122. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3123. @end example
  3124. @section aevalsrc
  3125. Generate an audio signal specified by an expression.
  3126. This source accepts in input one or more expressions (one for each
  3127. channel), which are evaluated and used to generate a corresponding
  3128. audio signal.
  3129. This source accepts the following options:
  3130. @table @option
  3131. @item exprs
  3132. Set the '|'-separated expressions list for each separate channel. In case the
  3133. @option{channel_layout} option is not specified, the selected channel layout
  3134. depends on the number of provided expressions. Otherwise the last
  3135. specified expression is applied to the remaining output channels.
  3136. @item channel_layout, c
  3137. Set the channel layout. The number of channels in the specified layout
  3138. must be equal to the number of specified expressions.
  3139. @item duration, d
  3140. Set the minimum duration of the sourced audio. See
  3141. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3142. for the accepted syntax.
  3143. Note that the resulting duration may be greater than the specified
  3144. duration, as the generated audio is always cut at the end of a
  3145. complete frame.
  3146. If not specified, or the expressed duration is negative, the audio is
  3147. supposed to be generated forever.
  3148. @item nb_samples, n
  3149. Set the number of samples per channel per each output frame,
  3150. default to 1024.
  3151. @item sample_rate, s
  3152. Specify the sample rate, default to 44100.
  3153. @end table
  3154. Each expression in @var{exprs} can contain the following constants:
  3155. @table @option
  3156. @item n
  3157. number of the evaluated sample, starting from 0
  3158. @item t
  3159. time of the evaluated sample expressed in seconds, starting from 0
  3160. @item s
  3161. sample rate
  3162. @end table
  3163. @subsection Examples
  3164. @itemize
  3165. @item
  3166. Generate silence:
  3167. @example
  3168. aevalsrc=0
  3169. @end example
  3170. @item
  3171. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3172. 8000 Hz:
  3173. @example
  3174. aevalsrc="sin(440*2*PI*t):s=8000"
  3175. @end example
  3176. @item
  3177. Generate a two channels signal, specify the channel layout (Front
  3178. Center + Back Center) explicitly:
  3179. @example
  3180. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3181. @end example
  3182. @item
  3183. Generate white noise:
  3184. @example
  3185. aevalsrc="-2+random(0)"
  3186. @end example
  3187. @item
  3188. Generate an amplitude modulated signal:
  3189. @example
  3190. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3191. @end example
  3192. @item
  3193. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3194. @example
  3195. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3196. @end example
  3197. @end itemize
  3198. @section anullsrc
  3199. The null audio source, return unprocessed audio frames. It is mainly useful
  3200. as a template and to be employed in analysis / debugging tools, or as
  3201. the source for filters which ignore the input data (for example the sox
  3202. synth filter).
  3203. This source accepts the following options:
  3204. @table @option
  3205. @item channel_layout, cl
  3206. Specifies the channel layout, and can be either an integer or a string
  3207. representing a channel layout. The default value of @var{channel_layout}
  3208. is "stereo".
  3209. Check the channel_layout_map definition in
  3210. @file{libavutil/channel_layout.c} for the mapping between strings and
  3211. channel layout values.
  3212. @item sample_rate, r
  3213. Specifies the sample rate, and defaults to 44100.
  3214. @item nb_samples, n
  3215. Set the number of samples per requested frames.
  3216. @end table
  3217. @subsection Examples
  3218. @itemize
  3219. @item
  3220. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3221. @example
  3222. anullsrc=r=48000:cl=4
  3223. @end example
  3224. @item
  3225. Do the same operation with a more obvious syntax:
  3226. @example
  3227. anullsrc=r=48000:cl=mono
  3228. @end example
  3229. @end itemize
  3230. All the parameters need to be explicitly defined.
  3231. @section flite
  3232. Synthesize a voice utterance using the libflite library.
  3233. To enable compilation of this filter you need to configure FFmpeg with
  3234. @code{--enable-libflite}.
  3235. Note that the flite library is not thread-safe.
  3236. The filter accepts the following options:
  3237. @table @option
  3238. @item list_voices
  3239. If set to 1, list the names of the available voices and exit
  3240. immediately. Default value is 0.
  3241. @item nb_samples, n
  3242. Set the maximum number of samples per frame. Default value is 512.
  3243. @item textfile
  3244. Set the filename containing the text to speak.
  3245. @item text
  3246. Set the text to speak.
  3247. @item voice, v
  3248. Set the voice to use for the speech synthesis. Default value is
  3249. @code{kal}. See also the @var{list_voices} option.
  3250. @end table
  3251. @subsection Examples
  3252. @itemize
  3253. @item
  3254. Read from file @file{speech.txt}, and synthesize the text using the
  3255. standard flite voice:
  3256. @example
  3257. flite=textfile=speech.txt
  3258. @end example
  3259. @item
  3260. Read the specified text selecting the @code{slt} voice:
  3261. @example
  3262. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3263. @end example
  3264. @item
  3265. Input text to ffmpeg:
  3266. @example
  3267. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3268. @end example
  3269. @item
  3270. Make @file{ffplay} speak the specified text, using @code{flite} and
  3271. the @code{lavfi} device:
  3272. @example
  3273. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3274. @end example
  3275. @end itemize
  3276. For more information about libflite, check:
  3277. @url{http://www.speech.cs.cmu.edu/flite/}
  3278. @section anoisesrc
  3279. Generate a noise audio signal.
  3280. The filter accepts the following options:
  3281. @table @option
  3282. @item sample_rate, r
  3283. Specify the sample rate. Default value is 48000 Hz.
  3284. @item amplitude, a
  3285. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3286. is 1.0.
  3287. @item duration, d
  3288. Specify the duration of the generated audio stream. Not specifying this option
  3289. results in noise with an infinite length.
  3290. @item color, colour, c
  3291. Specify the color of noise. Available noise colors are white, pink, and brown.
  3292. Default color is white.
  3293. @item seed, s
  3294. Specify a value used to seed the PRNG.
  3295. @item nb_samples, n
  3296. Set the number of samples per each output frame, default is 1024.
  3297. @end table
  3298. @subsection Examples
  3299. @itemize
  3300. @item
  3301. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3302. @example
  3303. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3304. @end example
  3305. @end itemize
  3306. @section sine
  3307. Generate an audio signal made of a sine wave with amplitude 1/8.
  3308. The audio signal is bit-exact.
  3309. The filter accepts the following options:
  3310. @table @option
  3311. @item frequency, f
  3312. Set the carrier frequency. Default is 440 Hz.
  3313. @item beep_factor, b
  3314. Enable a periodic beep every second with frequency @var{beep_factor} times
  3315. the carrier frequency. Default is 0, meaning the beep is disabled.
  3316. @item sample_rate, r
  3317. Specify the sample rate, default is 44100.
  3318. @item duration, d
  3319. Specify the duration of the generated audio stream.
  3320. @item samples_per_frame
  3321. Set the number of samples per output frame.
  3322. The expression can contain the following constants:
  3323. @table @option
  3324. @item n
  3325. The (sequential) number of the output audio frame, starting from 0.
  3326. @item pts
  3327. The PTS (Presentation TimeStamp) of the output audio frame,
  3328. expressed in @var{TB} units.
  3329. @item t
  3330. The PTS of the output audio frame, expressed in seconds.
  3331. @item TB
  3332. The timebase of the output audio frames.
  3333. @end table
  3334. Default is @code{1024}.
  3335. @end table
  3336. @subsection Examples
  3337. @itemize
  3338. @item
  3339. Generate a simple 440 Hz sine wave:
  3340. @example
  3341. sine
  3342. @end example
  3343. @item
  3344. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3345. @example
  3346. sine=220:4:d=5
  3347. sine=f=220:b=4:d=5
  3348. sine=frequency=220:beep_factor=4:duration=5
  3349. @end example
  3350. @item
  3351. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3352. pattern:
  3353. @example
  3354. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3355. @end example
  3356. @end itemize
  3357. @c man end AUDIO SOURCES
  3358. @chapter Audio Sinks
  3359. @c man begin AUDIO SINKS
  3360. Below is a description of the currently available audio sinks.
  3361. @section abuffersink
  3362. Buffer audio frames, and make them available to the end of filter chain.
  3363. This sink is mainly intended for programmatic use, in particular
  3364. through the interface defined in @file{libavfilter/buffersink.h}
  3365. or the options system.
  3366. It accepts a pointer to an AVABufferSinkContext structure, which
  3367. defines the incoming buffers' formats, to be passed as the opaque
  3368. parameter to @code{avfilter_init_filter} for initialization.
  3369. @section anullsink
  3370. Null audio sink; do absolutely nothing with the input audio. It is
  3371. mainly useful as a template and for use in analysis / debugging
  3372. tools.
  3373. @c man end AUDIO SINKS
  3374. @chapter Video Filters
  3375. @c man begin VIDEO FILTERS
  3376. When you configure your FFmpeg build, you can disable any of the
  3377. existing filters using @code{--disable-filters}.
  3378. The configure output will show the video filters included in your
  3379. build.
  3380. Below is a description of the currently available video filters.
  3381. @section alphaextract
  3382. Extract the alpha component from the input as a grayscale video. This
  3383. is especially useful with the @var{alphamerge} filter.
  3384. @section alphamerge
  3385. Add or replace the alpha component of the primary input with the
  3386. grayscale value of a second input. This is intended for use with
  3387. @var{alphaextract} to allow the transmission or storage of frame
  3388. sequences that have alpha in a format that doesn't support an alpha
  3389. channel.
  3390. For example, to reconstruct full frames from a normal YUV-encoded video
  3391. and a separate video created with @var{alphaextract}, you might use:
  3392. @example
  3393. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3394. @end example
  3395. Since this filter is designed for reconstruction, it operates on frame
  3396. sequences without considering timestamps, and terminates when either
  3397. input reaches end of stream. This will cause problems if your encoding
  3398. pipeline drops frames. If you're trying to apply an image as an
  3399. overlay to a video stream, consider the @var{overlay} filter instead.
  3400. @section ass
  3401. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3402. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3403. Substation Alpha) subtitles files.
  3404. This filter accepts the following option in addition to the common options from
  3405. the @ref{subtitles} filter:
  3406. @table @option
  3407. @item shaping
  3408. Set the shaping engine
  3409. Available values are:
  3410. @table @samp
  3411. @item auto
  3412. The default libass shaping engine, which is the best available.
  3413. @item simple
  3414. Fast, font-agnostic shaper that can do only substitutions
  3415. @item complex
  3416. Slower shaper using OpenType for substitutions and positioning
  3417. @end table
  3418. The default is @code{auto}.
  3419. @end table
  3420. @section atadenoise
  3421. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3422. The filter accepts the following options:
  3423. @table @option
  3424. @item 0a
  3425. Set threshold A for 1st plane. Default is 0.02.
  3426. Valid range is 0 to 0.3.
  3427. @item 0b
  3428. Set threshold B for 1st plane. Default is 0.04.
  3429. Valid range is 0 to 5.
  3430. @item 1a
  3431. Set threshold A for 2nd plane. Default is 0.02.
  3432. Valid range is 0 to 0.3.
  3433. @item 1b
  3434. Set threshold B for 2nd plane. Default is 0.04.
  3435. Valid range is 0 to 5.
  3436. @item 2a
  3437. Set threshold A for 3rd plane. Default is 0.02.
  3438. Valid range is 0 to 0.3.
  3439. @item 2b
  3440. Set threshold B for 3rd plane. Default is 0.04.
  3441. Valid range is 0 to 5.
  3442. Threshold A is designed to react on abrupt changes in the input signal and
  3443. threshold B is designed to react on continuous changes in the input signal.
  3444. @item s
  3445. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3446. number in range [5, 129].
  3447. @item p
  3448. Set what planes of frame filter will use for averaging. Default is all.
  3449. @end table
  3450. @section avgblur
  3451. Apply average blur filter.
  3452. The filter accepts the following options:
  3453. @table @option
  3454. @item sizeX
  3455. Set horizontal kernel size.
  3456. @item planes
  3457. Set which planes to filter. By default all planes are filtered.
  3458. @item sizeY
  3459. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3460. Default is @code{0}.
  3461. @end table
  3462. @section bbox
  3463. Compute the bounding box for the non-black pixels in the input frame
  3464. luminance plane.
  3465. This filter computes the bounding box containing all the pixels with a
  3466. luminance value greater than the minimum allowed value.
  3467. The parameters describing the bounding box are printed on the filter
  3468. log.
  3469. The filter accepts the following option:
  3470. @table @option
  3471. @item min_val
  3472. Set the minimal luminance value. Default is @code{16}.
  3473. @end table
  3474. @section bitplanenoise
  3475. Show and measure bit plane noise.
  3476. The filter accepts the following options:
  3477. @table @option
  3478. @item bitplane
  3479. Set which plane to analyze. Default is @code{1}.
  3480. @item filter
  3481. Filter out noisy pixels from @code{bitplane} set above.
  3482. Default is disabled.
  3483. @end table
  3484. @section blackdetect
  3485. Detect video intervals that are (almost) completely black. Can be
  3486. useful to detect chapter transitions, commercials, or invalid
  3487. recordings. Output lines contains the time for the start, end and
  3488. duration of the detected black interval expressed in seconds.
  3489. In order to display the output lines, you need to set the loglevel at
  3490. least to the AV_LOG_INFO value.
  3491. The filter accepts the following options:
  3492. @table @option
  3493. @item black_min_duration, d
  3494. Set the minimum detected black duration expressed in seconds. It must
  3495. be a non-negative floating point number.
  3496. Default value is 2.0.
  3497. @item picture_black_ratio_th, pic_th
  3498. Set the threshold for considering a picture "black".
  3499. Express the minimum value for the ratio:
  3500. @example
  3501. @var{nb_black_pixels} / @var{nb_pixels}
  3502. @end example
  3503. for which a picture is considered black.
  3504. Default value is 0.98.
  3505. @item pixel_black_th, pix_th
  3506. Set the threshold for considering a pixel "black".
  3507. The threshold expresses the maximum pixel luminance value for which a
  3508. pixel is considered "black". The provided value is scaled according to
  3509. the following equation:
  3510. @example
  3511. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3512. @end example
  3513. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3514. the input video format, the range is [0-255] for YUV full-range
  3515. formats and [16-235] for YUV non full-range formats.
  3516. Default value is 0.10.
  3517. @end table
  3518. The following example sets the maximum pixel threshold to the minimum
  3519. value, and detects only black intervals of 2 or more seconds:
  3520. @example
  3521. blackdetect=d=2:pix_th=0.00
  3522. @end example
  3523. @section blackframe
  3524. Detect frames that are (almost) completely black. Can be useful to
  3525. detect chapter transitions or commercials. Output lines consist of
  3526. the frame number of the detected frame, the percentage of blackness,
  3527. the position in the file if known or -1 and the timestamp in seconds.
  3528. In order to display the output lines, you need to set the loglevel at
  3529. least to the AV_LOG_INFO value.
  3530. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3531. The value represents the percentage of pixels in the picture that
  3532. are below the threshold value.
  3533. It accepts the following parameters:
  3534. @table @option
  3535. @item amount
  3536. The percentage of the pixels that have to be below the threshold; it defaults to
  3537. @code{98}.
  3538. @item threshold, thresh
  3539. The threshold below which a pixel value is considered black; it defaults to
  3540. @code{32}.
  3541. @end table
  3542. @section blend, tblend
  3543. Blend two video frames into each other.
  3544. The @code{blend} filter takes two input streams and outputs one
  3545. stream, the first input is the "top" layer and second input is
  3546. "bottom" layer. By default, the output terminates when the longest input terminates.
  3547. The @code{tblend} (time blend) filter takes two consecutive frames
  3548. from one single stream, and outputs the result obtained by blending
  3549. the new frame on top of the old frame.
  3550. A description of the accepted options follows.
  3551. @table @option
  3552. @item c0_mode
  3553. @item c1_mode
  3554. @item c2_mode
  3555. @item c3_mode
  3556. @item all_mode
  3557. Set blend mode for specific pixel component or all pixel components in case
  3558. of @var{all_mode}. Default value is @code{normal}.
  3559. Available values for component modes are:
  3560. @table @samp
  3561. @item addition
  3562. @item addition128
  3563. @item and
  3564. @item average
  3565. @item burn
  3566. @item darken
  3567. @item difference
  3568. @item difference128
  3569. @item divide
  3570. @item dodge
  3571. @item freeze
  3572. @item exclusion
  3573. @item glow
  3574. @item hardlight
  3575. @item hardmix
  3576. @item heat
  3577. @item lighten
  3578. @item linearlight
  3579. @item multiply
  3580. @item multiply128
  3581. @item negation
  3582. @item normal
  3583. @item or
  3584. @item overlay
  3585. @item phoenix
  3586. @item pinlight
  3587. @item reflect
  3588. @item screen
  3589. @item softlight
  3590. @item subtract
  3591. @item vividlight
  3592. @item xor
  3593. @end table
  3594. @item c0_opacity
  3595. @item c1_opacity
  3596. @item c2_opacity
  3597. @item c3_opacity
  3598. @item all_opacity
  3599. Set blend opacity for specific pixel component or all pixel components in case
  3600. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3601. @item c0_expr
  3602. @item c1_expr
  3603. @item c2_expr
  3604. @item c3_expr
  3605. @item all_expr
  3606. Set blend expression for specific pixel component or all pixel components in case
  3607. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3608. The expressions can use the following variables:
  3609. @table @option
  3610. @item N
  3611. The sequential number of the filtered frame, starting from @code{0}.
  3612. @item X
  3613. @item Y
  3614. the coordinates of the current sample
  3615. @item W
  3616. @item H
  3617. the width and height of currently filtered plane
  3618. @item SW
  3619. @item SH
  3620. Width and height scale depending on the currently filtered plane. It is the
  3621. ratio between the corresponding luma plane number of pixels and the current
  3622. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3623. @code{0.5,0.5} for chroma planes.
  3624. @item T
  3625. Time of the current frame, expressed in seconds.
  3626. @item TOP, A
  3627. Value of pixel component at current location for first video frame (top layer).
  3628. @item BOTTOM, B
  3629. Value of pixel component at current location for second video frame (bottom layer).
  3630. @end table
  3631. @item shortest
  3632. Force termination when the shortest input terminates. Default is
  3633. @code{0}. This option is only defined for the @code{blend} filter.
  3634. @item repeatlast
  3635. Continue applying the last bottom frame after the end of the stream. A value of
  3636. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3637. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3638. @end table
  3639. @subsection Examples
  3640. @itemize
  3641. @item
  3642. Apply transition from bottom layer to top layer in first 10 seconds:
  3643. @example
  3644. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3645. @end example
  3646. @item
  3647. Apply 1x1 checkerboard effect:
  3648. @example
  3649. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3650. @end example
  3651. @item
  3652. Apply uncover left effect:
  3653. @example
  3654. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3655. @end example
  3656. @item
  3657. Apply uncover down effect:
  3658. @example
  3659. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3660. @end example
  3661. @item
  3662. Apply uncover up-left effect:
  3663. @example
  3664. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3665. @end example
  3666. @item
  3667. Split diagonally video and shows top and bottom layer on each side:
  3668. @example
  3669. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3670. @end example
  3671. @item
  3672. Display differences between the current and the previous frame:
  3673. @example
  3674. tblend=all_mode=difference128
  3675. @end example
  3676. @end itemize
  3677. @section boxblur
  3678. Apply a boxblur algorithm to the input video.
  3679. It accepts the following parameters:
  3680. @table @option
  3681. @item luma_radius, lr
  3682. @item luma_power, lp
  3683. @item chroma_radius, cr
  3684. @item chroma_power, cp
  3685. @item alpha_radius, ar
  3686. @item alpha_power, ap
  3687. @end table
  3688. A description of the accepted options follows.
  3689. @table @option
  3690. @item luma_radius, lr
  3691. @item chroma_radius, cr
  3692. @item alpha_radius, ar
  3693. Set an expression for the box radius in pixels used for blurring the
  3694. corresponding input plane.
  3695. The radius value must be a non-negative number, and must not be
  3696. greater than the value of the expression @code{min(w,h)/2} for the
  3697. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3698. planes.
  3699. Default value for @option{luma_radius} is "2". If not specified,
  3700. @option{chroma_radius} and @option{alpha_radius} default to the
  3701. corresponding value set for @option{luma_radius}.
  3702. The expressions can contain the following constants:
  3703. @table @option
  3704. @item w
  3705. @item h
  3706. The input width and height in pixels.
  3707. @item cw
  3708. @item ch
  3709. The input chroma image width and height in pixels.
  3710. @item hsub
  3711. @item vsub
  3712. The horizontal and vertical chroma subsample values. For example, for the
  3713. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3714. @end table
  3715. @item luma_power, lp
  3716. @item chroma_power, cp
  3717. @item alpha_power, ap
  3718. Specify how many times the boxblur filter is applied to the
  3719. corresponding plane.
  3720. Default value for @option{luma_power} is 2. If not specified,
  3721. @option{chroma_power} and @option{alpha_power} default to the
  3722. corresponding value set for @option{luma_power}.
  3723. A value of 0 will disable the effect.
  3724. @end table
  3725. @subsection Examples
  3726. @itemize
  3727. @item
  3728. Apply a boxblur filter with the luma, chroma, and alpha radii
  3729. set to 2:
  3730. @example
  3731. boxblur=luma_radius=2:luma_power=1
  3732. boxblur=2:1
  3733. @end example
  3734. @item
  3735. Set the luma radius to 2, and alpha and chroma radius to 0:
  3736. @example
  3737. boxblur=2:1:cr=0:ar=0
  3738. @end example
  3739. @item
  3740. Set the luma and chroma radii to a fraction of the video dimension:
  3741. @example
  3742. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3743. @end example
  3744. @end itemize
  3745. @section bwdif
  3746. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3747. Deinterlacing Filter").
  3748. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3749. interpolation algorithms.
  3750. It accepts the following parameters:
  3751. @table @option
  3752. @item mode
  3753. The interlacing mode to adopt. It accepts one of the following values:
  3754. @table @option
  3755. @item 0, send_frame
  3756. Output one frame for each frame.
  3757. @item 1, send_field
  3758. Output one frame for each field.
  3759. @end table
  3760. The default value is @code{send_field}.
  3761. @item parity
  3762. The picture field parity assumed for the input interlaced video. It accepts one
  3763. of the following values:
  3764. @table @option
  3765. @item 0, tff
  3766. Assume the top field is first.
  3767. @item 1, bff
  3768. Assume the bottom field is first.
  3769. @item -1, auto
  3770. Enable automatic detection of field parity.
  3771. @end table
  3772. The default value is @code{auto}.
  3773. If the interlacing is unknown or the decoder does not export this information,
  3774. top field first will be assumed.
  3775. @item deint
  3776. Specify which frames to deinterlace. Accept one of the following
  3777. values:
  3778. @table @option
  3779. @item 0, all
  3780. Deinterlace all frames.
  3781. @item 1, interlaced
  3782. Only deinterlace frames marked as interlaced.
  3783. @end table
  3784. The default value is @code{all}.
  3785. @end table
  3786. @section chromakey
  3787. YUV colorspace color/chroma keying.
  3788. The filter accepts the following options:
  3789. @table @option
  3790. @item color
  3791. The color which will be replaced with transparency.
  3792. @item similarity
  3793. Similarity percentage with the key color.
  3794. 0.01 matches only the exact key color, while 1.0 matches everything.
  3795. @item blend
  3796. Blend percentage.
  3797. 0.0 makes pixels either fully transparent, or not transparent at all.
  3798. Higher values result in semi-transparent pixels, with a higher transparency
  3799. the more similar the pixels color is to the key color.
  3800. @item yuv
  3801. Signals that the color passed is already in YUV instead of RGB.
  3802. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3803. This can be used to pass exact YUV values as hexadecimal numbers.
  3804. @end table
  3805. @subsection Examples
  3806. @itemize
  3807. @item
  3808. Make every green pixel in the input image transparent:
  3809. @example
  3810. ffmpeg -i input.png -vf chromakey=green out.png
  3811. @end example
  3812. @item
  3813. Overlay a greenscreen-video on top of a static black background.
  3814. @example
  3815. 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
  3816. @end example
  3817. @end itemize
  3818. @section ciescope
  3819. Display CIE color diagram with pixels overlaid onto it.
  3820. The filter accepts the following options:
  3821. @table @option
  3822. @item system
  3823. Set color system.
  3824. @table @samp
  3825. @item ntsc, 470m
  3826. @item ebu, 470bg
  3827. @item smpte
  3828. @item 240m
  3829. @item apple
  3830. @item widergb
  3831. @item cie1931
  3832. @item rec709, hdtv
  3833. @item uhdtv, rec2020
  3834. @end table
  3835. @item cie
  3836. Set CIE system.
  3837. @table @samp
  3838. @item xyy
  3839. @item ucs
  3840. @item luv
  3841. @end table
  3842. @item gamuts
  3843. Set what gamuts to draw.
  3844. See @code{system} option for available values.
  3845. @item size, s
  3846. Set ciescope size, by default set to 512.
  3847. @item intensity, i
  3848. Set intensity used to map input pixel values to CIE diagram.
  3849. @item contrast
  3850. Set contrast used to draw tongue colors that are out of active color system gamut.
  3851. @item corrgamma
  3852. Correct gamma displayed on scope, by default enabled.
  3853. @item showwhite
  3854. Show white point on CIE diagram, by default disabled.
  3855. @item gamma
  3856. Set input gamma. Used only with XYZ input color space.
  3857. @end table
  3858. @section codecview
  3859. Visualize information exported by some codecs.
  3860. Some codecs can export information through frames using side-data or other
  3861. means. For example, some MPEG based codecs export motion vectors through the
  3862. @var{export_mvs} flag in the codec @option{flags2} option.
  3863. The filter accepts the following option:
  3864. @table @option
  3865. @item mv
  3866. Set motion vectors to visualize.
  3867. Available flags for @var{mv} are:
  3868. @table @samp
  3869. @item pf
  3870. forward predicted MVs of P-frames
  3871. @item bf
  3872. forward predicted MVs of B-frames
  3873. @item bb
  3874. backward predicted MVs of B-frames
  3875. @end table
  3876. @item qp
  3877. Display quantization parameters using the chroma planes.
  3878. @item mv_type, mvt
  3879. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3880. Available flags for @var{mv_type} are:
  3881. @table @samp
  3882. @item fp
  3883. forward predicted MVs
  3884. @item bp
  3885. backward predicted MVs
  3886. @end table
  3887. @item frame_type, ft
  3888. Set frame type to visualize motion vectors of.
  3889. Available flags for @var{frame_type} are:
  3890. @table @samp
  3891. @item if
  3892. intra-coded frames (I-frames)
  3893. @item pf
  3894. predicted frames (P-frames)
  3895. @item bf
  3896. bi-directionally predicted frames (B-frames)
  3897. @end table
  3898. @end table
  3899. @subsection Examples
  3900. @itemize
  3901. @item
  3902. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3903. @example
  3904. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3905. @end example
  3906. @item
  3907. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3908. @example
  3909. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3910. @end example
  3911. @end itemize
  3912. @section colorbalance
  3913. Modify intensity of primary colors (red, green and blue) of input frames.
  3914. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3915. regions for the red-cyan, green-magenta or blue-yellow balance.
  3916. A positive adjustment value shifts the balance towards the primary color, a negative
  3917. value towards the complementary color.
  3918. The filter accepts the following options:
  3919. @table @option
  3920. @item rs
  3921. @item gs
  3922. @item bs
  3923. Adjust red, green and blue shadows (darkest pixels).
  3924. @item rm
  3925. @item gm
  3926. @item bm
  3927. Adjust red, green and blue midtones (medium pixels).
  3928. @item rh
  3929. @item gh
  3930. @item bh
  3931. Adjust red, green and blue highlights (brightest pixels).
  3932. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3933. @end table
  3934. @subsection Examples
  3935. @itemize
  3936. @item
  3937. Add red color cast to shadows:
  3938. @example
  3939. colorbalance=rs=.3
  3940. @end example
  3941. @end itemize
  3942. @section colorkey
  3943. RGB colorspace color keying.
  3944. The filter accepts the following options:
  3945. @table @option
  3946. @item color
  3947. The color which will be replaced with transparency.
  3948. @item similarity
  3949. Similarity percentage with the key color.
  3950. 0.01 matches only the exact key color, while 1.0 matches everything.
  3951. @item blend
  3952. Blend percentage.
  3953. 0.0 makes pixels either fully transparent, or not transparent at all.
  3954. Higher values result in semi-transparent pixels, with a higher transparency
  3955. the more similar the pixels color is to the key color.
  3956. @end table
  3957. @subsection Examples
  3958. @itemize
  3959. @item
  3960. Make every green pixel in the input image transparent:
  3961. @example
  3962. ffmpeg -i input.png -vf colorkey=green out.png
  3963. @end example
  3964. @item
  3965. Overlay a greenscreen-video on top of a static background image.
  3966. @example
  3967. 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
  3968. @end example
  3969. @end itemize
  3970. @section colorlevels
  3971. Adjust video input frames using levels.
  3972. The filter accepts the following options:
  3973. @table @option
  3974. @item rimin
  3975. @item gimin
  3976. @item bimin
  3977. @item aimin
  3978. Adjust red, green, blue and alpha input black point.
  3979. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3980. @item rimax
  3981. @item gimax
  3982. @item bimax
  3983. @item aimax
  3984. Adjust red, green, blue and alpha input white point.
  3985. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3986. Input levels are used to lighten highlights (bright tones), darken shadows
  3987. (dark tones), change the balance of bright and dark tones.
  3988. @item romin
  3989. @item gomin
  3990. @item bomin
  3991. @item aomin
  3992. Adjust red, green, blue and alpha output black point.
  3993. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3994. @item romax
  3995. @item gomax
  3996. @item bomax
  3997. @item aomax
  3998. Adjust red, green, blue and alpha output white point.
  3999. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4000. Output levels allows manual selection of a constrained output level range.
  4001. @end table
  4002. @subsection Examples
  4003. @itemize
  4004. @item
  4005. Make video output darker:
  4006. @example
  4007. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4008. @end example
  4009. @item
  4010. Increase contrast:
  4011. @example
  4012. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4013. @end example
  4014. @item
  4015. Make video output lighter:
  4016. @example
  4017. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4018. @end example
  4019. @item
  4020. Increase brightness:
  4021. @example
  4022. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4023. @end example
  4024. @end itemize
  4025. @section colorchannelmixer
  4026. Adjust video input frames by re-mixing color channels.
  4027. This filter modifies a color channel by adding the values associated to
  4028. the other channels of the same pixels. For example if the value to
  4029. modify is red, the output value will be:
  4030. @example
  4031. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4032. @end example
  4033. The filter accepts the following options:
  4034. @table @option
  4035. @item rr
  4036. @item rg
  4037. @item rb
  4038. @item ra
  4039. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4040. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4041. @item gr
  4042. @item gg
  4043. @item gb
  4044. @item ga
  4045. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4046. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4047. @item br
  4048. @item bg
  4049. @item bb
  4050. @item ba
  4051. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4052. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4053. @item ar
  4054. @item ag
  4055. @item ab
  4056. @item aa
  4057. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4058. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4059. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4060. @end table
  4061. @subsection Examples
  4062. @itemize
  4063. @item
  4064. Convert source to grayscale:
  4065. @example
  4066. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4067. @end example
  4068. @item
  4069. Simulate sepia tones:
  4070. @example
  4071. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4072. @end example
  4073. @end itemize
  4074. @section colormatrix
  4075. Convert color matrix.
  4076. The filter accepts the following options:
  4077. @table @option
  4078. @item src
  4079. @item dst
  4080. Specify the source and destination color matrix. Both values must be
  4081. specified.
  4082. The accepted values are:
  4083. @table @samp
  4084. @item bt709
  4085. BT.709
  4086. @item fcc
  4087. FCC
  4088. @item bt601
  4089. BT.601
  4090. @item bt470
  4091. BT.470
  4092. @item bt470bg
  4093. BT.470BG
  4094. @item smpte170m
  4095. SMPTE-170M
  4096. @item smpte240m
  4097. SMPTE-240M
  4098. @item bt2020
  4099. BT.2020
  4100. @end table
  4101. @end table
  4102. For example to convert from BT.601 to SMPTE-240M, use the command:
  4103. @example
  4104. colormatrix=bt601:smpte240m
  4105. @end example
  4106. @section colorspace
  4107. Convert colorspace, transfer characteristics or color primaries.
  4108. Input video needs to have an even size.
  4109. The filter accepts the following options:
  4110. @table @option
  4111. @anchor{all}
  4112. @item all
  4113. Specify all color properties at once.
  4114. The accepted values are:
  4115. @table @samp
  4116. @item bt470m
  4117. BT.470M
  4118. @item bt470bg
  4119. BT.470BG
  4120. @item bt601-6-525
  4121. BT.601-6 525
  4122. @item bt601-6-625
  4123. BT.601-6 625
  4124. @item bt709
  4125. BT.709
  4126. @item smpte170m
  4127. SMPTE-170M
  4128. @item smpte240m
  4129. SMPTE-240M
  4130. @item bt2020
  4131. BT.2020
  4132. @end table
  4133. @anchor{space}
  4134. @item space
  4135. Specify output colorspace.
  4136. The accepted values are:
  4137. @table @samp
  4138. @item bt709
  4139. BT.709
  4140. @item fcc
  4141. FCC
  4142. @item bt470bg
  4143. BT.470BG or BT.601-6 625
  4144. @item smpte170m
  4145. SMPTE-170M or BT.601-6 525
  4146. @item smpte240m
  4147. SMPTE-240M
  4148. @item ycgco
  4149. YCgCo
  4150. @item bt2020ncl
  4151. BT.2020 with non-constant luminance
  4152. @end table
  4153. @anchor{trc}
  4154. @item trc
  4155. Specify output transfer characteristics.
  4156. The accepted values are:
  4157. @table @samp
  4158. @item bt709
  4159. BT.709
  4160. @item bt470m
  4161. BT.470M
  4162. @item bt470bg
  4163. BT.470BG
  4164. @item gamma22
  4165. Constant gamma of 2.2
  4166. @item gamma28
  4167. Constant gamma of 2.8
  4168. @item smpte170m
  4169. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4170. @item smpte240m
  4171. SMPTE-240M
  4172. @item srgb
  4173. SRGB
  4174. @item iec61966-2-1
  4175. iec61966-2-1
  4176. @item iec61966-2-4
  4177. iec61966-2-4
  4178. @item xvycc
  4179. xvycc
  4180. @item bt2020-10
  4181. BT.2020 for 10-bits content
  4182. @item bt2020-12
  4183. BT.2020 for 12-bits content
  4184. @end table
  4185. @anchor{primaries}
  4186. @item primaries
  4187. Specify output color primaries.
  4188. The accepted values are:
  4189. @table @samp
  4190. @item bt709
  4191. BT.709
  4192. @item bt470m
  4193. BT.470M
  4194. @item bt470bg
  4195. BT.470BG or BT.601-6 625
  4196. @item smpte170m
  4197. SMPTE-170M or BT.601-6 525
  4198. @item smpte240m
  4199. SMPTE-240M
  4200. @item film
  4201. film
  4202. @item smpte431
  4203. SMPTE-431
  4204. @item smpte432
  4205. SMPTE-432
  4206. @item bt2020
  4207. BT.2020
  4208. @end table
  4209. @anchor{range}
  4210. @item range
  4211. Specify output color range.
  4212. The accepted values are:
  4213. @table @samp
  4214. @item tv
  4215. TV (restricted) range
  4216. @item mpeg
  4217. MPEG (restricted) range
  4218. @item pc
  4219. PC (full) range
  4220. @item jpeg
  4221. JPEG (full) range
  4222. @end table
  4223. @item format
  4224. Specify output color format.
  4225. The accepted values are:
  4226. @table @samp
  4227. @item yuv420p
  4228. YUV 4:2:0 planar 8-bits
  4229. @item yuv420p10
  4230. YUV 4:2:0 planar 10-bits
  4231. @item yuv420p12
  4232. YUV 4:2:0 planar 12-bits
  4233. @item yuv422p
  4234. YUV 4:2:2 planar 8-bits
  4235. @item yuv422p10
  4236. YUV 4:2:2 planar 10-bits
  4237. @item yuv422p12
  4238. YUV 4:2:2 planar 12-bits
  4239. @item yuv444p
  4240. YUV 4:4:4 planar 8-bits
  4241. @item yuv444p10
  4242. YUV 4:4:4 planar 10-bits
  4243. @item yuv444p12
  4244. YUV 4:4:4 planar 12-bits
  4245. @end table
  4246. @item fast
  4247. Do a fast conversion, which skips gamma/primary correction. This will take
  4248. significantly less CPU, but will be mathematically incorrect. To get output
  4249. compatible with that produced by the colormatrix filter, use fast=1.
  4250. @item dither
  4251. Specify dithering mode.
  4252. The accepted values are:
  4253. @table @samp
  4254. @item none
  4255. No dithering
  4256. @item fsb
  4257. Floyd-Steinberg dithering
  4258. @end table
  4259. @item wpadapt
  4260. Whitepoint adaptation mode.
  4261. The accepted values are:
  4262. @table @samp
  4263. @item bradford
  4264. Bradford whitepoint adaptation
  4265. @item vonkries
  4266. von Kries whitepoint adaptation
  4267. @item identity
  4268. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4269. @end table
  4270. @item iall
  4271. Override all input properties at once. Same accepted values as @ref{all}.
  4272. @item ispace
  4273. Override input colorspace. Same accepted values as @ref{space}.
  4274. @item iprimaries
  4275. Override input color primaries. Same accepted values as @ref{primaries}.
  4276. @item itrc
  4277. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4278. @item irange
  4279. Override input color range. Same accepted values as @ref{range}.
  4280. @end table
  4281. The filter converts the transfer characteristics, color space and color
  4282. primaries to the specified user values. The output value, if not specified,
  4283. is set to a default value based on the "all" property. If that property is
  4284. also not specified, the filter will log an error. The output color range and
  4285. format default to the same value as the input color range and format. The
  4286. input transfer characteristics, color space, color primaries and color range
  4287. should be set on the input data. If any of these are missing, the filter will
  4288. log an error and no conversion will take place.
  4289. For example to convert the input to SMPTE-240M, use the command:
  4290. @example
  4291. colorspace=smpte240m
  4292. @end example
  4293. @section convolution
  4294. Apply convolution 3x3 or 5x5 filter.
  4295. The filter accepts the following options:
  4296. @table @option
  4297. @item 0m
  4298. @item 1m
  4299. @item 2m
  4300. @item 3m
  4301. Set matrix for each plane.
  4302. Matrix is sequence of 9 or 25 signed integers.
  4303. @item 0rdiv
  4304. @item 1rdiv
  4305. @item 2rdiv
  4306. @item 3rdiv
  4307. Set multiplier for calculated value for each plane.
  4308. @item 0bias
  4309. @item 1bias
  4310. @item 2bias
  4311. @item 3bias
  4312. Set bias for each plane. This value is added to the result of the multiplication.
  4313. Useful for making the overall image brighter or darker. Default is 0.0.
  4314. @end table
  4315. @subsection Examples
  4316. @itemize
  4317. @item
  4318. Apply sharpen:
  4319. @example
  4320. 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"
  4321. @end example
  4322. @item
  4323. Apply blur:
  4324. @example
  4325. 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"
  4326. @end example
  4327. @item
  4328. Apply edge enhance:
  4329. @example
  4330. 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"
  4331. @end example
  4332. @item
  4333. Apply edge detect:
  4334. @example
  4335. 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"
  4336. @end example
  4337. @item
  4338. Apply emboss:
  4339. @example
  4340. 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"
  4341. @end example
  4342. @end itemize
  4343. @section copy
  4344. Copy the input source unchanged to the output. This is mainly useful for
  4345. testing purposes.
  4346. @anchor{coreimage}
  4347. @section coreimage
  4348. Video filtering on GPU using Apple's CoreImage API on OSX.
  4349. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4350. processed by video hardware. However, software-based OpenGL implementations
  4351. exist which means there is no guarantee for hardware processing. It depends on
  4352. the respective OSX.
  4353. There are many filters and image generators provided by Apple that come with a
  4354. large variety of options. The filter has to be referenced by its name along
  4355. with its options.
  4356. The coreimage filter accepts the following options:
  4357. @table @option
  4358. @item list_filters
  4359. List all available filters and generators along with all their respective
  4360. options as well as possible minimum and maximum values along with the default
  4361. values.
  4362. @example
  4363. list_filters=true
  4364. @end example
  4365. @item filter
  4366. Specify all filters by their respective name and options.
  4367. Use @var{list_filters} to determine all valid filter names and options.
  4368. Numerical options are specified by a float value and are automatically clamped
  4369. to their respective value range. Vector and color options have to be specified
  4370. by a list of space separated float values. Character escaping has to be done.
  4371. A special option name @code{default} is available to use default options for a
  4372. filter.
  4373. It is required to specify either @code{default} or at least one of the filter options.
  4374. All omitted options are used with their default values.
  4375. The syntax of the filter string is as follows:
  4376. @example
  4377. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4378. @end example
  4379. @item output_rect
  4380. Specify a rectangle where the output of the filter chain is copied into the
  4381. input image. It is given by a list of space separated float values:
  4382. @example
  4383. output_rect=x\ y\ width\ height
  4384. @end example
  4385. If not given, the output rectangle equals the dimensions of the input image.
  4386. The output rectangle is automatically cropped at the borders of the input
  4387. image. Negative values are valid for each component.
  4388. @example
  4389. output_rect=25\ 25\ 100\ 100
  4390. @end example
  4391. @end table
  4392. Several filters can be chained for successive processing without GPU-HOST
  4393. transfers allowing for fast processing of complex filter chains.
  4394. Currently, only filters with zero (generators) or exactly one (filters) input
  4395. image and one output image are supported. Also, transition filters are not yet
  4396. usable as intended.
  4397. Some filters generate output images with additional padding depending on the
  4398. respective filter kernel. The padding is automatically removed to ensure the
  4399. filter output has the same size as the input image.
  4400. For image generators, the size of the output image is determined by the
  4401. previous output image of the filter chain or the input image of the whole
  4402. filterchain, respectively. The generators do not use the pixel information of
  4403. this image to generate their output. However, the generated output is
  4404. blended onto this image, resulting in partial or complete coverage of the
  4405. output image.
  4406. The @ref{coreimagesrc} video source can be used for generating input images
  4407. which are directly fed into the filter chain. By using it, providing input
  4408. images by another video source or an input video is not required.
  4409. @subsection Examples
  4410. @itemize
  4411. @item
  4412. List all filters available:
  4413. @example
  4414. coreimage=list_filters=true
  4415. @end example
  4416. @item
  4417. Use the CIBoxBlur filter with default options to blur an image:
  4418. @example
  4419. coreimage=filter=CIBoxBlur@@default
  4420. @end example
  4421. @item
  4422. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4423. its center at 100x100 and a radius of 50 pixels:
  4424. @example
  4425. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4426. @end example
  4427. @item
  4428. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4429. given as complete and escaped command-line for Apple's standard bash shell:
  4430. @example
  4431. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4432. @end example
  4433. @end itemize
  4434. @section crop
  4435. Crop the input video to given dimensions.
  4436. It accepts the following parameters:
  4437. @table @option
  4438. @item w, out_w
  4439. The width of the output video. It defaults to @code{iw}.
  4440. This expression is evaluated only once during the filter
  4441. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4442. @item h, out_h
  4443. The height of the output video. It defaults to @code{ih}.
  4444. This expression is evaluated only once during the filter
  4445. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4446. @item x
  4447. The horizontal position, in the input video, of the left edge of the output
  4448. video. It defaults to @code{(in_w-out_w)/2}.
  4449. This expression is evaluated per-frame.
  4450. @item y
  4451. The vertical position, in the input video, of the top edge of the output video.
  4452. It defaults to @code{(in_h-out_h)/2}.
  4453. This expression is evaluated per-frame.
  4454. @item keep_aspect
  4455. If set to 1 will force the output display aspect ratio
  4456. to be the same of the input, by changing the output sample aspect
  4457. ratio. It defaults to 0.
  4458. @item exact
  4459. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4460. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4461. It defaults to 0.
  4462. @end table
  4463. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4464. expressions containing the following constants:
  4465. @table @option
  4466. @item x
  4467. @item y
  4468. The computed values for @var{x} and @var{y}. They are evaluated for
  4469. each new frame.
  4470. @item in_w
  4471. @item in_h
  4472. The input width and height.
  4473. @item iw
  4474. @item ih
  4475. These are the same as @var{in_w} and @var{in_h}.
  4476. @item out_w
  4477. @item out_h
  4478. The output (cropped) width and height.
  4479. @item ow
  4480. @item oh
  4481. These are the same as @var{out_w} and @var{out_h}.
  4482. @item a
  4483. same as @var{iw} / @var{ih}
  4484. @item sar
  4485. input sample aspect ratio
  4486. @item dar
  4487. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4488. @item hsub
  4489. @item vsub
  4490. horizontal and vertical chroma subsample values. For example for the
  4491. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4492. @item n
  4493. The number of the input frame, starting from 0.
  4494. @item pos
  4495. the position in the file of the input frame, NAN if unknown
  4496. @item t
  4497. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4498. @end table
  4499. The expression for @var{out_w} may depend on the value of @var{out_h},
  4500. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4501. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4502. evaluated after @var{out_w} and @var{out_h}.
  4503. The @var{x} and @var{y} parameters specify the expressions for the
  4504. position of the top-left corner of the output (non-cropped) area. They
  4505. are evaluated for each frame. If the evaluated value is not valid, it
  4506. is approximated to the nearest valid value.
  4507. The expression for @var{x} may depend on @var{y}, and the expression
  4508. for @var{y} may depend on @var{x}.
  4509. @subsection Examples
  4510. @itemize
  4511. @item
  4512. Crop area with size 100x100 at position (12,34).
  4513. @example
  4514. crop=100:100:12:34
  4515. @end example
  4516. Using named options, the example above becomes:
  4517. @example
  4518. crop=w=100:h=100:x=12:y=34
  4519. @end example
  4520. @item
  4521. Crop the central input area with size 100x100:
  4522. @example
  4523. crop=100:100
  4524. @end example
  4525. @item
  4526. Crop the central input area with size 2/3 of the input video:
  4527. @example
  4528. crop=2/3*in_w:2/3*in_h
  4529. @end example
  4530. @item
  4531. Crop the input video central square:
  4532. @example
  4533. crop=out_w=in_h
  4534. crop=in_h
  4535. @end example
  4536. @item
  4537. Delimit the rectangle with the top-left corner placed at position
  4538. 100:100 and the right-bottom corner corresponding to the right-bottom
  4539. corner of the input image.
  4540. @example
  4541. crop=in_w-100:in_h-100:100:100
  4542. @end example
  4543. @item
  4544. Crop 10 pixels from the left and right borders, and 20 pixels from
  4545. the top and bottom borders
  4546. @example
  4547. crop=in_w-2*10:in_h-2*20
  4548. @end example
  4549. @item
  4550. Keep only the bottom right quarter of the input image:
  4551. @example
  4552. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4553. @end example
  4554. @item
  4555. Crop height for getting Greek harmony:
  4556. @example
  4557. crop=in_w:1/PHI*in_w
  4558. @end example
  4559. @item
  4560. Apply trembling effect:
  4561. @example
  4562. 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)
  4563. @end example
  4564. @item
  4565. Apply erratic camera effect depending on timestamp:
  4566. @example
  4567. 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)"
  4568. @end example
  4569. @item
  4570. Set x depending on the value of y:
  4571. @example
  4572. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4573. @end example
  4574. @end itemize
  4575. @subsection Commands
  4576. This filter supports the following commands:
  4577. @table @option
  4578. @item w, out_w
  4579. @item h, out_h
  4580. @item x
  4581. @item y
  4582. Set width/height of the output video and the horizontal/vertical position
  4583. in the input video.
  4584. The command accepts the same syntax of the corresponding option.
  4585. If the specified expression is not valid, it is kept at its current
  4586. value.
  4587. @end table
  4588. @section cropdetect
  4589. Auto-detect the crop size.
  4590. It calculates the necessary cropping parameters and prints the
  4591. recommended parameters via the logging system. The detected dimensions
  4592. correspond to the non-black area of the input video.
  4593. It accepts the following parameters:
  4594. @table @option
  4595. @item limit
  4596. Set higher black value threshold, which can be optionally specified
  4597. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4598. value greater to the set value is considered non-black. It defaults to 24.
  4599. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4600. on the bitdepth of the pixel format.
  4601. @item round
  4602. The value which the width/height should be divisible by. It defaults to
  4603. 16. The offset is automatically adjusted to center the video. Use 2 to
  4604. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4605. encoding to most video codecs.
  4606. @item reset_count, reset
  4607. Set the counter that determines after how many frames cropdetect will
  4608. reset the previously detected largest video area and start over to
  4609. detect the current optimal crop area. Default value is 0.
  4610. This can be useful when channel logos distort the video area. 0
  4611. indicates 'never reset', and returns the largest area encountered during
  4612. playback.
  4613. @end table
  4614. @anchor{curves}
  4615. @section curves
  4616. Apply color adjustments using curves.
  4617. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4618. component (red, green and blue) has its values defined by @var{N} key points
  4619. tied from each other using a smooth curve. The x-axis represents the pixel
  4620. values from the input frame, and the y-axis the new pixel values to be set for
  4621. the output frame.
  4622. By default, a component curve is defined by the two points @var{(0;0)} and
  4623. @var{(1;1)}. This creates a straight line where each original pixel value is
  4624. "adjusted" to its own value, which means no change to the image.
  4625. The filter allows you to redefine these two points and add some more. A new
  4626. curve (using a natural cubic spline interpolation) will be define to pass
  4627. smoothly through all these new coordinates. The new defined points needs to be
  4628. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4629. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4630. the vector spaces, the values will be clipped accordingly.
  4631. The filter accepts the following options:
  4632. @table @option
  4633. @item preset
  4634. Select one of the available color presets. This option can be used in addition
  4635. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4636. options takes priority on the preset values.
  4637. Available presets are:
  4638. @table @samp
  4639. @item none
  4640. @item color_negative
  4641. @item cross_process
  4642. @item darker
  4643. @item increase_contrast
  4644. @item lighter
  4645. @item linear_contrast
  4646. @item medium_contrast
  4647. @item negative
  4648. @item strong_contrast
  4649. @item vintage
  4650. @end table
  4651. Default is @code{none}.
  4652. @item master, m
  4653. Set the master key points. These points will define a second pass mapping. It
  4654. is sometimes called a "luminance" or "value" mapping. It can be used with
  4655. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4656. post-processing LUT.
  4657. @item red, r
  4658. Set the key points for the red component.
  4659. @item green, g
  4660. Set the key points for the green component.
  4661. @item blue, b
  4662. Set the key points for the blue component.
  4663. @item all
  4664. Set the key points for all components (not including master).
  4665. Can be used in addition to the other key points component
  4666. options. In this case, the unset component(s) will fallback on this
  4667. @option{all} setting.
  4668. @item psfile
  4669. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4670. @item plot
  4671. Save Gnuplot script of the curves in specified file.
  4672. @end table
  4673. To avoid some filtergraph syntax conflicts, each key points list need to be
  4674. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4675. @subsection Examples
  4676. @itemize
  4677. @item
  4678. Increase slightly the middle level of blue:
  4679. @example
  4680. curves=blue='0/0 0.5/0.58 1/1'
  4681. @end example
  4682. @item
  4683. Vintage effect:
  4684. @example
  4685. 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'
  4686. @end example
  4687. Here we obtain the following coordinates for each components:
  4688. @table @var
  4689. @item red
  4690. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4691. @item green
  4692. @code{(0;0) (0.50;0.48) (1;1)}
  4693. @item blue
  4694. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4695. @end table
  4696. @item
  4697. The previous example can also be achieved with the associated built-in preset:
  4698. @example
  4699. curves=preset=vintage
  4700. @end example
  4701. @item
  4702. Or simply:
  4703. @example
  4704. curves=vintage
  4705. @end example
  4706. @item
  4707. Use a Photoshop preset and redefine the points of the green component:
  4708. @example
  4709. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4710. @end example
  4711. @item
  4712. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4713. and @command{gnuplot}:
  4714. @example
  4715. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4716. gnuplot -p /tmp/curves.plt
  4717. @end example
  4718. @end itemize
  4719. @section datascope
  4720. Video data analysis filter.
  4721. This filter shows hexadecimal pixel values of part of video.
  4722. The filter accepts the following options:
  4723. @table @option
  4724. @item size, s
  4725. Set output video size.
  4726. @item x
  4727. Set x offset from where to pick pixels.
  4728. @item y
  4729. Set y offset from where to pick pixels.
  4730. @item mode
  4731. Set scope mode, can be one of the following:
  4732. @table @samp
  4733. @item mono
  4734. Draw hexadecimal pixel values with white color on black background.
  4735. @item color
  4736. Draw hexadecimal pixel values with input video pixel color on black
  4737. background.
  4738. @item color2
  4739. Draw hexadecimal pixel values on color background picked from input video,
  4740. the text color is picked in such way so its always visible.
  4741. @end table
  4742. @item axis
  4743. Draw rows and columns numbers on left and top of video.
  4744. @item opacity
  4745. Set background opacity.
  4746. @end table
  4747. @section dctdnoiz
  4748. Denoise frames using 2D DCT (frequency domain filtering).
  4749. This filter is not designed for real time.
  4750. The filter accepts the following options:
  4751. @table @option
  4752. @item sigma, s
  4753. Set the noise sigma constant.
  4754. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4755. coefficient (absolute value) below this threshold with be dropped.
  4756. If you need a more advanced filtering, see @option{expr}.
  4757. Default is @code{0}.
  4758. @item overlap
  4759. Set number overlapping pixels for each block. Since the filter can be slow, you
  4760. may want to reduce this value, at the cost of a less effective filter and the
  4761. risk of various artefacts.
  4762. If the overlapping value doesn't permit processing the whole input width or
  4763. height, a warning will be displayed and according borders won't be denoised.
  4764. Default value is @var{blocksize}-1, which is the best possible setting.
  4765. @item expr, e
  4766. Set the coefficient factor expression.
  4767. For each coefficient of a DCT block, this expression will be evaluated as a
  4768. multiplier value for the coefficient.
  4769. If this is option is set, the @option{sigma} option will be ignored.
  4770. The absolute value of the coefficient can be accessed through the @var{c}
  4771. variable.
  4772. @item n
  4773. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4774. @var{blocksize}, which is the width and height of the processed blocks.
  4775. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4776. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4777. on the speed processing. Also, a larger block size does not necessarily means a
  4778. better de-noising.
  4779. @end table
  4780. @subsection Examples
  4781. Apply a denoise with a @option{sigma} of @code{4.5}:
  4782. @example
  4783. dctdnoiz=4.5
  4784. @end example
  4785. The same operation can be achieved using the expression system:
  4786. @example
  4787. dctdnoiz=e='gte(c, 4.5*3)'
  4788. @end example
  4789. Violent denoise using a block size of @code{16x16}:
  4790. @example
  4791. dctdnoiz=15:n=4
  4792. @end example
  4793. @section deband
  4794. Remove banding artifacts from input video.
  4795. It works by replacing banded pixels with average value of referenced pixels.
  4796. The filter accepts the following options:
  4797. @table @option
  4798. @item 1thr
  4799. @item 2thr
  4800. @item 3thr
  4801. @item 4thr
  4802. Set banding detection threshold for each plane. Default is 0.02.
  4803. Valid range is 0.00003 to 0.5.
  4804. If difference between current pixel and reference pixel is less than threshold,
  4805. it will be considered as banded.
  4806. @item range, r
  4807. Banding detection range in pixels. Default is 16. If positive, random number
  4808. in range 0 to set value will be used. If negative, exact absolute value
  4809. will be used.
  4810. The range defines square of four pixels around current pixel.
  4811. @item direction, d
  4812. Set direction in radians from which four pixel will be compared. If positive,
  4813. random direction from 0 to set direction will be picked. If negative, exact of
  4814. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4815. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4816. column.
  4817. @item blur, b
  4818. If enabled, current pixel is compared with average value of all four
  4819. surrounding pixels. The default is enabled. If disabled current pixel is
  4820. compared with all four surrounding pixels. The pixel is considered banded
  4821. if only all four differences with surrounding pixels are less than threshold.
  4822. @item coupling, c
  4823. If enabled, current pixel is changed if and only if all pixel components are banded,
  4824. e.g. banding detection threshold is triggered for all color components.
  4825. The default is disabled.
  4826. @end table
  4827. @anchor{decimate}
  4828. @section decimate
  4829. Drop duplicated frames at regular intervals.
  4830. The filter accepts the following options:
  4831. @table @option
  4832. @item cycle
  4833. Set the number of frames from which one will be dropped. Setting this to
  4834. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4835. Default is @code{5}.
  4836. @item dupthresh
  4837. Set the threshold for duplicate detection. If the difference metric for a frame
  4838. is less than or equal to this value, then it is declared as duplicate. Default
  4839. is @code{1.1}
  4840. @item scthresh
  4841. Set scene change threshold. Default is @code{15}.
  4842. @item blockx
  4843. @item blocky
  4844. Set the size of the x and y-axis blocks used during metric calculations.
  4845. Larger blocks give better noise suppression, but also give worse detection of
  4846. small movements. Must be a power of two. Default is @code{32}.
  4847. @item ppsrc
  4848. Mark main input as a pre-processed input and activate clean source input
  4849. stream. This allows the input to be pre-processed with various filters to help
  4850. the metrics calculation while keeping the frame selection lossless. When set to
  4851. @code{1}, the first stream is for the pre-processed input, and the second
  4852. stream is the clean source from where the kept frames are chosen. Default is
  4853. @code{0}.
  4854. @item chroma
  4855. Set whether or not chroma is considered in the metric calculations. Default is
  4856. @code{1}.
  4857. @end table
  4858. @section deflate
  4859. Apply deflate effect to the video.
  4860. This filter replaces the pixel by the local(3x3) average by taking into account
  4861. only values lower than the pixel.
  4862. It accepts the following options:
  4863. @table @option
  4864. @item threshold0
  4865. @item threshold1
  4866. @item threshold2
  4867. @item threshold3
  4868. Limit the maximum change for each plane, default is 65535.
  4869. If 0, plane will remain unchanged.
  4870. @end table
  4871. @section deflicker
  4872. Remove temporal frame luminance variations.
  4873. It accepts the following options:
  4874. @table @option
  4875. @item size, s
  4876. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  4877. @item mode, m
  4878. Set averaging mode to smooth temporal luminance variations.
  4879. Available values are:
  4880. @table @samp
  4881. @item am
  4882. Arithmetic mean
  4883. @item gm
  4884. Geometric mean
  4885. @item hm
  4886. Harmonic mean
  4887. @item qm
  4888. Quadratic mean
  4889. @item cm
  4890. Cubic mean
  4891. @item pm
  4892. Power mean
  4893. @item median
  4894. Median
  4895. @end table
  4896. @end table
  4897. @section dejudder
  4898. Remove judder produced by partially interlaced telecined content.
  4899. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4900. source was partially telecined content then the output of @code{pullup,dejudder}
  4901. will have a variable frame rate. May change the recorded frame rate of the
  4902. container. Aside from that change, this filter will not affect constant frame
  4903. rate video.
  4904. The option available in this filter is:
  4905. @table @option
  4906. @item cycle
  4907. Specify the length of the window over which the judder repeats.
  4908. Accepts any integer greater than 1. Useful values are:
  4909. @table @samp
  4910. @item 4
  4911. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4912. @item 5
  4913. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4914. @item 20
  4915. If a mixture of the two.
  4916. @end table
  4917. The default is @samp{4}.
  4918. @end table
  4919. @section delogo
  4920. Suppress a TV station logo by a simple interpolation of the surrounding
  4921. pixels. Just set a rectangle covering the logo and watch it disappear
  4922. (and sometimes something even uglier appear - your mileage may vary).
  4923. It accepts the following parameters:
  4924. @table @option
  4925. @item x
  4926. @item y
  4927. Specify the top left corner coordinates of the logo. They must be
  4928. specified.
  4929. @item w
  4930. @item h
  4931. Specify the width and height of the logo to clear. They must be
  4932. specified.
  4933. @item band, t
  4934. Specify the thickness of the fuzzy edge of the rectangle (added to
  4935. @var{w} and @var{h}). The default value is 1. This option is
  4936. deprecated, setting higher values should no longer be necessary and
  4937. is not recommended.
  4938. @item show
  4939. When set to 1, a green rectangle is drawn on the screen to simplify
  4940. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4941. The default value is 0.
  4942. The rectangle is drawn on the outermost pixels which will be (partly)
  4943. replaced with interpolated values. The values of the next pixels
  4944. immediately outside this rectangle in each direction will be used to
  4945. compute the interpolated pixel values inside the rectangle.
  4946. @end table
  4947. @subsection Examples
  4948. @itemize
  4949. @item
  4950. Set a rectangle covering the area with top left corner coordinates 0,0
  4951. and size 100x77, and a band of size 10:
  4952. @example
  4953. delogo=x=0:y=0:w=100:h=77:band=10
  4954. @end example
  4955. @end itemize
  4956. @section deshake
  4957. Attempt to fix small changes in horizontal and/or vertical shift. This
  4958. filter helps remove camera shake from hand-holding a camera, bumping a
  4959. tripod, moving on a vehicle, etc.
  4960. The filter accepts the following options:
  4961. @table @option
  4962. @item x
  4963. @item y
  4964. @item w
  4965. @item h
  4966. Specify a rectangular area where to limit the search for motion
  4967. vectors.
  4968. If desired the search for motion vectors can be limited to a
  4969. rectangular area of the frame defined by its top left corner, width
  4970. and height. These parameters have the same meaning as the drawbox
  4971. filter which can be used to visualise the position of the bounding
  4972. box.
  4973. This is useful when simultaneous movement of subjects within the frame
  4974. might be confused for camera motion by the motion vector search.
  4975. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4976. then the full frame is used. This allows later options to be set
  4977. without specifying the bounding box for the motion vector search.
  4978. Default - search the whole frame.
  4979. @item rx
  4980. @item ry
  4981. Specify the maximum extent of movement in x and y directions in the
  4982. range 0-64 pixels. Default 16.
  4983. @item edge
  4984. Specify how to generate pixels to fill blanks at the edge of the
  4985. frame. Available values are:
  4986. @table @samp
  4987. @item blank, 0
  4988. Fill zeroes at blank locations
  4989. @item original, 1
  4990. Original image at blank locations
  4991. @item clamp, 2
  4992. Extruded edge value at blank locations
  4993. @item mirror, 3
  4994. Mirrored edge at blank locations
  4995. @end table
  4996. Default value is @samp{mirror}.
  4997. @item blocksize
  4998. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4999. default 8.
  5000. @item contrast
  5001. Specify the contrast threshold for blocks. Only blocks with more than
  5002. the specified contrast (difference between darkest and lightest
  5003. pixels) will be considered. Range 1-255, default 125.
  5004. @item search
  5005. Specify the search strategy. Available values are:
  5006. @table @samp
  5007. @item exhaustive, 0
  5008. Set exhaustive search
  5009. @item less, 1
  5010. Set less exhaustive search.
  5011. @end table
  5012. Default value is @samp{exhaustive}.
  5013. @item filename
  5014. If set then a detailed log of the motion search is written to the
  5015. specified file.
  5016. @item opencl
  5017. If set to 1, specify using OpenCL capabilities, only available if
  5018. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5019. @end table
  5020. @section detelecine
  5021. Apply an exact inverse of the telecine operation. It requires a predefined
  5022. pattern specified using the pattern option which must be the same as that passed
  5023. to the telecine filter.
  5024. This filter accepts the following options:
  5025. @table @option
  5026. @item first_field
  5027. @table @samp
  5028. @item top, t
  5029. top field first
  5030. @item bottom, b
  5031. bottom field first
  5032. The default value is @code{top}.
  5033. @end table
  5034. @item pattern
  5035. A string of numbers representing the pulldown pattern you wish to apply.
  5036. The default value is @code{23}.
  5037. @item start_frame
  5038. A number representing position of the first frame with respect to the telecine
  5039. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5040. @end table
  5041. @section dilation
  5042. Apply dilation effect to the video.
  5043. This filter replaces the pixel by the local(3x3) maximum.
  5044. It accepts the following options:
  5045. @table @option
  5046. @item threshold0
  5047. @item threshold1
  5048. @item threshold2
  5049. @item threshold3
  5050. Limit the maximum change for each plane, default is 65535.
  5051. If 0, plane will remain unchanged.
  5052. @item coordinates
  5053. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5054. pixels are used.
  5055. Flags to local 3x3 coordinates maps like this:
  5056. 1 2 3
  5057. 4 5
  5058. 6 7 8
  5059. @end table
  5060. @section displace
  5061. Displace pixels as indicated by second and third input stream.
  5062. It takes three input streams and outputs one stream, the first input is the
  5063. source, and second and third input are displacement maps.
  5064. The second input specifies how much to displace pixels along the
  5065. x-axis, while the third input specifies how much to displace pixels
  5066. along the y-axis.
  5067. If one of displacement map streams terminates, last frame from that
  5068. displacement map will be used.
  5069. Note that once generated, displacements maps can be reused over and over again.
  5070. A description of the accepted options follows.
  5071. @table @option
  5072. @item edge
  5073. Set displace behavior for pixels that are out of range.
  5074. Available values are:
  5075. @table @samp
  5076. @item blank
  5077. Missing pixels are replaced by black pixels.
  5078. @item smear
  5079. Adjacent pixels will spread out to replace missing pixels.
  5080. @item wrap
  5081. Out of range pixels are wrapped so they point to pixels of other side.
  5082. @end table
  5083. Default is @samp{smear}.
  5084. @end table
  5085. @subsection Examples
  5086. @itemize
  5087. @item
  5088. Add ripple effect to rgb input of video size hd720:
  5089. @example
  5090. 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
  5091. @end example
  5092. @item
  5093. Add wave effect to rgb input of video size hd720:
  5094. @example
  5095. 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
  5096. @end example
  5097. @end itemize
  5098. @section drawbox
  5099. Draw a colored box on the input image.
  5100. It accepts the following parameters:
  5101. @table @option
  5102. @item x
  5103. @item y
  5104. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5105. @item width, w
  5106. @item height, h
  5107. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5108. the input width and height. It defaults to 0.
  5109. @item color, c
  5110. Specify the color of the box to write. For the general syntax of this option,
  5111. check the "Color" section in the ffmpeg-utils manual. If the special
  5112. value @code{invert} is used, the box edge color is the same as the
  5113. video with inverted luma.
  5114. @item thickness, t
  5115. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5116. See below for the list of accepted constants.
  5117. @end table
  5118. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5119. following constants:
  5120. @table @option
  5121. @item dar
  5122. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5123. @item hsub
  5124. @item vsub
  5125. horizontal and vertical chroma subsample values. For example for the
  5126. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5127. @item in_h, ih
  5128. @item in_w, iw
  5129. The input width and height.
  5130. @item sar
  5131. The input sample aspect ratio.
  5132. @item x
  5133. @item y
  5134. The x and y offset coordinates where the box is drawn.
  5135. @item w
  5136. @item h
  5137. The width and height of the drawn box.
  5138. @item t
  5139. The thickness of the drawn box.
  5140. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5141. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5142. @end table
  5143. @subsection Examples
  5144. @itemize
  5145. @item
  5146. Draw a black box around the edge of the input image:
  5147. @example
  5148. drawbox
  5149. @end example
  5150. @item
  5151. Draw a box with color red and an opacity of 50%:
  5152. @example
  5153. drawbox=10:20:200:60:red@@0.5
  5154. @end example
  5155. The previous example can be specified as:
  5156. @example
  5157. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5158. @end example
  5159. @item
  5160. Fill the box with pink color:
  5161. @example
  5162. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5163. @end example
  5164. @item
  5165. Draw a 2-pixel red 2.40:1 mask:
  5166. @example
  5167. 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
  5168. @end example
  5169. @end itemize
  5170. @section drawgrid
  5171. Draw a grid on the input image.
  5172. It accepts the following parameters:
  5173. @table @option
  5174. @item x
  5175. @item y
  5176. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5177. @item width, w
  5178. @item height, h
  5179. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5180. input width and height, respectively, minus @code{thickness}, so image gets
  5181. framed. Default to 0.
  5182. @item color, c
  5183. Specify the color of the grid. For the general syntax of this option,
  5184. check the "Color" section in the ffmpeg-utils manual. If the special
  5185. value @code{invert} is used, the grid color is the same as the
  5186. video with inverted luma.
  5187. @item thickness, t
  5188. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5189. See below for the list of accepted constants.
  5190. @end table
  5191. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5192. following constants:
  5193. @table @option
  5194. @item dar
  5195. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5196. @item hsub
  5197. @item vsub
  5198. horizontal and vertical chroma subsample values. For example for the
  5199. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5200. @item in_h, ih
  5201. @item in_w, iw
  5202. The input grid cell width and height.
  5203. @item sar
  5204. The input sample aspect ratio.
  5205. @item x
  5206. @item y
  5207. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5208. @item w
  5209. @item h
  5210. The width and height of the drawn cell.
  5211. @item t
  5212. The thickness of the drawn cell.
  5213. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5214. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5215. @end table
  5216. @subsection Examples
  5217. @itemize
  5218. @item
  5219. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5220. @example
  5221. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5222. @end example
  5223. @item
  5224. Draw a white 3x3 grid with an opacity of 50%:
  5225. @example
  5226. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5227. @end example
  5228. @end itemize
  5229. @anchor{drawtext}
  5230. @section drawtext
  5231. Draw a text string or text from a specified file on top of a video, using the
  5232. libfreetype library.
  5233. To enable compilation of this filter, you need to configure FFmpeg with
  5234. @code{--enable-libfreetype}.
  5235. To enable default font fallback and the @var{font} option you need to
  5236. configure FFmpeg with @code{--enable-libfontconfig}.
  5237. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5238. @code{--enable-libfribidi}.
  5239. @subsection Syntax
  5240. It accepts the following parameters:
  5241. @table @option
  5242. @item box
  5243. Used to draw a box around text using the background color.
  5244. The value must be either 1 (enable) or 0 (disable).
  5245. The default value of @var{box} is 0.
  5246. @item boxborderw
  5247. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5248. The default value of @var{boxborderw} is 0.
  5249. @item boxcolor
  5250. The color to be used for drawing box around text. For the syntax of this
  5251. option, check the "Color" section in the ffmpeg-utils manual.
  5252. The default value of @var{boxcolor} is "white".
  5253. @item line_spacing
  5254. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5255. The default value of @var{line_spacing} is 0.
  5256. @item borderw
  5257. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5258. The default value of @var{borderw} is 0.
  5259. @item bordercolor
  5260. Set the color to be used for drawing border around text. For the syntax of this
  5261. option, check the "Color" section in the ffmpeg-utils manual.
  5262. The default value of @var{bordercolor} is "black".
  5263. @item expansion
  5264. Select how the @var{text} is expanded. Can be either @code{none},
  5265. @code{strftime} (deprecated) or
  5266. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5267. below for details.
  5268. @item basetime
  5269. Set a start time for the count. Value is in microseconds. Only applied
  5270. in the deprecated strftime expansion mode. To emulate in normal expansion
  5271. mode use the @code{pts} function, supplying the start time (in seconds)
  5272. as the second argument.
  5273. @item fix_bounds
  5274. If true, check and fix text coords to avoid clipping.
  5275. @item fontcolor
  5276. The color to be used for drawing fonts. For the syntax of this option, check
  5277. the "Color" section in the ffmpeg-utils manual.
  5278. The default value of @var{fontcolor} is "black".
  5279. @item fontcolor_expr
  5280. String which is expanded the same way as @var{text} to obtain dynamic
  5281. @var{fontcolor} value. By default this option has empty value and is not
  5282. processed. When this option is set, it overrides @var{fontcolor} option.
  5283. @item font
  5284. The font family to be used for drawing text. By default Sans.
  5285. @item fontfile
  5286. The font file to be used for drawing text. The path must be included.
  5287. This parameter is mandatory if the fontconfig support is disabled.
  5288. @item alpha
  5289. Draw the text applying alpha blending. The value can
  5290. be a number between 0.0 and 1.0.
  5291. The expression accepts the same variables @var{x, y} as well.
  5292. The default value is 1.
  5293. Please see @var{fontcolor_expr}.
  5294. @item fontsize
  5295. The font size to be used for drawing text.
  5296. The default value of @var{fontsize} is 16.
  5297. @item text_shaping
  5298. If set to 1, attempt to shape the text (for example, reverse the order of
  5299. right-to-left text and join Arabic characters) before drawing it.
  5300. Otherwise, just draw the text exactly as given.
  5301. By default 1 (if supported).
  5302. @item ft_load_flags
  5303. The flags to be used for loading the fonts.
  5304. The flags map the corresponding flags supported by libfreetype, and are
  5305. a combination of the following values:
  5306. @table @var
  5307. @item default
  5308. @item no_scale
  5309. @item no_hinting
  5310. @item render
  5311. @item no_bitmap
  5312. @item vertical_layout
  5313. @item force_autohint
  5314. @item crop_bitmap
  5315. @item pedantic
  5316. @item ignore_global_advance_width
  5317. @item no_recurse
  5318. @item ignore_transform
  5319. @item monochrome
  5320. @item linear_design
  5321. @item no_autohint
  5322. @end table
  5323. Default value is "default".
  5324. For more information consult the documentation for the FT_LOAD_*
  5325. libfreetype flags.
  5326. @item shadowcolor
  5327. The color to be used for drawing a shadow behind the drawn text. For the
  5328. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5329. The default value of @var{shadowcolor} is "black".
  5330. @item shadowx
  5331. @item shadowy
  5332. The x and y offsets for the text shadow position with respect to the
  5333. position of the text. They can be either positive or negative
  5334. values. The default value for both is "0".
  5335. @item start_number
  5336. The starting frame number for the n/frame_num variable. The default value
  5337. is "0".
  5338. @item tabsize
  5339. The size in number of spaces to use for rendering the tab.
  5340. Default value is 4.
  5341. @item timecode
  5342. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5343. format. It can be used with or without text parameter. @var{timecode_rate}
  5344. option must be specified.
  5345. @item timecode_rate, rate, r
  5346. Set the timecode frame rate (timecode only).
  5347. @item tc24hmax
  5348. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5349. Default is 0 (disabled).
  5350. @item text
  5351. The text string to be drawn. The text must be a sequence of UTF-8
  5352. encoded characters.
  5353. This parameter is mandatory if no file is specified with the parameter
  5354. @var{textfile}.
  5355. @item textfile
  5356. A text file containing text to be drawn. The text must be a sequence
  5357. of UTF-8 encoded characters.
  5358. This parameter is mandatory if no text string is specified with the
  5359. parameter @var{text}.
  5360. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5361. @item reload
  5362. If set to 1, the @var{textfile} will be reloaded before each frame.
  5363. Be sure to update it atomically, or it may be read partially, or even fail.
  5364. @item x
  5365. @item y
  5366. The expressions which specify the offsets where text will be drawn
  5367. within the video frame. They are relative to the top/left border of the
  5368. output image.
  5369. The default value of @var{x} and @var{y} is "0".
  5370. See below for the list of accepted constants and functions.
  5371. @end table
  5372. The parameters for @var{x} and @var{y} are expressions containing the
  5373. following constants and functions:
  5374. @table @option
  5375. @item dar
  5376. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5377. @item hsub
  5378. @item vsub
  5379. horizontal and vertical chroma subsample values. For example for the
  5380. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5381. @item line_h, lh
  5382. the height of each text line
  5383. @item main_h, h, H
  5384. the input height
  5385. @item main_w, w, W
  5386. the input width
  5387. @item max_glyph_a, ascent
  5388. the maximum distance from the baseline to the highest/upper grid
  5389. coordinate used to place a glyph outline point, for all the rendered
  5390. glyphs.
  5391. It is a positive value, due to the grid's orientation with the Y axis
  5392. upwards.
  5393. @item max_glyph_d, descent
  5394. the maximum distance from the baseline to the lowest grid coordinate
  5395. used to place a glyph outline point, for all the rendered glyphs.
  5396. This is a negative value, due to the grid's orientation, with the Y axis
  5397. upwards.
  5398. @item max_glyph_h
  5399. maximum glyph height, that is the maximum height for all the glyphs
  5400. contained in the rendered text, it is equivalent to @var{ascent} -
  5401. @var{descent}.
  5402. @item max_glyph_w
  5403. maximum glyph width, that is the maximum width for all the glyphs
  5404. contained in the rendered text
  5405. @item n
  5406. the number of input frame, starting from 0
  5407. @item rand(min, max)
  5408. return a random number included between @var{min} and @var{max}
  5409. @item sar
  5410. The input sample aspect ratio.
  5411. @item t
  5412. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5413. @item text_h, th
  5414. the height of the rendered text
  5415. @item text_w, tw
  5416. the width of the rendered text
  5417. @item x
  5418. @item y
  5419. the x and y offset coordinates where the text is drawn.
  5420. These parameters allow the @var{x} and @var{y} expressions to refer
  5421. each other, so you can for example specify @code{y=x/dar}.
  5422. @end table
  5423. @anchor{drawtext_expansion}
  5424. @subsection Text expansion
  5425. If @option{expansion} is set to @code{strftime},
  5426. the filter recognizes strftime() sequences in the provided text and
  5427. expands them accordingly. Check the documentation of strftime(). This
  5428. feature is deprecated.
  5429. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5430. If @option{expansion} is set to @code{normal} (which is the default),
  5431. the following expansion mechanism is used.
  5432. The backslash character @samp{\}, followed by any character, always expands to
  5433. the second character.
  5434. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5435. braces is a function name, possibly followed by arguments separated by ':'.
  5436. If the arguments contain special characters or delimiters (':' or '@}'),
  5437. they should be escaped.
  5438. Note that they probably must also be escaped as the value for the
  5439. @option{text} option in the filter argument string and as the filter
  5440. argument in the filtergraph description, and possibly also for the shell,
  5441. that makes up to four levels of escaping; using a text file avoids these
  5442. problems.
  5443. The following functions are available:
  5444. @table @command
  5445. @item expr, e
  5446. The expression evaluation result.
  5447. It must take one argument specifying the expression to be evaluated,
  5448. which accepts the same constants and functions as the @var{x} and
  5449. @var{y} values. Note that not all constants should be used, for
  5450. example the text size is not known when evaluating the expression, so
  5451. the constants @var{text_w} and @var{text_h} will have an undefined
  5452. value.
  5453. @item expr_int_format, eif
  5454. Evaluate the expression's value and output as formatted integer.
  5455. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5456. The second argument specifies the output format. Allowed values are @samp{x},
  5457. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5458. @code{printf} function.
  5459. The third parameter is optional and sets the number of positions taken by the output.
  5460. It can be used to add padding with zeros from the left.
  5461. @item gmtime
  5462. The time at which the filter is running, expressed in UTC.
  5463. It can accept an argument: a strftime() format string.
  5464. @item localtime
  5465. The time at which the filter is running, expressed in the local time zone.
  5466. It can accept an argument: a strftime() format string.
  5467. @item metadata
  5468. Frame metadata. Takes one or two arguments.
  5469. The first argument is mandatory and specifies the metadata key.
  5470. The second argument is optional and specifies a default value, used when the
  5471. metadata key is not found or empty.
  5472. @item n, frame_num
  5473. The frame number, starting from 0.
  5474. @item pict_type
  5475. A 1 character description of the current picture type.
  5476. @item pts
  5477. The timestamp of the current frame.
  5478. It can take up to three arguments.
  5479. The first argument is the format of the timestamp; it defaults to @code{flt}
  5480. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5481. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5482. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5483. @code{localtime} stands for the timestamp of the frame formatted as
  5484. local time zone time.
  5485. The second argument is an offset added to the timestamp.
  5486. If the format is set to @code{localtime} or @code{gmtime},
  5487. a third argument may be supplied: a strftime() format string.
  5488. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5489. @end table
  5490. @subsection Examples
  5491. @itemize
  5492. @item
  5493. Draw "Test Text" with font FreeSerif, using the default values for the
  5494. optional parameters.
  5495. @example
  5496. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5497. @end example
  5498. @item
  5499. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5500. and y=50 (counting from the top-left corner of the screen), text is
  5501. yellow with a red box around it. Both the text and the box have an
  5502. opacity of 20%.
  5503. @example
  5504. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5505. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5506. @end example
  5507. Note that the double quotes are not necessary if spaces are not used
  5508. within the parameter list.
  5509. @item
  5510. Show the text at the center of the video frame:
  5511. @example
  5512. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5513. @end example
  5514. @item
  5515. Show the text at a random position, switching to a new position every 30 seconds:
  5516. @example
  5517. 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)"
  5518. @end example
  5519. @item
  5520. Show a text line sliding from right to left in the last row of the video
  5521. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5522. with no newlines.
  5523. @example
  5524. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5525. @end example
  5526. @item
  5527. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5528. @example
  5529. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5530. @end example
  5531. @item
  5532. Draw a single green letter "g", at the center of the input video.
  5533. The glyph baseline is placed at half screen height.
  5534. @example
  5535. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5536. @end example
  5537. @item
  5538. Show text for 1 second every 3 seconds:
  5539. @example
  5540. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5541. @end example
  5542. @item
  5543. Use fontconfig to set the font. Note that the colons need to be escaped.
  5544. @example
  5545. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5546. @end example
  5547. @item
  5548. Print the date of a real-time encoding (see strftime(3)):
  5549. @example
  5550. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5551. @end example
  5552. @item
  5553. Show text fading in and out (appearing/disappearing):
  5554. @example
  5555. #!/bin/sh
  5556. DS=1.0 # display start
  5557. DE=10.0 # display end
  5558. FID=1.5 # fade in duration
  5559. FOD=5 # fade out duration
  5560. 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 @}"
  5561. @end example
  5562. @item
  5563. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5564. and the @option{fontsize} value are included in the @option{y} offset.
  5565. @example
  5566. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5567. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5568. @end example
  5569. @end itemize
  5570. For more information about libfreetype, check:
  5571. @url{http://www.freetype.org/}.
  5572. For more information about fontconfig, check:
  5573. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5574. For more information about libfribidi, check:
  5575. @url{http://fribidi.org/}.
  5576. @section edgedetect
  5577. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5578. The filter accepts the following options:
  5579. @table @option
  5580. @item low
  5581. @item high
  5582. Set low and high threshold values used by the Canny thresholding
  5583. algorithm.
  5584. The high threshold selects the "strong" edge pixels, which are then
  5585. connected through 8-connectivity with the "weak" edge pixels selected
  5586. by the low threshold.
  5587. @var{low} and @var{high} threshold values must be chosen in the range
  5588. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5589. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5590. is @code{50/255}.
  5591. @item mode
  5592. Define the drawing mode.
  5593. @table @samp
  5594. @item wires
  5595. Draw white/gray wires on black background.
  5596. @item colormix
  5597. Mix the colors to create a paint/cartoon effect.
  5598. @end table
  5599. Default value is @var{wires}.
  5600. @end table
  5601. @subsection Examples
  5602. @itemize
  5603. @item
  5604. Standard edge detection with custom values for the hysteresis thresholding:
  5605. @example
  5606. edgedetect=low=0.1:high=0.4
  5607. @end example
  5608. @item
  5609. Painting effect without thresholding:
  5610. @example
  5611. edgedetect=mode=colormix:high=0
  5612. @end example
  5613. @end itemize
  5614. @section eq
  5615. Set brightness, contrast, saturation and approximate gamma adjustment.
  5616. The filter accepts the following options:
  5617. @table @option
  5618. @item contrast
  5619. Set the contrast expression. The value must be a float value in range
  5620. @code{-2.0} to @code{2.0}. The default value is "1".
  5621. @item brightness
  5622. Set the brightness expression. The value must be a float value in
  5623. range @code{-1.0} to @code{1.0}. The default value is "0".
  5624. @item saturation
  5625. Set the saturation expression. The value must be a float in
  5626. range @code{0.0} to @code{3.0}. The default value is "1".
  5627. @item gamma
  5628. Set the gamma expression. The value must be a float in range
  5629. @code{0.1} to @code{10.0}. The default value is "1".
  5630. @item gamma_r
  5631. Set the gamma expression for red. The value must be a float in
  5632. range @code{0.1} to @code{10.0}. The default value is "1".
  5633. @item gamma_g
  5634. Set the gamma expression for green. The value must be a float in range
  5635. @code{0.1} to @code{10.0}. The default value is "1".
  5636. @item gamma_b
  5637. Set the gamma expression for blue. The value must be a float in range
  5638. @code{0.1} to @code{10.0}. The default value is "1".
  5639. @item gamma_weight
  5640. Set the gamma weight expression. It can be used to reduce the effect
  5641. of a high gamma value on bright image areas, e.g. keep them from
  5642. getting overamplified and just plain white. The value must be a float
  5643. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5644. gamma correction all the way down while @code{1.0} leaves it at its
  5645. full strength. Default is "1".
  5646. @item eval
  5647. Set when the expressions for brightness, contrast, saturation and
  5648. gamma expressions are evaluated.
  5649. It accepts the following values:
  5650. @table @samp
  5651. @item init
  5652. only evaluate expressions once during the filter initialization or
  5653. when a command is processed
  5654. @item frame
  5655. evaluate expressions for each incoming frame
  5656. @end table
  5657. Default value is @samp{init}.
  5658. @end table
  5659. The expressions accept the following parameters:
  5660. @table @option
  5661. @item n
  5662. frame count of the input frame starting from 0
  5663. @item pos
  5664. byte position of the corresponding packet in the input file, NAN if
  5665. unspecified
  5666. @item r
  5667. frame rate of the input video, NAN if the input frame rate is unknown
  5668. @item t
  5669. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5670. @end table
  5671. @subsection Commands
  5672. The filter supports the following commands:
  5673. @table @option
  5674. @item contrast
  5675. Set the contrast expression.
  5676. @item brightness
  5677. Set the brightness expression.
  5678. @item saturation
  5679. Set the saturation expression.
  5680. @item gamma
  5681. Set the gamma expression.
  5682. @item gamma_r
  5683. Set the gamma_r expression.
  5684. @item gamma_g
  5685. Set gamma_g expression.
  5686. @item gamma_b
  5687. Set gamma_b expression.
  5688. @item gamma_weight
  5689. Set gamma_weight expression.
  5690. The command accepts the same syntax of the corresponding option.
  5691. If the specified expression is not valid, it is kept at its current
  5692. value.
  5693. @end table
  5694. @section erosion
  5695. Apply erosion effect to the video.
  5696. This filter replaces the pixel by the local(3x3) minimum.
  5697. It accepts the following options:
  5698. @table @option
  5699. @item threshold0
  5700. @item threshold1
  5701. @item threshold2
  5702. @item threshold3
  5703. Limit the maximum change for each plane, default is 65535.
  5704. If 0, plane will remain unchanged.
  5705. @item coordinates
  5706. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5707. pixels are used.
  5708. Flags to local 3x3 coordinates maps like this:
  5709. 1 2 3
  5710. 4 5
  5711. 6 7 8
  5712. @end table
  5713. @section extractplanes
  5714. Extract color channel components from input video stream into
  5715. separate grayscale video streams.
  5716. The filter accepts the following option:
  5717. @table @option
  5718. @item planes
  5719. Set plane(s) to extract.
  5720. Available values for planes are:
  5721. @table @samp
  5722. @item y
  5723. @item u
  5724. @item v
  5725. @item a
  5726. @item r
  5727. @item g
  5728. @item b
  5729. @end table
  5730. Choosing planes not available in the input will result in an error.
  5731. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5732. with @code{y}, @code{u}, @code{v} planes at same time.
  5733. @end table
  5734. @subsection Examples
  5735. @itemize
  5736. @item
  5737. Extract luma, u and v color channel component from input video frame
  5738. into 3 grayscale outputs:
  5739. @example
  5740. 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
  5741. @end example
  5742. @end itemize
  5743. @section elbg
  5744. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5745. For each input image, the filter will compute the optimal mapping from
  5746. the input to the output given the codebook length, that is the number
  5747. of distinct output colors.
  5748. This filter accepts the following options.
  5749. @table @option
  5750. @item codebook_length, l
  5751. Set codebook length. The value must be a positive integer, and
  5752. represents the number of distinct output colors. Default value is 256.
  5753. @item nb_steps, n
  5754. Set the maximum number of iterations to apply for computing the optimal
  5755. mapping. The higher the value the better the result and the higher the
  5756. computation time. Default value is 1.
  5757. @item seed, s
  5758. Set a random seed, must be an integer included between 0 and
  5759. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5760. will try to use a good random seed on a best effort basis.
  5761. @item pal8
  5762. Set pal8 output pixel format. This option does not work with codebook
  5763. length greater than 256.
  5764. @end table
  5765. @section fade
  5766. Apply a fade-in/out effect to the input video.
  5767. It accepts the following parameters:
  5768. @table @option
  5769. @item type, t
  5770. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5771. effect.
  5772. Default is @code{in}.
  5773. @item start_frame, s
  5774. Specify the number of the frame to start applying the fade
  5775. effect at. Default is 0.
  5776. @item nb_frames, n
  5777. The number of frames that the fade effect lasts. At the end of the
  5778. fade-in effect, the output video will have the same intensity as the input video.
  5779. At the end of the fade-out transition, the output video will be filled with the
  5780. selected @option{color}.
  5781. Default is 25.
  5782. @item alpha
  5783. If set to 1, fade only alpha channel, if one exists on the input.
  5784. Default value is 0.
  5785. @item start_time, st
  5786. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5787. effect. If both start_frame and start_time are specified, the fade will start at
  5788. whichever comes last. Default is 0.
  5789. @item duration, d
  5790. The number of seconds for which the fade effect has to last. At the end of the
  5791. fade-in effect the output video will have the same intensity as the input video,
  5792. at the end of the fade-out transition the output video will be filled with the
  5793. selected @option{color}.
  5794. If both duration and nb_frames are specified, duration is used. Default is 0
  5795. (nb_frames is used by default).
  5796. @item color, c
  5797. Specify the color of the fade. Default is "black".
  5798. @end table
  5799. @subsection Examples
  5800. @itemize
  5801. @item
  5802. Fade in the first 30 frames of video:
  5803. @example
  5804. fade=in:0:30
  5805. @end example
  5806. The command above is equivalent to:
  5807. @example
  5808. fade=t=in:s=0:n=30
  5809. @end example
  5810. @item
  5811. Fade out the last 45 frames of a 200-frame video:
  5812. @example
  5813. fade=out:155:45
  5814. fade=type=out:start_frame=155:nb_frames=45
  5815. @end example
  5816. @item
  5817. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5818. @example
  5819. fade=in:0:25, fade=out:975:25
  5820. @end example
  5821. @item
  5822. Make the first 5 frames yellow, then fade in from frame 5-24:
  5823. @example
  5824. fade=in:5:20:color=yellow
  5825. @end example
  5826. @item
  5827. Fade in alpha over first 25 frames of video:
  5828. @example
  5829. fade=in:0:25:alpha=1
  5830. @end example
  5831. @item
  5832. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5833. @example
  5834. fade=t=in:st=5.5:d=0.5
  5835. @end example
  5836. @end itemize
  5837. @section fftfilt
  5838. Apply arbitrary expressions to samples in frequency domain
  5839. @table @option
  5840. @item dc_Y
  5841. Adjust the dc value (gain) of the luma plane of the image. The filter
  5842. accepts an integer value in range @code{0} to @code{1000}. The default
  5843. value is set to @code{0}.
  5844. @item dc_U
  5845. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5846. filter accepts an integer value in range @code{0} to @code{1000}. The
  5847. default value is set to @code{0}.
  5848. @item dc_V
  5849. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5850. filter accepts an integer value in range @code{0} to @code{1000}. The
  5851. default value is set to @code{0}.
  5852. @item weight_Y
  5853. Set the frequency domain weight expression for the luma plane.
  5854. @item weight_U
  5855. Set the frequency domain weight expression for the 1st chroma plane.
  5856. @item weight_V
  5857. Set the frequency domain weight expression for the 2nd chroma plane.
  5858. The filter accepts the following variables:
  5859. @item X
  5860. @item Y
  5861. The coordinates of the current sample.
  5862. @item W
  5863. @item H
  5864. The width and height of the image.
  5865. @end table
  5866. @subsection Examples
  5867. @itemize
  5868. @item
  5869. High-pass:
  5870. @example
  5871. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5872. @end example
  5873. @item
  5874. Low-pass:
  5875. @example
  5876. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5877. @end example
  5878. @item
  5879. Sharpen:
  5880. @example
  5881. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5882. @end example
  5883. @item
  5884. Blur:
  5885. @example
  5886. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5887. @end example
  5888. @end itemize
  5889. @section field
  5890. Extract a single field from an interlaced image using stride
  5891. arithmetic to avoid wasting CPU time. The output frames are marked as
  5892. non-interlaced.
  5893. The filter accepts the following options:
  5894. @table @option
  5895. @item type
  5896. Specify whether to extract the top (if the value is @code{0} or
  5897. @code{top}) or the bottom field (if the value is @code{1} or
  5898. @code{bottom}).
  5899. @end table
  5900. @section fieldhint
  5901. Create new frames by copying the top and bottom fields from surrounding frames
  5902. supplied as numbers by the hint file.
  5903. @table @option
  5904. @item hint
  5905. Set file containing hints: absolute/relative frame numbers.
  5906. There must be one line for each frame in a clip. Each line must contain two
  5907. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5908. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5909. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5910. for @code{relative} mode. First number tells from which frame to pick up top
  5911. field and second number tells from which frame to pick up bottom field.
  5912. If optionally followed by @code{+} output frame will be marked as interlaced,
  5913. else if followed by @code{-} output frame will be marked as progressive, else
  5914. it will be marked same as input frame.
  5915. If line starts with @code{#} or @code{;} that line is skipped.
  5916. @item mode
  5917. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5918. @end table
  5919. Example of first several lines of @code{hint} file for @code{relative} mode:
  5920. @example
  5921. 0,0 - # first frame
  5922. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5923. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5924. 1,0 -
  5925. 0,0 -
  5926. 0,0 -
  5927. 1,0 -
  5928. 1,0 -
  5929. 1,0 -
  5930. 0,0 -
  5931. 0,0 -
  5932. 1,0 -
  5933. 1,0 -
  5934. 1,0 -
  5935. 0,0 -
  5936. @end example
  5937. @section fieldmatch
  5938. Field matching filter for inverse telecine. It is meant to reconstruct the
  5939. progressive frames from a telecined stream. The filter does not drop duplicated
  5940. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5941. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5942. The separation of the field matching and the decimation is notably motivated by
  5943. the possibility of inserting a de-interlacing filter fallback between the two.
  5944. If the source has mixed telecined and real interlaced content,
  5945. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5946. But these remaining combed frames will be marked as interlaced, and thus can be
  5947. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5948. In addition to the various configuration options, @code{fieldmatch} can take an
  5949. optional second stream, activated through the @option{ppsrc} option. If
  5950. enabled, the frames reconstruction will be based on the fields and frames from
  5951. this second stream. This allows the first input to be pre-processed in order to
  5952. help the various algorithms of the filter, while keeping the output lossless
  5953. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5954. or brightness/contrast adjustments can help.
  5955. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5956. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5957. which @code{fieldmatch} is based on. While the semantic and usage are very
  5958. close, some behaviour and options names can differ.
  5959. The @ref{decimate} filter currently only works for constant frame rate input.
  5960. If your input has mixed telecined (30fps) and progressive content with a lower
  5961. framerate like 24fps use the following filterchain to produce the necessary cfr
  5962. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5963. The filter accepts the following options:
  5964. @table @option
  5965. @item order
  5966. Specify the assumed field order of the input stream. Available values are:
  5967. @table @samp
  5968. @item auto
  5969. Auto detect parity (use FFmpeg's internal parity value).
  5970. @item bff
  5971. Assume bottom field first.
  5972. @item tff
  5973. Assume top field first.
  5974. @end table
  5975. Note that it is sometimes recommended not to trust the parity announced by the
  5976. stream.
  5977. Default value is @var{auto}.
  5978. @item mode
  5979. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5980. sense that it won't risk creating jerkiness due to duplicate frames when
  5981. possible, but if there are bad edits or blended fields it will end up
  5982. outputting combed frames when a good match might actually exist. On the other
  5983. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5984. but will almost always find a good frame if there is one. The other values are
  5985. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5986. jerkiness and creating duplicate frames versus finding good matches in sections
  5987. with bad edits, orphaned fields, blended fields, etc.
  5988. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5989. Available values are:
  5990. @table @samp
  5991. @item pc
  5992. 2-way matching (p/c)
  5993. @item pc_n
  5994. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5995. @item pc_u
  5996. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5997. @item pc_n_ub
  5998. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5999. still combed (p/c + n + u/b)
  6000. @item pcn
  6001. 3-way matching (p/c/n)
  6002. @item pcn_ub
  6003. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6004. detected as combed (p/c/n + u/b)
  6005. @end table
  6006. The parenthesis at the end indicate the matches that would be used for that
  6007. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6008. @var{top}).
  6009. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6010. the slowest.
  6011. Default value is @var{pc_n}.
  6012. @item ppsrc
  6013. Mark the main input stream as a pre-processed input, and enable the secondary
  6014. input stream as the clean source to pick the fields from. See the filter
  6015. introduction for more details. It is similar to the @option{clip2} feature from
  6016. VFM/TFM.
  6017. Default value is @code{0} (disabled).
  6018. @item field
  6019. Set the field to match from. It is recommended to set this to the same value as
  6020. @option{order} unless you experience matching failures with that setting. In
  6021. certain circumstances changing the field that is used to match from can have a
  6022. large impact on matching performance. Available values are:
  6023. @table @samp
  6024. @item auto
  6025. Automatic (same value as @option{order}).
  6026. @item bottom
  6027. Match from the bottom field.
  6028. @item top
  6029. Match from the top field.
  6030. @end table
  6031. Default value is @var{auto}.
  6032. @item mchroma
  6033. Set whether or not chroma is included during the match comparisons. In most
  6034. cases it is recommended to leave this enabled. You should set this to @code{0}
  6035. only if your clip has bad chroma problems such as heavy rainbowing or other
  6036. artifacts. Setting this to @code{0} could also be used to speed things up at
  6037. the cost of some accuracy.
  6038. Default value is @code{1}.
  6039. @item y0
  6040. @item y1
  6041. These define an exclusion band which excludes the lines between @option{y0} and
  6042. @option{y1} from being included in the field matching decision. An exclusion
  6043. band can be used to ignore subtitles, a logo, or other things that may
  6044. interfere with the matching. @option{y0} sets the starting scan line and
  6045. @option{y1} sets the ending line; all lines in between @option{y0} and
  6046. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6047. @option{y0} and @option{y1} to the same value will disable the feature.
  6048. @option{y0} and @option{y1} defaults to @code{0}.
  6049. @item scthresh
  6050. Set the scene change detection threshold as a percentage of maximum change on
  6051. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6052. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6053. @option{scthresh} is @code{[0.0, 100.0]}.
  6054. Default value is @code{12.0}.
  6055. @item combmatch
  6056. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6057. account the combed scores of matches when deciding what match to use as the
  6058. final match. Available values are:
  6059. @table @samp
  6060. @item none
  6061. No final matching based on combed scores.
  6062. @item sc
  6063. Combed scores are only used when a scene change is detected.
  6064. @item full
  6065. Use combed scores all the time.
  6066. @end table
  6067. Default is @var{sc}.
  6068. @item combdbg
  6069. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6070. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6071. Available values are:
  6072. @table @samp
  6073. @item none
  6074. No forced calculation.
  6075. @item pcn
  6076. Force p/c/n calculations.
  6077. @item pcnub
  6078. Force p/c/n/u/b calculations.
  6079. @end table
  6080. Default value is @var{none}.
  6081. @item cthresh
  6082. This is the area combing threshold used for combed frame detection. This
  6083. essentially controls how "strong" or "visible" combing must be to be detected.
  6084. Larger values mean combing must be more visible and smaller values mean combing
  6085. can be less visible or strong and still be detected. Valid settings are from
  6086. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6087. be detected as combed). This is basically a pixel difference value. A good
  6088. range is @code{[8, 12]}.
  6089. Default value is @code{9}.
  6090. @item chroma
  6091. Sets whether or not chroma is considered in the combed frame decision. Only
  6092. disable this if your source has chroma problems (rainbowing, etc.) that are
  6093. causing problems for the combed frame detection with chroma enabled. Actually,
  6094. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6095. where there is chroma only combing in the source.
  6096. Default value is @code{0}.
  6097. @item blockx
  6098. @item blocky
  6099. Respectively set the x-axis and y-axis size of the window used during combed
  6100. frame detection. This has to do with the size of the area in which
  6101. @option{combpel} pixels are required to be detected as combed for a frame to be
  6102. declared combed. See the @option{combpel} parameter description for more info.
  6103. Possible values are any number that is a power of 2 starting at 4 and going up
  6104. to 512.
  6105. Default value is @code{16}.
  6106. @item combpel
  6107. The number of combed pixels inside any of the @option{blocky} by
  6108. @option{blockx} size blocks on the frame for the frame to be detected as
  6109. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6110. setting controls "how much" combing there must be in any localized area (a
  6111. window defined by the @option{blockx} and @option{blocky} settings) on the
  6112. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6113. which point no frames will ever be detected as combed). This setting is known
  6114. as @option{MI} in TFM/VFM vocabulary.
  6115. Default value is @code{80}.
  6116. @end table
  6117. @anchor{p/c/n/u/b meaning}
  6118. @subsection p/c/n/u/b meaning
  6119. @subsubsection p/c/n
  6120. We assume the following telecined stream:
  6121. @example
  6122. Top fields: 1 2 2 3 4
  6123. Bottom fields: 1 2 3 4 4
  6124. @end example
  6125. The numbers correspond to the progressive frame the fields relate to. Here, the
  6126. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6127. When @code{fieldmatch} is configured to run a matching from bottom
  6128. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6129. @example
  6130. Input stream:
  6131. T 1 2 2 3 4
  6132. B 1 2 3 4 4 <-- matching reference
  6133. Matches: c c n n c
  6134. Output stream:
  6135. T 1 2 3 4 4
  6136. B 1 2 3 4 4
  6137. @end example
  6138. As a result of the field matching, we can see that some frames get duplicated.
  6139. To perform a complete inverse telecine, you need to rely on a decimation filter
  6140. after this operation. See for instance the @ref{decimate} filter.
  6141. The same operation now matching from top fields (@option{field}=@var{top})
  6142. looks like this:
  6143. @example
  6144. Input stream:
  6145. T 1 2 2 3 4 <-- matching reference
  6146. B 1 2 3 4 4
  6147. Matches: c c p p c
  6148. Output stream:
  6149. T 1 2 2 3 4
  6150. B 1 2 2 3 4
  6151. @end example
  6152. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6153. basically, they refer to the frame and field of the opposite parity:
  6154. @itemize
  6155. @item @var{p} matches the field of the opposite parity in the previous frame
  6156. @item @var{c} matches the field of the opposite parity in the current frame
  6157. @item @var{n} matches the field of the opposite parity in the next frame
  6158. @end itemize
  6159. @subsubsection u/b
  6160. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6161. from the opposite parity flag. In the following examples, we assume that we are
  6162. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6163. 'x' is placed above and below each matched fields.
  6164. With bottom matching (@option{field}=@var{bottom}):
  6165. @example
  6166. Match: c p n b u
  6167. x x x x x
  6168. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6169. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6170. x x x x x
  6171. Output frames:
  6172. 2 1 2 2 2
  6173. 2 2 2 1 3
  6174. @end example
  6175. With top matching (@option{field}=@var{top}):
  6176. @example
  6177. Match: c p n b u
  6178. x x x x x
  6179. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6180. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6181. x x x x x
  6182. Output frames:
  6183. 2 2 2 1 2
  6184. 2 1 3 2 2
  6185. @end example
  6186. @subsection Examples
  6187. Simple IVTC of a top field first telecined stream:
  6188. @example
  6189. fieldmatch=order=tff:combmatch=none, decimate
  6190. @end example
  6191. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6192. @example
  6193. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6194. @end example
  6195. @section fieldorder
  6196. Transform the field order of the input video.
  6197. It accepts the following parameters:
  6198. @table @option
  6199. @item order
  6200. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6201. for bottom field first.
  6202. @end table
  6203. The default value is @samp{tff}.
  6204. The transformation is done by shifting the picture content up or down
  6205. by one line, and filling the remaining line with appropriate picture content.
  6206. This method is consistent with most broadcast field order converters.
  6207. If the input video is not flagged as being interlaced, or it is already
  6208. flagged as being of the required output field order, then this filter does
  6209. not alter the incoming video.
  6210. It is very useful when converting to or from PAL DV material,
  6211. which is bottom field first.
  6212. For example:
  6213. @example
  6214. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6215. @end example
  6216. @section fifo, afifo
  6217. Buffer input images and send them when they are requested.
  6218. It is mainly useful when auto-inserted by the libavfilter
  6219. framework.
  6220. It does not take parameters.
  6221. @section find_rect
  6222. Find a rectangular object
  6223. It accepts the following options:
  6224. @table @option
  6225. @item object
  6226. Filepath of the object image, needs to be in gray8.
  6227. @item threshold
  6228. Detection threshold, default is 0.5.
  6229. @item mipmaps
  6230. Number of mipmaps, default is 3.
  6231. @item xmin, ymin, xmax, ymax
  6232. Specifies the rectangle in which to search.
  6233. @end table
  6234. @subsection Examples
  6235. @itemize
  6236. @item
  6237. Generate a representative palette of a given video using @command{ffmpeg}:
  6238. @example
  6239. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6240. @end example
  6241. @end itemize
  6242. @section cover_rect
  6243. Cover a rectangular object
  6244. It accepts the following options:
  6245. @table @option
  6246. @item cover
  6247. Filepath of the optional cover image, needs to be in yuv420.
  6248. @item mode
  6249. Set covering mode.
  6250. It accepts the following values:
  6251. @table @samp
  6252. @item cover
  6253. cover it by the supplied image
  6254. @item blur
  6255. cover it by interpolating the surrounding pixels
  6256. @end table
  6257. Default value is @var{blur}.
  6258. @end table
  6259. @subsection Examples
  6260. @itemize
  6261. @item
  6262. Generate a representative palette of a given video using @command{ffmpeg}:
  6263. @example
  6264. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6265. @end example
  6266. @end itemize
  6267. @anchor{format}
  6268. @section format
  6269. Convert the input video to one of the specified pixel formats.
  6270. Libavfilter will try to pick one that is suitable as input to
  6271. the next filter.
  6272. It accepts the following parameters:
  6273. @table @option
  6274. @item pix_fmts
  6275. A '|'-separated list of pixel format names, such as
  6276. "pix_fmts=yuv420p|monow|rgb24".
  6277. @end table
  6278. @subsection Examples
  6279. @itemize
  6280. @item
  6281. Convert the input video to the @var{yuv420p} format
  6282. @example
  6283. format=pix_fmts=yuv420p
  6284. @end example
  6285. Convert the input video to any of the formats in the list
  6286. @example
  6287. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6288. @end example
  6289. @end itemize
  6290. @anchor{fps}
  6291. @section fps
  6292. Convert the video to specified constant frame rate by duplicating or dropping
  6293. frames as necessary.
  6294. It accepts the following parameters:
  6295. @table @option
  6296. @item fps
  6297. The desired output frame rate. The default is @code{25}.
  6298. @item round
  6299. Rounding method.
  6300. Possible values are:
  6301. @table @option
  6302. @item zero
  6303. zero round towards 0
  6304. @item inf
  6305. round away from 0
  6306. @item down
  6307. round towards -infinity
  6308. @item up
  6309. round towards +infinity
  6310. @item near
  6311. round to nearest
  6312. @end table
  6313. The default is @code{near}.
  6314. @item start_time
  6315. Assume the first PTS should be the given value, in seconds. This allows for
  6316. padding/trimming at the start of stream. By default, no assumption is made
  6317. about the first frame's expected PTS, so no padding or trimming is done.
  6318. For example, this could be set to 0 to pad the beginning with duplicates of
  6319. the first frame if a video stream starts after the audio stream or to trim any
  6320. frames with a negative PTS.
  6321. @end table
  6322. Alternatively, the options can be specified as a flat string:
  6323. @var{fps}[:@var{round}].
  6324. See also the @ref{setpts} filter.
  6325. @subsection Examples
  6326. @itemize
  6327. @item
  6328. A typical usage in order to set the fps to 25:
  6329. @example
  6330. fps=fps=25
  6331. @end example
  6332. @item
  6333. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6334. @example
  6335. fps=fps=film:round=near
  6336. @end example
  6337. @end itemize
  6338. @section framepack
  6339. Pack two different video streams into a stereoscopic video, setting proper
  6340. metadata on supported codecs. The two views should have the same size and
  6341. framerate and processing will stop when the shorter video ends. Please note
  6342. that you may conveniently adjust view properties with the @ref{scale} and
  6343. @ref{fps} filters.
  6344. It accepts the following parameters:
  6345. @table @option
  6346. @item format
  6347. The desired packing format. Supported values are:
  6348. @table @option
  6349. @item sbs
  6350. The views are next to each other (default).
  6351. @item tab
  6352. The views are on top of each other.
  6353. @item lines
  6354. The views are packed by line.
  6355. @item columns
  6356. The views are packed by column.
  6357. @item frameseq
  6358. The views are temporally interleaved.
  6359. @end table
  6360. @end table
  6361. Some examples:
  6362. @example
  6363. # Convert left and right views into a frame-sequential video
  6364. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6365. # Convert views into a side-by-side video with the same output resolution as the input
  6366. 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
  6367. @end example
  6368. @section framerate
  6369. Change the frame rate by interpolating new video output frames from the source
  6370. frames.
  6371. This filter is not designed to function correctly with interlaced media. If
  6372. you wish to change the frame rate of interlaced media then you are required
  6373. to deinterlace before this filter and re-interlace after this filter.
  6374. A description of the accepted options follows.
  6375. @table @option
  6376. @item fps
  6377. Specify the output frames per second. This option can also be specified
  6378. as a value alone. The default is @code{50}.
  6379. @item interp_start
  6380. Specify the start of a range where the output frame will be created as a
  6381. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6382. the default is @code{15}.
  6383. @item interp_end
  6384. Specify the end of a range where the output frame will be created as a
  6385. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6386. the default is @code{240}.
  6387. @item scene
  6388. Specify the level at which a scene change is detected as a value between
  6389. 0 and 100 to indicate a new scene; a low value reflects a low
  6390. probability for the current frame to introduce a new scene, while a higher
  6391. value means the current frame is more likely to be one.
  6392. The default is @code{7}.
  6393. @item flags
  6394. Specify flags influencing the filter process.
  6395. Available value for @var{flags} is:
  6396. @table @option
  6397. @item scene_change_detect, scd
  6398. Enable scene change detection using the value of the option @var{scene}.
  6399. This flag is enabled by default.
  6400. @end table
  6401. @end table
  6402. @section framestep
  6403. Select one frame every N-th frame.
  6404. This filter accepts the following option:
  6405. @table @option
  6406. @item step
  6407. Select frame after every @code{step} frames.
  6408. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6409. @end table
  6410. @anchor{frei0r}
  6411. @section frei0r
  6412. Apply a frei0r effect to the input video.
  6413. To enable the compilation of this filter, you need to install the frei0r
  6414. header and configure FFmpeg with @code{--enable-frei0r}.
  6415. It accepts the following parameters:
  6416. @table @option
  6417. @item filter_name
  6418. The name of the frei0r effect to load. If the environment variable
  6419. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6420. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6421. Otherwise, the standard frei0r paths are searched, in this order:
  6422. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6423. @file{/usr/lib/frei0r-1/}.
  6424. @item filter_params
  6425. A '|'-separated list of parameters to pass to the frei0r effect.
  6426. @end table
  6427. A frei0r effect parameter can be a boolean (its value is either
  6428. "y" or "n"), a double, a color (specified as
  6429. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6430. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6431. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6432. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6433. The number and types of parameters depend on the loaded effect. If an
  6434. effect parameter is not specified, the default value is set.
  6435. @subsection Examples
  6436. @itemize
  6437. @item
  6438. Apply the distort0r effect, setting the first two double parameters:
  6439. @example
  6440. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6441. @end example
  6442. @item
  6443. Apply the colordistance effect, taking a color as the first parameter:
  6444. @example
  6445. frei0r=colordistance:0.2/0.3/0.4
  6446. frei0r=colordistance:violet
  6447. frei0r=colordistance:0x112233
  6448. @end example
  6449. @item
  6450. Apply the perspective effect, specifying the top left and top right image
  6451. positions:
  6452. @example
  6453. frei0r=perspective:0.2/0.2|0.8/0.2
  6454. @end example
  6455. @end itemize
  6456. For more information, see
  6457. @url{http://frei0r.dyne.org}
  6458. @section fspp
  6459. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6460. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6461. processing filter, one of them is performed once per block, not per pixel.
  6462. This allows for much higher speed.
  6463. The filter accepts the following options:
  6464. @table @option
  6465. @item quality
  6466. Set quality. This option defines the number of levels for averaging. It accepts
  6467. an integer in the range 4-5. Default value is @code{4}.
  6468. @item qp
  6469. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6470. If not set, the filter will use the QP from the video stream (if available).
  6471. @item strength
  6472. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6473. more details but also more artifacts, while higher values make the image smoother
  6474. but also blurrier. Default value is @code{0} − PSNR optimal.
  6475. @item use_bframe_qp
  6476. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6477. option may cause flicker since the B-Frames have often larger QP. Default is
  6478. @code{0} (not enabled).
  6479. @end table
  6480. @section gblur
  6481. Apply Gaussian blur filter.
  6482. The filter accepts the following options:
  6483. @table @option
  6484. @item sigma
  6485. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6486. @item steps
  6487. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6488. @item planes
  6489. Set which planes to filter. By default all planes are filtered.
  6490. @item sigmaV
  6491. Set vertical sigma, if negative it will be same as @code{sigma}.
  6492. Default is @code{-1}.
  6493. @end table
  6494. @section geq
  6495. The filter accepts the following options:
  6496. @table @option
  6497. @item lum_expr, lum
  6498. Set the luminance expression.
  6499. @item cb_expr, cb
  6500. Set the chrominance blue expression.
  6501. @item cr_expr, cr
  6502. Set the chrominance red expression.
  6503. @item alpha_expr, a
  6504. Set the alpha expression.
  6505. @item red_expr, r
  6506. Set the red expression.
  6507. @item green_expr, g
  6508. Set the green expression.
  6509. @item blue_expr, b
  6510. Set the blue expression.
  6511. @end table
  6512. The colorspace is selected according to the specified options. If one
  6513. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6514. options is specified, the filter will automatically select a YCbCr
  6515. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6516. @option{blue_expr} options is specified, it will select an RGB
  6517. colorspace.
  6518. If one of the chrominance expression is not defined, it falls back on the other
  6519. one. If no alpha expression is specified it will evaluate to opaque value.
  6520. If none of chrominance expressions are specified, they will evaluate
  6521. to the luminance expression.
  6522. The expressions can use the following variables and functions:
  6523. @table @option
  6524. @item N
  6525. The sequential number of the filtered frame, starting from @code{0}.
  6526. @item X
  6527. @item Y
  6528. The coordinates of the current sample.
  6529. @item W
  6530. @item H
  6531. The width and height of the image.
  6532. @item SW
  6533. @item SH
  6534. Width and height scale depending on the currently filtered plane. It is the
  6535. ratio between the corresponding luma plane number of pixels and the current
  6536. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6537. @code{0.5,0.5} for chroma planes.
  6538. @item T
  6539. Time of the current frame, expressed in seconds.
  6540. @item p(x, y)
  6541. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6542. plane.
  6543. @item lum(x, y)
  6544. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6545. plane.
  6546. @item cb(x, y)
  6547. Return the value of the pixel at location (@var{x},@var{y}) of the
  6548. blue-difference chroma plane. Return 0 if there is no such plane.
  6549. @item cr(x, y)
  6550. Return the value of the pixel at location (@var{x},@var{y}) of the
  6551. red-difference chroma plane. Return 0 if there is no such plane.
  6552. @item r(x, y)
  6553. @item g(x, y)
  6554. @item b(x, y)
  6555. Return the value of the pixel at location (@var{x},@var{y}) of the
  6556. red/green/blue component. Return 0 if there is no such component.
  6557. @item alpha(x, y)
  6558. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6559. plane. Return 0 if there is no such plane.
  6560. @end table
  6561. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6562. automatically clipped to the closer edge.
  6563. @subsection Examples
  6564. @itemize
  6565. @item
  6566. Flip the image horizontally:
  6567. @example
  6568. geq=p(W-X\,Y)
  6569. @end example
  6570. @item
  6571. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6572. wavelength of 100 pixels:
  6573. @example
  6574. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6575. @end example
  6576. @item
  6577. Generate a fancy enigmatic moving light:
  6578. @example
  6579. 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
  6580. @end example
  6581. @item
  6582. Generate a quick emboss effect:
  6583. @example
  6584. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6585. @end example
  6586. @item
  6587. Modify RGB components depending on pixel position:
  6588. @example
  6589. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6590. @end example
  6591. @item
  6592. Create a radial gradient that is the same size as the input (also see
  6593. the @ref{vignette} filter):
  6594. @example
  6595. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6596. @end example
  6597. @end itemize
  6598. @section gradfun
  6599. Fix the banding artifacts that are sometimes introduced into nearly flat
  6600. regions by truncation to 8-bit color depth.
  6601. Interpolate the gradients that should go where the bands are, and
  6602. dither them.
  6603. It is designed for playback only. Do not use it prior to
  6604. lossy compression, because compression tends to lose the dither and
  6605. bring back the bands.
  6606. It accepts the following parameters:
  6607. @table @option
  6608. @item strength
  6609. The maximum amount by which the filter will change any one pixel. This is also
  6610. the threshold for detecting nearly flat regions. Acceptable values range from
  6611. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6612. valid range.
  6613. @item radius
  6614. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6615. gradients, but also prevents the filter from modifying the pixels near detailed
  6616. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6617. values will be clipped to the valid range.
  6618. @end table
  6619. Alternatively, the options can be specified as a flat string:
  6620. @var{strength}[:@var{radius}]
  6621. @subsection Examples
  6622. @itemize
  6623. @item
  6624. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6625. @example
  6626. gradfun=3.5:8
  6627. @end example
  6628. @item
  6629. Specify radius, omitting the strength (which will fall-back to the default
  6630. value):
  6631. @example
  6632. gradfun=radius=8
  6633. @end example
  6634. @end itemize
  6635. @anchor{haldclut}
  6636. @section haldclut
  6637. Apply a Hald CLUT to a video stream.
  6638. First input is the video stream to process, and second one is the Hald CLUT.
  6639. The Hald CLUT input can be a simple picture or a complete video stream.
  6640. The filter accepts the following options:
  6641. @table @option
  6642. @item shortest
  6643. Force termination when the shortest input terminates. Default is @code{0}.
  6644. @item repeatlast
  6645. Continue applying the last CLUT after the end of the stream. A value of
  6646. @code{0} disable the filter after the last frame of the CLUT is reached.
  6647. Default is @code{1}.
  6648. @end table
  6649. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6650. filters share the same internals).
  6651. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6652. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6653. @subsection Workflow examples
  6654. @subsubsection Hald CLUT video stream
  6655. Generate an identity Hald CLUT stream altered with various effects:
  6656. @example
  6657. 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
  6658. @end example
  6659. Note: make sure you use a lossless codec.
  6660. Then use it with @code{haldclut} to apply it on some random stream:
  6661. @example
  6662. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6663. @end example
  6664. The Hald CLUT will be applied to the 10 first seconds (duration of
  6665. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6666. to the remaining frames of the @code{mandelbrot} stream.
  6667. @subsubsection Hald CLUT with preview
  6668. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6669. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6670. biggest possible square starting at the top left of the picture. The remaining
  6671. padding pixels (bottom or right) will be ignored. This area can be used to add
  6672. a preview of the Hald CLUT.
  6673. Typically, the following generated Hald CLUT will be supported by the
  6674. @code{haldclut} filter:
  6675. @example
  6676. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6677. pad=iw+320 [padded_clut];
  6678. smptebars=s=320x256, split [a][b];
  6679. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6680. [main][b] overlay=W-320" -frames:v 1 clut.png
  6681. @end example
  6682. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6683. bars are displayed on the right-top, and below the same color bars processed by
  6684. the color changes.
  6685. Then, the effect of this Hald CLUT can be visualized with:
  6686. @example
  6687. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6688. @end example
  6689. @section hflip
  6690. Flip the input video horizontally.
  6691. For example, to horizontally flip the input video with @command{ffmpeg}:
  6692. @example
  6693. ffmpeg -i in.avi -vf "hflip" out.avi
  6694. @end example
  6695. @section histeq
  6696. This filter applies a global color histogram equalization on a
  6697. per-frame basis.
  6698. It can be used to correct video that has a compressed range of pixel
  6699. intensities. The filter redistributes the pixel intensities to
  6700. equalize their distribution across the intensity range. It may be
  6701. viewed as an "automatically adjusting contrast filter". This filter is
  6702. useful only for correcting degraded or poorly captured source
  6703. video.
  6704. The filter accepts the following options:
  6705. @table @option
  6706. @item strength
  6707. Determine the amount of equalization to be applied. As the strength
  6708. is reduced, the distribution of pixel intensities more-and-more
  6709. approaches that of the input frame. The value must be a float number
  6710. in the range [0,1] and defaults to 0.200.
  6711. @item intensity
  6712. Set the maximum intensity that can generated and scale the output
  6713. values appropriately. The strength should be set as desired and then
  6714. the intensity can be limited if needed to avoid washing-out. The value
  6715. must be a float number in the range [0,1] and defaults to 0.210.
  6716. @item antibanding
  6717. Set the antibanding level. If enabled the filter will randomly vary
  6718. the luminance of output pixels by a small amount to avoid banding of
  6719. the histogram. Possible values are @code{none}, @code{weak} or
  6720. @code{strong}. It defaults to @code{none}.
  6721. @end table
  6722. @section histogram
  6723. Compute and draw a color distribution histogram for the input video.
  6724. The computed histogram is a representation of the color component
  6725. distribution in an image.
  6726. Standard histogram displays the color components distribution in an image.
  6727. Displays color graph for each color component. Shows distribution of
  6728. the Y, U, V, A or R, G, B components, depending on input format, in the
  6729. current frame. Below each graph a color component scale meter is shown.
  6730. The filter accepts the following options:
  6731. @table @option
  6732. @item level_height
  6733. Set height of level. Default value is @code{200}.
  6734. Allowed range is [50, 2048].
  6735. @item scale_height
  6736. Set height of color scale. Default value is @code{12}.
  6737. Allowed range is [0, 40].
  6738. @item display_mode
  6739. Set display mode.
  6740. It accepts the following values:
  6741. @table @samp
  6742. @item parade
  6743. Per color component graphs are placed below each other.
  6744. @item overlay
  6745. Presents information identical to that in the @code{parade}, except
  6746. that the graphs representing color components are superimposed directly
  6747. over one another.
  6748. @end table
  6749. Default is @code{parade}.
  6750. @item levels_mode
  6751. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6752. Default is @code{linear}.
  6753. @item components
  6754. Set what color components to display.
  6755. Default is @code{7}.
  6756. @item fgopacity
  6757. Set foreground opacity. Default is @code{0.7}.
  6758. @item bgopacity
  6759. Set background opacity. Default is @code{0.5}.
  6760. @end table
  6761. @subsection Examples
  6762. @itemize
  6763. @item
  6764. Calculate and draw histogram:
  6765. @example
  6766. ffplay -i input -vf histogram
  6767. @end example
  6768. @end itemize
  6769. @anchor{hqdn3d}
  6770. @section hqdn3d
  6771. This is a high precision/quality 3d denoise filter. It aims to reduce
  6772. image noise, producing smooth images and making still images really
  6773. still. It should enhance compressibility.
  6774. It accepts the following optional parameters:
  6775. @table @option
  6776. @item luma_spatial
  6777. A non-negative floating point number which specifies spatial luma strength.
  6778. It defaults to 4.0.
  6779. @item chroma_spatial
  6780. A non-negative floating point number which specifies spatial chroma strength.
  6781. It defaults to 3.0*@var{luma_spatial}/4.0.
  6782. @item luma_tmp
  6783. A floating point number which specifies luma temporal strength. It defaults to
  6784. 6.0*@var{luma_spatial}/4.0.
  6785. @item chroma_tmp
  6786. A floating point number which specifies chroma temporal strength. It defaults to
  6787. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6788. @end table
  6789. @anchor{hwupload_cuda}
  6790. @section hwupload_cuda
  6791. Upload system memory frames to a CUDA device.
  6792. It accepts the following optional parameters:
  6793. @table @option
  6794. @item device
  6795. The number of the CUDA device to use
  6796. @end table
  6797. @section hqx
  6798. Apply a high-quality magnification filter designed for pixel art. This filter
  6799. was originally created by Maxim Stepin.
  6800. It accepts the following option:
  6801. @table @option
  6802. @item n
  6803. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6804. @code{hq3x} and @code{4} for @code{hq4x}.
  6805. Default is @code{3}.
  6806. @end table
  6807. @section hstack
  6808. Stack input videos horizontally.
  6809. All streams must be of same pixel format and of same height.
  6810. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6811. to create same output.
  6812. The filter accept the following option:
  6813. @table @option
  6814. @item inputs
  6815. Set number of input streams. Default is 2.
  6816. @item shortest
  6817. If set to 1, force the output to terminate when the shortest input
  6818. terminates. Default value is 0.
  6819. @end table
  6820. @section hue
  6821. Modify the hue and/or the saturation of the input.
  6822. It accepts the following parameters:
  6823. @table @option
  6824. @item h
  6825. Specify the hue angle as a number of degrees. It accepts an expression,
  6826. and defaults to "0".
  6827. @item s
  6828. Specify the saturation in the [-10,10] range. It accepts an expression and
  6829. defaults to "1".
  6830. @item H
  6831. Specify the hue angle as a number of radians. It accepts an
  6832. expression, and defaults to "0".
  6833. @item b
  6834. Specify the brightness in the [-10,10] range. It accepts an expression and
  6835. defaults to "0".
  6836. @end table
  6837. @option{h} and @option{H} are mutually exclusive, and can't be
  6838. specified at the same time.
  6839. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6840. expressions containing the following constants:
  6841. @table @option
  6842. @item n
  6843. frame count of the input frame starting from 0
  6844. @item pts
  6845. presentation timestamp of the input frame expressed in time base units
  6846. @item r
  6847. frame rate of the input video, NAN if the input frame rate is unknown
  6848. @item t
  6849. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6850. @item tb
  6851. time base of the input video
  6852. @end table
  6853. @subsection Examples
  6854. @itemize
  6855. @item
  6856. Set the hue to 90 degrees and the saturation to 1.0:
  6857. @example
  6858. hue=h=90:s=1
  6859. @end example
  6860. @item
  6861. Same command but expressing the hue in radians:
  6862. @example
  6863. hue=H=PI/2:s=1
  6864. @end example
  6865. @item
  6866. Rotate hue and make the saturation swing between 0
  6867. and 2 over a period of 1 second:
  6868. @example
  6869. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6870. @end example
  6871. @item
  6872. Apply a 3 seconds saturation fade-in effect starting at 0:
  6873. @example
  6874. hue="s=min(t/3\,1)"
  6875. @end example
  6876. The general fade-in expression can be written as:
  6877. @example
  6878. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6879. @end example
  6880. @item
  6881. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6882. @example
  6883. hue="s=max(0\, min(1\, (8-t)/3))"
  6884. @end example
  6885. The general fade-out expression can be written as:
  6886. @example
  6887. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6888. @end example
  6889. @end itemize
  6890. @subsection Commands
  6891. This filter supports the following commands:
  6892. @table @option
  6893. @item b
  6894. @item s
  6895. @item h
  6896. @item H
  6897. Modify the hue and/or the saturation and/or brightness of the input video.
  6898. The command accepts the same syntax of the corresponding option.
  6899. If the specified expression is not valid, it is kept at its current
  6900. value.
  6901. @end table
  6902. @section hysteresis
  6903. Grow first stream into second stream by connecting components.
  6904. This makes it possible to build more robust edge masks.
  6905. This filter accepts the following options:
  6906. @table @option
  6907. @item planes
  6908. Set which planes will be processed as bitmap, unprocessed planes will be
  6909. copied from first stream.
  6910. By default value 0xf, all planes will be processed.
  6911. @item threshold
  6912. Set threshold which is used in filtering. If pixel component value is higher than
  6913. this value filter algorithm for connecting components is activated.
  6914. By default value is 0.
  6915. @end table
  6916. @section idet
  6917. Detect video interlacing type.
  6918. This filter tries to detect if the input frames are interlaced, progressive,
  6919. top or bottom field first. It will also try to detect fields that are
  6920. repeated between adjacent frames (a sign of telecine).
  6921. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6922. Multiple frame detection incorporates the classification history of previous frames.
  6923. The filter will log these metadata values:
  6924. @table @option
  6925. @item single.current_frame
  6926. Detected type of current frame using single-frame detection. One of:
  6927. ``tff'' (top field first), ``bff'' (bottom field first),
  6928. ``progressive'', or ``undetermined''
  6929. @item single.tff
  6930. Cumulative number of frames detected as top field first using single-frame detection.
  6931. @item multiple.tff
  6932. Cumulative number of frames detected as top field first using multiple-frame detection.
  6933. @item single.bff
  6934. Cumulative number of frames detected as bottom field first using single-frame detection.
  6935. @item multiple.current_frame
  6936. Detected type of current frame using multiple-frame detection. One of:
  6937. ``tff'' (top field first), ``bff'' (bottom field first),
  6938. ``progressive'', or ``undetermined''
  6939. @item multiple.bff
  6940. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6941. @item single.progressive
  6942. Cumulative number of frames detected as progressive using single-frame detection.
  6943. @item multiple.progressive
  6944. Cumulative number of frames detected as progressive using multiple-frame detection.
  6945. @item single.undetermined
  6946. Cumulative number of frames that could not be classified using single-frame detection.
  6947. @item multiple.undetermined
  6948. Cumulative number of frames that could not be classified using multiple-frame detection.
  6949. @item repeated.current_frame
  6950. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6951. @item repeated.neither
  6952. Cumulative number of frames with no repeated field.
  6953. @item repeated.top
  6954. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6955. @item repeated.bottom
  6956. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6957. @end table
  6958. The filter accepts the following options:
  6959. @table @option
  6960. @item intl_thres
  6961. Set interlacing threshold.
  6962. @item prog_thres
  6963. Set progressive threshold.
  6964. @item rep_thres
  6965. Threshold for repeated field detection.
  6966. @item half_life
  6967. Number of frames after which a given frame's contribution to the
  6968. statistics is halved (i.e., it contributes only 0.5 to its
  6969. classification). The default of 0 means that all frames seen are given
  6970. full weight of 1.0 forever.
  6971. @item analyze_interlaced_flag
  6972. When this is not 0 then idet will use the specified number of frames to determine
  6973. if the interlaced flag is accurate, it will not count undetermined frames.
  6974. If the flag is found to be accurate it will be used without any further
  6975. computations, if it is found to be inaccurate it will be cleared without any
  6976. further computations. This allows inserting the idet filter as a low computational
  6977. method to clean up the interlaced flag
  6978. @end table
  6979. @section il
  6980. Deinterleave or interleave fields.
  6981. This filter allows one to process interlaced images fields without
  6982. deinterlacing them. Deinterleaving splits the input frame into 2
  6983. fields (so called half pictures). Odd lines are moved to the top
  6984. half of the output image, even lines to the bottom half.
  6985. You can process (filter) them independently and then re-interleave them.
  6986. The filter accepts the following options:
  6987. @table @option
  6988. @item luma_mode, l
  6989. @item chroma_mode, c
  6990. @item alpha_mode, a
  6991. Available values for @var{luma_mode}, @var{chroma_mode} and
  6992. @var{alpha_mode} are:
  6993. @table @samp
  6994. @item none
  6995. Do nothing.
  6996. @item deinterleave, d
  6997. Deinterleave fields, placing one above the other.
  6998. @item interleave, i
  6999. Interleave fields. Reverse the effect of deinterleaving.
  7000. @end table
  7001. Default value is @code{none}.
  7002. @item luma_swap, ls
  7003. @item chroma_swap, cs
  7004. @item alpha_swap, as
  7005. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7006. @end table
  7007. @section inflate
  7008. Apply inflate effect to the video.
  7009. This filter replaces the pixel by the local(3x3) average by taking into account
  7010. only values higher than the pixel.
  7011. It accepts the following options:
  7012. @table @option
  7013. @item threshold0
  7014. @item threshold1
  7015. @item threshold2
  7016. @item threshold3
  7017. Limit the maximum change for each plane, default is 65535.
  7018. If 0, plane will remain unchanged.
  7019. @end table
  7020. @section interlace
  7021. Simple interlacing filter from progressive contents. This interleaves upper (or
  7022. lower) lines from odd frames with lower (or upper) lines from even frames,
  7023. halving the frame rate and preserving image height.
  7024. @example
  7025. Original Original New Frame
  7026. Frame 'j' Frame 'j+1' (tff)
  7027. ========== =========== ==================
  7028. Line 0 --------------------> Frame 'j' Line 0
  7029. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7030. Line 2 ---------------------> Frame 'j' Line 2
  7031. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7032. ... ... ...
  7033. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7034. @end example
  7035. It accepts the following optional parameters:
  7036. @table @option
  7037. @item scan
  7038. This determines whether the interlaced frame is taken from the even
  7039. (tff - default) or odd (bff) lines of the progressive frame.
  7040. @item lowpass
  7041. Vertical lowpass filter to avoid twitter interlacing and
  7042. reduce moire patterns.
  7043. @table @samp
  7044. @item 0, off
  7045. Disable vertical lowpass filter
  7046. @item 1, linear
  7047. Enable linear filter (default)
  7048. @item 2, complex
  7049. Enable complex filter. This will slightly less reduce twitter and moire
  7050. but better retain detail and subjective sharpness impression.
  7051. @end table
  7052. @end table
  7053. @section kerndeint
  7054. Deinterlace input video by applying Donald Graft's adaptive kernel
  7055. deinterling. Work on interlaced parts of a video to produce
  7056. progressive frames.
  7057. The description of the accepted parameters follows.
  7058. @table @option
  7059. @item thresh
  7060. Set the threshold which affects the filter's tolerance when
  7061. determining if a pixel line must be processed. It must be an integer
  7062. in the range [0,255] and defaults to 10. A value of 0 will result in
  7063. applying the process on every pixels.
  7064. @item map
  7065. Paint pixels exceeding the threshold value to white if set to 1.
  7066. Default is 0.
  7067. @item order
  7068. Set the fields order. Swap fields if set to 1, leave fields alone if
  7069. 0. Default is 0.
  7070. @item sharp
  7071. Enable additional sharpening if set to 1. Default is 0.
  7072. @item twoway
  7073. Enable twoway sharpening if set to 1. Default is 0.
  7074. @end table
  7075. @subsection Examples
  7076. @itemize
  7077. @item
  7078. Apply default values:
  7079. @example
  7080. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7081. @end example
  7082. @item
  7083. Enable additional sharpening:
  7084. @example
  7085. kerndeint=sharp=1
  7086. @end example
  7087. @item
  7088. Paint processed pixels in white:
  7089. @example
  7090. kerndeint=map=1
  7091. @end example
  7092. @end itemize
  7093. @section lenscorrection
  7094. Correct radial lens distortion
  7095. This filter can be used to correct for radial distortion as can result from the use
  7096. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7097. one can use tools available for example as part of opencv or simply trial-and-error.
  7098. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7099. and extract the k1 and k2 coefficients from the resulting matrix.
  7100. Note that effectively the same filter is available in the open-source tools Krita and
  7101. Digikam from the KDE project.
  7102. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7103. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7104. brightness distribution, so you may want to use both filters together in certain
  7105. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7106. be applied before or after lens correction.
  7107. @subsection Options
  7108. The filter accepts the following options:
  7109. @table @option
  7110. @item cx
  7111. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7112. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7113. width.
  7114. @item cy
  7115. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7116. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7117. height.
  7118. @item k1
  7119. Coefficient of the quadratic correction term. 0.5 means no correction.
  7120. @item k2
  7121. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7122. @end table
  7123. The formula that generates the correction is:
  7124. @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)
  7125. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7126. distances from the focal point in the source and target images, respectively.
  7127. @section loop
  7128. Loop video frames.
  7129. The filter accepts the following options:
  7130. @table @option
  7131. @item loop
  7132. Set the number of loops.
  7133. @item size
  7134. Set maximal size in number of frames.
  7135. @item start
  7136. Set first frame of loop.
  7137. @end table
  7138. @anchor{lut3d}
  7139. @section lut3d
  7140. Apply a 3D LUT to an input video.
  7141. The filter accepts the following options:
  7142. @table @option
  7143. @item file
  7144. Set the 3D LUT file name.
  7145. Currently supported formats:
  7146. @table @samp
  7147. @item 3dl
  7148. AfterEffects
  7149. @item cube
  7150. Iridas
  7151. @item dat
  7152. DaVinci
  7153. @item m3d
  7154. Pandora
  7155. @end table
  7156. @item interp
  7157. Select interpolation mode.
  7158. Available values are:
  7159. @table @samp
  7160. @item nearest
  7161. Use values from the nearest defined point.
  7162. @item trilinear
  7163. Interpolate values using the 8 points defining a cube.
  7164. @item tetrahedral
  7165. Interpolate values using a tetrahedron.
  7166. @end table
  7167. @end table
  7168. @section lumakey
  7169. Turn certain luma values into transparency.
  7170. The filter accepts the following options:
  7171. @table @option
  7172. @item threshold
  7173. Set the luma which will be used as base for transparency.
  7174. Default value is @code{0}.
  7175. @item tolerance
  7176. Set the range of luma values to be keyed out.
  7177. Default value is @code{0}.
  7178. @item softness
  7179. Set the range of softness. Default value is @code{0}.
  7180. Use this to control gradual transition from zero to full transparency.
  7181. @end table
  7182. @section lut, lutrgb, lutyuv
  7183. Compute a look-up table for binding each pixel component input value
  7184. to an output value, and apply it to the input video.
  7185. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7186. to an RGB input video.
  7187. These filters accept the following parameters:
  7188. @table @option
  7189. @item c0
  7190. set first pixel component expression
  7191. @item c1
  7192. set second pixel component expression
  7193. @item c2
  7194. set third pixel component expression
  7195. @item c3
  7196. set fourth pixel component expression, corresponds to the alpha component
  7197. @item r
  7198. set red component expression
  7199. @item g
  7200. set green component expression
  7201. @item b
  7202. set blue component expression
  7203. @item a
  7204. alpha component expression
  7205. @item y
  7206. set Y/luminance component expression
  7207. @item u
  7208. set U/Cb component expression
  7209. @item v
  7210. set V/Cr component expression
  7211. @end table
  7212. Each of them specifies the expression to use for computing the lookup table for
  7213. the corresponding pixel component values.
  7214. The exact component associated to each of the @var{c*} options depends on the
  7215. format in input.
  7216. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7217. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7218. The expressions can contain the following constants and functions:
  7219. @table @option
  7220. @item w
  7221. @item h
  7222. The input width and height.
  7223. @item val
  7224. The input value for the pixel component.
  7225. @item clipval
  7226. The input value, clipped to the @var{minval}-@var{maxval} range.
  7227. @item maxval
  7228. The maximum value for the pixel component.
  7229. @item minval
  7230. The minimum value for the pixel component.
  7231. @item negval
  7232. The negated value for the pixel component value, clipped to the
  7233. @var{minval}-@var{maxval} range; it corresponds to the expression
  7234. "maxval-clipval+minval".
  7235. @item clip(val)
  7236. The computed value in @var{val}, clipped to the
  7237. @var{minval}-@var{maxval} range.
  7238. @item gammaval(gamma)
  7239. The computed gamma correction value of the pixel component value,
  7240. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7241. expression
  7242. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7243. @end table
  7244. All expressions default to "val".
  7245. @subsection Examples
  7246. @itemize
  7247. @item
  7248. Negate input video:
  7249. @example
  7250. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7251. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7252. @end example
  7253. The above is the same as:
  7254. @example
  7255. lutrgb="r=negval:g=negval:b=negval"
  7256. lutyuv="y=negval:u=negval:v=negval"
  7257. @end example
  7258. @item
  7259. Negate luminance:
  7260. @example
  7261. lutyuv=y=negval
  7262. @end example
  7263. @item
  7264. Remove chroma components, turning the video into a graytone image:
  7265. @example
  7266. lutyuv="u=128:v=128"
  7267. @end example
  7268. @item
  7269. Apply a luma burning effect:
  7270. @example
  7271. lutyuv="y=2*val"
  7272. @end example
  7273. @item
  7274. Remove green and blue components:
  7275. @example
  7276. lutrgb="g=0:b=0"
  7277. @end example
  7278. @item
  7279. Set a constant alpha channel value on input:
  7280. @example
  7281. format=rgba,lutrgb=a="maxval-minval/2"
  7282. @end example
  7283. @item
  7284. Correct luminance gamma by a factor of 0.5:
  7285. @example
  7286. lutyuv=y=gammaval(0.5)
  7287. @end example
  7288. @item
  7289. Discard least significant bits of luma:
  7290. @example
  7291. lutyuv=y='bitand(val, 128+64+32)'
  7292. @end example
  7293. @item
  7294. Technicolor like effect:
  7295. @example
  7296. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7297. @end example
  7298. @end itemize
  7299. @section lut2
  7300. Compute and apply a lookup table from two video inputs.
  7301. This filter accepts the following parameters:
  7302. @table @option
  7303. @item c0
  7304. set first pixel component expression
  7305. @item c1
  7306. set second pixel component expression
  7307. @item c2
  7308. set third pixel component expression
  7309. @item c3
  7310. set fourth pixel component expression, corresponds to the alpha component
  7311. @end table
  7312. Each of them specifies the expression to use for computing the lookup table for
  7313. the corresponding pixel component values.
  7314. The exact component associated to each of the @var{c*} options depends on the
  7315. format in inputs.
  7316. The expressions can contain the following constants:
  7317. @table @option
  7318. @item w
  7319. @item h
  7320. The input width and height.
  7321. @item x
  7322. The first input value for the pixel component.
  7323. @item y
  7324. The second input value for the pixel component.
  7325. @item bdx
  7326. The first input video bit depth.
  7327. @item bdy
  7328. The second input video bit depth.
  7329. @end table
  7330. All expressions default to "x".
  7331. @subsection Examples
  7332. @itemize
  7333. @item
  7334. Highlight differences between two RGB video streams:
  7335. @example
  7336. 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)'
  7337. @end example
  7338. @item
  7339. Highlight differences between two YUV video streams:
  7340. @example
  7341. 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)'
  7342. @end example
  7343. @end itemize
  7344. @section maskedclamp
  7345. Clamp the first input stream with the second input and third input stream.
  7346. Returns the value of first stream to be between second input
  7347. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7348. This filter accepts the following options:
  7349. @table @option
  7350. @item undershoot
  7351. Default value is @code{0}.
  7352. @item overshoot
  7353. Default value is @code{0}.
  7354. @item planes
  7355. Set which planes will be processed as bitmap, unprocessed planes will be
  7356. copied from first stream.
  7357. By default value 0xf, all planes will be processed.
  7358. @end table
  7359. @section maskedmerge
  7360. Merge the first input stream with the second input stream using per pixel
  7361. weights in the third input stream.
  7362. A value of 0 in the third stream pixel component means that pixel component
  7363. from first stream is returned unchanged, while maximum value (eg. 255 for
  7364. 8-bit videos) means that pixel component from second stream is returned
  7365. unchanged. Intermediate values define the amount of merging between both
  7366. input stream's pixel components.
  7367. This filter accepts the following options:
  7368. @table @option
  7369. @item planes
  7370. Set which planes will be processed as bitmap, unprocessed planes will be
  7371. copied from first stream.
  7372. By default value 0xf, all planes will be processed.
  7373. @end table
  7374. @section mcdeint
  7375. Apply motion-compensation deinterlacing.
  7376. It needs one field per frame as input and must thus be used together
  7377. with yadif=1/3 or equivalent.
  7378. This filter accepts the following options:
  7379. @table @option
  7380. @item mode
  7381. Set the deinterlacing mode.
  7382. It accepts one of the following values:
  7383. @table @samp
  7384. @item fast
  7385. @item medium
  7386. @item slow
  7387. use iterative motion estimation
  7388. @item extra_slow
  7389. like @samp{slow}, but use multiple reference frames.
  7390. @end table
  7391. Default value is @samp{fast}.
  7392. @item parity
  7393. Set the picture field parity assumed for the input video. It must be
  7394. one of the following values:
  7395. @table @samp
  7396. @item 0, tff
  7397. assume top field first
  7398. @item 1, bff
  7399. assume bottom field first
  7400. @end table
  7401. Default value is @samp{bff}.
  7402. @item qp
  7403. Set per-block quantization parameter (QP) used by the internal
  7404. encoder.
  7405. Higher values should result in a smoother motion vector field but less
  7406. optimal individual vectors. Default value is 1.
  7407. @end table
  7408. @section mergeplanes
  7409. Merge color channel components from several video streams.
  7410. The filter accepts up to 4 input streams, and merge selected input
  7411. planes to the output video.
  7412. This filter accepts the following options:
  7413. @table @option
  7414. @item mapping
  7415. Set input to output plane mapping. Default is @code{0}.
  7416. The mappings is specified as a bitmap. It should be specified as a
  7417. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7418. mapping for the first plane of the output stream. 'A' sets the number of
  7419. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7420. corresponding input to use (from 0 to 3). The rest of the mappings is
  7421. similar, 'Bb' describes the mapping for the output stream second
  7422. plane, 'Cc' describes the mapping for the output stream third plane and
  7423. 'Dd' describes the mapping for the output stream fourth plane.
  7424. @item format
  7425. Set output pixel format. Default is @code{yuva444p}.
  7426. @end table
  7427. @subsection Examples
  7428. @itemize
  7429. @item
  7430. Merge three gray video streams of same width and height into single video stream:
  7431. @example
  7432. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7433. @end example
  7434. @item
  7435. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7436. @example
  7437. [a0][a1]mergeplanes=0x00010210:yuva444p
  7438. @end example
  7439. @item
  7440. Swap Y and A plane in yuva444p stream:
  7441. @example
  7442. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7443. @end example
  7444. @item
  7445. Swap U and V plane in yuv420p stream:
  7446. @example
  7447. format=yuv420p,mergeplanes=0x000201:yuv420p
  7448. @end example
  7449. @item
  7450. Cast a rgb24 clip to yuv444p:
  7451. @example
  7452. format=rgb24,mergeplanes=0x000102:yuv444p
  7453. @end example
  7454. @end itemize
  7455. @section mestimate
  7456. Estimate and export motion vectors using block matching algorithms.
  7457. Motion vectors are stored in frame side data to be used by other filters.
  7458. This filter accepts the following options:
  7459. @table @option
  7460. @item method
  7461. Specify the motion estimation method. Accepts one of the following values:
  7462. @table @samp
  7463. @item esa
  7464. Exhaustive search algorithm.
  7465. @item tss
  7466. Three step search algorithm.
  7467. @item tdls
  7468. Two dimensional logarithmic search algorithm.
  7469. @item ntss
  7470. New three step search algorithm.
  7471. @item fss
  7472. Four step search algorithm.
  7473. @item ds
  7474. Diamond search algorithm.
  7475. @item hexbs
  7476. Hexagon-based search algorithm.
  7477. @item epzs
  7478. Enhanced predictive zonal search algorithm.
  7479. @item umh
  7480. Uneven multi-hexagon search algorithm.
  7481. @end table
  7482. Default value is @samp{esa}.
  7483. @item mb_size
  7484. Macroblock size. Default @code{16}.
  7485. @item search_param
  7486. Search parameter. Default @code{7}.
  7487. @end table
  7488. @section midequalizer
  7489. Apply Midway Image Equalization effect using two video streams.
  7490. Midway Image Equalization adjusts a pair of images to have the same
  7491. histogram, while maintaining their dynamics as much as possible. It's
  7492. useful for e.g. matching exposures from a pair of stereo cameras.
  7493. This filter has two inputs and one output, which must be of same pixel format, but
  7494. may be of different sizes. The output of filter is first input adjusted with
  7495. midway histogram of both inputs.
  7496. This filter accepts the following option:
  7497. @table @option
  7498. @item planes
  7499. Set which planes to process. Default is @code{15}, which is all available planes.
  7500. @end table
  7501. @section minterpolate
  7502. Convert the video to specified frame rate using motion interpolation.
  7503. This filter accepts the following options:
  7504. @table @option
  7505. @item fps
  7506. 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}.
  7507. @item mi_mode
  7508. Motion interpolation mode. Following values are accepted:
  7509. @table @samp
  7510. @item dup
  7511. Duplicate previous or next frame for interpolating new ones.
  7512. @item blend
  7513. Blend source frames. Interpolated frame is mean of previous and next frames.
  7514. @item mci
  7515. Motion compensated interpolation. Following options are effective when this mode is selected:
  7516. @table @samp
  7517. @item mc_mode
  7518. Motion compensation mode. Following values are accepted:
  7519. @table @samp
  7520. @item obmc
  7521. Overlapped block motion compensation.
  7522. @item aobmc
  7523. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7524. @end table
  7525. Default mode is @samp{obmc}.
  7526. @item me_mode
  7527. Motion estimation mode. Following values are accepted:
  7528. @table @samp
  7529. @item bidir
  7530. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7531. @item bilat
  7532. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7533. @end table
  7534. Default mode is @samp{bilat}.
  7535. @item me
  7536. The algorithm to be used for motion estimation. Following values are accepted:
  7537. @table @samp
  7538. @item esa
  7539. Exhaustive search algorithm.
  7540. @item tss
  7541. Three step search algorithm.
  7542. @item tdls
  7543. Two dimensional logarithmic search algorithm.
  7544. @item ntss
  7545. New three step search algorithm.
  7546. @item fss
  7547. Four step search algorithm.
  7548. @item ds
  7549. Diamond search algorithm.
  7550. @item hexbs
  7551. Hexagon-based search algorithm.
  7552. @item epzs
  7553. Enhanced predictive zonal search algorithm.
  7554. @item umh
  7555. Uneven multi-hexagon search algorithm.
  7556. @end table
  7557. Default algorithm is @samp{epzs}.
  7558. @item mb_size
  7559. Macroblock size. Default @code{16}.
  7560. @item search_param
  7561. Motion estimation search parameter. Default @code{32}.
  7562. @item vsbmc
  7563. 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).
  7564. @end table
  7565. @end table
  7566. @item scd
  7567. 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:
  7568. @table @samp
  7569. @item none
  7570. Disable scene change detection.
  7571. @item fdiff
  7572. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7573. @end table
  7574. Default method is @samp{fdiff}.
  7575. @item scd_threshold
  7576. Scene change detection threshold. Default is @code{5.0}.
  7577. @end table
  7578. @section mpdecimate
  7579. Drop frames that do not differ greatly from the previous frame in
  7580. order to reduce frame rate.
  7581. The main use of this filter is for very-low-bitrate encoding
  7582. (e.g. streaming over dialup modem), but it could in theory be used for
  7583. fixing movies that were inverse-telecined incorrectly.
  7584. A description of the accepted options follows.
  7585. @table @option
  7586. @item max
  7587. Set the maximum number of consecutive frames which can be dropped (if
  7588. positive), or the minimum interval between dropped frames (if
  7589. negative). If the value is 0, the frame is dropped unregarding the
  7590. number of previous sequentially dropped frames.
  7591. Default value is 0.
  7592. @item hi
  7593. @item lo
  7594. @item frac
  7595. Set the dropping threshold values.
  7596. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7597. represent actual pixel value differences, so a threshold of 64
  7598. corresponds to 1 unit of difference for each pixel, or the same spread
  7599. out differently over the block.
  7600. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7601. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7602. meaning the whole image) differ by more than a threshold of @option{lo}.
  7603. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7604. 64*5, and default value for @option{frac} is 0.33.
  7605. @end table
  7606. @section negate
  7607. Negate input video.
  7608. It accepts an integer in input; if non-zero it negates the
  7609. alpha component (if available). The default value in input is 0.
  7610. @section nlmeans
  7611. Denoise frames using Non-Local Means algorithm.
  7612. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7613. context similarity is defined by comparing their surrounding patches of size
  7614. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7615. around the pixel.
  7616. Note that the research area defines centers for patches, which means some
  7617. patches will be made of pixels outside that research area.
  7618. The filter accepts the following options.
  7619. @table @option
  7620. @item s
  7621. Set denoising strength.
  7622. @item p
  7623. Set patch size.
  7624. @item pc
  7625. Same as @option{p} but for chroma planes.
  7626. The default value is @var{0} and means automatic.
  7627. @item r
  7628. Set research size.
  7629. @item rc
  7630. Same as @option{r} but for chroma planes.
  7631. The default value is @var{0} and means automatic.
  7632. @end table
  7633. @section nnedi
  7634. Deinterlace video using neural network edge directed interpolation.
  7635. This filter accepts the following options:
  7636. @table @option
  7637. @item weights
  7638. Mandatory option, without binary file filter can not work.
  7639. Currently file can be found here:
  7640. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7641. @item deint
  7642. Set which frames to deinterlace, by default it is @code{all}.
  7643. Can be @code{all} or @code{interlaced}.
  7644. @item field
  7645. Set mode of operation.
  7646. Can be one of the following:
  7647. @table @samp
  7648. @item af
  7649. Use frame flags, both fields.
  7650. @item a
  7651. Use frame flags, single field.
  7652. @item t
  7653. Use top field only.
  7654. @item b
  7655. Use bottom field only.
  7656. @item tf
  7657. Use both fields, top first.
  7658. @item bf
  7659. Use both fields, bottom first.
  7660. @end table
  7661. @item planes
  7662. Set which planes to process, by default filter process all frames.
  7663. @item nsize
  7664. Set size of local neighborhood around each pixel, used by the predictor neural
  7665. network.
  7666. Can be one of the following:
  7667. @table @samp
  7668. @item s8x6
  7669. @item s16x6
  7670. @item s32x6
  7671. @item s48x6
  7672. @item s8x4
  7673. @item s16x4
  7674. @item s32x4
  7675. @end table
  7676. @item nns
  7677. Set the number of neurons in predicctor neural network.
  7678. Can be one of the following:
  7679. @table @samp
  7680. @item n16
  7681. @item n32
  7682. @item n64
  7683. @item n128
  7684. @item n256
  7685. @end table
  7686. @item qual
  7687. Controls the number of different neural network predictions that are blended
  7688. together to compute the final output value. Can be @code{fast}, default or
  7689. @code{slow}.
  7690. @item etype
  7691. Set which set of weights to use in the predictor.
  7692. Can be one of the following:
  7693. @table @samp
  7694. @item a
  7695. weights trained to minimize absolute error
  7696. @item s
  7697. weights trained to minimize squared error
  7698. @end table
  7699. @item pscrn
  7700. Controls whether or not the prescreener neural network is used to decide
  7701. which pixels should be processed by the predictor neural network and which
  7702. can be handled by simple cubic interpolation.
  7703. The prescreener is trained to know whether cubic interpolation will be
  7704. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7705. The computational complexity of the prescreener nn is much less than that of
  7706. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7707. using the prescreener generally results in much faster processing.
  7708. The prescreener is pretty accurate, so the difference between using it and not
  7709. using it is almost always unnoticeable.
  7710. Can be one of the following:
  7711. @table @samp
  7712. @item none
  7713. @item original
  7714. @item new
  7715. @end table
  7716. Default is @code{new}.
  7717. @item fapprox
  7718. Set various debugging flags.
  7719. @end table
  7720. @section noformat
  7721. Force libavfilter not to use any of the specified pixel formats for the
  7722. input to the next filter.
  7723. It accepts the following parameters:
  7724. @table @option
  7725. @item pix_fmts
  7726. A '|'-separated list of pixel format names, such as
  7727. apix_fmts=yuv420p|monow|rgb24".
  7728. @end table
  7729. @subsection Examples
  7730. @itemize
  7731. @item
  7732. Force libavfilter to use a format different from @var{yuv420p} for the
  7733. input to the vflip filter:
  7734. @example
  7735. noformat=pix_fmts=yuv420p,vflip
  7736. @end example
  7737. @item
  7738. Convert the input video to any of the formats not contained in the list:
  7739. @example
  7740. noformat=yuv420p|yuv444p|yuv410p
  7741. @end example
  7742. @end itemize
  7743. @section noise
  7744. Add noise on video input frame.
  7745. The filter accepts the following options:
  7746. @table @option
  7747. @item all_seed
  7748. @item c0_seed
  7749. @item c1_seed
  7750. @item c2_seed
  7751. @item c3_seed
  7752. Set noise seed for specific pixel component or all pixel components in case
  7753. of @var{all_seed}. Default value is @code{123457}.
  7754. @item all_strength, alls
  7755. @item c0_strength, c0s
  7756. @item c1_strength, c1s
  7757. @item c2_strength, c2s
  7758. @item c3_strength, c3s
  7759. Set noise strength for specific pixel component or all pixel components in case
  7760. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7761. @item all_flags, allf
  7762. @item c0_flags, c0f
  7763. @item c1_flags, c1f
  7764. @item c2_flags, c2f
  7765. @item c3_flags, c3f
  7766. Set pixel component flags or set flags for all components if @var{all_flags}.
  7767. Available values for component flags are:
  7768. @table @samp
  7769. @item a
  7770. averaged temporal noise (smoother)
  7771. @item p
  7772. mix random noise with a (semi)regular pattern
  7773. @item t
  7774. temporal noise (noise pattern changes between frames)
  7775. @item u
  7776. uniform noise (gaussian otherwise)
  7777. @end table
  7778. @end table
  7779. @subsection Examples
  7780. Add temporal and uniform noise to input video:
  7781. @example
  7782. noise=alls=20:allf=t+u
  7783. @end example
  7784. @section null
  7785. Pass the video source unchanged to the output.
  7786. @section ocr
  7787. Optical Character Recognition
  7788. This filter uses Tesseract for optical character recognition.
  7789. It accepts the following options:
  7790. @table @option
  7791. @item datapath
  7792. Set datapath to tesseract data. Default is to use whatever was
  7793. set at installation.
  7794. @item language
  7795. Set language, default is "eng".
  7796. @item whitelist
  7797. Set character whitelist.
  7798. @item blacklist
  7799. Set character blacklist.
  7800. @end table
  7801. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7802. @section ocv
  7803. Apply a video transform using libopencv.
  7804. To enable this filter, install the libopencv library and headers and
  7805. configure FFmpeg with @code{--enable-libopencv}.
  7806. It accepts the following parameters:
  7807. @table @option
  7808. @item filter_name
  7809. The name of the libopencv filter to apply.
  7810. @item filter_params
  7811. The parameters to pass to the libopencv filter. If not specified, the default
  7812. values are assumed.
  7813. @end table
  7814. Refer to the official libopencv documentation for more precise
  7815. information:
  7816. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7817. Several libopencv filters are supported; see the following subsections.
  7818. @anchor{dilate}
  7819. @subsection dilate
  7820. Dilate an image by using a specific structuring element.
  7821. It corresponds to the libopencv function @code{cvDilate}.
  7822. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7823. @var{struct_el} represents a structuring element, and has the syntax:
  7824. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7825. @var{cols} and @var{rows} represent the number of columns and rows of
  7826. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7827. point, and @var{shape} the shape for the structuring element. @var{shape}
  7828. must be "rect", "cross", "ellipse", or "custom".
  7829. If the value for @var{shape} is "custom", it must be followed by a
  7830. string of the form "=@var{filename}". The file with name
  7831. @var{filename} is assumed to represent a binary image, with each
  7832. printable character corresponding to a bright pixel. When a custom
  7833. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7834. or columns and rows of the read file are assumed instead.
  7835. The default value for @var{struct_el} is "3x3+0x0/rect".
  7836. @var{nb_iterations} specifies the number of times the transform is
  7837. applied to the image, and defaults to 1.
  7838. Some examples:
  7839. @example
  7840. # Use the default values
  7841. ocv=dilate
  7842. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7843. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7844. # Read the shape from the file diamond.shape, iterating two times.
  7845. # The file diamond.shape may contain a pattern of characters like this
  7846. # *
  7847. # ***
  7848. # *****
  7849. # ***
  7850. # *
  7851. # The specified columns and rows are ignored
  7852. # but the anchor point coordinates are not
  7853. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7854. @end example
  7855. @subsection erode
  7856. Erode an image by using a specific structuring element.
  7857. It corresponds to the libopencv function @code{cvErode}.
  7858. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7859. with the same syntax and semantics as the @ref{dilate} filter.
  7860. @subsection smooth
  7861. Smooth the input video.
  7862. The filter takes the following parameters:
  7863. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7864. @var{type} is the type of smooth filter to apply, and must be one of
  7865. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7866. or "bilateral". The default value is "gaussian".
  7867. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7868. depend on the smooth type. @var{param1} and
  7869. @var{param2} accept integer positive values or 0. @var{param3} and
  7870. @var{param4} accept floating point values.
  7871. The default value for @var{param1} is 3. The default value for the
  7872. other parameters is 0.
  7873. These parameters correspond to the parameters assigned to the
  7874. libopencv function @code{cvSmooth}.
  7875. @section oscilloscope
  7876. 2D Video Oscilloscope.
  7877. Useful to measure spatial impulse, step responses, chroma delays, etc.
  7878. It accepts the following parameters:
  7879. @table @option
  7880. @item x
  7881. Set scope center x position.
  7882. @item y
  7883. Set scope center y position.
  7884. @item s
  7885. Set scope size, relative to frame diagonal.
  7886. @item t
  7887. Set scope tilt/rotation.
  7888. @item o
  7889. Set trace opacity.
  7890. @item tx
  7891. Set trace center x position.
  7892. @item ty
  7893. Set trace center y position.
  7894. @item tw
  7895. Set trace width, relative to width of frame.
  7896. @item th
  7897. Set trace height, relative to height of frame.
  7898. @item c
  7899. Set which components to trace. By default it traces first three components.
  7900. @item g
  7901. Draw trace grid. By default is enabled.
  7902. @item st
  7903. Draw some statistics. By default is enabled.
  7904. @item sc
  7905. Draw scope. By default is enabled.
  7906. @end table
  7907. @subsection Examples
  7908. @itemize
  7909. @item
  7910. Inspect full first row of video frame.
  7911. @example
  7912. oscilloscope=x=0.5:y=0:s=1
  7913. @end example
  7914. @item
  7915. Inspect full last row of video frame.
  7916. @example
  7917. oscilloscope=x=0.5:y=1:s=1
  7918. @end example
  7919. @item
  7920. Inspect full 5th line of video frame of height 1080.
  7921. @example
  7922. oscilloscope=x=0.5:y=5/1080:s=1
  7923. @end example
  7924. @item
  7925. Inspect full last column of video frame.
  7926. @example
  7927. oscilloscope=x=1:y=0.5:s=1:t=1
  7928. @end example
  7929. @end itemize
  7930. @anchor{overlay}
  7931. @section overlay
  7932. Overlay one video on top of another.
  7933. It takes two inputs and has one output. The first input is the "main"
  7934. video on which the second input is overlaid.
  7935. It accepts the following parameters:
  7936. A description of the accepted options follows.
  7937. @table @option
  7938. @item x
  7939. @item y
  7940. Set the expression for the x and y coordinates of the overlaid video
  7941. on the main video. Default value is "0" for both expressions. In case
  7942. the expression is invalid, it is set to a huge value (meaning that the
  7943. overlay will not be displayed within the output visible area).
  7944. @item eof_action
  7945. The action to take when EOF is encountered on the secondary input; it accepts
  7946. one of the following values:
  7947. @table @option
  7948. @item repeat
  7949. Repeat the last frame (the default).
  7950. @item endall
  7951. End both streams.
  7952. @item pass
  7953. Pass the main input through.
  7954. @end table
  7955. @item eval
  7956. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7957. It accepts the following values:
  7958. @table @samp
  7959. @item init
  7960. only evaluate expressions once during the filter initialization or
  7961. when a command is processed
  7962. @item frame
  7963. evaluate expressions for each incoming frame
  7964. @end table
  7965. Default value is @samp{frame}.
  7966. @item shortest
  7967. If set to 1, force the output to terminate when the shortest input
  7968. terminates. Default value is 0.
  7969. @item format
  7970. Set the format for the output video.
  7971. It accepts the following values:
  7972. @table @samp
  7973. @item yuv420
  7974. force YUV420 output
  7975. @item yuv422
  7976. force YUV422 output
  7977. @item yuv444
  7978. force YUV444 output
  7979. @item rgb
  7980. force packed RGB output
  7981. @item gbrp
  7982. force planar RGB output
  7983. @end table
  7984. Default value is @samp{yuv420}.
  7985. @item rgb @emph{(deprecated)}
  7986. If set to 1, force the filter to accept inputs in the RGB
  7987. color space. Default value is 0. This option is deprecated, use
  7988. @option{format} instead.
  7989. @item repeatlast
  7990. If set to 1, force the filter to draw the last overlay frame over the
  7991. main input until the end of the stream. A value of 0 disables this
  7992. behavior. Default value is 1.
  7993. @end table
  7994. The @option{x}, and @option{y} expressions can contain the following
  7995. parameters.
  7996. @table @option
  7997. @item main_w, W
  7998. @item main_h, H
  7999. The main input width and height.
  8000. @item overlay_w, w
  8001. @item overlay_h, h
  8002. The overlay input width and height.
  8003. @item x
  8004. @item y
  8005. The computed values for @var{x} and @var{y}. They are evaluated for
  8006. each new frame.
  8007. @item hsub
  8008. @item vsub
  8009. horizontal and vertical chroma subsample values of the output
  8010. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8011. @var{vsub} is 1.
  8012. @item n
  8013. the number of input frame, starting from 0
  8014. @item pos
  8015. the position in the file of the input frame, NAN if unknown
  8016. @item t
  8017. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8018. @end table
  8019. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8020. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8021. when @option{eval} is set to @samp{init}.
  8022. Be aware that frames are taken from each input video in timestamp
  8023. order, hence, if their initial timestamps differ, it is a good idea
  8024. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8025. have them begin in the same zero timestamp, as the example for
  8026. the @var{movie} filter does.
  8027. You can chain together more overlays but you should test the
  8028. efficiency of such approach.
  8029. @subsection Commands
  8030. This filter supports the following commands:
  8031. @table @option
  8032. @item x
  8033. @item y
  8034. Modify the x and y of the overlay input.
  8035. The command accepts the same syntax of the corresponding option.
  8036. If the specified expression is not valid, it is kept at its current
  8037. value.
  8038. @end table
  8039. @subsection Examples
  8040. @itemize
  8041. @item
  8042. Draw the overlay at 10 pixels from the bottom right corner of the main
  8043. video:
  8044. @example
  8045. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8046. @end example
  8047. Using named options the example above becomes:
  8048. @example
  8049. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8050. @end example
  8051. @item
  8052. Insert a transparent PNG logo in the bottom left corner of the input,
  8053. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8054. @example
  8055. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8056. @end example
  8057. @item
  8058. Insert 2 different transparent PNG logos (second logo on bottom
  8059. right corner) using the @command{ffmpeg} tool:
  8060. @example
  8061. 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
  8062. @end example
  8063. @item
  8064. Add a transparent color layer on top of the main video; @code{WxH}
  8065. must specify the size of the main input to the overlay filter:
  8066. @example
  8067. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8068. @end example
  8069. @item
  8070. Play an original video and a filtered version (here with the deshake
  8071. filter) side by side using the @command{ffplay} tool:
  8072. @example
  8073. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8074. @end example
  8075. The above command is the same as:
  8076. @example
  8077. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8078. @end example
  8079. @item
  8080. Make a sliding overlay appearing from the left to the right top part of the
  8081. screen starting since time 2:
  8082. @example
  8083. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8084. @end example
  8085. @item
  8086. Compose output by putting two input videos side to side:
  8087. @example
  8088. ffmpeg -i left.avi -i right.avi -filter_complex "
  8089. nullsrc=size=200x100 [background];
  8090. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8091. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8092. [background][left] overlay=shortest=1 [background+left];
  8093. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8094. "
  8095. @end example
  8096. @item
  8097. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8098. @example
  8099. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8100. -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]'
  8101. masked.avi
  8102. @end example
  8103. @item
  8104. Chain several overlays in cascade:
  8105. @example
  8106. nullsrc=s=200x200 [bg];
  8107. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8108. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8109. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8110. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8111. [in3] null, [mid2] overlay=100:100 [out0]
  8112. @end example
  8113. @end itemize
  8114. @section owdenoise
  8115. Apply Overcomplete Wavelet denoiser.
  8116. The filter accepts the following options:
  8117. @table @option
  8118. @item depth
  8119. Set depth.
  8120. Larger depth values will denoise lower frequency components more, but
  8121. slow down filtering.
  8122. Must be an int in the range 8-16, default is @code{8}.
  8123. @item luma_strength, ls
  8124. Set luma strength.
  8125. Must be a double value in the range 0-1000, default is @code{1.0}.
  8126. @item chroma_strength, cs
  8127. Set chroma strength.
  8128. Must be a double value in the range 0-1000, default is @code{1.0}.
  8129. @end table
  8130. @anchor{pad}
  8131. @section pad
  8132. Add paddings to the input image, and place the original input at the
  8133. provided @var{x}, @var{y} coordinates.
  8134. It accepts the following parameters:
  8135. @table @option
  8136. @item width, w
  8137. @item height, h
  8138. Specify an expression for the size of the output image with the
  8139. paddings added. If the value for @var{width} or @var{height} is 0, the
  8140. corresponding input size is used for the output.
  8141. The @var{width} expression can reference the value set by the
  8142. @var{height} expression, and vice versa.
  8143. The default value of @var{width} and @var{height} is 0.
  8144. @item x
  8145. @item y
  8146. Specify the offsets to place the input image at within the padded area,
  8147. with respect to the top/left border of the output image.
  8148. The @var{x} expression can reference the value set by the @var{y}
  8149. expression, and vice versa.
  8150. The default value of @var{x} and @var{y} is 0.
  8151. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8152. so the input image is centered on the padded area.
  8153. @item color
  8154. Specify the color of the padded area. For the syntax of this option,
  8155. check the "Color" section in the ffmpeg-utils manual.
  8156. The default value of @var{color} is "black".
  8157. @item eval
  8158. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8159. It accepts the following values:
  8160. @table @samp
  8161. @item init
  8162. Only evaluate expressions once during the filter initialization or when
  8163. a command is processed.
  8164. @item frame
  8165. Evaluate expressions for each incoming frame.
  8166. @end table
  8167. Default value is @samp{init}.
  8168. @item aspect
  8169. Pad to aspect instead to a resolution.
  8170. @end table
  8171. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8172. options are expressions containing the following constants:
  8173. @table @option
  8174. @item in_w
  8175. @item in_h
  8176. The input video width and height.
  8177. @item iw
  8178. @item ih
  8179. These are the same as @var{in_w} and @var{in_h}.
  8180. @item out_w
  8181. @item out_h
  8182. The output width and height (the size of the padded area), as
  8183. specified by the @var{width} and @var{height} expressions.
  8184. @item ow
  8185. @item oh
  8186. These are the same as @var{out_w} and @var{out_h}.
  8187. @item x
  8188. @item y
  8189. The x and y offsets as specified by the @var{x} and @var{y}
  8190. expressions, or NAN if not yet specified.
  8191. @item a
  8192. same as @var{iw} / @var{ih}
  8193. @item sar
  8194. input sample aspect ratio
  8195. @item dar
  8196. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8197. @item hsub
  8198. @item vsub
  8199. The horizontal and vertical chroma subsample values. For example for the
  8200. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8201. @end table
  8202. @subsection Examples
  8203. @itemize
  8204. @item
  8205. Add paddings with the color "violet" to the input video. The output video
  8206. size is 640x480, and the top-left corner of the input video is placed at
  8207. column 0, row 40
  8208. @example
  8209. pad=640:480:0:40:violet
  8210. @end example
  8211. The example above is equivalent to the following command:
  8212. @example
  8213. pad=width=640:height=480:x=0:y=40:color=violet
  8214. @end example
  8215. @item
  8216. Pad the input to get an output with dimensions increased by 3/2,
  8217. and put the input video at the center of the padded area:
  8218. @example
  8219. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8220. @end example
  8221. @item
  8222. Pad the input to get a squared output with size equal to the maximum
  8223. value between the input width and height, and put the input video at
  8224. the center of the padded area:
  8225. @example
  8226. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8227. @end example
  8228. @item
  8229. Pad the input to get a final w/h ratio of 16:9:
  8230. @example
  8231. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8232. @end example
  8233. @item
  8234. In case of anamorphic video, in order to set the output display aspect
  8235. correctly, it is necessary to use @var{sar} in the expression,
  8236. according to the relation:
  8237. @example
  8238. (ih * X / ih) * sar = output_dar
  8239. X = output_dar / sar
  8240. @end example
  8241. Thus the previous example needs to be modified to:
  8242. @example
  8243. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8244. @end example
  8245. @item
  8246. Double the output size and put the input video in the bottom-right
  8247. corner of the output padded area:
  8248. @example
  8249. pad="2*iw:2*ih:ow-iw:oh-ih"
  8250. @end example
  8251. @end itemize
  8252. @anchor{palettegen}
  8253. @section palettegen
  8254. Generate one palette for a whole video stream.
  8255. It accepts the following options:
  8256. @table @option
  8257. @item max_colors
  8258. Set the maximum number of colors to quantize in the palette.
  8259. Note: the palette will still contain 256 colors; the unused palette entries
  8260. will be black.
  8261. @item reserve_transparent
  8262. Create a palette of 255 colors maximum and reserve the last one for
  8263. transparency. Reserving the transparency color is useful for GIF optimization.
  8264. If not set, the maximum of colors in the palette will be 256. You probably want
  8265. to disable this option for a standalone image.
  8266. Set by default.
  8267. @item stats_mode
  8268. Set statistics mode.
  8269. It accepts the following values:
  8270. @table @samp
  8271. @item full
  8272. Compute full frame histograms.
  8273. @item diff
  8274. Compute histograms only for the part that differs from previous frame. This
  8275. might be relevant to give more importance to the moving part of your input if
  8276. the background is static.
  8277. @item single
  8278. Compute new histogram for each frame.
  8279. @end table
  8280. Default value is @var{full}.
  8281. @end table
  8282. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8283. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8284. color quantization of the palette. This information is also visible at
  8285. @var{info} logging level.
  8286. @subsection Examples
  8287. @itemize
  8288. @item
  8289. Generate a representative palette of a given video using @command{ffmpeg}:
  8290. @example
  8291. ffmpeg -i input.mkv -vf palettegen palette.png
  8292. @end example
  8293. @end itemize
  8294. @section paletteuse
  8295. Use a palette to downsample an input video stream.
  8296. The filter takes two inputs: one video stream and a palette. The palette must
  8297. be a 256 pixels image.
  8298. It accepts the following options:
  8299. @table @option
  8300. @item dither
  8301. Select dithering mode. Available algorithms are:
  8302. @table @samp
  8303. @item bayer
  8304. Ordered 8x8 bayer dithering (deterministic)
  8305. @item heckbert
  8306. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8307. Note: this dithering is sometimes considered "wrong" and is included as a
  8308. reference.
  8309. @item floyd_steinberg
  8310. Floyd and Steingberg dithering (error diffusion)
  8311. @item sierra2
  8312. Frankie Sierra dithering v2 (error diffusion)
  8313. @item sierra2_4a
  8314. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8315. @end table
  8316. Default is @var{sierra2_4a}.
  8317. @item bayer_scale
  8318. When @var{bayer} dithering is selected, this option defines the scale of the
  8319. pattern (how much the crosshatch pattern is visible). A low value means more
  8320. visible pattern for less banding, and higher value means less visible pattern
  8321. at the cost of more banding.
  8322. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8323. @item diff_mode
  8324. If set, define the zone to process
  8325. @table @samp
  8326. @item rectangle
  8327. Only the changing rectangle will be reprocessed. This is similar to GIF
  8328. cropping/offsetting compression mechanism. This option can be useful for speed
  8329. if only a part of the image is changing, and has use cases such as limiting the
  8330. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8331. moving scene (it leads to more deterministic output if the scene doesn't change
  8332. much, and as a result less moving noise and better GIF compression).
  8333. @end table
  8334. Default is @var{none}.
  8335. @item new
  8336. Take new palette for each output frame.
  8337. @end table
  8338. @subsection Examples
  8339. @itemize
  8340. @item
  8341. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8342. using @command{ffmpeg}:
  8343. @example
  8344. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8345. @end example
  8346. @end itemize
  8347. @section perspective
  8348. Correct perspective of video not recorded perpendicular to the screen.
  8349. A description of the accepted parameters follows.
  8350. @table @option
  8351. @item x0
  8352. @item y0
  8353. @item x1
  8354. @item y1
  8355. @item x2
  8356. @item y2
  8357. @item x3
  8358. @item y3
  8359. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8360. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8361. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8362. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8363. then the corners of the source will be sent to the specified coordinates.
  8364. The expressions can use the following variables:
  8365. @table @option
  8366. @item W
  8367. @item H
  8368. the width and height of video frame.
  8369. @item in
  8370. Input frame count.
  8371. @item on
  8372. Output frame count.
  8373. @end table
  8374. @item interpolation
  8375. Set interpolation for perspective correction.
  8376. It accepts the following values:
  8377. @table @samp
  8378. @item linear
  8379. @item cubic
  8380. @end table
  8381. Default value is @samp{linear}.
  8382. @item sense
  8383. Set interpretation of coordinate options.
  8384. It accepts the following values:
  8385. @table @samp
  8386. @item 0, source
  8387. Send point in the source specified by the given coordinates to
  8388. the corners of the destination.
  8389. @item 1, destination
  8390. Send the corners of the source to the point in the destination specified
  8391. by the given coordinates.
  8392. Default value is @samp{source}.
  8393. @end table
  8394. @item eval
  8395. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8396. It accepts the following values:
  8397. @table @samp
  8398. @item init
  8399. only evaluate expressions once during the filter initialization or
  8400. when a command is processed
  8401. @item frame
  8402. evaluate expressions for each incoming frame
  8403. @end table
  8404. Default value is @samp{init}.
  8405. @end table
  8406. @section phase
  8407. Delay interlaced video by one field time so that the field order changes.
  8408. The intended use is to fix PAL movies that have been captured with the
  8409. opposite field order to the film-to-video transfer.
  8410. A description of the accepted parameters follows.
  8411. @table @option
  8412. @item mode
  8413. Set phase mode.
  8414. It accepts the following values:
  8415. @table @samp
  8416. @item t
  8417. Capture field order top-first, transfer bottom-first.
  8418. Filter will delay the bottom field.
  8419. @item b
  8420. Capture field order bottom-first, transfer top-first.
  8421. Filter will delay the top field.
  8422. @item p
  8423. Capture and transfer with the same field order. This mode only exists
  8424. for the documentation of the other options to refer to, but if you
  8425. actually select it, the filter will faithfully do nothing.
  8426. @item a
  8427. Capture field order determined automatically by field flags, transfer
  8428. opposite.
  8429. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8430. basis using field flags. If no field information is available,
  8431. then this works just like @samp{u}.
  8432. @item u
  8433. Capture unknown or varying, transfer opposite.
  8434. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8435. analyzing the images and selecting the alternative that produces best
  8436. match between the fields.
  8437. @item T
  8438. Capture top-first, transfer unknown or varying.
  8439. Filter selects among @samp{t} and @samp{p} using image analysis.
  8440. @item B
  8441. Capture bottom-first, transfer unknown or varying.
  8442. Filter selects among @samp{b} and @samp{p} using image analysis.
  8443. @item A
  8444. Capture determined by field flags, transfer unknown or varying.
  8445. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8446. image analysis. If no field information is available, then this works just
  8447. like @samp{U}. This is the default mode.
  8448. @item U
  8449. Both capture and transfer unknown or varying.
  8450. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8451. @end table
  8452. @end table
  8453. @section pixdesctest
  8454. Pixel format descriptor test filter, mainly useful for internal
  8455. testing. The output video should be equal to the input video.
  8456. For example:
  8457. @example
  8458. format=monow, pixdesctest
  8459. @end example
  8460. can be used to test the monowhite pixel format descriptor definition.
  8461. @section pixscope
  8462. Display sample values of color channels. Mainly useful for checking color and levels.
  8463. The filters accept the following options:
  8464. @table @option
  8465. @item x
  8466. Set scope X position, offset on X axis.
  8467. @item y
  8468. Set scope Y position, offset on Y axis.
  8469. @item w
  8470. Set scope width.
  8471. @item h
  8472. Set scope height.
  8473. @item o
  8474. Set window opacity. This window also holds statistics about pixel area.
  8475. @end table
  8476. @section pp
  8477. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8478. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8479. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8480. Each subfilter and some options have a short and a long name that can be used
  8481. interchangeably, i.e. dr/dering are the same.
  8482. The filters accept the following options:
  8483. @table @option
  8484. @item subfilters
  8485. Set postprocessing subfilters string.
  8486. @end table
  8487. All subfilters share common options to determine their scope:
  8488. @table @option
  8489. @item a/autoq
  8490. Honor the quality commands for this subfilter.
  8491. @item c/chrom
  8492. Do chrominance filtering, too (default).
  8493. @item y/nochrom
  8494. Do luminance filtering only (no chrominance).
  8495. @item n/noluma
  8496. Do chrominance filtering only (no luminance).
  8497. @end table
  8498. These options can be appended after the subfilter name, separated by a '|'.
  8499. Available subfilters are:
  8500. @table @option
  8501. @item hb/hdeblock[|difference[|flatness]]
  8502. Horizontal deblocking filter
  8503. @table @option
  8504. @item difference
  8505. Difference factor where higher values mean more deblocking (default: @code{32}).
  8506. @item flatness
  8507. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8508. @end table
  8509. @item vb/vdeblock[|difference[|flatness]]
  8510. Vertical deblocking filter
  8511. @table @option
  8512. @item difference
  8513. Difference factor where higher values mean more deblocking (default: @code{32}).
  8514. @item flatness
  8515. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8516. @end table
  8517. @item ha/hadeblock[|difference[|flatness]]
  8518. Accurate horizontal deblocking filter
  8519. @table @option
  8520. @item difference
  8521. Difference factor where higher values mean more deblocking (default: @code{32}).
  8522. @item flatness
  8523. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8524. @end table
  8525. @item va/vadeblock[|difference[|flatness]]
  8526. Accurate vertical deblocking filter
  8527. @table @option
  8528. @item difference
  8529. Difference factor where higher values mean more deblocking (default: @code{32}).
  8530. @item flatness
  8531. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8532. @end table
  8533. @end table
  8534. The horizontal and vertical deblocking filters share the difference and
  8535. flatness values so you cannot set different horizontal and vertical
  8536. thresholds.
  8537. @table @option
  8538. @item h1/x1hdeblock
  8539. Experimental horizontal deblocking filter
  8540. @item v1/x1vdeblock
  8541. Experimental vertical deblocking filter
  8542. @item dr/dering
  8543. Deringing filter
  8544. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8545. @table @option
  8546. @item threshold1
  8547. larger -> stronger filtering
  8548. @item threshold2
  8549. larger -> stronger filtering
  8550. @item threshold3
  8551. larger -> stronger filtering
  8552. @end table
  8553. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8554. @table @option
  8555. @item f/fullyrange
  8556. Stretch luminance to @code{0-255}.
  8557. @end table
  8558. @item lb/linblenddeint
  8559. Linear blend deinterlacing filter that deinterlaces the given block by
  8560. filtering all lines with a @code{(1 2 1)} filter.
  8561. @item li/linipoldeint
  8562. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8563. linearly interpolating every second line.
  8564. @item ci/cubicipoldeint
  8565. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8566. cubically interpolating every second line.
  8567. @item md/mediandeint
  8568. Median deinterlacing filter that deinterlaces the given block by applying a
  8569. median filter to every second line.
  8570. @item fd/ffmpegdeint
  8571. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8572. second line with a @code{(-1 4 2 4 -1)} filter.
  8573. @item l5/lowpass5
  8574. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8575. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8576. @item fq/forceQuant[|quantizer]
  8577. Overrides the quantizer table from the input with the constant quantizer you
  8578. specify.
  8579. @table @option
  8580. @item quantizer
  8581. Quantizer to use
  8582. @end table
  8583. @item de/default
  8584. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8585. @item fa/fast
  8586. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8587. @item ac
  8588. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8589. @end table
  8590. @subsection Examples
  8591. @itemize
  8592. @item
  8593. Apply horizontal and vertical deblocking, deringing and automatic
  8594. brightness/contrast:
  8595. @example
  8596. pp=hb/vb/dr/al
  8597. @end example
  8598. @item
  8599. Apply default filters without brightness/contrast correction:
  8600. @example
  8601. pp=de/-al
  8602. @end example
  8603. @item
  8604. Apply default filters and temporal denoiser:
  8605. @example
  8606. pp=default/tmpnoise|1|2|3
  8607. @end example
  8608. @item
  8609. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8610. automatically depending on available CPU time:
  8611. @example
  8612. pp=hb|y/vb|a
  8613. @end example
  8614. @end itemize
  8615. @section pp7
  8616. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8617. similar to spp = 6 with 7 point DCT, where only the center sample is
  8618. used after IDCT.
  8619. The filter accepts the following options:
  8620. @table @option
  8621. @item qp
  8622. Force a constant quantization parameter. It accepts an integer in range
  8623. 0 to 63. If not set, the filter will use the QP from the video stream
  8624. (if available).
  8625. @item mode
  8626. Set thresholding mode. Available modes are:
  8627. @table @samp
  8628. @item hard
  8629. Set hard thresholding.
  8630. @item soft
  8631. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8632. @item medium
  8633. Set medium thresholding (good results, default).
  8634. @end table
  8635. @end table
  8636. @section premultiply
  8637. Apply alpha premultiply effect to input video stream using first plane
  8638. of second stream as alpha.
  8639. Both streams must have same dimensions and same pixel format.
  8640. The filter accepts the following option:
  8641. @table @option
  8642. @item planes
  8643. Set which planes will be processed, unprocessed planes will be copied.
  8644. By default value 0xf, all planes will be processed.
  8645. @end table
  8646. @section prewitt
  8647. Apply prewitt operator to input video stream.
  8648. The filter accepts the following option:
  8649. @table @option
  8650. @item planes
  8651. Set which planes will be processed, unprocessed planes will be copied.
  8652. By default value 0xf, all planes will be processed.
  8653. @item scale
  8654. Set value which will be multiplied with filtered result.
  8655. @item delta
  8656. Set value which will be added to filtered result.
  8657. @end table
  8658. @section psnr
  8659. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8660. Ratio) between two input videos.
  8661. This filter takes in input two input videos, the first input is
  8662. considered the "main" source and is passed unchanged to the
  8663. output. The second input is used as a "reference" video for computing
  8664. the PSNR.
  8665. Both video inputs must have the same resolution and pixel format for
  8666. this filter to work correctly. Also it assumes that both inputs
  8667. have the same number of frames, which are compared one by one.
  8668. The obtained average PSNR is printed through the logging system.
  8669. The filter stores the accumulated MSE (mean squared error) of each
  8670. frame, and at the end of the processing it is averaged across all frames
  8671. equally, and the following formula is applied to obtain the PSNR:
  8672. @example
  8673. PSNR = 10*log10(MAX^2/MSE)
  8674. @end example
  8675. Where MAX is the average of the maximum values of each component of the
  8676. image.
  8677. The description of the accepted parameters follows.
  8678. @table @option
  8679. @item stats_file, f
  8680. If specified the filter will use the named file to save the PSNR of
  8681. each individual frame. When filename equals "-" the data is sent to
  8682. standard output.
  8683. @item stats_version
  8684. Specifies which version of the stats file format to use. Details of
  8685. each format are written below.
  8686. Default value is 1.
  8687. @item stats_add_max
  8688. Determines whether the max value is output to the stats log.
  8689. Default value is 0.
  8690. Requires stats_version >= 2. If this is set and stats_version < 2,
  8691. the filter will return an error.
  8692. @end table
  8693. The file printed if @var{stats_file} is selected, contains a sequence of
  8694. key/value pairs of the form @var{key}:@var{value} for each compared
  8695. couple of frames.
  8696. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8697. the list of per-frame-pair stats, with key value pairs following the frame
  8698. format with the following parameters:
  8699. @table @option
  8700. @item psnr_log_version
  8701. The version of the log file format. Will match @var{stats_version}.
  8702. @item fields
  8703. A comma separated list of the per-frame-pair parameters included in
  8704. the log.
  8705. @end table
  8706. A description of each shown per-frame-pair parameter follows:
  8707. @table @option
  8708. @item n
  8709. sequential number of the input frame, starting from 1
  8710. @item mse_avg
  8711. Mean Square Error pixel-by-pixel average difference of the compared
  8712. frames, averaged over all the image components.
  8713. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8714. Mean Square Error pixel-by-pixel average difference of the compared
  8715. frames for the component specified by the suffix.
  8716. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8717. Peak Signal to Noise ratio of the compared frames for the component
  8718. specified by the suffix.
  8719. @item max_avg, max_y, max_u, max_v
  8720. Maximum allowed value for each channel, and average over all
  8721. channels.
  8722. @end table
  8723. For example:
  8724. @example
  8725. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8726. [main][ref] psnr="stats_file=stats.log" [out]
  8727. @end example
  8728. On this example the input file being processed is compared with the
  8729. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8730. is stored in @file{stats.log}.
  8731. @anchor{pullup}
  8732. @section pullup
  8733. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8734. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8735. content.
  8736. The pullup filter is designed to take advantage of future context in making
  8737. its decisions. This filter is stateless in the sense that it does not lock
  8738. onto a pattern to follow, but it instead looks forward to the following
  8739. fields in order to identify matches and rebuild progressive frames.
  8740. To produce content with an even framerate, insert the fps filter after
  8741. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8742. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8743. The filter accepts the following options:
  8744. @table @option
  8745. @item jl
  8746. @item jr
  8747. @item jt
  8748. @item jb
  8749. These options set the amount of "junk" to ignore at the left, right, top, and
  8750. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8751. while top and bottom are in units of 2 lines.
  8752. The default is 8 pixels on each side.
  8753. @item sb
  8754. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8755. filter generating an occasional mismatched frame, but it may also cause an
  8756. excessive number of frames to be dropped during high motion sequences.
  8757. Conversely, setting it to -1 will make filter match fields more easily.
  8758. This may help processing of video where there is slight blurring between
  8759. the fields, but may also cause there to be interlaced frames in the output.
  8760. Default value is @code{0}.
  8761. @item mp
  8762. Set the metric plane to use. It accepts the following values:
  8763. @table @samp
  8764. @item l
  8765. Use luma plane.
  8766. @item u
  8767. Use chroma blue plane.
  8768. @item v
  8769. Use chroma red plane.
  8770. @end table
  8771. This option may be set to use chroma plane instead of the default luma plane
  8772. for doing filter's computations. This may improve accuracy on very clean
  8773. source material, but more likely will decrease accuracy, especially if there
  8774. is chroma noise (rainbow effect) or any grayscale video.
  8775. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8776. load and make pullup usable in realtime on slow machines.
  8777. @end table
  8778. For best results (without duplicated frames in the output file) it is
  8779. necessary to change the output frame rate. For example, to inverse
  8780. telecine NTSC input:
  8781. @example
  8782. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8783. @end example
  8784. @section qp
  8785. Change video quantization parameters (QP).
  8786. The filter accepts the following option:
  8787. @table @option
  8788. @item qp
  8789. Set expression for quantization parameter.
  8790. @end table
  8791. The expression is evaluated through the eval API and can contain, among others,
  8792. the following constants:
  8793. @table @var
  8794. @item known
  8795. 1 if index is not 129, 0 otherwise.
  8796. @item qp
  8797. Sequentional index starting from -129 to 128.
  8798. @end table
  8799. @subsection Examples
  8800. @itemize
  8801. @item
  8802. Some equation like:
  8803. @example
  8804. qp=2+2*sin(PI*qp)
  8805. @end example
  8806. @end itemize
  8807. @section random
  8808. Flush video frames from internal cache of frames into a random order.
  8809. No frame is discarded.
  8810. Inspired by @ref{frei0r} nervous filter.
  8811. @table @option
  8812. @item frames
  8813. Set size in number of frames of internal cache, in range from @code{2} to
  8814. @code{512}. Default is @code{30}.
  8815. @item seed
  8816. Set seed for random number generator, must be an integer included between
  8817. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8818. less than @code{0}, the filter will try to use a good random seed on a
  8819. best effort basis.
  8820. @end table
  8821. @section readeia608
  8822. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8823. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8824. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8825. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8826. @table @option
  8827. @item lavfi.readeia608.X.cc
  8828. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8829. @item lavfi.readeia608.X.line
  8830. The number of the line on which the EIA-608 data was identified and read.
  8831. @end table
  8832. This filter accepts the following options:
  8833. @table @option
  8834. @item scan_min
  8835. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8836. @item scan_max
  8837. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8838. @item mac
  8839. Set minimal acceptable amplitude change for sync codes detection.
  8840. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8841. @item spw
  8842. Set the ratio of width reserved for sync code detection.
  8843. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8844. @item mhd
  8845. Set the max peaks height difference for sync code detection.
  8846. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8847. @item mpd
  8848. Set max peaks period difference for sync code detection.
  8849. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8850. @item msd
  8851. Set the first two max start code bits differences.
  8852. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8853. @item bhd
  8854. Set the minimum ratio of bits height compared to 3rd start code bit.
  8855. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8856. @item th_w
  8857. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8858. @item th_b
  8859. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8860. @item chp
  8861. Enable checking the parity bit. In the event of a parity error, the filter will output
  8862. @code{0x00} for that character. Default is false.
  8863. @end table
  8864. @subsection Examples
  8865. @itemize
  8866. @item
  8867. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8868. @example
  8869. 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
  8870. @end example
  8871. @end itemize
  8872. @section readvitc
  8873. Read vertical interval timecode (VITC) information from the top lines of a
  8874. video frame.
  8875. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8876. timecode value, if a valid timecode has been detected. Further metadata key
  8877. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8878. timecode data has been found or not.
  8879. This filter accepts the following options:
  8880. @table @option
  8881. @item scan_max
  8882. Set the maximum number of lines to scan for VITC data. If the value is set to
  8883. @code{-1} the full video frame is scanned. Default is @code{45}.
  8884. @item thr_b
  8885. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8886. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8887. @item thr_w
  8888. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8889. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8890. @end table
  8891. @subsection Examples
  8892. @itemize
  8893. @item
  8894. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8895. draw @code{--:--:--:--} as a placeholder:
  8896. @example
  8897. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8898. @end example
  8899. @end itemize
  8900. @section remap
  8901. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8902. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8903. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8904. value for pixel will be used for destination pixel.
  8905. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8906. will have Xmap/Ymap video stream dimensions.
  8907. Xmap and Ymap input video streams are 16bit depth, single channel.
  8908. @section removegrain
  8909. The removegrain filter is a spatial denoiser for progressive video.
  8910. @table @option
  8911. @item m0
  8912. Set mode for the first plane.
  8913. @item m1
  8914. Set mode for the second plane.
  8915. @item m2
  8916. Set mode for the third plane.
  8917. @item m3
  8918. Set mode for the fourth plane.
  8919. @end table
  8920. Range of mode is from 0 to 24. Description of each mode follows:
  8921. @table @var
  8922. @item 0
  8923. Leave input plane unchanged. Default.
  8924. @item 1
  8925. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8926. @item 2
  8927. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8928. @item 3
  8929. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8930. @item 4
  8931. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8932. This is equivalent to a median filter.
  8933. @item 5
  8934. Line-sensitive clipping giving the minimal change.
  8935. @item 6
  8936. Line-sensitive clipping, intermediate.
  8937. @item 7
  8938. Line-sensitive clipping, intermediate.
  8939. @item 8
  8940. Line-sensitive clipping, intermediate.
  8941. @item 9
  8942. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8943. @item 10
  8944. Replaces the target pixel with the closest neighbour.
  8945. @item 11
  8946. [1 2 1] horizontal and vertical kernel blur.
  8947. @item 12
  8948. Same as mode 11.
  8949. @item 13
  8950. Bob mode, interpolates top field from the line where the neighbours
  8951. pixels are the closest.
  8952. @item 14
  8953. Bob mode, interpolates bottom field from the line where the neighbours
  8954. pixels are the closest.
  8955. @item 15
  8956. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8957. interpolation formula.
  8958. @item 16
  8959. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8960. interpolation formula.
  8961. @item 17
  8962. Clips the pixel with the minimum and maximum of respectively the maximum and
  8963. minimum of each pair of opposite neighbour pixels.
  8964. @item 18
  8965. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8966. the current pixel is minimal.
  8967. @item 19
  8968. Replaces the pixel with the average of its 8 neighbours.
  8969. @item 20
  8970. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8971. @item 21
  8972. Clips pixels using the averages of opposite neighbour.
  8973. @item 22
  8974. Same as mode 21 but simpler and faster.
  8975. @item 23
  8976. Small edge and halo removal, but reputed useless.
  8977. @item 24
  8978. Similar as 23.
  8979. @end table
  8980. @section removelogo
  8981. Suppress a TV station logo, using an image file to determine which
  8982. pixels comprise the logo. It works by filling in the pixels that
  8983. comprise the logo with neighboring pixels.
  8984. The filter accepts the following options:
  8985. @table @option
  8986. @item filename, f
  8987. Set the filter bitmap file, which can be any image format supported by
  8988. libavformat. The width and height of the image file must match those of the
  8989. video stream being processed.
  8990. @end table
  8991. Pixels in the provided bitmap image with a value of zero are not
  8992. considered part of the logo, non-zero pixels are considered part of
  8993. the logo. If you use white (255) for the logo and black (0) for the
  8994. rest, you will be safe. For making the filter bitmap, it is
  8995. recommended to take a screen capture of a black frame with the logo
  8996. visible, and then using a threshold filter followed by the erode
  8997. filter once or twice.
  8998. If needed, little splotches can be fixed manually. Remember that if
  8999. logo pixels are not covered, the filter quality will be much
  9000. reduced. Marking too many pixels as part of the logo does not hurt as
  9001. much, but it will increase the amount of blurring needed to cover over
  9002. the image and will destroy more information than necessary, and extra
  9003. pixels will slow things down on a large logo.
  9004. @section repeatfields
  9005. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9006. fields based on its value.
  9007. @section reverse
  9008. Reverse a video clip.
  9009. Warning: This filter requires memory to buffer the entire clip, so trimming
  9010. is suggested.
  9011. @subsection Examples
  9012. @itemize
  9013. @item
  9014. Take the first 5 seconds of a clip, and reverse it.
  9015. @example
  9016. trim=end=5,reverse
  9017. @end example
  9018. @end itemize
  9019. @section rotate
  9020. Rotate video by an arbitrary angle expressed in radians.
  9021. The filter accepts the following options:
  9022. A description of the optional parameters follows.
  9023. @table @option
  9024. @item angle, a
  9025. Set an expression for the angle by which to rotate the input video
  9026. clockwise, expressed as a number of radians. A negative value will
  9027. result in a counter-clockwise rotation. By default it is set to "0".
  9028. This expression is evaluated for each frame.
  9029. @item out_w, ow
  9030. Set the output width expression, default value is "iw".
  9031. This expression is evaluated just once during configuration.
  9032. @item out_h, oh
  9033. Set the output height expression, default value is "ih".
  9034. This expression is evaluated just once during configuration.
  9035. @item bilinear
  9036. Enable bilinear interpolation if set to 1, a value of 0 disables
  9037. it. Default value is 1.
  9038. @item fillcolor, c
  9039. Set the color used to fill the output area not covered by the rotated
  9040. image. For the general syntax of this option, check the "Color" section in the
  9041. ffmpeg-utils manual. If the special value "none" is selected then no
  9042. background is printed (useful for example if the background is never shown).
  9043. Default value is "black".
  9044. @end table
  9045. The expressions for the angle and the output size can contain the
  9046. following constants and functions:
  9047. @table @option
  9048. @item n
  9049. sequential number of the input frame, starting from 0. It is always NAN
  9050. before the first frame is filtered.
  9051. @item t
  9052. time in seconds of the input frame, it is set to 0 when the filter is
  9053. configured. It is always NAN before the first frame is filtered.
  9054. @item hsub
  9055. @item vsub
  9056. horizontal and vertical chroma subsample values. For example for the
  9057. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9058. @item in_w, iw
  9059. @item in_h, ih
  9060. the input video width and height
  9061. @item out_w, ow
  9062. @item out_h, oh
  9063. the output width and height, that is the size of the padded area as
  9064. specified by the @var{width} and @var{height} expressions
  9065. @item rotw(a)
  9066. @item roth(a)
  9067. the minimal width/height required for completely containing the input
  9068. video rotated by @var{a} radians.
  9069. These are only available when computing the @option{out_w} and
  9070. @option{out_h} expressions.
  9071. @end table
  9072. @subsection Examples
  9073. @itemize
  9074. @item
  9075. Rotate the input by PI/6 radians clockwise:
  9076. @example
  9077. rotate=PI/6
  9078. @end example
  9079. @item
  9080. Rotate the input by PI/6 radians counter-clockwise:
  9081. @example
  9082. rotate=-PI/6
  9083. @end example
  9084. @item
  9085. Rotate the input by 45 degrees clockwise:
  9086. @example
  9087. rotate=45*PI/180
  9088. @end example
  9089. @item
  9090. Apply a constant rotation with period T, starting from an angle of PI/3:
  9091. @example
  9092. rotate=PI/3+2*PI*t/T
  9093. @end example
  9094. @item
  9095. Make the input video rotation oscillating with a period of T
  9096. seconds and an amplitude of A radians:
  9097. @example
  9098. rotate=A*sin(2*PI/T*t)
  9099. @end example
  9100. @item
  9101. Rotate the video, output size is chosen so that the whole rotating
  9102. input video is always completely contained in the output:
  9103. @example
  9104. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9105. @end example
  9106. @item
  9107. Rotate the video, reduce the output size so that no background is ever
  9108. shown:
  9109. @example
  9110. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9111. @end example
  9112. @end itemize
  9113. @subsection Commands
  9114. The filter supports the following commands:
  9115. @table @option
  9116. @item a, angle
  9117. Set the angle expression.
  9118. The command accepts the same syntax of the corresponding option.
  9119. If the specified expression is not valid, it is kept at its current
  9120. value.
  9121. @end table
  9122. @section sab
  9123. Apply Shape Adaptive Blur.
  9124. The filter accepts the following options:
  9125. @table @option
  9126. @item luma_radius, lr
  9127. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9128. value is 1.0. A greater value will result in a more blurred image, and
  9129. in slower processing.
  9130. @item luma_pre_filter_radius, lpfr
  9131. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9132. value is 1.0.
  9133. @item luma_strength, ls
  9134. Set luma maximum difference between pixels to still be considered, must
  9135. be a value in the 0.1-100.0 range, default value is 1.0.
  9136. @item chroma_radius, cr
  9137. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9138. greater value will result in a more blurred image, and in slower
  9139. processing.
  9140. @item chroma_pre_filter_radius, cpfr
  9141. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9142. @item chroma_strength, cs
  9143. Set chroma maximum difference between pixels to still be considered,
  9144. must be a value in the -0.9-100.0 range.
  9145. @end table
  9146. Each chroma option value, if not explicitly specified, is set to the
  9147. corresponding luma option value.
  9148. @anchor{scale}
  9149. @section scale
  9150. Scale (resize) the input video, using the libswscale library.
  9151. The scale filter forces the output display aspect ratio to be the same
  9152. of the input, by changing the output sample aspect ratio.
  9153. If the input image format is different from the format requested by
  9154. the next filter, the scale filter will convert the input to the
  9155. requested format.
  9156. @subsection Options
  9157. The filter accepts the following options, or any of the options
  9158. supported by the libswscale scaler.
  9159. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9160. the complete list of scaler options.
  9161. @table @option
  9162. @item width, w
  9163. @item height, h
  9164. Set the output video dimension expression. Default value is the input
  9165. dimension.
  9166. If the value is 0, the input width is used for the output.
  9167. If one of the values is -1, the scale filter will use a value that
  9168. maintains the aspect ratio of the input image, calculated from the
  9169. other specified dimension. If both of them are -1, the input size is
  9170. used
  9171. If one of the values is -n with n > 1, the scale filter will also use a value
  9172. that maintains the aspect ratio of the input image, calculated from the other
  9173. specified dimension. After that it will, however, make sure that the calculated
  9174. dimension is divisible by n and adjust the value if necessary.
  9175. See below for the list of accepted constants for use in the dimension
  9176. expression.
  9177. @item eval
  9178. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9179. @table @samp
  9180. @item init
  9181. Only evaluate expressions once during the filter initialization or when a command is processed.
  9182. @item frame
  9183. Evaluate expressions for each incoming frame.
  9184. @end table
  9185. Default value is @samp{init}.
  9186. @item interl
  9187. Set the interlacing mode. It accepts the following values:
  9188. @table @samp
  9189. @item 1
  9190. Force interlaced aware scaling.
  9191. @item 0
  9192. Do not apply interlaced scaling.
  9193. @item -1
  9194. Select interlaced aware scaling depending on whether the source frames
  9195. are flagged as interlaced or not.
  9196. @end table
  9197. Default value is @samp{0}.
  9198. @item flags
  9199. Set libswscale scaling flags. See
  9200. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9201. complete list of values. If not explicitly specified the filter applies
  9202. the default flags.
  9203. @item param0, param1
  9204. Set libswscale input parameters for scaling algorithms that need them. See
  9205. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9206. complete documentation. If not explicitly specified the filter applies
  9207. empty parameters.
  9208. @item size, s
  9209. Set the video size. For the syntax of this option, check the
  9210. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9211. @item in_color_matrix
  9212. @item out_color_matrix
  9213. Set in/output YCbCr color space type.
  9214. This allows the autodetected value to be overridden as well as allows forcing
  9215. a specific value used for the output and encoder.
  9216. If not specified, the color space type depends on the pixel format.
  9217. Possible values:
  9218. @table @samp
  9219. @item auto
  9220. Choose automatically.
  9221. @item bt709
  9222. Format conforming to International Telecommunication Union (ITU)
  9223. Recommendation BT.709.
  9224. @item fcc
  9225. Set color space conforming to the United States Federal Communications
  9226. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9227. @item bt601
  9228. Set color space conforming to:
  9229. @itemize
  9230. @item
  9231. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9232. @item
  9233. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9234. @item
  9235. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9236. @end itemize
  9237. @item smpte240m
  9238. Set color space conforming to SMPTE ST 240:1999.
  9239. @end table
  9240. @item in_range
  9241. @item out_range
  9242. Set in/output YCbCr sample range.
  9243. This allows the autodetected value to be overridden as well as allows forcing
  9244. a specific value used for the output and encoder. If not specified, the
  9245. range depends on the pixel format. Possible values:
  9246. @table @samp
  9247. @item auto
  9248. Choose automatically.
  9249. @item jpeg/full/pc
  9250. Set full range (0-255 in case of 8-bit luma).
  9251. @item mpeg/tv
  9252. Set "MPEG" range (16-235 in case of 8-bit luma).
  9253. @end table
  9254. @item force_original_aspect_ratio
  9255. Enable decreasing or increasing output video width or height if necessary to
  9256. keep the original aspect ratio. Possible values:
  9257. @table @samp
  9258. @item disable
  9259. Scale the video as specified and disable this feature.
  9260. @item decrease
  9261. The output video dimensions will automatically be decreased if needed.
  9262. @item increase
  9263. The output video dimensions will automatically be increased if needed.
  9264. @end table
  9265. One useful instance of this option is that when you know a specific device's
  9266. maximum allowed resolution, you can use this to limit the output video to
  9267. that, while retaining the aspect ratio. For example, device A allows
  9268. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9269. decrease) and specifying 1280x720 to the command line makes the output
  9270. 1280x533.
  9271. Please note that this is a different thing than specifying -1 for @option{w}
  9272. or @option{h}, you still need to specify the output resolution for this option
  9273. to work.
  9274. @end table
  9275. The values of the @option{w} and @option{h} options are expressions
  9276. containing the following constants:
  9277. @table @var
  9278. @item in_w
  9279. @item in_h
  9280. The input width and height
  9281. @item iw
  9282. @item ih
  9283. These are the same as @var{in_w} and @var{in_h}.
  9284. @item out_w
  9285. @item out_h
  9286. The output (scaled) width and height
  9287. @item ow
  9288. @item oh
  9289. These are the same as @var{out_w} and @var{out_h}
  9290. @item a
  9291. The same as @var{iw} / @var{ih}
  9292. @item sar
  9293. input sample aspect ratio
  9294. @item dar
  9295. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9296. @item hsub
  9297. @item vsub
  9298. horizontal and vertical input chroma subsample values. For example for the
  9299. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9300. @item ohsub
  9301. @item ovsub
  9302. horizontal and vertical output chroma subsample values. For example for the
  9303. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9304. @end table
  9305. @subsection Examples
  9306. @itemize
  9307. @item
  9308. Scale the input video to a size of 200x100
  9309. @example
  9310. scale=w=200:h=100
  9311. @end example
  9312. This is equivalent to:
  9313. @example
  9314. scale=200:100
  9315. @end example
  9316. or:
  9317. @example
  9318. scale=200x100
  9319. @end example
  9320. @item
  9321. Specify a size abbreviation for the output size:
  9322. @example
  9323. scale=qcif
  9324. @end example
  9325. which can also be written as:
  9326. @example
  9327. scale=size=qcif
  9328. @end example
  9329. @item
  9330. Scale the input to 2x:
  9331. @example
  9332. scale=w=2*iw:h=2*ih
  9333. @end example
  9334. @item
  9335. The above is the same as:
  9336. @example
  9337. scale=2*in_w:2*in_h
  9338. @end example
  9339. @item
  9340. Scale the input to 2x with forced interlaced scaling:
  9341. @example
  9342. scale=2*iw:2*ih:interl=1
  9343. @end example
  9344. @item
  9345. Scale the input to half size:
  9346. @example
  9347. scale=w=iw/2:h=ih/2
  9348. @end example
  9349. @item
  9350. Increase the width, and set the height to the same size:
  9351. @example
  9352. scale=3/2*iw:ow
  9353. @end example
  9354. @item
  9355. Seek Greek harmony:
  9356. @example
  9357. scale=iw:1/PHI*iw
  9358. scale=ih*PHI:ih
  9359. @end example
  9360. @item
  9361. Increase the height, and set the width to 3/2 of the height:
  9362. @example
  9363. scale=w=3/2*oh:h=3/5*ih
  9364. @end example
  9365. @item
  9366. Increase the size, making the size a multiple of the chroma
  9367. subsample values:
  9368. @example
  9369. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9370. @end example
  9371. @item
  9372. Increase the width to a maximum of 500 pixels,
  9373. keeping the same aspect ratio as the input:
  9374. @example
  9375. scale=w='min(500\, iw*3/2):h=-1'
  9376. @end example
  9377. @end itemize
  9378. @subsection Commands
  9379. This filter supports the following commands:
  9380. @table @option
  9381. @item width, w
  9382. @item height, h
  9383. Set the output video dimension expression.
  9384. The command accepts the same syntax of the corresponding option.
  9385. If the specified expression is not valid, it is kept at its current
  9386. value.
  9387. @end table
  9388. @section scale_npp
  9389. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9390. format conversion on CUDA video frames. Setting the output width and height
  9391. works in the same way as for the @var{scale} filter.
  9392. The following additional options are accepted:
  9393. @table @option
  9394. @item format
  9395. The pixel format of the output CUDA frames. If set to the string "same" (the
  9396. default), the input format will be kept. Note that automatic format negotiation
  9397. and conversion is not yet supported for hardware frames
  9398. @item interp_algo
  9399. The interpolation algorithm used for resizing. One of the following:
  9400. @table @option
  9401. @item nn
  9402. Nearest neighbour.
  9403. @item linear
  9404. @item cubic
  9405. @item cubic2p_bspline
  9406. 2-parameter cubic (B=1, C=0)
  9407. @item cubic2p_catmullrom
  9408. 2-parameter cubic (B=0, C=1/2)
  9409. @item cubic2p_b05c03
  9410. 2-parameter cubic (B=1/2, C=3/10)
  9411. @item super
  9412. Supersampling
  9413. @item lanczos
  9414. @end table
  9415. @end table
  9416. @section scale2ref
  9417. Scale (resize) the input video, based on a reference video.
  9418. See the scale filter for available options, scale2ref supports the same but
  9419. uses the reference video instead of the main input as basis.
  9420. @subsection Examples
  9421. @itemize
  9422. @item
  9423. Scale a subtitle stream to match the main video in size before overlaying
  9424. @example
  9425. 'scale2ref[b][a];[a][b]overlay'
  9426. @end example
  9427. @end itemize
  9428. @anchor{selectivecolor}
  9429. @section selectivecolor
  9430. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9431. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9432. by the "purity" of the color (that is, how saturated it already is).
  9433. This filter is similar to the Adobe Photoshop Selective Color tool.
  9434. The filter accepts the following options:
  9435. @table @option
  9436. @item correction_method
  9437. Select color correction method.
  9438. Available values are:
  9439. @table @samp
  9440. @item absolute
  9441. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9442. component value).
  9443. @item relative
  9444. Specified adjustments are relative to the original component value.
  9445. @end table
  9446. Default is @code{absolute}.
  9447. @item reds
  9448. Adjustments for red pixels (pixels where the red component is the maximum)
  9449. @item yellows
  9450. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9451. @item greens
  9452. Adjustments for green pixels (pixels where the green component is the maximum)
  9453. @item cyans
  9454. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9455. @item blues
  9456. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9457. @item magentas
  9458. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9459. @item whites
  9460. Adjustments for white pixels (pixels where all components are greater than 128)
  9461. @item neutrals
  9462. Adjustments for all pixels except pure black and pure white
  9463. @item blacks
  9464. Adjustments for black pixels (pixels where all components are lesser than 128)
  9465. @item psfile
  9466. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9467. @end table
  9468. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9469. 4 space separated floating point adjustment values in the [-1,1] range,
  9470. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9471. pixels of its range.
  9472. @subsection Examples
  9473. @itemize
  9474. @item
  9475. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9476. increase magenta by 27% in blue areas:
  9477. @example
  9478. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9479. @end example
  9480. @item
  9481. Use a Photoshop selective color preset:
  9482. @example
  9483. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9484. @end example
  9485. @end itemize
  9486. @anchor{separatefields}
  9487. @section separatefields
  9488. The @code{separatefields} takes a frame-based video input and splits
  9489. each frame into its components fields, producing a new half height clip
  9490. with twice the frame rate and twice the frame count.
  9491. This filter use field-dominance information in frame to decide which
  9492. of each pair of fields to place first in the output.
  9493. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9494. @section setdar, setsar
  9495. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9496. output video.
  9497. This is done by changing the specified Sample (aka Pixel) Aspect
  9498. Ratio, according to the following equation:
  9499. @example
  9500. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9501. @end example
  9502. Keep in mind that the @code{setdar} filter does not modify the pixel
  9503. dimensions of the video frame. Also, the display aspect ratio set by
  9504. this filter may be changed by later filters in the filterchain,
  9505. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9506. applied.
  9507. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9508. the filter output video.
  9509. Note that as a consequence of the application of this filter, the
  9510. output display aspect ratio will change according to the equation
  9511. above.
  9512. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9513. filter may be changed by later filters in the filterchain, e.g. if
  9514. another "setsar" or a "setdar" filter is applied.
  9515. It accepts the following parameters:
  9516. @table @option
  9517. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9518. Set the aspect ratio used by the filter.
  9519. The parameter can be a floating point number string, an expression, or
  9520. a string of the form @var{num}:@var{den}, where @var{num} and
  9521. @var{den} are the numerator and denominator of the aspect ratio. If
  9522. the parameter is not specified, it is assumed the value "0".
  9523. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9524. should be escaped.
  9525. @item max
  9526. Set the maximum integer value to use for expressing numerator and
  9527. denominator when reducing the expressed aspect ratio to a rational.
  9528. Default value is @code{100}.
  9529. @end table
  9530. The parameter @var{sar} is an expression containing
  9531. the following constants:
  9532. @table @option
  9533. @item E, PI, PHI
  9534. These are approximated values for the mathematical constants e
  9535. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9536. @item w, h
  9537. The input width and height.
  9538. @item a
  9539. These are the same as @var{w} / @var{h}.
  9540. @item sar
  9541. The input sample aspect ratio.
  9542. @item dar
  9543. The input display aspect ratio. It is the same as
  9544. (@var{w} / @var{h}) * @var{sar}.
  9545. @item hsub, vsub
  9546. Horizontal and vertical chroma subsample values. For example, for the
  9547. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9548. @end table
  9549. @subsection Examples
  9550. @itemize
  9551. @item
  9552. To change the display aspect ratio to 16:9, specify one of the following:
  9553. @example
  9554. setdar=dar=1.77777
  9555. setdar=dar=16/9
  9556. @end example
  9557. @item
  9558. To change the sample aspect ratio to 10:11, specify:
  9559. @example
  9560. setsar=sar=10/11
  9561. @end example
  9562. @item
  9563. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9564. 1000 in the aspect ratio reduction, use the command:
  9565. @example
  9566. setdar=ratio=16/9:max=1000
  9567. @end example
  9568. @end itemize
  9569. @anchor{setfield}
  9570. @section setfield
  9571. Force field for the output video frame.
  9572. The @code{setfield} filter marks the interlace type field for the
  9573. output frames. It does not change the input frame, but only sets the
  9574. corresponding property, which affects how the frame is treated by
  9575. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9576. The filter accepts the following options:
  9577. @table @option
  9578. @item mode
  9579. Available values are:
  9580. @table @samp
  9581. @item auto
  9582. Keep the same field property.
  9583. @item bff
  9584. Mark the frame as bottom-field-first.
  9585. @item tff
  9586. Mark the frame as top-field-first.
  9587. @item prog
  9588. Mark the frame as progressive.
  9589. @end table
  9590. @end table
  9591. @section showinfo
  9592. Show a line containing various information for each input video frame.
  9593. The input video is not modified.
  9594. The shown line contains a sequence of key/value pairs of the form
  9595. @var{key}:@var{value}.
  9596. The following values are shown in the output:
  9597. @table @option
  9598. @item n
  9599. The (sequential) number of the input frame, starting from 0.
  9600. @item pts
  9601. The Presentation TimeStamp of the input frame, expressed as a number of
  9602. time base units. The time base unit depends on the filter input pad.
  9603. @item pts_time
  9604. The Presentation TimeStamp of the input frame, expressed as a number of
  9605. seconds.
  9606. @item pos
  9607. The position of the frame in the input stream, or -1 if this information is
  9608. unavailable and/or meaningless (for example in case of synthetic video).
  9609. @item fmt
  9610. The pixel format name.
  9611. @item sar
  9612. The sample aspect ratio of the input frame, expressed in the form
  9613. @var{num}/@var{den}.
  9614. @item s
  9615. The size of the input frame. For the syntax of this option, check the
  9616. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9617. @item i
  9618. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9619. for bottom field first).
  9620. @item iskey
  9621. This is 1 if the frame is a key frame, 0 otherwise.
  9622. @item type
  9623. The picture type of the input frame ("I" for an I-frame, "P" for a
  9624. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9625. Also refer to the documentation of the @code{AVPictureType} enum and of
  9626. the @code{av_get_picture_type_char} function defined in
  9627. @file{libavutil/avutil.h}.
  9628. @item checksum
  9629. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9630. @item plane_checksum
  9631. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9632. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9633. @end table
  9634. @section showpalette
  9635. Displays the 256 colors palette of each frame. This filter is only relevant for
  9636. @var{pal8} pixel format frames.
  9637. It accepts the following option:
  9638. @table @option
  9639. @item s
  9640. Set the size of the box used to represent one palette color entry. Default is
  9641. @code{30} (for a @code{30x30} pixel box).
  9642. @end table
  9643. @section shuffleframes
  9644. Reorder and/or duplicate and/or drop video frames.
  9645. It accepts the following parameters:
  9646. @table @option
  9647. @item mapping
  9648. Set the destination indexes of input frames.
  9649. This is space or '|' separated list of indexes that maps input frames to output
  9650. frames. Number of indexes also sets maximal value that each index may have.
  9651. '-1' index have special meaning and that is to drop frame.
  9652. @end table
  9653. The first frame has the index 0. The default is to keep the input unchanged.
  9654. @subsection Examples
  9655. @itemize
  9656. @item
  9657. Swap second and third frame of every three frames of the input:
  9658. @example
  9659. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9660. @end example
  9661. @item
  9662. Swap 10th and 1st frame of every ten frames of the input:
  9663. @example
  9664. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9665. @end example
  9666. @end itemize
  9667. @section shuffleplanes
  9668. Reorder and/or duplicate video planes.
  9669. It accepts the following parameters:
  9670. @table @option
  9671. @item map0
  9672. The index of the input plane to be used as the first output plane.
  9673. @item map1
  9674. The index of the input plane to be used as the second output plane.
  9675. @item map2
  9676. The index of the input plane to be used as the third output plane.
  9677. @item map3
  9678. The index of the input plane to be used as the fourth output plane.
  9679. @end table
  9680. The first plane has the index 0. The default is to keep the input unchanged.
  9681. @subsection Examples
  9682. @itemize
  9683. @item
  9684. Swap the second and third planes of the input:
  9685. @example
  9686. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9687. @end example
  9688. @end itemize
  9689. @anchor{signalstats}
  9690. @section signalstats
  9691. Evaluate various visual metrics that assist in determining issues associated
  9692. with the digitization of analog video media.
  9693. By default the filter will log these metadata values:
  9694. @table @option
  9695. @item YMIN
  9696. Display the minimal Y value contained within the input frame. Expressed in
  9697. range of [0-255].
  9698. @item YLOW
  9699. Display the Y value at the 10% percentile within the input frame. Expressed in
  9700. range of [0-255].
  9701. @item YAVG
  9702. Display the average Y value within the input frame. Expressed in range of
  9703. [0-255].
  9704. @item YHIGH
  9705. Display the Y value at the 90% percentile within the input frame. Expressed in
  9706. range of [0-255].
  9707. @item YMAX
  9708. Display the maximum Y value contained within the input frame. Expressed in
  9709. range of [0-255].
  9710. @item UMIN
  9711. Display the minimal U value contained within the input frame. Expressed in
  9712. range of [0-255].
  9713. @item ULOW
  9714. Display the U value at the 10% percentile within the input frame. Expressed in
  9715. range of [0-255].
  9716. @item UAVG
  9717. Display the average U value within the input frame. Expressed in range of
  9718. [0-255].
  9719. @item UHIGH
  9720. Display the U value at the 90% percentile within the input frame. Expressed in
  9721. range of [0-255].
  9722. @item UMAX
  9723. Display the maximum U value contained within the input frame. Expressed in
  9724. range of [0-255].
  9725. @item VMIN
  9726. Display the minimal V value contained within the input frame. Expressed in
  9727. range of [0-255].
  9728. @item VLOW
  9729. Display the V value at the 10% percentile within the input frame. Expressed in
  9730. range of [0-255].
  9731. @item VAVG
  9732. Display the average V value within the input frame. Expressed in range of
  9733. [0-255].
  9734. @item VHIGH
  9735. Display the V value at the 90% percentile within the input frame. Expressed in
  9736. range of [0-255].
  9737. @item VMAX
  9738. Display the maximum V value contained within the input frame. Expressed in
  9739. range of [0-255].
  9740. @item SATMIN
  9741. Display the minimal saturation value contained within the input frame.
  9742. Expressed in range of [0-~181.02].
  9743. @item SATLOW
  9744. Display the saturation value at the 10% percentile within the input frame.
  9745. Expressed in range of [0-~181.02].
  9746. @item SATAVG
  9747. Display the average saturation value within the input frame. Expressed in range
  9748. of [0-~181.02].
  9749. @item SATHIGH
  9750. Display the saturation value at the 90% percentile within the input frame.
  9751. Expressed in range of [0-~181.02].
  9752. @item SATMAX
  9753. Display the maximum saturation value contained within the input frame.
  9754. Expressed in range of [0-~181.02].
  9755. @item HUEMED
  9756. Display the median value for hue within the input frame. Expressed in range of
  9757. [0-360].
  9758. @item HUEAVG
  9759. Display the average value for hue within the input frame. Expressed in range of
  9760. [0-360].
  9761. @item YDIF
  9762. Display the average of sample value difference between all values of the Y
  9763. plane in the current frame and corresponding values of the previous input frame.
  9764. Expressed in range of [0-255].
  9765. @item UDIF
  9766. Display the average of sample value difference between all values of the U
  9767. plane in the current frame and corresponding values of the previous input frame.
  9768. Expressed in range of [0-255].
  9769. @item VDIF
  9770. Display the average of sample value difference between all values of the V
  9771. plane in the current frame and corresponding values of the previous input frame.
  9772. Expressed in range of [0-255].
  9773. @item YBITDEPTH
  9774. Display bit depth of Y plane in current frame.
  9775. Expressed in range of [0-16].
  9776. @item UBITDEPTH
  9777. Display bit depth of U plane in current frame.
  9778. Expressed in range of [0-16].
  9779. @item VBITDEPTH
  9780. Display bit depth of V plane in current frame.
  9781. Expressed in range of [0-16].
  9782. @end table
  9783. The filter accepts the following options:
  9784. @table @option
  9785. @item stat
  9786. @item out
  9787. @option{stat} specify an additional form of image analysis.
  9788. @option{out} output video with the specified type of pixel highlighted.
  9789. Both options accept the following values:
  9790. @table @samp
  9791. @item tout
  9792. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9793. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9794. include the results of video dropouts, head clogs, or tape tracking issues.
  9795. @item vrep
  9796. Identify @var{vertical line repetition}. Vertical line repetition includes
  9797. similar rows of pixels within a frame. In born-digital video vertical line
  9798. repetition is common, but this pattern is uncommon in video digitized from an
  9799. analog source. When it occurs in video that results from the digitization of an
  9800. analog source it can indicate concealment from a dropout compensator.
  9801. @item brng
  9802. Identify pixels that fall outside of legal broadcast range.
  9803. @end table
  9804. @item color, c
  9805. Set the highlight color for the @option{out} option. The default color is
  9806. yellow.
  9807. @end table
  9808. @subsection Examples
  9809. @itemize
  9810. @item
  9811. Output data of various video metrics:
  9812. @example
  9813. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9814. @end example
  9815. @item
  9816. Output specific data about the minimum and maximum values of the Y plane per frame:
  9817. @example
  9818. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9819. @end example
  9820. @item
  9821. Playback video while highlighting pixels that are outside of broadcast range in red.
  9822. @example
  9823. ffplay example.mov -vf signalstats="out=brng:color=red"
  9824. @end example
  9825. @item
  9826. Playback video with signalstats metadata drawn over the frame.
  9827. @example
  9828. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9829. @end example
  9830. The contents of signalstat_drawtext.txt used in the command are:
  9831. @example
  9832. time %@{pts:hms@}
  9833. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9834. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9835. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9836. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9837. @end example
  9838. @end itemize
  9839. @anchor{signature}
  9840. @section signature
  9841. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  9842. input. In this case the matching between the inputs can be calculated additionally.
  9843. The filter always passes through the first input. The signature of each stream can
  9844. be written into a file.
  9845. It accepts the following options:
  9846. @table @option
  9847. @item detectmode
  9848. Enable or disable the matching process.
  9849. Available values are:
  9850. @table @samp
  9851. @item off
  9852. Disable the calculation of a matching (default).
  9853. @item full
  9854. Calculate the matching for the whole video and output whether the whole video
  9855. matches or only parts.
  9856. @item fast
  9857. Calculate only until a matching is found or the video ends. Should be faster in
  9858. some cases.
  9859. @end table
  9860. @item nb_inputs
  9861. Set the number of inputs. The option value must be a non negative integer.
  9862. Default value is 1.
  9863. @item filename
  9864. Set the path to which the output is written. If there is more than one input,
  9865. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  9866. integer), that will be replaced with the input number. If no filename is
  9867. specified, no output will be written. This is the default.
  9868. @item format
  9869. Choose the output format.
  9870. Available values are:
  9871. @table @samp
  9872. @item binary
  9873. Use the specified binary representation (default).
  9874. @item xml
  9875. Use the specified xml representation.
  9876. @end table
  9877. @item th_d
  9878. Set threshold to detect one word as similar. The option value must be an integer
  9879. greater than zero. The default value is 9000.
  9880. @item th_dc
  9881. Set threshold to detect all words as similar. The option value must be an integer
  9882. greater than zero. The default value is 60000.
  9883. @item th_xh
  9884. Set threshold to detect frames as similar. The option value must be an integer
  9885. greater than zero. The default value is 116.
  9886. @item th_di
  9887. Set the minimum length of a sequence in frames to recognize it as matching
  9888. sequence. The option value must be a non negative integer value.
  9889. The default value is 0.
  9890. @item th_it
  9891. Set the minimum relation, that matching frames to all frames must have.
  9892. The option value must be a double value between 0 and 1. The default value is 0.5.
  9893. @end table
  9894. @subsection Examples
  9895. @itemize
  9896. @item
  9897. To calculate the signature of an input video and store it in signature.bin:
  9898. @example
  9899. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  9900. @end example
  9901. @item
  9902. To detect whether two videos match and store the signatures in XML format in
  9903. signature0.xml and signature1.xml:
  9904. @example
  9905. 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 -
  9906. @end example
  9907. @end itemize
  9908. @anchor{smartblur}
  9909. @section smartblur
  9910. Blur the input video without impacting the outlines.
  9911. It accepts the following options:
  9912. @table @option
  9913. @item luma_radius, lr
  9914. Set the luma radius. The option value must be a float number in
  9915. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9916. used to blur the image (slower if larger). Default value is 1.0.
  9917. @item luma_strength, ls
  9918. Set the luma strength. The option value must be a float number
  9919. in the range [-1.0,1.0] that configures the blurring. A value included
  9920. in [0.0,1.0] will blur the image whereas a value included in
  9921. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9922. @item luma_threshold, lt
  9923. Set the luma threshold used as a coefficient to determine
  9924. whether a pixel should be blurred or not. The option value must be an
  9925. integer in the range [-30,30]. A value of 0 will filter all the image,
  9926. a value included in [0,30] will filter flat areas and a value included
  9927. in [-30,0] will filter edges. Default value is 0.
  9928. @item chroma_radius, cr
  9929. Set the chroma radius. The option value must be a float number in
  9930. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9931. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  9932. @item chroma_strength, cs
  9933. Set the chroma strength. The option value must be a float number
  9934. in the range [-1.0,1.0] that configures the blurring. A value included
  9935. in [0.0,1.0] will blur the image whereas a value included in
  9936. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  9937. @item chroma_threshold, ct
  9938. Set the chroma threshold used as a coefficient to determine
  9939. whether a pixel should be blurred or not. The option value must be an
  9940. integer in the range [-30,30]. A value of 0 will filter all the image,
  9941. a value included in [0,30] will filter flat areas and a value included
  9942. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  9943. @end table
  9944. If a chroma option is not explicitly set, the corresponding luma value
  9945. is set.
  9946. @section ssim
  9947. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9948. This filter takes in input two input videos, the first input is
  9949. considered the "main" source and is passed unchanged to the
  9950. output. The second input is used as a "reference" video for computing
  9951. the SSIM.
  9952. Both video inputs must have the same resolution and pixel format for
  9953. this filter to work correctly. Also it assumes that both inputs
  9954. have the same number of frames, which are compared one by one.
  9955. The filter stores the calculated SSIM of each frame.
  9956. The description of the accepted parameters follows.
  9957. @table @option
  9958. @item stats_file, f
  9959. If specified the filter will use the named file to save the SSIM of
  9960. each individual frame. When filename equals "-" the data is sent to
  9961. standard output.
  9962. @end table
  9963. The file printed if @var{stats_file} is selected, contains a sequence of
  9964. key/value pairs of the form @var{key}:@var{value} for each compared
  9965. couple of frames.
  9966. A description of each shown parameter follows:
  9967. @table @option
  9968. @item n
  9969. sequential number of the input frame, starting from 1
  9970. @item Y, U, V, R, G, B
  9971. SSIM of the compared frames for the component specified by the suffix.
  9972. @item All
  9973. SSIM of the compared frames for the whole frame.
  9974. @item dB
  9975. Same as above but in dB representation.
  9976. @end table
  9977. For example:
  9978. @example
  9979. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9980. [main][ref] ssim="stats_file=stats.log" [out]
  9981. @end example
  9982. On this example the input file being processed is compared with the
  9983. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9984. is stored in @file{stats.log}.
  9985. Another example with both psnr and ssim at same time:
  9986. @example
  9987. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9988. @end example
  9989. @section stereo3d
  9990. Convert between different stereoscopic image formats.
  9991. The filters accept the following options:
  9992. @table @option
  9993. @item in
  9994. Set stereoscopic image format of input.
  9995. Available values for input image formats are:
  9996. @table @samp
  9997. @item sbsl
  9998. side by side parallel (left eye left, right eye right)
  9999. @item sbsr
  10000. side by side crosseye (right eye left, left eye right)
  10001. @item sbs2l
  10002. side by side parallel with half width resolution
  10003. (left eye left, right eye right)
  10004. @item sbs2r
  10005. side by side crosseye with half width resolution
  10006. (right eye left, left eye right)
  10007. @item abl
  10008. above-below (left eye above, right eye below)
  10009. @item abr
  10010. above-below (right eye above, left eye below)
  10011. @item ab2l
  10012. above-below with half height resolution
  10013. (left eye above, right eye below)
  10014. @item ab2r
  10015. above-below with half height resolution
  10016. (right eye above, left eye below)
  10017. @item al
  10018. alternating frames (left eye first, right eye second)
  10019. @item ar
  10020. alternating frames (right eye first, left eye second)
  10021. @item irl
  10022. interleaved rows (left eye has top row, right eye starts on next row)
  10023. @item irr
  10024. interleaved rows (right eye has top row, left eye starts on next row)
  10025. @item icl
  10026. interleaved columns, left eye first
  10027. @item icr
  10028. interleaved columns, right eye first
  10029. Default value is @samp{sbsl}.
  10030. @end table
  10031. @item out
  10032. Set stereoscopic image format of output.
  10033. @table @samp
  10034. @item sbsl
  10035. side by side parallel (left eye left, right eye right)
  10036. @item sbsr
  10037. side by side crosseye (right eye left, left eye right)
  10038. @item sbs2l
  10039. side by side parallel with half width resolution
  10040. (left eye left, right eye right)
  10041. @item sbs2r
  10042. side by side crosseye with half width resolution
  10043. (right eye left, left eye right)
  10044. @item abl
  10045. above-below (left eye above, right eye below)
  10046. @item abr
  10047. above-below (right eye above, left eye below)
  10048. @item ab2l
  10049. above-below with half height resolution
  10050. (left eye above, right eye below)
  10051. @item ab2r
  10052. above-below with half height resolution
  10053. (right eye above, left eye below)
  10054. @item al
  10055. alternating frames (left eye first, right eye second)
  10056. @item ar
  10057. alternating frames (right eye first, left eye second)
  10058. @item irl
  10059. interleaved rows (left eye has top row, right eye starts on next row)
  10060. @item irr
  10061. interleaved rows (right eye has top row, left eye starts on next row)
  10062. @item arbg
  10063. anaglyph red/blue gray
  10064. (red filter on left eye, blue filter on right eye)
  10065. @item argg
  10066. anaglyph red/green gray
  10067. (red filter on left eye, green filter on right eye)
  10068. @item arcg
  10069. anaglyph red/cyan gray
  10070. (red filter on left eye, cyan filter on right eye)
  10071. @item arch
  10072. anaglyph red/cyan half colored
  10073. (red filter on left eye, cyan filter on right eye)
  10074. @item arcc
  10075. anaglyph red/cyan color
  10076. (red filter on left eye, cyan filter on right eye)
  10077. @item arcd
  10078. anaglyph red/cyan color optimized with the least squares projection of dubois
  10079. (red filter on left eye, cyan filter on right eye)
  10080. @item agmg
  10081. anaglyph green/magenta gray
  10082. (green filter on left eye, magenta filter on right eye)
  10083. @item agmh
  10084. anaglyph green/magenta half colored
  10085. (green filter on left eye, magenta filter on right eye)
  10086. @item agmc
  10087. anaglyph green/magenta colored
  10088. (green filter on left eye, magenta filter on right eye)
  10089. @item agmd
  10090. anaglyph green/magenta color optimized with the least squares projection of dubois
  10091. (green filter on left eye, magenta filter on right eye)
  10092. @item aybg
  10093. anaglyph yellow/blue gray
  10094. (yellow filter on left eye, blue filter on right eye)
  10095. @item aybh
  10096. anaglyph yellow/blue half colored
  10097. (yellow filter on left eye, blue filter on right eye)
  10098. @item aybc
  10099. anaglyph yellow/blue colored
  10100. (yellow filter on left eye, blue filter on right eye)
  10101. @item aybd
  10102. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10103. (yellow filter on left eye, blue filter on right eye)
  10104. @item ml
  10105. mono output (left eye only)
  10106. @item mr
  10107. mono output (right eye only)
  10108. @item chl
  10109. checkerboard, left eye first
  10110. @item chr
  10111. checkerboard, right eye first
  10112. @item icl
  10113. interleaved columns, left eye first
  10114. @item icr
  10115. interleaved columns, right eye first
  10116. @item hdmi
  10117. HDMI frame pack
  10118. @end table
  10119. Default value is @samp{arcd}.
  10120. @end table
  10121. @subsection Examples
  10122. @itemize
  10123. @item
  10124. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10125. @example
  10126. stereo3d=sbsl:aybd
  10127. @end example
  10128. @item
  10129. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10130. @example
  10131. stereo3d=abl:sbsr
  10132. @end example
  10133. @end itemize
  10134. @section streamselect, astreamselect
  10135. Select video or audio streams.
  10136. The filter accepts the following options:
  10137. @table @option
  10138. @item inputs
  10139. Set number of inputs. Default is 2.
  10140. @item map
  10141. Set input indexes to remap to outputs.
  10142. @end table
  10143. @subsection Commands
  10144. The @code{streamselect} and @code{astreamselect} filter supports the following
  10145. commands:
  10146. @table @option
  10147. @item map
  10148. Set input indexes to remap to outputs.
  10149. @end table
  10150. @subsection Examples
  10151. @itemize
  10152. @item
  10153. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10154. @example
  10155. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10156. @end example
  10157. @item
  10158. Same as above, but for audio:
  10159. @example
  10160. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10161. @end example
  10162. @end itemize
  10163. @section sobel
  10164. Apply sobel operator to input video stream.
  10165. The filter accepts the following option:
  10166. @table @option
  10167. @item planes
  10168. Set which planes will be processed, unprocessed planes will be copied.
  10169. By default value 0xf, all planes will be processed.
  10170. @item scale
  10171. Set value which will be multiplied with filtered result.
  10172. @item delta
  10173. Set value which will be added to filtered result.
  10174. @end table
  10175. @anchor{spp}
  10176. @section spp
  10177. Apply a simple postprocessing filter that compresses and decompresses the image
  10178. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10179. and average the results.
  10180. The filter accepts the following options:
  10181. @table @option
  10182. @item quality
  10183. Set quality. This option defines the number of levels for averaging. It accepts
  10184. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10185. effect. A value of @code{6} means the higher quality. For each increment of
  10186. that value the speed drops by a factor of approximately 2. Default value is
  10187. @code{3}.
  10188. @item qp
  10189. Force a constant quantization parameter. If not set, the filter will use the QP
  10190. from the video stream (if available).
  10191. @item mode
  10192. Set thresholding mode. Available modes are:
  10193. @table @samp
  10194. @item hard
  10195. Set hard thresholding (default).
  10196. @item soft
  10197. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10198. @end table
  10199. @item use_bframe_qp
  10200. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10201. option may cause flicker since the B-Frames have often larger QP. Default is
  10202. @code{0} (not enabled).
  10203. @end table
  10204. @anchor{subtitles}
  10205. @section subtitles
  10206. Draw subtitles on top of input video using the libass library.
  10207. To enable compilation of this filter you need to configure FFmpeg with
  10208. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10209. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10210. Alpha) subtitles format.
  10211. The filter accepts the following options:
  10212. @table @option
  10213. @item filename, f
  10214. Set the filename of the subtitle file to read. It must be specified.
  10215. @item original_size
  10216. Specify the size of the original video, the video for which the ASS file
  10217. was composed. For the syntax of this option, check the
  10218. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10219. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10220. correctly scale the fonts if the aspect ratio has been changed.
  10221. @item fontsdir
  10222. Set a directory path containing fonts that can be used by the filter.
  10223. These fonts will be used in addition to whatever the font provider uses.
  10224. @item charenc
  10225. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10226. useful if not UTF-8.
  10227. @item stream_index, si
  10228. Set subtitles stream index. @code{subtitles} filter only.
  10229. @item force_style
  10230. Override default style or script info parameters of the subtitles. It accepts a
  10231. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10232. @end table
  10233. If the first key is not specified, it is assumed that the first value
  10234. specifies the @option{filename}.
  10235. For example, to render the file @file{sub.srt} on top of the input
  10236. video, use the command:
  10237. @example
  10238. subtitles=sub.srt
  10239. @end example
  10240. which is equivalent to:
  10241. @example
  10242. subtitles=filename=sub.srt
  10243. @end example
  10244. To render the default subtitles stream from file @file{video.mkv}, use:
  10245. @example
  10246. subtitles=video.mkv
  10247. @end example
  10248. To render the second subtitles stream from that file, use:
  10249. @example
  10250. subtitles=video.mkv:si=1
  10251. @end example
  10252. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10253. @code{DejaVu Serif}, use:
  10254. @example
  10255. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10256. @end example
  10257. @section super2xsai
  10258. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10259. Interpolate) pixel art scaling algorithm.
  10260. Useful for enlarging pixel art images without reducing sharpness.
  10261. @section swaprect
  10262. Swap two rectangular objects in video.
  10263. This filter accepts the following options:
  10264. @table @option
  10265. @item w
  10266. Set object width.
  10267. @item h
  10268. Set object height.
  10269. @item x1
  10270. Set 1st rect x coordinate.
  10271. @item y1
  10272. Set 1st rect y coordinate.
  10273. @item x2
  10274. Set 2nd rect x coordinate.
  10275. @item y2
  10276. Set 2nd rect y coordinate.
  10277. All expressions are evaluated once for each frame.
  10278. @end table
  10279. The all options are expressions containing the following constants:
  10280. @table @option
  10281. @item w
  10282. @item h
  10283. The input width and height.
  10284. @item a
  10285. same as @var{w} / @var{h}
  10286. @item sar
  10287. input sample aspect ratio
  10288. @item dar
  10289. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10290. @item n
  10291. The number of the input frame, starting from 0.
  10292. @item t
  10293. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10294. @item pos
  10295. the position in the file of the input frame, NAN if unknown
  10296. @end table
  10297. @section swapuv
  10298. Swap U & V plane.
  10299. @section telecine
  10300. Apply telecine process to the video.
  10301. This filter accepts the following options:
  10302. @table @option
  10303. @item first_field
  10304. @table @samp
  10305. @item top, t
  10306. top field first
  10307. @item bottom, b
  10308. bottom field first
  10309. The default value is @code{top}.
  10310. @end table
  10311. @item pattern
  10312. A string of numbers representing the pulldown pattern you wish to apply.
  10313. The default value is @code{23}.
  10314. @end table
  10315. @example
  10316. Some typical patterns:
  10317. NTSC output (30i):
  10318. 27.5p: 32222
  10319. 24p: 23 (classic)
  10320. 24p: 2332 (preferred)
  10321. 20p: 33
  10322. 18p: 334
  10323. 16p: 3444
  10324. PAL output (25i):
  10325. 27.5p: 12222
  10326. 24p: 222222222223 ("Euro pulldown")
  10327. 16.67p: 33
  10328. 16p: 33333334
  10329. @end example
  10330. @section threshold
  10331. Apply threshold effect to video stream.
  10332. This filter needs four video streams to perform thresholding.
  10333. First stream is stream we are filtering.
  10334. Second stream is holding threshold values, third stream is holding min values,
  10335. and last, fourth stream is holding max values.
  10336. The filter accepts the following option:
  10337. @table @option
  10338. @item planes
  10339. Set which planes will be processed, unprocessed planes will be copied.
  10340. By default value 0xf, all planes will be processed.
  10341. @end table
  10342. For example if first stream pixel's component value is less then threshold value
  10343. of pixel component from 2nd threshold stream, third stream value will picked,
  10344. otherwise fourth stream pixel component value will be picked.
  10345. Using color source filter one can perform various types of thresholding:
  10346. @subsection Examples
  10347. @itemize
  10348. @item
  10349. Binary threshold, using gray color as threshold:
  10350. @example
  10351. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10352. @end example
  10353. @item
  10354. Inverted binary threshold, using gray color as threshold:
  10355. @example
  10356. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10357. @end example
  10358. @item
  10359. Truncate binary threshold, using gray color as threshold:
  10360. @example
  10361. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10362. @end example
  10363. @item
  10364. Threshold to zero, using gray color as threshold:
  10365. @example
  10366. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10367. @end example
  10368. @item
  10369. Inverted threshold to zero, using gray color as threshold:
  10370. @example
  10371. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10372. @end example
  10373. @end itemize
  10374. @section thumbnail
  10375. Select the most representative frame in a given sequence of consecutive frames.
  10376. The filter accepts the following options:
  10377. @table @option
  10378. @item n
  10379. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10380. will pick one of them, and then handle the next batch of @var{n} frames until
  10381. the end. Default is @code{100}.
  10382. @end table
  10383. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10384. value will result in a higher memory usage, so a high value is not recommended.
  10385. @subsection Examples
  10386. @itemize
  10387. @item
  10388. Extract one picture each 50 frames:
  10389. @example
  10390. thumbnail=50
  10391. @end example
  10392. @item
  10393. Complete example of a thumbnail creation with @command{ffmpeg}:
  10394. @example
  10395. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10396. @end example
  10397. @end itemize
  10398. @section tile
  10399. Tile several successive frames together.
  10400. The filter accepts the following options:
  10401. @table @option
  10402. @item layout
  10403. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10404. this option, check the
  10405. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10406. @item nb_frames
  10407. Set the maximum number of frames to render in the given area. It must be less
  10408. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10409. the area will be used.
  10410. @item margin
  10411. Set the outer border margin in pixels.
  10412. @item padding
  10413. Set the inner border thickness (i.e. the number of pixels between frames). For
  10414. more advanced padding options (such as having different values for the edges),
  10415. refer to the pad video filter.
  10416. @item color
  10417. Specify the color of the unused area. For the syntax of this option, check the
  10418. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10419. is "black".
  10420. @end table
  10421. @subsection Examples
  10422. @itemize
  10423. @item
  10424. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10425. @example
  10426. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10427. @end example
  10428. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10429. duplicating each output frame to accommodate the originally detected frame
  10430. rate.
  10431. @item
  10432. Display @code{5} pictures in an area of @code{3x2} frames,
  10433. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10434. mixed flat and named options:
  10435. @example
  10436. tile=3x2:nb_frames=5:padding=7:margin=2
  10437. @end example
  10438. @end itemize
  10439. @section tinterlace
  10440. Perform various types of temporal field interlacing.
  10441. Frames are counted starting from 1, so the first input frame is
  10442. considered odd.
  10443. The filter accepts the following options:
  10444. @table @option
  10445. @item mode
  10446. Specify the mode of the interlacing. This option can also be specified
  10447. as a value alone. See below for a list of values for this option.
  10448. Available values are:
  10449. @table @samp
  10450. @item merge, 0
  10451. Move odd frames into the upper field, even into the lower field,
  10452. generating a double height frame at half frame rate.
  10453. @example
  10454. ------> time
  10455. Input:
  10456. Frame 1 Frame 2 Frame 3 Frame 4
  10457. 11111 22222 33333 44444
  10458. 11111 22222 33333 44444
  10459. 11111 22222 33333 44444
  10460. 11111 22222 33333 44444
  10461. Output:
  10462. 11111 33333
  10463. 22222 44444
  10464. 11111 33333
  10465. 22222 44444
  10466. 11111 33333
  10467. 22222 44444
  10468. 11111 33333
  10469. 22222 44444
  10470. @end example
  10471. @item drop_even, 1
  10472. Only output odd frames, even frames are dropped, generating a frame with
  10473. unchanged height at half frame rate.
  10474. @example
  10475. ------> time
  10476. Input:
  10477. Frame 1 Frame 2 Frame 3 Frame 4
  10478. 11111 22222 33333 44444
  10479. 11111 22222 33333 44444
  10480. 11111 22222 33333 44444
  10481. 11111 22222 33333 44444
  10482. Output:
  10483. 11111 33333
  10484. 11111 33333
  10485. 11111 33333
  10486. 11111 33333
  10487. @end example
  10488. @item drop_odd, 2
  10489. Only output even frames, odd frames are dropped, generating a frame with
  10490. unchanged height at half frame rate.
  10491. @example
  10492. ------> time
  10493. Input:
  10494. Frame 1 Frame 2 Frame 3 Frame 4
  10495. 11111 22222 33333 44444
  10496. 11111 22222 33333 44444
  10497. 11111 22222 33333 44444
  10498. 11111 22222 33333 44444
  10499. Output:
  10500. 22222 44444
  10501. 22222 44444
  10502. 22222 44444
  10503. 22222 44444
  10504. @end example
  10505. @item pad, 3
  10506. Expand each frame to full height, but pad alternate lines with black,
  10507. generating a frame with double height at the same input frame rate.
  10508. @example
  10509. ------> time
  10510. Input:
  10511. Frame 1 Frame 2 Frame 3 Frame 4
  10512. 11111 22222 33333 44444
  10513. 11111 22222 33333 44444
  10514. 11111 22222 33333 44444
  10515. 11111 22222 33333 44444
  10516. Output:
  10517. 11111 ..... 33333 .....
  10518. ..... 22222 ..... 44444
  10519. 11111 ..... 33333 .....
  10520. ..... 22222 ..... 44444
  10521. 11111 ..... 33333 .....
  10522. ..... 22222 ..... 44444
  10523. 11111 ..... 33333 .....
  10524. ..... 22222 ..... 44444
  10525. @end example
  10526. @item interleave_top, 4
  10527. Interleave the upper field from odd frames with the lower field from
  10528. even frames, generating a frame with unchanged height at half frame rate.
  10529. @example
  10530. ------> time
  10531. Input:
  10532. Frame 1 Frame 2 Frame 3 Frame 4
  10533. 11111<- 22222 33333<- 44444
  10534. 11111 22222<- 33333 44444<-
  10535. 11111<- 22222 33333<- 44444
  10536. 11111 22222<- 33333 44444<-
  10537. Output:
  10538. 11111 33333
  10539. 22222 44444
  10540. 11111 33333
  10541. 22222 44444
  10542. @end example
  10543. @item interleave_bottom, 5
  10544. Interleave the lower field from odd frames with the upper field from
  10545. even frames, generating a frame with unchanged height at half frame rate.
  10546. @example
  10547. ------> time
  10548. Input:
  10549. Frame 1 Frame 2 Frame 3 Frame 4
  10550. 11111 22222<- 33333 44444<-
  10551. 11111<- 22222 33333<- 44444
  10552. 11111 22222<- 33333 44444<-
  10553. 11111<- 22222 33333<- 44444
  10554. Output:
  10555. 22222 44444
  10556. 11111 33333
  10557. 22222 44444
  10558. 11111 33333
  10559. @end example
  10560. @item interlacex2, 6
  10561. Double frame rate with unchanged height. Frames are inserted each
  10562. containing the second temporal field from the previous input frame and
  10563. the first temporal field from the next input frame. This mode relies on
  10564. the top_field_first flag. Useful for interlaced video displays with no
  10565. field synchronisation.
  10566. @example
  10567. ------> time
  10568. Input:
  10569. Frame 1 Frame 2 Frame 3 Frame 4
  10570. 11111 22222 33333 44444
  10571. 11111 22222 33333 44444
  10572. 11111 22222 33333 44444
  10573. 11111 22222 33333 44444
  10574. Output:
  10575. 11111 22222 22222 33333 33333 44444 44444
  10576. 11111 11111 22222 22222 33333 33333 44444
  10577. 11111 22222 22222 33333 33333 44444 44444
  10578. 11111 11111 22222 22222 33333 33333 44444
  10579. @end example
  10580. @item mergex2, 7
  10581. Move odd frames into the upper field, even into the lower field,
  10582. generating a double height frame at same frame rate.
  10583. @example
  10584. ------> time
  10585. Input:
  10586. Frame 1 Frame 2 Frame 3 Frame 4
  10587. 11111 22222 33333 44444
  10588. 11111 22222 33333 44444
  10589. 11111 22222 33333 44444
  10590. 11111 22222 33333 44444
  10591. Output:
  10592. 11111 33333 33333 55555
  10593. 22222 22222 44444 44444
  10594. 11111 33333 33333 55555
  10595. 22222 22222 44444 44444
  10596. 11111 33333 33333 55555
  10597. 22222 22222 44444 44444
  10598. 11111 33333 33333 55555
  10599. 22222 22222 44444 44444
  10600. @end example
  10601. @end table
  10602. Numeric values are deprecated but are accepted for backward
  10603. compatibility reasons.
  10604. Default mode is @code{merge}.
  10605. @item flags
  10606. Specify flags influencing the filter process.
  10607. Available value for @var{flags} is:
  10608. @table @option
  10609. @item low_pass_filter, vlfp
  10610. Enable linear vertical low-pass filtering in the filter.
  10611. Vertical low-pass filtering is required when creating an interlaced
  10612. destination from a progressive source which contains high-frequency
  10613. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10614. patterning.
  10615. @item complex_filter, cvlfp
  10616. Enable complex vertical low-pass filtering.
  10617. This will slightly less reduce interlace 'twitter' and Moire
  10618. patterning but better retain detail and subjective sharpness impression.
  10619. @end table
  10620. Vertical low-pass filtering can only be enabled for @option{mode}
  10621. @var{interleave_top} and @var{interleave_bottom}.
  10622. @end table
  10623. @section transpose
  10624. Transpose rows with columns in the input video and optionally flip it.
  10625. It accepts the following parameters:
  10626. @table @option
  10627. @item dir
  10628. Specify the transposition direction.
  10629. Can assume the following values:
  10630. @table @samp
  10631. @item 0, 4, cclock_flip
  10632. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10633. @example
  10634. L.R L.l
  10635. . . -> . .
  10636. l.r R.r
  10637. @end example
  10638. @item 1, 5, clock
  10639. Rotate by 90 degrees clockwise, that is:
  10640. @example
  10641. L.R l.L
  10642. . . -> . .
  10643. l.r r.R
  10644. @end example
  10645. @item 2, 6, cclock
  10646. Rotate by 90 degrees counterclockwise, that is:
  10647. @example
  10648. L.R R.r
  10649. . . -> . .
  10650. l.r L.l
  10651. @end example
  10652. @item 3, 7, clock_flip
  10653. Rotate by 90 degrees clockwise and vertically flip, that is:
  10654. @example
  10655. L.R r.R
  10656. . . -> . .
  10657. l.r l.L
  10658. @end example
  10659. @end table
  10660. For values between 4-7, the transposition is only done if the input
  10661. video geometry is portrait and not landscape. These values are
  10662. deprecated, the @code{passthrough} option should be used instead.
  10663. Numerical values are deprecated, and should be dropped in favor of
  10664. symbolic constants.
  10665. @item passthrough
  10666. Do not apply the transposition if the input geometry matches the one
  10667. specified by the specified value. It accepts the following values:
  10668. @table @samp
  10669. @item none
  10670. Always apply transposition.
  10671. @item portrait
  10672. Preserve portrait geometry (when @var{height} >= @var{width}).
  10673. @item landscape
  10674. Preserve landscape geometry (when @var{width} >= @var{height}).
  10675. @end table
  10676. Default value is @code{none}.
  10677. @end table
  10678. For example to rotate by 90 degrees clockwise and preserve portrait
  10679. layout:
  10680. @example
  10681. transpose=dir=1:passthrough=portrait
  10682. @end example
  10683. The command above can also be specified as:
  10684. @example
  10685. transpose=1:portrait
  10686. @end example
  10687. @section trim
  10688. Trim the input so that the output contains one continuous subpart of the input.
  10689. It accepts the following parameters:
  10690. @table @option
  10691. @item start
  10692. Specify the time of the start of the kept section, i.e. the frame with the
  10693. timestamp @var{start} will be the first frame in the output.
  10694. @item end
  10695. Specify the time of the first frame that will be dropped, i.e. the frame
  10696. immediately preceding the one with the timestamp @var{end} will be the last
  10697. frame in the output.
  10698. @item start_pts
  10699. This is the same as @var{start}, except this option sets the start timestamp
  10700. in timebase units instead of seconds.
  10701. @item end_pts
  10702. This is the same as @var{end}, except this option sets the end timestamp
  10703. in timebase units instead of seconds.
  10704. @item duration
  10705. The maximum duration of the output in seconds.
  10706. @item start_frame
  10707. The number of the first frame that should be passed to the output.
  10708. @item end_frame
  10709. The number of the first frame that should be dropped.
  10710. @end table
  10711. @option{start}, @option{end}, and @option{duration} are expressed as time
  10712. duration specifications; see
  10713. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10714. for the accepted syntax.
  10715. Note that the first two sets of the start/end options and the @option{duration}
  10716. option look at the frame timestamp, while the _frame variants simply count the
  10717. frames that pass through the filter. Also note that this filter does not modify
  10718. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10719. setpts filter after the trim filter.
  10720. If multiple start or end options are set, this filter tries to be greedy and
  10721. keep all the frames that match at least one of the specified constraints. To keep
  10722. only the part that matches all the constraints at once, chain multiple trim
  10723. filters.
  10724. The defaults are such that all the input is kept. So it is possible to set e.g.
  10725. just the end values to keep everything before the specified time.
  10726. Examples:
  10727. @itemize
  10728. @item
  10729. Drop everything except the second minute of input:
  10730. @example
  10731. ffmpeg -i INPUT -vf trim=60:120
  10732. @end example
  10733. @item
  10734. Keep only the first second:
  10735. @example
  10736. ffmpeg -i INPUT -vf trim=duration=1
  10737. @end example
  10738. @end itemize
  10739. @anchor{unsharp}
  10740. @section unsharp
  10741. Sharpen or blur the input video.
  10742. It accepts the following parameters:
  10743. @table @option
  10744. @item luma_msize_x, lx
  10745. Set the luma matrix horizontal size. It must be an odd integer between
  10746. 3 and 23. The default value is 5.
  10747. @item luma_msize_y, ly
  10748. Set the luma matrix vertical size. It must be an odd integer between 3
  10749. and 23. The default value is 5.
  10750. @item luma_amount, la
  10751. Set the luma effect strength. It must be a floating point number, reasonable
  10752. values lay between -1.5 and 1.5.
  10753. Negative values will blur the input video, while positive values will
  10754. sharpen it, a value of zero will disable the effect.
  10755. Default value is 1.0.
  10756. @item chroma_msize_x, cx
  10757. Set the chroma matrix horizontal size. It must be an odd integer
  10758. between 3 and 23. The default value is 5.
  10759. @item chroma_msize_y, cy
  10760. Set the chroma matrix vertical size. It must be an odd integer
  10761. between 3 and 23. The default value is 5.
  10762. @item chroma_amount, ca
  10763. Set the chroma effect strength. It must be a floating point number, reasonable
  10764. values lay between -1.5 and 1.5.
  10765. Negative values will blur the input video, while positive values will
  10766. sharpen it, a value of zero will disable the effect.
  10767. Default value is 0.0.
  10768. @item opencl
  10769. If set to 1, specify using OpenCL capabilities, only available if
  10770. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10771. @end table
  10772. All parameters are optional and default to the equivalent of the
  10773. string '5:5:1.0:5:5:0.0'.
  10774. @subsection Examples
  10775. @itemize
  10776. @item
  10777. Apply strong luma sharpen effect:
  10778. @example
  10779. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10780. @end example
  10781. @item
  10782. Apply a strong blur of both luma and chroma parameters:
  10783. @example
  10784. unsharp=7:7:-2:7:7:-2
  10785. @end example
  10786. @end itemize
  10787. @section uspp
  10788. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10789. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10790. shifts and average the results.
  10791. The way this differs from the behavior of spp is that uspp actually encodes &
  10792. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10793. DCT similar to MJPEG.
  10794. The filter accepts the following options:
  10795. @table @option
  10796. @item quality
  10797. Set quality. This option defines the number of levels for averaging. It accepts
  10798. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10799. effect. A value of @code{8} means the higher quality. For each increment of
  10800. that value the speed drops by a factor of approximately 2. Default value is
  10801. @code{3}.
  10802. @item qp
  10803. Force a constant quantization parameter. If not set, the filter will use the QP
  10804. from the video stream (if available).
  10805. @end table
  10806. @section vaguedenoiser
  10807. Apply a wavelet based denoiser.
  10808. It transforms each frame from the video input into the wavelet domain,
  10809. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10810. the obtained coefficients. It does an inverse wavelet transform after.
  10811. Due to wavelet properties, it should give a nice smoothed result, and
  10812. reduced noise, without blurring picture features.
  10813. This filter accepts the following options:
  10814. @table @option
  10815. @item threshold
  10816. The filtering strength. The higher, the more filtered the video will be.
  10817. Hard thresholding can use a higher threshold than soft thresholding
  10818. before the video looks overfiltered.
  10819. @item method
  10820. The filtering method the filter will use.
  10821. It accepts the following values:
  10822. @table @samp
  10823. @item hard
  10824. All values under the threshold will be zeroed.
  10825. @item soft
  10826. All values under the threshold will be zeroed. All values above will be
  10827. reduced by the threshold.
  10828. @item garrote
  10829. Scales or nullifies coefficients - intermediary between (more) soft and
  10830. (less) hard thresholding.
  10831. @end table
  10832. @item nsteps
  10833. Number of times, the wavelet will decompose the picture. Picture can't
  10834. be decomposed beyond a particular point (typically, 8 for a 640x480
  10835. frame - as 2^9 = 512 > 480)
  10836. @item percent
  10837. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10838. @item planes
  10839. A list of the planes to process. By default all planes are processed.
  10840. @end table
  10841. @section vectorscope
  10842. Display 2 color component values in the two dimensional graph (which is called
  10843. a vectorscope).
  10844. This filter accepts the following options:
  10845. @table @option
  10846. @item mode, m
  10847. Set vectorscope mode.
  10848. It accepts the following values:
  10849. @table @samp
  10850. @item gray
  10851. Gray values are displayed on graph, higher brightness means more pixels have
  10852. same component color value on location in graph. This is the default mode.
  10853. @item color
  10854. Gray values are displayed on graph. Surrounding pixels values which are not
  10855. present in video frame are drawn in gradient of 2 color components which are
  10856. set by option @code{x} and @code{y}. The 3rd color component is static.
  10857. @item color2
  10858. Actual color components values present in video frame are displayed on graph.
  10859. @item color3
  10860. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10861. on graph increases value of another color component, which is luminance by
  10862. default values of @code{x} and @code{y}.
  10863. @item color4
  10864. Actual colors present in video frame are displayed on graph. If two different
  10865. colors map to same position on graph then color with higher value of component
  10866. not present in graph is picked.
  10867. @item color5
  10868. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10869. component picked from radial gradient.
  10870. @end table
  10871. @item x
  10872. Set which color component will be represented on X-axis. Default is @code{1}.
  10873. @item y
  10874. Set which color component will be represented on Y-axis. Default is @code{2}.
  10875. @item intensity, i
  10876. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10877. of color component which represents frequency of (X, Y) location in graph.
  10878. @item envelope, e
  10879. @table @samp
  10880. @item none
  10881. No envelope, this is default.
  10882. @item instant
  10883. Instant envelope, even darkest single pixel will be clearly highlighted.
  10884. @item peak
  10885. Hold maximum and minimum values presented in graph over time. This way you
  10886. can still spot out of range values without constantly looking at vectorscope.
  10887. @item peak+instant
  10888. Peak and instant envelope combined together.
  10889. @end table
  10890. @item graticule, g
  10891. Set what kind of graticule to draw.
  10892. @table @samp
  10893. @item none
  10894. @item green
  10895. @item color
  10896. @end table
  10897. @item opacity, o
  10898. Set graticule opacity.
  10899. @item flags, f
  10900. Set graticule flags.
  10901. @table @samp
  10902. @item white
  10903. Draw graticule for white point.
  10904. @item black
  10905. Draw graticule for black point.
  10906. @item name
  10907. Draw color points short names.
  10908. @end table
  10909. @item bgopacity, b
  10910. Set background opacity.
  10911. @item lthreshold, l
  10912. Set low threshold for color component not represented on X or Y axis.
  10913. Values lower than this value will be ignored. Default is 0.
  10914. Note this value is multiplied with actual max possible value one pixel component
  10915. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10916. is 0.1 * 255 = 25.
  10917. @item hthreshold, h
  10918. Set high threshold for color component not represented on X or Y axis.
  10919. Values higher than this value will be ignored. Default is 1.
  10920. Note this value is multiplied with actual max possible value one pixel component
  10921. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10922. is 0.9 * 255 = 230.
  10923. @item colorspace, c
  10924. Set what kind of colorspace to use when drawing graticule.
  10925. @table @samp
  10926. @item auto
  10927. @item 601
  10928. @item 709
  10929. @end table
  10930. Default is auto.
  10931. @end table
  10932. @anchor{vidstabdetect}
  10933. @section vidstabdetect
  10934. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10935. @ref{vidstabtransform} for pass 2.
  10936. This filter generates a file with relative translation and rotation
  10937. transform information about subsequent frames, which is then used by
  10938. the @ref{vidstabtransform} filter.
  10939. To enable compilation of this filter you need to configure FFmpeg with
  10940. @code{--enable-libvidstab}.
  10941. This filter accepts the following options:
  10942. @table @option
  10943. @item result
  10944. Set the path to the file used to write the transforms information.
  10945. Default value is @file{transforms.trf}.
  10946. @item shakiness
  10947. Set how shaky the video is and how quick the camera is. It accepts an
  10948. integer in the range 1-10, a value of 1 means little shakiness, a
  10949. value of 10 means strong shakiness. Default value is 5.
  10950. @item accuracy
  10951. Set the accuracy of the detection process. It must be a value in the
  10952. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10953. accuracy. Default value is 15.
  10954. @item stepsize
  10955. Set stepsize of the search process. The region around minimum is
  10956. scanned with 1 pixel resolution. Default value is 6.
  10957. @item mincontrast
  10958. Set minimum contrast. Below this value a local measurement field is
  10959. discarded. Must be a floating point value in the range 0-1. Default
  10960. value is 0.3.
  10961. @item tripod
  10962. Set reference frame number for tripod mode.
  10963. If enabled, the motion of the frames is compared to a reference frame
  10964. in the filtered stream, identified by the specified number. The idea
  10965. is to compensate all movements in a more-or-less static scene and keep
  10966. the camera view absolutely still.
  10967. If set to 0, it is disabled. The frames are counted starting from 1.
  10968. @item show
  10969. Show fields and transforms in the resulting frames. It accepts an
  10970. integer in the range 0-2. Default value is 0, which disables any
  10971. visualization.
  10972. @end table
  10973. @subsection Examples
  10974. @itemize
  10975. @item
  10976. Use default values:
  10977. @example
  10978. vidstabdetect
  10979. @end example
  10980. @item
  10981. Analyze strongly shaky movie and put the results in file
  10982. @file{mytransforms.trf}:
  10983. @example
  10984. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10985. @end example
  10986. @item
  10987. Visualize the result of internal transformations in the resulting
  10988. video:
  10989. @example
  10990. vidstabdetect=show=1
  10991. @end example
  10992. @item
  10993. Analyze a video with medium shakiness using @command{ffmpeg}:
  10994. @example
  10995. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10996. @end example
  10997. @end itemize
  10998. @anchor{vidstabtransform}
  10999. @section vidstabtransform
  11000. Video stabilization/deshaking: pass 2 of 2,
  11001. see @ref{vidstabdetect} for pass 1.
  11002. Read a file with transform information for each frame and
  11003. apply/compensate them. Together with the @ref{vidstabdetect}
  11004. filter this can be used to deshake videos. See also
  11005. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11006. the @ref{unsharp} filter, see below.
  11007. To enable compilation of this filter you need to configure FFmpeg with
  11008. @code{--enable-libvidstab}.
  11009. @subsection Options
  11010. @table @option
  11011. @item input
  11012. Set path to the file used to read the transforms. Default value is
  11013. @file{transforms.trf}.
  11014. @item smoothing
  11015. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11016. camera movements. Default value is 10.
  11017. For example a number of 10 means that 21 frames are used (10 in the
  11018. past and 10 in the future) to smoothen the motion in the video. A
  11019. larger value leads to a smoother video, but limits the acceleration of
  11020. the camera (pan/tilt movements). 0 is a special case where a static
  11021. camera is simulated.
  11022. @item optalgo
  11023. Set the camera path optimization algorithm.
  11024. Accepted values are:
  11025. @table @samp
  11026. @item gauss
  11027. gaussian kernel low-pass filter on camera motion (default)
  11028. @item avg
  11029. averaging on transformations
  11030. @end table
  11031. @item maxshift
  11032. Set maximal number of pixels to translate frames. Default value is -1,
  11033. meaning no limit.
  11034. @item maxangle
  11035. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11036. value is -1, meaning no limit.
  11037. @item crop
  11038. Specify how to deal with borders that may be visible due to movement
  11039. compensation.
  11040. Available values are:
  11041. @table @samp
  11042. @item keep
  11043. keep image information from previous frame (default)
  11044. @item black
  11045. fill the border black
  11046. @end table
  11047. @item invert
  11048. Invert transforms if set to 1. Default value is 0.
  11049. @item relative
  11050. Consider transforms as relative to previous frame if set to 1,
  11051. absolute if set to 0. Default value is 0.
  11052. @item zoom
  11053. Set percentage to zoom. A positive value will result in a zoom-in
  11054. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11055. zoom).
  11056. @item optzoom
  11057. Set optimal zooming to avoid borders.
  11058. Accepted values are:
  11059. @table @samp
  11060. @item 0
  11061. disabled
  11062. @item 1
  11063. optimal static zoom value is determined (only very strong movements
  11064. will lead to visible borders) (default)
  11065. @item 2
  11066. optimal adaptive zoom value is determined (no borders will be
  11067. visible), see @option{zoomspeed}
  11068. @end table
  11069. Note that the value given at zoom is added to the one calculated here.
  11070. @item zoomspeed
  11071. Set percent to zoom maximally each frame (enabled when
  11072. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11073. 0.25.
  11074. @item interpol
  11075. Specify type of interpolation.
  11076. Available values are:
  11077. @table @samp
  11078. @item no
  11079. no interpolation
  11080. @item linear
  11081. linear only horizontal
  11082. @item bilinear
  11083. linear in both directions (default)
  11084. @item bicubic
  11085. cubic in both directions (slow)
  11086. @end table
  11087. @item tripod
  11088. Enable virtual tripod mode if set to 1, which is equivalent to
  11089. @code{relative=0:smoothing=0}. Default value is 0.
  11090. Use also @code{tripod} option of @ref{vidstabdetect}.
  11091. @item debug
  11092. Increase log verbosity if set to 1. Also the detected global motions
  11093. are written to the temporary file @file{global_motions.trf}. Default
  11094. value is 0.
  11095. @end table
  11096. @subsection Examples
  11097. @itemize
  11098. @item
  11099. Use @command{ffmpeg} for a typical stabilization with default values:
  11100. @example
  11101. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11102. @end example
  11103. Note the use of the @ref{unsharp} filter which is always recommended.
  11104. @item
  11105. Zoom in a bit more and load transform data from a given file:
  11106. @example
  11107. vidstabtransform=zoom=5:input="mytransforms.trf"
  11108. @end example
  11109. @item
  11110. Smoothen the video even more:
  11111. @example
  11112. vidstabtransform=smoothing=30
  11113. @end example
  11114. @end itemize
  11115. @section vflip
  11116. Flip the input video vertically.
  11117. For example, to vertically flip a video with @command{ffmpeg}:
  11118. @example
  11119. ffmpeg -i in.avi -vf "vflip" out.avi
  11120. @end example
  11121. @anchor{vignette}
  11122. @section vignette
  11123. Make or reverse a natural vignetting effect.
  11124. The filter accepts the following options:
  11125. @table @option
  11126. @item angle, a
  11127. Set lens angle expression as a number of radians.
  11128. The value is clipped in the @code{[0,PI/2]} range.
  11129. Default value: @code{"PI/5"}
  11130. @item x0
  11131. @item y0
  11132. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11133. by default.
  11134. @item mode
  11135. Set forward/backward mode.
  11136. Available modes are:
  11137. @table @samp
  11138. @item forward
  11139. The larger the distance from the central point, the darker the image becomes.
  11140. @item backward
  11141. The larger the distance from the central point, the brighter the image becomes.
  11142. This can be used to reverse a vignette effect, though there is no automatic
  11143. detection to extract the lens @option{angle} and other settings (yet). It can
  11144. also be used to create a burning effect.
  11145. @end table
  11146. Default value is @samp{forward}.
  11147. @item eval
  11148. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11149. It accepts the following values:
  11150. @table @samp
  11151. @item init
  11152. Evaluate expressions only once during the filter initialization.
  11153. @item frame
  11154. Evaluate expressions for each incoming frame. This is way slower than the
  11155. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11156. allows advanced dynamic expressions.
  11157. @end table
  11158. Default value is @samp{init}.
  11159. @item dither
  11160. Set dithering to reduce the circular banding effects. Default is @code{1}
  11161. (enabled).
  11162. @item aspect
  11163. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11164. Setting this value to the SAR of the input will make a rectangular vignetting
  11165. following the dimensions of the video.
  11166. Default is @code{1/1}.
  11167. @end table
  11168. @subsection Expressions
  11169. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11170. following parameters.
  11171. @table @option
  11172. @item w
  11173. @item h
  11174. input width and height
  11175. @item n
  11176. the number of input frame, starting from 0
  11177. @item pts
  11178. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11179. @var{TB} units, NAN if undefined
  11180. @item r
  11181. frame rate of the input video, NAN if the input frame rate is unknown
  11182. @item t
  11183. the PTS (Presentation TimeStamp) of the filtered video frame,
  11184. expressed in seconds, NAN if undefined
  11185. @item tb
  11186. time base of the input video
  11187. @end table
  11188. @subsection Examples
  11189. @itemize
  11190. @item
  11191. Apply simple strong vignetting effect:
  11192. @example
  11193. vignette=PI/4
  11194. @end example
  11195. @item
  11196. Make a flickering vignetting:
  11197. @example
  11198. vignette='PI/4+random(1)*PI/50':eval=frame
  11199. @end example
  11200. @end itemize
  11201. @section vstack
  11202. Stack input videos vertically.
  11203. All streams must be of same pixel format and of same width.
  11204. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11205. to create same output.
  11206. The filter accept the following option:
  11207. @table @option
  11208. @item inputs
  11209. Set number of input streams. Default is 2.
  11210. @item shortest
  11211. If set to 1, force the output to terminate when the shortest input
  11212. terminates. Default value is 0.
  11213. @end table
  11214. @section w3fdif
  11215. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11216. Deinterlacing Filter").
  11217. Based on the process described by Martin Weston for BBC R&D, and
  11218. implemented based on the de-interlace algorithm written by Jim
  11219. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11220. uses filter coefficients calculated by BBC R&D.
  11221. There are two sets of filter coefficients, so called "simple":
  11222. and "complex". Which set of filter coefficients is used can
  11223. be set by passing an optional parameter:
  11224. @table @option
  11225. @item filter
  11226. Set the interlacing filter coefficients. Accepts one of the following values:
  11227. @table @samp
  11228. @item simple
  11229. Simple filter coefficient set.
  11230. @item complex
  11231. More-complex filter coefficient set.
  11232. @end table
  11233. Default value is @samp{complex}.
  11234. @item deint
  11235. Specify which frames to deinterlace. Accept one of the following values:
  11236. @table @samp
  11237. @item all
  11238. Deinterlace all frames,
  11239. @item interlaced
  11240. Only deinterlace frames marked as interlaced.
  11241. @end table
  11242. Default value is @samp{all}.
  11243. @end table
  11244. @section waveform
  11245. Video waveform monitor.
  11246. The waveform monitor plots color component intensity. By default luminance
  11247. only. Each column of the waveform corresponds to a column of pixels in the
  11248. source video.
  11249. It accepts the following options:
  11250. @table @option
  11251. @item mode, m
  11252. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11253. In row mode, the graph on the left side represents color component value 0 and
  11254. the right side represents value = 255. In column mode, the top side represents
  11255. color component value = 0 and bottom side represents value = 255.
  11256. @item intensity, i
  11257. Set intensity. Smaller values are useful to find out how many values of the same
  11258. luminance are distributed across input rows/columns.
  11259. Default value is @code{0.04}. Allowed range is [0, 1].
  11260. @item mirror, r
  11261. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11262. In mirrored mode, higher values will be represented on the left
  11263. side for @code{row} mode and at the top for @code{column} mode. Default is
  11264. @code{1} (mirrored).
  11265. @item display, d
  11266. Set display mode.
  11267. It accepts the following values:
  11268. @table @samp
  11269. @item overlay
  11270. Presents information identical to that in the @code{parade}, except
  11271. that the graphs representing color components are superimposed directly
  11272. over one another.
  11273. This display mode makes it easier to spot relative differences or similarities
  11274. in overlapping areas of the color components that are supposed to be identical,
  11275. such as neutral whites, grays, or blacks.
  11276. @item stack
  11277. Display separate graph for the color components side by side in
  11278. @code{row} mode or one below the other in @code{column} mode.
  11279. @item parade
  11280. Display separate graph for the color components side by side in
  11281. @code{column} mode or one below the other in @code{row} mode.
  11282. Using this display mode makes it easy to spot color casts in the highlights
  11283. and shadows of an image, by comparing the contours of the top and the bottom
  11284. graphs of each waveform. Since whites, grays, and blacks are characterized
  11285. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11286. should display three waveforms of roughly equal width/height. If not, the
  11287. correction is easy to perform by making level adjustments the three waveforms.
  11288. @end table
  11289. Default is @code{stack}.
  11290. @item components, c
  11291. Set which color components to display. Default is 1, which means only luminance
  11292. or red color component if input is in RGB colorspace. If is set for example to
  11293. 7 it will display all 3 (if) available color components.
  11294. @item envelope, e
  11295. @table @samp
  11296. @item none
  11297. No envelope, this is default.
  11298. @item instant
  11299. Instant envelope, minimum and maximum values presented in graph will be easily
  11300. visible even with small @code{step} value.
  11301. @item peak
  11302. Hold minimum and maximum values presented in graph across time. This way you
  11303. can still spot out of range values without constantly looking at waveforms.
  11304. @item peak+instant
  11305. Peak and instant envelope combined together.
  11306. @end table
  11307. @item filter, f
  11308. @table @samp
  11309. @item lowpass
  11310. No filtering, this is default.
  11311. @item flat
  11312. Luma and chroma combined together.
  11313. @item aflat
  11314. Similar as above, but shows difference between blue and red chroma.
  11315. @item chroma
  11316. Displays only chroma.
  11317. @item color
  11318. Displays actual color value on waveform.
  11319. @item acolor
  11320. Similar as above, but with luma showing frequency of chroma values.
  11321. @end table
  11322. @item graticule, g
  11323. Set which graticule to display.
  11324. @table @samp
  11325. @item none
  11326. Do not display graticule.
  11327. @item green
  11328. Display green graticule showing legal broadcast ranges.
  11329. @end table
  11330. @item opacity, o
  11331. Set graticule opacity.
  11332. @item flags, fl
  11333. Set graticule flags.
  11334. @table @samp
  11335. @item numbers
  11336. Draw numbers above lines. By default enabled.
  11337. @item dots
  11338. Draw dots instead of lines.
  11339. @end table
  11340. @item scale, s
  11341. Set scale used for displaying graticule.
  11342. @table @samp
  11343. @item digital
  11344. @item millivolts
  11345. @item ire
  11346. @end table
  11347. Default is digital.
  11348. @item bgopacity, b
  11349. Set background opacity.
  11350. @end table
  11351. @section weave, doubleweave
  11352. The @code{weave} takes a field-based video input and join
  11353. each two sequential fields into single frame, producing a new double
  11354. height clip with half the frame rate and half the frame count.
  11355. The @code{doubleweave} works same as @code{weave} but without
  11356. halving frame rate and frame count.
  11357. It accepts the following option:
  11358. @table @option
  11359. @item first_field
  11360. Set first field. Available values are:
  11361. @table @samp
  11362. @item top, t
  11363. Set the frame as top-field-first.
  11364. @item bottom, b
  11365. Set the frame as bottom-field-first.
  11366. @end table
  11367. @end table
  11368. @subsection Examples
  11369. @itemize
  11370. @item
  11371. Interlace video using @ref{select} and @ref{separatefields} filter:
  11372. @example
  11373. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11374. @end example
  11375. @end itemize
  11376. @section xbr
  11377. Apply the xBR high-quality magnification filter which is designed for pixel
  11378. art. It follows a set of edge-detection rules, see
  11379. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11380. It accepts the following option:
  11381. @table @option
  11382. @item n
  11383. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11384. @code{3xBR} and @code{4} for @code{4xBR}.
  11385. Default is @code{3}.
  11386. @end table
  11387. @anchor{yadif}
  11388. @section yadif
  11389. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11390. filter").
  11391. It accepts the following parameters:
  11392. @table @option
  11393. @item mode
  11394. The interlacing mode to adopt. It accepts one of the following values:
  11395. @table @option
  11396. @item 0, send_frame
  11397. Output one frame for each frame.
  11398. @item 1, send_field
  11399. Output one frame for each field.
  11400. @item 2, send_frame_nospatial
  11401. Like @code{send_frame}, but it skips the spatial interlacing check.
  11402. @item 3, send_field_nospatial
  11403. Like @code{send_field}, but it skips the spatial interlacing check.
  11404. @end table
  11405. The default value is @code{send_frame}.
  11406. @item parity
  11407. The picture field parity assumed for the input interlaced video. It accepts one
  11408. of the following values:
  11409. @table @option
  11410. @item 0, tff
  11411. Assume the top field is first.
  11412. @item 1, bff
  11413. Assume the bottom field is first.
  11414. @item -1, auto
  11415. Enable automatic detection of field parity.
  11416. @end table
  11417. The default value is @code{auto}.
  11418. If the interlacing is unknown or the decoder does not export this information,
  11419. top field first will be assumed.
  11420. @item deint
  11421. Specify which frames to deinterlace. Accept one of the following
  11422. values:
  11423. @table @option
  11424. @item 0, all
  11425. Deinterlace all frames.
  11426. @item 1, interlaced
  11427. Only deinterlace frames marked as interlaced.
  11428. @end table
  11429. The default value is @code{all}.
  11430. @end table
  11431. @section zoompan
  11432. Apply Zoom & Pan effect.
  11433. This filter accepts the following options:
  11434. @table @option
  11435. @item zoom, z
  11436. Set the zoom expression. Default is 1.
  11437. @item x
  11438. @item y
  11439. Set the x and y expression. Default is 0.
  11440. @item d
  11441. Set the duration expression in number of frames.
  11442. This sets for how many number of frames effect will last for
  11443. single input image.
  11444. @item s
  11445. Set the output image size, default is 'hd720'.
  11446. @item fps
  11447. Set the output frame rate, default is '25'.
  11448. @end table
  11449. Each expression can contain the following constants:
  11450. @table @option
  11451. @item in_w, iw
  11452. Input width.
  11453. @item in_h, ih
  11454. Input height.
  11455. @item out_w, ow
  11456. Output width.
  11457. @item out_h, oh
  11458. Output height.
  11459. @item in
  11460. Input frame count.
  11461. @item on
  11462. Output frame count.
  11463. @item x
  11464. @item y
  11465. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11466. for current input frame.
  11467. @item px
  11468. @item py
  11469. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11470. not yet such frame (first input frame).
  11471. @item zoom
  11472. Last calculated zoom from 'z' expression for current input frame.
  11473. @item pzoom
  11474. Last calculated zoom of last output frame of previous input frame.
  11475. @item duration
  11476. Number of output frames for current input frame. Calculated from 'd' expression
  11477. for each input frame.
  11478. @item pduration
  11479. number of output frames created for previous input frame
  11480. @item a
  11481. Rational number: input width / input height
  11482. @item sar
  11483. sample aspect ratio
  11484. @item dar
  11485. display aspect ratio
  11486. @end table
  11487. @subsection Examples
  11488. @itemize
  11489. @item
  11490. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11491. @example
  11492. 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
  11493. @end example
  11494. @item
  11495. Zoom-in up to 1.5 and pan always at center of picture:
  11496. @example
  11497. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11498. @end example
  11499. @item
  11500. Same as above but without pausing:
  11501. @example
  11502. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11503. @end example
  11504. @end itemize
  11505. @section zscale
  11506. Scale (resize) the input video, using the z.lib library:
  11507. https://github.com/sekrit-twc/zimg.
  11508. The zscale filter forces the output display aspect ratio to be the same
  11509. as the input, by changing the output sample aspect ratio.
  11510. If the input image format is different from the format requested by
  11511. the next filter, the zscale filter will convert the input to the
  11512. requested format.
  11513. @subsection Options
  11514. The filter accepts the following options.
  11515. @table @option
  11516. @item width, w
  11517. @item height, h
  11518. Set the output video dimension expression. Default value is the input
  11519. dimension.
  11520. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11521. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11522. If one of the values is -1, the zscale filter will use a value that
  11523. maintains the aspect ratio of the input image, calculated from the
  11524. other specified dimension. If both of them are -1, the input size is
  11525. used
  11526. If one of the values is -n with n > 1, the zscale filter will also use a value
  11527. that maintains the aspect ratio of the input image, calculated from the other
  11528. specified dimension. After that it will, however, make sure that the calculated
  11529. dimension is divisible by n and adjust the value if necessary.
  11530. See below for the list of accepted constants for use in the dimension
  11531. expression.
  11532. @item size, s
  11533. Set the video size. For the syntax of this option, check the
  11534. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11535. @item dither, d
  11536. Set the dither type.
  11537. Possible values are:
  11538. @table @var
  11539. @item none
  11540. @item ordered
  11541. @item random
  11542. @item error_diffusion
  11543. @end table
  11544. Default is none.
  11545. @item filter, f
  11546. Set the resize filter type.
  11547. Possible values are:
  11548. @table @var
  11549. @item point
  11550. @item bilinear
  11551. @item bicubic
  11552. @item spline16
  11553. @item spline36
  11554. @item lanczos
  11555. @end table
  11556. Default is bilinear.
  11557. @item range, r
  11558. Set the color range.
  11559. Possible values are:
  11560. @table @var
  11561. @item input
  11562. @item limited
  11563. @item full
  11564. @end table
  11565. Default is same as input.
  11566. @item primaries, p
  11567. Set the color primaries.
  11568. Possible values are:
  11569. @table @var
  11570. @item input
  11571. @item 709
  11572. @item unspecified
  11573. @item 170m
  11574. @item 240m
  11575. @item 2020
  11576. @end table
  11577. Default is same as input.
  11578. @item transfer, t
  11579. Set the transfer characteristics.
  11580. Possible values are:
  11581. @table @var
  11582. @item input
  11583. @item 709
  11584. @item unspecified
  11585. @item 601
  11586. @item linear
  11587. @item 2020_10
  11588. @item 2020_12
  11589. @item smpte2084
  11590. @item iec61966-2-1
  11591. @item arib-std-b67
  11592. @end table
  11593. Default is same as input.
  11594. @item matrix, m
  11595. Set the colorspace matrix.
  11596. Possible value are:
  11597. @table @var
  11598. @item input
  11599. @item 709
  11600. @item unspecified
  11601. @item 470bg
  11602. @item 170m
  11603. @item 2020_ncl
  11604. @item 2020_cl
  11605. @end table
  11606. Default is same as input.
  11607. @item rangein, rin
  11608. Set the input color range.
  11609. Possible values are:
  11610. @table @var
  11611. @item input
  11612. @item limited
  11613. @item full
  11614. @end table
  11615. Default is same as input.
  11616. @item primariesin, pin
  11617. Set the input color primaries.
  11618. Possible values are:
  11619. @table @var
  11620. @item input
  11621. @item 709
  11622. @item unspecified
  11623. @item 170m
  11624. @item 240m
  11625. @item 2020
  11626. @end table
  11627. Default is same as input.
  11628. @item transferin, tin
  11629. Set the input transfer characteristics.
  11630. Possible values are:
  11631. @table @var
  11632. @item input
  11633. @item 709
  11634. @item unspecified
  11635. @item 601
  11636. @item linear
  11637. @item 2020_10
  11638. @item 2020_12
  11639. @end table
  11640. Default is same as input.
  11641. @item matrixin, min
  11642. Set the input colorspace matrix.
  11643. Possible value are:
  11644. @table @var
  11645. @item input
  11646. @item 709
  11647. @item unspecified
  11648. @item 470bg
  11649. @item 170m
  11650. @item 2020_ncl
  11651. @item 2020_cl
  11652. @end table
  11653. @item chromal, c
  11654. Set the output chroma location.
  11655. Possible values are:
  11656. @table @var
  11657. @item input
  11658. @item left
  11659. @item center
  11660. @item topleft
  11661. @item top
  11662. @item bottomleft
  11663. @item bottom
  11664. @end table
  11665. @item chromalin, cin
  11666. Set the input chroma location.
  11667. Possible values are:
  11668. @table @var
  11669. @item input
  11670. @item left
  11671. @item center
  11672. @item topleft
  11673. @item top
  11674. @item bottomleft
  11675. @item bottom
  11676. @end table
  11677. @item npl
  11678. Set the nominal peak luminance.
  11679. @end table
  11680. The values of the @option{w} and @option{h} options are expressions
  11681. containing the following constants:
  11682. @table @var
  11683. @item in_w
  11684. @item in_h
  11685. The input width and height
  11686. @item iw
  11687. @item ih
  11688. These are the same as @var{in_w} and @var{in_h}.
  11689. @item out_w
  11690. @item out_h
  11691. The output (scaled) width and height
  11692. @item ow
  11693. @item oh
  11694. These are the same as @var{out_w} and @var{out_h}
  11695. @item a
  11696. The same as @var{iw} / @var{ih}
  11697. @item sar
  11698. input sample aspect ratio
  11699. @item dar
  11700. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11701. @item hsub
  11702. @item vsub
  11703. horizontal and vertical input chroma subsample values. For example for the
  11704. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11705. @item ohsub
  11706. @item ovsub
  11707. horizontal and vertical output chroma subsample values. For example for the
  11708. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11709. @end table
  11710. @table @option
  11711. @end table
  11712. @c man end VIDEO FILTERS
  11713. @chapter Video Sources
  11714. @c man begin VIDEO SOURCES
  11715. Below is a description of the currently available video sources.
  11716. @section buffer
  11717. Buffer video frames, and make them available to the filter chain.
  11718. This source is mainly intended for a programmatic use, in particular
  11719. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11720. It accepts the following parameters:
  11721. @table @option
  11722. @item video_size
  11723. Specify the size (width and height) of the buffered video frames. For the
  11724. syntax of this option, check the
  11725. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11726. @item width
  11727. The input video width.
  11728. @item height
  11729. The input video height.
  11730. @item pix_fmt
  11731. A string representing the pixel format of the buffered video frames.
  11732. It may be a number corresponding to a pixel format, or a pixel format
  11733. name.
  11734. @item time_base
  11735. Specify the timebase assumed by the timestamps of the buffered frames.
  11736. @item frame_rate
  11737. Specify the frame rate expected for the video stream.
  11738. @item pixel_aspect, sar
  11739. The sample (pixel) aspect ratio of the input video.
  11740. @item sws_param
  11741. Specify the optional parameters to be used for the scale filter which
  11742. is automatically inserted when an input change is detected in the
  11743. input size or format.
  11744. @item hw_frames_ctx
  11745. When using a hardware pixel format, this should be a reference to an
  11746. AVHWFramesContext describing input frames.
  11747. @end table
  11748. For example:
  11749. @example
  11750. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11751. @end example
  11752. will instruct the source to accept video frames with size 320x240 and
  11753. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11754. square pixels (1:1 sample aspect ratio).
  11755. Since the pixel format with name "yuv410p" corresponds to the number 6
  11756. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11757. this example corresponds to:
  11758. @example
  11759. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11760. @end example
  11761. Alternatively, the options can be specified as a flat string, but this
  11762. syntax is deprecated:
  11763. @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}]
  11764. @section cellauto
  11765. Create a pattern generated by an elementary cellular automaton.
  11766. The initial state of the cellular automaton can be defined through the
  11767. @option{filename} and @option{pattern} options. If such options are
  11768. not specified an initial state is created randomly.
  11769. At each new frame a new row in the video is filled with the result of
  11770. the cellular automaton next generation. The behavior when the whole
  11771. frame is filled is defined by the @option{scroll} option.
  11772. This source accepts the following options:
  11773. @table @option
  11774. @item filename, f
  11775. Read the initial cellular automaton state, i.e. the starting row, from
  11776. the specified file.
  11777. In the file, each non-whitespace character is considered an alive
  11778. cell, a newline will terminate the row, and further characters in the
  11779. file will be ignored.
  11780. @item pattern, p
  11781. Read the initial cellular automaton state, i.e. the starting row, from
  11782. the specified string.
  11783. Each non-whitespace character in the string is considered an alive
  11784. cell, a newline will terminate the row, and further characters in the
  11785. string will be ignored.
  11786. @item rate, r
  11787. Set the video rate, that is the number of frames generated per second.
  11788. Default is 25.
  11789. @item random_fill_ratio, ratio
  11790. Set the random fill ratio for the initial cellular automaton row. It
  11791. is a floating point number value ranging from 0 to 1, defaults to
  11792. 1/PHI.
  11793. This option is ignored when a file or a pattern is specified.
  11794. @item random_seed, seed
  11795. Set the seed for filling randomly the initial row, must be an integer
  11796. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11797. set to -1, the filter will try to use a good random seed on a best
  11798. effort basis.
  11799. @item rule
  11800. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11801. Default value is 110.
  11802. @item size, s
  11803. Set the size of the output video. For the syntax of this option, check the
  11804. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11805. If @option{filename} or @option{pattern} is specified, the size is set
  11806. by default to the width of the specified initial state row, and the
  11807. height is set to @var{width} * PHI.
  11808. If @option{size} is set, it must contain the width of the specified
  11809. pattern string, and the specified pattern will be centered in the
  11810. larger row.
  11811. If a filename or a pattern string is not specified, the size value
  11812. defaults to "320x518" (used for a randomly generated initial state).
  11813. @item scroll
  11814. If set to 1, scroll the output upward when all the rows in the output
  11815. have been already filled. If set to 0, the new generated row will be
  11816. written over the top row just after the bottom row is filled.
  11817. Defaults to 1.
  11818. @item start_full, full
  11819. If set to 1, completely fill the output with generated rows before
  11820. outputting the first frame.
  11821. This is the default behavior, for disabling set the value to 0.
  11822. @item stitch
  11823. If set to 1, stitch the left and right row edges together.
  11824. This is the default behavior, for disabling set the value to 0.
  11825. @end table
  11826. @subsection Examples
  11827. @itemize
  11828. @item
  11829. Read the initial state from @file{pattern}, and specify an output of
  11830. size 200x400.
  11831. @example
  11832. cellauto=f=pattern:s=200x400
  11833. @end example
  11834. @item
  11835. Generate a random initial row with a width of 200 cells, with a fill
  11836. ratio of 2/3:
  11837. @example
  11838. cellauto=ratio=2/3:s=200x200
  11839. @end example
  11840. @item
  11841. Create a pattern generated by rule 18 starting by a single alive cell
  11842. centered on an initial row with width 100:
  11843. @example
  11844. cellauto=p=@@:s=100x400:full=0:rule=18
  11845. @end example
  11846. @item
  11847. Specify a more elaborated initial pattern:
  11848. @example
  11849. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11850. @end example
  11851. @end itemize
  11852. @anchor{coreimagesrc}
  11853. @section coreimagesrc
  11854. Video source generated on GPU using Apple's CoreImage API on OSX.
  11855. This video source is a specialized version of the @ref{coreimage} video filter.
  11856. Use a core image generator at the beginning of the applied filterchain to
  11857. generate the content.
  11858. The coreimagesrc video source accepts the following options:
  11859. @table @option
  11860. @item list_generators
  11861. List all available generators along with all their respective options as well as
  11862. possible minimum and maximum values along with the default values.
  11863. @example
  11864. list_generators=true
  11865. @end example
  11866. @item size, s
  11867. Specify the size of the sourced video. For the syntax of this option, check the
  11868. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11869. The default value is @code{320x240}.
  11870. @item rate, r
  11871. Specify the frame rate of the sourced video, as the number of frames
  11872. generated per second. It has to be a string in the format
  11873. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11874. number or a valid video frame rate abbreviation. The default value is
  11875. "25".
  11876. @item sar
  11877. Set the sample aspect ratio of the sourced video.
  11878. @item duration, d
  11879. Set the duration of the sourced video. See
  11880. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11881. for the accepted syntax.
  11882. If not specified, or the expressed duration is negative, the video is
  11883. supposed to be generated forever.
  11884. @end table
  11885. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11886. A complete filterchain can be used for further processing of the
  11887. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11888. and examples for details.
  11889. @subsection Examples
  11890. @itemize
  11891. @item
  11892. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11893. given as complete and escaped command-line for Apple's standard bash shell:
  11894. @example
  11895. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11896. @end example
  11897. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11898. need for a nullsrc video source.
  11899. @end itemize
  11900. @section mandelbrot
  11901. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11902. point specified with @var{start_x} and @var{start_y}.
  11903. This source accepts the following options:
  11904. @table @option
  11905. @item end_pts
  11906. Set the terminal pts value. Default value is 400.
  11907. @item end_scale
  11908. Set the terminal scale value.
  11909. Must be a floating point value. Default value is 0.3.
  11910. @item inner
  11911. Set the inner coloring mode, that is the algorithm used to draw the
  11912. Mandelbrot fractal internal region.
  11913. It shall assume one of the following values:
  11914. @table @option
  11915. @item black
  11916. Set black mode.
  11917. @item convergence
  11918. Show time until convergence.
  11919. @item mincol
  11920. Set color based on point closest to the origin of the iterations.
  11921. @item period
  11922. Set period mode.
  11923. @end table
  11924. Default value is @var{mincol}.
  11925. @item bailout
  11926. Set the bailout value. Default value is 10.0.
  11927. @item maxiter
  11928. Set the maximum of iterations performed by the rendering
  11929. algorithm. Default value is 7189.
  11930. @item outer
  11931. Set outer coloring mode.
  11932. It shall assume one of following values:
  11933. @table @option
  11934. @item iteration_count
  11935. Set iteration cound mode.
  11936. @item normalized_iteration_count
  11937. set normalized iteration count mode.
  11938. @end table
  11939. Default value is @var{normalized_iteration_count}.
  11940. @item rate, r
  11941. Set frame rate, expressed as number of frames per second. Default
  11942. value is "25".
  11943. @item size, s
  11944. Set frame size. For the syntax of this option, check the "Video
  11945. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11946. @item start_scale
  11947. Set the initial scale value. Default value is 3.0.
  11948. @item start_x
  11949. Set the initial x position. Must be a floating point value between
  11950. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11951. @item start_y
  11952. Set the initial y position. Must be a floating point value between
  11953. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11954. @end table
  11955. @section mptestsrc
  11956. Generate various test patterns, as generated by the MPlayer test filter.
  11957. The size of the generated video is fixed, and is 256x256.
  11958. This source is useful in particular for testing encoding features.
  11959. This source accepts the following options:
  11960. @table @option
  11961. @item rate, r
  11962. Specify the frame rate of the sourced video, as the number of frames
  11963. generated per second. It has to be a string in the format
  11964. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11965. number or a valid video frame rate abbreviation. The default value is
  11966. "25".
  11967. @item duration, d
  11968. Set the duration of the sourced video. See
  11969. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11970. for the accepted syntax.
  11971. If not specified, or the expressed duration is negative, the video is
  11972. supposed to be generated forever.
  11973. @item test, t
  11974. Set the number or the name of the test to perform. Supported tests are:
  11975. @table @option
  11976. @item dc_luma
  11977. @item dc_chroma
  11978. @item freq_luma
  11979. @item freq_chroma
  11980. @item amp_luma
  11981. @item amp_chroma
  11982. @item cbp
  11983. @item mv
  11984. @item ring1
  11985. @item ring2
  11986. @item all
  11987. @end table
  11988. Default value is "all", which will cycle through the list of all tests.
  11989. @end table
  11990. Some examples:
  11991. @example
  11992. mptestsrc=t=dc_luma
  11993. @end example
  11994. will generate a "dc_luma" test pattern.
  11995. @section frei0r_src
  11996. Provide a frei0r source.
  11997. To enable compilation of this filter you need to install the frei0r
  11998. header and configure FFmpeg with @code{--enable-frei0r}.
  11999. This source accepts the following parameters:
  12000. @table @option
  12001. @item size
  12002. The size of the video to generate. For the syntax of this option, check the
  12003. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12004. @item framerate
  12005. The framerate of the generated video. It may be a string of the form
  12006. @var{num}/@var{den} or a frame rate abbreviation.
  12007. @item filter_name
  12008. The name to the frei0r source to load. For more information regarding frei0r and
  12009. how to set the parameters, read the @ref{frei0r} section in the video filters
  12010. documentation.
  12011. @item filter_params
  12012. A '|'-separated list of parameters to pass to the frei0r source.
  12013. @end table
  12014. For example, to generate a frei0r partik0l source with size 200x200
  12015. and frame rate 10 which is overlaid on the overlay filter main input:
  12016. @example
  12017. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12018. @end example
  12019. @section life
  12020. Generate a life pattern.
  12021. This source is based on a generalization of John Conway's life game.
  12022. The sourced input represents a life grid, each pixel represents a cell
  12023. which can be in one of two possible states, alive or dead. Every cell
  12024. interacts with its eight neighbours, which are the cells that are
  12025. horizontally, vertically, or diagonally adjacent.
  12026. At each interaction the grid evolves according to the adopted rule,
  12027. which specifies the number of neighbor alive cells which will make a
  12028. cell stay alive or born. The @option{rule} option allows one to specify
  12029. the rule to adopt.
  12030. This source accepts the following options:
  12031. @table @option
  12032. @item filename, f
  12033. Set the file from which to read the initial grid state. In the file,
  12034. each non-whitespace character is considered an alive cell, and newline
  12035. is used to delimit the end of each row.
  12036. If this option is not specified, the initial grid is generated
  12037. randomly.
  12038. @item rate, r
  12039. Set the video rate, that is the number of frames generated per second.
  12040. Default is 25.
  12041. @item random_fill_ratio, ratio
  12042. Set the random fill ratio for the initial random grid. It is a
  12043. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12044. It is ignored when a file is specified.
  12045. @item random_seed, seed
  12046. Set the seed for filling the initial random grid, must be an integer
  12047. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12048. set to -1, the filter will try to use a good random seed on a best
  12049. effort basis.
  12050. @item rule
  12051. Set the life rule.
  12052. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12053. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12054. @var{NS} specifies the number of alive neighbor cells which make a
  12055. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12056. which make a dead cell to become alive (i.e. to "born").
  12057. "s" and "b" can be used in place of "S" and "B", respectively.
  12058. Alternatively a rule can be specified by an 18-bits integer. The 9
  12059. high order bits are used to encode the next cell state if it is alive
  12060. for each number of neighbor alive cells, the low order bits specify
  12061. the rule for "borning" new cells. Higher order bits encode for an
  12062. higher number of neighbor cells.
  12063. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12064. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12065. Default value is "S23/B3", which is the original Conway's game of life
  12066. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12067. cells, and will born a new cell if there are three alive cells around
  12068. a dead cell.
  12069. @item size, s
  12070. Set the size of the output video. For the syntax of this option, check the
  12071. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12072. If @option{filename} is specified, the size is set by default to the
  12073. same size of the input file. If @option{size} is set, it must contain
  12074. the size specified in the input file, and the initial grid defined in
  12075. that file is centered in the larger resulting area.
  12076. If a filename is not specified, the size value defaults to "320x240"
  12077. (used for a randomly generated initial grid).
  12078. @item stitch
  12079. If set to 1, stitch the left and right grid edges together, and the
  12080. top and bottom edges also. Defaults to 1.
  12081. @item mold
  12082. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12083. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12084. value from 0 to 255.
  12085. @item life_color
  12086. Set the color of living (or new born) cells.
  12087. @item death_color
  12088. Set the color of dead cells. If @option{mold} is set, this is the first color
  12089. used to represent a dead cell.
  12090. @item mold_color
  12091. Set mold color, for definitely dead and moldy cells.
  12092. For the syntax of these 3 color options, check the "Color" section in the
  12093. ffmpeg-utils manual.
  12094. @end table
  12095. @subsection Examples
  12096. @itemize
  12097. @item
  12098. Read a grid from @file{pattern}, and center it on a grid of size
  12099. 300x300 pixels:
  12100. @example
  12101. life=f=pattern:s=300x300
  12102. @end example
  12103. @item
  12104. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12105. @example
  12106. life=ratio=2/3:s=200x200
  12107. @end example
  12108. @item
  12109. Specify a custom rule for evolving a randomly generated grid:
  12110. @example
  12111. life=rule=S14/B34
  12112. @end example
  12113. @item
  12114. Full example with slow death effect (mold) using @command{ffplay}:
  12115. @example
  12116. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12117. @end example
  12118. @end itemize
  12119. @anchor{allrgb}
  12120. @anchor{allyuv}
  12121. @anchor{color}
  12122. @anchor{haldclutsrc}
  12123. @anchor{nullsrc}
  12124. @anchor{rgbtestsrc}
  12125. @anchor{smptebars}
  12126. @anchor{smptehdbars}
  12127. @anchor{testsrc}
  12128. @anchor{testsrc2}
  12129. @anchor{yuvtestsrc}
  12130. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12131. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12132. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12133. The @code{color} source provides an uniformly colored input.
  12134. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12135. @ref{haldclut} filter.
  12136. The @code{nullsrc} source returns unprocessed video frames. It is
  12137. mainly useful to be employed in analysis / debugging tools, or as the
  12138. source for filters which ignore the input data.
  12139. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12140. detecting RGB vs BGR issues. You should see a red, green and blue
  12141. stripe from top to bottom.
  12142. The @code{smptebars} source generates a color bars pattern, based on
  12143. the SMPTE Engineering Guideline EG 1-1990.
  12144. The @code{smptehdbars} source generates a color bars pattern, based on
  12145. the SMPTE RP 219-2002.
  12146. The @code{testsrc} source generates a test video pattern, showing a
  12147. color pattern, a scrolling gradient and a timestamp. This is mainly
  12148. intended for testing purposes.
  12149. The @code{testsrc2} source is similar to testsrc, but supports more
  12150. pixel formats instead of just @code{rgb24}. This allows using it as an
  12151. input for other tests without requiring a format conversion.
  12152. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12153. see a y, cb and cr stripe from top to bottom.
  12154. The sources accept the following parameters:
  12155. @table @option
  12156. @item color, c
  12157. Specify the color of the source, only available in the @code{color}
  12158. source. For the syntax of this option, check the "Color" section in the
  12159. ffmpeg-utils manual.
  12160. @item level
  12161. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12162. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12163. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12164. coded on a @code{1/(N*N)} scale.
  12165. @item size, s
  12166. Specify the size of the sourced video. For the syntax of this option, check the
  12167. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12168. The default value is @code{320x240}.
  12169. This option is not available with the @code{haldclutsrc} filter.
  12170. @item rate, r
  12171. Specify the frame rate of the sourced video, as the number of frames
  12172. generated per second. It has to be a string in the format
  12173. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12174. number or a valid video frame rate abbreviation. The default value is
  12175. "25".
  12176. @item sar
  12177. Set the sample aspect ratio of the sourced video.
  12178. @item duration, d
  12179. Set the duration of the sourced video. See
  12180. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12181. for the accepted syntax.
  12182. If not specified, or the expressed duration is negative, the video is
  12183. supposed to be generated forever.
  12184. @item decimals, n
  12185. Set the number of decimals to show in the timestamp, only available in the
  12186. @code{testsrc} source.
  12187. The displayed timestamp value will correspond to the original
  12188. timestamp value multiplied by the power of 10 of the specified
  12189. value. Default value is 0.
  12190. @end table
  12191. For example the following:
  12192. @example
  12193. testsrc=duration=5.3:size=qcif:rate=10
  12194. @end example
  12195. will generate a video with a duration of 5.3 seconds, with size
  12196. 176x144 and a frame rate of 10 frames per second.
  12197. The following graph description will generate a red source
  12198. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12199. frames per second.
  12200. @example
  12201. color=c=red@@0.2:s=qcif:r=10
  12202. @end example
  12203. If the input content is to be ignored, @code{nullsrc} can be used. The
  12204. following command generates noise in the luminance plane by employing
  12205. the @code{geq} filter:
  12206. @example
  12207. nullsrc=s=256x256, geq=random(1)*255:128:128
  12208. @end example
  12209. @subsection Commands
  12210. The @code{color} source supports the following commands:
  12211. @table @option
  12212. @item c, color
  12213. Set the color of the created image. Accepts the same syntax of the
  12214. corresponding @option{color} option.
  12215. @end table
  12216. @c man end VIDEO SOURCES
  12217. @chapter Video Sinks
  12218. @c man begin VIDEO SINKS
  12219. Below is a description of the currently available video sinks.
  12220. @section buffersink
  12221. Buffer video frames, and make them available to the end of the filter
  12222. graph.
  12223. This sink is mainly intended for programmatic use, in particular
  12224. through the interface defined in @file{libavfilter/buffersink.h}
  12225. or the options system.
  12226. It accepts a pointer to an AVBufferSinkContext structure, which
  12227. defines the incoming buffers' formats, to be passed as the opaque
  12228. parameter to @code{avfilter_init_filter} for initialization.
  12229. @section nullsink
  12230. Null video sink: do absolutely nothing with the input video. It is
  12231. mainly useful as a template and for use in analysis / debugging
  12232. tools.
  12233. @c man end VIDEO SINKS
  12234. @chapter Multimedia Filters
  12235. @c man begin MULTIMEDIA FILTERS
  12236. Below is a description of the currently available multimedia filters.
  12237. @section abitscope
  12238. Convert input audio to a video output, displaying the audio bit scope.
  12239. The filter accepts the following options:
  12240. @table @option
  12241. @item rate, r
  12242. Set frame rate, expressed as number of frames per second. Default
  12243. value is "25".
  12244. @item size, s
  12245. Specify the video size for the output. For the syntax of this option, check the
  12246. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12247. Default value is @code{1024x256}.
  12248. @item colors
  12249. Specify list of colors separated by space or by '|' which will be used to
  12250. draw channels. Unrecognized or missing colors will be replaced
  12251. by white color.
  12252. @end table
  12253. @section ahistogram
  12254. Convert input audio to a video output, displaying the volume histogram.
  12255. The filter accepts the following options:
  12256. @table @option
  12257. @item dmode
  12258. Specify how histogram is calculated.
  12259. It accepts the following values:
  12260. @table @samp
  12261. @item single
  12262. Use single histogram for all channels.
  12263. @item separate
  12264. Use separate histogram for each channel.
  12265. @end table
  12266. Default is @code{single}.
  12267. @item rate, r
  12268. Set frame rate, expressed as number of frames per second. Default
  12269. value is "25".
  12270. @item size, s
  12271. Specify the video size for the output. For the syntax of this option, check the
  12272. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12273. Default value is @code{hd720}.
  12274. @item scale
  12275. Set display scale.
  12276. It accepts the following values:
  12277. @table @samp
  12278. @item log
  12279. logarithmic
  12280. @item sqrt
  12281. square root
  12282. @item cbrt
  12283. cubic root
  12284. @item lin
  12285. linear
  12286. @item rlog
  12287. reverse logarithmic
  12288. @end table
  12289. Default is @code{log}.
  12290. @item ascale
  12291. Set amplitude scale.
  12292. It accepts the following values:
  12293. @table @samp
  12294. @item log
  12295. logarithmic
  12296. @item lin
  12297. linear
  12298. @end table
  12299. Default is @code{log}.
  12300. @item acount
  12301. Set how much frames to accumulate in histogram.
  12302. Defauls is 1. Setting this to -1 accumulates all frames.
  12303. @item rheight
  12304. Set histogram ratio of window height.
  12305. @item slide
  12306. Set sonogram sliding.
  12307. It accepts the following values:
  12308. @table @samp
  12309. @item replace
  12310. replace old rows with new ones.
  12311. @item scroll
  12312. scroll from top to bottom.
  12313. @end table
  12314. Default is @code{replace}.
  12315. @end table
  12316. @section aphasemeter
  12317. Convert input audio to a video output, displaying the audio phase.
  12318. The filter accepts the following options:
  12319. @table @option
  12320. @item rate, r
  12321. Set the output frame rate. Default value is @code{25}.
  12322. @item size, s
  12323. Set the video size for the output. For the syntax of this option, check the
  12324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12325. Default value is @code{800x400}.
  12326. @item rc
  12327. @item gc
  12328. @item bc
  12329. Specify the red, green, blue contrast. Default values are @code{2},
  12330. @code{7} and @code{1}.
  12331. Allowed range is @code{[0, 255]}.
  12332. @item mpc
  12333. Set color which will be used for drawing median phase. If color is
  12334. @code{none} which is default, no median phase value will be drawn.
  12335. @item video
  12336. Enable video output. Default is enabled.
  12337. @end table
  12338. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12339. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12340. The @code{-1} means left and right channels are completely out of phase and
  12341. @code{1} means channels are in phase.
  12342. @section avectorscope
  12343. Convert input audio to a video output, representing the audio vector
  12344. scope.
  12345. The filter is used to measure the difference between channels of stereo
  12346. audio stream. A monoaural signal, consisting of identical left and right
  12347. signal, results in straight vertical line. Any stereo separation is visible
  12348. as a deviation from this line, creating a Lissajous figure.
  12349. If the straight (or deviation from it) but horizontal line appears this
  12350. indicates that the left and right channels are out of phase.
  12351. The filter accepts the following options:
  12352. @table @option
  12353. @item mode, m
  12354. Set the vectorscope mode.
  12355. Available values are:
  12356. @table @samp
  12357. @item lissajous
  12358. Lissajous rotated by 45 degrees.
  12359. @item lissajous_xy
  12360. Same as above but not rotated.
  12361. @item polar
  12362. Shape resembling half of circle.
  12363. @end table
  12364. Default value is @samp{lissajous}.
  12365. @item size, s
  12366. Set the video size for the output. For the syntax of this option, check the
  12367. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12368. Default value is @code{400x400}.
  12369. @item rate, r
  12370. Set the output frame rate. Default value is @code{25}.
  12371. @item rc
  12372. @item gc
  12373. @item bc
  12374. @item ac
  12375. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12376. @code{160}, @code{80} and @code{255}.
  12377. Allowed range is @code{[0, 255]}.
  12378. @item rf
  12379. @item gf
  12380. @item bf
  12381. @item af
  12382. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12383. @code{10}, @code{5} and @code{5}.
  12384. Allowed range is @code{[0, 255]}.
  12385. @item zoom
  12386. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12387. @item draw
  12388. Set the vectorscope drawing mode.
  12389. Available values are:
  12390. @table @samp
  12391. @item dot
  12392. Draw dot for each sample.
  12393. @item line
  12394. Draw line between previous and current sample.
  12395. @end table
  12396. Default value is @samp{dot}.
  12397. @item scale
  12398. Specify amplitude scale of audio samples.
  12399. Available values are:
  12400. @table @samp
  12401. @item lin
  12402. Linear.
  12403. @item sqrt
  12404. Square root.
  12405. @item cbrt
  12406. Cubic root.
  12407. @item log
  12408. Logarithmic.
  12409. @end table
  12410. @end table
  12411. @subsection Examples
  12412. @itemize
  12413. @item
  12414. Complete example using @command{ffplay}:
  12415. @example
  12416. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12417. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12418. @end example
  12419. @end itemize
  12420. @section bench, abench
  12421. Benchmark part of a filtergraph.
  12422. The filter accepts the following options:
  12423. @table @option
  12424. @item action
  12425. Start or stop a timer.
  12426. Available values are:
  12427. @table @samp
  12428. @item start
  12429. Get the current time, set it as frame metadata (using the key
  12430. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12431. @item stop
  12432. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12433. the input frame metadata to get the time difference. Time difference, average,
  12434. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12435. @code{min}) are then printed. The timestamps are expressed in seconds.
  12436. @end table
  12437. @end table
  12438. @subsection Examples
  12439. @itemize
  12440. @item
  12441. Benchmark @ref{selectivecolor} filter:
  12442. @example
  12443. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12444. @end example
  12445. @end itemize
  12446. @section concat
  12447. Concatenate audio and video streams, joining them together one after the
  12448. other.
  12449. The filter works on segments of synchronized video and audio streams. All
  12450. segments must have the same number of streams of each type, and that will
  12451. also be the number of streams at output.
  12452. The filter accepts the following options:
  12453. @table @option
  12454. @item n
  12455. Set the number of segments. Default is 2.
  12456. @item v
  12457. Set the number of output video streams, that is also the number of video
  12458. streams in each segment. Default is 1.
  12459. @item a
  12460. Set the number of output audio streams, that is also the number of audio
  12461. streams in each segment. Default is 0.
  12462. @item unsafe
  12463. Activate unsafe mode: do not fail if segments have a different format.
  12464. @end table
  12465. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12466. @var{a} audio outputs.
  12467. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12468. segment, in the same order as the outputs, then the inputs for the second
  12469. segment, etc.
  12470. Related streams do not always have exactly the same duration, for various
  12471. reasons including codec frame size or sloppy authoring. For that reason,
  12472. related synchronized streams (e.g. a video and its audio track) should be
  12473. concatenated at once. The concat filter will use the duration of the longest
  12474. stream in each segment (except the last one), and if necessary pad shorter
  12475. audio streams with silence.
  12476. For this filter to work correctly, all segments must start at timestamp 0.
  12477. All corresponding streams must have the same parameters in all segments; the
  12478. filtering system will automatically select a common pixel format for video
  12479. streams, and a common sample format, sample rate and channel layout for
  12480. audio streams, but other settings, such as resolution, must be converted
  12481. explicitly by the user.
  12482. Different frame rates are acceptable but will result in variable frame rate
  12483. at output; be sure to configure the output file to handle it.
  12484. @subsection Examples
  12485. @itemize
  12486. @item
  12487. Concatenate an opening, an episode and an ending, all in bilingual version
  12488. (video in stream 0, audio in streams 1 and 2):
  12489. @example
  12490. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12491. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12492. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12493. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12494. @end example
  12495. @item
  12496. Concatenate two parts, handling audio and video separately, using the
  12497. (a)movie sources, and adjusting the resolution:
  12498. @example
  12499. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12500. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12501. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12502. @end example
  12503. Note that a desync will happen at the stitch if the audio and video streams
  12504. do not have exactly the same duration in the first file.
  12505. @end itemize
  12506. @section drawgraph, adrawgraph
  12507. Draw a graph using input video or audio metadata.
  12508. It accepts the following parameters:
  12509. @table @option
  12510. @item m1
  12511. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12512. @item fg1
  12513. Set 1st foreground color expression.
  12514. @item m2
  12515. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12516. @item fg2
  12517. Set 2nd foreground color expression.
  12518. @item m3
  12519. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12520. @item fg3
  12521. Set 3rd foreground color expression.
  12522. @item m4
  12523. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12524. @item fg4
  12525. Set 4th foreground color expression.
  12526. @item min
  12527. Set minimal value of metadata value.
  12528. @item max
  12529. Set maximal value of metadata value.
  12530. @item bg
  12531. Set graph background color. Default is white.
  12532. @item mode
  12533. Set graph mode.
  12534. Available values for mode is:
  12535. @table @samp
  12536. @item bar
  12537. @item dot
  12538. @item line
  12539. @end table
  12540. Default is @code{line}.
  12541. @item slide
  12542. Set slide mode.
  12543. Available values for slide is:
  12544. @table @samp
  12545. @item frame
  12546. Draw new frame when right border is reached.
  12547. @item replace
  12548. Replace old columns with new ones.
  12549. @item scroll
  12550. Scroll from right to left.
  12551. @item rscroll
  12552. Scroll from left to right.
  12553. @item picture
  12554. Draw single picture.
  12555. @end table
  12556. Default is @code{frame}.
  12557. @item size
  12558. Set size of graph video. For the syntax of this option, check the
  12559. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12560. The default value is @code{900x256}.
  12561. The foreground color expressions can use the following variables:
  12562. @table @option
  12563. @item MIN
  12564. Minimal value of metadata value.
  12565. @item MAX
  12566. Maximal value of metadata value.
  12567. @item VAL
  12568. Current metadata key value.
  12569. @end table
  12570. The color is defined as 0xAABBGGRR.
  12571. @end table
  12572. Example using metadata from @ref{signalstats} filter:
  12573. @example
  12574. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12575. @end example
  12576. Example using metadata from @ref{ebur128} filter:
  12577. @example
  12578. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12579. @end example
  12580. @anchor{ebur128}
  12581. @section ebur128
  12582. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12583. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12584. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12585. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12586. The filter also has a video output (see the @var{video} option) with a real
  12587. time graph to observe the loudness evolution. The graphic contains the logged
  12588. message mentioned above, so it is not printed anymore when this option is set,
  12589. unless the verbose logging is set. The main graphing area contains the
  12590. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12591. the momentary loudness (400 milliseconds).
  12592. More information about the Loudness Recommendation EBU R128 on
  12593. @url{http://tech.ebu.ch/loudness}.
  12594. The filter accepts the following options:
  12595. @table @option
  12596. @item video
  12597. Activate the video output. The audio stream is passed unchanged whether this
  12598. option is set or no. The video stream will be the first output stream if
  12599. activated. Default is @code{0}.
  12600. @item size
  12601. Set the video size. This option is for video only. For the syntax of this
  12602. option, check the
  12603. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12604. Default and minimum resolution is @code{640x480}.
  12605. @item meter
  12606. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12607. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12608. other integer value between this range is allowed.
  12609. @item metadata
  12610. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12611. into 100ms output frames, each of them containing various loudness information
  12612. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12613. Default is @code{0}.
  12614. @item framelog
  12615. Force the frame logging level.
  12616. Available values are:
  12617. @table @samp
  12618. @item info
  12619. information logging level
  12620. @item verbose
  12621. verbose logging level
  12622. @end table
  12623. By default, the logging level is set to @var{info}. If the @option{video} or
  12624. the @option{metadata} options are set, it switches to @var{verbose}.
  12625. @item peak
  12626. Set peak mode(s).
  12627. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12628. values are:
  12629. @table @samp
  12630. @item none
  12631. Disable any peak mode (default).
  12632. @item sample
  12633. Enable sample-peak mode.
  12634. Simple peak mode looking for the higher sample value. It logs a message
  12635. for sample-peak (identified by @code{SPK}).
  12636. @item true
  12637. Enable true-peak mode.
  12638. If enabled, the peak lookup is done on an over-sampled version of the input
  12639. stream for better peak accuracy. It logs a message for true-peak.
  12640. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12641. This mode requires a build with @code{libswresample}.
  12642. @end table
  12643. @item dualmono
  12644. Treat mono input files as "dual mono". If a mono file is intended for playback
  12645. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12646. If set to @code{true}, this option will compensate for this effect.
  12647. Multi-channel input files are not affected by this option.
  12648. @item panlaw
  12649. Set a specific pan law to be used for the measurement of dual mono files.
  12650. This parameter is optional, and has a default value of -3.01dB.
  12651. @end table
  12652. @subsection Examples
  12653. @itemize
  12654. @item
  12655. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12656. @example
  12657. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12658. @end example
  12659. @item
  12660. Run an analysis with @command{ffmpeg}:
  12661. @example
  12662. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12663. @end example
  12664. @end itemize
  12665. @section interleave, ainterleave
  12666. Temporally interleave frames from several inputs.
  12667. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12668. These filters read frames from several inputs and send the oldest
  12669. queued frame to the output.
  12670. Input streams must have well defined, monotonically increasing frame
  12671. timestamp values.
  12672. In order to submit one frame to output, these filters need to enqueue
  12673. at least one frame for each input, so they cannot work in case one
  12674. input is not yet terminated and will not receive incoming frames.
  12675. For example consider the case when one input is a @code{select} filter
  12676. which always drops input frames. The @code{interleave} filter will keep
  12677. reading from that input, but it will never be able to send new frames
  12678. to output until the input sends an end-of-stream signal.
  12679. Also, depending on inputs synchronization, the filters will drop
  12680. frames in case one input receives more frames than the other ones, and
  12681. the queue is already filled.
  12682. These filters accept the following options:
  12683. @table @option
  12684. @item nb_inputs, n
  12685. Set the number of different inputs, it is 2 by default.
  12686. @end table
  12687. @subsection Examples
  12688. @itemize
  12689. @item
  12690. Interleave frames belonging to different streams using @command{ffmpeg}:
  12691. @example
  12692. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12693. @end example
  12694. @item
  12695. Add flickering blur effect:
  12696. @example
  12697. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12698. @end example
  12699. @end itemize
  12700. @section metadata, ametadata
  12701. Manipulate frame metadata.
  12702. This filter accepts the following options:
  12703. @table @option
  12704. @item mode
  12705. Set mode of operation of the filter.
  12706. Can be one of the following:
  12707. @table @samp
  12708. @item select
  12709. If both @code{value} and @code{key} is set, select frames
  12710. which have such metadata. If only @code{key} is set, select
  12711. every frame that has such key in metadata.
  12712. @item add
  12713. Add new metadata @code{key} and @code{value}. If key is already available
  12714. do nothing.
  12715. @item modify
  12716. Modify value of already present key.
  12717. @item delete
  12718. If @code{value} is set, delete only keys that have such value.
  12719. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12720. the frame.
  12721. @item print
  12722. Print key and its value if metadata was found. If @code{key} is not set print all
  12723. metadata values available in frame.
  12724. @end table
  12725. @item key
  12726. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12727. @item value
  12728. Set metadata value which will be used. This option is mandatory for
  12729. @code{modify} and @code{add} mode.
  12730. @item function
  12731. Which function to use when comparing metadata value and @code{value}.
  12732. Can be one of following:
  12733. @table @samp
  12734. @item same_str
  12735. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12736. @item starts_with
  12737. Values are interpreted as strings, returns true if metadata value starts with
  12738. the @code{value} option string.
  12739. @item less
  12740. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12741. @item equal
  12742. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12743. @item greater
  12744. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12745. @item expr
  12746. Values are interpreted as floats, returns true if expression from option @code{expr}
  12747. evaluates to true.
  12748. @end table
  12749. @item expr
  12750. Set expression which is used when @code{function} is set to @code{expr}.
  12751. The expression is evaluated through the eval API and can contain the following
  12752. constants:
  12753. @table @option
  12754. @item VALUE1
  12755. Float representation of @code{value} from metadata key.
  12756. @item VALUE2
  12757. Float representation of @code{value} as supplied by user in @code{value} option.
  12758. @end table
  12759. @item file
  12760. If specified in @code{print} mode, output is written to the named file. Instead of
  12761. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12762. for standard output. If @code{file} option is not set, output is written to the log
  12763. with AV_LOG_INFO loglevel.
  12764. @end table
  12765. @subsection Examples
  12766. @itemize
  12767. @item
  12768. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12769. between 0 and 1.
  12770. @example
  12771. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12772. @end example
  12773. @item
  12774. Print silencedetect output to file @file{metadata.txt}.
  12775. @example
  12776. silencedetect,ametadata=mode=print:file=metadata.txt
  12777. @end example
  12778. @item
  12779. Direct all metadata to a pipe with file descriptor 4.
  12780. @example
  12781. metadata=mode=print:file='pipe\:4'
  12782. @end example
  12783. @end itemize
  12784. @section perms, aperms
  12785. Set read/write permissions for the output frames.
  12786. These filters are mainly aimed at developers to test direct path in the
  12787. following filter in the filtergraph.
  12788. The filters accept the following options:
  12789. @table @option
  12790. @item mode
  12791. Select the permissions mode.
  12792. It accepts the following values:
  12793. @table @samp
  12794. @item none
  12795. Do nothing. This is the default.
  12796. @item ro
  12797. Set all the output frames read-only.
  12798. @item rw
  12799. Set all the output frames directly writable.
  12800. @item toggle
  12801. Make the frame read-only if writable, and writable if read-only.
  12802. @item random
  12803. Set each output frame read-only or writable randomly.
  12804. @end table
  12805. @item seed
  12806. Set the seed for the @var{random} mode, must be an integer included between
  12807. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12808. @code{-1}, the filter will try to use a good random seed on a best effort
  12809. basis.
  12810. @end table
  12811. Note: in case of auto-inserted filter between the permission filter and the
  12812. following one, the permission might not be received as expected in that
  12813. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12814. perms/aperms filter can avoid this problem.
  12815. @section realtime, arealtime
  12816. Slow down filtering to match real time approximatively.
  12817. These filters will pause the filtering for a variable amount of time to
  12818. match the output rate with the input timestamps.
  12819. They are similar to the @option{re} option to @code{ffmpeg}.
  12820. They accept the following options:
  12821. @table @option
  12822. @item limit
  12823. Time limit for the pauses. Any pause longer than that will be considered
  12824. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12825. @end table
  12826. @anchor{select}
  12827. @section select, aselect
  12828. Select frames to pass in output.
  12829. This filter accepts the following options:
  12830. @table @option
  12831. @item expr, e
  12832. Set expression, which is evaluated for each input frame.
  12833. If the expression is evaluated to zero, the frame is discarded.
  12834. If the evaluation result is negative or NaN, the frame is sent to the
  12835. first output; otherwise it is sent to the output with index
  12836. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12837. For example a value of @code{1.2} corresponds to the output with index
  12838. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12839. @item outputs, n
  12840. Set the number of outputs. The output to which to send the selected
  12841. frame is based on the result of the evaluation. Default value is 1.
  12842. @end table
  12843. The expression can contain the following constants:
  12844. @table @option
  12845. @item n
  12846. The (sequential) number of the filtered frame, starting from 0.
  12847. @item selected_n
  12848. The (sequential) number of the selected frame, starting from 0.
  12849. @item prev_selected_n
  12850. The sequential number of the last selected frame. It's NAN if undefined.
  12851. @item TB
  12852. The timebase of the input timestamps.
  12853. @item pts
  12854. The PTS (Presentation TimeStamp) of the filtered video frame,
  12855. expressed in @var{TB} units. It's NAN if undefined.
  12856. @item t
  12857. The PTS of the filtered video frame,
  12858. expressed in seconds. It's NAN if undefined.
  12859. @item prev_pts
  12860. The PTS of the previously filtered video frame. It's NAN if undefined.
  12861. @item prev_selected_pts
  12862. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12863. @item prev_selected_t
  12864. The PTS of the last previously selected video frame. It's NAN if undefined.
  12865. @item start_pts
  12866. The PTS of the first video frame in the video. It's NAN if undefined.
  12867. @item start_t
  12868. The time of the first video frame in the video. It's NAN if undefined.
  12869. @item pict_type @emph{(video only)}
  12870. The type of the filtered frame. It can assume one of the following
  12871. values:
  12872. @table @option
  12873. @item I
  12874. @item P
  12875. @item B
  12876. @item S
  12877. @item SI
  12878. @item SP
  12879. @item BI
  12880. @end table
  12881. @item interlace_type @emph{(video only)}
  12882. The frame interlace type. It can assume one of the following values:
  12883. @table @option
  12884. @item PROGRESSIVE
  12885. The frame is progressive (not interlaced).
  12886. @item TOPFIRST
  12887. The frame is top-field-first.
  12888. @item BOTTOMFIRST
  12889. The frame is bottom-field-first.
  12890. @end table
  12891. @item consumed_sample_n @emph{(audio only)}
  12892. the number of selected samples before the current frame
  12893. @item samples_n @emph{(audio only)}
  12894. the number of samples in the current frame
  12895. @item sample_rate @emph{(audio only)}
  12896. the input sample rate
  12897. @item key
  12898. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12899. @item pos
  12900. the position in the file of the filtered frame, -1 if the information
  12901. is not available (e.g. for synthetic video)
  12902. @item scene @emph{(video only)}
  12903. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12904. probability for the current frame to introduce a new scene, while a higher
  12905. value means the current frame is more likely to be one (see the example below)
  12906. @item concatdec_select
  12907. The concat demuxer can select only part of a concat input file by setting an
  12908. inpoint and an outpoint, but the output packets may not be entirely contained
  12909. in the selected interval. By using this variable, it is possible to skip frames
  12910. generated by the concat demuxer which are not exactly contained in the selected
  12911. interval.
  12912. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12913. and the @var{lavf.concat.duration} packet metadata values which are also
  12914. present in the decoded frames.
  12915. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12916. start_time and either the duration metadata is missing or the frame pts is less
  12917. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12918. missing.
  12919. That basically means that an input frame is selected if its pts is within the
  12920. interval set by the concat demuxer.
  12921. @end table
  12922. The default value of the select expression is "1".
  12923. @subsection Examples
  12924. @itemize
  12925. @item
  12926. Select all frames in input:
  12927. @example
  12928. select
  12929. @end example
  12930. The example above is the same as:
  12931. @example
  12932. select=1
  12933. @end example
  12934. @item
  12935. Skip all frames:
  12936. @example
  12937. select=0
  12938. @end example
  12939. @item
  12940. Select only I-frames:
  12941. @example
  12942. select='eq(pict_type\,I)'
  12943. @end example
  12944. @item
  12945. Select one frame every 100:
  12946. @example
  12947. select='not(mod(n\,100))'
  12948. @end example
  12949. @item
  12950. Select only frames contained in the 10-20 time interval:
  12951. @example
  12952. select=between(t\,10\,20)
  12953. @end example
  12954. @item
  12955. Select only I-frames contained in the 10-20 time interval:
  12956. @example
  12957. select=between(t\,10\,20)*eq(pict_type\,I)
  12958. @end example
  12959. @item
  12960. Select frames with a minimum distance of 10 seconds:
  12961. @example
  12962. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12963. @end example
  12964. @item
  12965. Use aselect to select only audio frames with samples number > 100:
  12966. @example
  12967. aselect='gt(samples_n\,100)'
  12968. @end example
  12969. @item
  12970. Create a mosaic of the first scenes:
  12971. @example
  12972. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12973. @end example
  12974. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12975. choice.
  12976. @item
  12977. Send even and odd frames to separate outputs, and compose them:
  12978. @example
  12979. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12980. @end example
  12981. @item
  12982. Select useful frames from an ffconcat file which is using inpoints and
  12983. outpoints but where the source files are not intra frame only.
  12984. @example
  12985. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12986. @end example
  12987. @end itemize
  12988. @section sendcmd, asendcmd
  12989. Send commands to filters in the filtergraph.
  12990. These filters read commands to be sent to other filters in the
  12991. filtergraph.
  12992. @code{sendcmd} must be inserted between two video filters,
  12993. @code{asendcmd} must be inserted between two audio filters, but apart
  12994. from that they act the same way.
  12995. The specification of commands can be provided in the filter arguments
  12996. with the @var{commands} option, or in a file specified by the
  12997. @var{filename} option.
  12998. These filters accept the following options:
  12999. @table @option
  13000. @item commands, c
  13001. Set the commands to be read and sent to the other filters.
  13002. @item filename, f
  13003. Set the filename of the commands to be read and sent to the other
  13004. filters.
  13005. @end table
  13006. @subsection Commands syntax
  13007. A commands description consists of a sequence of interval
  13008. specifications, comprising a list of commands to be executed when a
  13009. particular event related to that interval occurs. The occurring event
  13010. is typically the current frame time entering or leaving a given time
  13011. interval.
  13012. An interval is specified by the following syntax:
  13013. @example
  13014. @var{START}[-@var{END}] @var{COMMANDS};
  13015. @end example
  13016. The time interval is specified by the @var{START} and @var{END} times.
  13017. @var{END} is optional and defaults to the maximum time.
  13018. The current frame time is considered within the specified interval if
  13019. it is included in the interval [@var{START}, @var{END}), that is when
  13020. the time is greater or equal to @var{START} and is lesser than
  13021. @var{END}.
  13022. @var{COMMANDS} consists of a sequence of one or more command
  13023. specifications, separated by ",", relating to that interval. The
  13024. syntax of a command specification is given by:
  13025. @example
  13026. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13027. @end example
  13028. @var{FLAGS} is optional and specifies the type of events relating to
  13029. the time interval which enable sending the specified command, and must
  13030. be a non-null sequence of identifier flags separated by "+" or "|" and
  13031. enclosed between "[" and "]".
  13032. The following flags are recognized:
  13033. @table @option
  13034. @item enter
  13035. The command is sent when the current frame timestamp enters the
  13036. specified interval. In other words, the command is sent when the
  13037. previous frame timestamp was not in the given interval, and the
  13038. current is.
  13039. @item leave
  13040. The command is sent when the current frame timestamp leaves the
  13041. specified interval. In other words, the command is sent when the
  13042. previous frame timestamp was in the given interval, and the
  13043. current is not.
  13044. @end table
  13045. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13046. assumed.
  13047. @var{TARGET} specifies the target of the command, usually the name of
  13048. the filter class or a specific filter instance name.
  13049. @var{COMMAND} specifies the name of the command for the target filter.
  13050. @var{ARG} is optional and specifies the optional list of argument for
  13051. the given @var{COMMAND}.
  13052. Between one interval specification and another, whitespaces, or
  13053. sequences of characters starting with @code{#} until the end of line,
  13054. are ignored and can be used to annotate comments.
  13055. A simplified BNF description of the commands specification syntax
  13056. follows:
  13057. @example
  13058. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13059. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13060. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13061. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13062. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13063. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13064. @end example
  13065. @subsection Examples
  13066. @itemize
  13067. @item
  13068. Specify audio tempo change at second 4:
  13069. @example
  13070. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13071. @end example
  13072. @item
  13073. Specify a list of drawtext and hue commands in a file.
  13074. @example
  13075. # show text in the interval 5-10
  13076. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13077. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13078. # desaturate the image in the interval 15-20
  13079. 15.0-20.0 [enter] hue s 0,
  13080. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13081. [leave] hue s 1,
  13082. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13083. # apply an exponential saturation fade-out effect, starting from time 25
  13084. 25 [enter] hue s exp(25-t)
  13085. @end example
  13086. A filtergraph allowing to read and process the above command list
  13087. stored in a file @file{test.cmd}, can be specified with:
  13088. @example
  13089. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13090. @end example
  13091. @end itemize
  13092. @anchor{setpts}
  13093. @section setpts, asetpts
  13094. Change the PTS (presentation timestamp) of the input frames.
  13095. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13096. This filter accepts the following options:
  13097. @table @option
  13098. @item expr
  13099. The expression which is evaluated for each frame to construct its timestamp.
  13100. @end table
  13101. The expression is evaluated through the eval API and can contain the following
  13102. constants:
  13103. @table @option
  13104. @item FRAME_RATE
  13105. frame rate, only defined for constant frame-rate video
  13106. @item PTS
  13107. The presentation timestamp in input
  13108. @item N
  13109. The count of the input frame for video or the number of consumed samples,
  13110. not including the current frame for audio, starting from 0.
  13111. @item NB_CONSUMED_SAMPLES
  13112. The number of consumed samples, not including the current frame (only
  13113. audio)
  13114. @item NB_SAMPLES, S
  13115. The number of samples in the current frame (only audio)
  13116. @item SAMPLE_RATE, SR
  13117. The audio sample rate.
  13118. @item STARTPTS
  13119. The PTS of the first frame.
  13120. @item STARTT
  13121. the time in seconds of the first frame
  13122. @item INTERLACED
  13123. State whether the current frame is interlaced.
  13124. @item T
  13125. the time in seconds of the current frame
  13126. @item POS
  13127. original position in the file of the frame, or undefined if undefined
  13128. for the current frame
  13129. @item PREV_INPTS
  13130. The previous input PTS.
  13131. @item PREV_INT
  13132. previous input time in seconds
  13133. @item PREV_OUTPTS
  13134. The previous output PTS.
  13135. @item PREV_OUTT
  13136. previous output time in seconds
  13137. @item RTCTIME
  13138. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13139. instead.
  13140. @item RTCSTART
  13141. The wallclock (RTC) time at the start of the movie in microseconds.
  13142. @item TB
  13143. The timebase of the input timestamps.
  13144. @end table
  13145. @subsection Examples
  13146. @itemize
  13147. @item
  13148. Start counting PTS from zero
  13149. @example
  13150. setpts=PTS-STARTPTS
  13151. @end example
  13152. @item
  13153. Apply fast motion effect:
  13154. @example
  13155. setpts=0.5*PTS
  13156. @end example
  13157. @item
  13158. Apply slow motion effect:
  13159. @example
  13160. setpts=2.0*PTS
  13161. @end example
  13162. @item
  13163. Set fixed rate of 25 frames per second:
  13164. @example
  13165. setpts=N/(25*TB)
  13166. @end example
  13167. @item
  13168. Set fixed rate 25 fps with some jitter:
  13169. @example
  13170. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13171. @end example
  13172. @item
  13173. Apply an offset of 10 seconds to the input PTS:
  13174. @example
  13175. setpts=PTS+10/TB
  13176. @end example
  13177. @item
  13178. Generate timestamps from a "live source" and rebase onto the current timebase:
  13179. @example
  13180. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13181. @end example
  13182. @item
  13183. Generate timestamps by counting samples:
  13184. @example
  13185. asetpts=N/SR/TB
  13186. @end example
  13187. @end itemize
  13188. @section settb, asettb
  13189. Set the timebase to use for the output frames timestamps.
  13190. It is mainly useful for testing timebase configuration.
  13191. It accepts the following parameters:
  13192. @table @option
  13193. @item expr, tb
  13194. The expression which is evaluated into the output timebase.
  13195. @end table
  13196. The value for @option{tb} is an arithmetic expression representing a
  13197. rational. The expression can contain the constants "AVTB" (the default
  13198. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13199. audio only). Default value is "intb".
  13200. @subsection Examples
  13201. @itemize
  13202. @item
  13203. Set the timebase to 1/25:
  13204. @example
  13205. settb=expr=1/25
  13206. @end example
  13207. @item
  13208. Set the timebase to 1/10:
  13209. @example
  13210. settb=expr=0.1
  13211. @end example
  13212. @item
  13213. Set the timebase to 1001/1000:
  13214. @example
  13215. settb=1+0.001
  13216. @end example
  13217. @item
  13218. Set the timebase to 2*intb:
  13219. @example
  13220. settb=2*intb
  13221. @end example
  13222. @item
  13223. Set the default timebase value:
  13224. @example
  13225. settb=AVTB
  13226. @end example
  13227. @end itemize
  13228. @section showcqt
  13229. Convert input audio to a video output representing frequency spectrum
  13230. logarithmically using Brown-Puckette constant Q transform algorithm with
  13231. direct frequency domain coefficient calculation (but the transform itself
  13232. is not really constant Q, instead the Q factor is actually variable/clamped),
  13233. with musical tone scale, from E0 to D#10.
  13234. The filter accepts the following options:
  13235. @table @option
  13236. @item size, s
  13237. Specify the video size for the output. It must be even. For the syntax of this option,
  13238. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13239. Default value is @code{1920x1080}.
  13240. @item fps, rate, r
  13241. Set the output frame rate. Default value is @code{25}.
  13242. @item bar_h
  13243. Set the bargraph height. It must be even. Default value is @code{-1} which
  13244. computes the bargraph height automatically.
  13245. @item axis_h
  13246. Set the axis height. It must be even. Default value is @code{-1} which computes
  13247. the axis height automatically.
  13248. @item sono_h
  13249. Set the sonogram height. It must be even. Default value is @code{-1} which
  13250. computes the sonogram height automatically.
  13251. @item fullhd
  13252. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13253. instead. Default value is @code{1}.
  13254. @item sono_v, volume
  13255. Specify the sonogram volume expression. It can contain variables:
  13256. @table @option
  13257. @item bar_v
  13258. the @var{bar_v} evaluated expression
  13259. @item frequency, freq, f
  13260. the frequency where it is evaluated
  13261. @item timeclamp, tc
  13262. the value of @var{timeclamp} option
  13263. @end table
  13264. and functions:
  13265. @table @option
  13266. @item a_weighting(f)
  13267. A-weighting of equal loudness
  13268. @item b_weighting(f)
  13269. B-weighting of equal loudness
  13270. @item c_weighting(f)
  13271. C-weighting of equal loudness.
  13272. @end table
  13273. Default value is @code{16}.
  13274. @item bar_v, volume2
  13275. Specify the bargraph volume expression. It can contain variables:
  13276. @table @option
  13277. @item sono_v
  13278. the @var{sono_v} evaluated expression
  13279. @item frequency, freq, f
  13280. the frequency where it is evaluated
  13281. @item timeclamp, tc
  13282. the value of @var{timeclamp} option
  13283. @end table
  13284. and functions:
  13285. @table @option
  13286. @item a_weighting(f)
  13287. A-weighting of equal loudness
  13288. @item b_weighting(f)
  13289. B-weighting of equal loudness
  13290. @item c_weighting(f)
  13291. C-weighting of equal loudness.
  13292. @end table
  13293. Default value is @code{sono_v}.
  13294. @item sono_g, gamma
  13295. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13296. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13297. Acceptable range is @code{[1, 7]}.
  13298. @item bar_g, gamma2
  13299. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13300. @code{[1, 7]}.
  13301. @item bar_t
  13302. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13303. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13304. @item timeclamp, tc
  13305. Specify the transform timeclamp. At low frequency, there is trade-off between
  13306. accuracy in time domain and frequency domain. If timeclamp is lower,
  13307. event in time domain is represented more accurately (such as fast bass drum),
  13308. otherwise event in frequency domain is represented more accurately
  13309. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13310. @item attack
  13311. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13312. limits future samples by applying asymmetric windowing in time domain, useful
  13313. when low latency is required. Accepted range is @code{[0, 1]}.
  13314. @item basefreq
  13315. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13316. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13317. @item endfreq
  13318. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13319. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13320. @item coeffclamp
  13321. This option is deprecated and ignored.
  13322. @item tlength
  13323. Specify the transform length in time domain. Use this option to control accuracy
  13324. trade-off between time domain and frequency domain at every frequency sample.
  13325. It can contain variables:
  13326. @table @option
  13327. @item frequency, freq, f
  13328. the frequency where it is evaluated
  13329. @item timeclamp, tc
  13330. the value of @var{timeclamp} option.
  13331. @end table
  13332. Default value is @code{384*tc/(384+tc*f)}.
  13333. @item count
  13334. Specify the transform count for every video frame. Default value is @code{6}.
  13335. Acceptable range is @code{[1, 30]}.
  13336. @item fcount
  13337. Specify the transform count for every single pixel. Default value is @code{0},
  13338. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13339. @item fontfile
  13340. Specify font file for use with freetype to draw the axis. If not specified,
  13341. use embedded font. Note that drawing with font file or embedded font is not
  13342. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13343. option instead.
  13344. @item font
  13345. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13346. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13347. @item fontcolor
  13348. Specify font color expression. This is arithmetic expression that should return
  13349. integer value 0xRRGGBB. It can contain variables:
  13350. @table @option
  13351. @item frequency, freq, f
  13352. the frequency where it is evaluated
  13353. @item timeclamp, tc
  13354. the value of @var{timeclamp} option
  13355. @end table
  13356. and functions:
  13357. @table @option
  13358. @item midi(f)
  13359. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13360. @item r(x), g(x), b(x)
  13361. red, green, and blue value of intensity x.
  13362. @end table
  13363. Default value is @code{st(0, (midi(f)-59.5)/12);
  13364. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13365. r(1-ld(1)) + b(ld(1))}.
  13366. @item axisfile
  13367. Specify image file to draw the axis. This option override @var{fontfile} and
  13368. @var{fontcolor} option.
  13369. @item axis, text
  13370. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13371. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13372. Default value is @code{1}.
  13373. @item csp
  13374. Set colorspace. The accepted values are:
  13375. @table @samp
  13376. @item unspecified
  13377. Unspecified (default)
  13378. @item bt709
  13379. BT.709
  13380. @item fcc
  13381. FCC
  13382. @item bt470bg
  13383. BT.470BG or BT.601-6 625
  13384. @item smpte170m
  13385. SMPTE-170M or BT.601-6 525
  13386. @item smpte240m
  13387. SMPTE-240M
  13388. @item bt2020ncl
  13389. BT.2020 with non-constant luminance
  13390. @end table
  13391. @item cscheme
  13392. Set spectrogram color scheme. This is list of floating point values with format
  13393. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13394. The default is @code{1|0.5|0|0|0.5|1}.
  13395. @end table
  13396. @subsection Examples
  13397. @itemize
  13398. @item
  13399. Playing audio while showing the spectrum:
  13400. @example
  13401. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13402. @end example
  13403. @item
  13404. Same as above, but with frame rate 30 fps:
  13405. @example
  13406. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13407. @end example
  13408. @item
  13409. Playing at 1280x720:
  13410. @example
  13411. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13412. @end example
  13413. @item
  13414. Disable sonogram display:
  13415. @example
  13416. sono_h=0
  13417. @end example
  13418. @item
  13419. A1 and its harmonics: A1, A2, (near)E3, A3:
  13420. @example
  13421. 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),
  13422. asplit[a][out1]; [a] showcqt [out0]'
  13423. @end example
  13424. @item
  13425. Same as above, but with more accuracy in frequency domain:
  13426. @example
  13427. 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),
  13428. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13429. @end example
  13430. @item
  13431. Custom volume:
  13432. @example
  13433. bar_v=10:sono_v=bar_v*a_weighting(f)
  13434. @end example
  13435. @item
  13436. Custom gamma, now spectrum is linear to the amplitude.
  13437. @example
  13438. bar_g=2:sono_g=2
  13439. @end example
  13440. @item
  13441. Custom tlength equation:
  13442. @example
  13443. 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)))'
  13444. @end example
  13445. @item
  13446. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13447. @example
  13448. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13449. @end example
  13450. @item
  13451. Custom font using fontconfig:
  13452. @example
  13453. font='Courier New,Monospace,mono|bold'
  13454. @end example
  13455. @item
  13456. Custom frequency range with custom axis using image file:
  13457. @example
  13458. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13459. @end example
  13460. @end itemize
  13461. @section showfreqs
  13462. Convert input audio to video output representing the audio power spectrum.
  13463. Audio amplitude is on Y-axis while frequency is on X-axis.
  13464. The filter accepts the following options:
  13465. @table @option
  13466. @item size, s
  13467. Specify size of video. For the syntax of this option, check the
  13468. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13469. Default is @code{1024x512}.
  13470. @item mode
  13471. Set display mode.
  13472. This set how each frequency bin will be represented.
  13473. It accepts the following values:
  13474. @table @samp
  13475. @item line
  13476. @item bar
  13477. @item dot
  13478. @end table
  13479. Default is @code{bar}.
  13480. @item ascale
  13481. Set amplitude scale.
  13482. It accepts the following values:
  13483. @table @samp
  13484. @item lin
  13485. Linear scale.
  13486. @item sqrt
  13487. Square root scale.
  13488. @item cbrt
  13489. Cubic root scale.
  13490. @item log
  13491. Logarithmic scale.
  13492. @end table
  13493. Default is @code{log}.
  13494. @item fscale
  13495. Set frequency scale.
  13496. It accepts the following values:
  13497. @table @samp
  13498. @item lin
  13499. Linear scale.
  13500. @item log
  13501. Logarithmic scale.
  13502. @item rlog
  13503. Reverse logarithmic scale.
  13504. @end table
  13505. Default is @code{lin}.
  13506. @item win_size
  13507. Set window size.
  13508. It accepts the following values:
  13509. @table @samp
  13510. @item w16
  13511. @item w32
  13512. @item w64
  13513. @item w128
  13514. @item w256
  13515. @item w512
  13516. @item w1024
  13517. @item w2048
  13518. @item w4096
  13519. @item w8192
  13520. @item w16384
  13521. @item w32768
  13522. @item w65536
  13523. @end table
  13524. Default is @code{w2048}
  13525. @item win_func
  13526. Set windowing function.
  13527. It accepts the following values:
  13528. @table @samp
  13529. @item rect
  13530. @item bartlett
  13531. @item hanning
  13532. @item hamming
  13533. @item blackman
  13534. @item welch
  13535. @item flattop
  13536. @item bharris
  13537. @item bnuttall
  13538. @item bhann
  13539. @item sine
  13540. @item nuttall
  13541. @item lanczos
  13542. @item gauss
  13543. @item tukey
  13544. @item dolph
  13545. @item cauchy
  13546. @item parzen
  13547. @item poisson
  13548. @end table
  13549. Default is @code{hanning}.
  13550. @item overlap
  13551. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13552. which means optimal overlap for selected window function will be picked.
  13553. @item averaging
  13554. Set time averaging. Setting this to 0 will display current maximal peaks.
  13555. Default is @code{1}, which means time averaging is disabled.
  13556. @item colors
  13557. Specify list of colors separated by space or by '|' which will be used to
  13558. draw channel frequencies. Unrecognized or missing colors will be replaced
  13559. by white color.
  13560. @item cmode
  13561. Set channel display mode.
  13562. It accepts the following values:
  13563. @table @samp
  13564. @item combined
  13565. @item separate
  13566. @end table
  13567. Default is @code{combined}.
  13568. @item minamp
  13569. Set minimum amplitude used in @code{log} amplitude scaler.
  13570. @end table
  13571. @anchor{showspectrum}
  13572. @section showspectrum
  13573. Convert input audio to a video output, representing the audio frequency
  13574. spectrum.
  13575. The filter accepts the following options:
  13576. @table @option
  13577. @item size, s
  13578. Specify the video size for the output. For the syntax of this option, check the
  13579. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13580. Default value is @code{640x512}.
  13581. @item slide
  13582. Specify how the spectrum should slide along the window.
  13583. It accepts the following values:
  13584. @table @samp
  13585. @item replace
  13586. the samples start again on the left when they reach the right
  13587. @item scroll
  13588. the samples scroll from right to left
  13589. @item fullframe
  13590. frames are only produced when the samples reach the right
  13591. @item rscroll
  13592. the samples scroll from left to right
  13593. @end table
  13594. Default value is @code{replace}.
  13595. @item mode
  13596. Specify display mode.
  13597. It accepts the following values:
  13598. @table @samp
  13599. @item combined
  13600. all channels are displayed in the same row
  13601. @item separate
  13602. all channels are displayed in separate rows
  13603. @end table
  13604. Default value is @samp{combined}.
  13605. @item color
  13606. Specify display color mode.
  13607. It accepts the following values:
  13608. @table @samp
  13609. @item channel
  13610. each channel is displayed in a separate color
  13611. @item intensity
  13612. each channel is displayed using the same color scheme
  13613. @item rainbow
  13614. each channel is displayed using the rainbow color scheme
  13615. @item moreland
  13616. each channel is displayed using the moreland color scheme
  13617. @item nebulae
  13618. each channel is displayed using the nebulae color scheme
  13619. @item fire
  13620. each channel is displayed using the fire color scheme
  13621. @item fiery
  13622. each channel is displayed using the fiery color scheme
  13623. @item fruit
  13624. each channel is displayed using the fruit color scheme
  13625. @item cool
  13626. each channel is displayed using the cool color scheme
  13627. @end table
  13628. Default value is @samp{channel}.
  13629. @item scale
  13630. Specify scale used for calculating intensity color values.
  13631. It accepts the following values:
  13632. @table @samp
  13633. @item lin
  13634. linear
  13635. @item sqrt
  13636. square root, default
  13637. @item cbrt
  13638. cubic root
  13639. @item log
  13640. logarithmic
  13641. @item 4thrt
  13642. 4th root
  13643. @item 5thrt
  13644. 5th root
  13645. @end table
  13646. Default value is @samp{sqrt}.
  13647. @item saturation
  13648. Set saturation modifier for displayed colors. Negative values provide
  13649. alternative color scheme. @code{0} is no saturation at all.
  13650. Saturation must be in [-10.0, 10.0] range.
  13651. Default value is @code{1}.
  13652. @item win_func
  13653. Set window function.
  13654. It accepts the following values:
  13655. @table @samp
  13656. @item rect
  13657. @item bartlett
  13658. @item hann
  13659. @item hanning
  13660. @item hamming
  13661. @item blackman
  13662. @item welch
  13663. @item flattop
  13664. @item bharris
  13665. @item bnuttall
  13666. @item bhann
  13667. @item sine
  13668. @item nuttall
  13669. @item lanczos
  13670. @item gauss
  13671. @item tukey
  13672. @item dolph
  13673. @item cauchy
  13674. @item parzen
  13675. @item poisson
  13676. @end table
  13677. Default value is @code{hann}.
  13678. @item orientation
  13679. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13680. @code{horizontal}. Default is @code{vertical}.
  13681. @item overlap
  13682. Set ratio of overlap window. Default value is @code{0}.
  13683. When value is @code{1} overlap is set to recommended size for specific
  13684. window function currently used.
  13685. @item gain
  13686. Set scale gain for calculating intensity color values.
  13687. Default value is @code{1}.
  13688. @item data
  13689. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13690. @item rotation
  13691. Set color rotation, must be in [-1.0, 1.0] range.
  13692. Default value is @code{0}.
  13693. @end table
  13694. The usage is very similar to the showwaves filter; see the examples in that
  13695. section.
  13696. @subsection Examples
  13697. @itemize
  13698. @item
  13699. Large window with logarithmic color scaling:
  13700. @example
  13701. showspectrum=s=1280x480:scale=log
  13702. @end example
  13703. @item
  13704. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13705. @example
  13706. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13707. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13708. @end example
  13709. @end itemize
  13710. @section showspectrumpic
  13711. Convert input audio to a single video frame, representing the audio frequency
  13712. spectrum.
  13713. The filter accepts the following options:
  13714. @table @option
  13715. @item size, s
  13716. Specify the video size for the output. For the syntax of this option, check the
  13717. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13718. Default value is @code{4096x2048}.
  13719. @item mode
  13720. Specify display mode.
  13721. It accepts the following values:
  13722. @table @samp
  13723. @item combined
  13724. all channels are displayed in the same row
  13725. @item separate
  13726. all channels are displayed in separate rows
  13727. @end table
  13728. Default value is @samp{combined}.
  13729. @item color
  13730. Specify display color mode.
  13731. It accepts the following values:
  13732. @table @samp
  13733. @item channel
  13734. each channel is displayed in a separate color
  13735. @item intensity
  13736. each channel is displayed using the same color scheme
  13737. @item rainbow
  13738. each channel is displayed using the rainbow color scheme
  13739. @item moreland
  13740. each channel is displayed using the moreland color scheme
  13741. @item nebulae
  13742. each channel is displayed using the nebulae color scheme
  13743. @item fire
  13744. each channel is displayed using the fire color scheme
  13745. @item fiery
  13746. each channel is displayed using the fiery color scheme
  13747. @item fruit
  13748. each channel is displayed using the fruit color scheme
  13749. @item cool
  13750. each channel is displayed using the cool color scheme
  13751. @end table
  13752. Default value is @samp{intensity}.
  13753. @item scale
  13754. Specify scale used for calculating intensity color values.
  13755. It accepts the following values:
  13756. @table @samp
  13757. @item lin
  13758. linear
  13759. @item sqrt
  13760. square root, default
  13761. @item cbrt
  13762. cubic root
  13763. @item log
  13764. logarithmic
  13765. @item 4thrt
  13766. 4th root
  13767. @item 5thrt
  13768. 5th root
  13769. @end table
  13770. Default value is @samp{log}.
  13771. @item saturation
  13772. Set saturation modifier for displayed colors. Negative values provide
  13773. alternative color scheme. @code{0} is no saturation at all.
  13774. Saturation must be in [-10.0, 10.0] range.
  13775. Default value is @code{1}.
  13776. @item win_func
  13777. Set window function.
  13778. It accepts the following values:
  13779. @table @samp
  13780. @item rect
  13781. @item bartlett
  13782. @item hann
  13783. @item hanning
  13784. @item hamming
  13785. @item blackman
  13786. @item welch
  13787. @item flattop
  13788. @item bharris
  13789. @item bnuttall
  13790. @item bhann
  13791. @item sine
  13792. @item nuttall
  13793. @item lanczos
  13794. @item gauss
  13795. @item tukey
  13796. @item dolph
  13797. @item cauchy
  13798. @item parzen
  13799. @item poisson
  13800. @end table
  13801. Default value is @code{hann}.
  13802. @item orientation
  13803. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13804. @code{horizontal}. Default is @code{vertical}.
  13805. @item gain
  13806. Set scale gain for calculating intensity color values.
  13807. Default value is @code{1}.
  13808. @item legend
  13809. Draw time and frequency axes and legends. Default is enabled.
  13810. @item rotation
  13811. Set color rotation, must be in [-1.0, 1.0] range.
  13812. Default value is @code{0}.
  13813. @end table
  13814. @subsection Examples
  13815. @itemize
  13816. @item
  13817. Extract an audio spectrogram of a whole audio track
  13818. in a 1024x1024 picture using @command{ffmpeg}:
  13819. @example
  13820. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13821. @end example
  13822. @end itemize
  13823. @section showvolume
  13824. Convert input audio volume to a video output.
  13825. The filter accepts the following options:
  13826. @table @option
  13827. @item rate, r
  13828. Set video rate.
  13829. @item b
  13830. Set border width, allowed range is [0, 5]. Default is 1.
  13831. @item w
  13832. Set channel width, allowed range is [80, 8192]. Default is 400.
  13833. @item h
  13834. Set channel height, allowed range is [1, 900]. Default is 20.
  13835. @item f
  13836. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13837. @item c
  13838. Set volume color expression.
  13839. The expression can use the following variables:
  13840. @table @option
  13841. @item VOLUME
  13842. Current max volume of channel in dB.
  13843. @item PEAK
  13844. Current peak.
  13845. @item CHANNEL
  13846. Current channel number, starting from 0.
  13847. @end table
  13848. @item t
  13849. If set, displays channel names. Default is enabled.
  13850. @item v
  13851. If set, displays volume values. Default is enabled.
  13852. @item o
  13853. Set orientation, can be @code{horizontal} or @code{vertical},
  13854. default is @code{horizontal}.
  13855. @item s
  13856. Set step size, allowed range s [0, 5]. Default is 0, which means
  13857. step is disabled.
  13858. @end table
  13859. @section showwaves
  13860. Convert input audio to a video output, representing the samples waves.
  13861. The filter accepts the following options:
  13862. @table @option
  13863. @item size, s
  13864. Specify the video size for the output. For the syntax of this option, check the
  13865. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13866. Default value is @code{600x240}.
  13867. @item mode
  13868. Set display mode.
  13869. Available values are:
  13870. @table @samp
  13871. @item point
  13872. Draw a point for each sample.
  13873. @item line
  13874. Draw a vertical line for each sample.
  13875. @item p2p
  13876. Draw a point for each sample and a line between them.
  13877. @item cline
  13878. Draw a centered vertical line for each sample.
  13879. @end table
  13880. Default value is @code{point}.
  13881. @item n
  13882. Set the number of samples which are printed on the same column. A
  13883. larger value will decrease the frame rate. Must be a positive
  13884. integer. This option can be set only if the value for @var{rate}
  13885. is not explicitly specified.
  13886. @item rate, r
  13887. Set the (approximate) output frame rate. This is done by setting the
  13888. option @var{n}. Default value is "25".
  13889. @item split_channels
  13890. Set if channels should be drawn separately or overlap. Default value is 0.
  13891. @item colors
  13892. Set colors separated by '|' which are going to be used for drawing of each channel.
  13893. @item scale
  13894. Set amplitude scale.
  13895. Available values are:
  13896. @table @samp
  13897. @item lin
  13898. Linear.
  13899. @item log
  13900. Logarithmic.
  13901. @item sqrt
  13902. Square root.
  13903. @item cbrt
  13904. Cubic root.
  13905. @end table
  13906. Default is linear.
  13907. @end table
  13908. @subsection Examples
  13909. @itemize
  13910. @item
  13911. Output the input file audio and the corresponding video representation
  13912. at the same time:
  13913. @example
  13914. amovie=a.mp3,asplit[out0],showwaves[out1]
  13915. @end example
  13916. @item
  13917. Create a synthetic signal and show it with showwaves, forcing a
  13918. frame rate of 30 frames per second:
  13919. @example
  13920. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13921. @end example
  13922. @end itemize
  13923. @section showwavespic
  13924. Convert input audio to a single video frame, representing the samples waves.
  13925. The filter accepts the following options:
  13926. @table @option
  13927. @item size, s
  13928. Specify the video size for the output. For the syntax of this option, check the
  13929. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13930. Default value is @code{600x240}.
  13931. @item split_channels
  13932. Set if channels should be drawn separately or overlap. Default value is 0.
  13933. @item colors
  13934. Set colors separated by '|' which are going to be used for drawing of each channel.
  13935. @item scale
  13936. Set amplitude scale.
  13937. Available values are:
  13938. @table @samp
  13939. @item lin
  13940. Linear.
  13941. @item log
  13942. Logarithmic.
  13943. @item sqrt
  13944. Square root.
  13945. @item cbrt
  13946. Cubic root.
  13947. @end table
  13948. Default is linear.
  13949. @end table
  13950. @subsection Examples
  13951. @itemize
  13952. @item
  13953. Extract a channel split representation of the wave form of a whole audio track
  13954. in a 1024x800 picture using @command{ffmpeg}:
  13955. @example
  13956. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13957. @end example
  13958. @end itemize
  13959. @section sidedata, asidedata
  13960. Delete frame side data, or select frames based on it.
  13961. This filter accepts the following options:
  13962. @table @option
  13963. @item mode
  13964. Set mode of operation of the filter.
  13965. Can be one of the following:
  13966. @table @samp
  13967. @item select
  13968. Select every frame with side data of @code{type}.
  13969. @item delete
  13970. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13971. data in the frame.
  13972. @end table
  13973. @item type
  13974. Set side data type used with all modes. Must be set for @code{select} mode. For
  13975. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13976. in @file{libavutil/frame.h}. For example, to choose
  13977. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13978. @end table
  13979. @section spectrumsynth
  13980. Sythesize audio from 2 input video spectrums, first input stream represents
  13981. magnitude across time and second represents phase across time.
  13982. The filter will transform from frequency domain as displayed in videos back
  13983. to time domain as presented in audio output.
  13984. This filter is primarily created for reversing processed @ref{showspectrum}
  13985. filter outputs, but can synthesize sound from other spectrograms too.
  13986. But in such case results are going to be poor if the phase data is not
  13987. available, because in such cases phase data need to be recreated, usually
  13988. its just recreated from random noise.
  13989. For best results use gray only output (@code{channel} color mode in
  13990. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13991. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13992. @code{data} option. Inputs videos should generally use @code{fullframe}
  13993. slide mode as that saves resources needed for decoding video.
  13994. The filter accepts the following options:
  13995. @table @option
  13996. @item sample_rate
  13997. Specify sample rate of output audio, the sample rate of audio from which
  13998. spectrum was generated may differ.
  13999. @item channels
  14000. Set number of channels represented in input video spectrums.
  14001. @item scale
  14002. Set scale which was used when generating magnitude input spectrum.
  14003. Can be @code{lin} or @code{log}. Default is @code{log}.
  14004. @item slide
  14005. Set slide which was used when generating inputs spectrums.
  14006. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14007. Default is @code{fullframe}.
  14008. @item win_func
  14009. Set window function used for resynthesis.
  14010. @item overlap
  14011. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14012. which means optimal overlap for selected window function will be picked.
  14013. @item orientation
  14014. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14015. Default is @code{vertical}.
  14016. @end table
  14017. @subsection Examples
  14018. @itemize
  14019. @item
  14020. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14021. then resynthesize videos back to audio with spectrumsynth:
  14022. @example
  14023. 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
  14024. 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
  14025. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14026. @end example
  14027. @end itemize
  14028. @section split, asplit
  14029. Split input into several identical outputs.
  14030. @code{asplit} works with audio input, @code{split} with video.
  14031. The filter accepts a single parameter which specifies the number of outputs. If
  14032. unspecified, it defaults to 2.
  14033. @subsection Examples
  14034. @itemize
  14035. @item
  14036. Create two separate outputs from the same input:
  14037. @example
  14038. [in] split [out0][out1]
  14039. @end example
  14040. @item
  14041. To create 3 or more outputs, you need to specify the number of
  14042. outputs, like in:
  14043. @example
  14044. [in] asplit=3 [out0][out1][out2]
  14045. @end example
  14046. @item
  14047. Create two separate outputs from the same input, one cropped and
  14048. one padded:
  14049. @example
  14050. [in] split [splitout1][splitout2];
  14051. [splitout1] crop=100:100:0:0 [cropout];
  14052. [splitout2] pad=200:200:100:100 [padout];
  14053. @end example
  14054. @item
  14055. Create 5 copies of the input audio with @command{ffmpeg}:
  14056. @example
  14057. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14058. @end example
  14059. @end itemize
  14060. @section zmq, azmq
  14061. Receive commands sent through a libzmq client, and forward them to
  14062. filters in the filtergraph.
  14063. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14064. must be inserted between two video filters, @code{azmq} between two
  14065. audio filters.
  14066. To enable these filters you need to install the libzmq library and
  14067. headers and configure FFmpeg with @code{--enable-libzmq}.
  14068. For more information about libzmq see:
  14069. @url{http://www.zeromq.org/}
  14070. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14071. receives messages sent through a network interface defined by the
  14072. @option{bind_address} option.
  14073. The received message must be in the form:
  14074. @example
  14075. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14076. @end example
  14077. @var{TARGET} specifies the target of the command, usually the name of
  14078. the filter class or a specific filter instance name.
  14079. @var{COMMAND} specifies the name of the command for the target filter.
  14080. @var{ARG} is optional and specifies the optional argument list for the
  14081. given @var{COMMAND}.
  14082. Upon reception, the message is processed and the corresponding command
  14083. is injected into the filtergraph. Depending on the result, the filter
  14084. will send a reply to the client, adopting the format:
  14085. @example
  14086. @var{ERROR_CODE} @var{ERROR_REASON}
  14087. @var{MESSAGE}
  14088. @end example
  14089. @var{MESSAGE} is optional.
  14090. @subsection Examples
  14091. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14092. be used to send commands processed by these filters.
  14093. Consider the following filtergraph generated by @command{ffplay}
  14094. @example
  14095. ffplay -dumpgraph 1 -f lavfi "
  14096. color=s=100x100:c=red [l];
  14097. color=s=100x100:c=blue [r];
  14098. nullsrc=s=200x100, zmq [bg];
  14099. [bg][l] overlay [bg+l];
  14100. [bg+l][r] overlay=x=100 "
  14101. @end example
  14102. To change the color of the left side of the video, the following
  14103. command can be used:
  14104. @example
  14105. echo Parsed_color_0 c yellow | tools/zmqsend
  14106. @end example
  14107. To change the right side:
  14108. @example
  14109. echo Parsed_color_1 c pink | tools/zmqsend
  14110. @end example
  14111. @c man end MULTIMEDIA FILTERS
  14112. @chapter Multimedia Sources
  14113. @c man begin MULTIMEDIA SOURCES
  14114. Below is a description of the currently available multimedia sources.
  14115. @section amovie
  14116. This is the same as @ref{movie} source, except it selects an audio
  14117. stream by default.
  14118. @anchor{movie}
  14119. @section movie
  14120. Read audio and/or video stream(s) from a movie container.
  14121. It accepts the following parameters:
  14122. @table @option
  14123. @item filename
  14124. The name of the resource to read (not necessarily a file; it can also be a
  14125. device or a stream accessed through some protocol).
  14126. @item format_name, f
  14127. Specifies the format assumed for the movie to read, and can be either
  14128. the name of a container or an input device. If not specified, the
  14129. format is guessed from @var{movie_name} or by probing.
  14130. @item seek_point, sp
  14131. Specifies the seek point in seconds. The frames will be output
  14132. starting from this seek point. The parameter is evaluated with
  14133. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14134. postfix. The default value is "0".
  14135. @item streams, s
  14136. Specifies the streams to read. Several streams can be specified,
  14137. separated by "+". The source will then have as many outputs, in the
  14138. same order. The syntax is explained in the ``Stream specifiers''
  14139. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14140. respectively the default (best suited) video and audio stream. Default
  14141. is "dv", or "da" if the filter is called as "amovie".
  14142. @item stream_index, si
  14143. Specifies the index of the video stream to read. If the value is -1,
  14144. the most suitable video stream will be automatically selected. The default
  14145. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14146. audio instead of video.
  14147. @item loop
  14148. Specifies how many times to read the stream in sequence.
  14149. If the value is 0, the stream will be looped infinitely.
  14150. Default value is "1".
  14151. Note that when the movie is looped the source timestamps are not
  14152. changed, so it will generate non monotonically increasing timestamps.
  14153. @item discontinuity
  14154. Specifies the time difference between frames above which the point is
  14155. considered a timestamp discontinuity which is removed by adjusting the later
  14156. timestamps.
  14157. @end table
  14158. It allows overlaying a second video on top of the main input of
  14159. a filtergraph, as shown in this graph:
  14160. @example
  14161. input -----------> deltapts0 --> overlay --> output
  14162. ^
  14163. |
  14164. movie --> scale--> deltapts1 -------+
  14165. @end example
  14166. @subsection Examples
  14167. @itemize
  14168. @item
  14169. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14170. on top of the input labelled "in":
  14171. @example
  14172. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14173. [in] setpts=PTS-STARTPTS [main];
  14174. [main][over] overlay=16:16 [out]
  14175. @end example
  14176. @item
  14177. Read from a video4linux2 device, and overlay it on top of the input
  14178. labelled "in":
  14179. @example
  14180. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14181. [in] setpts=PTS-STARTPTS [main];
  14182. [main][over] overlay=16:16 [out]
  14183. @end example
  14184. @item
  14185. Read the first video stream and the audio stream with id 0x81 from
  14186. dvd.vob; the video is connected to the pad named "video" and the audio is
  14187. connected to the pad named "audio":
  14188. @example
  14189. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14190. @end example
  14191. @end itemize
  14192. @subsection Commands
  14193. Both movie and amovie support the following commands:
  14194. @table @option
  14195. @item seek
  14196. Perform seek using "av_seek_frame".
  14197. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14198. @itemize
  14199. @item
  14200. @var{stream_index}: If stream_index is -1, a default
  14201. stream is selected, and @var{timestamp} is automatically converted
  14202. from AV_TIME_BASE units to the stream specific time_base.
  14203. @item
  14204. @var{timestamp}: Timestamp in AVStream.time_base units
  14205. or, if no stream is specified, in AV_TIME_BASE units.
  14206. @item
  14207. @var{flags}: Flags which select direction and seeking mode.
  14208. @end itemize
  14209. @item get_duration
  14210. Get movie duration in AV_TIME_BASE units.
  14211. @end table
  14212. @c man end MULTIMEDIA SOURCES