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.

16543 lines
446KB

  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. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and divide it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to raise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio about which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is rms. Can be peak or rms.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is average. Can be average or maximum.
  714. @end table
  715. @section alimiter
  716. The limiter prevents input signal from raising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. 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
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signal its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. 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
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. 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
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section firequalizer
  1860. Apply FIR Equalization using arbitrary frequency response.
  1861. The filter accepts the following option:
  1862. @table @option
  1863. @item gain
  1864. Set gain curve equation (in dB). The expression can contain variables:
  1865. @table @option
  1866. @item f
  1867. the evaluated frequency
  1868. @item sr
  1869. sample rate
  1870. @item ch
  1871. channel number, set to 0 when multichannels evaluation is disabled
  1872. @item chid
  1873. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1874. multichannels evaluation is disabled
  1875. @item chs
  1876. number of channels
  1877. @item chlayout
  1878. channel_layout, see libavutil/channel_layout.h
  1879. @end table
  1880. and functions:
  1881. @table @option
  1882. @item gain_interpolate(f)
  1883. interpolate gain on frequency f based on gain_entry
  1884. @end table
  1885. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1886. @item gain_entry
  1887. Set gain entry for gain_interpolate function. The expression can
  1888. contain functions:
  1889. @table @option
  1890. @item entry(f, g)
  1891. store gain entry at frequency f with value g
  1892. @end table
  1893. This option is also available as command.
  1894. @item delay
  1895. Set filter delay in seconds. Higher value means more accurate.
  1896. Default is @code{0.01}.
  1897. @item accuracy
  1898. Set filter accuracy in Hz. Lower value means more accurate.
  1899. Default is @code{5}.
  1900. @item wfunc
  1901. Set window function. Acceptable values are:
  1902. @table @option
  1903. @item rectangular
  1904. rectangular window, useful when gain curve is already smooth
  1905. @item hann
  1906. hann window (default)
  1907. @item hamming
  1908. hamming window
  1909. @item blackman
  1910. blackman window
  1911. @item nuttall3
  1912. 3-terms continuous 1st derivative nuttall window
  1913. @item mnuttall3
  1914. minimum 3-terms discontinuous nuttall window
  1915. @item nuttall
  1916. 4-terms continuous 1st derivative nuttall window
  1917. @item bnuttall
  1918. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1919. @item bharris
  1920. blackman-harris window
  1921. @end table
  1922. @item fixed
  1923. If enabled, use fixed number of audio samples. This improves speed when
  1924. filtering with large delay. Default is disabled.
  1925. @item multi
  1926. Enable multichannels evaluation on gain. Default is disabled.
  1927. @end table
  1928. @subsection Examples
  1929. @itemize
  1930. @item
  1931. lowpass at 1000 Hz:
  1932. @example
  1933. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1934. @end example
  1935. @item
  1936. lowpass at 1000 Hz with gain_entry:
  1937. @example
  1938. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1939. @end example
  1940. @item
  1941. custom equalization:
  1942. @example
  1943. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1944. @end example
  1945. @item
  1946. higher delay:
  1947. @example
  1948. firequalizer=delay=0.1:fixed=on
  1949. @end example
  1950. @item
  1951. lowpass on left channel, highpass on right channel:
  1952. @example
  1953. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1954. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1955. @end example
  1956. @end itemize
  1957. @section flanger
  1958. Apply a flanging effect to the audio.
  1959. The filter accepts the following options:
  1960. @table @option
  1961. @item delay
  1962. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1963. @item depth
  1964. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1965. @item regen
  1966. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1967. Default value is 0.
  1968. @item width
  1969. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1970. Default value is 71.
  1971. @item speed
  1972. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1973. @item shape
  1974. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1975. Default value is @var{sinusoidal}.
  1976. @item phase
  1977. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1978. Default value is 25.
  1979. @item interp
  1980. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1981. Default is @var{linear}.
  1982. @end table
  1983. @section highpass
  1984. Apply a high-pass filter with 3dB point frequency.
  1985. The filter can be either single-pole, or double-pole (the default).
  1986. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1987. The filter accepts the following options:
  1988. @table @option
  1989. @item frequency, f
  1990. Set frequency in Hz. Default is 3000.
  1991. @item poles, p
  1992. Set number of poles. Default is 2.
  1993. @item width_type
  1994. Set method to specify band-width of filter.
  1995. @table @option
  1996. @item h
  1997. Hz
  1998. @item q
  1999. Q-Factor
  2000. @item o
  2001. octave
  2002. @item s
  2003. slope
  2004. @end table
  2005. @item width, w
  2006. Specify the band-width of a filter in width_type units.
  2007. Applies only to double-pole filter.
  2008. The default is 0.707q and gives a Butterworth response.
  2009. @end table
  2010. @section join
  2011. Join multiple input streams into one multi-channel stream.
  2012. It accepts the following parameters:
  2013. @table @option
  2014. @item inputs
  2015. The number of input streams. It defaults to 2.
  2016. @item channel_layout
  2017. The desired output channel layout. It defaults to stereo.
  2018. @item map
  2019. Map channels from inputs to output. The argument is a '|'-separated list of
  2020. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2021. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2022. can be either the name of the input channel (e.g. FL for front left) or its
  2023. index in the specified input stream. @var{out_channel} is the name of the output
  2024. channel.
  2025. @end table
  2026. The filter will attempt to guess the mappings when they are not specified
  2027. explicitly. It does so by first trying to find an unused matching input channel
  2028. and if that fails it picks the first unused input channel.
  2029. Join 3 inputs (with properly set channel layouts):
  2030. @example
  2031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2032. @end example
  2033. Build a 5.1 output from 6 single-channel streams:
  2034. @example
  2035. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2036. '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'
  2037. out
  2038. @end example
  2039. @section ladspa
  2040. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2041. To enable compilation of this filter you need to configure FFmpeg with
  2042. @code{--enable-ladspa}.
  2043. @table @option
  2044. @item file, f
  2045. Specifies the name of LADSPA plugin library to load. If the environment
  2046. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2047. each one of the directories specified by the colon separated list in
  2048. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2049. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2050. @file{/usr/lib/ladspa/}.
  2051. @item plugin, p
  2052. Specifies the plugin within the library. Some libraries contain only
  2053. one plugin, but others contain many of them. If this is not set filter
  2054. will list all available plugins within the specified library.
  2055. @item controls, c
  2056. Set the '|' separated list of controls which are zero or more floating point
  2057. values that determine the behavior of the loaded plugin (for example delay,
  2058. threshold or gain).
  2059. Controls need to be defined using the following syntax:
  2060. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2061. @var{valuei} is the value set on the @var{i}-th control.
  2062. Alternatively they can be also defined using the following syntax:
  2063. @var{value0}|@var{value1}|@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. If @option{controls} is set to @code{help}, all available controls and
  2066. their valid ranges are printed.
  2067. @item sample_rate, s
  2068. Specify the sample rate, default to 44100. Only used if plugin have
  2069. zero inputs.
  2070. @item nb_samples, n
  2071. Set the number of samples per channel per each output frame, default
  2072. is 1024. Only used if plugin have zero inputs.
  2073. @item duration, d
  2074. Set the minimum duration of the sourced audio. See
  2075. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2076. for the accepted syntax.
  2077. Note that the resulting duration may be greater than the specified duration,
  2078. as the generated audio is always cut at the end of a complete frame.
  2079. If not specified, or the expressed duration is negative, the audio is
  2080. supposed to be generated forever.
  2081. Only used if plugin have zero inputs.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. List all available plugins within amp (LADSPA example plugin) library:
  2087. @example
  2088. ladspa=file=amp
  2089. @end example
  2090. @item
  2091. List all available controls and their valid ranges for @code{vcf_notch}
  2092. plugin from @code{VCF} library:
  2093. @example
  2094. ladspa=f=vcf:p=vcf_notch:c=help
  2095. @end example
  2096. @item
  2097. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2098. plugin library:
  2099. @example
  2100. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2101. @end example
  2102. @item
  2103. Add reverberation to the audio using TAP-plugins
  2104. (Tom's Audio Processing plugins):
  2105. @example
  2106. ladspa=file=tap_reverb:tap_reverb
  2107. @end example
  2108. @item
  2109. Generate white noise, with 0.2 amplitude:
  2110. @example
  2111. ladspa=file=cmt:noise_source_white:c=c0=.2
  2112. @end example
  2113. @item
  2114. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2115. @code{C* Audio Plugin Suite} (CAPS) library:
  2116. @example
  2117. ladspa=file=caps:Click:c=c1=20'
  2118. @end example
  2119. @item
  2120. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2121. @example
  2122. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2123. @end example
  2124. @item
  2125. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2126. @code{SWH Plugins} collection:
  2127. @example
  2128. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2129. @end example
  2130. @item
  2131. Attenuate low frequencies using Multiband EQ from Steve Harris
  2132. @code{SWH Plugins} collection:
  2133. @example
  2134. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2135. @end example
  2136. @end itemize
  2137. @subsection Commands
  2138. This filter supports the following commands:
  2139. @table @option
  2140. @item cN
  2141. Modify the @var{N}-th control value.
  2142. If the specified value is not valid, it is ignored and prior one is kept.
  2143. @end table
  2144. @section lowpass
  2145. Apply a low-pass filter with 3dB point frequency.
  2146. The filter can be either single-pole or double-pole (the default).
  2147. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2148. The filter accepts the following options:
  2149. @table @option
  2150. @item frequency, f
  2151. Set frequency in Hz. Default is 500.
  2152. @item poles, p
  2153. Set number of poles. Default is 2.
  2154. @item width_type
  2155. Set method to specify band-width of filter.
  2156. @table @option
  2157. @item h
  2158. Hz
  2159. @item q
  2160. Q-Factor
  2161. @item o
  2162. octave
  2163. @item s
  2164. slope
  2165. @end table
  2166. @item width, w
  2167. Specify the band-width of a filter in width_type units.
  2168. Applies only to double-pole filter.
  2169. The default is 0.707q and gives a Butterworth response.
  2170. @end table
  2171. @anchor{pan}
  2172. @section pan
  2173. Mix channels with specific gain levels. The filter accepts the output
  2174. channel layout followed by a set of channels definitions.
  2175. This filter is also designed to efficiently remap the channels of an audio
  2176. stream.
  2177. The filter accepts parameters of the form:
  2178. "@var{l}|@var{outdef}|@var{outdef}|..."
  2179. @table @option
  2180. @item l
  2181. output channel layout or number of channels
  2182. @item outdef
  2183. output channel specification, of the form:
  2184. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2185. @item out_name
  2186. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2187. number (c0, c1, etc.)
  2188. @item gain
  2189. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2190. @item in_name
  2191. input channel to use, see out_name for details; it is not possible to mix
  2192. named and numbered input channels
  2193. @end table
  2194. If the `=' in a channel specification is replaced by `<', then the gains for
  2195. that specification will be renormalized so that the total is 1, thus
  2196. avoiding clipping noise.
  2197. @subsection Mixing examples
  2198. For example, if you want to down-mix from stereo to mono, but with a bigger
  2199. factor for the left channel:
  2200. @example
  2201. pan=1c|c0=0.9*c0+0.1*c1
  2202. @end example
  2203. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2204. 7-channels surround:
  2205. @example
  2206. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2207. @end example
  2208. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2209. that should be preferred (see "-ac" option) unless you have very specific
  2210. needs.
  2211. @subsection Remapping examples
  2212. The channel remapping will be effective if, and only if:
  2213. @itemize
  2214. @item gain coefficients are zeroes or ones,
  2215. @item only one input per channel output,
  2216. @end itemize
  2217. If all these conditions are satisfied, the filter will notify the user ("Pure
  2218. channel mapping detected"), and use an optimized and lossless method to do the
  2219. remapping.
  2220. For example, if you have a 5.1 source and want a stereo audio stream by
  2221. dropping the extra channels:
  2222. @example
  2223. pan="stereo| c0=FL | c1=FR"
  2224. @end example
  2225. Given the same source, you can also switch front left and front right channels
  2226. and keep the input channel layout:
  2227. @example
  2228. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2229. @end example
  2230. If the input is a stereo audio stream, you can mute the front left channel (and
  2231. still keep the stereo channel layout) with:
  2232. @example
  2233. pan="stereo|c1=c1"
  2234. @end example
  2235. Still with a stereo audio stream input, you can copy the right channel in both
  2236. front left and right:
  2237. @example
  2238. pan="stereo| c0=FR | c1=FR"
  2239. @end example
  2240. @section replaygain
  2241. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2242. outputs it unchanged.
  2243. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2244. @section resample
  2245. Convert the audio sample format, sample rate and channel layout. It is
  2246. not meant to be used directly.
  2247. @section rubberband
  2248. Apply time-stretching and pitch-shifting with librubberband.
  2249. The filter accepts the following options:
  2250. @table @option
  2251. @item tempo
  2252. Set tempo scale factor.
  2253. @item pitch
  2254. Set pitch scale factor.
  2255. @item transients
  2256. Set transients detector.
  2257. Possible values are:
  2258. @table @var
  2259. @item crisp
  2260. @item mixed
  2261. @item smooth
  2262. @end table
  2263. @item detector
  2264. Set detector.
  2265. Possible values are:
  2266. @table @var
  2267. @item compound
  2268. @item percussive
  2269. @item soft
  2270. @end table
  2271. @item phase
  2272. Set phase.
  2273. Possible values are:
  2274. @table @var
  2275. @item laminar
  2276. @item independent
  2277. @end table
  2278. @item window
  2279. Set processing window size.
  2280. Possible values are:
  2281. @table @var
  2282. @item standard
  2283. @item short
  2284. @item long
  2285. @end table
  2286. @item smoothing
  2287. Set smoothing.
  2288. Possible values are:
  2289. @table @var
  2290. @item off
  2291. @item on
  2292. @end table
  2293. @item formant
  2294. Enable formant preservation when shift pitching.
  2295. Possible values are:
  2296. @table @var
  2297. @item shifted
  2298. @item preserved
  2299. @end table
  2300. @item pitchq
  2301. Set pitch quality.
  2302. Possible values are:
  2303. @table @var
  2304. @item quality
  2305. @item speed
  2306. @item consistency
  2307. @end table
  2308. @item channels
  2309. Set channels.
  2310. Possible values are:
  2311. @table @var
  2312. @item apart
  2313. @item together
  2314. @end table
  2315. @end table
  2316. @section sidechaincompress
  2317. This filter acts like normal compressor but has the ability to compress
  2318. detected signal using second input signal.
  2319. It needs two input streams and returns one output stream.
  2320. First input stream will be processed depending on second stream signal.
  2321. The filtered signal then can be filtered with other filters in later stages of
  2322. processing. See @ref{pan} and @ref{amerge} filter.
  2323. The filter accepts the following options:
  2324. @table @option
  2325. @item level_in
  2326. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2327. @item threshold
  2328. If a signal of second stream raises above this level it will affect the gain
  2329. reduction of first stream.
  2330. By default is 0.125. Range is between 0.00097563 and 1.
  2331. @item ratio
  2332. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2333. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2334. Default is 2. Range is between 1 and 20.
  2335. @item attack
  2336. Amount of milliseconds the signal has to rise above the threshold before gain
  2337. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2338. @item release
  2339. Amount of milliseconds the signal has to fall below the threshold before
  2340. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2341. @item makeup
  2342. Set the amount by how much signal will be amplified after processing.
  2343. Default is 2. Range is from 1 and 64.
  2344. @item knee
  2345. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2346. Default is 2.82843. Range is between 1 and 8.
  2347. @item link
  2348. Choose if the @code{average} level between all channels of side-chain stream
  2349. or the louder(@code{maximum}) channel of side-chain stream affects the
  2350. reduction. Default is @code{average}.
  2351. @item detection
  2352. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2353. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2354. @item level_sc
  2355. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2356. @item mix
  2357. How much to use compressed signal in output. Default is 1.
  2358. Range is between 0 and 1.
  2359. @end table
  2360. @subsection Examples
  2361. @itemize
  2362. @item
  2363. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2364. depending on the signal of 2nd input and later compressed signal to be
  2365. merged with 2nd input:
  2366. @example
  2367. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2368. @end example
  2369. @end itemize
  2370. @section sidechaingate
  2371. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2372. filter the detected signal before sending it to the gain reduction stage.
  2373. Normally a gate uses the full range signal to detect a level above the
  2374. threshold.
  2375. For example: If you cut all lower frequencies from your sidechain signal
  2376. the gate will decrease the volume of your track only if not enough highs
  2377. appear. With this technique you are able to reduce the resonation of a
  2378. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2379. guitar.
  2380. It needs two input streams and returns one output stream.
  2381. First input stream will be processed depending on second stream signal.
  2382. The filter accepts the following options:
  2383. @table @option
  2384. @item level_in
  2385. Set input level before filtering.
  2386. Default is 1. Allowed range is from 0.015625 to 64.
  2387. @item range
  2388. Set the level of gain reduction when the signal is below the threshold.
  2389. Default is 0.06125. Allowed range is from 0 to 1.
  2390. @item threshold
  2391. If a signal rises above this level the gain reduction is released.
  2392. Default is 0.125. Allowed range is from 0 to 1.
  2393. @item ratio
  2394. Set a ratio about which the signal is reduced.
  2395. Default is 2. Allowed range is from 1 to 9000.
  2396. @item attack
  2397. Amount of milliseconds the signal has to rise above the threshold before gain
  2398. reduction stops.
  2399. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2400. @item release
  2401. Amount of milliseconds the signal has to fall below the threshold before the
  2402. reduction is increased again. Default is 250 milliseconds.
  2403. Allowed range is from 0.01 to 9000.
  2404. @item makeup
  2405. Set amount of amplification of signal after processing.
  2406. Default is 1. Allowed range is from 1 to 64.
  2407. @item knee
  2408. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2409. Default is 2.828427125. Allowed range is from 1 to 8.
  2410. @item detection
  2411. Choose if exact signal should be taken for detection or an RMS like one.
  2412. Default is rms. Can be peak or rms.
  2413. @item link
  2414. Choose if the average level between all channels or the louder channel affects
  2415. the reduction.
  2416. Default is average. Can be average or maximum.
  2417. @item level_sc
  2418. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2419. @end table
  2420. @section silencedetect
  2421. Detect silence in an audio stream.
  2422. This filter logs a message when it detects that the input audio volume is less
  2423. or equal to a noise tolerance value for a duration greater or equal to the
  2424. minimum detected noise duration.
  2425. The printed times and duration are expressed in seconds.
  2426. The filter accepts the following options:
  2427. @table @option
  2428. @item duration, d
  2429. Set silence duration until notification (default is 2 seconds).
  2430. @item noise, n
  2431. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2432. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2433. @end table
  2434. @subsection Examples
  2435. @itemize
  2436. @item
  2437. Detect 5 seconds of silence with -50dB noise tolerance:
  2438. @example
  2439. silencedetect=n=-50dB:d=5
  2440. @end example
  2441. @item
  2442. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2443. tolerance in @file{silence.mp3}:
  2444. @example
  2445. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2446. @end example
  2447. @end itemize
  2448. @section silenceremove
  2449. Remove silence from the beginning, middle or end of the audio.
  2450. The filter accepts the following options:
  2451. @table @option
  2452. @item start_periods
  2453. This value is used to indicate if audio should be trimmed at beginning of
  2454. the audio. A value of zero indicates no silence should be trimmed from the
  2455. beginning. When specifying a non-zero value, it trims audio up until it
  2456. finds non-silence. Normally, when trimming silence from beginning of audio
  2457. the @var{start_periods} will be @code{1} but it can be increased to higher
  2458. values to trim all audio up to specific count of non-silence periods.
  2459. Default value is @code{0}.
  2460. @item start_duration
  2461. Specify the amount of time that non-silence must be detected before it stops
  2462. trimming audio. By increasing the duration, bursts of noises can be treated
  2463. as silence and trimmed off. Default value is @code{0}.
  2464. @item start_threshold
  2465. This indicates what sample value should be treated as silence. For digital
  2466. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2467. you may wish to increase the value to account for background noise.
  2468. Can be specified in dB (in case "dB" is appended to the specified value)
  2469. or amplitude ratio. Default value is @code{0}.
  2470. @item stop_periods
  2471. Set the count for trimming silence from the end of audio.
  2472. To remove silence from the middle of a file, specify a @var{stop_periods}
  2473. that is negative. This value is then treated as a positive value and is
  2474. used to indicate the effect should restart processing as specified by
  2475. @var{start_periods}, making it suitable for removing periods of silence
  2476. in the middle of the audio.
  2477. Default value is @code{0}.
  2478. @item stop_duration
  2479. Specify a duration of silence that must exist before audio is not copied any
  2480. more. By specifying a higher duration, silence that is wanted can be left in
  2481. the audio.
  2482. Default value is @code{0}.
  2483. @item stop_threshold
  2484. This is the same as @option{start_threshold} but for trimming silence from
  2485. the end of audio.
  2486. Can be specified in dB (in case "dB" is appended to the specified value)
  2487. or amplitude ratio. Default value is @code{0}.
  2488. @item leave_silence
  2489. This indicate that @var{stop_duration} length of audio should be left intact
  2490. at the beginning of each period of silence.
  2491. For example, if you want to remove long pauses between words but do not want
  2492. to remove the pauses completely. Default value is @code{0}.
  2493. @item detection
  2494. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2495. and works better with digital silence which is exactly 0.
  2496. Default value is @code{rms}.
  2497. @item window
  2498. Set ratio used to calculate size of window for detecting silence.
  2499. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. The following example shows how this filter can be used to start a recording
  2505. that does not contain the delay at the start which usually occurs between
  2506. pressing the record button and the start of the performance:
  2507. @example
  2508. silenceremove=1:5:0.02
  2509. @end example
  2510. @item
  2511. Trim all silence encountered from begining to end where there is more than 1
  2512. second of silence in audio:
  2513. @example
  2514. silenceremove=0:0:0:-1:1:-90dB
  2515. @end example
  2516. @end itemize
  2517. @section sofalizer
  2518. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2519. loudspeakers around the user for binaural listening via headphones (audio
  2520. formats up to 9 channels supported).
  2521. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2522. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2523. Austrian Academy of Sciences.
  2524. To enable compilation of this filter you need to configure FFmpeg with
  2525. @code{--enable-netcdf}.
  2526. The filter accepts the following options:
  2527. @table @option
  2528. @item sofa
  2529. Set the SOFA file used for rendering.
  2530. @item gain
  2531. Set gain applied to audio. Value is in dB. Default is 0.
  2532. @item rotation
  2533. Set rotation of virtual loudspeakers in deg. Default is 0.
  2534. @item elevation
  2535. Set elevation of virtual speakers in deg. Default is 0.
  2536. @item radius
  2537. Set distance in meters between loudspeakers and the listener with near-field
  2538. HRTFs. Default is 1.
  2539. @item type
  2540. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2541. processing audio in time domain which is slow but gives high quality output.
  2542. @var{freq} is processing audio in frequency domain which is fast but gives
  2543. mediocre output. Default is @var{freq}.
  2544. @item speakers
  2545. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2546. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2547. Each virtual loudspeaker is described with short channel name following with
  2548. azimuth and elevation in degreees.
  2549. Each virtual loudspeaker description is separated by '|'.
  2550. For example to override front left and front right channel positions use:
  2551. 'speakers=FL 45 15|FR 345 15'.
  2552. Descriptions with unrecognised channel names are ignored.
  2553. @end table
  2554. @section stereotools
  2555. This filter has some handy utilities to manage stereo signals, for converting
  2556. M/S stereo recordings to L/R signal while having control over the parameters
  2557. or spreading the stereo image of master track.
  2558. The filter accepts the following options:
  2559. @table @option
  2560. @item level_in
  2561. Set input level before filtering for both channels. Defaults is 1.
  2562. Allowed range is from 0.015625 to 64.
  2563. @item level_out
  2564. Set output level after filtering for both channels. Defaults is 1.
  2565. Allowed range is from 0.015625 to 64.
  2566. @item balance_in
  2567. Set input balance between both channels. Default is 0.
  2568. Allowed range is from -1 to 1.
  2569. @item balance_out
  2570. Set output balance between both channels. Default is 0.
  2571. Allowed range is from -1 to 1.
  2572. @item softclip
  2573. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2574. clipping. Disabled by default.
  2575. @item mutel
  2576. Mute the left channel. Disabled by default.
  2577. @item muter
  2578. Mute the right channel. Disabled by default.
  2579. @item phasel
  2580. Change the phase of the left channel. Disabled by default.
  2581. @item phaser
  2582. Change the phase of the right channel. Disabled by default.
  2583. @item mode
  2584. Set stereo mode. Available values are:
  2585. @table @samp
  2586. @item lr>lr
  2587. Left/Right to Left/Right, this is default.
  2588. @item lr>ms
  2589. Left/Right to Mid/Side.
  2590. @item ms>lr
  2591. Mid/Side to Left/Right.
  2592. @item lr>ll
  2593. Left/Right to Left/Left.
  2594. @item lr>rr
  2595. Left/Right to Right/Right.
  2596. @item lr>l+r
  2597. Left/Right to Left + Right.
  2598. @item lr>rl
  2599. Left/Right to Right/Left.
  2600. @end table
  2601. @item slev
  2602. Set level of side signal. Default is 1.
  2603. Allowed range is from 0.015625 to 64.
  2604. @item sbal
  2605. Set balance of side signal. Default is 0.
  2606. Allowed range is from -1 to 1.
  2607. @item mlev
  2608. Set level of the middle signal. Default is 1.
  2609. Allowed range is from 0.015625 to 64.
  2610. @item mpan
  2611. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2612. @item base
  2613. Set stereo base between mono and inversed channels. Default is 0.
  2614. Allowed range is from -1 to 1.
  2615. @item delay
  2616. Set delay in milliseconds how much to delay left from right channel and
  2617. vice versa. Default is 0. Allowed range is from -20 to 20.
  2618. @item sclevel
  2619. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2620. @item phase
  2621. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2622. @end table
  2623. @section stereowiden
  2624. This filter enhance the stereo effect by suppressing signal common to both
  2625. channels and by delaying the signal of left into right and vice versa,
  2626. thereby widening the stereo effect.
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item delay
  2630. Time in milliseconds of the delay of left signal into right and vice versa.
  2631. Default is 20 milliseconds.
  2632. @item feedback
  2633. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2634. effect of left signal in right output and vice versa which gives widening
  2635. effect. Default is 0.3.
  2636. @item crossfeed
  2637. Cross feed of left into right with inverted phase. This helps in suppressing
  2638. the mono. If the value is 1 it will cancel all the signal common to both
  2639. channels. Default is 0.3.
  2640. @item drymix
  2641. Set level of input signal of original channel. Default is 0.8.
  2642. @end table
  2643. @section treble
  2644. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2645. shelving filter with a response similar to that of a standard
  2646. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2647. The filter accepts the following options:
  2648. @table @option
  2649. @item gain, g
  2650. Give the gain at whichever is the lower of ~22 kHz and the
  2651. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2652. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2653. @item frequency, f
  2654. Set the filter's central frequency and so can be used
  2655. to extend or reduce the frequency range to be boosted or cut.
  2656. The default value is @code{3000} Hz.
  2657. @item width_type
  2658. Set method to specify band-width of filter.
  2659. @table @option
  2660. @item h
  2661. Hz
  2662. @item q
  2663. Q-Factor
  2664. @item o
  2665. octave
  2666. @item s
  2667. slope
  2668. @end table
  2669. @item width, w
  2670. Determine how steep is the filter's shelf transition.
  2671. @end table
  2672. @section tremolo
  2673. Sinusoidal amplitude modulation.
  2674. The filter accepts the following options:
  2675. @table @option
  2676. @item f
  2677. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2678. (20 Hz or lower) will result in a tremolo effect.
  2679. This filter may also be used as a ring modulator by specifying
  2680. a modulation frequency higher than 20 Hz.
  2681. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2682. @item d
  2683. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2684. Default value is 0.5.
  2685. @end table
  2686. @section vibrato
  2687. Sinusoidal phase modulation.
  2688. The filter accepts the following options:
  2689. @table @option
  2690. @item f
  2691. Modulation frequency in Hertz.
  2692. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2693. @item d
  2694. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2695. Default value is 0.5.
  2696. @end table
  2697. @section volume
  2698. Adjust the input audio volume.
  2699. It accepts the following parameters:
  2700. @table @option
  2701. @item volume
  2702. Set audio volume expression.
  2703. Output values are clipped to the maximum value.
  2704. The output audio volume is given by the relation:
  2705. @example
  2706. @var{output_volume} = @var{volume} * @var{input_volume}
  2707. @end example
  2708. The default value for @var{volume} is "1.0".
  2709. @item precision
  2710. This parameter represents the mathematical precision.
  2711. It determines which input sample formats will be allowed, which affects the
  2712. precision of the volume scaling.
  2713. @table @option
  2714. @item fixed
  2715. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2716. @item float
  2717. 32-bit floating-point; this limits input sample format to FLT. (default)
  2718. @item double
  2719. 64-bit floating-point; this limits input sample format to DBL.
  2720. @end table
  2721. @item replaygain
  2722. Choose the behaviour on encountering ReplayGain side data in input frames.
  2723. @table @option
  2724. @item drop
  2725. Remove ReplayGain side data, ignoring its contents (the default).
  2726. @item ignore
  2727. Ignore ReplayGain side data, but leave it in the frame.
  2728. @item track
  2729. Prefer the track gain, if present.
  2730. @item album
  2731. Prefer the album gain, if present.
  2732. @end table
  2733. @item replaygain_preamp
  2734. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2735. Default value for @var{replaygain_preamp} is 0.0.
  2736. @item eval
  2737. Set when the volume expression is evaluated.
  2738. It accepts the following values:
  2739. @table @samp
  2740. @item once
  2741. only evaluate expression once during the filter initialization, or
  2742. when the @samp{volume} command is sent
  2743. @item frame
  2744. evaluate expression for each incoming frame
  2745. @end table
  2746. Default value is @samp{once}.
  2747. @end table
  2748. The volume expression can contain the following parameters.
  2749. @table @option
  2750. @item n
  2751. frame number (starting at zero)
  2752. @item nb_channels
  2753. number of channels
  2754. @item nb_consumed_samples
  2755. number of samples consumed by the filter
  2756. @item nb_samples
  2757. number of samples in the current frame
  2758. @item pos
  2759. original frame position in the file
  2760. @item pts
  2761. frame PTS
  2762. @item sample_rate
  2763. sample rate
  2764. @item startpts
  2765. PTS at start of stream
  2766. @item startt
  2767. time at start of stream
  2768. @item t
  2769. frame time
  2770. @item tb
  2771. timestamp timebase
  2772. @item volume
  2773. last set volume value
  2774. @end table
  2775. Note that when @option{eval} is set to @samp{once} only the
  2776. @var{sample_rate} and @var{tb} variables are available, all other
  2777. variables will evaluate to NAN.
  2778. @subsection Commands
  2779. This filter supports the following commands:
  2780. @table @option
  2781. @item volume
  2782. Modify the volume expression.
  2783. The command accepts the same syntax of the corresponding option.
  2784. If the specified expression is not valid, it is kept at its current
  2785. value.
  2786. @item replaygain_noclip
  2787. Prevent clipping by limiting the gain applied.
  2788. Default value for @var{replaygain_noclip} is 1.
  2789. @end table
  2790. @subsection Examples
  2791. @itemize
  2792. @item
  2793. Halve the input audio volume:
  2794. @example
  2795. volume=volume=0.5
  2796. volume=volume=1/2
  2797. volume=volume=-6.0206dB
  2798. @end example
  2799. In all the above example the named key for @option{volume} can be
  2800. omitted, for example like in:
  2801. @example
  2802. volume=0.5
  2803. @end example
  2804. @item
  2805. Increase input audio power by 6 decibels using fixed-point precision:
  2806. @example
  2807. volume=volume=6dB:precision=fixed
  2808. @end example
  2809. @item
  2810. Fade volume after time 10 with an annihilation period of 5 seconds:
  2811. @example
  2812. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2813. @end example
  2814. @end itemize
  2815. @section volumedetect
  2816. Detect the volume of the input video.
  2817. The filter has no parameters. The input is not modified. Statistics about
  2818. the volume will be printed in the log when the input stream end is reached.
  2819. In particular it will show the mean volume (root mean square), maximum
  2820. volume (on a per-sample basis), and the beginning of a histogram of the
  2821. registered volume values (from the maximum value to a cumulated 1/1000 of
  2822. the samples).
  2823. All volumes are in decibels relative to the maximum PCM value.
  2824. @subsection Examples
  2825. Here is an excerpt of the output:
  2826. @example
  2827. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2828. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2829. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2830. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2831. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2832. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2833. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2834. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2835. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2836. @end example
  2837. It means that:
  2838. @itemize
  2839. @item
  2840. The mean square energy is approximately -27 dB, or 10^-2.7.
  2841. @item
  2842. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2843. @item
  2844. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2845. @end itemize
  2846. In other words, raising the volume by +4 dB does not cause any clipping,
  2847. raising it by +5 dB causes clipping for 6 samples, etc.
  2848. @c man end AUDIO FILTERS
  2849. @chapter Audio Sources
  2850. @c man begin AUDIO SOURCES
  2851. Below is a description of the currently available audio sources.
  2852. @section abuffer
  2853. Buffer audio frames, and make them available to the filter chain.
  2854. This source is mainly intended for a programmatic use, in particular
  2855. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2856. It accepts the following parameters:
  2857. @table @option
  2858. @item time_base
  2859. The timebase which will be used for timestamps of submitted frames. It must be
  2860. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2861. @item sample_rate
  2862. The sample rate of the incoming audio buffers.
  2863. @item sample_fmt
  2864. The sample format of the incoming audio buffers.
  2865. Either a sample format name or its corresponding integer representation from
  2866. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2867. @item channel_layout
  2868. The channel layout of the incoming audio buffers.
  2869. Either a channel layout name from channel_layout_map in
  2870. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2871. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2872. @item channels
  2873. The number of channels of the incoming audio buffers.
  2874. If both @var{channels} and @var{channel_layout} are specified, then they
  2875. must be consistent.
  2876. @end table
  2877. @subsection Examples
  2878. @example
  2879. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2880. @end example
  2881. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2882. Since the sample format with name "s16p" corresponds to the number
  2883. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2884. equivalent to:
  2885. @example
  2886. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2887. @end example
  2888. @section aevalsrc
  2889. Generate an audio signal specified by an expression.
  2890. This source accepts in input one or more expressions (one for each
  2891. channel), which are evaluated and used to generate a corresponding
  2892. audio signal.
  2893. This source accepts the following options:
  2894. @table @option
  2895. @item exprs
  2896. Set the '|'-separated expressions list for each separate channel. In case the
  2897. @option{channel_layout} option is not specified, the selected channel layout
  2898. depends on the number of provided expressions. Otherwise the last
  2899. specified expression is applied to the remaining output channels.
  2900. @item channel_layout, c
  2901. Set the channel layout. The number of channels in the specified layout
  2902. must be equal to the number of specified expressions.
  2903. @item duration, d
  2904. Set the minimum duration of the sourced audio. See
  2905. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2906. for the accepted syntax.
  2907. Note that the resulting duration may be greater than the specified
  2908. duration, as the generated audio is always cut at the end of a
  2909. complete frame.
  2910. If not specified, or the expressed duration is negative, the audio is
  2911. supposed to be generated forever.
  2912. @item nb_samples, n
  2913. Set the number of samples per channel per each output frame,
  2914. default to 1024.
  2915. @item sample_rate, s
  2916. Specify the sample rate, default to 44100.
  2917. @end table
  2918. Each expression in @var{exprs} can contain the following constants:
  2919. @table @option
  2920. @item n
  2921. number of the evaluated sample, starting from 0
  2922. @item t
  2923. time of the evaluated sample expressed in seconds, starting from 0
  2924. @item s
  2925. sample rate
  2926. @end table
  2927. @subsection Examples
  2928. @itemize
  2929. @item
  2930. Generate silence:
  2931. @example
  2932. aevalsrc=0
  2933. @end example
  2934. @item
  2935. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2936. 8000 Hz:
  2937. @example
  2938. aevalsrc="sin(440*2*PI*t):s=8000"
  2939. @end example
  2940. @item
  2941. Generate a two channels signal, specify the channel layout (Front
  2942. Center + Back Center) explicitly:
  2943. @example
  2944. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2945. @end example
  2946. @item
  2947. Generate white noise:
  2948. @example
  2949. aevalsrc="-2+random(0)"
  2950. @end example
  2951. @item
  2952. Generate an amplitude modulated signal:
  2953. @example
  2954. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2955. @end example
  2956. @item
  2957. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2958. @example
  2959. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2960. @end example
  2961. @end itemize
  2962. @section anullsrc
  2963. The null audio source, return unprocessed audio frames. It is mainly useful
  2964. as a template and to be employed in analysis / debugging tools, or as
  2965. the source for filters which ignore the input data (for example the sox
  2966. synth filter).
  2967. This source accepts the following options:
  2968. @table @option
  2969. @item channel_layout, cl
  2970. Specifies the channel layout, and can be either an integer or a string
  2971. representing a channel layout. The default value of @var{channel_layout}
  2972. is "stereo".
  2973. Check the channel_layout_map definition in
  2974. @file{libavutil/channel_layout.c} for the mapping between strings and
  2975. channel layout values.
  2976. @item sample_rate, r
  2977. Specifies the sample rate, and defaults to 44100.
  2978. @item nb_samples, n
  2979. Set the number of samples per requested frames.
  2980. @end table
  2981. @subsection Examples
  2982. @itemize
  2983. @item
  2984. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2985. @example
  2986. anullsrc=r=48000:cl=4
  2987. @end example
  2988. @item
  2989. Do the same operation with a more obvious syntax:
  2990. @example
  2991. anullsrc=r=48000:cl=mono
  2992. @end example
  2993. @end itemize
  2994. All the parameters need to be explicitly defined.
  2995. @section flite
  2996. Synthesize a voice utterance using the libflite library.
  2997. To enable compilation of this filter you need to configure FFmpeg with
  2998. @code{--enable-libflite}.
  2999. Note that the flite library is not thread-safe.
  3000. The filter accepts the following options:
  3001. @table @option
  3002. @item list_voices
  3003. If set to 1, list the names of the available voices and exit
  3004. immediately. Default value is 0.
  3005. @item nb_samples, n
  3006. Set the maximum number of samples per frame. Default value is 512.
  3007. @item textfile
  3008. Set the filename containing the text to speak.
  3009. @item text
  3010. Set the text to speak.
  3011. @item voice, v
  3012. Set the voice to use for the speech synthesis. Default value is
  3013. @code{kal}. See also the @var{list_voices} option.
  3014. @end table
  3015. @subsection Examples
  3016. @itemize
  3017. @item
  3018. Read from file @file{speech.txt}, and synthesize the text using the
  3019. standard flite voice:
  3020. @example
  3021. flite=textfile=speech.txt
  3022. @end example
  3023. @item
  3024. Read the specified text selecting the @code{slt} voice:
  3025. @example
  3026. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3027. @end example
  3028. @item
  3029. Input text to ffmpeg:
  3030. @example
  3031. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3032. @end example
  3033. @item
  3034. Make @file{ffplay} speak the specified text, using @code{flite} and
  3035. the @code{lavfi} device:
  3036. @example
  3037. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3038. @end example
  3039. @end itemize
  3040. For more information about libflite, check:
  3041. @url{http://www.speech.cs.cmu.edu/flite/}
  3042. @section anoisesrc
  3043. Generate a noise audio signal.
  3044. The filter accepts the following options:
  3045. @table @option
  3046. @item sample_rate, r
  3047. Specify the sample rate. Default value is 48000 Hz.
  3048. @item amplitude, a
  3049. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3050. is 1.0.
  3051. @item duration, d
  3052. Specify the duration of the generated audio stream. Not specifying this option
  3053. results in noise with an infinite length.
  3054. @item color, colour, c
  3055. Specify the color of noise. Available noise colors are white, pink, and brown.
  3056. Default color is white.
  3057. @item seed, s
  3058. Specify a value used to seed the PRNG.
  3059. @item nb_samples, n
  3060. Set the number of samples per each output frame, default is 1024.
  3061. @end table
  3062. @subsection Examples
  3063. @itemize
  3064. @item
  3065. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3066. @example
  3067. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3068. @end example
  3069. @end itemize
  3070. @section sine
  3071. Generate an audio signal made of a sine wave with amplitude 1/8.
  3072. The audio signal is bit-exact.
  3073. The filter accepts the following options:
  3074. @table @option
  3075. @item frequency, f
  3076. Set the carrier frequency. Default is 440 Hz.
  3077. @item beep_factor, b
  3078. Enable a periodic beep every second with frequency @var{beep_factor} times
  3079. the carrier frequency. Default is 0, meaning the beep is disabled.
  3080. @item sample_rate, r
  3081. Specify the sample rate, default is 44100.
  3082. @item duration, d
  3083. Specify the duration of the generated audio stream.
  3084. @item samples_per_frame
  3085. Set the number of samples per output frame.
  3086. The expression can contain the following constants:
  3087. @table @option
  3088. @item n
  3089. The (sequential) number of the output audio frame, starting from 0.
  3090. @item pts
  3091. The PTS (Presentation TimeStamp) of the output audio frame,
  3092. expressed in @var{TB} units.
  3093. @item t
  3094. The PTS of the output audio frame, expressed in seconds.
  3095. @item TB
  3096. The timebase of the output audio frames.
  3097. @end table
  3098. Default is @code{1024}.
  3099. @end table
  3100. @subsection Examples
  3101. @itemize
  3102. @item
  3103. Generate a simple 440 Hz sine wave:
  3104. @example
  3105. sine
  3106. @end example
  3107. @item
  3108. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3109. @example
  3110. sine=220:4:d=5
  3111. sine=f=220:b=4:d=5
  3112. sine=frequency=220:beep_factor=4:duration=5
  3113. @end example
  3114. @item
  3115. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3116. pattern:
  3117. @example
  3118. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3119. @end example
  3120. @end itemize
  3121. @c man end AUDIO SOURCES
  3122. @chapter Audio Sinks
  3123. @c man begin AUDIO SINKS
  3124. Below is a description of the currently available audio sinks.
  3125. @section abuffersink
  3126. Buffer audio frames, and make them available to the end of filter chain.
  3127. This sink is mainly intended for programmatic use, in particular
  3128. through the interface defined in @file{libavfilter/buffersink.h}
  3129. or the options system.
  3130. It accepts a pointer to an AVABufferSinkContext structure, which
  3131. defines the incoming buffers' formats, to be passed as the opaque
  3132. parameter to @code{avfilter_init_filter} for initialization.
  3133. @section anullsink
  3134. Null audio sink; do absolutely nothing with the input audio. It is
  3135. mainly useful as a template and for use in analysis / debugging
  3136. tools.
  3137. @c man end AUDIO SINKS
  3138. @chapter Video Filters
  3139. @c man begin VIDEO FILTERS
  3140. When you configure your FFmpeg build, you can disable any of the
  3141. existing filters using @code{--disable-filters}.
  3142. The configure output will show the video filters included in your
  3143. build.
  3144. Below is a description of the currently available video filters.
  3145. @section alphaextract
  3146. Extract the alpha component from the input as a grayscale video. This
  3147. is especially useful with the @var{alphamerge} filter.
  3148. @section alphamerge
  3149. Add or replace the alpha component of the primary input with the
  3150. grayscale value of a second input. This is intended for use with
  3151. @var{alphaextract} to allow the transmission or storage of frame
  3152. sequences that have alpha in a format that doesn't support an alpha
  3153. channel.
  3154. For example, to reconstruct full frames from a normal YUV-encoded video
  3155. and a separate video created with @var{alphaextract}, you might use:
  3156. @example
  3157. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3158. @end example
  3159. Since this filter is designed for reconstruction, it operates on frame
  3160. sequences without considering timestamps, and terminates when either
  3161. input reaches end of stream. This will cause problems if your encoding
  3162. pipeline drops frames. If you're trying to apply an image as an
  3163. overlay to a video stream, consider the @var{overlay} filter instead.
  3164. @section ass
  3165. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3166. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3167. Substation Alpha) subtitles files.
  3168. This filter accepts the following option in addition to the common options from
  3169. the @ref{subtitles} filter:
  3170. @table @option
  3171. @item shaping
  3172. Set the shaping engine
  3173. Available values are:
  3174. @table @samp
  3175. @item auto
  3176. The default libass shaping engine, which is the best available.
  3177. @item simple
  3178. Fast, font-agnostic shaper that can do only substitutions
  3179. @item complex
  3180. Slower shaper using OpenType for substitutions and positioning
  3181. @end table
  3182. The default is @code{auto}.
  3183. @end table
  3184. @section atadenoise
  3185. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3186. The filter accepts the following options:
  3187. @table @option
  3188. @item 0a
  3189. Set threshold A for 1st plane. Default is 0.02.
  3190. Valid range is 0 to 0.3.
  3191. @item 0b
  3192. Set threshold B for 1st plane. Default is 0.04.
  3193. Valid range is 0 to 5.
  3194. @item 1a
  3195. Set threshold A for 2nd plane. Default is 0.02.
  3196. Valid range is 0 to 0.3.
  3197. @item 1b
  3198. Set threshold B for 2nd plane. Default is 0.04.
  3199. Valid range is 0 to 5.
  3200. @item 2a
  3201. Set threshold A for 3rd plane. Default is 0.02.
  3202. Valid range is 0 to 0.3.
  3203. @item 2b
  3204. Set threshold B for 3rd plane. Default is 0.04.
  3205. Valid range is 0 to 5.
  3206. Threshold A is designed to react on abrupt changes in the input signal and
  3207. threshold B is designed to react on continuous changes in the input signal.
  3208. @item s
  3209. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3210. number in range [5, 129].
  3211. @end table
  3212. @section bbox
  3213. Compute the bounding box for the non-black pixels in the input frame
  3214. luminance plane.
  3215. This filter computes the bounding box containing all the pixels with a
  3216. luminance value greater than the minimum allowed value.
  3217. The parameters describing the bounding box are printed on the filter
  3218. log.
  3219. The filter accepts the following option:
  3220. @table @option
  3221. @item min_val
  3222. Set the minimal luminance value. Default is @code{16}.
  3223. @end table
  3224. @section blackdetect
  3225. Detect video intervals that are (almost) completely black. Can be
  3226. useful to detect chapter transitions, commercials, or invalid
  3227. recordings. Output lines contains the time for the start, end and
  3228. duration of the detected black interval expressed in seconds.
  3229. In order to display the output lines, you need to set the loglevel at
  3230. least to the AV_LOG_INFO value.
  3231. The filter accepts the following options:
  3232. @table @option
  3233. @item black_min_duration, d
  3234. Set the minimum detected black duration expressed in seconds. It must
  3235. be a non-negative floating point number.
  3236. Default value is 2.0.
  3237. @item picture_black_ratio_th, pic_th
  3238. Set the threshold for considering a picture "black".
  3239. Express the minimum value for the ratio:
  3240. @example
  3241. @var{nb_black_pixels} / @var{nb_pixels}
  3242. @end example
  3243. for which a picture is considered black.
  3244. Default value is 0.98.
  3245. @item pixel_black_th, pix_th
  3246. Set the threshold for considering a pixel "black".
  3247. The threshold expresses the maximum pixel luminance value for which a
  3248. pixel is considered "black". The provided value is scaled according to
  3249. the following equation:
  3250. @example
  3251. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3252. @end example
  3253. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3254. the input video format, the range is [0-255] for YUV full-range
  3255. formats and [16-235] for YUV non full-range formats.
  3256. Default value is 0.10.
  3257. @end table
  3258. The following example sets the maximum pixel threshold to the minimum
  3259. value, and detects only black intervals of 2 or more seconds:
  3260. @example
  3261. blackdetect=d=2:pix_th=0.00
  3262. @end example
  3263. @section blackframe
  3264. Detect frames that are (almost) completely black. Can be useful to
  3265. detect chapter transitions or commercials. Output lines consist of
  3266. the frame number of the detected frame, the percentage of blackness,
  3267. the position in the file if known or -1 and the timestamp in seconds.
  3268. In order to display the output lines, you need to set the loglevel at
  3269. least to the AV_LOG_INFO value.
  3270. It accepts the following parameters:
  3271. @table @option
  3272. @item amount
  3273. The percentage of the pixels that have to be below the threshold; it defaults to
  3274. @code{98}.
  3275. @item threshold, thresh
  3276. The threshold below which a pixel value is considered black; it defaults to
  3277. @code{32}.
  3278. @end table
  3279. @section blend, tblend
  3280. Blend two video frames into each other.
  3281. The @code{blend} filter takes two input streams and outputs one
  3282. stream, the first input is the "top" layer and second input is
  3283. "bottom" layer. Output terminates when shortest input terminates.
  3284. The @code{tblend} (time blend) filter takes two consecutive frames
  3285. from one single stream, and outputs the result obtained by blending
  3286. the new frame on top of the old frame.
  3287. A description of the accepted options follows.
  3288. @table @option
  3289. @item c0_mode
  3290. @item c1_mode
  3291. @item c2_mode
  3292. @item c3_mode
  3293. @item all_mode
  3294. Set blend mode for specific pixel component or all pixel components in case
  3295. of @var{all_mode}. Default value is @code{normal}.
  3296. Available values for component modes are:
  3297. @table @samp
  3298. @item addition
  3299. @item addition128
  3300. @item and
  3301. @item average
  3302. @item burn
  3303. @item darken
  3304. @item difference
  3305. @item difference128
  3306. @item divide
  3307. @item dodge
  3308. @item freeze
  3309. @item exclusion
  3310. @item glow
  3311. @item hardlight
  3312. @item hardmix
  3313. @item heat
  3314. @item lighten
  3315. @item linearlight
  3316. @item multiply
  3317. @item multiply128
  3318. @item negation
  3319. @item normal
  3320. @item or
  3321. @item overlay
  3322. @item phoenix
  3323. @item pinlight
  3324. @item reflect
  3325. @item screen
  3326. @item softlight
  3327. @item subtract
  3328. @item vividlight
  3329. @item xor
  3330. @end table
  3331. @item c0_opacity
  3332. @item c1_opacity
  3333. @item c2_opacity
  3334. @item c3_opacity
  3335. @item all_opacity
  3336. Set blend opacity for specific pixel component or all pixel components in case
  3337. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3338. @item c0_expr
  3339. @item c1_expr
  3340. @item c2_expr
  3341. @item c3_expr
  3342. @item all_expr
  3343. Set blend expression for specific pixel component or all pixel components in case
  3344. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3345. The expressions can use the following variables:
  3346. @table @option
  3347. @item N
  3348. The sequential number of the filtered frame, starting from @code{0}.
  3349. @item X
  3350. @item Y
  3351. the coordinates of the current sample
  3352. @item W
  3353. @item H
  3354. the width and height of currently filtered plane
  3355. @item SW
  3356. @item SH
  3357. Width and height scale depending on the currently filtered plane. It is the
  3358. ratio between the corresponding luma plane number of pixels and the current
  3359. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3360. @code{0.5,0.5} for chroma planes.
  3361. @item T
  3362. Time of the current frame, expressed in seconds.
  3363. @item TOP, A
  3364. Value of pixel component at current location for first video frame (top layer).
  3365. @item BOTTOM, B
  3366. Value of pixel component at current location for second video frame (bottom layer).
  3367. @end table
  3368. @item shortest
  3369. Force termination when the shortest input terminates. Default is
  3370. @code{0}. This option is only defined for the @code{blend} filter.
  3371. @item repeatlast
  3372. Continue applying the last bottom frame after the end of the stream. A value of
  3373. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3374. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3375. @end table
  3376. @subsection Examples
  3377. @itemize
  3378. @item
  3379. Apply transition from bottom layer to top layer in first 10 seconds:
  3380. @example
  3381. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3382. @end example
  3383. @item
  3384. Apply 1x1 checkerboard effect:
  3385. @example
  3386. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3387. @end example
  3388. @item
  3389. Apply uncover left effect:
  3390. @example
  3391. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3392. @end example
  3393. @item
  3394. Apply uncover down effect:
  3395. @example
  3396. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3397. @end example
  3398. @item
  3399. Apply uncover up-left effect:
  3400. @example
  3401. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3402. @end example
  3403. @item
  3404. Split diagonally video and shows top and bottom layer on each side:
  3405. @example
  3406. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3407. @end example
  3408. @item
  3409. Display differences between the current and the previous frame:
  3410. @example
  3411. tblend=all_mode=difference128
  3412. @end example
  3413. @end itemize
  3414. @section bwdif
  3415. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3416. Deinterlacing Filter").
  3417. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3418. interpolation algorithms.
  3419. It accepts the following parameters:
  3420. @table @option
  3421. @item mode
  3422. The interlacing mode to adopt. It accepts one of the following values:
  3423. @table @option
  3424. @item 0, send_frame
  3425. Output one frame for each frame.
  3426. @item 1, send_field
  3427. Output one frame for each field.
  3428. @end table
  3429. The default value is @code{send_field}.
  3430. @item parity
  3431. The picture field parity assumed for the input interlaced video. It accepts one
  3432. of the following values:
  3433. @table @option
  3434. @item 0, tff
  3435. Assume the top field is first.
  3436. @item 1, bff
  3437. Assume the bottom field is first.
  3438. @item -1, auto
  3439. Enable automatic detection of field parity.
  3440. @end table
  3441. The default value is @code{auto}.
  3442. If the interlacing is unknown or the decoder does not export this information,
  3443. top field first will be assumed.
  3444. @item deint
  3445. Specify which frames to deinterlace. Accept one of the following
  3446. values:
  3447. @table @option
  3448. @item 0, all
  3449. Deinterlace all frames.
  3450. @item 1, interlaced
  3451. Only deinterlace frames marked as interlaced.
  3452. @end table
  3453. The default value is @code{all}.
  3454. @end table
  3455. @section boxblur
  3456. Apply a boxblur algorithm to the input video.
  3457. It accepts the following parameters:
  3458. @table @option
  3459. @item luma_radius, lr
  3460. @item luma_power, lp
  3461. @item chroma_radius, cr
  3462. @item chroma_power, cp
  3463. @item alpha_radius, ar
  3464. @item alpha_power, ap
  3465. @end table
  3466. A description of the accepted options follows.
  3467. @table @option
  3468. @item luma_radius, lr
  3469. @item chroma_radius, cr
  3470. @item alpha_radius, ar
  3471. Set an expression for the box radius in pixels used for blurring the
  3472. corresponding input plane.
  3473. The radius value must be a non-negative number, and must not be
  3474. greater than the value of the expression @code{min(w,h)/2} for the
  3475. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3476. planes.
  3477. Default value for @option{luma_radius} is "2". If not specified,
  3478. @option{chroma_radius} and @option{alpha_radius} default to the
  3479. corresponding value set for @option{luma_radius}.
  3480. The expressions can contain the following constants:
  3481. @table @option
  3482. @item w
  3483. @item h
  3484. The input width and height in pixels.
  3485. @item cw
  3486. @item ch
  3487. The input chroma image width and height in pixels.
  3488. @item hsub
  3489. @item vsub
  3490. The horizontal and vertical chroma subsample values. For example, for the
  3491. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3492. @end table
  3493. @item luma_power, lp
  3494. @item chroma_power, cp
  3495. @item alpha_power, ap
  3496. Specify how many times the boxblur filter is applied to the
  3497. corresponding plane.
  3498. Default value for @option{luma_power} is 2. If not specified,
  3499. @option{chroma_power} and @option{alpha_power} default to the
  3500. corresponding value set for @option{luma_power}.
  3501. A value of 0 will disable the effect.
  3502. @end table
  3503. @subsection Examples
  3504. @itemize
  3505. @item
  3506. Apply a boxblur filter with the luma, chroma, and alpha radii
  3507. set to 2:
  3508. @example
  3509. boxblur=luma_radius=2:luma_power=1
  3510. boxblur=2:1
  3511. @end example
  3512. @item
  3513. Set the luma radius to 2, and alpha and chroma radius to 0:
  3514. @example
  3515. boxblur=2:1:cr=0:ar=0
  3516. @end example
  3517. @item
  3518. Set the luma and chroma radii to a fraction of the video dimension:
  3519. @example
  3520. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3521. @end example
  3522. @end itemize
  3523. @section chromakey
  3524. YUV colorspace color/chroma keying.
  3525. The filter accepts the following options:
  3526. @table @option
  3527. @item color
  3528. The color which will be replaced with transparency.
  3529. @item similarity
  3530. Similarity percentage with the key color.
  3531. 0.01 matches only the exact key color, while 1.0 matches everything.
  3532. @item blend
  3533. Blend percentage.
  3534. 0.0 makes pixels either fully transparent, or not transparent at all.
  3535. Higher values result in semi-transparent pixels, with a higher transparency
  3536. the more similar the pixels color is to the key color.
  3537. @item yuv
  3538. Signals that the color passed is already in YUV instead of RGB.
  3539. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3540. This can be used to pass exact YUV values as hexadecimal numbers.
  3541. @end table
  3542. @subsection Examples
  3543. @itemize
  3544. @item
  3545. Make every green pixel in the input image transparent:
  3546. @example
  3547. ffmpeg -i input.png -vf chromakey=green out.png
  3548. @end example
  3549. @item
  3550. Overlay a greenscreen-video on top of a static black background.
  3551. @example
  3552. 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
  3553. @end example
  3554. @end itemize
  3555. @section ciescope
  3556. Display CIE color diagram with pixels overlaid onto it.
  3557. The filter acccepts the following options:
  3558. @table @option
  3559. @item system
  3560. Set color system.
  3561. @table @samp
  3562. @item ntsc, 470m
  3563. @item ebu, 470bg
  3564. @item smpte
  3565. @item 240m
  3566. @item apple
  3567. @item widergb
  3568. @item cie1931
  3569. @item rec709, hdtv
  3570. @item uhdtv, rec2020
  3571. @end table
  3572. @item cie
  3573. Set CIE system.
  3574. @table @samp
  3575. @item xyy
  3576. @item ucs
  3577. @item luv
  3578. @end table
  3579. @item gamuts
  3580. Set what gamuts to draw.
  3581. See @code{system} option for avaiable values.
  3582. @item size, s
  3583. Set ciescope size, by default set to 512.
  3584. @item intensity, i
  3585. Set intensity used to map input pixel values to CIE diagram.
  3586. @item contrast
  3587. Set contrast used to draw tongue colors that are out of active color system gamut.
  3588. @item corrgamma
  3589. Correct gamma displayed on scope, by default enabled.
  3590. @item showwhite
  3591. Show white point on CIE diagram, by default disabled.
  3592. @item gamma
  3593. Set input gamma. Used only with XYZ input color space.
  3594. @end table
  3595. @section codecview
  3596. Visualize information exported by some codecs.
  3597. Some codecs can export information through frames using side-data or other
  3598. means. For example, some MPEG based codecs export motion vectors through the
  3599. @var{export_mvs} flag in the codec @option{flags2} option.
  3600. The filter accepts the following option:
  3601. @table @option
  3602. @item mv
  3603. Set motion vectors to visualize.
  3604. Available flags for @var{mv} are:
  3605. @table @samp
  3606. @item pf
  3607. forward predicted MVs of P-frames
  3608. @item bf
  3609. forward predicted MVs of B-frames
  3610. @item bb
  3611. backward predicted MVs of B-frames
  3612. @end table
  3613. @item qp
  3614. Display quantization parameters using the chroma planes
  3615. @end table
  3616. @subsection Examples
  3617. @itemize
  3618. @item
  3619. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3620. @example
  3621. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3622. @end example
  3623. @end itemize
  3624. @section colorbalance
  3625. Modify intensity of primary colors (red, green and blue) of input frames.
  3626. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3627. regions for the red-cyan, green-magenta or blue-yellow balance.
  3628. A positive adjustment value shifts the balance towards the primary color, a negative
  3629. value towards the complementary color.
  3630. The filter accepts the following options:
  3631. @table @option
  3632. @item rs
  3633. @item gs
  3634. @item bs
  3635. Adjust red, green and blue shadows (darkest pixels).
  3636. @item rm
  3637. @item gm
  3638. @item bm
  3639. Adjust red, green and blue midtones (medium pixels).
  3640. @item rh
  3641. @item gh
  3642. @item bh
  3643. Adjust red, green and blue highlights (brightest pixels).
  3644. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3645. @end table
  3646. @subsection Examples
  3647. @itemize
  3648. @item
  3649. Add red color cast to shadows:
  3650. @example
  3651. colorbalance=rs=.3
  3652. @end example
  3653. @end itemize
  3654. @section colorkey
  3655. RGB colorspace color keying.
  3656. The filter accepts the following options:
  3657. @table @option
  3658. @item color
  3659. The color which will be replaced with transparency.
  3660. @item similarity
  3661. Similarity percentage with the key color.
  3662. 0.01 matches only the exact key color, while 1.0 matches everything.
  3663. @item blend
  3664. Blend percentage.
  3665. 0.0 makes pixels either fully transparent, or not transparent at all.
  3666. Higher values result in semi-transparent pixels, with a higher transparency
  3667. the more similar the pixels color is to the key color.
  3668. @end table
  3669. @subsection Examples
  3670. @itemize
  3671. @item
  3672. Make every green pixel in the input image transparent:
  3673. @example
  3674. ffmpeg -i input.png -vf colorkey=green out.png
  3675. @end example
  3676. @item
  3677. Overlay a greenscreen-video on top of a static background image.
  3678. @example
  3679. 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
  3680. @end example
  3681. @end itemize
  3682. @section colorlevels
  3683. Adjust video input frames using levels.
  3684. The filter accepts the following options:
  3685. @table @option
  3686. @item rimin
  3687. @item gimin
  3688. @item bimin
  3689. @item aimin
  3690. Adjust red, green, blue and alpha input black point.
  3691. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3692. @item rimax
  3693. @item gimax
  3694. @item bimax
  3695. @item aimax
  3696. Adjust red, green, blue and alpha input white point.
  3697. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3698. Input levels are used to lighten highlights (bright tones), darken shadows
  3699. (dark tones), change the balance of bright and dark tones.
  3700. @item romin
  3701. @item gomin
  3702. @item bomin
  3703. @item aomin
  3704. Adjust red, green, blue and alpha output black point.
  3705. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3706. @item romax
  3707. @item gomax
  3708. @item bomax
  3709. @item aomax
  3710. Adjust red, green, blue and alpha output white point.
  3711. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3712. Output levels allows manual selection of a constrained output level range.
  3713. @end table
  3714. @subsection Examples
  3715. @itemize
  3716. @item
  3717. Make video output darker:
  3718. @example
  3719. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3720. @end example
  3721. @item
  3722. Increase contrast:
  3723. @example
  3724. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3725. @end example
  3726. @item
  3727. Make video output lighter:
  3728. @example
  3729. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3730. @end example
  3731. @item
  3732. Increase brightness:
  3733. @example
  3734. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3735. @end example
  3736. @end itemize
  3737. @section colorchannelmixer
  3738. Adjust video input frames by re-mixing color channels.
  3739. This filter modifies a color channel by adding the values associated to
  3740. the other channels of the same pixels. For example if the value to
  3741. modify is red, the output value will be:
  3742. @example
  3743. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3744. @end example
  3745. The filter accepts the following options:
  3746. @table @option
  3747. @item rr
  3748. @item rg
  3749. @item rb
  3750. @item ra
  3751. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3752. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3753. @item gr
  3754. @item gg
  3755. @item gb
  3756. @item ga
  3757. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3758. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3759. @item br
  3760. @item bg
  3761. @item bb
  3762. @item ba
  3763. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3764. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3765. @item ar
  3766. @item ag
  3767. @item ab
  3768. @item aa
  3769. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3770. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3771. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3772. @end table
  3773. @subsection Examples
  3774. @itemize
  3775. @item
  3776. Convert source to grayscale:
  3777. @example
  3778. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3779. @end example
  3780. @item
  3781. Simulate sepia tones:
  3782. @example
  3783. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3784. @end example
  3785. @end itemize
  3786. @section colormatrix
  3787. Convert color matrix.
  3788. The filter accepts the following options:
  3789. @table @option
  3790. @item src
  3791. @item dst
  3792. Specify the source and destination color matrix. Both values must be
  3793. specified.
  3794. The accepted values are:
  3795. @table @samp
  3796. @item bt709
  3797. BT.709
  3798. @item bt601
  3799. BT.601
  3800. @item smpte240m
  3801. SMPTE-240M
  3802. @item fcc
  3803. FCC
  3804. @end table
  3805. @end table
  3806. For example to convert from BT.601 to SMPTE-240M, use the command:
  3807. @example
  3808. colormatrix=bt601:smpte240m
  3809. @end example
  3810. @section convolution
  3811. Apply convolution 3x3 or 5x5 filter.
  3812. The filter accepts the following options:
  3813. @table @option
  3814. @item 0m
  3815. @item 1m
  3816. @item 2m
  3817. @item 3m
  3818. Set matrix for each plane.
  3819. Matrix is sequence of 9 or 25 signed integers.
  3820. @item 0rdiv
  3821. @item 1rdiv
  3822. @item 2rdiv
  3823. @item 3rdiv
  3824. Set multiplier for calculated value for each plane.
  3825. @item 0bias
  3826. @item 1bias
  3827. @item 2bias
  3828. @item 3bias
  3829. Set bias for each plane. This value is added to the result of the multiplication.
  3830. Useful for making the overall image brighter or darker. Default is 0.0.
  3831. @end table
  3832. @subsection Examples
  3833. @itemize
  3834. @item
  3835. Apply sharpen:
  3836. @example
  3837. 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"
  3838. @end example
  3839. @item
  3840. Apply blur:
  3841. @example
  3842. 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"
  3843. @end example
  3844. @item
  3845. Apply edge enhance:
  3846. @example
  3847. 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"
  3848. @end example
  3849. @item
  3850. Apply edge detect:
  3851. @example
  3852. 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"
  3853. @end example
  3854. @item
  3855. Apply emboss:
  3856. @example
  3857. 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"
  3858. @end example
  3859. @end itemize
  3860. @section copy
  3861. Copy the input source unchanged to the output. This is mainly useful for
  3862. testing purposes.
  3863. @anchor{coreimage}
  3864. @section coreimage
  3865. Video filtering on GPU using Apple's CoreImage API on OSX.
  3866. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  3867. processed by video hardware. However, software-based OpenGL implementations
  3868. exist which means there is no guarantee for hardware processing. It depends on
  3869. the respective OSX.
  3870. There are many filters and image generators provided by Apple that come with a
  3871. large variety of options. The filter has to be referenced by its name along
  3872. with its options.
  3873. The coreimage filter accepts the following options:
  3874. @table @option
  3875. @item list_filters
  3876. List all available filters and generators along with all their respective
  3877. options as well as possible minimum and maximum values along with the default
  3878. values.
  3879. @example
  3880. list_filters=true
  3881. @end example
  3882. @item filter
  3883. Specify all filters by their respective name and options.
  3884. Use @var{list_filters} to determine all valid filter names and options.
  3885. Numerical options are specified by a float value and are automatically clamped
  3886. to their respective value range. Vector and color options have to be specified
  3887. by a list of space separated float values. Character escaping has to be done.
  3888. A special option name @code{default} is available to use default options for a
  3889. filter.
  3890. It is required to specify either @code{default} or at least one of the filter options.
  3891. All omitted options are used with their default values.
  3892. The syntax of the filter string is as follows:
  3893. @example
  3894. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  3895. @end example
  3896. @item output_rect
  3897. Specify a rectangle where the output of the filter chain is copied into the
  3898. input image. It is given by a list of space separated float values:
  3899. @example
  3900. output_rect=x\ y\ width\ height
  3901. @end example
  3902. If not given, the output rectangle equals the dimensions of the input image.
  3903. The output rectangle is automatically cropped at the borders of the input
  3904. image. Negative values are valid for each component.
  3905. @example
  3906. output_rect=25\ 25\ 100\ 100
  3907. @end example
  3908. @end table
  3909. Several filters can be chained for successive processing without GPU-HOST
  3910. transfers allowing for fast processing of complex filter chains.
  3911. Currently, only filters with zero (generators) or exactly one (filters) input
  3912. image and one output image are supported. Also, transition filters are not yet
  3913. usable as intended.
  3914. Some filters generate output images with additional padding depending on the
  3915. respective filter kernel. The padding is automatically removed to ensure the
  3916. filter output has the same size as the input image.
  3917. For image generators, the size of the output image is determined by the
  3918. previous output image of the filter chain or the input image of the whole
  3919. filterchain, respectively. The generators do not use the pixel information of
  3920. this image to generate their output. However, the generated output is
  3921. blended onto this image, resulting in partial or complete coverage of the
  3922. output image.
  3923. The @ref{coreimagesrc} video source can be used for generating input images
  3924. which are directly fed into the filter chain. By using it, providing input
  3925. images by another video source or an input video is not required.
  3926. @subsection Examples
  3927. @itemize
  3928. @item
  3929. List all filters available:
  3930. @example
  3931. coreimage=list_filters=true
  3932. @end example
  3933. @item
  3934. Use the CIBoxBlur filter with default options to blur an image:
  3935. @example
  3936. coreimage=filter=CIBoxBlur@@default
  3937. @end example
  3938. @item
  3939. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  3940. its center at 100x100 and a radius of 50 pixels:
  3941. @example
  3942. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  3943. @end example
  3944. @item
  3945. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  3946. given as complete and escaped command-line for Apple's standard bash shell:
  3947. @example
  3948. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  3949. @end example
  3950. @end itemize
  3951. @section crop
  3952. Crop the input video to given dimensions.
  3953. It accepts the following parameters:
  3954. @table @option
  3955. @item w, out_w
  3956. The width of the output video. It defaults to @code{iw}.
  3957. This expression is evaluated only once during the filter
  3958. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3959. @item h, out_h
  3960. The height of the output video. It defaults to @code{ih}.
  3961. This expression is evaluated only once during the filter
  3962. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3963. @item x
  3964. The horizontal position, in the input video, of the left edge of the output
  3965. video. It defaults to @code{(in_w-out_w)/2}.
  3966. This expression is evaluated per-frame.
  3967. @item y
  3968. The vertical position, in the input video, of the top edge of the output video.
  3969. It defaults to @code{(in_h-out_h)/2}.
  3970. This expression is evaluated per-frame.
  3971. @item keep_aspect
  3972. If set to 1 will force the output display aspect ratio
  3973. to be the same of the input, by changing the output sample aspect
  3974. ratio. It defaults to 0.
  3975. @end table
  3976. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3977. expressions containing the following constants:
  3978. @table @option
  3979. @item x
  3980. @item y
  3981. The computed values for @var{x} and @var{y}. They are evaluated for
  3982. each new frame.
  3983. @item in_w
  3984. @item in_h
  3985. The input width and height.
  3986. @item iw
  3987. @item ih
  3988. These are the same as @var{in_w} and @var{in_h}.
  3989. @item out_w
  3990. @item out_h
  3991. The output (cropped) width and height.
  3992. @item ow
  3993. @item oh
  3994. These are the same as @var{out_w} and @var{out_h}.
  3995. @item a
  3996. same as @var{iw} / @var{ih}
  3997. @item sar
  3998. input sample aspect ratio
  3999. @item dar
  4000. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4001. @item hsub
  4002. @item vsub
  4003. horizontal and vertical chroma subsample values. For example for the
  4004. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4005. @item n
  4006. The number of the input frame, starting from 0.
  4007. @item pos
  4008. the position in the file of the input frame, NAN if unknown
  4009. @item t
  4010. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4011. @end table
  4012. The expression for @var{out_w} may depend on the value of @var{out_h},
  4013. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4014. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4015. evaluated after @var{out_w} and @var{out_h}.
  4016. The @var{x} and @var{y} parameters specify the expressions for the
  4017. position of the top-left corner of the output (non-cropped) area. They
  4018. are evaluated for each frame. If the evaluated value is not valid, it
  4019. is approximated to the nearest valid value.
  4020. The expression for @var{x} may depend on @var{y}, and the expression
  4021. for @var{y} may depend on @var{x}.
  4022. @subsection Examples
  4023. @itemize
  4024. @item
  4025. Crop area with size 100x100 at position (12,34).
  4026. @example
  4027. crop=100:100:12:34
  4028. @end example
  4029. Using named options, the example above becomes:
  4030. @example
  4031. crop=w=100:h=100:x=12:y=34
  4032. @end example
  4033. @item
  4034. Crop the central input area with size 100x100:
  4035. @example
  4036. crop=100:100
  4037. @end example
  4038. @item
  4039. Crop the central input area with size 2/3 of the input video:
  4040. @example
  4041. crop=2/3*in_w:2/3*in_h
  4042. @end example
  4043. @item
  4044. Crop the input video central square:
  4045. @example
  4046. crop=out_w=in_h
  4047. crop=in_h
  4048. @end example
  4049. @item
  4050. Delimit the rectangle with the top-left corner placed at position
  4051. 100:100 and the right-bottom corner corresponding to the right-bottom
  4052. corner of the input image.
  4053. @example
  4054. crop=in_w-100:in_h-100:100:100
  4055. @end example
  4056. @item
  4057. Crop 10 pixels from the left and right borders, and 20 pixels from
  4058. the top and bottom borders
  4059. @example
  4060. crop=in_w-2*10:in_h-2*20
  4061. @end example
  4062. @item
  4063. Keep only the bottom right quarter of the input image:
  4064. @example
  4065. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4066. @end example
  4067. @item
  4068. Crop height for getting Greek harmony:
  4069. @example
  4070. crop=in_w:1/PHI*in_w
  4071. @end example
  4072. @item
  4073. Apply trembling effect:
  4074. @example
  4075. 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)
  4076. @end example
  4077. @item
  4078. Apply erratic camera effect depending on timestamp:
  4079. @example
  4080. 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)"
  4081. @end example
  4082. @item
  4083. Set x depending on the value of y:
  4084. @example
  4085. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4086. @end example
  4087. @end itemize
  4088. @subsection Commands
  4089. This filter supports the following commands:
  4090. @table @option
  4091. @item w, out_w
  4092. @item h, out_h
  4093. @item x
  4094. @item y
  4095. Set width/height of the output video and the horizontal/vertical position
  4096. in the input video.
  4097. The command accepts the same syntax of the corresponding option.
  4098. If the specified expression is not valid, it is kept at its current
  4099. value.
  4100. @end table
  4101. @section cropdetect
  4102. Auto-detect the crop size.
  4103. It calculates the necessary cropping parameters and prints the
  4104. recommended parameters via the logging system. The detected dimensions
  4105. correspond to the non-black area of the input video.
  4106. It accepts the following parameters:
  4107. @table @option
  4108. @item limit
  4109. Set higher black value threshold, which can be optionally specified
  4110. from nothing (0) to everything (255 for 8bit based formats). An intensity
  4111. value greater to the set value is considered non-black. It defaults to 24.
  4112. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4113. on the bitdepth of the pixel format.
  4114. @item round
  4115. The value which the width/height should be divisible by. It defaults to
  4116. 16. The offset is automatically adjusted to center the video. Use 2 to
  4117. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4118. encoding to most video codecs.
  4119. @item reset_count, reset
  4120. Set the counter that determines after how many frames cropdetect will
  4121. reset the previously detected largest video area and start over to
  4122. detect the current optimal crop area. Default value is 0.
  4123. This can be useful when channel logos distort the video area. 0
  4124. indicates 'never reset', and returns the largest area encountered during
  4125. playback.
  4126. @end table
  4127. @anchor{curves}
  4128. @section curves
  4129. Apply color adjustments using curves.
  4130. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4131. component (red, green and blue) has its values defined by @var{N} key points
  4132. tied from each other using a smooth curve. The x-axis represents the pixel
  4133. values from the input frame, and the y-axis the new pixel values to be set for
  4134. the output frame.
  4135. By default, a component curve is defined by the two points @var{(0;0)} and
  4136. @var{(1;1)}. This creates a straight line where each original pixel value is
  4137. "adjusted" to its own value, which means no change to the image.
  4138. The filter allows you to redefine these two points and add some more. A new
  4139. curve (using a natural cubic spline interpolation) will be define to pass
  4140. smoothly through all these new coordinates. The new defined points needs to be
  4141. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4142. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4143. the vector spaces, the values will be clipped accordingly.
  4144. If there is no key point defined in @code{x=0}, the filter will automatically
  4145. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  4146. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  4147. The filter accepts the following options:
  4148. @table @option
  4149. @item preset
  4150. Select one of the available color presets. This option can be used in addition
  4151. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4152. options takes priority on the preset values.
  4153. Available presets are:
  4154. @table @samp
  4155. @item none
  4156. @item color_negative
  4157. @item cross_process
  4158. @item darker
  4159. @item increase_contrast
  4160. @item lighter
  4161. @item linear_contrast
  4162. @item medium_contrast
  4163. @item negative
  4164. @item strong_contrast
  4165. @item vintage
  4166. @end table
  4167. Default is @code{none}.
  4168. @item master, m
  4169. Set the master key points. These points will define a second pass mapping. It
  4170. is sometimes called a "luminance" or "value" mapping. It can be used with
  4171. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4172. post-processing LUT.
  4173. @item red, r
  4174. Set the key points for the red component.
  4175. @item green, g
  4176. Set the key points for the green component.
  4177. @item blue, b
  4178. Set the key points for the blue component.
  4179. @item all
  4180. Set the key points for all components (not including master).
  4181. Can be used in addition to the other key points component
  4182. options. In this case, the unset component(s) will fallback on this
  4183. @option{all} setting.
  4184. @item psfile
  4185. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4186. @end table
  4187. To avoid some filtergraph syntax conflicts, each key points list need to be
  4188. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4189. @subsection Examples
  4190. @itemize
  4191. @item
  4192. Increase slightly the middle level of blue:
  4193. @example
  4194. curves=blue='0.5/0.58'
  4195. @end example
  4196. @item
  4197. Vintage effect:
  4198. @example
  4199. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  4200. @end example
  4201. Here we obtain the following coordinates for each components:
  4202. @table @var
  4203. @item red
  4204. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4205. @item green
  4206. @code{(0;0) (0.50;0.48) (1;1)}
  4207. @item blue
  4208. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4209. @end table
  4210. @item
  4211. The previous example can also be achieved with the associated built-in preset:
  4212. @example
  4213. curves=preset=vintage
  4214. @end example
  4215. @item
  4216. Or simply:
  4217. @example
  4218. curves=vintage
  4219. @end example
  4220. @item
  4221. Use a Photoshop preset and redefine the points of the green component:
  4222. @example
  4223. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  4224. @end example
  4225. @end itemize
  4226. @section datascope
  4227. Video data analysis filter.
  4228. This filter shows hexadecimal pixel values of part of video.
  4229. The filter accepts the following options:
  4230. @table @option
  4231. @item size, s
  4232. Set output video size.
  4233. @item x
  4234. Set x offset from where to pick pixels.
  4235. @item y
  4236. Set y offset from where to pick pixels.
  4237. @item mode
  4238. Set scope mode, can be one of the following:
  4239. @table @samp
  4240. @item mono
  4241. Draw hexadecimal pixel values with white color on black background.
  4242. @item color
  4243. Draw hexadecimal pixel values with input video pixel color on black
  4244. background.
  4245. @item color2
  4246. Draw hexadecimal pixel values on color background picked from input video,
  4247. the text color is picked in such way so its always visible.
  4248. @end table
  4249. @item axis
  4250. Draw rows and columns numbers on left and top of video.
  4251. @end table
  4252. @section dctdnoiz
  4253. Denoise frames using 2D DCT (frequency domain filtering).
  4254. This filter is not designed for real time.
  4255. The filter accepts the following options:
  4256. @table @option
  4257. @item sigma, s
  4258. Set the noise sigma constant.
  4259. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4260. coefficient (absolute value) below this threshold with be dropped.
  4261. If you need a more advanced filtering, see @option{expr}.
  4262. Default is @code{0}.
  4263. @item overlap
  4264. Set number overlapping pixels for each block. Since the filter can be slow, you
  4265. may want to reduce this value, at the cost of a less effective filter and the
  4266. risk of various artefacts.
  4267. If the overlapping value doesn't permit processing the whole input width or
  4268. height, a warning will be displayed and according borders won't be denoised.
  4269. Default value is @var{blocksize}-1, which is the best possible setting.
  4270. @item expr, e
  4271. Set the coefficient factor expression.
  4272. For each coefficient of a DCT block, this expression will be evaluated as a
  4273. multiplier value for the coefficient.
  4274. If this is option is set, the @option{sigma} option will be ignored.
  4275. The absolute value of the coefficient can be accessed through the @var{c}
  4276. variable.
  4277. @item n
  4278. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4279. @var{blocksize}, which is the width and height of the processed blocks.
  4280. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4281. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4282. on the speed processing. Also, a larger block size does not necessarily means a
  4283. better de-noising.
  4284. @end table
  4285. @subsection Examples
  4286. Apply a denoise with a @option{sigma} of @code{4.5}:
  4287. @example
  4288. dctdnoiz=4.5
  4289. @end example
  4290. The same operation can be achieved using the expression system:
  4291. @example
  4292. dctdnoiz=e='gte(c, 4.5*3)'
  4293. @end example
  4294. Violent denoise using a block size of @code{16x16}:
  4295. @example
  4296. dctdnoiz=15:n=4
  4297. @end example
  4298. @section deband
  4299. Remove banding artifacts from input video.
  4300. It works by replacing banded pixels with average value of referenced pixels.
  4301. The filter accepts the following options:
  4302. @table @option
  4303. @item 1thr
  4304. @item 2thr
  4305. @item 3thr
  4306. @item 4thr
  4307. Set banding detection threshold for each plane. Default is 0.02.
  4308. Valid range is 0.00003 to 0.5.
  4309. If difference between current pixel and reference pixel is less than threshold,
  4310. it will be considered as banded.
  4311. @item range, r
  4312. Banding detection range in pixels. Default is 16. If positive, random number
  4313. in range 0 to set value will be used. If negative, exact absolute value
  4314. will be used.
  4315. The range defines square of four pixels around current pixel.
  4316. @item direction, d
  4317. Set direction in radians from which four pixel will be compared. If positive,
  4318. random direction from 0 to set direction will be picked. If negative, exact of
  4319. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4320. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4321. column.
  4322. @item blur
  4323. If enabled, current pixel is compared with average value of all four
  4324. surrounding pixels. The default is enabled. If disabled current pixel is
  4325. compared with all four surrounding pixels. The pixel is considered banded
  4326. if only all four differences with surrounding pixels are less than threshold.
  4327. @end table
  4328. @anchor{decimate}
  4329. @section decimate
  4330. Drop duplicated frames at regular intervals.
  4331. The filter accepts the following options:
  4332. @table @option
  4333. @item cycle
  4334. Set the number of frames from which one will be dropped. Setting this to
  4335. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4336. Default is @code{5}.
  4337. @item dupthresh
  4338. Set the threshold for duplicate detection. If the difference metric for a frame
  4339. is less than or equal to this value, then it is declared as duplicate. Default
  4340. is @code{1.1}
  4341. @item scthresh
  4342. Set scene change threshold. Default is @code{15}.
  4343. @item blockx
  4344. @item blocky
  4345. Set the size of the x and y-axis blocks used during metric calculations.
  4346. Larger blocks give better noise suppression, but also give worse detection of
  4347. small movements. Must be a power of two. Default is @code{32}.
  4348. @item ppsrc
  4349. Mark main input as a pre-processed input and activate clean source input
  4350. stream. This allows the input to be pre-processed with various filters to help
  4351. the metrics calculation while keeping the frame selection lossless. When set to
  4352. @code{1}, the first stream is for the pre-processed input, and the second
  4353. stream is the clean source from where the kept frames are chosen. Default is
  4354. @code{0}.
  4355. @item chroma
  4356. Set whether or not chroma is considered in the metric calculations. Default is
  4357. @code{1}.
  4358. @end table
  4359. @section deflate
  4360. Apply deflate effect to the video.
  4361. This filter replaces the pixel by the local(3x3) average by taking into account
  4362. only values lower than the pixel.
  4363. It accepts the following options:
  4364. @table @option
  4365. @item threshold0
  4366. @item threshold1
  4367. @item threshold2
  4368. @item threshold3
  4369. Limit the maximum change for each plane, default is 65535.
  4370. If 0, plane will remain unchanged.
  4371. @end table
  4372. @section dejudder
  4373. Remove judder produced by partially interlaced telecined content.
  4374. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4375. source was partially telecined content then the output of @code{pullup,dejudder}
  4376. will have a variable frame rate. May change the recorded frame rate of the
  4377. container. Aside from that change, this filter will not affect constant frame
  4378. rate video.
  4379. The option available in this filter is:
  4380. @table @option
  4381. @item cycle
  4382. Specify the length of the window over which the judder repeats.
  4383. Accepts any integer greater than 1. Useful values are:
  4384. @table @samp
  4385. @item 4
  4386. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4387. @item 5
  4388. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4389. @item 20
  4390. If a mixture of the two.
  4391. @end table
  4392. The default is @samp{4}.
  4393. @end table
  4394. @section delogo
  4395. Suppress a TV station logo by a simple interpolation of the surrounding
  4396. pixels. Just set a rectangle covering the logo and watch it disappear
  4397. (and sometimes something even uglier appear - your mileage may vary).
  4398. It accepts the following parameters:
  4399. @table @option
  4400. @item x
  4401. @item y
  4402. Specify the top left corner coordinates of the logo. They must be
  4403. specified.
  4404. @item w
  4405. @item h
  4406. Specify the width and height of the logo to clear. They must be
  4407. specified.
  4408. @item band, t
  4409. Specify the thickness of the fuzzy edge of the rectangle (added to
  4410. @var{w} and @var{h}). The default value is 1. This option is
  4411. deprecated, setting higher values should no longer be necessary and
  4412. is not recommended.
  4413. @item show
  4414. When set to 1, a green rectangle is drawn on the screen to simplify
  4415. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4416. The default value is 0.
  4417. The rectangle is drawn on the outermost pixels which will be (partly)
  4418. replaced with interpolated values. The values of the next pixels
  4419. immediately outside this rectangle in each direction will be used to
  4420. compute the interpolated pixel values inside the rectangle.
  4421. @end table
  4422. @subsection Examples
  4423. @itemize
  4424. @item
  4425. Set a rectangle covering the area with top left corner coordinates 0,0
  4426. and size 100x77, and a band of size 10:
  4427. @example
  4428. delogo=x=0:y=0:w=100:h=77:band=10
  4429. @end example
  4430. @end itemize
  4431. @section deshake
  4432. Attempt to fix small changes in horizontal and/or vertical shift. This
  4433. filter helps remove camera shake from hand-holding a camera, bumping a
  4434. tripod, moving on a vehicle, etc.
  4435. The filter accepts the following options:
  4436. @table @option
  4437. @item x
  4438. @item y
  4439. @item w
  4440. @item h
  4441. Specify a rectangular area where to limit the search for motion
  4442. vectors.
  4443. If desired the search for motion vectors can be limited to a
  4444. rectangular area of the frame defined by its top left corner, width
  4445. and height. These parameters have the same meaning as the drawbox
  4446. filter which can be used to visualise the position of the bounding
  4447. box.
  4448. This is useful when simultaneous movement of subjects within the frame
  4449. might be confused for camera motion by the motion vector search.
  4450. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4451. then the full frame is used. This allows later options to be set
  4452. without specifying the bounding box for the motion vector search.
  4453. Default - search the whole frame.
  4454. @item rx
  4455. @item ry
  4456. Specify the maximum extent of movement in x and y directions in the
  4457. range 0-64 pixels. Default 16.
  4458. @item edge
  4459. Specify how to generate pixels to fill blanks at the edge of the
  4460. frame. Available values are:
  4461. @table @samp
  4462. @item blank, 0
  4463. Fill zeroes at blank locations
  4464. @item original, 1
  4465. Original image at blank locations
  4466. @item clamp, 2
  4467. Extruded edge value at blank locations
  4468. @item mirror, 3
  4469. Mirrored edge at blank locations
  4470. @end table
  4471. Default value is @samp{mirror}.
  4472. @item blocksize
  4473. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4474. default 8.
  4475. @item contrast
  4476. Specify the contrast threshold for blocks. Only blocks with more than
  4477. the specified contrast (difference between darkest and lightest
  4478. pixels) will be considered. Range 1-255, default 125.
  4479. @item search
  4480. Specify the search strategy. Available values are:
  4481. @table @samp
  4482. @item exhaustive, 0
  4483. Set exhaustive search
  4484. @item less, 1
  4485. Set less exhaustive search.
  4486. @end table
  4487. Default value is @samp{exhaustive}.
  4488. @item filename
  4489. If set then a detailed log of the motion search is written to the
  4490. specified file.
  4491. @item opencl
  4492. If set to 1, specify using OpenCL capabilities, only available if
  4493. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4494. @end table
  4495. @section detelecine
  4496. Apply an exact inverse of the telecine operation. It requires a predefined
  4497. pattern specified using the pattern option which must be the same as that passed
  4498. to the telecine filter.
  4499. This filter accepts the following options:
  4500. @table @option
  4501. @item first_field
  4502. @table @samp
  4503. @item top, t
  4504. top field first
  4505. @item bottom, b
  4506. bottom field first
  4507. The default value is @code{top}.
  4508. @end table
  4509. @item pattern
  4510. A string of numbers representing the pulldown pattern you wish to apply.
  4511. The default value is @code{23}.
  4512. @item start_frame
  4513. A number representing position of the first frame with respect to the telecine
  4514. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4515. @end table
  4516. @section dilation
  4517. Apply dilation effect to the video.
  4518. This filter replaces the pixel by the local(3x3) maximum.
  4519. It accepts the following options:
  4520. @table @option
  4521. @item threshold0
  4522. @item threshold1
  4523. @item threshold2
  4524. @item threshold3
  4525. Limit the maximum change for each plane, default is 65535.
  4526. If 0, plane will remain unchanged.
  4527. @item coordinates
  4528. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4529. pixels are used.
  4530. Flags to local 3x3 coordinates maps like this:
  4531. 1 2 3
  4532. 4 5
  4533. 6 7 8
  4534. @end table
  4535. @section displace
  4536. Displace pixels as indicated by second and third input stream.
  4537. It takes three input streams and outputs one stream, the first input is the
  4538. source, and second and third input are displacement maps.
  4539. The second input specifies how much to displace pixels along the
  4540. x-axis, while the third input specifies how much to displace pixels
  4541. along the y-axis.
  4542. If one of displacement map streams terminates, last frame from that
  4543. displacement map will be used.
  4544. Note that once generated, displacements maps can be reused over and over again.
  4545. A description of the accepted options follows.
  4546. @table @option
  4547. @item edge
  4548. Set displace behavior for pixels that are out of range.
  4549. Available values are:
  4550. @table @samp
  4551. @item blank
  4552. Missing pixels are replaced by black pixels.
  4553. @item smear
  4554. Adjacent pixels will spread out to replace missing pixels.
  4555. @item wrap
  4556. Out of range pixels are wrapped so they point to pixels of other side.
  4557. @end table
  4558. Default is @samp{smear}.
  4559. @end table
  4560. @subsection Examples
  4561. @itemize
  4562. @item
  4563. Add ripple effect to rgb input of video size hd720:
  4564. @example
  4565. 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
  4566. @end example
  4567. @item
  4568. Add wave effect to rgb input of video size hd720:
  4569. @example
  4570. 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
  4571. @end example
  4572. @end itemize
  4573. @section drawbox
  4574. Draw a colored box on the input image.
  4575. It accepts the following parameters:
  4576. @table @option
  4577. @item x
  4578. @item y
  4579. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4580. @item width, w
  4581. @item height, h
  4582. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4583. the input width and height. It defaults to 0.
  4584. @item color, c
  4585. Specify the color of the box to write. For the general syntax of this option,
  4586. check the "Color" section in the ffmpeg-utils manual. If the special
  4587. value @code{invert} is used, the box edge color is the same as the
  4588. video with inverted luma.
  4589. @item thickness, t
  4590. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4591. See below for the list of accepted constants.
  4592. @end table
  4593. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4594. following constants:
  4595. @table @option
  4596. @item dar
  4597. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4598. @item hsub
  4599. @item vsub
  4600. horizontal and vertical chroma subsample values. For example for the
  4601. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4602. @item in_h, ih
  4603. @item in_w, iw
  4604. The input width and height.
  4605. @item sar
  4606. The input sample aspect ratio.
  4607. @item x
  4608. @item y
  4609. The x and y offset coordinates where the box is drawn.
  4610. @item w
  4611. @item h
  4612. The width and height of the drawn box.
  4613. @item t
  4614. The thickness of the drawn box.
  4615. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4616. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4617. @end table
  4618. @subsection Examples
  4619. @itemize
  4620. @item
  4621. Draw a black box around the edge of the input image:
  4622. @example
  4623. drawbox
  4624. @end example
  4625. @item
  4626. Draw a box with color red and an opacity of 50%:
  4627. @example
  4628. drawbox=10:20:200:60:red@@0.5
  4629. @end example
  4630. The previous example can be specified as:
  4631. @example
  4632. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4633. @end example
  4634. @item
  4635. Fill the box with pink color:
  4636. @example
  4637. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4638. @end example
  4639. @item
  4640. Draw a 2-pixel red 2.40:1 mask:
  4641. @example
  4642. 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
  4643. @end example
  4644. @end itemize
  4645. @section drawgraph, adrawgraph
  4646. Draw a graph using input video or audio metadata.
  4647. It accepts the following parameters:
  4648. @table @option
  4649. @item m1
  4650. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4651. @item fg1
  4652. Set 1st foreground color expression.
  4653. @item m2
  4654. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4655. @item fg2
  4656. Set 2nd foreground color expression.
  4657. @item m3
  4658. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4659. @item fg3
  4660. Set 3rd foreground color expression.
  4661. @item m4
  4662. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4663. @item fg4
  4664. Set 4th foreground color expression.
  4665. @item min
  4666. Set minimal value of metadata value.
  4667. @item max
  4668. Set maximal value of metadata value.
  4669. @item bg
  4670. Set graph background color. Default is white.
  4671. @item mode
  4672. Set graph mode.
  4673. Available values for mode is:
  4674. @table @samp
  4675. @item bar
  4676. @item dot
  4677. @item line
  4678. @end table
  4679. Default is @code{line}.
  4680. @item slide
  4681. Set slide mode.
  4682. Available values for slide is:
  4683. @table @samp
  4684. @item frame
  4685. Draw new frame when right border is reached.
  4686. @item replace
  4687. Replace old columns with new ones.
  4688. @item scroll
  4689. Scroll from right to left.
  4690. @item rscroll
  4691. Scroll from left to right.
  4692. @end table
  4693. Default is @code{frame}.
  4694. @item size
  4695. Set size of graph video. For the syntax of this option, check the
  4696. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4697. The default value is @code{900x256}.
  4698. The foreground color expressions can use the following variables:
  4699. @table @option
  4700. @item MIN
  4701. Minimal value of metadata value.
  4702. @item MAX
  4703. Maximal value of metadata value.
  4704. @item VAL
  4705. Current metadata key value.
  4706. @end table
  4707. The color is defined as 0xAABBGGRR.
  4708. @end table
  4709. Example using metadata from @ref{signalstats} filter:
  4710. @example
  4711. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4712. @end example
  4713. Example using metadata from @ref{ebur128} filter:
  4714. @example
  4715. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4716. @end example
  4717. @section drawgrid
  4718. Draw a grid on the input image.
  4719. It accepts the following parameters:
  4720. @table @option
  4721. @item x
  4722. @item y
  4723. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4724. @item width, w
  4725. @item height, h
  4726. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4727. input width and height, respectively, minus @code{thickness}, so image gets
  4728. framed. Default to 0.
  4729. @item color, c
  4730. Specify the color of the grid. For the general syntax of this option,
  4731. check the "Color" section in the ffmpeg-utils manual. If the special
  4732. value @code{invert} is used, the grid color is the same as the
  4733. video with inverted luma.
  4734. @item thickness, t
  4735. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4736. See below for the list of accepted constants.
  4737. @end table
  4738. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4739. following constants:
  4740. @table @option
  4741. @item dar
  4742. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4743. @item hsub
  4744. @item vsub
  4745. horizontal and vertical chroma subsample values. For example for the
  4746. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4747. @item in_h, ih
  4748. @item in_w, iw
  4749. The input grid cell width and height.
  4750. @item sar
  4751. The input sample aspect ratio.
  4752. @item x
  4753. @item y
  4754. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4755. @item w
  4756. @item h
  4757. The width and height of the drawn cell.
  4758. @item t
  4759. The thickness of the drawn cell.
  4760. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4761. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4762. @end table
  4763. @subsection Examples
  4764. @itemize
  4765. @item
  4766. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4767. @example
  4768. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4769. @end example
  4770. @item
  4771. Draw a white 3x3 grid with an opacity of 50%:
  4772. @example
  4773. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4774. @end example
  4775. @end itemize
  4776. @anchor{drawtext}
  4777. @section drawtext
  4778. Draw a text string or text from a specified file on top of a video, using the
  4779. libfreetype library.
  4780. To enable compilation of this filter, you need to configure FFmpeg with
  4781. @code{--enable-libfreetype}.
  4782. To enable default font fallback and the @var{font} option you need to
  4783. configure FFmpeg with @code{--enable-libfontconfig}.
  4784. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4785. @code{--enable-libfribidi}.
  4786. @subsection Syntax
  4787. It accepts the following parameters:
  4788. @table @option
  4789. @item box
  4790. Used to draw a box around text using the background color.
  4791. The value must be either 1 (enable) or 0 (disable).
  4792. The default value of @var{box} is 0.
  4793. @item boxborderw
  4794. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4795. The default value of @var{boxborderw} is 0.
  4796. @item boxcolor
  4797. The color to be used for drawing box around text. For the syntax of this
  4798. option, check the "Color" section in the ffmpeg-utils manual.
  4799. The default value of @var{boxcolor} is "white".
  4800. @item borderw
  4801. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4802. The default value of @var{borderw} is 0.
  4803. @item bordercolor
  4804. Set the color to be used for drawing border around text. For the syntax of this
  4805. option, check the "Color" section in the ffmpeg-utils manual.
  4806. The default value of @var{bordercolor} is "black".
  4807. @item expansion
  4808. Select how the @var{text} is expanded. Can be either @code{none},
  4809. @code{strftime} (deprecated) or
  4810. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4811. below for details.
  4812. @item fix_bounds
  4813. If true, check and fix text coords to avoid clipping.
  4814. @item fontcolor
  4815. The color to be used for drawing fonts. For the syntax of this option, check
  4816. the "Color" section in the ffmpeg-utils manual.
  4817. The default value of @var{fontcolor} is "black".
  4818. @item fontcolor_expr
  4819. String which is expanded the same way as @var{text} to obtain dynamic
  4820. @var{fontcolor} value. By default this option has empty value and is not
  4821. processed. When this option is set, it overrides @var{fontcolor} option.
  4822. @item font
  4823. The font family to be used for drawing text. By default Sans.
  4824. @item fontfile
  4825. The font file to be used for drawing text. The path must be included.
  4826. This parameter is mandatory if the fontconfig support is disabled.
  4827. @item draw
  4828. This option does not exist, please see the timeline system
  4829. @item alpha
  4830. Draw the text applying alpha blending. The value can
  4831. be either a number between 0.0 and 1.0
  4832. The expression accepts the same variables @var{x, y} do.
  4833. The default value is 1.
  4834. Please see fontcolor_expr
  4835. @item fontsize
  4836. The font size to be used for drawing text.
  4837. The default value of @var{fontsize} is 16.
  4838. @item text_shaping
  4839. If set to 1, attempt to shape the text (for example, reverse the order of
  4840. right-to-left text and join Arabic characters) before drawing it.
  4841. Otherwise, just draw the text exactly as given.
  4842. By default 1 (if supported).
  4843. @item ft_load_flags
  4844. The flags to be used for loading the fonts.
  4845. The flags map the corresponding flags supported by libfreetype, and are
  4846. a combination of the following values:
  4847. @table @var
  4848. @item default
  4849. @item no_scale
  4850. @item no_hinting
  4851. @item render
  4852. @item no_bitmap
  4853. @item vertical_layout
  4854. @item force_autohint
  4855. @item crop_bitmap
  4856. @item pedantic
  4857. @item ignore_global_advance_width
  4858. @item no_recurse
  4859. @item ignore_transform
  4860. @item monochrome
  4861. @item linear_design
  4862. @item no_autohint
  4863. @end table
  4864. Default value is "default".
  4865. For more information consult the documentation for the FT_LOAD_*
  4866. libfreetype flags.
  4867. @item shadowcolor
  4868. The color to be used for drawing a shadow behind the drawn text. For the
  4869. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4870. The default value of @var{shadowcolor} is "black".
  4871. @item shadowx
  4872. @item shadowy
  4873. The x and y offsets for the text shadow position with respect to the
  4874. position of the text. They can be either positive or negative
  4875. values. The default value for both is "0".
  4876. @item start_number
  4877. The starting frame number for the n/frame_num variable. The default value
  4878. is "0".
  4879. @item tabsize
  4880. The size in number of spaces to use for rendering the tab.
  4881. Default value is 4.
  4882. @item timecode
  4883. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4884. format. It can be used with or without text parameter. @var{timecode_rate}
  4885. option must be specified.
  4886. @item timecode_rate, rate, r
  4887. Set the timecode frame rate (timecode only).
  4888. @item text
  4889. The text string to be drawn. The text must be a sequence of UTF-8
  4890. encoded characters.
  4891. This parameter is mandatory if no file is specified with the parameter
  4892. @var{textfile}.
  4893. @item textfile
  4894. A text file containing text to be drawn. The text must be a sequence
  4895. of UTF-8 encoded characters.
  4896. This parameter is mandatory if no text string is specified with the
  4897. parameter @var{text}.
  4898. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4899. @item reload
  4900. If set to 1, the @var{textfile} will be reloaded before each frame.
  4901. Be sure to update it atomically, or it may be read partially, or even fail.
  4902. @item x
  4903. @item y
  4904. The expressions which specify the offsets where text will be drawn
  4905. within the video frame. They are relative to the top/left border of the
  4906. output image.
  4907. The default value of @var{x} and @var{y} is "0".
  4908. See below for the list of accepted constants and functions.
  4909. @end table
  4910. The parameters for @var{x} and @var{y} are expressions containing the
  4911. following constants and functions:
  4912. @table @option
  4913. @item dar
  4914. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4915. @item hsub
  4916. @item vsub
  4917. horizontal and vertical chroma subsample values. For example for the
  4918. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4919. @item line_h, lh
  4920. the height of each text line
  4921. @item main_h, h, H
  4922. the input height
  4923. @item main_w, w, W
  4924. the input width
  4925. @item max_glyph_a, ascent
  4926. the maximum distance from the baseline to the highest/upper grid
  4927. coordinate used to place a glyph outline point, for all the rendered
  4928. glyphs.
  4929. It is a positive value, due to the grid's orientation with the Y axis
  4930. upwards.
  4931. @item max_glyph_d, descent
  4932. the maximum distance from the baseline to the lowest grid coordinate
  4933. used to place a glyph outline point, for all the rendered glyphs.
  4934. This is a negative value, due to the grid's orientation, with the Y axis
  4935. upwards.
  4936. @item max_glyph_h
  4937. maximum glyph height, that is the maximum height for all the glyphs
  4938. contained in the rendered text, it is equivalent to @var{ascent} -
  4939. @var{descent}.
  4940. @item max_glyph_w
  4941. maximum glyph width, that is the maximum width for all the glyphs
  4942. contained in the rendered text
  4943. @item n
  4944. the number of input frame, starting from 0
  4945. @item rand(min, max)
  4946. return a random number included between @var{min} and @var{max}
  4947. @item sar
  4948. The input sample aspect ratio.
  4949. @item t
  4950. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4951. @item text_h, th
  4952. the height of the rendered text
  4953. @item text_w, tw
  4954. the width of the rendered text
  4955. @item x
  4956. @item y
  4957. the x and y offset coordinates where the text is drawn.
  4958. These parameters allow the @var{x} and @var{y} expressions to refer
  4959. each other, so you can for example specify @code{y=x/dar}.
  4960. @end table
  4961. @anchor{drawtext_expansion}
  4962. @subsection Text expansion
  4963. If @option{expansion} is set to @code{strftime},
  4964. the filter recognizes strftime() sequences in the provided text and
  4965. expands them accordingly. Check the documentation of strftime(). This
  4966. feature is deprecated.
  4967. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4968. If @option{expansion} is set to @code{normal} (which is the default),
  4969. the following expansion mechanism is used.
  4970. The backslash character @samp{\}, followed by any character, always expands to
  4971. the second character.
  4972. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4973. braces is a function name, possibly followed by arguments separated by ':'.
  4974. If the arguments contain special characters or delimiters (':' or '@}'),
  4975. they should be escaped.
  4976. Note that they probably must also be escaped as the value for the
  4977. @option{text} option in the filter argument string and as the filter
  4978. argument in the filtergraph description, and possibly also for the shell,
  4979. that makes up to four levels of escaping; using a text file avoids these
  4980. problems.
  4981. The following functions are available:
  4982. @table @command
  4983. @item expr, e
  4984. The expression evaluation result.
  4985. It must take one argument specifying the expression to be evaluated,
  4986. which accepts the same constants and functions as the @var{x} and
  4987. @var{y} values. Note that not all constants should be used, for
  4988. example the text size is not known when evaluating the expression, so
  4989. the constants @var{text_w} and @var{text_h} will have an undefined
  4990. value.
  4991. @item expr_int_format, eif
  4992. Evaluate the expression's value and output as formatted integer.
  4993. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4994. The second argument specifies the output format. Allowed values are @samp{x},
  4995. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4996. @code{printf} function.
  4997. The third parameter is optional and sets the number of positions taken by the output.
  4998. It can be used to add padding with zeros from the left.
  4999. @item gmtime
  5000. The time at which the filter is running, expressed in UTC.
  5001. It can accept an argument: a strftime() format string.
  5002. @item localtime
  5003. The time at which the filter is running, expressed in the local time zone.
  5004. It can accept an argument: a strftime() format string.
  5005. @item metadata
  5006. Frame metadata. It must take one argument specifying metadata key.
  5007. @item n, frame_num
  5008. The frame number, starting from 0.
  5009. @item pict_type
  5010. A 1 character description of the current picture type.
  5011. @item pts
  5012. The timestamp of the current frame.
  5013. It can take up to three arguments.
  5014. The first argument is the format of the timestamp; it defaults to @code{flt}
  5015. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5016. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5017. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5018. @code{localtime} stands for the timestamp of the frame formatted as
  5019. local time zone time.
  5020. The second argument is an offset added to the timestamp.
  5021. If the format is set to @code{localtime} or @code{gmtime},
  5022. a third argument may be supplied: a strftime() format string.
  5023. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5024. @end table
  5025. @subsection Examples
  5026. @itemize
  5027. @item
  5028. Draw "Test Text" with font FreeSerif, using the default values for the
  5029. optional parameters.
  5030. @example
  5031. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5032. @end example
  5033. @item
  5034. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5035. and y=50 (counting from the top-left corner of the screen), text is
  5036. yellow with a red box around it. Both the text and the box have an
  5037. opacity of 20%.
  5038. @example
  5039. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5040. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5041. @end example
  5042. Note that the double quotes are not necessary if spaces are not used
  5043. within the parameter list.
  5044. @item
  5045. Show the text at the center of the video frame:
  5046. @example
  5047. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5048. @end example
  5049. @item
  5050. Show a text line sliding from right to left in the last row of the video
  5051. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5052. with no newlines.
  5053. @example
  5054. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5055. @end example
  5056. @item
  5057. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5058. @example
  5059. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5060. @end example
  5061. @item
  5062. Draw a single green letter "g", at the center of the input video.
  5063. The glyph baseline is placed at half screen height.
  5064. @example
  5065. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5066. @end example
  5067. @item
  5068. Show text for 1 second every 3 seconds:
  5069. @example
  5070. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5071. @end example
  5072. @item
  5073. Use fontconfig to set the font. Note that the colons need to be escaped.
  5074. @example
  5075. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5076. @end example
  5077. @item
  5078. Print the date of a real-time encoding (see strftime(3)):
  5079. @example
  5080. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5081. @end example
  5082. @item
  5083. Show text fading in and out (appearing/disappearing):
  5084. @example
  5085. #!/bin/sh
  5086. DS=1.0 # display start
  5087. DE=10.0 # display end
  5088. FID=1.5 # fade in duration
  5089. FOD=5 # fade out duration
  5090. 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 @}"
  5091. @end example
  5092. @end itemize
  5093. For more information about libfreetype, check:
  5094. @url{http://www.freetype.org/}.
  5095. For more information about fontconfig, check:
  5096. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5097. For more information about libfribidi, check:
  5098. @url{http://fribidi.org/}.
  5099. @section edgedetect
  5100. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5101. The filter accepts the following options:
  5102. @table @option
  5103. @item low
  5104. @item high
  5105. Set low and high threshold values used by the Canny thresholding
  5106. algorithm.
  5107. The high threshold selects the "strong" edge pixels, which are then
  5108. connected through 8-connectivity with the "weak" edge pixels selected
  5109. by the low threshold.
  5110. @var{low} and @var{high} threshold values must be chosen in the range
  5111. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5112. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5113. is @code{50/255}.
  5114. @item mode
  5115. Define the drawing mode.
  5116. @table @samp
  5117. @item wires
  5118. Draw white/gray wires on black background.
  5119. @item colormix
  5120. Mix the colors to create a paint/cartoon effect.
  5121. @end table
  5122. Default value is @var{wires}.
  5123. @end table
  5124. @subsection Examples
  5125. @itemize
  5126. @item
  5127. Standard edge detection with custom values for the hysteresis thresholding:
  5128. @example
  5129. edgedetect=low=0.1:high=0.4
  5130. @end example
  5131. @item
  5132. Painting effect without thresholding:
  5133. @example
  5134. edgedetect=mode=colormix:high=0
  5135. @end example
  5136. @end itemize
  5137. @section eq
  5138. Set brightness, contrast, saturation and approximate gamma adjustment.
  5139. The filter accepts the following options:
  5140. @table @option
  5141. @item contrast
  5142. Set the contrast expression. The value must be a float value in range
  5143. @code{-2.0} to @code{2.0}. The default value is "1".
  5144. @item brightness
  5145. Set the brightness expression. The value must be a float value in
  5146. range @code{-1.0} to @code{1.0}. The default value is "0".
  5147. @item saturation
  5148. Set the saturation expression. The value must be a float in
  5149. range @code{0.0} to @code{3.0}. The default value is "1".
  5150. @item gamma
  5151. Set the gamma expression. The value must be a float in range
  5152. @code{0.1} to @code{10.0}. The default value is "1".
  5153. @item gamma_r
  5154. Set the gamma expression for red. The value must be a float in
  5155. range @code{0.1} to @code{10.0}. The default value is "1".
  5156. @item gamma_g
  5157. Set the gamma expression for green. The value must be a float in range
  5158. @code{0.1} to @code{10.0}. The default value is "1".
  5159. @item gamma_b
  5160. Set the gamma expression for blue. The value must be a float in range
  5161. @code{0.1} to @code{10.0}. The default value is "1".
  5162. @item gamma_weight
  5163. Set the gamma weight expression. It can be used to reduce the effect
  5164. of a high gamma value on bright image areas, e.g. keep them from
  5165. getting overamplified and just plain white. The value must be a float
  5166. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5167. gamma correction all the way down while @code{1.0} leaves it at its
  5168. full strength. Default is "1".
  5169. @item eval
  5170. Set when the expressions for brightness, contrast, saturation and
  5171. gamma expressions are evaluated.
  5172. It accepts the following values:
  5173. @table @samp
  5174. @item init
  5175. only evaluate expressions once during the filter initialization or
  5176. when a command is processed
  5177. @item frame
  5178. evaluate expressions for each incoming frame
  5179. @end table
  5180. Default value is @samp{init}.
  5181. @end table
  5182. The expressions accept the following parameters:
  5183. @table @option
  5184. @item n
  5185. frame count of the input frame starting from 0
  5186. @item pos
  5187. byte position of the corresponding packet in the input file, NAN if
  5188. unspecified
  5189. @item r
  5190. frame rate of the input video, NAN if the input frame rate is unknown
  5191. @item t
  5192. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5193. @end table
  5194. @subsection Commands
  5195. The filter supports the following commands:
  5196. @table @option
  5197. @item contrast
  5198. Set the contrast expression.
  5199. @item brightness
  5200. Set the brightness expression.
  5201. @item saturation
  5202. Set the saturation expression.
  5203. @item gamma
  5204. Set the gamma expression.
  5205. @item gamma_r
  5206. Set the gamma_r expression.
  5207. @item gamma_g
  5208. Set gamma_g expression.
  5209. @item gamma_b
  5210. Set gamma_b expression.
  5211. @item gamma_weight
  5212. Set gamma_weight expression.
  5213. The command accepts the same syntax of the corresponding option.
  5214. If the specified expression is not valid, it is kept at its current
  5215. value.
  5216. @end table
  5217. @section erosion
  5218. Apply erosion effect to the video.
  5219. This filter replaces the pixel by the local(3x3) minimum.
  5220. It accepts the following options:
  5221. @table @option
  5222. @item threshold0
  5223. @item threshold1
  5224. @item threshold2
  5225. @item threshold3
  5226. Limit the maximum change for each plane, default is 65535.
  5227. If 0, plane will remain unchanged.
  5228. @item coordinates
  5229. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5230. pixels are used.
  5231. Flags to local 3x3 coordinates maps like this:
  5232. 1 2 3
  5233. 4 5
  5234. 6 7 8
  5235. @end table
  5236. @section extractplanes
  5237. Extract color channel components from input video stream into
  5238. separate grayscale video streams.
  5239. The filter accepts the following option:
  5240. @table @option
  5241. @item planes
  5242. Set plane(s) to extract.
  5243. Available values for planes are:
  5244. @table @samp
  5245. @item y
  5246. @item u
  5247. @item v
  5248. @item a
  5249. @item r
  5250. @item g
  5251. @item b
  5252. @end table
  5253. Choosing planes not available in the input will result in an error.
  5254. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5255. with @code{y}, @code{u}, @code{v} planes at same time.
  5256. @end table
  5257. @subsection Examples
  5258. @itemize
  5259. @item
  5260. Extract luma, u and v color channel component from input video frame
  5261. into 3 grayscale outputs:
  5262. @example
  5263. 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
  5264. @end example
  5265. @end itemize
  5266. @section elbg
  5267. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5268. For each input image, the filter will compute the optimal mapping from
  5269. the input to the output given the codebook length, that is the number
  5270. of distinct output colors.
  5271. This filter accepts the following options.
  5272. @table @option
  5273. @item codebook_length, l
  5274. Set codebook length. The value must be a positive integer, and
  5275. represents the number of distinct output colors. Default value is 256.
  5276. @item nb_steps, n
  5277. Set the maximum number of iterations to apply for computing the optimal
  5278. mapping. The higher the value the better the result and the higher the
  5279. computation time. Default value is 1.
  5280. @item seed, s
  5281. Set a random seed, must be an integer included between 0 and
  5282. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5283. will try to use a good random seed on a best effort basis.
  5284. @item pal8
  5285. Set pal8 output pixel format. This option does not work with codebook
  5286. length greater than 256.
  5287. @end table
  5288. @section fade
  5289. Apply a fade-in/out effect to the input video.
  5290. It accepts the following parameters:
  5291. @table @option
  5292. @item type, t
  5293. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5294. effect.
  5295. Default is @code{in}.
  5296. @item start_frame, s
  5297. Specify the number of the frame to start applying the fade
  5298. effect at. Default is 0.
  5299. @item nb_frames, n
  5300. The number of frames that the fade effect lasts. At the end of the
  5301. fade-in effect, the output video will have the same intensity as the input video.
  5302. At the end of the fade-out transition, the output video will be filled with the
  5303. selected @option{color}.
  5304. Default is 25.
  5305. @item alpha
  5306. If set to 1, fade only alpha channel, if one exists on the input.
  5307. Default value is 0.
  5308. @item start_time, st
  5309. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5310. effect. If both start_frame and start_time are specified, the fade will start at
  5311. whichever comes last. Default is 0.
  5312. @item duration, d
  5313. The number of seconds for which the fade effect has to last. At the end of the
  5314. fade-in effect the output video will have the same intensity as the input video,
  5315. at the end of the fade-out transition the output video will be filled with the
  5316. selected @option{color}.
  5317. If both duration and nb_frames are specified, duration is used. Default is 0
  5318. (nb_frames is used by default).
  5319. @item color, c
  5320. Specify the color of the fade. Default is "black".
  5321. @end table
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Fade in the first 30 frames of video:
  5326. @example
  5327. fade=in:0:30
  5328. @end example
  5329. The command above is equivalent to:
  5330. @example
  5331. fade=t=in:s=0:n=30
  5332. @end example
  5333. @item
  5334. Fade out the last 45 frames of a 200-frame video:
  5335. @example
  5336. fade=out:155:45
  5337. fade=type=out:start_frame=155:nb_frames=45
  5338. @end example
  5339. @item
  5340. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5341. @example
  5342. fade=in:0:25, fade=out:975:25
  5343. @end example
  5344. @item
  5345. Make the first 5 frames yellow, then fade in from frame 5-24:
  5346. @example
  5347. fade=in:5:20:color=yellow
  5348. @end example
  5349. @item
  5350. Fade in alpha over first 25 frames of video:
  5351. @example
  5352. fade=in:0:25:alpha=1
  5353. @end example
  5354. @item
  5355. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5356. @example
  5357. fade=t=in:st=5.5:d=0.5
  5358. @end example
  5359. @end itemize
  5360. @section fftfilt
  5361. Apply arbitrary expressions to samples in frequency domain
  5362. @table @option
  5363. @item dc_Y
  5364. Adjust the dc value (gain) of the luma plane of the image. The filter
  5365. accepts an integer value in range @code{0} to @code{1000}. The default
  5366. value is set to @code{0}.
  5367. @item dc_U
  5368. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5369. filter accepts an integer value in range @code{0} to @code{1000}. The
  5370. default value is set to @code{0}.
  5371. @item dc_V
  5372. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5373. filter accepts an integer value in range @code{0} to @code{1000}. The
  5374. default value is set to @code{0}.
  5375. @item weight_Y
  5376. Set the frequency domain weight expression for the luma plane.
  5377. @item weight_U
  5378. Set the frequency domain weight expression for the 1st chroma plane.
  5379. @item weight_V
  5380. Set the frequency domain weight expression for the 2nd chroma plane.
  5381. The filter accepts the following variables:
  5382. @item X
  5383. @item Y
  5384. The coordinates of the current sample.
  5385. @item W
  5386. @item H
  5387. The width and height of the image.
  5388. @end table
  5389. @subsection Examples
  5390. @itemize
  5391. @item
  5392. High-pass:
  5393. @example
  5394. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5395. @end example
  5396. @item
  5397. Low-pass:
  5398. @example
  5399. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5400. @end example
  5401. @item
  5402. Sharpen:
  5403. @example
  5404. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5405. @end example
  5406. @item
  5407. Blur:
  5408. @example
  5409. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5410. @end example
  5411. @end itemize
  5412. @section field
  5413. Extract a single field from an interlaced image using stride
  5414. arithmetic to avoid wasting CPU time. The output frames are marked as
  5415. non-interlaced.
  5416. The filter accepts the following options:
  5417. @table @option
  5418. @item type
  5419. Specify whether to extract the top (if the value is @code{0} or
  5420. @code{top}) or the bottom field (if the value is @code{1} or
  5421. @code{bottom}).
  5422. @end table
  5423. @section fieldhint
  5424. Create new frames by copying the top and bottom fields from surrounding frames
  5425. supplied as numbers by the hint file.
  5426. @table @option
  5427. @item hint
  5428. Set file containing hints: absolute/relative frame numbers.
  5429. There must be one line for each frame in a clip. Each line must contain two
  5430. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5431. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5432. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5433. for @code{relative} mode. First number tells from which frame to pick up top
  5434. field and second number tells from which frame to pick up bottom field.
  5435. If optionally followed by @code{+} output frame will be marked as interlaced,
  5436. else if followed by @code{-} output frame will be marked as progressive, else
  5437. it will be marked same as input frame.
  5438. If line starts with @code{#} or @code{;} that line is skipped.
  5439. @item mode
  5440. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5441. @end table
  5442. Example of first several lines of @code{hint} file for @code{relative} mode:
  5443. @example
  5444. 0,0 - # first frame
  5445. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5446. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5447. 1,0 -
  5448. 0,0 -
  5449. 0,0 -
  5450. 1,0 -
  5451. 1,0 -
  5452. 1,0 -
  5453. 0,0 -
  5454. 0,0 -
  5455. 1,0 -
  5456. 1,0 -
  5457. 1,0 -
  5458. 0,0 -
  5459. @end example
  5460. @section fieldmatch
  5461. Field matching filter for inverse telecine. It is meant to reconstruct the
  5462. progressive frames from a telecined stream. The filter does not drop duplicated
  5463. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5464. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5465. The separation of the field matching and the decimation is notably motivated by
  5466. the possibility of inserting a de-interlacing filter fallback between the two.
  5467. If the source has mixed telecined and real interlaced content,
  5468. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5469. But these remaining combed frames will be marked as interlaced, and thus can be
  5470. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5471. In addition to the various configuration options, @code{fieldmatch} can take an
  5472. optional second stream, activated through the @option{ppsrc} option. If
  5473. enabled, the frames reconstruction will be based on the fields and frames from
  5474. this second stream. This allows the first input to be pre-processed in order to
  5475. help the various algorithms of the filter, while keeping the output lossless
  5476. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5477. or brightness/contrast adjustments can help.
  5478. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5479. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5480. which @code{fieldmatch} is based on. While the semantic and usage are very
  5481. close, some behaviour and options names can differ.
  5482. The @ref{decimate} filter currently only works for constant frame rate input.
  5483. If your input has mixed telecined (30fps) and progressive content with a lower
  5484. framerate like 24fps use the following filterchain to produce the necessary cfr
  5485. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5486. The filter accepts the following options:
  5487. @table @option
  5488. @item order
  5489. Specify the assumed field order of the input stream. Available values are:
  5490. @table @samp
  5491. @item auto
  5492. Auto detect parity (use FFmpeg's internal parity value).
  5493. @item bff
  5494. Assume bottom field first.
  5495. @item tff
  5496. Assume top field first.
  5497. @end table
  5498. Note that it is sometimes recommended not to trust the parity announced by the
  5499. stream.
  5500. Default value is @var{auto}.
  5501. @item mode
  5502. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5503. sense that it won't risk creating jerkiness due to duplicate frames when
  5504. possible, but if there are bad edits or blended fields it will end up
  5505. outputting combed frames when a good match might actually exist. On the other
  5506. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5507. but will almost always find a good frame if there is one. The other values are
  5508. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5509. jerkiness and creating duplicate frames versus finding good matches in sections
  5510. with bad edits, orphaned fields, blended fields, etc.
  5511. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5512. Available values are:
  5513. @table @samp
  5514. @item pc
  5515. 2-way matching (p/c)
  5516. @item pc_n
  5517. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5518. @item pc_u
  5519. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5520. @item pc_n_ub
  5521. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5522. still combed (p/c + n + u/b)
  5523. @item pcn
  5524. 3-way matching (p/c/n)
  5525. @item pcn_ub
  5526. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5527. detected as combed (p/c/n + u/b)
  5528. @end table
  5529. The parenthesis at the end indicate the matches that would be used for that
  5530. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5531. @var{top}).
  5532. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5533. the slowest.
  5534. Default value is @var{pc_n}.
  5535. @item ppsrc
  5536. Mark the main input stream as a pre-processed input, and enable the secondary
  5537. input stream as the clean source to pick the fields from. See the filter
  5538. introduction for more details. It is similar to the @option{clip2} feature from
  5539. VFM/TFM.
  5540. Default value is @code{0} (disabled).
  5541. @item field
  5542. Set the field to match from. It is recommended to set this to the same value as
  5543. @option{order} unless you experience matching failures with that setting. In
  5544. certain circumstances changing the field that is used to match from can have a
  5545. large impact on matching performance. Available values are:
  5546. @table @samp
  5547. @item auto
  5548. Automatic (same value as @option{order}).
  5549. @item bottom
  5550. Match from the bottom field.
  5551. @item top
  5552. Match from the top field.
  5553. @end table
  5554. Default value is @var{auto}.
  5555. @item mchroma
  5556. Set whether or not chroma is included during the match comparisons. In most
  5557. cases it is recommended to leave this enabled. You should set this to @code{0}
  5558. only if your clip has bad chroma problems such as heavy rainbowing or other
  5559. artifacts. Setting this to @code{0} could also be used to speed things up at
  5560. the cost of some accuracy.
  5561. Default value is @code{1}.
  5562. @item y0
  5563. @item y1
  5564. These define an exclusion band which excludes the lines between @option{y0} and
  5565. @option{y1} from being included in the field matching decision. An exclusion
  5566. band can be used to ignore subtitles, a logo, or other things that may
  5567. interfere with the matching. @option{y0} sets the starting scan line and
  5568. @option{y1} sets the ending line; all lines in between @option{y0} and
  5569. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5570. @option{y0} and @option{y1} to the same value will disable the feature.
  5571. @option{y0} and @option{y1} defaults to @code{0}.
  5572. @item scthresh
  5573. Set the scene change detection threshold as a percentage of maximum change on
  5574. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5575. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5576. @option{scthresh} is @code{[0.0, 100.0]}.
  5577. Default value is @code{12.0}.
  5578. @item combmatch
  5579. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5580. account the combed scores of matches when deciding what match to use as the
  5581. final match. Available values are:
  5582. @table @samp
  5583. @item none
  5584. No final matching based on combed scores.
  5585. @item sc
  5586. Combed scores are only used when a scene change is detected.
  5587. @item full
  5588. Use combed scores all the time.
  5589. @end table
  5590. Default is @var{sc}.
  5591. @item combdbg
  5592. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5593. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5594. Available values are:
  5595. @table @samp
  5596. @item none
  5597. No forced calculation.
  5598. @item pcn
  5599. Force p/c/n calculations.
  5600. @item pcnub
  5601. Force p/c/n/u/b calculations.
  5602. @end table
  5603. Default value is @var{none}.
  5604. @item cthresh
  5605. This is the area combing threshold used for combed frame detection. This
  5606. essentially controls how "strong" or "visible" combing must be to be detected.
  5607. Larger values mean combing must be more visible and smaller values mean combing
  5608. can be less visible or strong and still be detected. Valid settings are from
  5609. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5610. be detected as combed). This is basically a pixel difference value. A good
  5611. range is @code{[8, 12]}.
  5612. Default value is @code{9}.
  5613. @item chroma
  5614. Sets whether or not chroma is considered in the combed frame decision. Only
  5615. disable this if your source has chroma problems (rainbowing, etc.) that are
  5616. causing problems for the combed frame detection with chroma enabled. Actually,
  5617. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5618. where there is chroma only combing in the source.
  5619. Default value is @code{0}.
  5620. @item blockx
  5621. @item blocky
  5622. Respectively set the x-axis and y-axis size of the window used during combed
  5623. frame detection. This has to do with the size of the area in which
  5624. @option{combpel} pixels are required to be detected as combed for a frame to be
  5625. declared combed. See the @option{combpel} parameter description for more info.
  5626. Possible values are any number that is a power of 2 starting at 4 and going up
  5627. to 512.
  5628. Default value is @code{16}.
  5629. @item combpel
  5630. The number of combed pixels inside any of the @option{blocky} by
  5631. @option{blockx} size blocks on the frame for the frame to be detected as
  5632. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5633. setting controls "how much" combing there must be in any localized area (a
  5634. window defined by the @option{blockx} and @option{blocky} settings) on the
  5635. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5636. which point no frames will ever be detected as combed). This setting is known
  5637. as @option{MI} in TFM/VFM vocabulary.
  5638. Default value is @code{80}.
  5639. @end table
  5640. @anchor{p/c/n/u/b meaning}
  5641. @subsection p/c/n/u/b meaning
  5642. @subsubsection p/c/n
  5643. We assume the following telecined stream:
  5644. @example
  5645. Top fields: 1 2 2 3 4
  5646. Bottom fields: 1 2 3 4 4
  5647. @end example
  5648. The numbers correspond to the progressive frame the fields relate to. Here, the
  5649. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5650. When @code{fieldmatch} is configured to run a matching from bottom
  5651. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5652. @example
  5653. Input stream:
  5654. T 1 2 2 3 4
  5655. B 1 2 3 4 4 <-- matching reference
  5656. Matches: c c n n c
  5657. Output stream:
  5658. T 1 2 3 4 4
  5659. B 1 2 3 4 4
  5660. @end example
  5661. As a result of the field matching, we can see that some frames get duplicated.
  5662. To perform a complete inverse telecine, you need to rely on a decimation filter
  5663. after this operation. See for instance the @ref{decimate} filter.
  5664. The same operation now matching from top fields (@option{field}=@var{top})
  5665. looks like this:
  5666. @example
  5667. Input stream:
  5668. T 1 2 2 3 4 <-- matching reference
  5669. B 1 2 3 4 4
  5670. Matches: c c p p c
  5671. Output stream:
  5672. T 1 2 2 3 4
  5673. B 1 2 2 3 4
  5674. @end example
  5675. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5676. basically, they refer to the frame and field of the opposite parity:
  5677. @itemize
  5678. @item @var{p} matches the field of the opposite parity in the previous frame
  5679. @item @var{c} matches the field of the opposite parity in the current frame
  5680. @item @var{n} matches the field of the opposite parity in the next frame
  5681. @end itemize
  5682. @subsubsection u/b
  5683. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5684. from the opposite parity flag. In the following examples, we assume that we are
  5685. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5686. 'x' is placed above and below each matched fields.
  5687. With bottom matching (@option{field}=@var{bottom}):
  5688. @example
  5689. Match: c p n b u
  5690. x x x x x
  5691. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5692. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5693. x x x x x
  5694. Output frames:
  5695. 2 1 2 2 2
  5696. 2 2 2 1 3
  5697. @end example
  5698. With top matching (@option{field}=@var{top}):
  5699. @example
  5700. Match: c p n b u
  5701. x x x x x
  5702. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5703. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5704. x x x x x
  5705. Output frames:
  5706. 2 2 2 1 2
  5707. 2 1 3 2 2
  5708. @end example
  5709. @subsection Examples
  5710. Simple IVTC of a top field first telecined stream:
  5711. @example
  5712. fieldmatch=order=tff:combmatch=none, decimate
  5713. @end example
  5714. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5715. @example
  5716. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5717. @end example
  5718. @section fieldorder
  5719. Transform the field order of the input video.
  5720. It accepts the following parameters:
  5721. @table @option
  5722. @item order
  5723. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5724. for bottom field first.
  5725. @end table
  5726. The default value is @samp{tff}.
  5727. The transformation is done by shifting the picture content up or down
  5728. by one line, and filling the remaining line with appropriate picture content.
  5729. This method is consistent with most broadcast field order converters.
  5730. If the input video is not flagged as being interlaced, or it is already
  5731. flagged as being of the required output field order, then this filter does
  5732. not alter the incoming video.
  5733. It is very useful when converting to or from PAL DV material,
  5734. which is bottom field first.
  5735. For example:
  5736. @example
  5737. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5738. @end example
  5739. @section fifo, afifo
  5740. Buffer input images and send them when they are requested.
  5741. It is mainly useful when auto-inserted by the libavfilter
  5742. framework.
  5743. It does not take parameters.
  5744. @section find_rect
  5745. Find a rectangular object
  5746. It accepts the following options:
  5747. @table @option
  5748. @item object
  5749. Filepath of the object image, needs to be in gray8.
  5750. @item threshold
  5751. Detection threshold, default is 0.5.
  5752. @item mipmaps
  5753. Number of mipmaps, default is 3.
  5754. @item xmin, ymin, xmax, ymax
  5755. Specifies the rectangle in which to search.
  5756. @end table
  5757. @subsection Examples
  5758. @itemize
  5759. @item
  5760. Generate a representative palette of a given video using @command{ffmpeg}:
  5761. @example
  5762. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5763. @end example
  5764. @end itemize
  5765. @section cover_rect
  5766. Cover a rectangular object
  5767. It accepts the following options:
  5768. @table @option
  5769. @item cover
  5770. Filepath of the optional cover image, needs to be in yuv420.
  5771. @item mode
  5772. Set covering mode.
  5773. It accepts the following values:
  5774. @table @samp
  5775. @item cover
  5776. cover it by the supplied image
  5777. @item blur
  5778. cover it by interpolating the surrounding pixels
  5779. @end table
  5780. Default value is @var{blur}.
  5781. @end table
  5782. @subsection Examples
  5783. @itemize
  5784. @item
  5785. Generate a representative palette of a given video using @command{ffmpeg}:
  5786. @example
  5787. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5788. @end example
  5789. @end itemize
  5790. @anchor{format}
  5791. @section format
  5792. Convert the input video to one of the specified pixel formats.
  5793. Libavfilter will try to pick one that is suitable as input to
  5794. the next filter.
  5795. It accepts the following parameters:
  5796. @table @option
  5797. @item pix_fmts
  5798. A '|'-separated list of pixel format names, such as
  5799. "pix_fmts=yuv420p|monow|rgb24".
  5800. @end table
  5801. @subsection Examples
  5802. @itemize
  5803. @item
  5804. Convert the input video to the @var{yuv420p} format
  5805. @example
  5806. format=pix_fmts=yuv420p
  5807. @end example
  5808. Convert the input video to any of the formats in the list
  5809. @example
  5810. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5811. @end example
  5812. @end itemize
  5813. @anchor{fps}
  5814. @section fps
  5815. Convert the video to specified constant frame rate by duplicating or dropping
  5816. frames as necessary.
  5817. It accepts the following parameters:
  5818. @table @option
  5819. @item fps
  5820. The desired output frame rate. The default is @code{25}.
  5821. @item round
  5822. Rounding method.
  5823. Possible values are:
  5824. @table @option
  5825. @item zero
  5826. zero round towards 0
  5827. @item inf
  5828. round away from 0
  5829. @item down
  5830. round towards -infinity
  5831. @item up
  5832. round towards +infinity
  5833. @item near
  5834. round to nearest
  5835. @end table
  5836. The default is @code{near}.
  5837. @item start_time
  5838. Assume the first PTS should be the given value, in seconds. This allows for
  5839. padding/trimming at the start of stream. By default, no assumption is made
  5840. about the first frame's expected PTS, so no padding or trimming is done.
  5841. For example, this could be set to 0 to pad the beginning with duplicates of
  5842. the first frame if a video stream starts after the audio stream or to trim any
  5843. frames with a negative PTS.
  5844. @end table
  5845. Alternatively, the options can be specified as a flat string:
  5846. @var{fps}[:@var{round}].
  5847. See also the @ref{setpts} filter.
  5848. @subsection Examples
  5849. @itemize
  5850. @item
  5851. A typical usage in order to set the fps to 25:
  5852. @example
  5853. fps=fps=25
  5854. @end example
  5855. @item
  5856. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5857. @example
  5858. fps=fps=film:round=near
  5859. @end example
  5860. @end itemize
  5861. @section framepack
  5862. Pack two different video streams into a stereoscopic video, setting proper
  5863. metadata on supported codecs. The two views should have the same size and
  5864. framerate and processing will stop when the shorter video ends. Please note
  5865. that you may conveniently adjust view properties with the @ref{scale} and
  5866. @ref{fps} filters.
  5867. It accepts the following parameters:
  5868. @table @option
  5869. @item format
  5870. The desired packing format. Supported values are:
  5871. @table @option
  5872. @item sbs
  5873. The views are next to each other (default).
  5874. @item tab
  5875. The views are on top of each other.
  5876. @item lines
  5877. The views are packed by line.
  5878. @item columns
  5879. The views are packed by column.
  5880. @item frameseq
  5881. The views are temporally interleaved.
  5882. @end table
  5883. @end table
  5884. Some examples:
  5885. @example
  5886. # Convert left and right views into a frame-sequential video
  5887. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5888. # Convert views into a side-by-side video with the same output resolution as the input
  5889. 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
  5890. @end example
  5891. @section framerate
  5892. Change the frame rate by interpolating new video output frames from the source
  5893. frames.
  5894. This filter is not designed to function correctly with interlaced media. If
  5895. you wish to change the frame rate of interlaced media then you are required
  5896. to deinterlace before this filter and re-interlace after this filter.
  5897. A description of the accepted options follows.
  5898. @table @option
  5899. @item fps
  5900. Specify the output frames per second. This option can also be specified
  5901. as a value alone. The default is @code{50}.
  5902. @item interp_start
  5903. Specify the start of a range where the output frame will be created as a
  5904. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5905. the default is @code{15}.
  5906. @item interp_end
  5907. Specify the end of a range where the output frame will be created as a
  5908. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5909. the default is @code{240}.
  5910. @item scene
  5911. Specify the level at which a scene change is detected as a value between
  5912. 0 and 100 to indicate a new scene; a low value reflects a low
  5913. probability for the current frame to introduce a new scene, while a higher
  5914. value means the current frame is more likely to be one.
  5915. The default is @code{7}.
  5916. @item flags
  5917. Specify flags influencing the filter process.
  5918. Available value for @var{flags} is:
  5919. @table @option
  5920. @item scene_change_detect, scd
  5921. Enable scene change detection using the value of the option @var{scene}.
  5922. This flag is enabled by default.
  5923. @end table
  5924. @end table
  5925. @section framestep
  5926. Select one frame every N-th frame.
  5927. This filter accepts the following option:
  5928. @table @option
  5929. @item step
  5930. Select frame after every @code{step} frames.
  5931. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5932. @end table
  5933. @anchor{frei0r}
  5934. @section frei0r
  5935. Apply a frei0r effect to the input video.
  5936. To enable the compilation of this filter, you need to install the frei0r
  5937. header and configure FFmpeg with @code{--enable-frei0r}.
  5938. It accepts the following parameters:
  5939. @table @option
  5940. @item filter_name
  5941. The name of the frei0r effect to load. If the environment variable
  5942. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5943. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5944. Otherwise, the standard frei0r paths are searched, in this order:
  5945. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5946. @file{/usr/lib/frei0r-1/}.
  5947. @item filter_params
  5948. A '|'-separated list of parameters to pass to the frei0r effect.
  5949. @end table
  5950. A frei0r effect parameter can be a boolean (its value is either
  5951. "y" or "n"), a double, a color (specified as
  5952. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5953. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5954. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5955. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5956. The number and types of parameters depend on the loaded effect. If an
  5957. effect parameter is not specified, the default value is set.
  5958. @subsection Examples
  5959. @itemize
  5960. @item
  5961. Apply the distort0r effect, setting the first two double parameters:
  5962. @example
  5963. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5964. @end example
  5965. @item
  5966. Apply the colordistance effect, taking a color as the first parameter:
  5967. @example
  5968. frei0r=colordistance:0.2/0.3/0.4
  5969. frei0r=colordistance:violet
  5970. frei0r=colordistance:0x112233
  5971. @end example
  5972. @item
  5973. Apply the perspective effect, specifying the top left and top right image
  5974. positions:
  5975. @example
  5976. frei0r=perspective:0.2/0.2|0.8/0.2
  5977. @end example
  5978. @end itemize
  5979. For more information, see
  5980. @url{http://frei0r.dyne.org}
  5981. @section fspp
  5982. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5983. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5984. processing filter, one of them is performed once per block, not per pixel.
  5985. This allows for much higher speed.
  5986. The filter accepts the following options:
  5987. @table @option
  5988. @item quality
  5989. Set quality. This option defines the number of levels for averaging. It accepts
  5990. an integer in the range 4-5. Default value is @code{4}.
  5991. @item qp
  5992. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5993. If not set, the filter will use the QP from the video stream (if available).
  5994. @item strength
  5995. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5996. more details but also more artifacts, while higher values make the image smoother
  5997. but also blurrier. Default value is @code{0} − PSNR optimal.
  5998. @item use_bframe_qp
  5999. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6000. option may cause flicker since the B-Frames have often larger QP. Default is
  6001. @code{0} (not enabled).
  6002. @end table
  6003. @section geq
  6004. The filter accepts the following options:
  6005. @table @option
  6006. @item lum_expr, lum
  6007. Set the luminance expression.
  6008. @item cb_expr, cb
  6009. Set the chrominance blue expression.
  6010. @item cr_expr, cr
  6011. Set the chrominance red expression.
  6012. @item alpha_expr, a
  6013. Set the alpha expression.
  6014. @item red_expr, r
  6015. Set the red expression.
  6016. @item green_expr, g
  6017. Set the green expression.
  6018. @item blue_expr, b
  6019. Set the blue expression.
  6020. @end table
  6021. The colorspace is selected according to the specified options. If one
  6022. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6023. options is specified, the filter will automatically select a YCbCr
  6024. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6025. @option{blue_expr} options is specified, it will select an RGB
  6026. colorspace.
  6027. If one of the chrominance expression is not defined, it falls back on the other
  6028. one. If no alpha expression is specified it will evaluate to opaque value.
  6029. If none of chrominance expressions are specified, they will evaluate
  6030. to the luminance expression.
  6031. The expressions can use the following variables and functions:
  6032. @table @option
  6033. @item N
  6034. The sequential number of the filtered frame, starting from @code{0}.
  6035. @item X
  6036. @item Y
  6037. The coordinates of the current sample.
  6038. @item W
  6039. @item H
  6040. The width and height of the image.
  6041. @item SW
  6042. @item SH
  6043. Width and height scale depending on the currently filtered plane. It is the
  6044. ratio between the corresponding luma plane number of pixels and the current
  6045. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6046. @code{0.5,0.5} for chroma planes.
  6047. @item T
  6048. Time of the current frame, expressed in seconds.
  6049. @item p(x, y)
  6050. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6051. plane.
  6052. @item lum(x, y)
  6053. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6054. plane.
  6055. @item cb(x, y)
  6056. Return the value of the pixel at location (@var{x},@var{y}) of the
  6057. blue-difference chroma plane. Return 0 if there is no such plane.
  6058. @item cr(x, y)
  6059. Return the value of the pixel at location (@var{x},@var{y}) of the
  6060. red-difference chroma plane. Return 0 if there is no such plane.
  6061. @item r(x, y)
  6062. @item g(x, y)
  6063. @item b(x, y)
  6064. Return the value of the pixel at location (@var{x},@var{y}) of the
  6065. red/green/blue component. Return 0 if there is no such component.
  6066. @item alpha(x, y)
  6067. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6068. plane. Return 0 if there is no such plane.
  6069. @end table
  6070. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6071. automatically clipped to the closer edge.
  6072. @subsection Examples
  6073. @itemize
  6074. @item
  6075. Flip the image horizontally:
  6076. @example
  6077. geq=p(W-X\,Y)
  6078. @end example
  6079. @item
  6080. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6081. wavelength of 100 pixels:
  6082. @example
  6083. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6084. @end example
  6085. @item
  6086. Generate a fancy enigmatic moving light:
  6087. @example
  6088. 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
  6089. @end example
  6090. @item
  6091. Generate a quick emboss effect:
  6092. @example
  6093. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6094. @end example
  6095. @item
  6096. Modify RGB components depending on pixel position:
  6097. @example
  6098. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6099. @end example
  6100. @item
  6101. Create a radial gradient that is the same size as the input (also see
  6102. the @ref{vignette} filter):
  6103. @example
  6104. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6105. @end example
  6106. @end itemize
  6107. @section gradfun
  6108. Fix the banding artifacts that are sometimes introduced into nearly flat
  6109. regions by truncation to 8bit color depth.
  6110. Interpolate the gradients that should go where the bands are, and
  6111. dither them.
  6112. It is designed for playback only. Do not use it prior to
  6113. lossy compression, because compression tends to lose the dither and
  6114. bring back the bands.
  6115. It accepts the following parameters:
  6116. @table @option
  6117. @item strength
  6118. The maximum amount by which the filter will change any one pixel. This is also
  6119. the threshold for detecting nearly flat regions. Acceptable values range from
  6120. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6121. valid range.
  6122. @item radius
  6123. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6124. gradients, but also prevents the filter from modifying the pixels near detailed
  6125. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6126. values will be clipped to the valid range.
  6127. @end table
  6128. Alternatively, the options can be specified as a flat string:
  6129. @var{strength}[:@var{radius}]
  6130. @subsection Examples
  6131. @itemize
  6132. @item
  6133. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6134. @example
  6135. gradfun=3.5:8
  6136. @end example
  6137. @item
  6138. Specify radius, omitting the strength (which will fall-back to the default
  6139. value):
  6140. @example
  6141. gradfun=radius=8
  6142. @end example
  6143. @end itemize
  6144. @anchor{haldclut}
  6145. @section haldclut
  6146. Apply a Hald CLUT to a video stream.
  6147. First input is the video stream to process, and second one is the Hald CLUT.
  6148. The Hald CLUT input can be a simple picture or a complete video stream.
  6149. The filter accepts the following options:
  6150. @table @option
  6151. @item shortest
  6152. Force termination when the shortest input terminates. Default is @code{0}.
  6153. @item repeatlast
  6154. Continue applying the last CLUT after the end of the stream. A value of
  6155. @code{0} disable the filter after the last frame of the CLUT is reached.
  6156. Default is @code{1}.
  6157. @end table
  6158. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6159. filters share the same internals).
  6160. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6161. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6162. @subsection Workflow examples
  6163. @subsubsection Hald CLUT video stream
  6164. Generate an identity Hald CLUT stream altered with various effects:
  6165. @example
  6166. 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
  6167. @end example
  6168. Note: make sure you use a lossless codec.
  6169. Then use it with @code{haldclut} to apply it on some random stream:
  6170. @example
  6171. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6172. @end example
  6173. The Hald CLUT will be applied to the 10 first seconds (duration of
  6174. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6175. to the remaining frames of the @code{mandelbrot} stream.
  6176. @subsubsection Hald CLUT with preview
  6177. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6178. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6179. biggest possible square starting at the top left of the picture. The remaining
  6180. padding pixels (bottom or right) will be ignored. This area can be used to add
  6181. a preview of the Hald CLUT.
  6182. Typically, the following generated Hald CLUT will be supported by the
  6183. @code{haldclut} filter:
  6184. @example
  6185. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6186. pad=iw+320 [padded_clut];
  6187. smptebars=s=320x256, split [a][b];
  6188. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6189. [main][b] overlay=W-320" -frames:v 1 clut.png
  6190. @end example
  6191. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6192. bars are displayed on the right-top, and below the same color bars processed by
  6193. the color changes.
  6194. Then, the effect of this Hald CLUT can be visualized with:
  6195. @example
  6196. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6197. @end example
  6198. @section hflip
  6199. Flip the input video horizontally.
  6200. For example, to horizontally flip the input video with @command{ffmpeg}:
  6201. @example
  6202. ffmpeg -i in.avi -vf "hflip" out.avi
  6203. @end example
  6204. @section histeq
  6205. This filter applies a global color histogram equalization on a
  6206. per-frame basis.
  6207. It can be used to correct video that has a compressed range of pixel
  6208. intensities. The filter redistributes the pixel intensities to
  6209. equalize their distribution across the intensity range. It may be
  6210. viewed as an "automatically adjusting contrast filter". This filter is
  6211. useful only for correcting degraded or poorly captured source
  6212. video.
  6213. The filter accepts the following options:
  6214. @table @option
  6215. @item strength
  6216. Determine the amount of equalization to be applied. As the strength
  6217. is reduced, the distribution of pixel intensities more-and-more
  6218. approaches that of the input frame. The value must be a float number
  6219. in the range [0,1] and defaults to 0.200.
  6220. @item intensity
  6221. Set the maximum intensity that can generated and scale the output
  6222. values appropriately. The strength should be set as desired and then
  6223. the intensity can be limited if needed to avoid washing-out. The value
  6224. must be a float number in the range [0,1] and defaults to 0.210.
  6225. @item antibanding
  6226. Set the antibanding level. If enabled the filter will randomly vary
  6227. the luminance of output pixels by a small amount to avoid banding of
  6228. the histogram. Possible values are @code{none}, @code{weak} or
  6229. @code{strong}. It defaults to @code{none}.
  6230. @end table
  6231. @section histogram
  6232. Compute and draw a color distribution histogram for the input video.
  6233. The computed histogram is a representation of the color component
  6234. distribution in an image.
  6235. Standard histogram displays the color components distribution in an image.
  6236. Displays color graph for each color component. Shows distribution of
  6237. the Y, U, V, A or R, G, B components, depending on input format, in the
  6238. current frame. Below each graph a color component scale meter is shown.
  6239. The filter accepts the following options:
  6240. @table @option
  6241. @item level_height
  6242. Set height of level. Default value is @code{200}.
  6243. Allowed range is [50, 2048].
  6244. @item scale_height
  6245. Set height of color scale. Default value is @code{12}.
  6246. Allowed range is [0, 40].
  6247. @item display_mode
  6248. Set display mode.
  6249. It accepts the following values:
  6250. @table @samp
  6251. @item parade
  6252. Per color component graphs are placed below each other.
  6253. @item overlay
  6254. Presents information identical to that in the @code{parade}, except
  6255. that the graphs representing color components are superimposed directly
  6256. over one another.
  6257. @end table
  6258. Default is @code{parade}.
  6259. @item levels_mode
  6260. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6261. Default is @code{linear}.
  6262. @item components
  6263. Set what color components to display.
  6264. Default is @code{7}.
  6265. @end table
  6266. @subsection Examples
  6267. @itemize
  6268. @item
  6269. Calculate and draw histogram:
  6270. @example
  6271. ffplay -i input -vf histogram
  6272. @end example
  6273. @end itemize
  6274. @anchor{hqdn3d}
  6275. @section hqdn3d
  6276. This is a high precision/quality 3d denoise filter. It aims to reduce
  6277. image noise, producing smooth images and making still images really
  6278. still. It should enhance compressibility.
  6279. It accepts the following optional parameters:
  6280. @table @option
  6281. @item luma_spatial
  6282. A non-negative floating point number which specifies spatial luma strength.
  6283. It defaults to 4.0.
  6284. @item chroma_spatial
  6285. A non-negative floating point number which specifies spatial chroma strength.
  6286. It defaults to 3.0*@var{luma_spatial}/4.0.
  6287. @item luma_tmp
  6288. A floating point number which specifies luma temporal strength. It defaults to
  6289. 6.0*@var{luma_spatial}/4.0.
  6290. @item chroma_tmp
  6291. A floating point number which specifies chroma temporal strength. It defaults to
  6292. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6293. @end table
  6294. @anchor{hwupload_cuda}
  6295. @section hwupload_cuda
  6296. Upload system memory frames to a CUDA device.
  6297. It accepts the following optional parameters:
  6298. @table @option
  6299. @item device
  6300. The number of the CUDA device to use
  6301. @end table
  6302. @section hqx
  6303. Apply a high-quality magnification filter designed for pixel art. This filter
  6304. was originally created by Maxim Stepin.
  6305. It accepts the following option:
  6306. @table @option
  6307. @item n
  6308. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6309. @code{hq3x} and @code{4} for @code{hq4x}.
  6310. Default is @code{3}.
  6311. @end table
  6312. @section hstack
  6313. Stack input videos horizontally.
  6314. All streams must be of same pixel format and of same height.
  6315. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6316. to create same output.
  6317. The filter accept the following option:
  6318. @table @option
  6319. @item inputs
  6320. Set number of input streams. Default is 2.
  6321. @item shortest
  6322. If set to 1, force the output to terminate when the shortest input
  6323. terminates. Default value is 0.
  6324. @end table
  6325. @section hue
  6326. Modify the hue and/or the saturation of the input.
  6327. It accepts the following parameters:
  6328. @table @option
  6329. @item h
  6330. Specify the hue angle as a number of degrees. It accepts an expression,
  6331. and defaults to "0".
  6332. @item s
  6333. Specify the saturation in the [-10,10] range. It accepts an expression and
  6334. defaults to "1".
  6335. @item H
  6336. Specify the hue angle as a number of radians. It accepts an
  6337. expression, and defaults to "0".
  6338. @item b
  6339. Specify the brightness in the [-10,10] range. It accepts an expression and
  6340. defaults to "0".
  6341. @end table
  6342. @option{h} and @option{H} are mutually exclusive, and can't be
  6343. specified at the same time.
  6344. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6345. expressions containing the following constants:
  6346. @table @option
  6347. @item n
  6348. frame count of the input frame starting from 0
  6349. @item pts
  6350. presentation timestamp of the input frame expressed in time base units
  6351. @item r
  6352. frame rate of the input video, NAN if the input frame rate is unknown
  6353. @item t
  6354. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6355. @item tb
  6356. time base of the input video
  6357. @end table
  6358. @subsection Examples
  6359. @itemize
  6360. @item
  6361. Set the hue to 90 degrees and the saturation to 1.0:
  6362. @example
  6363. hue=h=90:s=1
  6364. @end example
  6365. @item
  6366. Same command but expressing the hue in radians:
  6367. @example
  6368. hue=H=PI/2:s=1
  6369. @end example
  6370. @item
  6371. Rotate hue and make the saturation swing between 0
  6372. and 2 over a period of 1 second:
  6373. @example
  6374. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6375. @end example
  6376. @item
  6377. Apply a 3 seconds saturation fade-in effect starting at 0:
  6378. @example
  6379. hue="s=min(t/3\,1)"
  6380. @end example
  6381. The general fade-in expression can be written as:
  6382. @example
  6383. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6384. @end example
  6385. @item
  6386. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6387. @example
  6388. hue="s=max(0\, min(1\, (8-t)/3))"
  6389. @end example
  6390. The general fade-out expression can be written as:
  6391. @example
  6392. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6393. @end example
  6394. @end itemize
  6395. @subsection Commands
  6396. This filter supports the following commands:
  6397. @table @option
  6398. @item b
  6399. @item s
  6400. @item h
  6401. @item H
  6402. Modify the hue and/or the saturation and/or brightness of the input video.
  6403. The command accepts the same syntax of the corresponding option.
  6404. If the specified expression is not valid, it is kept at its current
  6405. value.
  6406. @end table
  6407. @section idet
  6408. Detect video interlacing type.
  6409. This filter tries to detect if the input frames as interlaced, progressive,
  6410. top or bottom field first. It will also try and detect fields that are
  6411. repeated between adjacent frames (a sign of telecine).
  6412. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6413. Multiple frame detection incorporates the classification history of previous frames.
  6414. The filter will log these metadata values:
  6415. @table @option
  6416. @item single.current_frame
  6417. Detected type of current frame using single-frame detection. One of:
  6418. ``tff'' (top field first), ``bff'' (bottom field first),
  6419. ``progressive'', or ``undetermined''
  6420. @item single.tff
  6421. Cumulative number of frames detected as top field first using single-frame detection.
  6422. @item multiple.tff
  6423. Cumulative number of frames detected as top field first using multiple-frame detection.
  6424. @item single.bff
  6425. Cumulative number of frames detected as bottom field first using single-frame detection.
  6426. @item multiple.current_frame
  6427. Detected type of current frame using multiple-frame detection. One of:
  6428. ``tff'' (top field first), ``bff'' (bottom field first),
  6429. ``progressive'', or ``undetermined''
  6430. @item multiple.bff
  6431. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6432. @item single.progressive
  6433. Cumulative number of frames detected as progressive using single-frame detection.
  6434. @item multiple.progressive
  6435. Cumulative number of frames detected as progressive using multiple-frame detection.
  6436. @item single.undetermined
  6437. Cumulative number of frames that could not be classified using single-frame detection.
  6438. @item multiple.undetermined
  6439. Cumulative number of frames that could not be classified using multiple-frame detection.
  6440. @item repeated.current_frame
  6441. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6442. @item repeated.neither
  6443. Cumulative number of frames with no repeated field.
  6444. @item repeated.top
  6445. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6446. @item repeated.bottom
  6447. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6448. @end table
  6449. The filter accepts the following options:
  6450. @table @option
  6451. @item intl_thres
  6452. Set interlacing threshold.
  6453. @item prog_thres
  6454. Set progressive threshold.
  6455. @item rep_thres
  6456. Threshold for repeated field detection.
  6457. @item half_life
  6458. Number of frames after which a given frame's contribution to the
  6459. statistics is halved (i.e., it contributes only 0.5 to it's
  6460. classification). The default of 0 means that all frames seen are given
  6461. full weight of 1.0 forever.
  6462. @item analyze_interlaced_flag
  6463. When this is not 0 then idet will use the specified number of frames to determine
  6464. if the interlaced flag is accurate, it will not count undetermined frames.
  6465. If the flag is found to be accurate it will be used without any further
  6466. computations, if it is found to be inaccurate it will be cleared without any
  6467. further computations. This allows inserting the idet filter as a low computational
  6468. method to clean up the interlaced flag
  6469. @end table
  6470. @section il
  6471. Deinterleave or interleave fields.
  6472. This filter allows one to process interlaced images fields without
  6473. deinterlacing them. Deinterleaving splits the input frame into 2
  6474. fields (so called half pictures). Odd lines are moved to the top
  6475. half of the output image, even lines to the bottom half.
  6476. You can process (filter) them independently and then re-interleave them.
  6477. The filter accepts the following options:
  6478. @table @option
  6479. @item luma_mode, l
  6480. @item chroma_mode, c
  6481. @item alpha_mode, a
  6482. Available values for @var{luma_mode}, @var{chroma_mode} and
  6483. @var{alpha_mode} are:
  6484. @table @samp
  6485. @item none
  6486. Do nothing.
  6487. @item deinterleave, d
  6488. Deinterleave fields, placing one above the other.
  6489. @item interleave, i
  6490. Interleave fields. Reverse the effect of deinterleaving.
  6491. @end table
  6492. Default value is @code{none}.
  6493. @item luma_swap, ls
  6494. @item chroma_swap, cs
  6495. @item alpha_swap, as
  6496. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6497. @end table
  6498. @section inflate
  6499. Apply inflate effect to the video.
  6500. This filter replaces the pixel by the local(3x3) average by taking into account
  6501. only values higher than the pixel.
  6502. It accepts the following options:
  6503. @table @option
  6504. @item threshold0
  6505. @item threshold1
  6506. @item threshold2
  6507. @item threshold3
  6508. Limit the maximum change for each plane, default is 65535.
  6509. If 0, plane will remain unchanged.
  6510. @end table
  6511. @section interlace
  6512. Simple interlacing filter from progressive contents. This interleaves upper (or
  6513. lower) lines from odd frames with lower (or upper) lines from even frames,
  6514. halving the frame rate and preserving image height.
  6515. @example
  6516. Original Original New Frame
  6517. Frame 'j' Frame 'j+1' (tff)
  6518. ========== =========== ==================
  6519. Line 0 --------------------> Frame 'j' Line 0
  6520. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6521. Line 2 ---------------------> Frame 'j' Line 2
  6522. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6523. ... ... ...
  6524. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6525. @end example
  6526. It accepts the following optional parameters:
  6527. @table @option
  6528. @item scan
  6529. This determines whether the interlaced frame is taken from the even
  6530. (tff - default) or odd (bff) lines of the progressive frame.
  6531. @item lowpass
  6532. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6533. interlacing and reduce moire patterns.
  6534. @end table
  6535. @section kerndeint
  6536. Deinterlace input video by applying Donald Graft's adaptive kernel
  6537. deinterling. Work on interlaced parts of a video to produce
  6538. progressive frames.
  6539. The description of the accepted parameters follows.
  6540. @table @option
  6541. @item thresh
  6542. Set the threshold which affects the filter's tolerance when
  6543. determining if a pixel line must be processed. It must be an integer
  6544. in the range [0,255] and defaults to 10. A value of 0 will result in
  6545. applying the process on every pixels.
  6546. @item map
  6547. Paint pixels exceeding the threshold value to white if set to 1.
  6548. Default is 0.
  6549. @item order
  6550. Set the fields order. Swap fields if set to 1, leave fields alone if
  6551. 0. Default is 0.
  6552. @item sharp
  6553. Enable additional sharpening if set to 1. Default is 0.
  6554. @item twoway
  6555. Enable twoway sharpening if set to 1. Default is 0.
  6556. @end table
  6557. @subsection Examples
  6558. @itemize
  6559. @item
  6560. Apply default values:
  6561. @example
  6562. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6563. @end example
  6564. @item
  6565. Enable additional sharpening:
  6566. @example
  6567. kerndeint=sharp=1
  6568. @end example
  6569. @item
  6570. Paint processed pixels in white:
  6571. @example
  6572. kerndeint=map=1
  6573. @end example
  6574. @end itemize
  6575. @section lenscorrection
  6576. Correct radial lens distortion
  6577. This filter can be used to correct for radial distortion as can result from the use
  6578. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6579. one can use tools available for example as part of opencv or simply trial-and-error.
  6580. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6581. and extract the k1 and k2 coefficients from the resulting matrix.
  6582. Note that effectively the same filter is available in the open-source tools Krita and
  6583. Digikam from the KDE project.
  6584. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6585. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6586. brightness distribution, so you may want to use both filters together in certain
  6587. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6588. be applied before or after lens correction.
  6589. @subsection Options
  6590. The filter accepts the following options:
  6591. @table @option
  6592. @item cx
  6593. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6594. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6595. width.
  6596. @item cy
  6597. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6598. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6599. height.
  6600. @item k1
  6601. Coefficient of the quadratic correction term. 0.5 means no correction.
  6602. @item k2
  6603. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6604. @end table
  6605. The formula that generates the correction is:
  6606. @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)
  6607. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6608. distances from the focal point in the source and target images, respectively.
  6609. @section loop, aloop
  6610. Loop video frames or audio samples.
  6611. Those filters accepts the following options:
  6612. @table @option
  6613. @item loop
  6614. Set the number of loops.
  6615. @item size
  6616. Set maximal size in number of frames for @code{loop} filter or maximal number
  6617. of samples in case of @code{aloop} filter.
  6618. @item start
  6619. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6620. of @code{aloop} filter.
  6621. @end table
  6622. @anchor{lut3d}
  6623. @section lut3d
  6624. Apply a 3D LUT to an input video.
  6625. The filter accepts the following options:
  6626. @table @option
  6627. @item file
  6628. Set the 3D LUT file name.
  6629. Currently supported formats:
  6630. @table @samp
  6631. @item 3dl
  6632. AfterEffects
  6633. @item cube
  6634. Iridas
  6635. @item dat
  6636. DaVinci
  6637. @item m3d
  6638. Pandora
  6639. @end table
  6640. @item interp
  6641. Select interpolation mode.
  6642. Available values are:
  6643. @table @samp
  6644. @item nearest
  6645. Use values from the nearest defined point.
  6646. @item trilinear
  6647. Interpolate values using the 8 points defining a cube.
  6648. @item tetrahedral
  6649. Interpolate values using a tetrahedron.
  6650. @end table
  6651. @end table
  6652. @section lut, lutrgb, lutyuv
  6653. Compute a look-up table for binding each pixel component input value
  6654. to an output value, and apply it to the input video.
  6655. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6656. to an RGB input video.
  6657. These filters accept the following parameters:
  6658. @table @option
  6659. @item c0
  6660. set first pixel component expression
  6661. @item c1
  6662. set second pixel component expression
  6663. @item c2
  6664. set third pixel component expression
  6665. @item c3
  6666. set fourth pixel component expression, corresponds to the alpha component
  6667. @item r
  6668. set red component expression
  6669. @item g
  6670. set green component expression
  6671. @item b
  6672. set blue component expression
  6673. @item a
  6674. alpha component expression
  6675. @item y
  6676. set Y/luminance component expression
  6677. @item u
  6678. set U/Cb component expression
  6679. @item v
  6680. set V/Cr component expression
  6681. @end table
  6682. Each of them specifies the expression to use for computing the lookup table for
  6683. the corresponding pixel component values.
  6684. The exact component associated to each of the @var{c*} options depends on the
  6685. format in input.
  6686. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6687. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6688. The expressions can contain the following constants and functions:
  6689. @table @option
  6690. @item w
  6691. @item h
  6692. The input width and height.
  6693. @item val
  6694. The input value for the pixel component.
  6695. @item clipval
  6696. The input value, clipped to the @var{minval}-@var{maxval} range.
  6697. @item maxval
  6698. The maximum value for the pixel component.
  6699. @item minval
  6700. The minimum value for the pixel component.
  6701. @item negval
  6702. The negated value for the pixel component value, clipped to the
  6703. @var{minval}-@var{maxval} range; it corresponds to the expression
  6704. "maxval-clipval+minval".
  6705. @item clip(val)
  6706. The computed value in @var{val}, clipped to the
  6707. @var{minval}-@var{maxval} range.
  6708. @item gammaval(gamma)
  6709. The computed gamma correction value of the pixel component value,
  6710. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6711. expression
  6712. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6713. @end table
  6714. All expressions default to "val".
  6715. @subsection Examples
  6716. @itemize
  6717. @item
  6718. Negate input video:
  6719. @example
  6720. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6721. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6722. @end example
  6723. The above is the same as:
  6724. @example
  6725. lutrgb="r=negval:g=negval:b=negval"
  6726. lutyuv="y=negval:u=negval:v=negval"
  6727. @end example
  6728. @item
  6729. Negate luminance:
  6730. @example
  6731. lutyuv=y=negval
  6732. @end example
  6733. @item
  6734. Remove chroma components, turning the video into a graytone image:
  6735. @example
  6736. lutyuv="u=128:v=128"
  6737. @end example
  6738. @item
  6739. Apply a luma burning effect:
  6740. @example
  6741. lutyuv="y=2*val"
  6742. @end example
  6743. @item
  6744. Remove green and blue components:
  6745. @example
  6746. lutrgb="g=0:b=0"
  6747. @end example
  6748. @item
  6749. Set a constant alpha channel value on input:
  6750. @example
  6751. format=rgba,lutrgb=a="maxval-minval/2"
  6752. @end example
  6753. @item
  6754. Correct luminance gamma by a factor of 0.5:
  6755. @example
  6756. lutyuv=y=gammaval(0.5)
  6757. @end example
  6758. @item
  6759. Discard least significant bits of luma:
  6760. @example
  6761. lutyuv=y='bitand(val, 128+64+32)'
  6762. @end example
  6763. @end itemize
  6764. @section maskedmerge
  6765. Merge the first input stream with the second input stream using per pixel
  6766. weights in the third input stream.
  6767. A value of 0 in the third stream pixel component means that pixel component
  6768. from first stream is returned unchanged, while maximum value (eg. 255 for
  6769. 8-bit videos) means that pixel component from second stream is returned
  6770. unchanged. Intermediate values define the amount of merging between both
  6771. input stream's pixel components.
  6772. This filter accepts the following options:
  6773. @table @option
  6774. @item planes
  6775. Set which planes will be processed as bitmap, unprocessed planes will be
  6776. copied from first stream.
  6777. By default value 0xf, all planes will be processed.
  6778. @end table
  6779. @section mcdeint
  6780. Apply motion-compensation deinterlacing.
  6781. It needs one field per frame as input and must thus be used together
  6782. with yadif=1/3 or equivalent.
  6783. This filter accepts the following options:
  6784. @table @option
  6785. @item mode
  6786. Set the deinterlacing mode.
  6787. It accepts one of the following values:
  6788. @table @samp
  6789. @item fast
  6790. @item medium
  6791. @item slow
  6792. use iterative motion estimation
  6793. @item extra_slow
  6794. like @samp{slow}, but use multiple reference frames.
  6795. @end table
  6796. Default value is @samp{fast}.
  6797. @item parity
  6798. Set the picture field parity assumed for the input video. It must be
  6799. one of the following values:
  6800. @table @samp
  6801. @item 0, tff
  6802. assume top field first
  6803. @item 1, bff
  6804. assume bottom field first
  6805. @end table
  6806. Default value is @samp{bff}.
  6807. @item qp
  6808. Set per-block quantization parameter (QP) used by the internal
  6809. encoder.
  6810. Higher values should result in a smoother motion vector field but less
  6811. optimal individual vectors. Default value is 1.
  6812. @end table
  6813. @section mergeplanes
  6814. Merge color channel components from several video streams.
  6815. The filter accepts up to 4 input streams, and merge selected input
  6816. planes to the output video.
  6817. This filter accepts the following options:
  6818. @table @option
  6819. @item mapping
  6820. Set input to output plane mapping. Default is @code{0}.
  6821. The mappings is specified as a bitmap. It should be specified as a
  6822. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6823. mapping for the first plane of the output stream. 'A' sets the number of
  6824. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6825. corresponding input to use (from 0 to 3). The rest of the mappings is
  6826. similar, 'Bb' describes the mapping for the output stream second
  6827. plane, 'Cc' describes the mapping for the output stream third plane and
  6828. 'Dd' describes the mapping for the output stream fourth plane.
  6829. @item format
  6830. Set output pixel format. Default is @code{yuva444p}.
  6831. @end table
  6832. @subsection Examples
  6833. @itemize
  6834. @item
  6835. Merge three gray video streams of same width and height into single video stream:
  6836. @example
  6837. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6838. @end example
  6839. @item
  6840. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6841. @example
  6842. [a0][a1]mergeplanes=0x00010210:yuva444p
  6843. @end example
  6844. @item
  6845. Swap Y and A plane in yuva444p stream:
  6846. @example
  6847. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6848. @end example
  6849. @item
  6850. Swap U and V plane in yuv420p stream:
  6851. @example
  6852. format=yuv420p,mergeplanes=0x000201:yuv420p
  6853. @end example
  6854. @item
  6855. Cast a rgb24 clip to yuv444p:
  6856. @example
  6857. format=rgb24,mergeplanes=0x000102:yuv444p
  6858. @end example
  6859. @end itemize
  6860. @section metadata, ametadata
  6861. Manipulate frame metadata.
  6862. This filter accepts the following options:
  6863. @table @option
  6864. @item mode
  6865. Set mode of operation of the filter.
  6866. Can be one of the following:
  6867. @table @samp
  6868. @item select
  6869. If both @code{value} and @code{key} is set, select frames
  6870. which have such metadata. If only @code{key} is set, select
  6871. every frame that has such key in metadata.
  6872. @item add
  6873. Add new metadata @code{key} and @code{value}. If key is already available
  6874. do nothing.
  6875. @item modify
  6876. Modify value of already present key.
  6877. @item delete
  6878. If @code{value} is set, delete only keys that have such value.
  6879. Otherwise, delete key.
  6880. @item print
  6881. Print key and its value if metadata was found. If @code{key} is not set print all
  6882. metadata values available in frame.
  6883. @end table
  6884. @item key
  6885. Set key used with all modes. Must be set for all modes except @code{print}.
  6886. @item value
  6887. Set metadata value which will be used. This option is mandatory for
  6888. @code{modify} and @code{add} mode.
  6889. @item function
  6890. Which function to use when comparing metadata value and @code{value}.
  6891. Can be one of following:
  6892. @table @samp
  6893. @item same_str
  6894. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  6895. @item starts_with
  6896. Values are interpreted as strings, returns true if metadata value starts with
  6897. the @code{value} option string.
  6898. @item less
  6899. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  6900. @item equal
  6901. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  6902. @item greater
  6903. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  6904. @item expr
  6905. Values are interpreted as floats, returns true if expression from option @code{expr}
  6906. evaluates to true.
  6907. @end table
  6908. @item expr
  6909. Set expression which is used when @code{function} is set to @code{expr}.
  6910. The expression is evaluated through the eval API and can contain the following
  6911. constants:
  6912. @table @option
  6913. @item VALUE1
  6914. Float representation of @code{value} from metadata key.
  6915. @item VALUE2
  6916. Float representation of @code{value} as supplied by user in @code{value} option.
  6917. @end table
  6918. @item file
  6919. If specified in @code{print} mode, output is written to the named file. When
  6920. filename equals "-" data is written to standard output.
  6921. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  6922. loglevel.
  6923. @end table
  6924. @subsection Examples
  6925. @itemize
  6926. @item
  6927. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  6928. between 0 and 1.
  6929. @example
  6930. @end example
  6931. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  6932. @end itemize
  6933. @section mpdecimate
  6934. Drop frames that do not differ greatly from the previous frame in
  6935. order to reduce frame rate.
  6936. The main use of this filter is for very-low-bitrate encoding
  6937. (e.g. streaming over dialup modem), but it could in theory be used for
  6938. fixing movies that were inverse-telecined incorrectly.
  6939. A description of the accepted options follows.
  6940. @table @option
  6941. @item max
  6942. Set the maximum number of consecutive frames which can be dropped (if
  6943. positive), or the minimum interval between dropped frames (if
  6944. negative). If the value is 0, the frame is dropped unregarding the
  6945. number of previous sequentially dropped frames.
  6946. Default value is 0.
  6947. @item hi
  6948. @item lo
  6949. @item frac
  6950. Set the dropping threshold values.
  6951. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6952. represent actual pixel value differences, so a threshold of 64
  6953. corresponds to 1 unit of difference for each pixel, or the same spread
  6954. out differently over the block.
  6955. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6956. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6957. meaning the whole image) differ by more than a threshold of @option{lo}.
  6958. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6959. 64*5, and default value for @option{frac} is 0.33.
  6960. @end table
  6961. @section negate
  6962. Negate input video.
  6963. It accepts an integer in input; if non-zero it negates the
  6964. alpha component (if available). The default value in input is 0.
  6965. @section nnedi
  6966. Deinterlace video using neural network edge directed interpolation.
  6967. This filter accepts the following options:
  6968. @table @option
  6969. @item weights
  6970. Mandatory option, without binary file filter can not work.
  6971. Currently file can be found here:
  6972. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  6973. @item deint
  6974. Set which frames to deinterlace, by default it is @code{all}.
  6975. Can be @code{all} or @code{interlaced}.
  6976. @item field
  6977. Set mode of operation.
  6978. Can be one of the following:
  6979. @table @samp
  6980. @item af
  6981. Use frame flags, both fields.
  6982. @item a
  6983. Use frame flags, single field.
  6984. @item t
  6985. Use top field only.
  6986. @item b
  6987. Use bottom field only.
  6988. @item tf
  6989. Use both fields, top first.
  6990. @item bf
  6991. Use both fields, bottom first.
  6992. @end table
  6993. @item planes
  6994. Set which planes to process, by default filter process all frames.
  6995. @item nsize
  6996. Set size of local neighborhood around each pixel, used by the predictor neural
  6997. network.
  6998. Can be one of the following:
  6999. @table @samp
  7000. @item s8x6
  7001. @item s16x6
  7002. @item s32x6
  7003. @item s48x6
  7004. @item s8x4
  7005. @item s16x4
  7006. @item s32x4
  7007. @end table
  7008. @item nns
  7009. Set the number of neurons in predicctor neural network.
  7010. Can be one of the following:
  7011. @table @samp
  7012. @item n16
  7013. @item n32
  7014. @item n64
  7015. @item n128
  7016. @item n256
  7017. @end table
  7018. @item qual
  7019. Controls the number of different neural network predictions that are blended
  7020. together to compute the final output value. Can be @code{fast}, default or
  7021. @code{slow}.
  7022. @item etype
  7023. Set which set of weights to use in the predictor.
  7024. Can be one of the following:
  7025. @table @samp
  7026. @item a
  7027. weights trained to minimize absolute error
  7028. @item s
  7029. weights trained to minimize squared error
  7030. @end table
  7031. @item pscrn
  7032. Controls whether or not the prescreener neural network is used to decide
  7033. which pixels should be processed by the predictor neural network and which
  7034. can be handled by simple cubic interpolation.
  7035. The prescreener is trained to know whether cubic interpolation will be
  7036. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7037. The computational complexity of the prescreener nn is much less than that of
  7038. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7039. using the prescreener generally results in much faster processing.
  7040. The prescreener is pretty accurate, so the difference between using it and not
  7041. using it is almost always unnoticeable.
  7042. Can be one of the following:
  7043. @table @samp
  7044. @item none
  7045. @item original
  7046. @item new
  7047. @end table
  7048. Default is @code{new}.
  7049. @item fapprox
  7050. Set various debugging flags.
  7051. @end table
  7052. @section noformat
  7053. Force libavfilter not to use any of the specified pixel formats for the
  7054. input to the next filter.
  7055. It accepts the following parameters:
  7056. @table @option
  7057. @item pix_fmts
  7058. A '|'-separated list of pixel format names, such as
  7059. apix_fmts=yuv420p|monow|rgb24".
  7060. @end table
  7061. @subsection Examples
  7062. @itemize
  7063. @item
  7064. Force libavfilter to use a format different from @var{yuv420p} for the
  7065. input to the vflip filter:
  7066. @example
  7067. noformat=pix_fmts=yuv420p,vflip
  7068. @end example
  7069. @item
  7070. Convert the input video to any of the formats not contained in the list:
  7071. @example
  7072. noformat=yuv420p|yuv444p|yuv410p
  7073. @end example
  7074. @end itemize
  7075. @section noise
  7076. Add noise on video input frame.
  7077. The filter accepts the following options:
  7078. @table @option
  7079. @item all_seed
  7080. @item c0_seed
  7081. @item c1_seed
  7082. @item c2_seed
  7083. @item c3_seed
  7084. Set noise seed for specific pixel component or all pixel components in case
  7085. of @var{all_seed}. Default value is @code{123457}.
  7086. @item all_strength, alls
  7087. @item c0_strength, c0s
  7088. @item c1_strength, c1s
  7089. @item c2_strength, c2s
  7090. @item c3_strength, c3s
  7091. Set noise strength for specific pixel component or all pixel components in case
  7092. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7093. @item all_flags, allf
  7094. @item c0_flags, c0f
  7095. @item c1_flags, c1f
  7096. @item c2_flags, c2f
  7097. @item c3_flags, c3f
  7098. Set pixel component flags or set flags for all components if @var{all_flags}.
  7099. Available values for component flags are:
  7100. @table @samp
  7101. @item a
  7102. averaged temporal noise (smoother)
  7103. @item p
  7104. mix random noise with a (semi)regular pattern
  7105. @item t
  7106. temporal noise (noise pattern changes between frames)
  7107. @item u
  7108. uniform noise (gaussian otherwise)
  7109. @end table
  7110. @end table
  7111. @subsection Examples
  7112. Add temporal and uniform noise to input video:
  7113. @example
  7114. noise=alls=20:allf=t+u
  7115. @end example
  7116. @section null
  7117. Pass the video source unchanged to the output.
  7118. @section ocr
  7119. Optical Character Recognition
  7120. This filter uses Tesseract for optical character recognition.
  7121. It accepts the following options:
  7122. @table @option
  7123. @item datapath
  7124. Set datapath to tesseract data. Default is to use whatever was
  7125. set at installation.
  7126. @item language
  7127. Set language, default is "eng".
  7128. @item whitelist
  7129. Set character whitelist.
  7130. @item blacklist
  7131. Set character blacklist.
  7132. @end table
  7133. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7134. @section ocv
  7135. Apply a video transform using libopencv.
  7136. To enable this filter, install the libopencv library and headers and
  7137. configure FFmpeg with @code{--enable-libopencv}.
  7138. It accepts the following parameters:
  7139. @table @option
  7140. @item filter_name
  7141. The name of the libopencv filter to apply.
  7142. @item filter_params
  7143. The parameters to pass to the libopencv filter. If not specified, the default
  7144. values are assumed.
  7145. @end table
  7146. Refer to the official libopencv documentation for more precise
  7147. information:
  7148. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7149. Several libopencv filters are supported; see the following subsections.
  7150. @anchor{dilate}
  7151. @subsection dilate
  7152. Dilate an image by using a specific structuring element.
  7153. It corresponds to the libopencv function @code{cvDilate}.
  7154. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7155. @var{struct_el} represents a structuring element, and has the syntax:
  7156. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7157. @var{cols} and @var{rows} represent the number of columns and rows of
  7158. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7159. point, and @var{shape} the shape for the structuring element. @var{shape}
  7160. must be "rect", "cross", "ellipse", or "custom".
  7161. If the value for @var{shape} is "custom", it must be followed by a
  7162. string of the form "=@var{filename}". The file with name
  7163. @var{filename} is assumed to represent a binary image, with each
  7164. printable character corresponding to a bright pixel. When a custom
  7165. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7166. or columns and rows of the read file are assumed instead.
  7167. The default value for @var{struct_el} is "3x3+0x0/rect".
  7168. @var{nb_iterations} specifies the number of times the transform is
  7169. applied to the image, and defaults to 1.
  7170. Some examples:
  7171. @example
  7172. # Use the default values
  7173. ocv=dilate
  7174. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7175. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7176. # Read the shape from the file diamond.shape, iterating two times.
  7177. # The file diamond.shape may contain a pattern of characters like this
  7178. # *
  7179. # ***
  7180. # *****
  7181. # ***
  7182. # *
  7183. # The specified columns and rows are ignored
  7184. # but the anchor point coordinates are not
  7185. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7186. @end example
  7187. @subsection erode
  7188. Erode an image by using a specific structuring element.
  7189. It corresponds to the libopencv function @code{cvErode}.
  7190. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7191. with the same syntax and semantics as the @ref{dilate} filter.
  7192. @subsection smooth
  7193. Smooth the input video.
  7194. The filter takes the following parameters:
  7195. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7196. @var{type} is the type of smooth filter to apply, and must be one of
  7197. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7198. or "bilateral". The default value is "gaussian".
  7199. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7200. depend on the smooth type. @var{param1} and
  7201. @var{param2} accept integer positive values or 0. @var{param3} and
  7202. @var{param4} accept floating point values.
  7203. The default value for @var{param1} is 3. The default value for the
  7204. other parameters is 0.
  7205. These parameters correspond to the parameters assigned to the
  7206. libopencv function @code{cvSmooth}.
  7207. @anchor{overlay}
  7208. @section overlay
  7209. Overlay one video on top of another.
  7210. It takes two inputs and has one output. The first input is the "main"
  7211. video on which the second input is overlaid.
  7212. It accepts the following parameters:
  7213. A description of the accepted options follows.
  7214. @table @option
  7215. @item x
  7216. @item y
  7217. Set the expression for the x and y coordinates of the overlaid video
  7218. on the main video. Default value is "0" for both expressions. In case
  7219. the expression is invalid, it is set to a huge value (meaning that the
  7220. overlay will not be displayed within the output visible area).
  7221. @item eof_action
  7222. The action to take when EOF is encountered on the secondary input; it accepts
  7223. one of the following values:
  7224. @table @option
  7225. @item repeat
  7226. Repeat the last frame (the default).
  7227. @item endall
  7228. End both streams.
  7229. @item pass
  7230. Pass the main input through.
  7231. @end table
  7232. @item eval
  7233. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7234. It accepts the following values:
  7235. @table @samp
  7236. @item init
  7237. only evaluate expressions once during the filter initialization or
  7238. when a command is processed
  7239. @item frame
  7240. evaluate expressions for each incoming frame
  7241. @end table
  7242. Default value is @samp{frame}.
  7243. @item shortest
  7244. If set to 1, force the output to terminate when the shortest input
  7245. terminates. Default value is 0.
  7246. @item format
  7247. Set the format for the output video.
  7248. It accepts the following values:
  7249. @table @samp
  7250. @item yuv420
  7251. force YUV420 output
  7252. @item yuv422
  7253. force YUV422 output
  7254. @item yuv444
  7255. force YUV444 output
  7256. @item rgb
  7257. force RGB output
  7258. @end table
  7259. Default value is @samp{yuv420}.
  7260. @item rgb @emph{(deprecated)}
  7261. If set to 1, force the filter to accept inputs in the RGB
  7262. color space. Default value is 0. This option is deprecated, use
  7263. @option{format} instead.
  7264. @item repeatlast
  7265. If set to 1, force the filter to draw the last overlay frame over the
  7266. main input until the end of the stream. A value of 0 disables this
  7267. behavior. Default value is 1.
  7268. @end table
  7269. The @option{x}, and @option{y} expressions can contain the following
  7270. parameters.
  7271. @table @option
  7272. @item main_w, W
  7273. @item main_h, H
  7274. The main input width and height.
  7275. @item overlay_w, w
  7276. @item overlay_h, h
  7277. The overlay input width and height.
  7278. @item x
  7279. @item y
  7280. The computed values for @var{x} and @var{y}. They are evaluated for
  7281. each new frame.
  7282. @item hsub
  7283. @item vsub
  7284. horizontal and vertical chroma subsample values of the output
  7285. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7286. @var{vsub} is 1.
  7287. @item n
  7288. the number of input frame, starting from 0
  7289. @item pos
  7290. the position in the file of the input frame, NAN if unknown
  7291. @item t
  7292. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7293. @end table
  7294. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7295. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7296. when @option{eval} is set to @samp{init}.
  7297. Be aware that frames are taken from each input video in timestamp
  7298. order, hence, if their initial timestamps differ, it is a good idea
  7299. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7300. have them begin in the same zero timestamp, as the example for
  7301. the @var{movie} filter does.
  7302. You can chain together more overlays but you should test the
  7303. efficiency of such approach.
  7304. @subsection Commands
  7305. This filter supports the following commands:
  7306. @table @option
  7307. @item x
  7308. @item y
  7309. Modify the x and y of the overlay input.
  7310. The command accepts the same syntax of the corresponding option.
  7311. If the specified expression is not valid, it is kept at its current
  7312. value.
  7313. @end table
  7314. @subsection Examples
  7315. @itemize
  7316. @item
  7317. Draw the overlay at 10 pixels from the bottom right corner of the main
  7318. video:
  7319. @example
  7320. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7321. @end example
  7322. Using named options the example above becomes:
  7323. @example
  7324. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7325. @end example
  7326. @item
  7327. Insert a transparent PNG logo in the bottom left corner of the input,
  7328. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7329. @example
  7330. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7331. @end example
  7332. @item
  7333. Insert 2 different transparent PNG logos (second logo on bottom
  7334. right corner) using the @command{ffmpeg} tool:
  7335. @example
  7336. 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
  7337. @end example
  7338. @item
  7339. Add a transparent color layer on top of the main video; @code{WxH}
  7340. must specify the size of the main input to the overlay filter:
  7341. @example
  7342. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7343. @end example
  7344. @item
  7345. Play an original video and a filtered version (here with the deshake
  7346. filter) side by side using the @command{ffplay} tool:
  7347. @example
  7348. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7349. @end example
  7350. The above command is the same as:
  7351. @example
  7352. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7353. @end example
  7354. @item
  7355. Make a sliding overlay appearing from the left to the right top part of the
  7356. screen starting since time 2:
  7357. @example
  7358. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7359. @end example
  7360. @item
  7361. Compose output by putting two input videos side to side:
  7362. @example
  7363. ffmpeg -i left.avi -i right.avi -filter_complex "
  7364. nullsrc=size=200x100 [background];
  7365. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7366. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7367. [background][left] overlay=shortest=1 [background+left];
  7368. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7369. "
  7370. @end example
  7371. @item
  7372. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7373. @example
  7374. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7375. -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]'
  7376. masked.avi
  7377. @end example
  7378. @item
  7379. Chain several overlays in cascade:
  7380. @example
  7381. nullsrc=s=200x200 [bg];
  7382. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7383. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7384. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7385. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7386. [in3] null, [mid2] overlay=100:100 [out0]
  7387. @end example
  7388. @end itemize
  7389. @section owdenoise
  7390. Apply Overcomplete Wavelet denoiser.
  7391. The filter accepts the following options:
  7392. @table @option
  7393. @item depth
  7394. Set depth.
  7395. Larger depth values will denoise lower frequency components more, but
  7396. slow down filtering.
  7397. Must be an int in the range 8-16, default is @code{8}.
  7398. @item luma_strength, ls
  7399. Set luma strength.
  7400. Must be a double value in the range 0-1000, default is @code{1.0}.
  7401. @item chroma_strength, cs
  7402. Set chroma strength.
  7403. Must be a double value in the range 0-1000, default is @code{1.0}.
  7404. @end table
  7405. @anchor{pad}
  7406. @section pad
  7407. Add paddings to the input image, and place the original input at the
  7408. provided @var{x}, @var{y} coordinates.
  7409. It accepts the following parameters:
  7410. @table @option
  7411. @item width, w
  7412. @item height, h
  7413. Specify an expression for the size of the output image with the
  7414. paddings added. If the value for @var{width} or @var{height} is 0, the
  7415. corresponding input size is used for the output.
  7416. The @var{width} expression can reference the value set by the
  7417. @var{height} expression, and vice versa.
  7418. The default value of @var{width} and @var{height} is 0.
  7419. @item x
  7420. @item y
  7421. Specify the offsets to place the input image at within the padded area,
  7422. with respect to the top/left border of the output image.
  7423. The @var{x} expression can reference the value set by the @var{y}
  7424. expression, and vice versa.
  7425. The default value of @var{x} and @var{y} is 0.
  7426. @item color
  7427. Specify the color of the padded area. For the syntax of this option,
  7428. check the "Color" section in the ffmpeg-utils manual.
  7429. The default value of @var{color} is "black".
  7430. @end table
  7431. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7432. options are expressions containing the following constants:
  7433. @table @option
  7434. @item in_w
  7435. @item in_h
  7436. The input video width and height.
  7437. @item iw
  7438. @item ih
  7439. These are the same as @var{in_w} and @var{in_h}.
  7440. @item out_w
  7441. @item out_h
  7442. The output width and height (the size of the padded area), as
  7443. specified by the @var{width} and @var{height} expressions.
  7444. @item ow
  7445. @item oh
  7446. These are the same as @var{out_w} and @var{out_h}.
  7447. @item x
  7448. @item y
  7449. The x and y offsets as specified by the @var{x} and @var{y}
  7450. expressions, or NAN if not yet specified.
  7451. @item a
  7452. same as @var{iw} / @var{ih}
  7453. @item sar
  7454. input sample aspect ratio
  7455. @item dar
  7456. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7457. @item hsub
  7458. @item vsub
  7459. The horizontal and vertical chroma subsample values. For example for the
  7460. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7461. @end table
  7462. @subsection Examples
  7463. @itemize
  7464. @item
  7465. Add paddings with the color "violet" to the input video. The output video
  7466. size is 640x480, and the top-left corner of the input video is placed at
  7467. column 0, row 40
  7468. @example
  7469. pad=640:480:0:40:violet
  7470. @end example
  7471. The example above is equivalent to the following command:
  7472. @example
  7473. pad=width=640:height=480:x=0:y=40:color=violet
  7474. @end example
  7475. @item
  7476. Pad the input to get an output with dimensions increased by 3/2,
  7477. and put the input video at the center of the padded area:
  7478. @example
  7479. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7480. @end example
  7481. @item
  7482. Pad the input to get a squared output with size equal to the maximum
  7483. value between the input width and height, and put the input video at
  7484. the center of the padded area:
  7485. @example
  7486. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7487. @end example
  7488. @item
  7489. Pad the input to get a final w/h ratio of 16:9:
  7490. @example
  7491. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7492. @end example
  7493. @item
  7494. In case of anamorphic video, in order to set the output display aspect
  7495. correctly, it is necessary to use @var{sar} in the expression,
  7496. according to the relation:
  7497. @example
  7498. (ih * X / ih) * sar = output_dar
  7499. X = output_dar / sar
  7500. @end example
  7501. Thus the previous example needs to be modified to:
  7502. @example
  7503. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7504. @end example
  7505. @item
  7506. Double the output size and put the input video in the bottom-right
  7507. corner of the output padded area:
  7508. @example
  7509. pad="2*iw:2*ih:ow-iw:oh-ih"
  7510. @end example
  7511. @end itemize
  7512. @anchor{palettegen}
  7513. @section palettegen
  7514. Generate one palette for a whole video stream.
  7515. It accepts the following options:
  7516. @table @option
  7517. @item max_colors
  7518. Set the maximum number of colors to quantize in the palette.
  7519. Note: the palette will still contain 256 colors; the unused palette entries
  7520. will be black.
  7521. @item reserve_transparent
  7522. Create a palette of 255 colors maximum and reserve the last one for
  7523. transparency. Reserving the transparency color is useful for GIF optimization.
  7524. If not set, the maximum of colors in the palette will be 256. You probably want
  7525. to disable this option for a standalone image.
  7526. Set by default.
  7527. @item stats_mode
  7528. Set statistics mode.
  7529. It accepts the following values:
  7530. @table @samp
  7531. @item full
  7532. Compute full frame histograms.
  7533. @item diff
  7534. Compute histograms only for the part that differs from previous frame. This
  7535. might be relevant to give more importance to the moving part of your input if
  7536. the background is static.
  7537. @end table
  7538. Default value is @var{full}.
  7539. @end table
  7540. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7541. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7542. color quantization of the palette. This information is also visible at
  7543. @var{info} logging level.
  7544. @subsection Examples
  7545. @itemize
  7546. @item
  7547. Generate a representative palette of a given video using @command{ffmpeg}:
  7548. @example
  7549. ffmpeg -i input.mkv -vf palettegen palette.png
  7550. @end example
  7551. @end itemize
  7552. @section paletteuse
  7553. Use a palette to downsample an input video stream.
  7554. The filter takes two inputs: one video stream and a palette. The palette must
  7555. be a 256 pixels image.
  7556. It accepts the following options:
  7557. @table @option
  7558. @item dither
  7559. Select dithering mode. Available algorithms are:
  7560. @table @samp
  7561. @item bayer
  7562. Ordered 8x8 bayer dithering (deterministic)
  7563. @item heckbert
  7564. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7565. Note: this dithering is sometimes considered "wrong" and is included as a
  7566. reference.
  7567. @item floyd_steinberg
  7568. Floyd and Steingberg dithering (error diffusion)
  7569. @item sierra2
  7570. Frankie Sierra dithering v2 (error diffusion)
  7571. @item sierra2_4a
  7572. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7573. @end table
  7574. Default is @var{sierra2_4a}.
  7575. @item bayer_scale
  7576. When @var{bayer} dithering is selected, this option defines the scale of the
  7577. pattern (how much the crosshatch pattern is visible). A low value means more
  7578. visible pattern for less banding, and higher value means less visible pattern
  7579. at the cost of more banding.
  7580. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7581. @item diff_mode
  7582. If set, define the zone to process
  7583. @table @samp
  7584. @item rectangle
  7585. Only the changing rectangle will be reprocessed. This is similar to GIF
  7586. cropping/offsetting compression mechanism. This option can be useful for speed
  7587. if only a part of the image is changing, and has use cases such as limiting the
  7588. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7589. moving scene (it leads to more deterministic output if the scene doesn't change
  7590. much, and as a result less moving noise and better GIF compression).
  7591. @end table
  7592. Default is @var{none}.
  7593. @end table
  7594. @subsection Examples
  7595. @itemize
  7596. @item
  7597. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7598. using @command{ffmpeg}:
  7599. @example
  7600. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7601. @end example
  7602. @end itemize
  7603. @section perspective
  7604. Correct perspective of video not recorded perpendicular to the screen.
  7605. A description of the accepted parameters follows.
  7606. @table @option
  7607. @item x0
  7608. @item y0
  7609. @item x1
  7610. @item y1
  7611. @item x2
  7612. @item y2
  7613. @item x3
  7614. @item y3
  7615. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7616. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7617. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7618. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7619. then the corners of the source will be sent to the specified coordinates.
  7620. The expressions can use the following variables:
  7621. @table @option
  7622. @item W
  7623. @item H
  7624. the width and height of video frame.
  7625. @end table
  7626. @item interpolation
  7627. Set interpolation for perspective correction.
  7628. It accepts the following values:
  7629. @table @samp
  7630. @item linear
  7631. @item cubic
  7632. @end table
  7633. Default value is @samp{linear}.
  7634. @item sense
  7635. Set interpretation of coordinate options.
  7636. It accepts the following values:
  7637. @table @samp
  7638. @item 0, source
  7639. Send point in the source specified by the given coordinates to
  7640. the corners of the destination.
  7641. @item 1, destination
  7642. Send the corners of the source to the point in the destination specified
  7643. by the given coordinates.
  7644. Default value is @samp{source}.
  7645. @end table
  7646. @end table
  7647. @section phase
  7648. Delay interlaced video by one field time so that the field order changes.
  7649. The intended use is to fix PAL movies that have been captured with the
  7650. opposite field order to the film-to-video transfer.
  7651. A description of the accepted parameters follows.
  7652. @table @option
  7653. @item mode
  7654. Set phase mode.
  7655. It accepts the following values:
  7656. @table @samp
  7657. @item t
  7658. Capture field order top-first, transfer bottom-first.
  7659. Filter will delay the bottom field.
  7660. @item b
  7661. Capture field order bottom-first, transfer top-first.
  7662. Filter will delay the top field.
  7663. @item p
  7664. Capture and transfer with the same field order. This mode only exists
  7665. for the documentation of the other options to refer to, but if you
  7666. actually select it, the filter will faithfully do nothing.
  7667. @item a
  7668. Capture field order determined automatically by field flags, transfer
  7669. opposite.
  7670. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7671. basis using field flags. If no field information is available,
  7672. then this works just like @samp{u}.
  7673. @item u
  7674. Capture unknown or varying, transfer opposite.
  7675. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7676. analyzing the images and selecting the alternative that produces best
  7677. match between the fields.
  7678. @item T
  7679. Capture top-first, transfer unknown or varying.
  7680. Filter selects among @samp{t} and @samp{p} using image analysis.
  7681. @item B
  7682. Capture bottom-first, transfer unknown or varying.
  7683. Filter selects among @samp{b} and @samp{p} using image analysis.
  7684. @item A
  7685. Capture determined by field flags, transfer unknown or varying.
  7686. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7687. image analysis. If no field information is available, then this works just
  7688. like @samp{U}. This is the default mode.
  7689. @item U
  7690. Both capture and transfer unknown or varying.
  7691. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7692. @end table
  7693. @end table
  7694. @section pixdesctest
  7695. Pixel format descriptor test filter, mainly useful for internal
  7696. testing. The output video should be equal to the input video.
  7697. For example:
  7698. @example
  7699. format=monow, pixdesctest
  7700. @end example
  7701. can be used to test the monowhite pixel format descriptor definition.
  7702. @section pp
  7703. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7704. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7705. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7706. Each subfilter and some options have a short and a long name that can be used
  7707. interchangeably, i.e. dr/dering are the same.
  7708. The filters accept the following options:
  7709. @table @option
  7710. @item subfilters
  7711. Set postprocessing subfilters string.
  7712. @end table
  7713. All subfilters share common options to determine their scope:
  7714. @table @option
  7715. @item a/autoq
  7716. Honor the quality commands for this subfilter.
  7717. @item c/chrom
  7718. Do chrominance filtering, too (default).
  7719. @item y/nochrom
  7720. Do luminance filtering only (no chrominance).
  7721. @item n/noluma
  7722. Do chrominance filtering only (no luminance).
  7723. @end table
  7724. These options can be appended after the subfilter name, separated by a '|'.
  7725. Available subfilters are:
  7726. @table @option
  7727. @item hb/hdeblock[|difference[|flatness]]
  7728. Horizontal deblocking filter
  7729. @table @option
  7730. @item difference
  7731. Difference factor where higher values mean more deblocking (default: @code{32}).
  7732. @item flatness
  7733. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7734. @end table
  7735. @item vb/vdeblock[|difference[|flatness]]
  7736. Vertical deblocking filter
  7737. @table @option
  7738. @item difference
  7739. Difference factor where higher values mean more deblocking (default: @code{32}).
  7740. @item flatness
  7741. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7742. @end table
  7743. @item ha/hadeblock[|difference[|flatness]]
  7744. Accurate horizontal deblocking filter
  7745. @table @option
  7746. @item difference
  7747. Difference factor where higher values mean more deblocking (default: @code{32}).
  7748. @item flatness
  7749. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7750. @end table
  7751. @item va/vadeblock[|difference[|flatness]]
  7752. Accurate vertical deblocking filter
  7753. @table @option
  7754. @item difference
  7755. Difference factor where higher values mean more deblocking (default: @code{32}).
  7756. @item flatness
  7757. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7758. @end table
  7759. @end table
  7760. The horizontal and vertical deblocking filters share the difference and
  7761. flatness values so you cannot set different horizontal and vertical
  7762. thresholds.
  7763. @table @option
  7764. @item h1/x1hdeblock
  7765. Experimental horizontal deblocking filter
  7766. @item v1/x1vdeblock
  7767. Experimental vertical deblocking filter
  7768. @item dr/dering
  7769. Deringing filter
  7770. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7771. @table @option
  7772. @item threshold1
  7773. larger -> stronger filtering
  7774. @item threshold2
  7775. larger -> stronger filtering
  7776. @item threshold3
  7777. larger -> stronger filtering
  7778. @end table
  7779. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7780. @table @option
  7781. @item f/fullyrange
  7782. Stretch luminance to @code{0-255}.
  7783. @end table
  7784. @item lb/linblenddeint
  7785. Linear blend deinterlacing filter that deinterlaces the given block by
  7786. filtering all lines with a @code{(1 2 1)} filter.
  7787. @item li/linipoldeint
  7788. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7789. linearly interpolating every second line.
  7790. @item ci/cubicipoldeint
  7791. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7792. cubically interpolating every second line.
  7793. @item md/mediandeint
  7794. Median deinterlacing filter that deinterlaces the given block by applying a
  7795. median filter to every second line.
  7796. @item fd/ffmpegdeint
  7797. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7798. second line with a @code{(-1 4 2 4 -1)} filter.
  7799. @item l5/lowpass5
  7800. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7801. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7802. @item fq/forceQuant[|quantizer]
  7803. Overrides the quantizer table from the input with the constant quantizer you
  7804. specify.
  7805. @table @option
  7806. @item quantizer
  7807. Quantizer to use
  7808. @end table
  7809. @item de/default
  7810. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7811. @item fa/fast
  7812. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7813. @item ac
  7814. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7815. @end table
  7816. @subsection Examples
  7817. @itemize
  7818. @item
  7819. Apply horizontal and vertical deblocking, deringing and automatic
  7820. brightness/contrast:
  7821. @example
  7822. pp=hb/vb/dr/al
  7823. @end example
  7824. @item
  7825. Apply default filters without brightness/contrast correction:
  7826. @example
  7827. pp=de/-al
  7828. @end example
  7829. @item
  7830. Apply default filters and temporal denoiser:
  7831. @example
  7832. pp=default/tmpnoise|1|2|3
  7833. @end example
  7834. @item
  7835. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7836. automatically depending on available CPU time:
  7837. @example
  7838. pp=hb|y/vb|a
  7839. @end example
  7840. @end itemize
  7841. @section pp7
  7842. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7843. similar to spp = 6 with 7 point DCT, where only the center sample is
  7844. used after IDCT.
  7845. The filter accepts the following options:
  7846. @table @option
  7847. @item qp
  7848. Force a constant quantization parameter. It accepts an integer in range
  7849. 0 to 63. If not set, the filter will use the QP from the video stream
  7850. (if available).
  7851. @item mode
  7852. Set thresholding mode. Available modes are:
  7853. @table @samp
  7854. @item hard
  7855. Set hard thresholding.
  7856. @item soft
  7857. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7858. @item medium
  7859. Set medium thresholding (good results, default).
  7860. @end table
  7861. @end table
  7862. @section psnr
  7863. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7864. Ratio) between two input videos.
  7865. This filter takes in input two input videos, the first input is
  7866. considered the "main" source and is passed unchanged to the
  7867. output. The second input is used as a "reference" video for computing
  7868. the PSNR.
  7869. Both video inputs must have the same resolution and pixel format for
  7870. this filter to work correctly. Also it assumes that both inputs
  7871. have the same number of frames, which are compared one by one.
  7872. The obtained average PSNR is printed through the logging system.
  7873. The filter stores the accumulated MSE (mean squared error) of each
  7874. frame, and at the end of the processing it is averaged across all frames
  7875. equally, and the following formula is applied to obtain the PSNR:
  7876. @example
  7877. PSNR = 10*log10(MAX^2/MSE)
  7878. @end example
  7879. Where MAX is the average of the maximum values of each component of the
  7880. image.
  7881. The description of the accepted parameters follows.
  7882. @table @option
  7883. @item stats_file, f
  7884. If specified the filter will use the named file to save the PSNR of
  7885. each individual frame. When filename equals "-" the data is sent to
  7886. standard output.
  7887. @end table
  7888. The file printed if @var{stats_file} is selected, contains a sequence of
  7889. key/value pairs of the form @var{key}:@var{value} for each compared
  7890. couple of frames.
  7891. A description of each shown parameter follows:
  7892. @table @option
  7893. @item n
  7894. sequential number of the input frame, starting from 1
  7895. @item mse_avg
  7896. Mean Square Error pixel-by-pixel average difference of the compared
  7897. frames, averaged over all the image components.
  7898. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7899. Mean Square Error pixel-by-pixel average difference of the compared
  7900. frames for the component specified by the suffix.
  7901. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7902. Peak Signal to Noise ratio of the compared frames for the component
  7903. specified by the suffix.
  7904. @end table
  7905. For example:
  7906. @example
  7907. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7908. [main][ref] psnr="stats_file=stats.log" [out]
  7909. @end example
  7910. On this example the input file being processed is compared with the
  7911. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7912. is stored in @file{stats.log}.
  7913. @anchor{pullup}
  7914. @section pullup
  7915. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7916. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7917. content.
  7918. The pullup filter is designed to take advantage of future context in making
  7919. its decisions. This filter is stateless in the sense that it does not lock
  7920. onto a pattern to follow, but it instead looks forward to the following
  7921. fields in order to identify matches and rebuild progressive frames.
  7922. To produce content with an even framerate, insert the fps filter after
  7923. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7924. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7925. The filter accepts the following options:
  7926. @table @option
  7927. @item jl
  7928. @item jr
  7929. @item jt
  7930. @item jb
  7931. These options set the amount of "junk" to ignore at the left, right, top, and
  7932. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7933. while top and bottom are in units of 2 lines.
  7934. The default is 8 pixels on each side.
  7935. @item sb
  7936. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7937. filter generating an occasional mismatched frame, but it may also cause an
  7938. excessive number of frames to be dropped during high motion sequences.
  7939. Conversely, setting it to -1 will make filter match fields more easily.
  7940. This may help processing of video where there is slight blurring between
  7941. the fields, but may also cause there to be interlaced frames in the output.
  7942. Default value is @code{0}.
  7943. @item mp
  7944. Set the metric plane to use. It accepts the following values:
  7945. @table @samp
  7946. @item l
  7947. Use luma plane.
  7948. @item u
  7949. Use chroma blue plane.
  7950. @item v
  7951. Use chroma red plane.
  7952. @end table
  7953. This option may be set to use chroma plane instead of the default luma plane
  7954. for doing filter's computations. This may improve accuracy on very clean
  7955. source material, but more likely will decrease accuracy, especially if there
  7956. is chroma noise (rainbow effect) or any grayscale video.
  7957. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7958. load and make pullup usable in realtime on slow machines.
  7959. @end table
  7960. For best results (without duplicated frames in the output file) it is
  7961. necessary to change the output frame rate. For example, to inverse
  7962. telecine NTSC input:
  7963. @example
  7964. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7965. @end example
  7966. @section qp
  7967. Change video quantization parameters (QP).
  7968. The filter accepts the following option:
  7969. @table @option
  7970. @item qp
  7971. Set expression for quantization parameter.
  7972. @end table
  7973. The expression is evaluated through the eval API and can contain, among others,
  7974. the following constants:
  7975. @table @var
  7976. @item known
  7977. 1 if index is not 129, 0 otherwise.
  7978. @item qp
  7979. Sequentional index starting from -129 to 128.
  7980. @end table
  7981. @subsection Examples
  7982. @itemize
  7983. @item
  7984. Some equation like:
  7985. @example
  7986. qp=2+2*sin(PI*qp)
  7987. @end example
  7988. @end itemize
  7989. @section random
  7990. Flush video frames from internal cache of frames into a random order.
  7991. No frame is discarded.
  7992. Inspired by @ref{frei0r} nervous filter.
  7993. @table @option
  7994. @item frames
  7995. Set size in number of frames of internal cache, in range from @code{2} to
  7996. @code{512}. Default is @code{30}.
  7997. @item seed
  7998. Set seed for random number generator, must be an integer included between
  7999. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8000. less than @code{0}, the filter will try to use a good random seed on a
  8001. best effort basis.
  8002. @end table
  8003. @section removegrain
  8004. The removegrain filter is a spatial denoiser for progressive video.
  8005. @table @option
  8006. @item m0
  8007. Set mode for the first plane.
  8008. @item m1
  8009. Set mode for the second plane.
  8010. @item m2
  8011. Set mode for the third plane.
  8012. @item m3
  8013. Set mode for the fourth plane.
  8014. @end table
  8015. Range of mode is from 0 to 24. Description of each mode follows:
  8016. @table @var
  8017. @item 0
  8018. Leave input plane unchanged. Default.
  8019. @item 1
  8020. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8021. @item 2
  8022. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8023. @item 3
  8024. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8025. @item 4
  8026. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8027. This is equivalent to a median filter.
  8028. @item 5
  8029. Line-sensitive clipping giving the minimal change.
  8030. @item 6
  8031. Line-sensitive clipping, intermediate.
  8032. @item 7
  8033. Line-sensitive clipping, intermediate.
  8034. @item 8
  8035. Line-sensitive clipping, intermediate.
  8036. @item 9
  8037. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8038. @item 10
  8039. Replaces the target pixel with the closest neighbour.
  8040. @item 11
  8041. [1 2 1] horizontal and vertical kernel blur.
  8042. @item 12
  8043. Same as mode 11.
  8044. @item 13
  8045. Bob mode, interpolates top field from the line where the neighbours
  8046. pixels are the closest.
  8047. @item 14
  8048. Bob mode, interpolates bottom field from the line where the neighbours
  8049. pixels are the closest.
  8050. @item 15
  8051. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8052. interpolation formula.
  8053. @item 16
  8054. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8055. interpolation formula.
  8056. @item 17
  8057. Clips the pixel with the minimum and maximum of respectively the maximum and
  8058. minimum of each pair of opposite neighbour pixels.
  8059. @item 18
  8060. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8061. the current pixel is minimal.
  8062. @item 19
  8063. Replaces the pixel with the average of its 8 neighbours.
  8064. @item 20
  8065. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8066. @item 21
  8067. Clips pixels using the averages of opposite neighbour.
  8068. @item 22
  8069. Same as mode 21 but simpler and faster.
  8070. @item 23
  8071. Small edge and halo removal, but reputed useless.
  8072. @item 24
  8073. Similar as 23.
  8074. @end table
  8075. @section removelogo
  8076. Suppress a TV station logo, using an image file to determine which
  8077. pixels comprise the logo. It works by filling in the pixels that
  8078. comprise the logo with neighboring pixels.
  8079. The filter accepts the following options:
  8080. @table @option
  8081. @item filename, f
  8082. Set the filter bitmap file, which can be any image format supported by
  8083. libavformat. The width and height of the image file must match those of the
  8084. video stream being processed.
  8085. @end table
  8086. Pixels in the provided bitmap image with a value of zero are not
  8087. considered part of the logo, non-zero pixels are considered part of
  8088. the logo. If you use white (255) for the logo and black (0) for the
  8089. rest, you will be safe. For making the filter bitmap, it is
  8090. recommended to take a screen capture of a black frame with the logo
  8091. visible, and then using a threshold filter followed by the erode
  8092. filter once or twice.
  8093. If needed, little splotches can be fixed manually. Remember that if
  8094. logo pixels are not covered, the filter quality will be much
  8095. reduced. Marking too many pixels as part of the logo does not hurt as
  8096. much, but it will increase the amount of blurring needed to cover over
  8097. the image and will destroy more information than necessary, and extra
  8098. pixels will slow things down on a large logo.
  8099. @section repeatfields
  8100. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8101. fields based on its value.
  8102. @section reverse, areverse
  8103. Reverse a clip.
  8104. Warning: This filter requires memory to buffer the entire clip, so trimming
  8105. is suggested.
  8106. @subsection Examples
  8107. @itemize
  8108. @item
  8109. Take the first 5 seconds of a clip, and reverse it.
  8110. @example
  8111. trim=end=5,reverse
  8112. @end example
  8113. @end itemize
  8114. @section rotate
  8115. Rotate video by an arbitrary angle expressed in radians.
  8116. The filter accepts the following options:
  8117. A description of the optional parameters follows.
  8118. @table @option
  8119. @item angle, a
  8120. Set an expression for the angle by which to rotate the input video
  8121. clockwise, expressed as a number of radians. A negative value will
  8122. result in a counter-clockwise rotation. By default it is set to "0".
  8123. This expression is evaluated for each frame.
  8124. @item out_w, ow
  8125. Set the output width expression, default value is "iw".
  8126. This expression is evaluated just once during configuration.
  8127. @item out_h, oh
  8128. Set the output height expression, default value is "ih".
  8129. This expression is evaluated just once during configuration.
  8130. @item bilinear
  8131. Enable bilinear interpolation if set to 1, a value of 0 disables
  8132. it. Default value is 1.
  8133. @item fillcolor, c
  8134. Set the color used to fill the output area not covered by the rotated
  8135. image. For the general syntax of this option, check the "Color" section in the
  8136. ffmpeg-utils manual. If the special value "none" is selected then no
  8137. background is printed (useful for example if the background is never shown).
  8138. Default value is "black".
  8139. @end table
  8140. The expressions for the angle and the output size can contain the
  8141. following constants and functions:
  8142. @table @option
  8143. @item n
  8144. sequential number of the input frame, starting from 0. It is always NAN
  8145. before the first frame is filtered.
  8146. @item t
  8147. time in seconds of the input frame, it is set to 0 when the filter is
  8148. configured. It is always NAN before the first frame is filtered.
  8149. @item hsub
  8150. @item vsub
  8151. horizontal and vertical chroma subsample values. For example for the
  8152. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8153. @item in_w, iw
  8154. @item in_h, ih
  8155. the input video width and height
  8156. @item out_w, ow
  8157. @item out_h, oh
  8158. the output width and height, that is the size of the padded area as
  8159. specified by the @var{width} and @var{height} expressions
  8160. @item rotw(a)
  8161. @item roth(a)
  8162. the minimal width/height required for completely containing the input
  8163. video rotated by @var{a} radians.
  8164. These are only available when computing the @option{out_w} and
  8165. @option{out_h} expressions.
  8166. @end table
  8167. @subsection Examples
  8168. @itemize
  8169. @item
  8170. Rotate the input by PI/6 radians clockwise:
  8171. @example
  8172. rotate=PI/6
  8173. @end example
  8174. @item
  8175. Rotate the input by PI/6 radians counter-clockwise:
  8176. @example
  8177. rotate=-PI/6
  8178. @end example
  8179. @item
  8180. Rotate the input by 45 degrees clockwise:
  8181. @example
  8182. rotate=45*PI/180
  8183. @end example
  8184. @item
  8185. Apply a constant rotation with period T, starting from an angle of PI/3:
  8186. @example
  8187. rotate=PI/3+2*PI*t/T
  8188. @end example
  8189. @item
  8190. Make the input video rotation oscillating with a period of T
  8191. seconds and an amplitude of A radians:
  8192. @example
  8193. rotate=A*sin(2*PI/T*t)
  8194. @end example
  8195. @item
  8196. Rotate the video, output size is chosen so that the whole rotating
  8197. input video is always completely contained in the output:
  8198. @example
  8199. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8200. @end example
  8201. @item
  8202. Rotate the video, reduce the output size so that no background is ever
  8203. shown:
  8204. @example
  8205. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8206. @end example
  8207. @end itemize
  8208. @subsection Commands
  8209. The filter supports the following commands:
  8210. @table @option
  8211. @item a, angle
  8212. Set the angle expression.
  8213. The command accepts the same syntax of the corresponding option.
  8214. If the specified expression is not valid, it is kept at its current
  8215. value.
  8216. @end table
  8217. @section sab
  8218. Apply Shape Adaptive Blur.
  8219. The filter accepts the following options:
  8220. @table @option
  8221. @item luma_radius, lr
  8222. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8223. value is 1.0. A greater value will result in a more blurred image, and
  8224. in slower processing.
  8225. @item luma_pre_filter_radius, lpfr
  8226. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8227. value is 1.0.
  8228. @item luma_strength, ls
  8229. Set luma maximum difference between pixels to still be considered, must
  8230. be a value in the 0.1-100.0 range, default value is 1.0.
  8231. @item chroma_radius, cr
  8232. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8233. greater value will result in a more blurred image, and in slower
  8234. processing.
  8235. @item chroma_pre_filter_radius, cpfr
  8236. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8237. @item chroma_strength, cs
  8238. Set chroma maximum difference between pixels to still be considered,
  8239. must be a value in the 0.1-100.0 range.
  8240. @end table
  8241. Each chroma option value, if not explicitly specified, is set to the
  8242. corresponding luma option value.
  8243. @anchor{scale}
  8244. @section scale
  8245. Scale (resize) the input video, using the libswscale library.
  8246. The scale filter forces the output display aspect ratio to be the same
  8247. of the input, by changing the output sample aspect ratio.
  8248. If the input image format is different from the format requested by
  8249. the next filter, the scale filter will convert the input to the
  8250. requested format.
  8251. @subsection Options
  8252. The filter accepts the following options, or any of the options
  8253. supported by the libswscale scaler.
  8254. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8255. the complete list of scaler options.
  8256. @table @option
  8257. @item width, w
  8258. @item height, h
  8259. Set the output video dimension expression. Default value is the input
  8260. dimension.
  8261. If the value is 0, the input width is used for the output.
  8262. If one of the values is -1, the scale filter will use a value that
  8263. maintains the aspect ratio of the input image, calculated from the
  8264. other specified dimension. If both of them are -1, the input size is
  8265. used
  8266. If one of the values is -n with n > 1, the scale filter will also use a value
  8267. that maintains the aspect ratio of the input image, calculated from the other
  8268. specified dimension. After that it will, however, make sure that the calculated
  8269. dimension is divisible by n and adjust the value if necessary.
  8270. See below for the list of accepted constants for use in the dimension
  8271. expression.
  8272. @item eval
  8273. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8274. @table @samp
  8275. @item init
  8276. Only evaluate expressions once during the filter initialization or when a command is processed.
  8277. @item frame
  8278. Evaluate expressions for each incoming frame.
  8279. @end table
  8280. Default value is @samp{init}.
  8281. @item interl
  8282. Set the interlacing mode. It accepts the following values:
  8283. @table @samp
  8284. @item 1
  8285. Force interlaced aware scaling.
  8286. @item 0
  8287. Do not apply interlaced scaling.
  8288. @item -1
  8289. Select interlaced aware scaling depending on whether the source frames
  8290. are flagged as interlaced or not.
  8291. @end table
  8292. Default value is @samp{0}.
  8293. @item flags
  8294. Set libswscale scaling flags. See
  8295. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8296. complete list of values. If not explicitly specified the filter applies
  8297. the default flags.
  8298. @item param0, param1
  8299. Set libswscale input parameters for scaling algorithms that need them. See
  8300. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8301. complete documentation. If not explicitly specified the filter applies
  8302. empty parameters.
  8303. @item size, s
  8304. Set the video size. For the syntax of this option, check the
  8305. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8306. @item in_color_matrix
  8307. @item out_color_matrix
  8308. Set in/output YCbCr color space type.
  8309. This allows the autodetected value to be overridden as well as allows forcing
  8310. a specific value used for the output and encoder.
  8311. If not specified, the color space type depends on the pixel format.
  8312. Possible values:
  8313. @table @samp
  8314. @item auto
  8315. Choose automatically.
  8316. @item bt709
  8317. Format conforming to International Telecommunication Union (ITU)
  8318. Recommendation BT.709.
  8319. @item fcc
  8320. Set color space conforming to the United States Federal Communications
  8321. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8322. @item bt601
  8323. Set color space conforming to:
  8324. @itemize
  8325. @item
  8326. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8327. @item
  8328. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8329. @item
  8330. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8331. @end itemize
  8332. @item smpte240m
  8333. Set color space conforming to SMPTE ST 240:1999.
  8334. @end table
  8335. @item in_range
  8336. @item out_range
  8337. Set in/output YCbCr sample range.
  8338. This allows the autodetected value to be overridden as well as allows forcing
  8339. a specific value used for the output and encoder. If not specified, the
  8340. range depends on the pixel format. Possible values:
  8341. @table @samp
  8342. @item auto
  8343. Choose automatically.
  8344. @item jpeg/full/pc
  8345. Set full range (0-255 in case of 8-bit luma).
  8346. @item mpeg/tv
  8347. Set "MPEG" range (16-235 in case of 8-bit luma).
  8348. @end table
  8349. @item force_original_aspect_ratio
  8350. Enable decreasing or increasing output video width or height if necessary to
  8351. keep the original aspect ratio. Possible values:
  8352. @table @samp
  8353. @item disable
  8354. Scale the video as specified and disable this feature.
  8355. @item decrease
  8356. The output video dimensions will automatically be decreased if needed.
  8357. @item increase
  8358. The output video dimensions will automatically be increased if needed.
  8359. @end table
  8360. One useful instance of this option is that when you know a specific device's
  8361. maximum allowed resolution, you can use this to limit the output video to
  8362. that, while retaining the aspect ratio. For example, device A allows
  8363. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8364. decrease) and specifying 1280x720 to the command line makes the output
  8365. 1280x533.
  8366. Please note that this is a different thing than specifying -1 for @option{w}
  8367. or @option{h}, you still need to specify the output resolution for this option
  8368. to work.
  8369. @end table
  8370. The values of the @option{w} and @option{h} options are expressions
  8371. containing the following constants:
  8372. @table @var
  8373. @item in_w
  8374. @item in_h
  8375. The input width and height
  8376. @item iw
  8377. @item ih
  8378. These are the same as @var{in_w} and @var{in_h}.
  8379. @item out_w
  8380. @item out_h
  8381. The output (scaled) width and height
  8382. @item ow
  8383. @item oh
  8384. These are the same as @var{out_w} and @var{out_h}
  8385. @item a
  8386. The same as @var{iw} / @var{ih}
  8387. @item sar
  8388. input sample aspect ratio
  8389. @item dar
  8390. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8391. @item hsub
  8392. @item vsub
  8393. horizontal and vertical input chroma subsample values. For example for the
  8394. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8395. @item ohsub
  8396. @item ovsub
  8397. horizontal and vertical output chroma subsample values. For example for the
  8398. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8399. @end table
  8400. @subsection Examples
  8401. @itemize
  8402. @item
  8403. Scale the input video to a size of 200x100
  8404. @example
  8405. scale=w=200:h=100
  8406. @end example
  8407. This is equivalent to:
  8408. @example
  8409. scale=200:100
  8410. @end example
  8411. or:
  8412. @example
  8413. scale=200x100
  8414. @end example
  8415. @item
  8416. Specify a size abbreviation for the output size:
  8417. @example
  8418. scale=qcif
  8419. @end example
  8420. which can also be written as:
  8421. @example
  8422. scale=size=qcif
  8423. @end example
  8424. @item
  8425. Scale the input to 2x:
  8426. @example
  8427. scale=w=2*iw:h=2*ih
  8428. @end example
  8429. @item
  8430. The above is the same as:
  8431. @example
  8432. scale=2*in_w:2*in_h
  8433. @end example
  8434. @item
  8435. Scale the input to 2x with forced interlaced scaling:
  8436. @example
  8437. scale=2*iw:2*ih:interl=1
  8438. @end example
  8439. @item
  8440. Scale the input to half size:
  8441. @example
  8442. scale=w=iw/2:h=ih/2
  8443. @end example
  8444. @item
  8445. Increase the width, and set the height to the same size:
  8446. @example
  8447. scale=3/2*iw:ow
  8448. @end example
  8449. @item
  8450. Seek Greek harmony:
  8451. @example
  8452. scale=iw:1/PHI*iw
  8453. scale=ih*PHI:ih
  8454. @end example
  8455. @item
  8456. Increase the height, and set the width to 3/2 of the height:
  8457. @example
  8458. scale=w=3/2*oh:h=3/5*ih
  8459. @end example
  8460. @item
  8461. Increase the size, making the size a multiple of the chroma
  8462. subsample values:
  8463. @example
  8464. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8465. @end example
  8466. @item
  8467. Increase the width to a maximum of 500 pixels,
  8468. keeping the same aspect ratio as the input:
  8469. @example
  8470. scale=w='min(500\, iw*3/2):h=-1'
  8471. @end example
  8472. @end itemize
  8473. @subsection Commands
  8474. This filter supports the following commands:
  8475. @table @option
  8476. @item width, w
  8477. @item height, h
  8478. Set the output video dimension expression.
  8479. The command accepts the same syntax of the corresponding option.
  8480. If the specified expression is not valid, it is kept at its current
  8481. value.
  8482. @end table
  8483. @section scale2ref
  8484. Scale (resize) the input video, based on a reference video.
  8485. See the scale filter for available options, scale2ref supports the same but
  8486. uses the reference video instead of the main input as basis.
  8487. @subsection Examples
  8488. @itemize
  8489. @item
  8490. Scale a subtitle stream to match the main video in size before overlaying
  8491. @example
  8492. 'scale2ref[b][a];[a][b]overlay'
  8493. @end example
  8494. @end itemize
  8495. @anchor{selectivecolor}
  8496. @section selectivecolor
  8497. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8498. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8499. by the "purity" of the color (that is, how saturated it already is).
  8500. This filter is similar to the Adobe Photoshop Selective Color tool.
  8501. The filter accepts the following options:
  8502. @table @option
  8503. @item correction_method
  8504. Select color correction method.
  8505. Available values are:
  8506. @table @samp
  8507. @item absolute
  8508. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8509. component value).
  8510. @item relative
  8511. Specified adjustments are relative to the original component value.
  8512. @end table
  8513. Default is @code{absolute}.
  8514. @item reds
  8515. Adjustments for red pixels (pixels where the red component is the maximum)
  8516. @item yellows
  8517. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8518. @item greens
  8519. Adjustments for green pixels (pixels where the green component is the maximum)
  8520. @item cyans
  8521. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8522. @item blues
  8523. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8524. @item magentas
  8525. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8526. @item whites
  8527. Adjustments for white pixels (pixels where all components are greater than 128)
  8528. @item neutrals
  8529. Adjustments for all pixels except pure black and pure white
  8530. @item blacks
  8531. Adjustments for black pixels (pixels where all components are lesser than 128)
  8532. @item psfile
  8533. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8534. @end table
  8535. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8536. 4 space separated floating point adjustment values in the [-1,1] range,
  8537. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8538. pixels of its range.
  8539. @subsection Examples
  8540. @itemize
  8541. @item
  8542. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8543. increase magenta by 27% in blue areas:
  8544. @example
  8545. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8546. @end example
  8547. @item
  8548. Use a Photoshop selective color preset:
  8549. @example
  8550. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8551. @end example
  8552. @end itemize
  8553. @section separatefields
  8554. The @code{separatefields} takes a frame-based video input and splits
  8555. each frame into its components fields, producing a new half height clip
  8556. with twice the frame rate and twice the frame count.
  8557. This filter use field-dominance information in frame to decide which
  8558. of each pair of fields to place first in the output.
  8559. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8560. @section setdar, setsar
  8561. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8562. output video.
  8563. This is done by changing the specified Sample (aka Pixel) Aspect
  8564. Ratio, according to the following equation:
  8565. @example
  8566. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8567. @end example
  8568. Keep in mind that the @code{setdar} filter does not modify the pixel
  8569. dimensions of the video frame. Also, the display aspect ratio set by
  8570. this filter may be changed by later filters in the filterchain,
  8571. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8572. applied.
  8573. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8574. the filter output video.
  8575. Note that as a consequence of the application of this filter, the
  8576. output display aspect ratio will change according to the equation
  8577. above.
  8578. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8579. filter may be changed by later filters in the filterchain, e.g. if
  8580. another "setsar" or a "setdar" filter is applied.
  8581. It accepts the following parameters:
  8582. @table @option
  8583. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8584. Set the aspect ratio used by the filter.
  8585. The parameter can be a floating point number string, an expression, or
  8586. a string of the form @var{num}:@var{den}, where @var{num} and
  8587. @var{den} are the numerator and denominator of the aspect ratio. If
  8588. the parameter is not specified, it is assumed the value "0".
  8589. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8590. should be escaped.
  8591. @item max
  8592. Set the maximum integer value to use for expressing numerator and
  8593. denominator when reducing the expressed aspect ratio to a rational.
  8594. Default value is @code{100}.
  8595. @end table
  8596. The parameter @var{sar} is an expression containing
  8597. the following constants:
  8598. @table @option
  8599. @item E, PI, PHI
  8600. These are approximated values for the mathematical constants e
  8601. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8602. @item w, h
  8603. The input width and height.
  8604. @item a
  8605. These are the same as @var{w} / @var{h}.
  8606. @item sar
  8607. The input sample aspect ratio.
  8608. @item dar
  8609. The input display aspect ratio. It is the same as
  8610. (@var{w} / @var{h}) * @var{sar}.
  8611. @item hsub, vsub
  8612. Horizontal and vertical chroma subsample values. For example, for the
  8613. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8614. @end table
  8615. @subsection Examples
  8616. @itemize
  8617. @item
  8618. To change the display aspect ratio to 16:9, specify one of the following:
  8619. @example
  8620. setdar=dar=1.77777
  8621. setdar=dar=16/9
  8622. setdar=dar=1.77777
  8623. @end example
  8624. @item
  8625. To change the sample aspect ratio to 10:11, specify:
  8626. @example
  8627. setsar=sar=10/11
  8628. @end example
  8629. @item
  8630. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8631. 1000 in the aspect ratio reduction, use the command:
  8632. @example
  8633. setdar=ratio=16/9:max=1000
  8634. @end example
  8635. @end itemize
  8636. @anchor{setfield}
  8637. @section setfield
  8638. Force field for the output video frame.
  8639. The @code{setfield} filter marks the interlace type field for the
  8640. output frames. It does not change the input frame, but only sets the
  8641. corresponding property, which affects how the frame is treated by
  8642. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8643. The filter accepts the following options:
  8644. @table @option
  8645. @item mode
  8646. Available values are:
  8647. @table @samp
  8648. @item auto
  8649. Keep the same field property.
  8650. @item bff
  8651. Mark the frame as bottom-field-first.
  8652. @item tff
  8653. Mark the frame as top-field-first.
  8654. @item prog
  8655. Mark the frame as progressive.
  8656. @end table
  8657. @end table
  8658. @section showinfo
  8659. Show a line containing various information for each input video frame.
  8660. The input video is not modified.
  8661. The shown line contains a sequence of key/value pairs of the form
  8662. @var{key}:@var{value}.
  8663. The following values are shown in the output:
  8664. @table @option
  8665. @item n
  8666. The (sequential) number of the input frame, starting from 0.
  8667. @item pts
  8668. The Presentation TimeStamp of the input frame, expressed as a number of
  8669. time base units. The time base unit depends on the filter input pad.
  8670. @item pts_time
  8671. The Presentation TimeStamp of the input frame, expressed as a number of
  8672. seconds.
  8673. @item pos
  8674. The position of the frame in the input stream, or -1 if this information is
  8675. unavailable and/or meaningless (for example in case of synthetic video).
  8676. @item fmt
  8677. The pixel format name.
  8678. @item sar
  8679. The sample aspect ratio of the input frame, expressed in the form
  8680. @var{num}/@var{den}.
  8681. @item s
  8682. The size of the input frame. For the syntax of this option, check the
  8683. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8684. @item i
  8685. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8686. for bottom field first).
  8687. @item iskey
  8688. This is 1 if the frame is a key frame, 0 otherwise.
  8689. @item type
  8690. The picture type of the input frame ("I" for an I-frame, "P" for a
  8691. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8692. Also refer to the documentation of the @code{AVPictureType} enum and of
  8693. the @code{av_get_picture_type_char} function defined in
  8694. @file{libavutil/avutil.h}.
  8695. @item checksum
  8696. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8697. @item plane_checksum
  8698. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8699. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8700. @end table
  8701. @section showpalette
  8702. Displays the 256 colors palette of each frame. This filter is only relevant for
  8703. @var{pal8} pixel format frames.
  8704. It accepts the following option:
  8705. @table @option
  8706. @item s
  8707. Set the size of the box used to represent one palette color entry. Default is
  8708. @code{30} (for a @code{30x30} pixel box).
  8709. @end table
  8710. @section shuffleframes
  8711. Reorder and/or duplicate video frames.
  8712. It accepts the following parameters:
  8713. @table @option
  8714. @item mapping
  8715. Set the destination indexes of input frames.
  8716. This is space or '|' separated list of indexes that maps input frames to output
  8717. frames. Number of indexes also sets maximal value that each index may have.
  8718. @end table
  8719. The first frame has the index 0. The default is to keep the input unchanged.
  8720. Swap second and third frame of every three frames of the input:
  8721. @example
  8722. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8723. @end example
  8724. @section shuffleplanes
  8725. Reorder and/or duplicate video planes.
  8726. It accepts the following parameters:
  8727. @table @option
  8728. @item map0
  8729. The index of the input plane to be used as the first output plane.
  8730. @item map1
  8731. The index of the input plane to be used as the second output plane.
  8732. @item map2
  8733. The index of the input plane to be used as the third output plane.
  8734. @item map3
  8735. The index of the input plane to be used as the fourth output plane.
  8736. @end table
  8737. The first plane has the index 0. The default is to keep the input unchanged.
  8738. Swap the second and third planes of the input:
  8739. @example
  8740. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8741. @end example
  8742. @anchor{signalstats}
  8743. @section signalstats
  8744. Evaluate various visual metrics that assist in determining issues associated
  8745. with the digitization of analog video media.
  8746. By default the filter will log these metadata values:
  8747. @table @option
  8748. @item YMIN
  8749. Display the minimal Y value contained within the input frame. Expressed in
  8750. range of [0-255].
  8751. @item YLOW
  8752. Display the Y value at the 10% percentile within the input frame. Expressed in
  8753. range of [0-255].
  8754. @item YAVG
  8755. Display the average Y value within the input frame. Expressed in range of
  8756. [0-255].
  8757. @item YHIGH
  8758. Display the Y value at the 90% percentile within the input frame. Expressed in
  8759. range of [0-255].
  8760. @item YMAX
  8761. Display the maximum Y value contained within the input frame. Expressed in
  8762. range of [0-255].
  8763. @item UMIN
  8764. Display the minimal U value contained within the input frame. Expressed in
  8765. range of [0-255].
  8766. @item ULOW
  8767. Display the U value at the 10% percentile within the input frame. Expressed in
  8768. range of [0-255].
  8769. @item UAVG
  8770. Display the average U value within the input frame. Expressed in range of
  8771. [0-255].
  8772. @item UHIGH
  8773. Display the U value at the 90% percentile within the input frame. Expressed in
  8774. range of [0-255].
  8775. @item UMAX
  8776. Display the maximum U value contained within the input frame. Expressed in
  8777. range of [0-255].
  8778. @item VMIN
  8779. Display the minimal V value contained within the input frame. Expressed in
  8780. range of [0-255].
  8781. @item VLOW
  8782. Display the V value at the 10% percentile within the input frame. Expressed in
  8783. range of [0-255].
  8784. @item VAVG
  8785. Display the average V value within the input frame. Expressed in range of
  8786. [0-255].
  8787. @item VHIGH
  8788. Display the V value at the 90% percentile within the input frame. Expressed in
  8789. range of [0-255].
  8790. @item VMAX
  8791. Display the maximum V value contained within the input frame. Expressed in
  8792. range of [0-255].
  8793. @item SATMIN
  8794. Display the minimal saturation value contained within the input frame.
  8795. Expressed in range of [0-~181.02].
  8796. @item SATLOW
  8797. Display the saturation value at the 10% percentile within the input frame.
  8798. Expressed in range of [0-~181.02].
  8799. @item SATAVG
  8800. Display the average saturation value within the input frame. Expressed in range
  8801. of [0-~181.02].
  8802. @item SATHIGH
  8803. Display the saturation value at the 90% percentile within the input frame.
  8804. Expressed in range of [0-~181.02].
  8805. @item SATMAX
  8806. Display the maximum saturation value contained within the input frame.
  8807. Expressed in range of [0-~181.02].
  8808. @item HUEMED
  8809. Display the median value for hue within the input frame. Expressed in range of
  8810. [0-360].
  8811. @item HUEAVG
  8812. Display the average value for hue within the input frame. Expressed in range of
  8813. [0-360].
  8814. @item YDIF
  8815. Display the average of sample value difference between all values of the Y
  8816. plane in the current frame and corresponding values of the previous input frame.
  8817. Expressed in range of [0-255].
  8818. @item UDIF
  8819. Display the average of sample value difference between all values of the U
  8820. plane in the current frame and corresponding values of the previous input frame.
  8821. Expressed in range of [0-255].
  8822. @item VDIF
  8823. Display the average of sample value difference between all values of the V
  8824. plane in the current frame and corresponding values of the previous input frame.
  8825. Expressed in range of [0-255].
  8826. @end table
  8827. The filter accepts the following options:
  8828. @table @option
  8829. @item stat
  8830. @item out
  8831. @option{stat} specify an additional form of image analysis.
  8832. @option{out} output video with the specified type of pixel highlighted.
  8833. Both options accept the following values:
  8834. @table @samp
  8835. @item tout
  8836. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8837. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8838. include the results of video dropouts, head clogs, or tape tracking issues.
  8839. @item vrep
  8840. Identify @var{vertical line repetition}. Vertical line repetition includes
  8841. similar rows of pixels within a frame. In born-digital video vertical line
  8842. repetition is common, but this pattern is uncommon in video digitized from an
  8843. analog source. When it occurs in video that results from the digitization of an
  8844. analog source it can indicate concealment from a dropout compensator.
  8845. @item brng
  8846. Identify pixels that fall outside of legal broadcast range.
  8847. @end table
  8848. @item color, c
  8849. Set the highlight color for the @option{out} option. The default color is
  8850. yellow.
  8851. @end table
  8852. @subsection Examples
  8853. @itemize
  8854. @item
  8855. Output data of various video metrics:
  8856. @example
  8857. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8858. @end example
  8859. @item
  8860. Output specific data about the minimum and maximum values of the Y plane per frame:
  8861. @example
  8862. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8863. @end example
  8864. @item
  8865. Playback video while highlighting pixels that are outside of broadcast range in red.
  8866. @example
  8867. ffplay example.mov -vf signalstats="out=brng:color=red"
  8868. @end example
  8869. @item
  8870. Playback video with signalstats metadata drawn over the frame.
  8871. @example
  8872. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8873. @end example
  8874. The contents of signalstat_drawtext.txt used in the command are:
  8875. @example
  8876. time %@{pts:hms@}
  8877. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8878. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8879. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8880. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8881. @end example
  8882. @end itemize
  8883. @anchor{smartblur}
  8884. @section smartblur
  8885. Blur the input video without impacting the outlines.
  8886. It accepts the following options:
  8887. @table @option
  8888. @item luma_radius, lr
  8889. Set the luma radius. The option value must be a float number in
  8890. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8891. used to blur the image (slower if larger). Default value is 1.0.
  8892. @item luma_strength, ls
  8893. Set the luma strength. The option value must be a float number
  8894. in the range [-1.0,1.0] that configures the blurring. A value included
  8895. in [0.0,1.0] will blur the image whereas a value included in
  8896. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8897. @item luma_threshold, lt
  8898. Set the luma threshold used as a coefficient to determine
  8899. whether a pixel should be blurred or not. The option value must be an
  8900. integer in the range [-30,30]. A value of 0 will filter all the image,
  8901. a value included in [0,30] will filter flat areas and a value included
  8902. in [-30,0] will filter edges. Default value is 0.
  8903. @item chroma_radius, cr
  8904. Set the chroma radius. The option value must be a float number in
  8905. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8906. used to blur the image (slower if larger). Default value is 1.0.
  8907. @item chroma_strength, cs
  8908. Set the chroma strength. The option value must be a float number
  8909. in the range [-1.0,1.0] that configures the blurring. A value included
  8910. in [0.0,1.0] will blur the image whereas a value included in
  8911. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8912. @item chroma_threshold, ct
  8913. Set the chroma threshold used as a coefficient to determine
  8914. whether a pixel should be blurred or not. The option value must be an
  8915. integer in the range [-30,30]. A value of 0 will filter all the image,
  8916. a value included in [0,30] will filter flat areas and a value included
  8917. in [-30,0] will filter edges. Default value is 0.
  8918. @end table
  8919. If a chroma option is not explicitly set, the corresponding luma value
  8920. is set.
  8921. @section ssim
  8922. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8923. This filter takes in input two input videos, the first input is
  8924. considered the "main" source and is passed unchanged to the
  8925. output. The second input is used as a "reference" video for computing
  8926. the SSIM.
  8927. Both video inputs must have the same resolution and pixel format for
  8928. this filter to work correctly. Also it assumes that both inputs
  8929. have the same number of frames, which are compared one by one.
  8930. The filter stores the calculated SSIM of each frame.
  8931. The description of the accepted parameters follows.
  8932. @table @option
  8933. @item stats_file, f
  8934. If specified the filter will use the named file to save the SSIM of
  8935. each individual frame. When filename equals "-" the data is sent to
  8936. standard output.
  8937. @end table
  8938. The file printed if @var{stats_file} is selected, contains a sequence of
  8939. key/value pairs of the form @var{key}:@var{value} for each compared
  8940. couple of frames.
  8941. A description of each shown parameter follows:
  8942. @table @option
  8943. @item n
  8944. sequential number of the input frame, starting from 1
  8945. @item Y, U, V, R, G, B
  8946. SSIM of the compared frames for the component specified by the suffix.
  8947. @item All
  8948. SSIM of the compared frames for the whole frame.
  8949. @item dB
  8950. Same as above but in dB representation.
  8951. @end table
  8952. For example:
  8953. @example
  8954. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8955. [main][ref] ssim="stats_file=stats.log" [out]
  8956. @end example
  8957. On this example the input file being processed is compared with the
  8958. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8959. is stored in @file{stats.log}.
  8960. Another example with both psnr and ssim at same time:
  8961. @example
  8962. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8963. @end example
  8964. @section stereo3d
  8965. Convert between different stereoscopic image formats.
  8966. The filters accept the following options:
  8967. @table @option
  8968. @item in
  8969. Set stereoscopic image format of input.
  8970. Available values for input image formats are:
  8971. @table @samp
  8972. @item sbsl
  8973. side by side parallel (left eye left, right eye right)
  8974. @item sbsr
  8975. side by side crosseye (right eye left, left eye right)
  8976. @item sbs2l
  8977. side by side parallel with half width resolution
  8978. (left eye left, right eye right)
  8979. @item sbs2r
  8980. side by side crosseye with half width resolution
  8981. (right eye left, left eye right)
  8982. @item abl
  8983. above-below (left eye above, right eye below)
  8984. @item abr
  8985. above-below (right eye above, left eye below)
  8986. @item ab2l
  8987. above-below with half height resolution
  8988. (left eye above, right eye below)
  8989. @item ab2r
  8990. above-below with half height resolution
  8991. (right eye above, left eye below)
  8992. @item al
  8993. alternating frames (left eye first, right eye second)
  8994. @item ar
  8995. alternating frames (right eye first, left eye second)
  8996. @item irl
  8997. interleaved rows (left eye has top row, right eye starts on next row)
  8998. @item irr
  8999. interleaved rows (right eye has top row, left eye starts on next row)
  9000. @item icl
  9001. interleaved columns, left eye first
  9002. @item icr
  9003. interleaved columns, right eye first
  9004. Default value is @samp{sbsl}.
  9005. @end table
  9006. @item out
  9007. Set stereoscopic image format of output.
  9008. @table @samp
  9009. @item sbsl
  9010. side by side parallel (left eye left, right eye right)
  9011. @item sbsr
  9012. side by side crosseye (right eye left, left eye right)
  9013. @item sbs2l
  9014. side by side parallel with half width resolution
  9015. (left eye left, right eye right)
  9016. @item sbs2r
  9017. side by side crosseye with half width resolution
  9018. (right eye left, left eye right)
  9019. @item abl
  9020. above-below (left eye above, right eye below)
  9021. @item abr
  9022. above-below (right eye above, left eye below)
  9023. @item ab2l
  9024. above-below with half height resolution
  9025. (left eye above, right eye below)
  9026. @item ab2r
  9027. above-below with half height resolution
  9028. (right eye above, left eye below)
  9029. @item al
  9030. alternating frames (left eye first, right eye second)
  9031. @item ar
  9032. alternating frames (right eye first, left eye second)
  9033. @item irl
  9034. interleaved rows (left eye has top row, right eye starts on next row)
  9035. @item irr
  9036. interleaved rows (right eye has top row, left eye starts on next row)
  9037. @item arbg
  9038. anaglyph red/blue gray
  9039. (red filter on left eye, blue filter on right eye)
  9040. @item argg
  9041. anaglyph red/green gray
  9042. (red filter on left eye, green filter on right eye)
  9043. @item arcg
  9044. anaglyph red/cyan gray
  9045. (red filter on left eye, cyan filter on right eye)
  9046. @item arch
  9047. anaglyph red/cyan half colored
  9048. (red filter on left eye, cyan filter on right eye)
  9049. @item arcc
  9050. anaglyph red/cyan color
  9051. (red filter on left eye, cyan filter on right eye)
  9052. @item arcd
  9053. anaglyph red/cyan color optimized with the least squares projection of dubois
  9054. (red filter on left eye, cyan filter on right eye)
  9055. @item agmg
  9056. anaglyph green/magenta gray
  9057. (green filter on left eye, magenta filter on right eye)
  9058. @item agmh
  9059. anaglyph green/magenta half colored
  9060. (green filter on left eye, magenta filter on right eye)
  9061. @item agmc
  9062. anaglyph green/magenta colored
  9063. (green filter on left eye, magenta filter on right eye)
  9064. @item agmd
  9065. anaglyph green/magenta color optimized with the least squares projection of dubois
  9066. (green filter on left eye, magenta filter on right eye)
  9067. @item aybg
  9068. anaglyph yellow/blue gray
  9069. (yellow filter on left eye, blue filter on right eye)
  9070. @item aybh
  9071. anaglyph yellow/blue half colored
  9072. (yellow filter on left eye, blue filter on right eye)
  9073. @item aybc
  9074. anaglyph yellow/blue colored
  9075. (yellow filter on left eye, blue filter on right eye)
  9076. @item aybd
  9077. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9078. (yellow filter on left eye, blue filter on right eye)
  9079. @item ml
  9080. mono output (left eye only)
  9081. @item mr
  9082. mono output (right eye only)
  9083. @item chl
  9084. checkerboard, left eye first
  9085. @item chr
  9086. checkerboard, right eye first
  9087. @item icl
  9088. interleaved columns, left eye first
  9089. @item icr
  9090. interleaved columns, right eye first
  9091. @end table
  9092. Default value is @samp{arcd}.
  9093. @end table
  9094. @subsection Examples
  9095. @itemize
  9096. @item
  9097. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9098. @example
  9099. stereo3d=sbsl:aybd
  9100. @end example
  9101. @item
  9102. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9103. @example
  9104. stereo3d=abl:sbsr
  9105. @end example
  9106. @end itemize
  9107. @section streamselect, astreamselect
  9108. Select video or audio streams.
  9109. The filter accepts the following options:
  9110. @table @option
  9111. @item inputs
  9112. Set number of inputs. Default is 2.
  9113. @item map
  9114. Set input indexes to remap to outputs.
  9115. @end table
  9116. @subsection Commands
  9117. The @code{streamselect} and @code{astreamselect} filter supports the following
  9118. commands:
  9119. @table @option
  9120. @item map
  9121. Set input indexes to remap to outputs.
  9122. @end table
  9123. @subsection Examples
  9124. @itemize
  9125. @item
  9126. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9127. @example
  9128. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9129. @end example
  9130. @item
  9131. Same as above, but for audio:
  9132. @example
  9133. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9134. @end example
  9135. @end itemize
  9136. @anchor{spp}
  9137. @section spp
  9138. Apply a simple postprocessing filter that compresses and decompresses the image
  9139. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9140. and average the results.
  9141. The filter accepts the following options:
  9142. @table @option
  9143. @item quality
  9144. Set quality. This option defines the number of levels for averaging. It accepts
  9145. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9146. effect. A value of @code{6} means the higher quality. For each increment of
  9147. that value the speed drops by a factor of approximately 2. Default value is
  9148. @code{3}.
  9149. @item qp
  9150. Force a constant quantization parameter. If not set, the filter will use the QP
  9151. from the video stream (if available).
  9152. @item mode
  9153. Set thresholding mode. Available modes are:
  9154. @table @samp
  9155. @item hard
  9156. Set hard thresholding (default).
  9157. @item soft
  9158. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9159. @end table
  9160. @item use_bframe_qp
  9161. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9162. option may cause flicker since the B-Frames have often larger QP. Default is
  9163. @code{0} (not enabled).
  9164. @end table
  9165. @anchor{subtitles}
  9166. @section subtitles
  9167. Draw subtitles on top of input video using the libass library.
  9168. To enable compilation of this filter you need to configure FFmpeg with
  9169. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9170. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9171. Alpha) subtitles format.
  9172. The filter accepts the following options:
  9173. @table @option
  9174. @item filename, f
  9175. Set the filename of the subtitle file to read. It must be specified.
  9176. @item original_size
  9177. Specify the size of the original video, the video for which the ASS file
  9178. was composed. For the syntax of this option, check the
  9179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9180. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9181. correctly scale the fonts if the aspect ratio has been changed.
  9182. @item fontsdir
  9183. Set a directory path containing fonts that can be used by the filter.
  9184. These fonts will be used in addition to whatever the font provider uses.
  9185. @item charenc
  9186. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9187. useful if not UTF-8.
  9188. @item stream_index, si
  9189. Set subtitles stream index. @code{subtitles} filter only.
  9190. @item force_style
  9191. Override default style or script info parameters of the subtitles. It accepts a
  9192. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9193. @end table
  9194. If the first key is not specified, it is assumed that the first value
  9195. specifies the @option{filename}.
  9196. For example, to render the file @file{sub.srt} on top of the input
  9197. video, use the command:
  9198. @example
  9199. subtitles=sub.srt
  9200. @end example
  9201. which is equivalent to:
  9202. @example
  9203. subtitles=filename=sub.srt
  9204. @end example
  9205. To render the default subtitles stream from file @file{video.mkv}, use:
  9206. @example
  9207. subtitles=video.mkv
  9208. @end example
  9209. To render the second subtitles stream from that file, use:
  9210. @example
  9211. subtitles=video.mkv:si=1
  9212. @end example
  9213. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9214. @code{DejaVu Serif}, use:
  9215. @example
  9216. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9217. @end example
  9218. @section super2xsai
  9219. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9220. Interpolate) pixel art scaling algorithm.
  9221. Useful for enlarging pixel art images without reducing sharpness.
  9222. @section swaprect
  9223. Swap two rectangular objects in video.
  9224. This filter accepts the following options:
  9225. @table @option
  9226. @item w
  9227. Set object width.
  9228. @item h
  9229. Set object height.
  9230. @item x1
  9231. Set 1st rect x coordinate.
  9232. @item y1
  9233. Set 1st rect y coordinate.
  9234. @item x2
  9235. Set 2nd rect x coordinate.
  9236. @item y2
  9237. Set 2nd rect y coordinate.
  9238. All expressions are evaluated once for each frame.
  9239. @end table
  9240. The all options are expressions containing the following constants:
  9241. @table @option
  9242. @item w
  9243. @item h
  9244. The input width and height.
  9245. @item a
  9246. same as @var{w} / @var{h}
  9247. @item sar
  9248. input sample aspect ratio
  9249. @item dar
  9250. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9251. @item n
  9252. The number of the input frame, starting from 0.
  9253. @item t
  9254. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9255. @item pos
  9256. the position in the file of the input frame, NAN if unknown
  9257. @end table
  9258. @section swapuv
  9259. Swap U & V plane.
  9260. @section telecine
  9261. Apply telecine process to the video.
  9262. This filter accepts the following options:
  9263. @table @option
  9264. @item first_field
  9265. @table @samp
  9266. @item top, t
  9267. top field first
  9268. @item bottom, b
  9269. bottom field first
  9270. The default value is @code{top}.
  9271. @end table
  9272. @item pattern
  9273. A string of numbers representing the pulldown pattern you wish to apply.
  9274. The default value is @code{23}.
  9275. @end table
  9276. @example
  9277. Some typical patterns:
  9278. NTSC output (30i):
  9279. 27.5p: 32222
  9280. 24p: 23 (classic)
  9281. 24p: 2332 (preferred)
  9282. 20p: 33
  9283. 18p: 334
  9284. 16p: 3444
  9285. PAL output (25i):
  9286. 27.5p: 12222
  9287. 24p: 222222222223 ("Euro pulldown")
  9288. 16.67p: 33
  9289. 16p: 33333334
  9290. @end example
  9291. @section thumbnail
  9292. Select the most representative frame in a given sequence of consecutive frames.
  9293. The filter accepts the following options:
  9294. @table @option
  9295. @item n
  9296. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9297. will pick one of them, and then handle the next batch of @var{n} frames until
  9298. the end. Default is @code{100}.
  9299. @end table
  9300. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9301. value will result in a higher memory usage, so a high value is not recommended.
  9302. @subsection Examples
  9303. @itemize
  9304. @item
  9305. Extract one picture each 50 frames:
  9306. @example
  9307. thumbnail=50
  9308. @end example
  9309. @item
  9310. Complete example of a thumbnail creation with @command{ffmpeg}:
  9311. @example
  9312. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9313. @end example
  9314. @end itemize
  9315. @section tile
  9316. Tile several successive frames together.
  9317. The filter accepts the following options:
  9318. @table @option
  9319. @item layout
  9320. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9321. this option, check the
  9322. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9323. @item nb_frames
  9324. Set the maximum number of frames to render in the given area. It must be less
  9325. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9326. the area will be used.
  9327. @item margin
  9328. Set the outer border margin in pixels.
  9329. @item padding
  9330. Set the inner border thickness (i.e. the number of pixels between frames). For
  9331. more advanced padding options (such as having different values for the edges),
  9332. refer to the pad video filter.
  9333. @item color
  9334. Specify the color of the unused area. For the syntax of this option, check the
  9335. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9336. is "black".
  9337. @end table
  9338. @subsection Examples
  9339. @itemize
  9340. @item
  9341. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9342. @example
  9343. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9344. @end example
  9345. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9346. duplicating each output frame to accommodate the originally detected frame
  9347. rate.
  9348. @item
  9349. Display @code{5} pictures in an area of @code{3x2} frames,
  9350. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9351. mixed flat and named options:
  9352. @example
  9353. tile=3x2:nb_frames=5:padding=7:margin=2
  9354. @end example
  9355. @end itemize
  9356. @section tinterlace
  9357. Perform various types of temporal field interlacing.
  9358. Frames are counted starting from 1, so the first input frame is
  9359. considered odd.
  9360. The filter accepts the following options:
  9361. @table @option
  9362. @item mode
  9363. Specify the mode of the interlacing. This option can also be specified
  9364. as a value alone. See below for a list of values for this option.
  9365. Available values are:
  9366. @table @samp
  9367. @item merge, 0
  9368. Move odd frames into the upper field, even into the lower field,
  9369. generating a double height frame at half frame rate.
  9370. @example
  9371. ------> time
  9372. Input:
  9373. Frame 1 Frame 2 Frame 3 Frame 4
  9374. 11111 22222 33333 44444
  9375. 11111 22222 33333 44444
  9376. 11111 22222 33333 44444
  9377. 11111 22222 33333 44444
  9378. Output:
  9379. 11111 33333
  9380. 22222 44444
  9381. 11111 33333
  9382. 22222 44444
  9383. 11111 33333
  9384. 22222 44444
  9385. 11111 33333
  9386. 22222 44444
  9387. @end example
  9388. @item drop_odd, 1
  9389. Only output even frames, odd frames are dropped, generating a frame with
  9390. unchanged height at half frame rate.
  9391. @example
  9392. ------> time
  9393. Input:
  9394. Frame 1 Frame 2 Frame 3 Frame 4
  9395. 11111 22222 33333 44444
  9396. 11111 22222 33333 44444
  9397. 11111 22222 33333 44444
  9398. 11111 22222 33333 44444
  9399. Output:
  9400. 22222 44444
  9401. 22222 44444
  9402. 22222 44444
  9403. 22222 44444
  9404. @end example
  9405. @item drop_even, 2
  9406. Only output odd frames, even frames are dropped, generating a frame with
  9407. unchanged height at half frame rate.
  9408. @example
  9409. ------> time
  9410. Input:
  9411. Frame 1 Frame 2 Frame 3 Frame 4
  9412. 11111 22222 33333 44444
  9413. 11111 22222 33333 44444
  9414. 11111 22222 33333 44444
  9415. 11111 22222 33333 44444
  9416. Output:
  9417. 11111 33333
  9418. 11111 33333
  9419. 11111 33333
  9420. 11111 33333
  9421. @end example
  9422. @item pad, 3
  9423. Expand each frame to full height, but pad alternate lines with black,
  9424. generating a frame with double height at the same input frame rate.
  9425. @example
  9426. ------> time
  9427. Input:
  9428. Frame 1 Frame 2 Frame 3 Frame 4
  9429. 11111 22222 33333 44444
  9430. 11111 22222 33333 44444
  9431. 11111 22222 33333 44444
  9432. 11111 22222 33333 44444
  9433. Output:
  9434. 11111 ..... 33333 .....
  9435. ..... 22222 ..... 44444
  9436. 11111 ..... 33333 .....
  9437. ..... 22222 ..... 44444
  9438. 11111 ..... 33333 .....
  9439. ..... 22222 ..... 44444
  9440. 11111 ..... 33333 .....
  9441. ..... 22222 ..... 44444
  9442. @end example
  9443. @item interleave_top, 4
  9444. Interleave the upper field from odd frames with the lower field from
  9445. even frames, generating a frame with unchanged height at half frame rate.
  9446. @example
  9447. ------> time
  9448. Input:
  9449. Frame 1 Frame 2 Frame 3 Frame 4
  9450. 11111<- 22222 33333<- 44444
  9451. 11111 22222<- 33333 44444<-
  9452. 11111<- 22222 33333<- 44444
  9453. 11111 22222<- 33333 44444<-
  9454. Output:
  9455. 11111 33333
  9456. 22222 44444
  9457. 11111 33333
  9458. 22222 44444
  9459. @end example
  9460. @item interleave_bottom, 5
  9461. Interleave the lower field from odd frames with the upper field from
  9462. even frames, generating a frame with unchanged height at half frame rate.
  9463. @example
  9464. ------> time
  9465. Input:
  9466. Frame 1 Frame 2 Frame 3 Frame 4
  9467. 11111 22222<- 33333 44444<-
  9468. 11111<- 22222 33333<- 44444
  9469. 11111 22222<- 33333 44444<-
  9470. 11111<- 22222 33333<- 44444
  9471. Output:
  9472. 22222 44444
  9473. 11111 33333
  9474. 22222 44444
  9475. 11111 33333
  9476. @end example
  9477. @item interlacex2, 6
  9478. Double frame rate with unchanged height. Frames are inserted each
  9479. containing the second temporal field from the previous input frame and
  9480. the first temporal field from the next input frame. This mode relies on
  9481. the top_field_first flag. Useful for interlaced video displays with no
  9482. field synchronisation.
  9483. @example
  9484. ------> time
  9485. Input:
  9486. Frame 1 Frame 2 Frame 3 Frame 4
  9487. 11111 22222 33333 44444
  9488. 11111 22222 33333 44444
  9489. 11111 22222 33333 44444
  9490. 11111 22222 33333 44444
  9491. Output:
  9492. 11111 22222 22222 33333 33333 44444 44444
  9493. 11111 11111 22222 22222 33333 33333 44444
  9494. 11111 22222 22222 33333 33333 44444 44444
  9495. 11111 11111 22222 22222 33333 33333 44444
  9496. @end example
  9497. @item mergex2, 7
  9498. Move odd frames into the upper field, even into the lower field,
  9499. generating a double height frame at same frame rate.
  9500. @example
  9501. ------> time
  9502. Input:
  9503. Frame 1 Frame 2 Frame 3 Frame 4
  9504. 11111 22222 33333 44444
  9505. 11111 22222 33333 44444
  9506. 11111 22222 33333 44444
  9507. 11111 22222 33333 44444
  9508. Output:
  9509. 11111 33333 33333 55555
  9510. 22222 22222 44444 44444
  9511. 11111 33333 33333 55555
  9512. 22222 22222 44444 44444
  9513. 11111 33333 33333 55555
  9514. 22222 22222 44444 44444
  9515. 11111 33333 33333 55555
  9516. 22222 22222 44444 44444
  9517. @end example
  9518. @end table
  9519. Numeric values are deprecated but are accepted for backward
  9520. compatibility reasons.
  9521. Default mode is @code{merge}.
  9522. @item flags
  9523. Specify flags influencing the filter process.
  9524. Available value for @var{flags} is:
  9525. @table @option
  9526. @item low_pass_filter, vlfp
  9527. Enable vertical low-pass filtering in the filter.
  9528. Vertical low-pass filtering is required when creating an interlaced
  9529. destination from a progressive source which contains high-frequency
  9530. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9531. patterning.
  9532. Vertical low-pass filtering can only be enabled for @option{mode}
  9533. @var{interleave_top} and @var{interleave_bottom}.
  9534. @end table
  9535. @end table
  9536. @section transpose
  9537. Transpose rows with columns in the input video and optionally flip it.
  9538. It accepts the following parameters:
  9539. @table @option
  9540. @item dir
  9541. Specify the transposition direction.
  9542. Can assume the following values:
  9543. @table @samp
  9544. @item 0, 4, cclock_flip
  9545. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9546. @example
  9547. L.R L.l
  9548. . . -> . .
  9549. l.r R.r
  9550. @end example
  9551. @item 1, 5, clock
  9552. Rotate by 90 degrees clockwise, that is:
  9553. @example
  9554. L.R l.L
  9555. . . -> . .
  9556. l.r r.R
  9557. @end example
  9558. @item 2, 6, cclock
  9559. Rotate by 90 degrees counterclockwise, that is:
  9560. @example
  9561. L.R R.r
  9562. . . -> . .
  9563. l.r L.l
  9564. @end example
  9565. @item 3, 7, clock_flip
  9566. Rotate by 90 degrees clockwise and vertically flip, that is:
  9567. @example
  9568. L.R r.R
  9569. . . -> . .
  9570. l.r l.L
  9571. @end example
  9572. @end table
  9573. For values between 4-7, the transposition is only done if the input
  9574. video geometry is portrait and not landscape. These values are
  9575. deprecated, the @code{passthrough} option should be used instead.
  9576. Numerical values are deprecated, and should be dropped in favor of
  9577. symbolic constants.
  9578. @item passthrough
  9579. Do not apply the transposition if the input geometry matches the one
  9580. specified by the specified value. It accepts the following values:
  9581. @table @samp
  9582. @item none
  9583. Always apply transposition.
  9584. @item portrait
  9585. Preserve portrait geometry (when @var{height} >= @var{width}).
  9586. @item landscape
  9587. Preserve landscape geometry (when @var{width} >= @var{height}).
  9588. @end table
  9589. Default value is @code{none}.
  9590. @end table
  9591. For example to rotate by 90 degrees clockwise and preserve portrait
  9592. layout:
  9593. @example
  9594. transpose=dir=1:passthrough=portrait
  9595. @end example
  9596. The command above can also be specified as:
  9597. @example
  9598. transpose=1:portrait
  9599. @end example
  9600. @section trim
  9601. Trim the input so that the output contains one continuous subpart of the input.
  9602. It accepts the following parameters:
  9603. @table @option
  9604. @item start
  9605. Specify the time of the start of the kept section, i.e. the frame with the
  9606. timestamp @var{start} will be the first frame in the output.
  9607. @item end
  9608. Specify the time of the first frame that will be dropped, i.e. the frame
  9609. immediately preceding the one with the timestamp @var{end} will be the last
  9610. frame in the output.
  9611. @item start_pts
  9612. This is the same as @var{start}, except this option sets the start timestamp
  9613. in timebase units instead of seconds.
  9614. @item end_pts
  9615. This is the same as @var{end}, except this option sets the end timestamp
  9616. in timebase units instead of seconds.
  9617. @item duration
  9618. The maximum duration of the output in seconds.
  9619. @item start_frame
  9620. The number of the first frame that should be passed to the output.
  9621. @item end_frame
  9622. The number of the first frame that should be dropped.
  9623. @end table
  9624. @option{start}, @option{end}, and @option{duration} are expressed as time
  9625. duration specifications; see
  9626. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9627. for the accepted syntax.
  9628. Note that the first two sets of the start/end options and the @option{duration}
  9629. option look at the frame timestamp, while the _frame variants simply count the
  9630. frames that pass through the filter. Also note that this filter does not modify
  9631. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9632. setpts filter after the trim filter.
  9633. If multiple start or end options are set, this filter tries to be greedy and
  9634. keep all the frames that match at least one of the specified constraints. To keep
  9635. only the part that matches all the constraints at once, chain multiple trim
  9636. filters.
  9637. The defaults are such that all the input is kept. So it is possible to set e.g.
  9638. just the end values to keep everything before the specified time.
  9639. Examples:
  9640. @itemize
  9641. @item
  9642. Drop everything except the second minute of input:
  9643. @example
  9644. ffmpeg -i INPUT -vf trim=60:120
  9645. @end example
  9646. @item
  9647. Keep only the first second:
  9648. @example
  9649. ffmpeg -i INPUT -vf trim=duration=1
  9650. @end example
  9651. @end itemize
  9652. @anchor{unsharp}
  9653. @section unsharp
  9654. Sharpen or blur the input video.
  9655. It accepts the following parameters:
  9656. @table @option
  9657. @item luma_msize_x, lx
  9658. Set the luma matrix horizontal size. It must be an odd integer between
  9659. 3 and 63. The default value is 5.
  9660. @item luma_msize_y, ly
  9661. Set the luma matrix vertical size. It must be an odd integer between 3
  9662. and 63. The default value is 5.
  9663. @item luma_amount, la
  9664. Set the luma effect strength. It must be a floating point number, reasonable
  9665. values lay between -1.5 and 1.5.
  9666. Negative values will blur the input video, while positive values will
  9667. sharpen it, a value of zero will disable the effect.
  9668. Default value is 1.0.
  9669. @item chroma_msize_x, cx
  9670. Set the chroma matrix horizontal size. It must be an odd integer
  9671. between 3 and 63. The default value is 5.
  9672. @item chroma_msize_y, cy
  9673. Set the chroma matrix vertical size. It must be an odd integer
  9674. between 3 and 63. The default value is 5.
  9675. @item chroma_amount, ca
  9676. Set the chroma effect strength. It must be a floating point number, reasonable
  9677. values lay between -1.5 and 1.5.
  9678. Negative values will blur the input video, while positive values will
  9679. sharpen it, a value of zero will disable the effect.
  9680. Default value is 0.0.
  9681. @item opencl
  9682. If set to 1, specify using OpenCL capabilities, only available if
  9683. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  9684. @end table
  9685. All parameters are optional and default to the equivalent of the
  9686. string '5:5:1.0:5:5:0.0'.
  9687. @subsection Examples
  9688. @itemize
  9689. @item
  9690. Apply strong luma sharpen effect:
  9691. @example
  9692. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  9693. @end example
  9694. @item
  9695. Apply a strong blur of both luma and chroma parameters:
  9696. @example
  9697. unsharp=7:7:-2:7:7:-2
  9698. @end example
  9699. @end itemize
  9700. @section uspp
  9701. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  9702. the image at several (or - in the case of @option{quality} level @code{8} - all)
  9703. shifts and average the results.
  9704. The way this differs from the behavior of spp is that uspp actually encodes &
  9705. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  9706. DCT similar to MJPEG.
  9707. The filter accepts the following options:
  9708. @table @option
  9709. @item quality
  9710. Set quality. This option defines the number of levels for averaging. It accepts
  9711. an integer in the range 0-8. If set to @code{0}, the filter will have no
  9712. effect. A value of @code{8} means the higher quality. For each increment of
  9713. that value the speed drops by a factor of approximately 2. Default value is
  9714. @code{3}.
  9715. @item qp
  9716. Force a constant quantization parameter. If not set, the filter will use the QP
  9717. from the video stream (if available).
  9718. @end table
  9719. @section vectorscope
  9720. Display 2 color component values in the two dimensional graph (which is called
  9721. a vectorscope).
  9722. This filter accepts the following options:
  9723. @table @option
  9724. @item mode, m
  9725. Set vectorscope mode.
  9726. It accepts the following values:
  9727. @table @samp
  9728. @item gray
  9729. Gray values are displayed on graph, higher brightness means more pixels have
  9730. same component color value on location in graph. This is the default mode.
  9731. @item color
  9732. Gray values are displayed on graph. Surrounding pixels values which are not
  9733. present in video frame are drawn in gradient of 2 color components which are
  9734. set by option @code{x} and @code{y}. The 3rd color component is static.
  9735. @item color2
  9736. Actual color components values present in video frame are displayed on graph.
  9737. @item color3
  9738. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9739. on graph increases value of another color component, which is luminance by
  9740. default values of @code{x} and @code{y}.
  9741. @item color4
  9742. Actual colors present in video frame are displayed on graph. If two different
  9743. colors map to same position on graph then color with higher value of component
  9744. not present in graph is picked.
  9745. @item color5
  9746. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  9747. component picked from radial gradient.
  9748. @end table
  9749. @item x
  9750. Set which color component will be represented on X-axis. Default is @code{1}.
  9751. @item y
  9752. Set which color component will be represented on Y-axis. Default is @code{2}.
  9753. @item intensity, i
  9754. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  9755. of color component which represents frequency of (X, Y) location in graph.
  9756. @item envelope, e
  9757. @table @samp
  9758. @item none
  9759. No envelope, this is default.
  9760. @item instant
  9761. Instant envelope, even darkest single pixel will be clearly highlighted.
  9762. @item peak
  9763. Hold maximum and minimum values presented in graph over time. This way you
  9764. can still spot out of range values without constantly looking at vectorscope.
  9765. @item peak+instant
  9766. Peak and instant envelope combined together.
  9767. @end table
  9768. @item graticule, g
  9769. Set what kind of graticule to draw.
  9770. @table @samp
  9771. @item none
  9772. @item green
  9773. @item color
  9774. @end table
  9775. @item opacity, o
  9776. Set graticule opacity.
  9777. @item flags, f
  9778. Set graticule flags.
  9779. @table @samp
  9780. @item white
  9781. Draw graticule for white point.
  9782. @item black
  9783. Draw graticule for black point.
  9784. @item name
  9785. Draw color points short names.
  9786. @end table
  9787. @item bgopacity, b
  9788. Set background opacity.
  9789. @item lthreshold, l
  9790. Set low threshold for color component not represented on X or Y axis.
  9791. Values lower than this value will be ignored. Default is 0.
  9792. Note this value is multiplied with actual max possible value one pixel component
  9793. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  9794. is 0.1 * 255 = 25.
  9795. @item hthreshold, h
  9796. Set high threshold for color component not represented on X or Y axis.
  9797. Values higher than this value will be ignored. Default is 1.
  9798. Note this value is multiplied with actual max possible value one pixel component
  9799. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  9800. is 0.9 * 255 = 230.
  9801. @item colorspace, c
  9802. Set what kind of colorspace to use when drawing graticule.
  9803. @table @samp
  9804. @item auto
  9805. @item 601
  9806. @item 709
  9807. @end table
  9808. Default is auto.
  9809. @end table
  9810. @anchor{vidstabdetect}
  9811. @section vidstabdetect
  9812. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9813. @ref{vidstabtransform} for pass 2.
  9814. This filter generates a file with relative translation and rotation
  9815. transform information about subsequent frames, which is then used by
  9816. the @ref{vidstabtransform} filter.
  9817. To enable compilation of this filter you need to configure FFmpeg with
  9818. @code{--enable-libvidstab}.
  9819. This filter accepts the following options:
  9820. @table @option
  9821. @item result
  9822. Set the path to the file used to write the transforms information.
  9823. Default value is @file{transforms.trf}.
  9824. @item shakiness
  9825. Set how shaky the video is and how quick the camera is. It accepts an
  9826. integer in the range 1-10, a value of 1 means little shakiness, a
  9827. value of 10 means strong shakiness. Default value is 5.
  9828. @item accuracy
  9829. Set the accuracy of the detection process. It must be a value in the
  9830. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9831. accuracy. Default value is 15.
  9832. @item stepsize
  9833. Set stepsize of the search process. The region around minimum is
  9834. scanned with 1 pixel resolution. Default value is 6.
  9835. @item mincontrast
  9836. Set minimum contrast. Below this value a local measurement field is
  9837. discarded. Must be a floating point value in the range 0-1. Default
  9838. value is 0.3.
  9839. @item tripod
  9840. Set reference frame number for tripod mode.
  9841. If enabled, the motion of the frames is compared to a reference frame
  9842. in the filtered stream, identified by the specified number. The idea
  9843. is to compensate all movements in a more-or-less static scene and keep
  9844. the camera view absolutely still.
  9845. If set to 0, it is disabled. The frames are counted starting from 1.
  9846. @item show
  9847. Show fields and transforms in the resulting frames. It accepts an
  9848. integer in the range 0-2. Default value is 0, which disables any
  9849. visualization.
  9850. @end table
  9851. @subsection Examples
  9852. @itemize
  9853. @item
  9854. Use default values:
  9855. @example
  9856. vidstabdetect
  9857. @end example
  9858. @item
  9859. Analyze strongly shaky movie and put the results in file
  9860. @file{mytransforms.trf}:
  9861. @example
  9862. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9863. @end example
  9864. @item
  9865. Visualize the result of internal transformations in the resulting
  9866. video:
  9867. @example
  9868. vidstabdetect=show=1
  9869. @end example
  9870. @item
  9871. Analyze a video with medium shakiness using @command{ffmpeg}:
  9872. @example
  9873. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9874. @end example
  9875. @end itemize
  9876. @anchor{vidstabtransform}
  9877. @section vidstabtransform
  9878. Video stabilization/deshaking: pass 2 of 2,
  9879. see @ref{vidstabdetect} for pass 1.
  9880. Read a file with transform information for each frame and
  9881. apply/compensate them. Together with the @ref{vidstabdetect}
  9882. filter this can be used to deshake videos. See also
  9883. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9884. the @ref{unsharp} filter, see below.
  9885. To enable compilation of this filter you need to configure FFmpeg with
  9886. @code{--enable-libvidstab}.
  9887. @subsection Options
  9888. @table @option
  9889. @item input
  9890. Set path to the file used to read the transforms. Default value is
  9891. @file{transforms.trf}.
  9892. @item smoothing
  9893. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9894. camera movements. Default value is 10.
  9895. For example a number of 10 means that 21 frames are used (10 in the
  9896. past and 10 in the future) to smoothen the motion in the video. A
  9897. larger value leads to a smoother video, but limits the acceleration of
  9898. the camera (pan/tilt movements). 0 is a special case where a static
  9899. camera is simulated.
  9900. @item optalgo
  9901. Set the camera path optimization algorithm.
  9902. Accepted values are:
  9903. @table @samp
  9904. @item gauss
  9905. gaussian kernel low-pass filter on camera motion (default)
  9906. @item avg
  9907. averaging on transformations
  9908. @end table
  9909. @item maxshift
  9910. Set maximal number of pixels to translate frames. Default value is -1,
  9911. meaning no limit.
  9912. @item maxangle
  9913. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9914. value is -1, meaning no limit.
  9915. @item crop
  9916. Specify how to deal with borders that may be visible due to movement
  9917. compensation.
  9918. Available values are:
  9919. @table @samp
  9920. @item keep
  9921. keep image information from previous frame (default)
  9922. @item black
  9923. fill the border black
  9924. @end table
  9925. @item invert
  9926. Invert transforms if set to 1. Default value is 0.
  9927. @item relative
  9928. Consider transforms as relative to previous frame if set to 1,
  9929. absolute if set to 0. Default value is 0.
  9930. @item zoom
  9931. Set percentage to zoom. A positive value will result in a zoom-in
  9932. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9933. zoom).
  9934. @item optzoom
  9935. Set optimal zooming to avoid borders.
  9936. Accepted values are:
  9937. @table @samp
  9938. @item 0
  9939. disabled
  9940. @item 1
  9941. optimal static zoom value is determined (only very strong movements
  9942. will lead to visible borders) (default)
  9943. @item 2
  9944. optimal adaptive zoom value is determined (no borders will be
  9945. visible), see @option{zoomspeed}
  9946. @end table
  9947. Note that the value given at zoom is added to the one calculated here.
  9948. @item zoomspeed
  9949. Set percent to zoom maximally each frame (enabled when
  9950. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9951. 0.25.
  9952. @item interpol
  9953. Specify type of interpolation.
  9954. Available values are:
  9955. @table @samp
  9956. @item no
  9957. no interpolation
  9958. @item linear
  9959. linear only horizontal
  9960. @item bilinear
  9961. linear in both directions (default)
  9962. @item bicubic
  9963. cubic in both directions (slow)
  9964. @end table
  9965. @item tripod
  9966. Enable virtual tripod mode if set to 1, which is equivalent to
  9967. @code{relative=0:smoothing=0}. Default value is 0.
  9968. Use also @code{tripod} option of @ref{vidstabdetect}.
  9969. @item debug
  9970. Increase log verbosity if set to 1. Also the detected global motions
  9971. are written to the temporary file @file{global_motions.trf}. Default
  9972. value is 0.
  9973. @end table
  9974. @subsection Examples
  9975. @itemize
  9976. @item
  9977. Use @command{ffmpeg} for a typical stabilization with default values:
  9978. @example
  9979. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9980. @end example
  9981. Note the use of the @ref{unsharp} filter which is always recommended.
  9982. @item
  9983. Zoom in a bit more and load transform data from a given file:
  9984. @example
  9985. vidstabtransform=zoom=5:input="mytransforms.trf"
  9986. @end example
  9987. @item
  9988. Smoothen the video even more:
  9989. @example
  9990. vidstabtransform=smoothing=30
  9991. @end example
  9992. @end itemize
  9993. @section vflip
  9994. Flip the input video vertically.
  9995. For example, to vertically flip a video with @command{ffmpeg}:
  9996. @example
  9997. ffmpeg -i in.avi -vf "vflip" out.avi
  9998. @end example
  9999. @anchor{vignette}
  10000. @section vignette
  10001. Make or reverse a natural vignetting effect.
  10002. The filter accepts the following options:
  10003. @table @option
  10004. @item angle, a
  10005. Set lens angle expression as a number of radians.
  10006. The value is clipped in the @code{[0,PI/2]} range.
  10007. Default value: @code{"PI/5"}
  10008. @item x0
  10009. @item y0
  10010. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10011. by default.
  10012. @item mode
  10013. Set forward/backward mode.
  10014. Available modes are:
  10015. @table @samp
  10016. @item forward
  10017. The larger the distance from the central point, the darker the image becomes.
  10018. @item backward
  10019. The larger the distance from the central point, the brighter the image becomes.
  10020. This can be used to reverse a vignette effect, though there is no automatic
  10021. detection to extract the lens @option{angle} and other settings (yet). It can
  10022. also be used to create a burning effect.
  10023. @end table
  10024. Default value is @samp{forward}.
  10025. @item eval
  10026. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10027. It accepts the following values:
  10028. @table @samp
  10029. @item init
  10030. Evaluate expressions only once during the filter initialization.
  10031. @item frame
  10032. Evaluate expressions for each incoming frame. This is way slower than the
  10033. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10034. allows advanced dynamic expressions.
  10035. @end table
  10036. Default value is @samp{init}.
  10037. @item dither
  10038. Set dithering to reduce the circular banding effects. Default is @code{1}
  10039. (enabled).
  10040. @item aspect
  10041. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10042. Setting this value to the SAR of the input will make a rectangular vignetting
  10043. following the dimensions of the video.
  10044. Default is @code{1/1}.
  10045. @end table
  10046. @subsection Expressions
  10047. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10048. following parameters.
  10049. @table @option
  10050. @item w
  10051. @item h
  10052. input width and height
  10053. @item n
  10054. the number of input frame, starting from 0
  10055. @item pts
  10056. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10057. @var{TB} units, NAN if undefined
  10058. @item r
  10059. frame rate of the input video, NAN if the input frame rate is unknown
  10060. @item t
  10061. the PTS (Presentation TimeStamp) of the filtered video frame,
  10062. expressed in seconds, NAN if undefined
  10063. @item tb
  10064. time base of the input video
  10065. @end table
  10066. @subsection Examples
  10067. @itemize
  10068. @item
  10069. Apply simple strong vignetting effect:
  10070. @example
  10071. vignette=PI/4
  10072. @end example
  10073. @item
  10074. Make a flickering vignetting:
  10075. @example
  10076. vignette='PI/4+random(1)*PI/50':eval=frame
  10077. @end example
  10078. @end itemize
  10079. @section vstack
  10080. Stack input videos vertically.
  10081. All streams must be of same pixel format and of same width.
  10082. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10083. to create same output.
  10084. The filter accept the following option:
  10085. @table @option
  10086. @item inputs
  10087. Set number of input streams. Default is 2.
  10088. @item shortest
  10089. If set to 1, force the output to terminate when the shortest input
  10090. terminates. Default value is 0.
  10091. @end table
  10092. @section w3fdif
  10093. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10094. Deinterlacing Filter").
  10095. Based on the process described by Martin Weston for BBC R&D, and
  10096. implemented based on the de-interlace algorithm written by Jim
  10097. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10098. uses filter coefficients calculated by BBC R&D.
  10099. There are two sets of filter coefficients, so called "simple":
  10100. and "complex". Which set of filter coefficients is used can
  10101. be set by passing an optional parameter:
  10102. @table @option
  10103. @item filter
  10104. Set the interlacing filter coefficients. Accepts one of the following values:
  10105. @table @samp
  10106. @item simple
  10107. Simple filter coefficient set.
  10108. @item complex
  10109. More-complex filter coefficient set.
  10110. @end table
  10111. Default value is @samp{complex}.
  10112. @item deint
  10113. Specify which frames to deinterlace. Accept one of the following values:
  10114. @table @samp
  10115. @item all
  10116. Deinterlace all frames,
  10117. @item interlaced
  10118. Only deinterlace frames marked as interlaced.
  10119. @end table
  10120. Default value is @samp{all}.
  10121. @end table
  10122. @section waveform
  10123. Video waveform monitor.
  10124. The waveform monitor plots color component intensity. By default luminance
  10125. only. Each column of the waveform corresponds to a column of pixels in the
  10126. source video.
  10127. It accepts the following options:
  10128. @table @option
  10129. @item mode, m
  10130. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10131. In row mode, the graph on the left side represents color component value 0 and
  10132. the right side represents value = 255. In column mode, the top side represents
  10133. color component value = 0 and bottom side represents value = 255.
  10134. @item intensity, i
  10135. Set intensity. Smaller values are useful to find out how many values of the same
  10136. luminance are distributed across input rows/columns.
  10137. Default value is @code{0.04}. Allowed range is [0, 1].
  10138. @item mirror, r
  10139. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10140. In mirrored mode, higher values will be represented on the left
  10141. side for @code{row} mode and at the top for @code{column} mode. Default is
  10142. @code{1} (mirrored).
  10143. @item display, d
  10144. Set display mode.
  10145. It accepts the following values:
  10146. @table @samp
  10147. @item overlay
  10148. Presents information identical to that in the @code{parade}, except
  10149. that the graphs representing color components are superimposed directly
  10150. over one another.
  10151. This display mode makes it easier to spot relative differences or similarities
  10152. in overlapping areas of the color components that are supposed to be identical,
  10153. such as neutral whites, grays, or blacks.
  10154. @item stack
  10155. Display separate graph for the color components side by side in
  10156. @code{row} mode or one below the other in @code{column} mode.
  10157. @item parade
  10158. Display separate graph for the color components side by side in
  10159. @code{column} mode or one below the other in @code{row} mode.
  10160. Using this display mode makes it easy to spot color casts in the highlights
  10161. and shadows of an image, by comparing the contours of the top and the bottom
  10162. graphs of each waveform. Since whites, grays, and blacks are characterized
  10163. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10164. should display three waveforms of roughly equal width/height. If not, the
  10165. correction is easy to perform by making level adjustments the three waveforms.
  10166. @end table
  10167. Default is @code{stack}.
  10168. @item components, c
  10169. Set which color components to display. Default is 1, which means only luminance
  10170. or red color component if input is in RGB colorspace. If is set for example to
  10171. 7 it will display all 3 (if) available color components.
  10172. @item envelope, e
  10173. @table @samp
  10174. @item none
  10175. No envelope, this is default.
  10176. @item instant
  10177. Instant envelope, minimum and maximum values presented in graph will be easily
  10178. visible even with small @code{step} value.
  10179. @item peak
  10180. Hold minimum and maximum values presented in graph across time. This way you
  10181. can still spot out of range values without constantly looking at waveforms.
  10182. @item peak+instant
  10183. Peak and instant envelope combined together.
  10184. @end table
  10185. @item filter, f
  10186. @table @samp
  10187. @item lowpass
  10188. No filtering, this is default.
  10189. @item flat
  10190. Luma and chroma combined together.
  10191. @item aflat
  10192. Similar as above, but shows difference between blue and red chroma.
  10193. @item chroma
  10194. Displays only chroma.
  10195. @item color
  10196. Displays actual color value on waveform.
  10197. @item acolor
  10198. Similar as above, but with luma showing frequency of chroma values.
  10199. @end table
  10200. @item graticule, g
  10201. Set which graticule to display.
  10202. @table @samp
  10203. @item none
  10204. Do not display graticule.
  10205. @item green
  10206. Display green graticule showing legal broadcast ranges.
  10207. @end table
  10208. @item opacity, o
  10209. Set graticule opacity.
  10210. @item flags, fl
  10211. Set graticule flags.
  10212. @table @samp
  10213. @item numbers
  10214. Draw numbers above lines. By default enabled.
  10215. @item dots
  10216. Draw dots instead of lines.
  10217. @end table
  10218. @item scale, s
  10219. Set scale used for displaying graticule.
  10220. @table @samp
  10221. @item digital
  10222. @item millivolts
  10223. @item ire
  10224. @end table
  10225. Default is digital.
  10226. @end table
  10227. @section xbr
  10228. Apply the xBR high-quality magnification filter which is designed for pixel
  10229. art. It follows a set of edge-detection rules, see
  10230. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10231. It accepts the following option:
  10232. @table @option
  10233. @item n
  10234. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10235. @code{3xBR} and @code{4} for @code{4xBR}.
  10236. Default is @code{3}.
  10237. @end table
  10238. @anchor{yadif}
  10239. @section yadif
  10240. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10241. filter").
  10242. It accepts the following parameters:
  10243. @table @option
  10244. @item mode
  10245. The interlacing mode to adopt. It accepts one of the following values:
  10246. @table @option
  10247. @item 0, send_frame
  10248. Output one frame for each frame.
  10249. @item 1, send_field
  10250. Output one frame for each field.
  10251. @item 2, send_frame_nospatial
  10252. Like @code{send_frame}, but it skips the spatial interlacing check.
  10253. @item 3, send_field_nospatial
  10254. Like @code{send_field}, but it skips the spatial interlacing check.
  10255. @end table
  10256. The default value is @code{send_frame}.
  10257. @item parity
  10258. The picture field parity assumed for the input interlaced video. It accepts one
  10259. of the following values:
  10260. @table @option
  10261. @item 0, tff
  10262. Assume the top field is first.
  10263. @item 1, bff
  10264. Assume the bottom field is first.
  10265. @item -1, auto
  10266. Enable automatic detection of field parity.
  10267. @end table
  10268. The default value is @code{auto}.
  10269. If the interlacing is unknown or the decoder does not export this information,
  10270. top field first will be assumed.
  10271. @item deint
  10272. Specify which frames to deinterlace. Accept one of the following
  10273. values:
  10274. @table @option
  10275. @item 0, all
  10276. Deinterlace all frames.
  10277. @item 1, interlaced
  10278. Only deinterlace frames marked as interlaced.
  10279. @end table
  10280. The default value is @code{all}.
  10281. @end table
  10282. @section zoompan
  10283. Apply Zoom & Pan effect.
  10284. This filter accepts the following options:
  10285. @table @option
  10286. @item zoom, z
  10287. Set the zoom expression. Default is 1.
  10288. @item x
  10289. @item y
  10290. Set the x and y expression. Default is 0.
  10291. @item d
  10292. Set the duration expression in number of frames.
  10293. This sets for how many number of frames effect will last for
  10294. single input image.
  10295. @item s
  10296. Set the output image size, default is 'hd720'.
  10297. @item fps
  10298. Set the output frame rate, default is '25'.
  10299. @end table
  10300. Each expression can contain the following constants:
  10301. @table @option
  10302. @item in_w, iw
  10303. Input width.
  10304. @item in_h, ih
  10305. Input height.
  10306. @item out_w, ow
  10307. Output width.
  10308. @item out_h, oh
  10309. Output height.
  10310. @item in
  10311. Input frame count.
  10312. @item on
  10313. Output frame count.
  10314. @item x
  10315. @item y
  10316. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10317. for current input frame.
  10318. @item px
  10319. @item py
  10320. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10321. not yet such frame (first input frame).
  10322. @item zoom
  10323. Last calculated zoom from 'z' expression for current input frame.
  10324. @item pzoom
  10325. Last calculated zoom of last output frame of previous input frame.
  10326. @item duration
  10327. Number of output frames for current input frame. Calculated from 'd' expression
  10328. for each input frame.
  10329. @item pduration
  10330. number of output frames created for previous input frame
  10331. @item a
  10332. Rational number: input width / input height
  10333. @item sar
  10334. sample aspect ratio
  10335. @item dar
  10336. display aspect ratio
  10337. @end table
  10338. @subsection Examples
  10339. @itemize
  10340. @item
  10341. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10342. @example
  10343. 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
  10344. @end example
  10345. @item
  10346. Zoom-in up to 1.5 and pan always at center of picture:
  10347. @example
  10348. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10349. @end example
  10350. @end itemize
  10351. @section zscale
  10352. Scale (resize) the input video, using the z.lib library:
  10353. https://github.com/sekrit-twc/zimg.
  10354. The zscale filter forces the output display aspect ratio to be the same
  10355. as the input, by changing the output sample aspect ratio.
  10356. If the input image format is different from the format requested by
  10357. the next filter, the zscale filter will convert the input to the
  10358. requested format.
  10359. @subsection Options
  10360. The filter accepts the following options.
  10361. @table @option
  10362. @item width, w
  10363. @item height, h
  10364. Set the output video dimension expression. Default value is the input
  10365. dimension.
  10366. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10367. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10368. If one of the values is -1, the zscale filter will use a value that
  10369. maintains the aspect ratio of the input image, calculated from the
  10370. other specified dimension. If both of them are -1, the input size is
  10371. used
  10372. If one of the values is -n with n > 1, the zscale filter will also use a value
  10373. that maintains the aspect ratio of the input image, calculated from the other
  10374. specified dimension. After that it will, however, make sure that the calculated
  10375. dimension is divisible by n and adjust the value if necessary.
  10376. See below for the list of accepted constants for use in the dimension
  10377. expression.
  10378. @item size, s
  10379. Set the video size. For the syntax of this option, check the
  10380. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10381. @item dither, d
  10382. Set the dither type.
  10383. Possible values are:
  10384. @table @var
  10385. @item none
  10386. @item ordered
  10387. @item random
  10388. @item error_diffusion
  10389. @end table
  10390. Default is none.
  10391. @item filter, f
  10392. Set the resize filter type.
  10393. Possible values are:
  10394. @table @var
  10395. @item point
  10396. @item bilinear
  10397. @item bicubic
  10398. @item spline16
  10399. @item spline36
  10400. @item lanczos
  10401. @end table
  10402. Default is bilinear.
  10403. @item range, r
  10404. Set the color range.
  10405. Possible values are:
  10406. @table @var
  10407. @item input
  10408. @item limited
  10409. @item full
  10410. @end table
  10411. Default is same as input.
  10412. @item primaries, p
  10413. Set the color primaries.
  10414. Possible values are:
  10415. @table @var
  10416. @item input
  10417. @item 709
  10418. @item unspecified
  10419. @item 170m
  10420. @item 240m
  10421. @item 2020
  10422. @end table
  10423. Default is same as input.
  10424. @item transfer, t
  10425. Set the transfer characteristics.
  10426. Possible values are:
  10427. @table @var
  10428. @item input
  10429. @item 709
  10430. @item unspecified
  10431. @item 601
  10432. @item linear
  10433. @item 2020_10
  10434. @item 2020_12
  10435. @end table
  10436. Default is same as input.
  10437. @item matrix, m
  10438. Set the colorspace matrix.
  10439. Possible value are:
  10440. @table @var
  10441. @item input
  10442. @item 709
  10443. @item unspecified
  10444. @item 470bg
  10445. @item 170m
  10446. @item 2020_ncl
  10447. @item 2020_cl
  10448. @end table
  10449. Default is same as input.
  10450. @item rangein, rin
  10451. Set the input color range.
  10452. Possible values are:
  10453. @table @var
  10454. @item input
  10455. @item limited
  10456. @item full
  10457. @end table
  10458. Default is same as input.
  10459. @item primariesin, pin
  10460. Set the input color primaries.
  10461. Possible values are:
  10462. @table @var
  10463. @item input
  10464. @item 709
  10465. @item unspecified
  10466. @item 170m
  10467. @item 240m
  10468. @item 2020
  10469. @end table
  10470. Default is same as input.
  10471. @item transferin, tin
  10472. Set the input transfer characteristics.
  10473. Possible values are:
  10474. @table @var
  10475. @item input
  10476. @item 709
  10477. @item unspecified
  10478. @item 601
  10479. @item linear
  10480. @item 2020_10
  10481. @item 2020_12
  10482. @end table
  10483. Default is same as input.
  10484. @item matrixin, min
  10485. Set the input colorspace matrix.
  10486. Possible value are:
  10487. @table @var
  10488. @item input
  10489. @item 709
  10490. @item unspecified
  10491. @item 470bg
  10492. @item 170m
  10493. @item 2020_ncl
  10494. @item 2020_cl
  10495. @end table
  10496. @end table
  10497. The values of the @option{w} and @option{h} options are expressions
  10498. containing the following constants:
  10499. @table @var
  10500. @item in_w
  10501. @item in_h
  10502. The input width and height
  10503. @item iw
  10504. @item ih
  10505. These are the same as @var{in_w} and @var{in_h}.
  10506. @item out_w
  10507. @item out_h
  10508. The output (scaled) width and height
  10509. @item ow
  10510. @item oh
  10511. These are the same as @var{out_w} and @var{out_h}
  10512. @item a
  10513. The same as @var{iw} / @var{ih}
  10514. @item sar
  10515. input sample aspect ratio
  10516. @item dar
  10517. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10518. @item hsub
  10519. @item vsub
  10520. horizontal and vertical input chroma subsample values. For example for the
  10521. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10522. @item ohsub
  10523. @item ovsub
  10524. horizontal and vertical output chroma subsample values. For example for the
  10525. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10526. @end table
  10527. @table @option
  10528. @end table
  10529. @c man end VIDEO FILTERS
  10530. @chapter Video Sources
  10531. @c man begin VIDEO SOURCES
  10532. Below is a description of the currently available video sources.
  10533. @section buffer
  10534. Buffer video frames, and make them available to the filter chain.
  10535. This source is mainly intended for a programmatic use, in particular
  10536. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10537. It accepts the following parameters:
  10538. @table @option
  10539. @item video_size
  10540. Specify the size (width and height) of the buffered video frames. For the
  10541. syntax of this option, check the
  10542. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10543. @item width
  10544. The input video width.
  10545. @item height
  10546. The input video height.
  10547. @item pix_fmt
  10548. A string representing the pixel format of the buffered video frames.
  10549. It may be a number corresponding to a pixel format, or a pixel format
  10550. name.
  10551. @item time_base
  10552. Specify the timebase assumed by the timestamps of the buffered frames.
  10553. @item frame_rate
  10554. Specify the frame rate expected for the video stream.
  10555. @item pixel_aspect, sar
  10556. The sample (pixel) aspect ratio of the input video.
  10557. @item sws_param
  10558. Specify the optional parameters to be used for the scale filter which
  10559. is automatically inserted when an input change is detected in the
  10560. input size or format.
  10561. @item hw_frames_ctx
  10562. When using a hardware pixel format, this should be a reference to an
  10563. AVHWFramesContext describing input frames.
  10564. @end table
  10565. For example:
  10566. @example
  10567. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10568. @end example
  10569. will instruct the source to accept video frames with size 320x240 and
  10570. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10571. square pixels (1:1 sample aspect ratio).
  10572. Since the pixel format with name "yuv410p" corresponds to the number 6
  10573. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10574. this example corresponds to:
  10575. @example
  10576. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10577. @end example
  10578. Alternatively, the options can be specified as a flat string, but this
  10579. syntax is deprecated:
  10580. @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}]
  10581. @section cellauto
  10582. Create a pattern generated by an elementary cellular automaton.
  10583. The initial state of the cellular automaton can be defined through the
  10584. @option{filename}, and @option{pattern} options. If such options are
  10585. not specified an initial state is created randomly.
  10586. At each new frame a new row in the video is filled with the result of
  10587. the cellular automaton next generation. The behavior when the whole
  10588. frame is filled is defined by the @option{scroll} option.
  10589. This source accepts the following options:
  10590. @table @option
  10591. @item filename, f
  10592. Read the initial cellular automaton state, i.e. the starting row, from
  10593. the specified file.
  10594. In the file, each non-whitespace character is considered an alive
  10595. cell, a newline will terminate the row, and further characters in the
  10596. file will be ignored.
  10597. @item pattern, p
  10598. Read the initial cellular automaton state, i.e. the starting row, from
  10599. the specified string.
  10600. Each non-whitespace character in the string is considered an alive
  10601. cell, a newline will terminate the row, and further characters in the
  10602. string will be ignored.
  10603. @item rate, r
  10604. Set the video rate, that is the number of frames generated per second.
  10605. Default is 25.
  10606. @item random_fill_ratio, ratio
  10607. Set the random fill ratio for the initial cellular automaton row. It
  10608. is a floating point number value ranging from 0 to 1, defaults to
  10609. 1/PHI.
  10610. This option is ignored when a file or a pattern is specified.
  10611. @item random_seed, seed
  10612. Set the seed for filling randomly the initial row, must be an integer
  10613. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10614. set to -1, the filter will try to use a good random seed on a best
  10615. effort basis.
  10616. @item rule
  10617. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10618. Default value is 110.
  10619. @item size, s
  10620. Set the size of the output video. For the syntax of this option, check the
  10621. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10622. If @option{filename} or @option{pattern} is specified, the size is set
  10623. by default to the width of the specified initial state row, and the
  10624. height is set to @var{width} * PHI.
  10625. If @option{size} is set, it must contain the width of the specified
  10626. pattern string, and the specified pattern will be centered in the
  10627. larger row.
  10628. If a filename or a pattern string is not specified, the size value
  10629. defaults to "320x518" (used for a randomly generated initial state).
  10630. @item scroll
  10631. If set to 1, scroll the output upward when all the rows in the output
  10632. have been already filled. If set to 0, the new generated row will be
  10633. written over the top row just after the bottom row is filled.
  10634. Defaults to 1.
  10635. @item start_full, full
  10636. If set to 1, completely fill the output with generated rows before
  10637. outputting the first frame.
  10638. This is the default behavior, for disabling set the value to 0.
  10639. @item stitch
  10640. If set to 1, stitch the left and right row edges together.
  10641. This is the default behavior, for disabling set the value to 0.
  10642. @end table
  10643. @subsection Examples
  10644. @itemize
  10645. @item
  10646. Read the initial state from @file{pattern}, and specify an output of
  10647. size 200x400.
  10648. @example
  10649. cellauto=f=pattern:s=200x400
  10650. @end example
  10651. @item
  10652. Generate a random initial row with a width of 200 cells, with a fill
  10653. ratio of 2/3:
  10654. @example
  10655. cellauto=ratio=2/3:s=200x200
  10656. @end example
  10657. @item
  10658. Create a pattern generated by rule 18 starting by a single alive cell
  10659. centered on an initial row with width 100:
  10660. @example
  10661. cellauto=p=@@:s=100x400:full=0:rule=18
  10662. @end example
  10663. @item
  10664. Specify a more elaborated initial pattern:
  10665. @example
  10666. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10667. @end example
  10668. @end itemize
  10669. @anchor{coreimagesrc}
  10670. @section coreimagesrc
  10671. Video source generated on GPU using Apple's CoreImage API on OSX.
  10672. This video source is a specialized version of the @ref{coreimage} video filter.
  10673. Use a core image generator at the beginning of the applied filterchain to
  10674. generate the content.
  10675. The coreimagesrc video source accepts the following options:
  10676. @table @option
  10677. @item list_generators
  10678. List all available generators along with all their respective options as well as
  10679. possible minimum and maximum values along with the default values.
  10680. @example
  10681. list_generators=true
  10682. @end example
  10683. @item size, s
  10684. Specify the size of the sourced video. For the syntax of this option, check the
  10685. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10686. The default value is @code{320x240}.
  10687. @item rate, r
  10688. Specify the frame rate of the sourced video, as the number of frames
  10689. generated per second. It has to be a string in the format
  10690. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10691. number or a valid video frame rate abbreviation. The default value is
  10692. "25".
  10693. @item sar
  10694. Set the sample aspect ratio of the sourced video.
  10695. @item duration, d
  10696. Set the duration of the sourced video. See
  10697. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10698. for the accepted syntax.
  10699. If not specified, or the expressed duration is negative, the video is
  10700. supposed to be generated forever.
  10701. @end table
  10702. Additionally, all options of the @ref{coreimage} video filter are accepted.
  10703. A complete filterchain can be used for further processing of the
  10704. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  10705. and examples for details.
  10706. @subsection Examples
  10707. @itemize
  10708. @item
  10709. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  10710. given as complete and escaped command-line for Apple's standard bash shell:
  10711. @example
  10712. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  10713. @end example
  10714. This example is equivalent to the QRCode example of @ref{coreimage} without the
  10715. need for a nullsrc video source.
  10716. @end itemize
  10717. @section mandelbrot
  10718. Generate a Mandelbrot set fractal, and progressively zoom towards the
  10719. point specified with @var{start_x} and @var{start_y}.
  10720. This source accepts the following options:
  10721. @table @option
  10722. @item end_pts
  10723. Set the terminal pts value. Default value is 400.
  10724. @item end_scale
  10725. Set the terminal scale value.
  10726. Must be a floating point value. Default value is 0.3.
  10727. @item inner
  10728. Set the inner coloring mode, that is the algorithm used to draw the
  10729. Mandelbrot fractal internal region.
  10730. It shall assume one of the following values:
  10731. @table @option
  10732. @item black
  10733. Set black mode.
  10734. @item convergence
  10735. Show time until convergence.
  10736. @item mincol
  10737. Set color based on point closest to the origin of the iterations.
  10738. @item period
  10739. Set period mode.
  10740. @end table
  10741. Default value is @var{mincol}.
  10742. @item bailout
  10743. Set the bailout value. Default value is 10.0.
  10744. @item maxiter
  10745. Set the maximum of iterations performed by the rendering
  10746. algorithm. Default value is 7189.
  10747. @item outer
  10748. Set outer coloring mode.
  10749. It shall assume one of following values:
  10750. @table @option
  10751. @item iteration_count
  10752. Set iteration cound mode.
  10753. @item normalized_iteration_count
  10754. set normalized iteration count mode.
  10755. @end table
  10756. Default value is @var{normalized_iteration_count}.
  10757. @item rate, r
  10758. Set frame rate, expressed as number of frames per second. Default
  10759. value is "25".
  10760. @item size, s
  10761. Set frame size. For the syntax of this option, check the "Video
  10762. size" section in the ffmpeg-utils manual. Default value is "640x480".
  10763. @item start_scale
  10764. Set the initial scale value. Default value is 3.0.
  10765. @item start_x
  10766. Set the initial x position. Must be a floating point value between
  10767. -100 and 100. Default value is -0.743643887037158704752191506114774.
  10768. @item start_y
  10769. Set the initial y position. Must be a floating point value between
  10770. -100 and 100. Default value is -0.131825904205311970493132056385139.
  10771. @end table
  10772. @section mptestsrc
  10773. Generate various test patterns, as generated by the MPlayer test filter.
  10774. The size of the generated video is fixed, and is 256x256.
  10775. This source is useful in particular for testing encoding features.
  10776. This source accepts the following options:
  10777. @table @option
  10778. @item rate, r
  10779. Specify the frame rate of the sourced video, as the number of frames
  10780. generated per second. It has to be a string in the format
  10781. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10782. number or a valid video frame rate abbreviation. The default value is
  10783. "25".
  10784. @item duration, d
  10785. Set the duration of the sourced video. See
  10786. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10787. for the accepted syntax.
  10788. If not specified, or the expressed duration is negative, the video is
  10789. supposed to be generated forever.
  10790. @item test, t
  10791. Set the number or the name of the test to perform. Supported tests are:
  10792. @table @option
  10793. @item dc_luma
  10794. @item dc_chroma
  10795. @item freq_luma
  10796. @item freq_chroma
  10797. @item amp_luma
  10798. @item amp_chroma
  10799. @item cbp
  10800. @item mv
  10801. @item ring1
  10802. @item ring2
  10803. @item all
  10804. @end table
  10805. Default value is "all", which will cycle through the list of all tests.
  10806. @end table
  10807. Some examples:
  10808. @example
  10809. mptestsrc=t=dc_luma
  10810. @end example
  10811. will generate a "dc_luma" test pattern.
  10812. @section frei0r_src
  10813. Provide a frei0r source.
  10814. To enable compilation of this filter you need to install the frei0r
  10815. header and configure FFmpeg with @code{--enable-frei0r}.
  10816. This source accepts the following parameters:
  10817. @table @option
  10818. @item size
  10819. The size of the video to generate. For the syntax of this option, check the
  10820. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10821. @item framerate
  10822. The framerate of the generated video. It may be a string of the form
  10823. @var{num}/@var{den} or a frame rate abbreviation.
  10824. @item filter_name
  10825. The name to the frei0r source to load. For more information regarding frei0r and
  10826. how to set the parameters, read the @ref{frei0r} section in the video filters
  10827. documentation.
  10828. @item filter_params
  10829. A '|'-separated list of parameters to pass to the frei0r source.
  10830. @end table
  10831. For example, to generate a frei0r partik0l source with size 200x200
  10832. and frame rate 10 which is overlaid on the overlay filter main input:
  10833. @example
  10834. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  10835. @end example
  10836. @section life
  10837. Generate a life pattern.
  10838. This source is based on a generalization of John Conway's life game.
  10839. The sourced input represents a life grid, each pixel represents a cell
  10840. which can be in one of two possible states, alive or dead. Every cell
  10841. interacts with its eight neighbours, which are the cells that are
  10842. horizontally, vertically, or diagonally adjacent.
  10843. At each interaction the grid evolves according to the adopted rule,
  10844. which specifies the number of neighbor alive cells which will make a
  10845. cell stay alive or born. The @option{rule} option allows one to specify
  10846. the rule to adopt.
  10847. This source accepts the following options:
  10848. @table @option
  10849. @item filename, f
  10850. Set the file from which to read the initial grid state. In the file,
  10851. each non-whitespace character is considered an alive cell, and newline
  10852. is used to delimit the end of each row.
  10853. If this option is not specified, the initial grid is generated
  10854. randomly.
  10855. @item rate, r
  10856. Set the video rate, that is the number of frames generated per second.
  10857. Default is 25.
  10858. @item random_fill_ratio, ratio
  10859. Set the random fill ratio for the initial random grid. It is a
  10860. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  10861. It is ignored when a file is specified.
  10862. @item random_seed, seed
  10863. Set the seed for filling the initial random grid, must be an integer
  10864. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10865. set to -1, the filter will try to use a good random seed on a best
  10866. effort basis.
  10867. @item rule
  10868. Set the life rule.
  10869. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  10870. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  10871. @var{NS} specifies the number of alive neighbor cells which make a
  10872. live cell stay alive, and @var{NB} the number of alive neighbor cells
  10873. which make a dead cell to become alive (i.e. to "born").
  10874. "s" and "b" can be used in place of "S" and "B", respectively.
  10875. Alternatively a rule can be specified by an 18-bits integer. The 9
  10876. high order bits are used to encode the next cell state if it is alive
  10877. for each number of neighbor alive cells, the low order bits specify
  10878. the rule for "borning" new cells. Higher order bits encode for an
  10879. higher number of neighbor cells.
  10880. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  10881. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  10882. Default value is "S23/B3", which is the original Conway's game of life
  10883. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  10884. cells, and will born a new cell if there are three alive cells around
  10885. a dead cell.
  10886. @item size, s
  10887. Set the size of the output video. For the syntax of this option, check the
  10888. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10889. If @option{filename} is specified, the size is set by default to the
  10890. same size of the input file. If @option{size} is set, it must contain
  10891. the size specified in the input file, and the initial grid defined in
  10892. that file is centered in the larger resulting area.
  10893. If a filename is not specified, the size value defaults to "320x240"
  10894. (used for a randomly generated initial grid).
  10895. @item stitch
  10896. If set to 1, stitch the left and right grid edges together, and the
  10897. top and bottom edges also. Defaults to 1.
  10898. @item mold
  10899. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10900. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10901. value from 0 to 255.
  10902. @item life_color
  10903. Set the color of living (or new born) cells.
  10904. @item death_color
  10905. Set the color of dead cells. If @option{mold} is set, this is the first color
  10906. used to represent a dead cell.
  10907. @item mold_color
  10908. Set mold color, for definitely dead and moldy cells.
  10909. For the syntax of these 3 color options, check the "Color" section in the
  10910. ffmpeg-utils manual.
  10911. @end table
  10912. @subsection Examples
  10913. @itemize
  10914. @item
  10915. Read a grid from @file{pattern}, and center it on a grid of size
  10916. 300x300 pixels:
  10917. @example
  10918. life=f=pattern:s=300x300
  10919. @end example
  10920. @item
  10921. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10922. @example
  10923. life=ratio=2/3:s=200x200
  10924. @end example
  10925. @item
  10926. Specify a custom rule for evolving a randomly generated grid:
  10927. @example
  10928. life=rule=S14/B34
  10929. @end example
  10930. @item
  10931. Full example with slow death effect (mold) using @command{ffplay}:
  10932. @example
  10933. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10934. @end example
  10935. @end itemize
  10936. @anchor{allrgb}
  10937. @anchor{allyuv}
  10938. @anchor{color}
  10939. @anchor{haldclutsrc}
  10940. @anchor{nullsrc}
  10941. @anchor{rgbtestsrc}
  10942. @anchor{smptebars}
  10943. @anchor{smptehdbars}
  10944. @anchor{testsrc}
  10945. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  10946. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10947. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10948. The @code{color} source provides an uniformly colored input.
  10949. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10950. @ref{haldclut} filter.
  10951. The @code{nullsrc} source returns unprocessed video frames. It is
  10952. mainly useful to be employed in analysis / debugging tools, or as the
  10953. source for filters which ignore the input data.
  10954. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  10955. detecting RGB vs BGR issues. You should see a red, green and blue
  10956. stripe from top to bottom.
  10957. The @code{smptebars} source generates a color bars pattern, based on
  10958. the SMPTE Engineering Guideline EG 1-1990.
  10959. The @code{smptehdbars} source generates a color bars pattern, based on
  10960. the SMPTE RP 219-2002.
  10961. The @code{testsrc} source generates a test video pattern, showing a
  10962. color pattern, a scrolling gradient and a timestamp. This is mainly
  10963. intended for testing purposes.
  10964. The sources accept the following parameters:
  10965. @table @option
  10966. @item color, c
  10967. Specify the color of the source, only available in the @code{color}
  10968. source. For the syntax of this option, check the "Color" section in the
  10969. ffmpeg-utils manual.
  10970. @item level
  10971. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  10972. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  10973. pixels to be used as identity matrix for 3D lookup tables. Each component is
  10974. coded on a @code{1/(N*N)} scale.
  10975. @item size, s
  10976. Specify the size of the sourced video. For the syntax of this option, check the
  10977. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10978. The default value is @code{320x240}.
  10979. This option is not available with the @code{haldclutsrc} filter.
  10980. @item rate, r
  10981. Specify the frame rate of the sourced video, as the number of frames
  10982. generated per second. It has to be a string in the format
  10983. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10984. number or a valid video frame rate abbreviation. The default value is
  10985. "25".
  10986. @item sar
  10987. Set the sample aspect ratio of the sourced video.
  10988. @item duration, d
  10989. Set the duration of the sourced video. See
  10990. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10991. for the accepted syntax.
  10992. If not specified, or the expressed duration is negative, the video is
  10993. supposed to be generated forever.
  10994. @item decimals, n
  10995. Set the number of decimals to show in the timestamp, only available in the
  10996. @code{testsrc} source.
  10997. The displayed timestamp value will correspond to the original
  10998. timestamp value multiplied by the power of 10 of the specified
  10999. value. Default value is 0.
  11000. @end table
  11001. For example the following:
  11002. @example
  11003. testsrc=duration=5.3:size=qcif:rate=10
  11004. @end example
  11005. will generate a video with a duration of 5.3 seconds, with size
  11006. 176x144 and a frame rate of 10 frames per second.
  11007. The following graph description will generate a red source
  11008. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11009. frames per second.
  11010. @example
  11011. color=c=red@@0.2:s=qcif:r=10
  11012. @end example
  11013. If the input content is to be ignored, @code{nullsrc} can be used. The
  11014. following command generates noise in the luminance plane by employing
  11015. the @code{geq} filter:
  11016. @example
  11017. nullsrc=s=256x256, geq=random(1)*255:128:128
  11018. @end example
  11019. @subsection Commands
  11020. The @code{color} source supports the following commands:
  11021. @table @option
  11022. @item c, color
  11023. Set the color of the created image. Accepts the same syntax of the
  11024. corresponding @option{color} option.
  11025. @end table
  11026. @c man end VIDEO SOURCES
  11027. @chapter Video Sinks
  11028. @c man begin VIDEO SINKS
  11029. Below is a description of the currently available video sinks.
  11030. @section buffersink
  11031. Buffer video frames, and make them available to the end of the filter
  11032. graph.
  11033. This sink is mainly intended for programmatic use, in particular
  11034. through the interface defined in @file{libavfilter/buffersink.h}
  11035. or the options system.
  11036. It accepts a pointer to an AVBufferSinkContext structure, which
  11037. defines the incoming buffers' formats, to be passed as the opaque
  11038. parameter to @code{avfilter_init_filter} for initialization.
  11039. @section nullsink
  11040. Null video sink: do absolutely nothing with the input video. It is
  11041. mainly useful as a template and for use in analysis / debugging
  11042. tools.
  11043. @c man end VIDEO SINKS
  11044. @chapter Multimedia Filters
  11045. @c man begin MULTIMEDIA FILTERS
  11046. Below is a description of the currently available multimedia filters.
  11047. @section ahistogram
  11048. Convert input audio to a video output, displaying the volume histogram.
  11049. The filter accepts the following options:
  11050. @table @option
  11051. @item dmode
  11052. Specify how histogram is calculated.
  11053. It accepts the following values:
  11054. @table @samp
  11055. @item single
  11056. Use single histogram for all channels.
  11057. @item separate
  11058. Use separate histogram for each channel.
  11059. @end table
  11060. Default is @code{single}.
  11061. @item rate, r
  11062. Set frame rate, expressed as number of frames per second. Default
  11063. value is "25".
  11064. @item size, s
  11065. Specify the video size for the output. For the syntax of this option, check the
  11066. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11067. Default value is @code{hd720}.
  11068. @item scale
  11069. Set display scale.
  11070. It accepts the following values:
  11071. @table @samp
  11072. @item log
  11073. logarithmic
  11074. @item sqrt
  11075. square root
  11076. @item cbrt
  11077. cubic root
  11078. @item lin
  11079. linear
  11080. @item rlog
  11081. reverse logarithmic
  11082. @end table
  11083. Default is @code{log}.
  11084. @item ascale
  11085. Set amplitude scale.
  11086. It accepts the following values:
  11087. @table @samp
  11088. @item log
  11089. logarithmic
  11090. @item lin
  11091. linear
  11092. @end table
  11093. Default is @code{log}.
  11094. @item acount
  11095. Set how much frames to accumulate in histogram.
  11096. Defauls is 1. Setting this to -1 accumulates all frames.
  11097. @item rheight
  11098. Set histogram ratio of window height.
  11099. @item slide
  11100. Set sonogram sliding.
  11101. It accepts the following values:
  11102. @table @samp
  11103. @item replace
  11104. replace old rows with new ones.
  11105. @item scroll
  11106. scroll from top to bottom.
  11107. @end table
  11108. Default is @code{replace}.
  11109. @end table
  11110. @section aphasemeter
  11111. Convert input audio to a video output, displaying the audio phase.
  11112. The filter accepts the following options:
  11113. @table @option
  11114. @item rate, r
  11115. Set the output frame rate. Default value is @code{25}.
  11116. @item size, s
  11117. Set the video size for the output. For the syntax of this option, check the
  11118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11119. Default value is @code{800x400}.
  11120. @item rc
  11121. @item gc
  11122. @item bc
  11123. Specify the red, green, blue contrast. Default values are @code{2},
  11124. @code{7} and @code{1}.
  11125. Allowed range is @code{[0, 255]}.
  11126. @item mpc
  11127. Set color which will be used for drawing median phase. If color is
  11128. @code{none} which is default, no median phase value will be drawn.
  11129. @end table
  11130. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11131. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11132. The @code{-1} means left and right channels are completely out of phase and
  11133. @code{1} means channels are in phase.
  11134. @section avectorscope
  11135. Convert input audio to a video output, representing the audio vector
  11136. scope.
  11137. The filter is used to measure the difference between channels of stereo
  11138. audio stream. A monoaural signal, consisting of identical left and right
  11139. signal, results in straight vertical line. Any stereo separation is visible
  11140. as a deviation from this line, creating a Lissajous figure.
  11141. If the straight (or deviation from it) but horizontal line appears this
  11142. indicates that the left and right channels are out of phase.
  11143. The filter accepts the following options:
  11144. @table @option
  11145. @item mode, m
  11146. Set the vectorscope mode.
  11147. Available values are:
  11148. @table @samp
  11149. @item lissajous
  11150. Lissajous rotated by 45 degrees.
  11151. @item lissajous_xy
  11152. Same as above but not rotated.
  11153. @item polar
  11154. Shape resembling half of circle.
  11155. @end table
  11156. Default value is @samp{lissajous}.
  11157. @item size, s
  11158. Set the video size for the output. For the syntax of this option, check the
  11159. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11160. Default value is @code{400x400}.
  11161. @item rate, r
  11162. Set the output frame rate. Default value is @code{25}.
  11163. @item rc
  11164. @item gc
  11165. @item bc
  11166. @item ac
  11167. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11168. @code{160}, @code{80} and @code{255}.
  11169. Allowed range is @code{[0, 255]}.
  11170. @item rf
  11171. @item gf
  11172. @item bf
  11173. @item af
  11174. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11175. @code{10}, @code{5} and @code{5}.
  11176. Allowed range is @code{[0, 255]}.
  11177. @item zoom
  11178. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11179. @item draw
  11180. Set the vectorscope drawing mode.
  11181. Available values are:
  11182. @table @samp
  11183. @item dot
  11184. Draw dot for each sample.
  11185. @item line
  11186. Draw line between previous and current sample.
  11187. @end table
  11188. Default value is @samp{dot}.
  11189. @end table
  11190. @subsection Examples
  11191. @itemize
  11192. @item
  11193. Complete example using @command{ffplay}:
  11194. @example
  11195. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11196. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11197. @end example
  11198. @end itemize
  11199. @section bench, abench
  11200. Benchmark part of a filtergraph.
  11201. The filter accepts the following options:
  11202. @table @option
  11203. @item action
  11204. Start or stop a timer.
  11205. Available values are:
  11206. @table @samp
  11207. @item start
  11208. Get the current time, set it as frame metadata (using the key
  11209. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11210. @item stop
  11211. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11212. the input frame metadata to get the time difference. Time difference, average,
  11213. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11214. @code{min}) are then printed. The timestamps are expressed in seconds.
  11215. @end table
  11216. @end table
  11217. @subsection Examples
  11218. @itemize
  11219. @item
  11220. Benchmark @ref{selectivecolor} filter:
  11221. @example
  11222. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11223. @end example
  11224. @end itemize
  11225. @section concat
  11226. Concatenate audio and video streams, joining them together one after the
  11227. other.
  11228. The filter works on segments of synchronized video and audio streams. All
  11229. segments must have the same number of streams of each type, and that will
  11230. also be the number of streams at output.
  11231. The filter accepts the following options:
  11232. @table @option
  11233. @item n
  11234. Set the number of segments. Default is 2.
  11235. @item v
  11236. Set the number of output video streams, that is also the number of video
  11237. streams in each segment. Default is 1.
  11238. @item a
  11239. Set the number of output audio streams, that is also the number of audio
  11240. streams in each segment. Default is 0.
  11241. @item unsafe
  11242. Activate unsafe mode: do not fail if segments have a different format.
  11243. @end table
  11244. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11245. @var{a} audio outputs.
  11246. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11247. segment, in the same order as the outputs, then the inputs for the second
  11248. segment, etc.
  11249. Related streams do not always have exactly the same duration, for various
  11250. reasons including codec frame size or sloppy authoring. For that reason,
  11251. related synchronized streams (e.g. a video and its audio track) should be
  11252. concatenated at once. The concat filter will use the duration of the longest
  11253. stream in each segment (except the last one), and if necessary pad shorter
  11254. audio streams with silence.
  11255. For this filter to work correctly, all segments must start at timestamp 0.
  11256. All corresponding streams must have the same parameters in all segments; the
  11257. filtering system will automatically select a common pixel format for video
  11258. streams, and a common sample format, sample rate and channel layout for
  11259. audio streams, but other settings, such as resolution, must be converted
  11260. explicitly by the user.
  11261. Different frame rates are acceptable but will result in variable frame rate
  11262. at output; be sure to configure the output file to handle it.
  11263. @subsection Examples
  11264. @itemize
  11265. @item
  11266. Concatenate an opening, an episode and an ending, all in bilingual version
  11267. (video in stream 0, audio in streams 1 and 2):
  11268. @example
  11269. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11270. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11271. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11272. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11273. @end example
  11274. @item
  11275. Concatenate two parts, handling audio and video separately, using the
  11276. (a)movie sources, and adjusting the resolution:
  11277. @example
  11278. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11279. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11280. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11281. @end example
  11282. Note that a desync will happen at the stitch if the audio and video streams
  11283. do not have exactly the same duration in the first file.
  11284. @end itemize
  11285. @anchor{ebur128}
  11286. @section ebur128
  11287. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11288. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11289. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11290. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11291. The filter also has a video output (see the @var{video} option) with a real
  11292. time graph to observe the loudness evolution. The graphic contains the logged
  11293. message mentioned above, so it is not printed anymore when this option is set,
  11294. unless the verbose logging is set. The main graphing area contains the
  11295. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11296. the momentary loudness (400 milliseconds).
  11297. More information about the Loudness Recommendation EBU R128 on
  11298. @url{http://tech.ebu.ch/loudness}.
  11299. The filter accepts the following options:
  11300. @table @option
  11301. @item video
  11302. Activate the video output. The audio stream is passed unchanged whether this
  11303. option is set or no. The video stream will be the first output stream if
  11304. activated. Default is @code{0}.
  11305. @item size
  11306. Set the video size. This option is for video only. For the syntax of this
  11307. option, check the
  11308. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11309. Default and minimum resolution is @code{640x480}.
  11310. @item meter
  11311. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11312. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11313. other integer value between this range is allowed.
  11314. @item metadata
  11315. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11316. into 100ms output frames, each of them containing various loudness information
  11317. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11318. Default is @code{0}.
  11319. @item framelog
  11320. Force the frame logging level.
  11321. Available values are:
  11322. @table @samp
  11323. @item info
  11324. information logging level
  11325. @item verbose
  11326. verbose logging level
  11327. @end table
  11328. By default, the logging level is set to @var{info}. If the @option{video} or
  11329. the @option{metadata} options are set, it switches to @var{verbose}.
  11330. @item peak
  11331. Set peak mode(s).
  11332. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11333. values are:
  11334. @table @samp
  11335. @item none
  11336. Disable any peak mode (default).
  11337. @item sample
  11338. Enable sample-peak mode.
  11339. Simple peak mode looking for the higher sample value. It logs a message
  11340. for sample-peak (identified by @code{SPK}).
  11341. @item true
  11342. Enable true-peak mode.
  11343. If enabled, the peak lookup is done on an over-sampled version of the input
  11344. stream for better peak accuracy. It logs a message for true-peak.
  11345. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11346. This mode requires a build with @code{libswresample}.
  11347. @end table
  11348. @item dualmono
  11349. Treat mono input files as "dual mono". If a mono file is intended for playback
  11350. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11351. If set to @code{true}, this option will compensate for this effect.
  11352. Multi-channel input files are not affected by this option.
  11353. @item panlaw
  11354. Set a specific pan law to be used for the measurement of dual mono files.
  11355. This parameter is optional, and has a default value of -3.01dB.
  11356. @end table
  11357. @subsection Examples
  11358. @itemize
  11359. @item
  11360. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11361. @example
  11362. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11363. @end example
  11364. @item
  11365. Run an analysis with @command{ffmpeg}:
  11366. @example
  11367. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11368. @end example
  11369. @end itemize
  11370. @section interleave, ainterleave
  11371. Temporally interleave frames from several inputs.
  11372. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11373. These filters read frames from several inputs and send the oldest
  11374. queued frame to the output.
  11375. Input streams must have a well defined, monotonically increasing frame
  11376. timestamp values.
  11377. In order to submit one frame to output, these filters need to enqueue
  11378. at least one frame for each input, so they cannot work in case one
  11379. input is not yet terminated and will not receive incoming frames.
  11380. For example consider the case when one input is a @code{select} filter
  11381. which always drop input frames. The @code{interleave} filter will keep
  11382. reading from that input, but it will never be able to send new frames
  11383. to output until the input will send an end-of-stream signal.
  11384. Also, depending on inputs synchronization, the filters will drop
  11385. frames in case one input receives more frames than the other ones, and
  11386. the queue is already filled.
  11387. These filters accept the following options:
  11388. @table @option
  11389. @item nb_inputs, n
  11390. Set the number of different inputs, it is 2 by default.
  11391. @end table
  11392. @subsection Examples
  11393. @itemize
  11394. @item
  11395. Interleave frames belonging to different streams using @command{ffmpeg}:
  11396. @example
  11397. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11398. @end example
  11399. @item
  11400. Add flickering blur effect:
  11401. @example
  11402. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11403. @end example
  11404. @end itemize
  11405. @section perms, aperms
  11406. Set read/write permissions for the output frames.
  11407. These filters are mainly aimed at developers to test direct path in the
  11408. following filter in the filtergraph.
  11409. The filters accept the following options:
  11410. @table @option
  11411. @item mode
  11412. Select the permissions mode.
  11413. It accepts the following values:
  11414. @table @samp
  11415. @item none
  11416. Do nothing. This is the default.
  11417. @item ro
  11418. Set all the output frames read-only.
  11419. @item rw
  11420. Set all the output frames directly writable.
  11421. @item toggle
  11422. Make the frame read-only if writable, and writable if read-only.
  11423. @item random
  11424. Set each output frame read-only or writable randomly.
  11425. @end table
  11426. @item seed
  11427. Set the seed for the @var{random} mode, must be an integer included between
  11428. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11429. @code{-1}, the filter will try to use a good random seed on a best effort
  11430. basis.
  11431. @end table
  11432. Note: in case of auto-inserted filter between the permission filter and the
  11433. following one, the permission might not be received as expected in that
  11434. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11435. perms/aperms filter can avoid this problem.
  11436. @section realtime, arealtime
  11437. Slow down filtering to match real time approximatively.
  11438. These filters will pause the filtering for a variable amount of time to
  11439. match the output rate with the input timestamps.
  11440. They are similar to the @option{re} option to @code{ffmpeg}.
  11441. They accept the following options:
  11442. @table @option
  11443. @item limit
  11444. Time limit for the pauses. Any pause longer than that will be considered
  11445. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11446. @end table
  11447. @section select, aselect
  11448. Select frames to pass in output.
  11449. This filter accepts the following options:
  11450. @table @option
  11451. @item expr, e
  11452. Set expression, which is evaluated for each input frame.
  11453. If the expression is evaluated to zero, the frame is discarded.
  11454. If the evaluation result is negative or NaN, the frame is sent to the
  11455. first output; otherwise it is sent to the output with index
  11456. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11457. For example a value of @code{1.2} corresponds to the output with index
  11458. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11459. @item outputs, n
  11460. Set the number of outputs. The output to which to send the selected
  11461. frame is based on the result of the evaluation. Default value is 1.
  11462. @end table
  11463. The expression can contain the following constants:
  11464. @table @option
  11465. @item n
  11466. The (sequential) number of the filtered frame, starting from 0.
  11467. @item selected_n
  11468. The (sequential) number of the selected frame, starting from 0.
  11469. @item prev_selected_n
  11470. The sequential number of the last selected frame. It's NAN if undefined.
  11471. @item TB
  11472. The timebase of the input timestamps.
  11473. @item pts
  11474. The PTS (Presentation TimeStamp) of the filtered video frame,
  11475. expressed in @var{TB} units. It's NAN if undefined.
  11476. @item t
  11477. The PTS of the filtered video frame,
  11478. expressed in seconds. It's NAN if undefined.
  11479. @item prev_pts
  11480. The PTS of the previously filtered video frame. It's NAN if undefined.
  11481. @item prev_selected_pts
  11482. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11483. @item prev_selected_t
  11484. The PTS of the last previously selected video frame. It's NAN if undefined.
  11485. @item start_pts
  11486. The PTS of the first video frame in the video. It's NAN if undefined.
  11487. @item start_t
  11488. The time of the first video frame in the video. It's NAN if undefined.
  11489. @item pict_type @emph{(video only)}
  11490. The type of the filtered frame. It can assume one of the following
  11491. values:
  11492. @table @option
  11493. @item I
  11494. @item P
  11495. @item B
  11496. @item S
  11497. @item SI
  11498. @item SP
  11499. @item BI
  11500. @end table
  11501. @item interlace_type @emph{(video only)}
  11502. The frame interlace type. It can assume one of the following values:
  11503. @table @option
  11504. @item PROGRESSIVE
  11505. The frame is progressive (not interlaced).
  11506. @item TOPFIRST
  11507. The frame is top-field-first.
  11508. @item BOTTOMFIRST
  11509. The frame is bottom-field-first.
  11510. @end table
  11511. @item consumed_sample_n @emph{(audio only)}
  11512. the number of selected samples before the current frame
  11513. @item samples_n @emph{(audio only)}
  11514. the number of samples in the current frame
  11515. @item sample_rate @emph{(audio only)}
  11516. the input sample rate
  11517. @item key
  11518. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11519. @item pos
  11520. the position in the file of the filtered frame, -1 if the information
  11521. is not available (e.g. for synthetic video)
  11522. @item scene @emph{(video only)}
  11523. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11524. probability for the current frame to introduce a new scene, while a higher
  11525. value means the current frame is more likely to be one (see the example below)
  11526. @item concatdec_select
  11527. The concat demuxer can select only part of a concat input file by setting an
  11528. inpoint and an outpoint, but the output packets may not be entirely contained
  11529. in the selected interval. By using this variable, it is possible to skip frames
  11530. generated by the concat demuxer which are not exactly contained in the selected
  11531. interval.
  11532. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11533. and the @var{lavf.concat.duration} packet metadata values which are also
  11534. present in the decoded frames.
  11535. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11536. start_time and either the duration metadata is missing or the frame pts is less
  11537. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11538. missing.
  11539. That basically means that an input frame is selected if its pts is within the
  11540. interval set by the concat demuxer.
  11541. @end table
  11542. The default value of the select expression is "1".
  11543. @subsection Examples
  11544. @itemize
  11545. @item
  11546. Select all frames in input:
  11547. @example
  11548. select
  11549. @end example
  11550. The example above is the same as:
  11551. @example
  11552. select=1
  11553. @end example
  11554. @item
  11555. Skip all frames:
  11556. @example
  11557. select=0
  11558. @end example
  11559. @item
  11560. Select only I-frames:
  11561. @example
  11562. select='eq(pict_type\,I)'
  11563. @end example
  11564. @item
  11565. Select one frame every 100:
  11566. @example
  11567. select='not(mod(n\,100))'
  11568. @end example
  11569. @item
  11570. Select only frames contained in the 10-20 time interval:
  11571. @example
  11572. select=between(t\,10\,20)
  11573. @end example
  11574. @item
  11575. Select only I frames contained in the 10-20 time interval:
  11576. @example
  11577. select=between(t\,10\,20)*eq(pict_type\,I)
  11578. @end example
  11579. @item
  11580. Select frames with a minimum distance of 10 seconds:
  11581. @example
  11582. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11583. @end example
  11584. @item
  11585. Use aselect to select only audio frames with samples number > 100:
  11586. @example
  11587. aselect='gt(samples_n\,100)'
  11588. @end example
  11589. @item
  11590. Create a mosaic of the first scenes:
  11591. @example
  11592. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11593. @end example
  11594. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11595. choice.
  11596. @item
  11597. Send even and odd frames to separate outputs, and compose them:
  11598. @example
  11599. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11600. @end example
  11601. @item
  11602. Select useful frames from an ffconcat file which is using inpoints and
  11603. outpoints but where the source files are not intra frame only.
  11604. @example
  11605. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11606. @end example
  11607. @end itemize
  11608. @section sendcmd, asendcmd
  11609. Send commands to filters in the filtergraph.
  11610. These filters read commands to be sent to other filters in the
  11611. filtergraph.
  11612. @code{sendcmd} must be inserted between two video filters,
  11613. @code{asendcmd} must be inserted between two audio filters, but apart
  11614. from that they act the same way.
  11615. The specification of commands can be provided in the filter arguments
  11616. with the @var{commands} option, or in a file specified by the
  11617. @var{filename} option.
  11618. These filters accept the following options:
  11619. @table @option
  11620. @item commands, c
  11621. Set the commands to be read and sent to the other filters.
  11622. @item filename, f
  11623. Set the filename of the commands to be read and sent to the other
  11624. filters.
  11625. @end table
  11626. @subsection Commands syntax
  11627. A commands description consists of a sequence of interval
  11628. specifications, comprising a list of commands to be executed when a
  11629. particular event related to that interval occurs. The occurring event
  11630. is typically the current frame time entering or leaving a given time
  11631. interval.
  11632. An interval is specified by the following syntax:
  11633. @example
  11634. @var{START}[-@var{END}] @var{COMMANDS};
  11635. @end example
  11636. The time interval is specified by the @var{START} and @var{END} times.
  11637. @var{END} is optional and defaults to the maximum time.
  11638. The current frame time is considered within the specified interval if
  11639. it is included in the interval [@var{START}, @var{END}), that is when
  11640. the time is greater or equal to @var{START} and is lesser than
  11641. @var{END}.
  11642. @var{COMMANDS} consists of a sequence of one or more command
  11643. specifications, separated by ",", relating to that interval. The
  11644. syntax of a command specification is given by:
  11645. @example
  11646. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11647. @end example
  11648. @var{FLAGS} is optional and specifies the type of events relating to
  11649. the time interval which enable sending the specified command, and must
  11650. be a non-null sequence of identifier flags separated by "+" or "|" and
  11651. enclosed between "[" and "]".
  11652. The following flags are recognized:
  11653. @table @option
  11654. @item enter
  11655. The command is sent when the current frame timestamp enters the
  11656. specified interval. In other words, the command is sent when the
  11657. previous frame timestamp was not in the given interval, and the
  11658. current is.
  11659. @item leave
  11660. The command is sent when the current frame timestamp leaves the
  11661. specified interval. In other words, the command is sent when the
  11662. previous frame timestamp was in the given interval, and the
  11663. current is not.
  11664. @end table
  11665. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  11666. assumed.
  11667. @var{TARGET} specifies the target of the command, usually the name of
  11668. the filter class or a specific filter instance name.
  11669. @var{COMMAND} specifies the name of the command for the target filter.
  11670. @var{ARG} is optional and specifies the optional list of argument for
  11671. the given @var{COMMAND}.
  11672. Between one interval specification and another, whitespaces, or
  11673. sequences of characters starting with @code{#} until the end of line,
  11674. are ignored and can be used to annotate comments.
  11675. A simplified BNF description of the commands specification syntax
  11676. follows:
  11677. @example
  11678. @var{COMMAND_FLAG} ::= "enter" | "leave"
  11679. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  11680. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  11681. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  11682. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  11683. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  11684. @end example
  11685. @subsection Examples
  11686. @itemize
  11687. @item
  11688. Specify audio tempo change at second 4:
  11689. @example
  11690. asendcmd=c='4.0 atempo tempo 1.5',atempo
  11691. @end example
  11692. @item
  11693. Specify a list of drawtext and hue commands in a file.
  11694. @example
  11695. # show text in the interval 5-10
  11696. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  11697. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  11698. # desaturate the image in the interval 15-20
  11699. 15.0-20.0 [enter] hue s 0,
  11700. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  11701. [leave] hue s 1,
  11702. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  11703. # apply an exponential saturation fade-out effect, starting from time 25
  11704. 25 [enter] hue s exp(25-t)
  11705. @end example
  11706. A filtergraph allowing to read and process the above command list
  11707. stored in a file @file{test.cmd}, can be specified with:
  11708. @example
  11709. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  11710. @end example
  11711. @end itemize
  11712. @anchor{setpts}
  11713. @section setpts, asetpts
  11714. Change the PTS (presentation timestamp) of the input frames.
  11715. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  11716. This filter accepts the following options:
  11717. @table @option
  11718. @item expr
  11719. The expression which is evaluated for each frame to construct its timestamp.
  11720. @end table
  11721. The expression is evaluated through the eval API and can contain the following
  11722. constants:
  11723. @table @option
  11724. @item FRAME_RATE
  11725. frame rate, only defined for constant frame-rate video
  11726. @item PTS
  11727. The presentation timestamp in input
  11728. @item N
  11729. The count of the input frame for video or the number of consumed samples,
  11730. not including the current frame for audio, starting from 0.
  11731. @item NB_CONSUMED_SAMPLES
  11732. The number of consumed samples, not including the current frame (only
  11733. audio)
  11734. @item NB_SAMPLES, S
  11735. The number of samples in the current frame (only audio)
  11736. @item SAMPLE_RATE, SR
  11737. The audio sample rate.
  11738. @item STARTPTS
  11739. The PTS of the first frame.
  11740. @item STARTT
  11741. the time in seconds of the first frame
  11742. @item INTERLACED
  11743. State whether the current frame is interlaced.
  11744. @item T
  11745. the time in seconds of the current frame
  11746. @item POS
  11747. original position in the file of the frame, or undefined if undefined
  11748. for the current frame
  11749. @item PREV_INPTS
  11750. The previous input PTS.
  11751. @item PREV_INT
  11752. previous input time in seconds
  11753. @item PREV_OUTPTS
  11754. The previous output PTS.
  11755. @item PREV_OUTT
  11756. previous output time in seconds
  11757. @item RTCTIME
  11758. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  11759. instead.
  11760. @item RTCSTART
  11761. The wallclock (RTC) time at the start of the movie in microseconds.
  11762. @item TB
  11763. The timebase of the input timestamps.
  11764. @end table
  11765. @subsection Examples
  11766. @itemize
  11767. @item
  11768. Start counting PTS from zero
  11769. @example
  11770. setpts=PTS-STARTPTS
  11771. @end example
  11772. @item
  11773. Apply fast motion effect:
  11774. @example
  11775. setpts=0.5*PTS
  11776. @end example
  11777. @item
  11778. Apply slow motion effect:
  11779. @example
  11780. setpts=2.0*PTS
  11781. @end example
  11782. @item
  11783. Set fixed rate of 25 frames per second:
  11784. @example
  11785. setpts=N/(25*TB)
  11786. @end example
  11787. @item
  11788. Set fixed rate 25 fps with some jitter:
  11789. @example
  11790. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  11791. @end example
  11792. @item
  11793. Apply an offset of 10 seconds to the input PTS:
  11794. @example
  11795. setpts=PTS+10/TB
  11796. @end example
  11797. @item
  11798. Generate timestamps from a "live source" and rebase onto the current timebase:
  11799. @example
  11800. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  11801. @end example
  11802. @item
  11803. Generate timestamps by counting samples:
  11804. @example
  11805. asetpts=N/SR/TB
  11806. @end example
  11807. @end itemize
  11808. @section settb, asettb
  11809. Set the timebase to use for the output frames timestamps.
  11810. It is mainly useful for testing timebase configuration.
  11811. It accepts the following parameters:
  11812. @table @option
  11813. @item expr, tb
  11814. The expression which is evaluated into the output timebase.
  11815. @end table
  11816. The value for @option{tb} is an arithmetic expression representing a
  11817. rational. The expression can contain the constants "AVTB" (the default
  11818. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  11819. audio only). Default value is "intb".
  11820. @subsection Examples
  11821. @itemize
  11822. @item
  11823. Set the timebase to 1/25:
  11824. @example
  11825. settb=expr=1/25
  11826. @end example
  11827. @item
  11828. Set the timebase to 1/10:
  11829. @example
  11830. settb=expr=0.1
  11831. @end example
  11832. @item
  11833. Set the timebase to 1001/1000:
  11834. @example
  11835. settb=1+0.001
  11836. @end example
  11837. @item
  11838. Set the timebase to 2*intb:
  11839. @example
  11840. settb=2*intb
  11841. @end example
  11842. @item
  11843. Set the default timebase value:
  11844. @example
  11845. settb=AVTB
  11846. @end example
  11847. @end itemize
  11848. @section showcqt
  11849. Convert input audio to a video output representing frequency spectrum
  11850. logarithmically using Brown-Puckette constant Q transform algorithm with
  11851. direct frequency domain coefficient calculation (but the transform itself
  11852. is not really constant Q, instead the Q factor is actually variable/clamped),
  11853. with musical tone scale, from E0 to D#10.
  11854. The filter accepts the following options:
  11855. @table @option
  11856. @item size, s
  11857. Specify the video size for the output. It must be even. For the syntax of this option,
  11858. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11859. Default value is @code{1920x1080}.
  11860. @item fps, rate, r
  11861. Set the output frame rate. Default value is @code{25}.
  11862. @item bar_h
  11863. Set the bargraph height. It must be even. Default value is @code{-1} which
  11864. computes the bargraph height automatically.
  11865. @item axis_h
  11866. Set the axis height. It must be even. Default value is @code{-1} which computes
  11867. the axis height automatically.
  11868. @item sono_h
  11869. Set the sonogram height. It must be even. Default value is @code{-1} which
  11870. computes the sonogram height automatically.
  11871. @item fullhd
  11872. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  11873. instead. Default value is @code{1}.
  11874. @item sono_v, volume
  11875. Specify the sonogram volume expression. It can contain variables:
  11876. @table @option
  11877. @item bar_v
  11878. the @var{bar_v} evaluated expression
  11879. @item frequency, freq, f
  11880. the frequency where it is evaluated
  11881. @item timeclamp, tc
  11882. the value of @var{timeclamp} option
  11883. @end table
  11884. and functions:
  11885. @table @option
  11886. @item a_weighting(f)
  11887. A-weighting of equal loudness
  11888. @item b_weighting(f)
  11889. B-weighting of equal loudness
  11890. @item c_weighting(f)
  11891. C-weighting of equal loudness.
  11892. @end table
  11893. Default value is @code{16}.
  11894. @item bar_v, volume2
  11895. Specify the bargraph volume expression. It can contain variables:
  11896. @table @option
  11897. @item sono_v
  11898. the @var{sono_v} evaluated expression
  11899. @item frequency, freq, f
  11900. the frequency where it is evaluated
  11901. @item timeclamp, tc
  11902. the value of @var{timeclamp} option
  11903. @end table
  11904. and functions:
  11905. @table @option
  11906. @item a_weighting(f)
  11907. A-weighting of equal loudness
  11908. @item b_weighting(f)
  11909. B-weighting of equal loudness
  11910. @item c_weighting(f)
  11911. C-weighting of equal loudness.
  11912. @end table
  11913. Default value is @code{sono_v}.
  11914. @item sono_g, gamma
  11915. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  11916. higher gamma makes the spectrum having more range. Default value is @code{3}.
  11917. Acceptable range is @code{[1, 7]}.
  11918. @item bar_g, gamma2
  11919. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  11920. @code{[1, 7]}.
  11921. @item timeclamp, tc
  11922. Specify the transform timeclamp. At low frequency, there is trade-off between
  11923. accuracy in time domain and frequency domain. If timeclamp is lower,
  11924. event in time domain is represented more accurately (such as fast bass drum),
  11925. otherwise event in frequency domain is represented more accurately
  11926. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  11927. @item basefreq
  11928. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  11929. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  11930. @item endfreq
  11931. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  11932. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  11933. @item coeffclamp
  11934. This option is deprecated and ignored.
  11935. @item tlength
  11936. Specify the transform length in time domain. Use this option to control accuracy
  11937. trade-off between time domain and frequency domain at every frequency sample.
  11938. It can contain variables:
  11939. @table @option
  11940. @item frequency, freq, f
  11941. the frequency where it is evaluated
  11942. @item timeclamp, tc
  11943. the value of @var{timeclamp} option.
  11944. @end table
  11945. Default value is @code{384*tc/(384+tc*f)}.
  11946. @item count
  11947. Specify the transform count for every video frame. Default value is @code{6}.
  11948. Acceptable range is @code{[1, 30]}.
  11949. @item fcount
  11950. Specify the transform count for every single pixel. Default value is @code{0},
  11951. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  11952. @item fontfile
  11953. Specify font file for use with freetype to draw the axis. If not specified,
  11954. use embedded font. Note that drawing with font file or embedded font is not
  11955. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  11956. option instead.
  11957. @item fontcolor
  11958. Specify font color expression. This is arithmetic expression that should return
  11959. integer value 0xRRGGBB. It can contain variables:
  11960. @table @option
  11961. @item frequency, freq, f
  11962. the frequency where it is evaluated
  11963. @item timeclamp, tc
  11964. the value of @var{timeclamp} option
  11965. @end table
  11966. and functions:
  11967. @table @option
  11968. @item midi(f)
  11969. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  11970. @item r(x), g(x), b(x)
  11971. red, green, and blue value of intensity x.
  11972. @end table
  11973. Default value is @code{st(0, (midi(f)-59.5)/12);
  11974. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  11975. r(1-ld(1)) + b(ld(1))}.
  11976. @item axisfile
  11977. Specify image file to draw the axis. This option override @var{fontfile} and
  11978. @var{fontcolor} option.
  11979. @item axis, text
  11980. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  11981. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  11982. Default value is @code{1}.
  11983. @end table
  11984. @subsection Examples
  11985. @itemize
  11986. @item
  11987. Playing audio while showing the spectrum:
  11988. @example
  11989. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  11990. @end example
  11991. @item
  11992. Same as above, but with frame rate 30 fps:
  11993. @example
  11994. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  11995. @end example
  11996. @item
  11997. Playing at 1280x720:
  11998. @example
  11999. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12000. @end example
  12001. @item
  12002. Disable sonogram display:
  12003. @example
  12004. sono_h=0
  12005. @end example
  12006. @item
  12007. A1 and its harmonics: A1, A2, (near)E3, A3:
  12008. @example
  12009. 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),
  12010. asplit[a][out1]; [a] showcqt [out0]'
  12011. @end example
  12012. @item
  12013. Same as above, but with more accuracy in frequency domain:
  12014. @example
  12015. 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),
  12016. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12017. @end example
  12018. @item
  12019. Custom volume:
  12020. @example
  12021. bar_v=10:sono_v=bar_v*a_weighting(f)
  12022. @end example
  12023. @item
  12024. Custom gamma, now spectrum is linear to the amplitude.
  12025. @example
  12026. bar_g=2:sono_g=2
  12027. @end example
  12028. @item
  12029. Custom tlength equation:
  12030. @example
  12031. 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)))'
  12032. @end example
  12033. @item
  12034. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12035. @example
  12036. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12037. @end example
  12038. @item
  12039. Custom frequency range with custom axis using image file:
  12040. @example
  12041. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12042. @end example
  12043. @end itemize
  12044. @section showfreqs
  12045. Convert input audio to video output representing the audio power spectrum.
  12046. Audio amplitude is on Y-axis while frequency is on X-axis.
  12047. The filter accepts the following options:
  12048. @table @option
  12049. @item size, s
  12050. Specify size of video. For the syntax of this option, check the
  12051. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12052. Default is @code{1024x512}.
  12053. @item mode
  12054. Set display mode.
  12055. This set how each frequency bin will be represented.
  12056. It accepts the following values:
  12057. @table @samp
  12058. @item line
  12059. @item bar
  12060. @item dot
  12061. @end table
  12062. Default is @code{bar}.
  12063. @item ascale
  12064. Set amplitude scale.
  12065. It accepts the following values:
  12066. @table @samp
  12067. @item lin
  12068. Linear scale.
  12069. @item sqrt
  12070. Square root scale.
  12071. @item cbrt
  12072. Cubic root scale.
  12073. @item log
  12074. Logarithmic scale.
  12075. @end table
  12076. Default is @code{log}.
  12077. @item fscale
  12078. Set frequency scale.
  12079. It accepts the following values:
  12080. @table @samp
  12081. @item lin
  12082. Linear scale.
  12083. @item log
  12084. Logarithmic scale.
  12085. @item rlog
  12086. Reverse logarithmic scale.
  12087. @end table
  12088. Default is @code{lin}.
  12089. @item win_size
  12090. Set window size.
  12091. It accepts the following values:
  12092. @table @samp
  12093. @item w16
  12094. @item w32
  12095. @item w64
  12096. @item w128
  12097. @item w256
  12098. @item w512
  12099. @item w1024
  12100. @item w2048
  12101. @item w4096
  12102. @item w8192
  12103. @item w16384
  12104. @item w32768
  12105. @item w65536
  12106. @end table
  12107. Default is @code{w2048}
  12108. @item win_func
  12109. Set windowing function.
  12110. It accepts the following values:
  12111. @table @samp
  12112. @item rect
  12113. @item bartlett
  12114. @item hanning
  12115. @item hamming
  12116. @item blackman
  12117. @item welch
  12118. @item flattop
  12119. @item bharris
  12120. @item bnuttall
  12121. @item bhann
  12122. @item sine
  12123. @item nuttall
  12124. @item lanczos
  12125. @item gauss
  12126. @item tukey
  12127. @end table
  12128. Default is @code{hanning}.
  12129. @item overlap
  12130. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12131. which means optimal overlap for selected window function will be picked.
  12132. @item averaging
  12133. Set time averaging. Setting this to 0 will display current maximal peaks.
  12134. Default is @code{1}, which means time averaging is disabled.
  12135. @item colors
  12136. Specify list of colors separated by space or by '|' which will be used to
  12137. draw channel frequencies. Unrecognized or missing colors will be replaced
  12138. by white color.
  12139. @item cmode
  12140. Set channel display mode.
  12141. It accepts the following values:
  12142. @table @samp
  12143. @item combined
  12144. @item separate
  12145. @end table
  12146. Default is @code{combined}.
  12147. @end table
  12148. @anchor{showspectrum}
  12149. @section showspectrum
  12150. Convert input audio to a video output, representing the audio frequency
  12151. spectrum.
  12152. The filter accepts the following options:
  12153. @table @option
  12154. @item size, s
  12155. Specify the video size for the output. For the syntax of this option, check the
  12156. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12157. Default value is @code{640x512}.
  12158. @item slide
  12159. Specify how the spectrum should slide along the window.
  12160. It accepts the following values:
  12161. @table @samp
  12162. @item replace
  12163. the samples start again on the left when they reach the right
  12164. @item scroll
  12165. the samples scroll from right to left
  12166. @item rscroll
  12167. the samples scroll from left to right
  12168. @item fullframe
  12169. frames are only produced when the samples reach the right
  12170. @end table
  12171. Default value is @code{replace}.
  12172. @item mode
  12173. Specify display mode.
  12174. It accepts the following values:
  12175. @table @samp
  12176. @item combined
  12177. all channels are displayed in the same row
  12178. @item separate
  12179. all channels are displayed in separate rows
  12180. @end table
  12181. Default value is @samp{combined}.
  12182. @item color
  12183. Specify display color mode.
  12184. It accepts the following values:
  12185. @table @samp
  12186. @item channel
  12187. each channel is displayed in a separate color
  12188. @item intensity
  12189. each channel is displayed using the same color scheme
  12190. @item rainbow
  12191. each channel is displayed using the rainbow color scheme
  12192. @item moreland
  12193. each channel is displayed using the moreland color scheme
  12194. @item nebulae
  12195. each channel is displayed using the nebulae color scheme
  12196. @item fire
  12197. each channel is displayed using the fire color scheme
  12198. @item fiery
  12199. each channel is displayed using the fiery color scheme
  12200. @item fruit
  12201. each channel is displayed using the fruit color scheme
  12202. @item cool
  12203. each channel is displayed using the cool color scheme
  12204. @end table
  12205. Default value is @samp{channel}.
  12206. @item scale
  12207. Specify scale used for calculating intensity color values.
  12208. It accepts the following values:
  12209. @table @samp
  12210. @item lin
  12211. linear
  12212. @item sqrt
  12213. square root, default
  12214. @item cbrt
  12215. cubic root
  12216. @item 4thrt
  12217. 4th root
  12218. @item 5thrt
  12219. 5th root
  12220. @item log
  12221. logarithmic
  12222. @end table
  12223. Default value is @samp{sqrt}.
  12224. @item saturation
  12225. Set saturation modifier for displayed colors. Negative values provide
  12226. alternative color scheme. @code{0} is no saturation at all.
  12227. Saturation must be in [-10.0, 10.0] range.
  12228. Default value is @code{1}.
  12229. @item win_func
  12230. Set window function.
  12231. It accepts the following values:
  12232. @table @samp
  12233. @item rect
  12234. @item bartlett
  12235. @item hann
  12236. @item hanning
  12237. @item hamming
  12238. @item blackman
  12239. @item welch
  12240. @item flattop
  12241. @item bharris
  12242. @item bnuttall
  12243. @item bhann
  12244. @item sine
  12245. @item nuttall
  12246. @item lanczos
  12247. @item gauss
  12248. @item tukey
  12249. @end table
  12250. Default value is @code{hann}.
  12251. @item orientation
  12252. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12253. @code{horizontal}. Default is @code{vertical}.
  12254. @item overlap
  12255. Set ratio of overlap window. Default value is @code{0}.
  12256. When value is @code{1} overlap is set to recommended size for specific
  12257. window function currently used.
  12258. @item gain
  12259. Set scale gain for calculating intensity color values.
  12260. Default value is @code{1}.
  12261. @item data
  12262. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12263. @end table
  12264. The usage is very similar to the showwaves filter; see the examples in that
  12265. section.
  12266. @subsection Examples
  12267. @itemize
  12268. @item
  12269. Large window with logarithmic color scaling:
  12270. @example
  12271. showspectrum=s=1280x480:scale=log
  12272. @end example
  12273. @item
  12274. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12275. @example
  12276. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12277. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12278. @end example
  12279. @end itemize
  12280. @section showspectrumpic
  12281. Convert input audio to a single video frame, representing the audio frequency
  12282. spectrum.
  12283. The filter accepts the following options:
  12284. @table @option
  12285. @item size, s
  12286. Specify the video size for the output. For the syntax of this option, check the
  12287. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12288. Default value is @code{4096x2048}.
  12289. @item mode
  12290. Specify display mode.
  12291. It accepts the following values:
  12292. @table @samp
  12293. @item combined
  12294. all channels are displayed in the same row
  12295. @item separate
  12296. all channels are displayed in separate rows
  12297. @end table
  12298. Default value is @samp{combined}.
  12299. @item color
  12300. Specify display color mode.
  12301. It accepts the following values:
  12302. @table @samp
  12303. @item channel
  12304. each channel is displayed in a separate color
  12305. @item intensity
  12306. each channel is displayed using the same color scheme
  12307. @item rainbow
  12308. each channel is displayed using the rainbow color scheme
  12309. @item moreland
  12310. each channel is displayed using the moreland color scheme
  12311. @item nebulae
  12312. each channel is displayed using the nebulae color scheme
  12313. @item fire
  12314. each channel is displayed using the fire color scheme
  12315. @item fiery
  12316. each channel is displayed using the fiery color scheme
  12317. @item fruit
  12318. each channel is displayed using the fruit color scheme
  12319. @item cool
  12320. each channel is displayed using the cool color scheme
  12321. @end table
  12322. Default value is @samp{intensity}.
  12323. @item scale
  12324. Specify scale used for calculating intensity color values.
  12325. It accepts the following values:
  12326. @table @samp
  12327. @item lin
  12328. linear
  12329. @item sqrt
  12330. square root, default
  12331. @item cbrt
  12332. cubic root
  12333. @item 4thrt
  12334. 4th root
  12335. @item 5thrt
  12336. 5th root
  12337. @item log
  12338. logarithmic
  12339. @end table
  12340. Default value is @samp{log}.
  12341. @item saturation
  12342. Set saturation modifier for displayed colors. Negative values provide
  12343. alternative color scheme. @code{0} is no saturation at all.
  12344. Saturation must be in [-10.0, 10.0] range.
  12345. Default value is @code{1}.
  12346. @item win_func
  12347. Set window function.
  12348. It accepts the following values:
  12349. @table @samp
  12350. @item rect
  12351. @item bartlett
  12352. @item hann
  12353. @item hanning
  12354. @item hamming
  12355. @item blackman
  12356. @item welch
  12357. @item flattop
  12358. @item bharris
  12359. @item bnuttall
  12360. @item bhann
  12361. @item sine
  12362. @item nuttall
  12363. @item lanczos
  12364. @item gauss
  12365. @item tukey
  12366. @end table
  12367. Default value is @code{hann}.
  12368. @item orientation
  12369. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12370. @code{horizontal}. Default is @code{vertical}.
  12371. @item gain
  12372. Set scale gain for calculating intensity color values.
  12373. Default value is @code{1}.
  12374. @item legend
  12375. Draw time and frequency axes and legends. Default is enabled.
  12376. @end table
  12377. @subsection Examples
  12378. @itemize
  12379. @item
  12380. Extract an audio spectrogram of a whole audio track
  12381. in a 1024x1024 picture using @command{ffmpeg}:
  12382. @example
  12383. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12384. @end example
  12385. @end itemize
  12386. @section showvolume
  12387. Convert input audio volume to a video output.
  12388. The filter accepts the following options:
  12389. @table @option
  12390. @item rate, r
  12391. Set video rate.
  12392. @item b
  12393. Set border width, allowed range is [0, 5]. Default is 1.
  12394. @item w
  12395. Set channel width, allowed range is [80, 8192]. Default is 400.
  12396. @item h
  12397. Set channel height, allowed range is [1, 900]. Default is 20.
  12398. @item f
  12399. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12400. @item c
  12401. Set volume color expression.
  12402. The expression can use the following variables:
  12403. @table @option
  12404. @item VOLUME
  12405. Current max volume of channel in dB.
  12406. @item CHANNEL
  12407. Current channel number, starting from 0.
  12408. @end table
  12409. @item t
  12410. If set, displays channel names. Default is enabled.
  12411. @item v
  12412. If set, displays volume values. Default is enabled.
  12413. @item o
  12414. Set orientation, can be @code{horizontal} or @code{vertical},
  12415. default is @code{horizontal}.
  12416. @item s
  12417. Set step size, allowed range s [0, 5]. Default is 0, which means
  12418. step is disabled.
  12419. @end table
  12420. @section showwaves
  12421. Convert input audio to a video output, representing the samples waves.
  12422. The filter accepts the following options:
  12423. @table @option
  12424. @item size, s
  12425. Specify the video size for the output. For the syntax of this option, check the
  12426. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12427. Default value is @code{600x240}.
  12428. @item mode
  12429. Set display mode.
  12430. Available values are:
  12431. @table @samp
  12432. @item point
  12433. Draw a point for each sample.
  12434. @item line
  12435. Draw a vertical line for each sample.
  12436. @item p2p
  12437. Draw a point for each sample and a line between them.
  12438. @item cline
  12439. Draw a centered vertical line for each sample.
  12440. @end table
  12441. Default value is @code{point}.
  12442. @item n
  12443. Set the number of samples which are printed on the same column. A
  12444. larger value will decrease the frame rate. Must be a positive
  12445. integer. This option can be set only if the value for @var{rate}
  12446. is not explicitly specified.
  12447. @item rate, r
  12448. Set the (approximate) output frame rate. This is done by setting the
  12449. option @var{n}. Default value is "25".
  12450. @item split_channels
  12451. Set if channels should be drawn separately or overlap. Default value is 0.
  12452. @item colors
  12453. Set colors separated by '|' which are going to be used for drawing of each channel.
  12454. @item scale
  12455. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12456. Default is linear.
  12457. @end table
  12458. @subsection Examples
  12459. @itemize
  12460. @item
  12461. Output the input file audio and the corresponding video representation
  12462. at the same time:
  12463. @example
  12464. amovie=a.mp3,asplit[out0],showwaves[out1]
  12465. @end example
  12466. @item
  12467. Create a synthetic signal and show it with showwaves, forcing a
  12468. frame rate of 30 frames per second:
  12469. @example
  12470. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12471. @end example
  12472. @end itemize
  12473. @section showwavespic
  12474. Convert input audio to a single video frame, representing the samples waves.
  12475. The filter accepts the following options:
  12476. @table @option
  12477. @item size, s
  12478. Specify the video size for the output. For the syntax of this option, check the
  12479. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12480. Default value is @code{600x240}.
  12481. @item split_channels
  12482. Set if channels should be drawn separately or overlap. Default value is 0.
  12483. @item colors
  12484. Set colors separated by '|' which are going to be used for drawing of each channel.
  12485. @item scale
  12486. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12487. Default is linear.
  12488. @end table
  12489. @subsection Examples
  12490. @itemize
  12491. @item
  12492. Extract a channel split representation of the wave form of a whole audio track
  12493. in a 1024x800 picture using @command{ffmpeg}:
  12494. @example
  12495. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12496. @end example
  12497. @item
  12498. Colorize the waveform with colorchannelmixer. This example will make
  12499. the waveform a green color approximately RGB(66,217,150). Additional
  12500. channels will be shades of this color.
  12501. @example
  12502. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  12503. @end example
  12504. @end itemize
  12505. @section spectrumsynth
  12506. Sythesize audio from 2 input video spectrums, first input stream represents
  12507. magnitude across time and second represents phase across time.
  12508. The filter will transform from frequency domain as displayed in videos back
  12509. to time domain as presented in audio output.
  12510. This filter is primarly created for reversing processed @ref{showspectrum}
  12511. filter outputs, but can synthesize sound from other spectrograms too.
  12512. But in such case results are going to be poor if the phase data is not
  12513. available, because in such cases phase data need to be recreated, usually
  12514. its just recreated from random noise.
  12515. For best results use gray only output (@code{channel} color mode in
  12516. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12517. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12518. @code{data} option. Inputs videos should generally use @code{fullframe}
  12519. slide mode as that saves resources needed for decoding video.
  12520. The filter accepts the following options:
  12521. @table @option
  12522. @item sample_rate
  12523. Specify sample rate of output audio, the sample rate of audio from which
  12524. spectrum was generated may differ.
  12525. @item channels
  12526. Set number of channels represented in input video spectrums.
  12527. @item scale
  12528. Set scale which was used when generating magnitude input spectrum.
  12529. Can be @code{lin} or @code{log}. Default is @code{log}.
  12530. @item slide
  12531. Set slide which was used when generating inputs spectrums.
  12532. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12533. Default is @code{fullframe}.
  12534. @item win_func
  12535. Set window function used for resynthesis.
  12536. @item overlap
  12537. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12538. which means optimal overlap for selected window function will be picked.
  12539. @item orientation
  12540. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12541. Default is @code{vertical}.
  12542. @end table
  12543. @subsection Examples
  12544. @itemize
  12545. @item
  12546. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12547. then resynthesize videos back to audio with spectrumsynth:
  12548. @example
  12549. 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
  12550. 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
  12551. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12552. @end example
  12553. @end itemize
  12554. @section split, asplit
  12555. Split input into several identical outputs.
  12556. @code{asplit} works with audio input, @code{split} with video.
  12557. The filter accepts a single parameter which specifies the number of outputs. If
  12558. unspecified, it defaults to 2.
  12559. @subsection Examples
  12560. @itemize
  12561. @item
  12562. Create two separate outputs from the same input:
  12563. @example
  12564. [in] split [out0][out1]
  12565. @end example
  12566. @item
  12567. To create 3 or more outputs, you need to specify the number of
  12568. outputs, like in:
  12569. @example
  12570. [in] asplit=3 [out0][out1][out2]
  12571. @end example
  12572. @item
  12573. Create two separate outputs from the same input, one cropped and
  12574. one padded:
  12575. @example
  12576. [in] split [splitout1][splitout2];
  12577. [splitout1] crop=100:100:0:0 [cropout];
  12578. [splitout2] pad=200:200:100:100 [padout];
  12579. @end example
  12580. @item
  12581. Create 5 copies of the input audio with @command{ffmpeg}:
  12582. @example
  12583. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12584. @end example
  12585. @end itemize
  12586. @section zmq, azmq
  12587. Receive commands sent through a libzmq client, and forward them to
  12588. filters in the filtergraph.
  12589. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12590. must be inserted between two video filters, @code{azmq} between two
  12591. audio filters.
  12592. To enable these filters you need to install the libzmq library and
  12593. headers and configure FFmpeg with @code{--enable-libzmq}.
  12594. For more information about libzmq see:
  12595. @url{http://www.zeromq.org/}
  12596. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12597. receives messages sent through a network interface defined by the
  12598. @option{bind_address} option.
  12599. The received message must be in the form:
  12600. @example
  12601. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12602. @end example
  12603. @var{TARGET} specifies the target of the command, usually the name of
  12604. the filter class or a specific filter instance name.
  12605. @var{COMMAND} specifies the name of the command for the target filter.
  12606. @var{ARG} is optional and specifies the optional argument list for the
  12607. given @var{COMMAND}.
  12608. Upon reception, the message is processed and the corresponding command
  12609. is injected into the filtergraph. Depending on the result, the filter
  12610. will send a reply to the client, adopting the format:
  12611. @example
  12612. @var{ERROR_CODE} @var{ERROR_REASON}
  12613. @var{MESSAGE}
  12614. @end example
  12615. @var{MESSAGE} is optional.
  12616. @subsection Examples
  12617. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12618. be used to send commands processed by these filters.
  12619. Consider the following filtergraph generated by @command{ffplay}
  12620. @example
  12621. ffplay -dumpgraph 1 -f lavfi "
  12622. color=s=100x100:c=red [l];
  12623. color=s=100x100:c=blue [r];
  12624. nullsrc=s=200x100, zmq [bg];
  12625. [bg][l] overlay [bg+l];
  12626. [bg+l][r] overlay=x=100 "
  12627. @end example
  12628. To change the color of the left side of the video, the following
  12629. command can be used:
  12630. @example
  12631. echo Parsed_color_0 c yellow | tools/zmqsend
  12632. @end example
  12633. To change the right side:
  12634. @example
  12635. echo Parsed_color_1 c pink | tools/zmqsend
  12636. @end example
  12637. @c man end MULTIMEDIA FILTERS
  12638. @chapter Multimedia Sources
  12639. @c man begin MULTIMEDIA SOURCES
  12640. Below is a description of the currently available multimedia sources.
  12641. @section amovie
  12642. This is the same as @ref{movie} source, except it selects an audio
  12643. stream by default.
  12644. @anchor{movie}
  12645. @section movie
  12646. Read audio and/or video stream(s) from a movie container.
  12647. It accepts the following parameters:
  12648. @table @option
  12649. @item filename
  12650. The name of the resource to read (not necessarily a file; it can also be a
  12651. device or a stream accessed through some protocol).
  12652. @item format_name, f
  12653. Specifies the format assumed for the movie to read, and can be either
  12654. the name of a container or an input device. If not specified, the
  12655. format is guessed from @var{movie_name} or by probing.
  12656. @item seek_point, sp
  12657. Specifies the seek point in seconds. The frames will be output
  12658. starting from this seek point. The parameter is evaluated with
  12659. @code{av_strtod}, so the numerical value may be suffixed by an IS
  12660. postfix. The default value is "0".
  12661. @item streams, s
  12662. Specifies the streams to read. Several streams can be specified,
  12663. separated by "+". The source will then have as many outputs, in the
  12664. same order. The syntax is explained in the ``Stream specifiers''
  12665. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  12666. respectively the default (best suited) video and audio stream. Default
  12667. is "dv", or "da" if the filter is called as "amovie".
  12668. @item stream_index, si
  12669. Specifies the index of the video stream to read. If the value is -1,
  12670. the most suitable video stream will be automatically selected. The default
  12671. value is "-1". Deprecated. If the filter is called "amovie", it will select
  12672. audio instead of video.
  12673. @item loop
  12674. Specifies how many times to read the stream in sequence.
  12675. If the value is less than 1, the stream will be read again and again.
  12676. Default value is "1".
  12677. Note that when the movie is looped the source timestamps are not
  12678. changed, so it will generate non monotonically increasing timestamps.
  12679. @end table
  12680. It allows overlaying a second video on top of the main input of
  12681. a filtergraph, as shown in this graph:
  12682. @example
  12683. input -----------> deltapts0 --> overlay --> output
  12684. ^
  12685. |
  12686. movie --> scale--> deltapts1 -------+
  12687. @end example
  12688. @subsection Examples
  12689. @itemize
  12690. @item
  12691. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  12692. on top of the input labelled "in":
  12693. @example
  12694. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12695. [in] setpts=PTS-STARTPTS [main];
  12696. [main][over] overlay=16:16 [out]
  12697. @end example
  12698. @item
  12699. Read from a video4linux2 device, and overlay it on top of the input
  12700. labelled "in":
  12701. @example
  12702. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12703. [in] setpts=PTS-STARTPTS [main];
  12704. [main][over] overlay=16:16 [out]
  12705. @end example
  12706. @item
  12707. Read the first video stream and the audio stream with id 0x81 from
  12708. dvd.vob; the video is connected to the pad named "video" and the audio is
  12709. connected to the pad named "audio":
  12710. @example
  12711. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  12712. @end example
  12713. @end itemize
  12714. @c man end MULTIMEDIA SOURCES